@owox/web 0.14.0-next-20251201155939 → 0.14.0-next-20251202103155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{cssMode-D9TF1LHV.js → cssMode-SV3LkZxl.js} +1 -1
- package/dist/assets/{freemarker2-DqUk05MV.js → freemarker2-CxFgQ1qv.js} +1 -1
- package/dist/assets/{handlebars-DkSDsDsd.js → handlebars-BGKxT387.js} +1 -1
- package/dist/assets/{html-CX1Ba-zG.js → html-Dy2rlxNJ.js} +1 -1
- package/dist/assets/{htmlMode-BonALoV1.js → htmlMode-Dg66JQT7.js} +1 -1
- package/dist/assets/{index-CpSscIy9.js → index-jfUDZGPl.js} +4 -4
- package/dist/assets/{javascript-D6mAVD7m.js → javascript-CJzMD2IB.js} +1 -1
- package/dist/assets/{jsonMode-CtEgBKrb.js → jsonMode-BYOLXHGD.js} +1 -1
- package/dist/assets/{liquid-drE2VSI9.js → liquid-B6hlZhnN.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-C1ln_QQM.js → lspLanguageFeatures-D_32hsSa.js} +1 -1
- package/dist/assets/{mdx-C67NloL7.js → mdx-Ct4CZHnS.js} +1 -1
- package/dist/assets/{python-BBVOusE5.js → python-Dv7zLVcI.js} +1 -1
- package/dist/assets/{razor-coQ55R0C.js → razor-VFna7_Vy.js} +1 -1
- package/dist/assets/{tsMode-DSW0uCYz.js → tsMode-BH2YA4LN.js} +1 -1
- package/dist/assets/{typescript-DIAAd4bI.js → typescript-x36q2fbo.js} +1 -1
- package/dist/assets/{xml-BP9oj1kg.js → xml-Dx8dIreF.js} +1 -1
- package/dist/assets/{yaml-DPr6VzpH.js → yaml-CqG7IK-x.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/cssMode-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/cssMode-SV3LkZxl.js","assets/lspLanguageFeatures-D_32hsSa.js","assets/htmlMode-Dg66JQT7.js","assets/jsonMode-BYOLXHGD.js","assets/javascript-CJzMD2IB.js","assets/typescript-x36q2fbo.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var y6e=Object.defineProperty;var S6e=(n,e,t)=>e in n?y6e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Yn=(n,e,t)=>S6e(n,typeof e!="symbol"?e+"":e,t);function x6e(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in n)){const r=Object.getOwnPropertyDescriptor(i,s);r&&Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();function vSe(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var lU={exports:{}},aT={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -738,12 +738,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
738
738
|
`},Rct={onDragStart(n){let{active:e}=n;return"Picked up draggable item "+e.id+"."},onDragOver(n){let{active:e,over:t}=n;return t?"Draggable item "+e.id+" was moved over droppable area "+t.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(n){let{active:e,over:t}=n;return t?"Draggable item "+e.id+" was dropped over droppable area "+t.id:"Draggable item "+e.id+" was dropped."},onDragCancel(n){let{active:e}=n;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function Nct(n){let{announcements:e=Rct,container:t,hiddenTextDescribedById:i,screenReaderInstructions:s=Dct}=n;const{announce:r,announcement:o}=xct(),a=zM("DndLiveRegion"),[l,c]=x.useState(!1);if(x.useEffect(()=>{c(!0)},[]),Lct(x.useMemo(()=>({onDragStart(u){let{active:h}=u;r(e.onDragStart({active:h}))},onDragMove(u){let{active:h,over:g}=u;e.onDragMove&&r(e.onDragMove({active:h,over:g}))},onDragOver(u){let{active:h,over:g}=u;r(e.onDragOver({active:h,over:g}))},onDragEnd(u){let{active:h,over:g}=u;r(e.onDragEnd({active:h,over:g}))},onDragCancel(u){let{active:h,over:g}=u;r(e.onDragCancel({active:h,over:g}))}}),[r,e])),!l)return null;const d=nt.createElement(nt.Fragment,null,nt.createElement(yct,{id:i,value:s.draggable}),nt.createElement(Sct,{id:a,announcement:o}));return t?Rf.createPortal(d,t):d}var Ea;(function(n){n.DragStart="dragStart",n.DragMove="dragMove",n.DragEnd="dragEnd",n.DragCancel="dragCancel",n.DragOver="dragOver",n.RegisterDroppable="registerDroppable",n.SetDroppableDisabled="setDroppableDisabled",n.UnregisterDroppable="unregisterDroppable"})(Ea||(Ea={}));function VF(){}function jre(n,e){return x.useMemo(()=>({sensor:n,options:e??{}}),[n,e])}function Hre(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return x.useMemo(()=>[...e].filter(i=>i!=null),[...e])}const Uf=Object.freeze({x:0,y:0});function Tct(n,e){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))}function Ict(n,e){let{data:{value:t}}=n,{data:{value:i}}=e;return t-i}function kct(n,e){let{data:{value:t}}=n,{data:{value:i}}=e;return i-t}function Act(n,e){if(!n||n.length===0)return null;const[t]=n;return t[e]}function $me(n,e,t){return e===void 0&&(e=n.left),t===void 0&&(t=n.top),{x:e+n.width*.5,y:t+n.height*.5}}const Bre=n=>{let{collisionRect:e,droppableRects:t,droppableContainers:i}=n;const s=$me(e,e.left,e.top),r=[];for(const o of i){const{id:a}=o,l=t.get(a);if(l){const c=Tct($me(l),s);r.push({id:a,data:{droppableContainer:o,value:c}})}}return r.sort(Ict)};function Mct(n,e){const t=Math.max(e.top,n.top),i=Math.max(e.left,n.left),s=Math.min(e.left+e.width,n.left+n.width),r=Math.min(e.top+e.height,n.top+n.height),o=s-i,a=r-t;if(i<s&&t<r){const l=e.width*e.height,c=n.width*n.height,d=o*a,u=d/(l+c-d);return Number(u.toFixed(4))}return 0}const Oct=n=>{let{collisionRect:e,droppableRects:t,droppableContainers:i}=n;const s=[];for(const r of i){const{id:o}=r,a=t.get(o);if(a){const l=Mct(a,e);l>0&&s.push({id:o,data:{droppableContainer:r,value:l}})}}return s.sort(kct)};function Pct(n,e,t){return{...n,scaleX:e&&t?e.width/t.width:1,scaleY:e&&t?e.height/t.height:1}}function oIe(n,e){return n&&e?{x:n.left-e.left,y:n.top-e.top}:Uf}function Fct(n){return function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),r=1;r<i;r++)s[r-1]=arguments[r];return s.reduce((o,a)=>({...o,top:o.top+n*a.y,bottom:o.bottom+n*a.y,left:o.left+n*a.x,right:o.right+n*a.x}),{...t})}}const jct=Fct(1);function Hct(n){if(n.startsWith("matrix3d(")){const e=n.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(n.startsWith("matrix(")){const e=n.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function Bct(n,e,t){const i=Hct(e);if(!i)return n;const{scaleX:s,scaleY:r,x:o,y:a}=i,l=n.left-o-(1-s)*parseFloat(t),c=n.top-a-(1-r)*parseFloat(t.slice(t.indexOf(" ")+1)),d=s?n.width/s:n.width,u=r?n.height/r:n.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}const Vct={ignoreTransform:!1};function GR(n,e){e===void 0&&(e=Vct);let t=n.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=qd(n).getComputedStyle(n);c&&(t=Bct(t,c,d))}const{top:i,left:s,width:r,height:o,bottom:a,right:l}=t;return{top:i,left:s,width:r,height:o,bottom:a,right:l}}function Gme(n){return GR(n,{ignoreTransform:!0})}function Wct(n){const e=n.innerWidth,t=n.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}function zct(n,e){return e===void 0&&(e=qd(n).getComputedStyle(n)),e.position==="fixed"}function Uct(n,e){e===void 0&&(e=qd(n).getComputedStyle(n));const t=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const r=e[s];return typeof r=="string"?t.test(r):!1})}function Vre(n,e){const t=[];function i(s){if(e!=null&&t.length>=e||!s)return t;if(Ore(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!VM(s)||nIe(s)||t.includes(s))return t;const r=qd(n).getComputedStyle(s);return s!==n&&Uct(s,r)&&t.push(s),zct(s,r)?t:i(s.parentNode)}return n?i(n):t}function aIe(n){const[e]=Vre(n,1);return e??null}function a$(n){return!sB||!n?null:UR(n)?n:Mre(n)?Ore(n)||n===$R(n).scrollingElement?window:VM(n)?n:null:null}function lIe(n){return UR(n)?n.scrollX:n.scrollLeft}function cIe(n){return UR(n)?n.scrollY:n.scrollTop}function nZ(n){return{x:lIe(n),y:cIe(n)}}var Za;(function(n){n[n.Forward=1]="Forward",n[n.Backward=-1]="Backward"})(Za||(Za={}));function dIe(n){return!sB||!n?!1:n===document.scrollingElement}function uIe(n){const e={x:0,y:0},t=dIe(n)?{height:window.innerHeight,width:window.innerWidth}:{height:n.clientHeight,width:n.clientWidth},i={x:n.scrollWidth-t.width,y:n.scrollHeight-t.height},s=n.scrollTop<=e.y,r=n.scrollLeft<=e.x,o=n.scrollTop>=i.y,a=n.scrollLeft>=i.x;return{isTop:s,isLeft:r,isBottom:o,isRight:a,maxScroll:i,minScroll:e}}const $ct={x:.2,y:.2};function Gct(n,e,t,i,s){let{top:r,left:o,right:a,bottom:l}=t;i===void 0&&(i=10),s===void 0&&(s=$ct);const{isTop:c,isBottom:d,isLeft:u,isRight:h}=uIe(n),g={x:0,y:0},m={x:0,y:0},b={height:e.height*s.y,width:e.width*s.x};return!c&&r<=e.top+b.height?(g.y=Za.Backward,m.y=i*Math.abs((e.top+b.height-r)/b.height)):!d&&l>=e.bottom-b.height&&(g.y=Za.Forward,m.y=i*Math.abs((e.bottom-b.height-l)/b.height)),!h&&a>=e.right-b.width?(g.x=Za.Forward,m.x=i*Math.abs((e.right-b.width-a)/b.width)):!u&&o<=e.left+b.width&&(g.x=Za.Backward,m.x=i*Math.abs((e.left+b.width-o)/b.width)),{direction:g,speed:m}}function qct(n){if(n===document.scrollingElement){const{innerWidth:r,innerHeight:o}=window;return{top:0,left:0,right:r,bottom:o,width:r,height:o}}const{top:e,left:t,right:i,bottom:s}=n.getBoundingClientRect();return{top:e,left:t,right:i,bottom:s,width:n.clientWidth,height:n.clientHeight}}function hIe(n){return n.reduce((e,t)=>FE(e,nZ(t)),Uf)}function Kct(n){return n.reduce((e,t)=>e+lIe(t),0)}function Zct(n){return n.reduce((e,t)=>e+cIe(t),0)}function Yct(n,e){if(e===void 0&&(e=GR),!n)return;const{top:t,left:i,bottom:s,right:r}=e(n);aIe(n)&&(s<=0||r<=0||t>=window.innerHeight||i>=window.innerWidth)&&n.scrollIntoView({block:"center",inline:"center"})}const Xct=[["x",["left","right"],Kct],["y",["top","bottom"],Zct]];let Wre=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=Vre(t),s=hIe(i);this.rect={...e},this.width=e.width,this.height=e.height;for(const[r,o,a]of Xct)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(i),d=s[r]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}};class PI{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(t=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...t)})},this.target=e}add(e,t,i){var s;(s=this.target)==null||s.addEventListener(e,t,i),this.listeners.push([e,t,i])}}function Qct(n){const{EventTarget:e}=qd(n);return n instanceof e?n:$R(n)}function l$(n,e){const t=Math.abs(n.x),i=Math.abs(n.y);return typeof e=="number"?Math.sqrt(t**2+i**2)>e:"x"in e&&"y"in e?t>e.x&&i>e.y:"x"in e?t>e.x:"y"in e?i>e.y:!1}var yh;(function(n){n.Click="click",n.DragStart="dragstart",n.Keydown="keydown",n.ContextMenu="contextmenu",n.Resize="resize",n.SelectionChange="selectionchange",n.VisibilityChange="visibilitychange"})(yh||(yh={}));function qme(n){n.preventDefault()}function Jct(n){n.stopPropagation()}var Ns;(function(n){n.Space="Space",n.Down="ArrowDown",n.Right="ArrowRight",n.Left="ArrowLeft",n.Up="ArrowUp",n.Esc="Escape",n.Enter="Enter",n.Tab="Tab"})(Ns||(Ns={}));const fIe={start:[Ns.Space,Ns.Enter],cancel:[Ns.Esc],end:[Ns.Space,Ns.Enter,Ns.Tab]},edt=(n,e)=>{let{currentCoordinates:t}=e;switch(n.code){case Ns.Right:return{...t,x:t.x+25};case Ns.Left:return{...t,x:t.x-25};case Ns.Down:return{...t,y:t.y+25};case Ns.Up:return{...t,y:t.y-25}}};class gIe{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new PI($R(t)),this.windowListeners=new PI(qd(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(yh.Resize,this.handleCancel),this.windowListeners.add(yh.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(yh.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,i=e.node.current;i&&Yct(i),t(Uf)}handleKeyDown(e){if(Fre(e)){const{active:t,context:i,options:s}=this.props,{keyboardCodes:r=fIe,coordinateGetter:o=edt,scrollBehavior:a="smooth"}=s,{code:l}=e;if(r.end.includes(l)){this.handleEnd(e);return}if(r.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=i.current,d=c?{x:c.left,y:c.top}:Uf;this.referenceCoordinates||(this.referenceCoordinates=d);const u=o(e,{active:t,context:i.current,currentCoordinates:d});if(u){const h=BF(u,d),g={x:0,y:0},{scrollableAncestors:m}=i.current;for(const b of m){const v=e.code,{isTop:C,isRight:y,isLeft:L,isBottom:E,maxScroll:R,minScroll:T}=uIe(b),N=qct(b),I={x:Math.min(v===Ns.Right?N.right-N.width/2:N.right,Math.max(v===Ns.Right?N.left:N.left+N.width/2,u.x)),y:Math.min(v===Ns.Down?N.bottom-N.height/2:N.bottom,Math.max(v===Ns.Down?N.top:N.top+N.height/2,u.y))},M=v===Ns.Right&&!y||v===Ns.Left&&!L,P=v===Ns.Down&&!E||v===Ns.Up&&!C;if(M&&I.x!==u.x){const H=b.scrollLeft+h.x,j=v===Ns.Right&&H<=R.x||v===Ns.Left&&H>=T.x;if(j&&!h.y){b.scrollTo({left:H,behavior:a});return}j?g.x=b.scrollLeft-H:g.x=v===Ns.Right?b.scrollLeft-R.x:b.scrollLeft-T.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(P&&I.y!==u.y){const H=b.scrollTop+h.y,j=v===Ns.Down&&H<=R.y||v===Ns.Up&&H>=T.y;if(j&&!h.x){b.scrollTo({top:H,behavior:a});return}j?g.y=b.scrollTop-H:g.y=v===Ns.Down?b.scrollTop-R.y:b.scrollTop-T.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(e,FE(BF(u,this.referenceCoordinates),g))}}}handleMove(e,t){const{onMove:i}=this.props;e.preventDefault(),i(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}gIe.activators=[{eventName:"onKeyDown",handler:(n,e,t)=>{let{keyboardCodes:i=fIe,onActivation:s}=e,{active:r}=t;const{code:o}=n.nativeEvent;if(i.start.includes(o)){const a=r.activatorNode.current;return a&&n.target!==a?!1:(n.preventDefault(),s==null||s({event:n.nativeEvent}),!0)}return!1}}];function Kme(n){return!!(n&&"distance"in n)}function Zme(n){return!!(n&&"delay"in n)}class zre{constructor(e,t,i){var s;i===void 0&&(i=Qct(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:r}=e,{target:o}=r;this.props=e,this.events=t,this.document=$R(o),this.documentListeners=new PI(this.document),this.listeners=new PI(i),this.windowListeners=new PI(qd(o)),this.initialCoordinates=(s=iZ(r))!=null?s:Uf,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:i}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(yh.Resize,this.handleCancel),this.windowListeners.add(yh.DragStart,qme),this.windowListeners.add(yh.VisibilityChange,this.handleCancel),this.windowListeners.add(yh.ContextMenu,qme),this.documentListeners.add(yh.Keydown,this.handleKeydown),t){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Zme(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Kme(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:i,onPending:s}=this.props;s(i,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(yh.Click,Jct,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(yh.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:i,initialCoordinates:s,props:r}=this,{onMove:o,options:{activationConstraint:a}}=r;if(!s)return;const l=(t=iZ(e))!=null?t:Uf,c=BF(s,l);if(!i&&a){if(Kme(a)){if(a.tolerance!=null&&l$(c,a.tolerance))return this.handleCancel();if(l$(c,a.distance))return this.handleStart()}if(Zme(a)&&l$(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Ns.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const tdt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class UM extends zre{constructor(e){const{event:t}=e,i=$R(t.target);super(e,tdt,i)}}UM.activators=[{eventName:"onPointerDown",handler:(n,e)=>{let{nativeEvent:t}=n,{onActivation:i}=e;return!t.isPrimary||t.button!==0?!1:(i==null||i({event:t}),!0)}}];const idt={move:{name:"mousemove"},end:{name:"mouseup"}};var sZ;(function(n){n[n.RightClick=2]="RightClick"})(sZ||(sZ={}));class ndt extends zre{constructor(e){super(e,idt,$R(e.event.target))}}ndt.activators=[{eventName:"onMouseDown",handler:(n,e)=>{let{nativeEvent:t}=n,{onActivation:i}=e;return t.button===sZ.RightClick?!1:(i==null||i({event:t}),!0)}}];const c$={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class sdt extends zre{constructor(e){super(e,c$)}static setup(){return window.addEventListener(c$.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(c$.move.name,e)};function e(){}}}sdt.activators=[{eventName:"onTouchStart",handler:(n,e)=>{let{nativeEvent:t}=n,{onActivation:i}=e;const{touches:s}=t;return s.length>1?!1:(i==null||i({event:t}),!0)}}];var FI;(function(n){n[n.Pointer=0]="Pointer",n[n.DraggableRect=1]="DraggableRect"})(FI||(FI={}));var WF;(function(n){n[n.TreeOrder=0]="TreeOrder",n[n.ReversedTreeOrder=1]="ReversedTreeOrder"})(WF||(WF={}));function rdt(n){let{acceleration:e,activator:t=FI.Pointer,canScroll:i,draggingRect:s,enabled:r,interval:o=5,order:a=WF.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:h}=n;const g=adt({delta:u,disabled:!r}),[m,b]=_ct(),v=x.useRef({x:0,y:0}),C=x.useRef({x:0,y:0}),y=x.useMemo(()=>{switch(t){case FI.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case FI.DraggableRect:return s}},[t,s,l]),L=x.useRef(null),E=x.useCallback(()=>{const T=L.current;if(!T)return;const N=v.current.x*C.current.x,I=v.current.y*C.current.y;T.scrollBy(N,I)},[]),R=x.useMemo(()=>a===WF.TreeOrder?[...c].reverse():c,[a,c]);x.useEffect(()=>{if(!r||!c.length||!y){b();return}for(const T of R){if((i==null?void 0:i(T))===!1)continue;const N=c.indexOf(T),I=d[N];if(!I)continue;const{direction:M,speed:P}=Gct(T,I,y,e,h);for(const H of["x","y"])g[H][M[H]]||(P[H]=0,M[H]=0);if(P.x>0||P.y>0){b(),L.current=T,m(E,o),v.current=P,C.current=M;return}}v.current={x:0,y:0},C.current={x:0,y:0},b()},[e,E,i,b,r,o,JSON.stringify(y),JSON.stringify(g),m,c,R,d,JSON.stringify(h)])}const odt={x:{[Za.Backward]:!1,[Za.Forward]:!1},y:{[Za.Backward]:!1,[Za.Forward]:!1}};function adt(n){let{delta:e,disabled:t}=n;const i=tZ(e);return WM(s=>{if(t||!i||!s)return odt;const r={x:Math.sign(e.x-i.x),y:Math.sign(e.y-i.y)};return{x:{[Za.Backward]:s.x[Za.Backward]||r.x===-1,[Za.Forward]:s.x[Za.Forward]||r.x===1},y:{[Za.Backward]:s.y[Za.Backward]||r.y===-1,[Za.Forward]:s.y[Za.Forward]||r.y===1}}},[t,e,i])}function ldt(n,e){const t=e!=null?n.get(e):void 0,i=t?t.node.current:null;return WM(s=>{var r;return e==null?null:(r=i??s)!=null?r:null},[i,e])}function cdt(n,e){return x.useMemo(()=>n.reduce((t,i)=>{const{sensor:s}=i,r=s.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,i)}));return[...t,...r]},[]),[n,e])}var p2;(function(n){n[n.Always=0]="Always",n[n.BeforeDragging=1]="BeforeDragging",n[n.WhileDragging=2]="WhileDragging"})(p2||(p2={}));var rZ;(function(n){n.Optimized="optimized"})(rZ||(rZ={}));const Yme=new Map;function ddt(n,e){let{dragging:t,dependencies:i,config:s}=e;const[r,o]=x.useState(null),{frequency:a,measure:l,strategy:c}=s,d=x.useRef(n),u=v(),h=f2(u),g=x.useCallback(function(C){C===void 0&&(C=[]),!h.current&&o(y=>y===null?C:y.concat(C.filter(L=>!y.includes(L))))},[h]),m=x.useRef(null),b=WM(C=>{if(u&&!t)return Yme;if(!C||C===Yme||d.current!==n||r!=null){const y=new Map;for(let L of n){if(!L)continue;if(r&&r.length>0&&!r.includes(L.id)&&L.rect.current){y.set(L.id,L.rect.current);continue}const E=L.node.current,R=E?new Wre(l(E),E):null;L.rect.current=R,R&&y.set(L.id,R)}return y}return C},[n,r,t,u,l]);return x.useEffect(()=>{d.current=n},[n]),x.useEffect(()=>{u||g()},[t,u]),x.useEffect(()=>{r&&r.length>0&&o(null)},[JSON.stringify(r)]),x.useEffect(()=>{u||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},a))},[a,u,g,...i]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:r!=null};function v(){switch(c){case p2.Always:return!1;case p2.BeforeDragging:return t;default:return!t}}}function pIe(n,e){return WM(t=>n?t||(typeof e=="function"?e(n):n):null,[e,n])}function udt(n,e){return pIe(n,e)}function hdt(n){let{callback:e,disabled:t}=n;const i=Pre(e),s=x.useMemo(()=>{if(t||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:r}=window;return new r(i)},[i,t]);return x.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function rB(n){let{callback:e,disabled:t}=n;const i=Pre(e),s=x.useMemo(()=>{if(t||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:r}=window;return new r(i)},[t]);return x.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function fdt(n){return new Wre(GR(n),n)}function Xme(n,e,t){e===void 0&&(e=fdt);const[i,s]=x.useState(null);function r(){s(l=>{if(!n)return null;if(n.isConnected===!1){var c;return(c=l??t)!=null?c:null}const d=e(n);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const o=hdt({callback(l){if(n)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(n)){r();break}}}}),a=rB({callback:r});return Sp(()=>{r(),n?(a==null||a.observe(n),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[n]),i}function gdt(n){const e=pIe(n);return oIe(n,e)}const Qme=[];function pdt(n){const e=x.useRef(n),t=WM(i=>n?i&&i!==Qme&&n&&e.current&&n.parentNode===e.current.parentNode?i:Vre(n):Qme,[n]);return x.useEffect(()=>{e.current=n},[n]),t}function mdt(n){const[e,t]=x.useState(null),i=x.useRef(n),s=x.useCallback(r=>{const o=a$(r.target);o&&t(a=>a?(a.set(o,nZ(o)),new Map(a)):null)},[]);return x.useEffect(()=>{const r=i.current;if(n!==r){o(r);const a=n.map(l=>{const c=a$(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,nZ(c)]):null}).filter(l=>l!=null);t(a.length?new Map(a):null),i.current=n}return()=>{o(n),o(r)};function o(a){a.forEach(l=>{const c=a$(l);c==null||c.removeEventListener("scroll",s)})}},[s,n]),x.useMemo(()=>n.length?e?Array.from(e.values()).reduce((r,o)=>FE(r,o),Uf):hIe(n):Uf,[n,e])}function Jme(n,e){e===void 0&&(e=[]);const t=x.useRef(null);return x.useEffect(()=>{t.current=null},e),x.useEffect(()=>{const i=n!==Uf;i&&!t.current&&(t.current=n),!i&&t.current&&(t.current=null)},[n]),t.current?BF(n,t.current):Uf}function _dt(n){x.useEffect(()=>{if(!sB)return;const e=n.map(t=>{let{sensor:i}=t;return i.setup==null?void 0:i.setup()});return()=>{for(const t of e)t==null||t()}},n.map(e=>{let{sensor:t}=e;return t}))}function bdt(n,e){return x.useMemo(()=>n.reduce((t,i)=>{let{eventName:s,handler:r}=i;return t[s]=o=>{r(o,e)},t},{}),[n,e])}function mIe(n){return x.useMemo(()=>n?Wct(n):null,[n])}const e_e=[];function vdt(n,e){e===void 0&&(e=GR);const[t]=n,i=mIe(t?qd(t):null),[s,r]=x.useState(e_e);function o(){r(()=>n.length?n.map(l=>dIe(l)?i:new Wre(e(l),l)):e_e)}const a=rB({callback:o});return Sp(()=>{a==null||a.disconnect(),o(),n.forEach(l=>a==null?void 0:a.observe(l))},[n]),s}function Cdt(n){if(!n)return null;if(n.children.length>1)return n;const e=n.children[0];return VM(e)?e:n}function wdt(n){let{measure:e}=n;const[t,i]=x.useState(null),s=x.useCallback(c=>{for(const{target:d}of c)if(VM(d)){i(u=>{const h=e(d);return u?{...u,width:h.width,height:h.height}:h});break}},[e]),r=rB({callback:s}),o=x.useCallback(c=>{const d=Cdt(c);r==null||r.disconnect(),d&&(r==null||r.observe(d)),i(d?e(d):null)},[e,r]),[a,l]=HF(o);return x.useMemo(()=>({nodeRef:a,rect:t,setRef:l}),[t,a,l])}const ydt=[{sensor:UM,options:{}},{sensor:gIe,options:{}}],Sdt={current:{}},a5={draggable:{measure:Gme},droppable:{measure:Gme,strategy:p2.WhileDragging,frequency:rZ.Optimized},dragOverlay:{measure:GR}};class jI extends Map{get(e){var t;return e!=null&&(t=super.get(e))!=null?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,i;return(t=(i=this.get(e))==null?void 0:i.node.current)!=null?t:void 0}}const xdt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new jI,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:VF},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:a5,measureDroppableContainers:VF,windowRect:null,measuringScheduled:!1},Ldt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:VF,draggableNodes:new Map,over:null,measureDroppableContainers:VF},oB=x.createContext(Ldt),_Ie=x.createContext(xdt);function Edt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new jI}}}function Ddt(n,e){switch(e.type){case Ea.DragStart:return{...n,draggable:{...n.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ea.DragMove:return n.draggable.active==null?n:{...n,draggable:{...n.draggable,translate:{x:e.coordinates.x-n.draggable.initialCoordinates.x,y:e.coordinates.y-n.draggable.initialCoordinates.y}}};case Ea.DragEnd:case Ea.DragCancel:return{...n,draggable:{...n.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ea.RegisterDroppable:{const{element:t}=e,{id:i}=t,s=new jI(n.droppable.containers);return s.set(i,t),{...n,droppable:{...n.droppable,containers:s}}}case Ea.SetDroppableDisabled:{const{id:t,key:i,disabled:s}=e,r=n.droppable.containers.get(t);if(!r||i!==r.key)return n;const o=new jI(n.droppable.containers);return o.set(t,{...r,disabled:s}),{...n,droppable:{...n.droppable,containers:o}}}case Ea.UnregisterDroppable:{const{id:t,key:i}=e,s=n.droppable.containers.get(t);if(!s||i!==s.key)return n;const r=new jI(n.droppable.containers);return r.delete(t),{...n,droppable:{...n.droppable,containers:r}}}default:return n}}function Rdt(n){let{disabled:e}=n;const{active:t,activatorEvent:i,draggableNodes:s}=x.useContext(oB),r=tZ(i),o=tZ(t==null?void 0:t.id);return x.useEffect(()=>{if(!e&&!i&&r&&o!=null){if(!Fre(r)||document.activeElement===r.target)return;const a=s.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=Cct(d);if(u){u.focus();break}}})}},[i,e,s,o,r]),null}function Ndt(n,e){let{transform:t,...i}=e;return n!=null&&n.length?n.reduce((s,r)=>r({transform:s,...i}),t):t}function Tdt(n){return x.useMemo(()=>({draggable:{...a5.draggable,...n==null?void 0:n.draggable},droppable:{...a5.droppable,...n==null?void 0:n.droppable},dragOverlay:{...a5.dragOverlay,...n==null?void 0:n.dragOverlay}}),[n==null?void 0:n.draggable,n==null?void 0:n.droppable,n==null?void 0:n.dragOverlay])}function Idt(n){let{activeNode:e,measure:t,initialRect:i,config:s=!0}=n;const r=x.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Sp(()=>{if(!o&&!a||!e){r.current=!1;return}if(r.current||!i)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const d=t(c),u=oIe(d,i);if(o||(u.x=0),a||(u.y=0),r.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const h=aIe(c);h&&h.scrollBy({top:u.y,left:u.x})}},[e,o,a,i,t])}const bIe=x.createContext({...Uf,scaleX:1,scaleY:1});var dv;(function(n){n[n.Uninitialized=0]="Uninitialized",n[n.Initializing=1]="Initializing",n[n.Initialized=2]="Initialized"})(dv||(dv={}));const Ure=x.memo(function(e){var t,i,s,r;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:d=ydt,collisionDetection:u=Oct,measuring:h,modifiers:g,...m}=e;const b=x.useReducer(Ddt,void 0,Edt),[v,C]=b,[y,L]=Ect(),[E,R]=x.useState(dv.Uninitialized),T=E===dv.Initialized,{draggable:{active:N,nodes:I,translate:M},droppable:{containers:P}}=v,H=N!=null?I.get(N):null,j=x.useRef({initial:null,translated:null}),V=x.useMemo(()=>{var Ks;return N!=null?{id:N,data:(Ks=H==null?void 0:H.data)!=null?Ks:Sdt,rect:j}:null},[N,H]),W=x.useRef(null),[U,B]=x.useState(null),[K,X]=x.useState(null),ne=f2(m,Object.values(m)),fe=zM("DndDescribedBy",o),Z=x.useMemo(()=>P.getEnabled(),[P]),Y=Tdt(h),{droppableRects:ee,measureDroppableContainers:se,measuringScheduled:ae}=ddt(Z,{dragging:T,dependencies:[M.x,M.y],config:Y.droppable}),Se=ldt(I,N),ue=x.useMemo(()=>K?iZ(K):null,[K]),Re=ih(),Ve=udt(Se,Y.draggable.measure);Idt({activeNode:N!=null?I.get(N):null,config:Re.layoutShiftCompensation,initialRect:Ve,measure:Y.draggable.measure});const Qe=Xme(Se,Y.draggable.measure,Ve),dt=Xme(Se?Se.parentElement:null),yt=x.useRef({activatorEvent:null,active:null,activeNode:Se,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fi=P.getNodeFor((t=yt.current.over)==null?void 0:t.id),_i=wdt({measure:Y.dragOverlay.measure}),Sn=(i=_i.nodeRef.current)!=null?i:Se,Es=T?(s=_i.rect)!=null?s:Qe:null,br=!!(_i.nodeRef.current&&_i.rect),hs=gdt(br?null:Qe),Ht=mIe(Sn?qd(Sn):null),oe=pdt(T?fi??Se:null),Ce=vdt(oe),je=Ndt(g,{transform:{x:M.x-hs.x,y:M.y-hs.y,scaleX:1,scaleY:1},activatorEvent:K,active:V,activeNodeRect:Qe,containerNodeRect:dt,draggingNodeRect:Es,over:yt.current.over,overlayNodeRect:_i.rect,scrollableAncestors:oe,scrollableAncestorRects:Ce,windowRect:Ht}),bt=ue?FE(ue,M):null,tt=mdt(oe),ct=Jme(tt),$t=Jme(tt,[Qe]),yi=FE(je,ct),xi=Es?jct(Es,je):null,Nr=V&&xi?u({active:V,collisionRect:xi,droppableRects:ee,droppableContainers:Z,pointerCoordinates:bt}):null,Wl=Act(Nr,"id"),[Tr,Qd]=x.useState(null),Ir=br?je:FE(je,$t),vs=Pct(Ir,(r=Tr==null?void 0:Tr.rect)!=null?r:null,Qe),Kr=x.useRef(null),kr=x.useCallback((Ks,Ar)=>{let{sensor:vo,options:Bn}=Ar;if(W.current==null)return;const Mr=I.get(W.current);if(!Mr)return;const ro=Ks.nativeEvent,qo=new vo({active:W.current,activeNode:Mr,event:ro,options:Bn,context:yt,onAbort(Zr){if(!I.get(Zr))return;const{onDragAbort:we}=ne.current,Te={id:Zr};we==null||we(Te),y({type:"onDragAbort",event:Te})},onPending(Zr,le,we,Te){if(!I.get(Zr))return;const{onDragPending:mt}=ne.current,Wt={id:Zr,constraint:le,initialCoordinates:we,offset:Te};mt==null||mt(Wt),y({type:"onDragPending",event:Wt})},onStart(Zr){const le=W.current;if(le==null)return;const we=I.get(le);if(!we)return;const{onDragStart:Te}=ne.current,Ye={activatorEvent:ro,active:{id:le,data:we.data,rect:j}};Rf.unstable_batchedUpdates(()=>{Te==null||Te(Ye),R(dv.Initializing),C({type:Ea.DragStart,initialCoordinates:Zr,active:le}),y({type:"onDragStart",event:Ye}),B(Kr.current),X(ro)})},onMove(Zr){C({type:Ea.DragMove,coordinates:Zr})},onEnd:Va(Ea.DragEnd),onCancel:Va(Ea.DragCancel)});Kr.current=qo;function Va(Zr){return async function(){const{active:we,collisions:Te,over:Ye,scrollAdjustedTranslate:mt}=yt.current;let Wt=null;if(we&&mt){const{cancelDrop:Gt}=ne.current;Wt={activatorEvent:ro,active:we,collisions:Te,delta:mt,over:Ye},Zr===Ea.DragEnd&&typeof Gt=="function"&&await Promise.resolve(Gt(Wt))&&(Zr=Ea.DragCancel)}W.current=null,Rf.unstable_batchedUpdates(()=>{C({type:Zr}),R(dv.Uninitialized),Qd(null),B(null),X(null),Kr.current=null;const Gt=Zr===Ea.DragEnd?"onDragEnd":"onDragCancel";if(Wt){const Ft=ne.current[Gt];Ft==null||Ft(Wt),y({type:Gt,event:Wt})}})}}},[I]),Kh=x.useCallback((Ks,Ar)=>(vo,Bn)=>{const Mr=vo.nativeEvent,ro=I.get(Bn);if(W.current!==null||!ro||Mr.dndKit||Mr.defaultPrevented)return;const qo={active:ro};Ks(vo,Ar.options,qo)===!0&&(Mr.dndKit={capturedBy:Ar.sensor},W.current=Bn,kr(vo,Ar))},[I,kr]),th=cdt(d,Kh);_dt(d),Sp(()=>{Qe&&E===dv.Initializing&&R(dv.Initialized)},[Qe,E]),x.useEffect(()=>{const{onDragMove:Ks}=ne.current,{active:Ar,activatorEvent:vo,collisions:Bn,over:Mr}=yt.current;if(!Ar||!vo)return;const ro={active:Ar,activatorEvent:vo,collisions:Bn,delta:{x:yi.x,y:yi.y},over:Mr};Rf.unstable_batchedUpdates(()=>{Ks==null||Ks(ro),y({type:"onDragMove",event:ro})})},[yi.x,yi.y]),x.useEffect(()=>{const{active:Ks,activatorEvent:Ar,collisions:vo,droppableContainers:Bn,scrollAdjustedTranslate:Mr}=yt.current;if(!Ks||W.current==null||!Ar||!Mr)return;const{onDragOver:ro}=ne.current,qo=Bn.get(Wl),Va=qo&&qo.rect.current?{id:qo.id,rect:qo.rect.current,data:qo.data,disabled:qo.disabled}:null,Zr={active:Ks,activatorEvent:Ar,collisions:vo,delta:{x:Mr.x,y:Mr.y},over:Va};Rf.unstable_batchedUpdates(()=>{Qd(Va),ro==null||ro(Zr),y({type:"onDragOver",event:Zr})})},[Wl]),Sp(()=>{yt.current={activatorEvent:K,active:V,activeNode:Se,collisionRect:xi,collisions:Nr,droppableRects:ee,draggableNodes:I,draggingNode:Sn,draggingNodeRect:Es,droppableContainers:P,over:Tr,scrollableAncestors:oe,scrollAdjustedTranslate:yi},j.current={initial:Es,translated:xi}},[V,Se,Nr,xi,I,Sn,Es,ee,P,Tr,oe,yi]),rdt({...Re,delta:M,draggingRect:xi,pointerCoordinates:bt,scrollableAncestors:oe,scrollableAncestorRects:Ce});const Jd=x.useMemo(()=>({active:V,activeNode:Se,activeNodeRect:Qe,activatorEvent:K,collisions:Nr,containerNodeRect:dt,dragOverlay:_i,draggableNodes:I,droppableContainers:P,droppableRects:ee,over:Tr,measureDroppableContainers:se,scrollableAncestors:oe,scrollableAncestorRects:Ce,measuringConfiguration:Y,measuringScheduled:ae,windowRect:Ht}),[V,Se,Qe,K,Nr,dt,_i,I,P,ee,Tr,se,oe,Ce,Y,ae,Ht]),sd=x.useMemo(()=>({activatorEvent:K,activators:th,active:V,activeNodeRect:Qe,ariaDescribedById:{draggable:fe},dispatch:C,draggableNodes:I,over:Tr,measureDroppableContainers:se}),[K,th,V,Qe,C,fe,I,Tr,se]);return nt.createElement(rIe.Provider,{value:L},nt.createElement(oB.Provider,{value:sd},nt.createElement(_Ie.Provider,{value:Jd},nt.createElement(bIe.Provider,{value:vs},c)),nt.createElement(Rdt,{disabled:(a==null?void 0:a.restoreFocus)===!1})),nt.createElement(Nct,{...a,hiddenTextDescribedById:fe}));function ih(){const Ks=(U==null?void 0:U.autoScrollEnabled)===!1,Ar=typeof l=="object"?l.enabled===!1:l===!1,vo=T&&!Ks&&!Ar;return typeof l=="object"?{...l,enabled:vo}:{enabled:vo}}}),kdt=x.createContext(null),t_e="button",Adt="Draggable";function Mdt(n){let{id:e,data:t,disabled:i=!1,attributes:s}=n;const r=zM(Adt),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:h}=x.useContext(oB),{role:g=t_e,roleDescription:m="draggable",tabIndex:b=0}=s??{},v=(l==null?void 0:l.id)===e,C=x.useContext(v?bIe:kdt),[y,L]=HF(),[E,R]=HF(),T=bdt(o,e),N=f2(t);Sp(()=>(u.set(e,{id:e,key:r,node:y,activatorNode:E,data:N}),()=>{const M=u.get(e);M&&M.key===r&&u.delete(e)}),[u,e]);const I=x.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":i,"aria-pressed":v&&g===t_e?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[i,g,b,v,m,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:I,isDragging:v,listeners:i?void 0:T,node:y,over:h,setNodeRef:L,setActivatorNodeRef:R,transform:C}}function Odt(){return x.useContext(_Ie)}const Pdt="Droppable",Fdt={timeout:25};function jdt(n){let{data:e,disabled:t=!1,id:i,resizeObserverConfig:s}=n;const r=zM(Pdt),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=x.useContext(oB),d=x.useRef({disabled:t}),u=x.useRef(!1),h=x.useRef(null),g=x.useRef(null),{disabled:m,updateMeasurementsFor:b,timeout:v}={...Fdt,...s},C=f2(b??i),y=x.useCallback(()=>{if(!u.current){u.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(C.current)?C.current:[C.current]),g.current=null},v)},[v]),L=rB({callback:y,disabled:m||!o}),E=x.useCallback((I,M)=>{L&&(M&&(L.unobserve(M),u.current=!1),I&&L.observe(I))},[L]),[R,T]=HF(E),N=f2(e);return x.useEffect(()=>{!L||!R.current||(L.disconnect(),u.current=!1,L.observe(R.current))},[R,L]),x.useEffect(()=>(a({type:Ea.RegisterDroppable,element:{id:i,key:r,disabled:t,node:R,rect:h,data:N}}),()=>a({type:Ea.UnregisterDroppable,key:r,id:i})),[i]),x.useEffect(()=>{t!==d.current.disabled&&(a({type:Ea.SetDroppableDisabled,id:i,key:r,disabled:t}),d.current.disabled=t)},[i,r,t,a]),{active:o,rect:h,isOver:(l==null?void 0:l.id)===i,node:R,over:l,setNodeRef:T}}function vIe(n,e,t){const i=n.slice();return i.splice(t<0?i.length+t:t,0,i.splice(e,1)[0]),i}function Hdt(n,e){return n.reduce((t,i,s)=>{const r=e.get(i);return r&&(t[s]=r),t},Array(n.length))}function b4(n){return n!==null&&n>=0}function Bdt(n,e){if(n===e)return!0;if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Vdt(n){return typeof n=="boolean"?{draggable:n,droppable:n}:n}const CIe=n=>{let{rects:e,activeIndex:t,overIndex:i,index:s}=n;const r=vIe(e,i,t),o=e[s],a=r[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},v4={scaleX:1,scaleY:1},$re=n=>{var e;let{activeIndex:t,activeNodeRect:i,index:s,rects:r,overIndex:o}=n;const a=(e=r[t])!=null?e:i;if(!a)return null;if(s===t){const c=r[o];return c?{x:0,y:t<o?c.top+c.height-(a.top+a.height):c.top-a.top,...v4}:null}const l=Wdt(r,s,t);return s>t&&s<=o?{x:0,y:-a.height-l,...v4}:s<t&&s>=o?{x:0,y:a.height+l,...v4}:{x:0,y:0,...v4}};function Wdt(n,e,t){const i=n[e],s=n[e-1],r=n[e+1];return i?t<e?s?i.top-(s.top+s.height):r?r.top-(i.top+i.height):0:r?r.top-(i.top+i.height):s?i.top-(s.top+s.height):0:0}const wIe="Sortable",yIe=nt.createContext({activeIndex:-1,containerId:wIe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:CIe,disabled:{draggable:!1,droppable:!1}});function Gre(n){let{children:e,id:t,items:i,strategy:s=CIe,disabled:r=!1}=n;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=Odt(),u=zM(wIe,t),h=a.rect!==null,g=x.useMemo(()=>i.map(T=>typeof T=="object"&&"id"in T?T.id:T),[i]),m=o!=null,b=o?g.indexOf(o.id):-1,v=c?g.indexOf(c.id):-1,C=x.useRef(g),y=!Bdt(g,C.current),L=v!==-1&&b===-1||y,E=Vdt(r);Sp(()=>{y&&m&&d(g)},[y,g,m,d]),x.useEffect(()=>{C.current=g},[g]);const R=x.useMemo(()=>({activeIndex:b,containerId:u,disabled:E,disableTransforms:L,items:g,overIndex:v,useDragOverlay:h,sortedRects:Hdt(g,l),strategy:s}),[b,u,E.draggable,E.droppable,L,g,v,l,h,s]);return nt.createElement(yIe.Provider,{value:R},e)}const zdt=n=>{let{id:e,items:t,activeIndex:i,overIndex:s}=n;return vIe(t,i,s).indexOf(e)},Udt=n=>{let{containerId:e,isSorting:t,wasDragging:i,index:s,items:r,newIndex:o,previousItems:a,previousContainerId:l,transition:c}=n;return!c||!i||a!==r&&s===o?!1:t?!0:o!==s&&e===l},$dt={duration:200,easing:"ease"},SIe="transform",Gdt=g2.Transition.toString({property:SIe,duration:0,easing:"linear"}),qdt={roleDescription:"sortable"};function Kdt(n){let{disabled:e,index:t,node:i,rect:s}=n;const[r,o]=x.useState(null),a=x.useRef(t);return Sp(()=>{if(!e&&t!==a.current&&i.current){const l=s.current;if(l){const c=GR(i.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&o(d)}}t!==a.current&&(a.current=t)},[e,t,i,s]),x.useEffect(()=>{r&&o(null)},[r]),r}function Zdt(n){let{animateLayoutChanges:e=Udt,attributes:t,disabled:i,data:s,getNewIndex:r=zdt,id:o,strategy:a,resizeObserverConfig:l,transition:c=$dt}=n;const{items:d,containerId:u,activeIndex:h,disabled:g,disableTransforms:m,sortedRects:b,overIndex:v,useDragOverlay:C,strategy:y}=x.useContext(yIe),L=Ydt(i,g),E=d.indexOf(o),R=x.useMemo(()=>({sortable:{containerId:u,index:E,items:d},...s}),[u,s,E,d]),T=x.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:N,node:I,isOver:M,setNodeRef:P}=jdt({id:o,data:R,disabled:L.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...l}}),{active:H,activatorEvent:j,activeNodeRect:V,attributes:W,setNodeRef:U,listeners:B,isDragging:K,over:X,setActivatorNodeRef:ne,transform:fe}=Mdt({id:o,data:R,attributes:{...qdt,...t},disabled:L.draggable}),Z=mct(P,U),Y=!!H,ee=Y&&!m&&b4(h)&&b4(v),se=!C&&K,ae=se&&ee?fe:null,ue=ee?ae??(a??y)({rects:b,activeNodeRect:V,activeIndex:h,overIndex:v,index:E}):null,Re=b4(h)&&b4(v)?r({id:o,items:d,activeIndex:h,overIndex:v}):E,Ve=H==null?void 0:H.id,Qe=x.useRef({activeId:Ve,items:d,newIndex:Re,containerId:u}),dt=d!==Qe.current.items,yt=e({active:H,containerId:u,isDragging:K,isSorting:Y,id:o,index:E,items:d,newIndex:Qe.current.newIndex,previousItems:Qe.current.items,previousContainerId:Qe.current.containerId,transition:c,wasDragging:Qe.current.activeId!=null}),fi=Kdt({disabled:!yt,index:E,node:I,rect:N});return x.useEffect(()=>{Y&&Qe.current.newIndex!==Re&&(Qe.current.newIndex=Re),u!==Qe.current.containerId&&(Qe.current.containerId=u),d!==Qe.current.items&&(Qe.current.items=d)},[Y,Re,u,d]),x.useEffect(()=>{if(Ve===Qe.current.activeId)return;if(Ve&&!Qe.current.activeId){Qe.current.activeId=Ve;return}const Sn=setTimeout(()=>{Qe.current.activeId=Ve},50);return()=>clearTimeout(Sn)},[Ve]),{active:H,activeIndex:h,attributes:W,data:R,rect:N,index:E,newIndex:Re,items:d,isOver:M,isSorting:Y,isDragging:K,listeners:B,node:I,overIndex:v,over:X,setNodeRef:Z,setActivatorNodeRef:ne,setDroppableNodeRef:P,setDraggableNodeRef:U,transform:fi??ue,transition:_i()};function _i(){if(fi||dt&&Qe.current.newIndex===E)return Gdt;if(!(se&&!Fre(j)||!c)&&(Y||yt))return g2.Transition.toString({...c,property:SIe})}}function Ydt(n,e){var t,i;return typeof n=="boolean"?{draggable:n,droppable:!1}:{draggable:(t=n==null?void 0:n.draggable)!=null?t:e.draggable,droppable:(i=n==null?void 0:n.droppable)!=null?i:e.droppable}}Ns.Down,Ns.Right,Ns.Up,Ns.Left;function jE({value:n,placeholder:e="",onValueChange:t,minRows:i=1,isBold:s=!1,className:r,saveButtonText:o="Save",cancelButtonText:a="Discard"}){const[l,c]=x.useState(!1),[d,u]=x.useState(n),h=x.useRef(null),g=y=>{u(y.target.value)},m=()=>{t&&d!==n&&t(d.trim()),c(!1)},b=()=>{u(n),c(!1)},v=y=>{y.key==="Enter"&&!y.shiftKey?(i===1||y.ctrlKey)&&(y.preventDefault(),m()):y.key==="Escape"&&(y.preventDefault(),b())},C=y=>{c(y),y?(u(n),setTimeout(()=>{h.current&&h.current.focus()},0)):b()};return f.jsxs(yre,{open:l,onOpenChange:C,children:[f.jsx(Sre,{asChild:!0,children:f.jsx("div",{className:Le("cursor-edit w-full min-w-[100px]",!n&&"text-gray-400",s&&"font-medium",r),children:n||e})}),f.jsxs(xre,{className:"w-auto max-w-[600px] min-w-[300px] p-2",align:"start",children:[f.jsx(Hp,{ref:h,value:d,onChange:g,onKeyDown:v,className:"min-h-[24px] resize-y",style:{minHeight:String(Math.max(i*24,24))+"px"},rows:i}),f.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[f.jsx(rt,{variant:"outline",size:"sm",onClick:b,className:"h-7 cursor-pointer px-2 text-xs",children:a}),f.jsx(rt,{size:"sm",onClick:m,className:"h-7 cursor-pointer px-2 text-xs",children:o})]})]})]})}function Xdt({isAllExpanded:n,onToggle:e}){return f.jsx(rt,{variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer p-0",onClick:e,title:n?"Collapse all items":"Expand all items",children:n?f.jsx(HHe,{className:"h-4 w-4"}):f.jsx(One,{className:"h-4 w-4"})})}function Qdt({isExpanded:n,onToggle:e,ariaLabel:t}){return f.jsx(rt,{variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer p-0",onClick:e,"aria-label":t??(n?"Collapse":"Expand"),children:n?f.jsx(Pp,{className:"h-4 w-4"}):f.jsx($d,{className:"h-4 w-4"})})}function Jdt({className:n="",...e}){return f.jsx("div",{...e,className:`flex cursor-grab items-center justify-center opacity-0 group-hover:opacity-100 active:cursor-grabbing ${n}`,children:f.jsx(JSe,{className:"h-4 w-4 text-gray-400"})})}function qre({id:n,children:e}){const{attributes:t,listeners:i,setNodeRef:s,transform:r,transition:o,isDragging:a}=Zdt({id:n}),l={transform:g2.Transform.toString(r),transition:o,opacity:a?.75:1},c=x.Children.toArray(e),d=[f.jsx(Rl,{className:"bg-background dark:bg-muted",style:{width:20,position:"sticky",left:0,zIndex:2,paddingTop:8,paddingBottom:8,paddingLeft:4,paddingRight:0},children:f.jsx(Jdt,{...t,...i})},"drag-handle-cell"),...c.slice(1)];return f.jsx(qr,{ref:s,style:l,className:"group",children:d})}function xIe({row:n,onDeleteRow:e,onAddNestedField:t,isRecordType:i}){const[s,r]=x.useState(!1),o=()=>{e&&e(n.index),r(!1)},a=i&&t&&i(n.index),l=!!e,c=a&&l;return f.jsxs("div",{className:"px-3 text-right",children:[f.jsxs(Al,{children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:"dm-card-table-body-row-actionbtn opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100","aria-label":"Row actions",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsxs(Ol,{align:"end",children:[a&&f.jsxs(wn,{className:"cursor-pointer",onClick:()=>{t(n.index)},children:[f.jsx(Gd,{className:"mr-2 h-4 w-4"}),"Add nested field"]}),c&&f.jsx(Vd,{}),l&&f.jsxs(wn,{onClick:()=>{r(!0)},children:[f.jsx(Wh,{className:"h-4 w-4 text-red-600","aria-hidden":"true"}),f.jsx("span",{className:"text-red-600",children:"Delete field"})]})]})]}),f.jsx(Ma,{open:s,onOpenChange:r,title:"Delete field",description:"Are you sure you want to delete this field?",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:o,variant:"destructive"})]})}function eut({mode:n,onModeChange:e}){const t=Object.values(d2),i=s=>{e&&e(s)};return f.jsxs($c,{value:n,onValueChange:i,children:[f.jsx(qc,{className:"h-90 cursor-pointer",size:"sm",children:f.jsx(Gc,{placeholder:"Select field mode"})}),f.jsx(Kc,{className:"max-h-[300px]",children:t.map(s=>f.jsx(fo,{value:s,children:s},s))})]})}var aB="Checkbox",[tut]=Ha(aB),[iut,Kre]=tut(aB);function nut(n){const{__scopeCheckbox:e,checked:t,children:i,defaultChecked:s,disabled:r,form:o,name:a,onCheckedChange:l,required:c,value:d="on",internal_do_not_use_render:u}=n,[h,g]=zc({prop:t,defaultProp:s??!1,onChange:l,caller:aB}),[m,b]=x.useState(null),[v,C]=x.useState(null),y=x.useRef(!1),L=m?!!o||!!m.closest("form"):!0,E={checked:h,disabled:r,setChecked:g,control:m,setControl:b,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:y,required:c,defaultChecked:l1(s)?!1:s,isFormControl:L,bubbleInput:v,setBubbleInput:C};return f.jsx(iut,{scope:e,...E,children:sut(u)?u(E):i})}var LIe="CheckboxTrigger",EIe=x.forwardRef(({__scopeCheckbox:n,onKeyDown:e,onClick:t,...i},s)=>{const{control:r,value:o,disabled:a,checked:l,required:c,setControl:d,setChecked:u,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:m}=Kre(LIe,n),b=Ui(s,d),v=x.useRef(l);return x.useEffect(()=>{const C=r==null?void 0:r.form;if(C){const y=()=>u(v.current);return C.addEventListener("reset",y),()=>C.removeEventListener("reset",y)}},[r,u]),f.jsx(ui.button,{type:"button",role:"checkbox","aria-checked":l1(l)?"mixed":l,"aria-required":c,"data-state":kIe(l),"data-disabled":a?"":void 0,disabled:a,value:o,...i,ref:b,onKeyDown:Lt(e,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Lt(t,C=>{u(y=>l1(y)?!0:!y),m&&g&&(h.current=C.isPropagationStopped(),h.current||C.stopPropagation())})})});EIe.displayName=LIe;var DIe=x.forwardRef((n,e)=>{const{__scopeCheckbox:t,name:i,checked:s,defaultChecked:r,required:o,disabled:a,value:l,onCheckedChange:c,form:d,...u}=n;return f.jsx(nut,{__scopeCheckbox:t,checked:s,defaultChecked:r,disabled:a,required:o,onCheckedChange:c,name:i,form:d,value:l,internal_do_not_use_render:({isFormControl:h})=>f.jsxs(f.Fragment,{children:[f.jsx(EIe,{...u,ref:e,__scopeCheckbox:t}),h&&f.jsx(IIe,{__scopeCheckbox:t})]})})});DIe.displayName=aB;var RIe="CheckboxIndicator",NIe=x.forwardRef((n,e)=>{const{__scopeCheckbox:t,forceMount:i,...s}=n,r=Kre(RIe,t);return f.jsx(kl,{present:i||l1(r.checked)||r.checked===!0,children:f.jsx(ui.span,{"data-state":kIe(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...n.style}})})});NIe.displayName=RIe;var TIe="CheckboxBubbleInput",IIe=x.forwardRef(({__scopeCheckbox:n,...e},t)=>{const{control:i,hasConsumerStoppedPropagationRef:s,checked:r,defaultChecked:o,required:a,disabled:l,name:c,value:d,form:u,bubbleInput:h,setBubbleInput:g}=Kre(TIe,n),m=Ui(t,g),b=ire(r),v=Xne(i);x.useEffect(()=>{const y=h;if(!y)return;const L=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(L,"checked").set,T=!s.current;if(b!==r&&R){const N=new Event("click",{bubbles:T});y.indeterminate=l1(r),R.call(y,l1(r)?!1:r),y.dispatchEvent(N)}},[h,b,r,s]);const C=x.useRef(l1(r)?!1:r);return f.jsx(ui.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??C.current,required:a,disabled:l,name:c,value:d,form:u,...e,tabIndex:-1,ref:m,style:{...e.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});IIe.displayName=TIe;function sut(n){return typeof n=="function"}function l1(n){return n==="indeterminate"}function kIe(n){return l1(n)?"indeterminate":n?"checked":"unchecked"}function rut({className:n,...e}){return f.jsx(DIe,{"data-slot":"checkbox",className:Le("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",n),...e,children:f.jsx(NIe,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:f.jsx(Wc,{className:"size-3.5"})})})}function AIe({isPrimaryKey:n,onPrimaryKeyChange:e}){const t=!!n,i=s=>{e&&e(s)};return f.jsx(rut,{className:"cursor-pointer",checked:t,onCheckedChange:i,"aria-label":"Primary Key"})}const i_e={[Mu.CONNECTED]:{icon:sH,color:"text-green-500",label:"Connected",description:"Field is connected to the data source"},[Mu.CONNECTED_WITH_DEFINITION_MISMATCH]:{icon:oH,color:"text-orange-500",label:"Connected with issues",description:"Field is connected but has definition mismatches"},[Mu.DISCONNECTED]:{icon:OBe,color:"text-red-500",label:"Disconnected",description:"Field is not connected to the data source"}};function MIe({status:n}){if(!(n in i_e))return null;const e=i_e[n],{icon:t,color:i,label:s,description:r}=e,o=`schema-field-status-tooltip-${n}`;return f.jsx(Nf,{children:f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx(t,{className:Le("h-5 w-5",i),role:"img","aria-label":s,"aria-describedby":o,tabIndex:0})}),f.jsxs(kn,{id:o,side:"bottom",role:"tooltip",children:[f.jsx("div",{className:"text-xs font-medium",children:s}),f.jsx("div",{className:"mt-1 max-w-xs text-xs break-words whitespace-normal",children:r})]})]})})}function Zre({type:n,storageType:e,onTypeChange:t}){const i=e===lt.GOOGLE_BIGQUERY?Object.values(Ho):e===lt.AWS_ATHENA?Object.values(Gse):Object.values(qse),s=r=>{t&&(e===lt.GOOGLE_BIGQUERY||lt.AWS_ATHENA,t(r))};return f.jsxs($c,{value:n,onValueChange:s,children:[f.jsx(qc,{className:"cursor-pointer",size:"sm",children:f.jsx(Gc,{placeholder:"Select field type"})}),f.jsx(Kc,{className:"max-h-[300px]",children:i.map(r=>f.jsx(fo,{value:r,children:r},r))})]})}function out({table:n}){return f.jsx("div",{className:"px-3 text-right",children:f.jsxs(Al,{children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:"dm-card-table-body-row-actionbtn","aria-label":"Toggle columns",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsx(Ol,{align:"end",children:n.getAllColumns().filter(e=>e.getCanHide()&&e.id!=="actions").map(e=>f.jsx(wn,{className:"capitalize",children:f.jsxs("label",{className:"flex items-center space-x-2",children:[f.jsx("button",{type:"button",role:"checkbox","aria-checked":e.getIsVisible(),"data-state":e.getIsVisible()?"checked":"unchecked","aria-label":`Toggle column ${e.columnDef.meta?e.columnDef.meta.title??e.id:e.id}`,className:"peer border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border bg-white shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white/8",onClick:()=>{e.toggleVisibility(!e.getIsVisible())},children:e.getIsVisible()&&f.jsx("span",{"data-state":"checked","data-slot":"checkbox-indicator",className:"pointer-events-none flex items-center justify-center text-current transition-none",children:f.jsx(Wc,{className:"size-3.5 text-white"})})}),f.jsx("span",{children:e.columnDef.meta?e.columnDef.meta.title??e.id:e.id})]})},e.id))})]})})}function aut({id:n,placeholder:e="Search",value:t,onChange:i,debounceTime:s=500,className:r,"aria-label":o}){const[a,l]=x.useState(t),c=x.useRef(!0);x.useEffect(()=>{(t===""||c.current)&&(l(t),c.current=!1)},[t]);const d=x.useCallback(u=>{const h=u.target.value;l(h);const g=setTimeout(()=>{i(h)},s);return()=>{clearTimeout(g)}},[i,s]);return f.jsxs("div",{className:"dm-card-toolbar-search",children:[f.jsx(FS,{className:"dm-card-toolbar-search-icon","aria-hidden":"true"}),f.jsx(vn,{id:n,placeholder:e,value:a,onChange:d,className:r??"dm-card-toolbar-search-input","aria-label":o??e})]})}function lut({searchInputId:n,onAddField:e,filterValue:t,onFilterChange:i,statusCounts:s,disabled:r=!1}){return f.jsxs("div",{className:"dm-card-toolbar",children:[f.jsx("div",{className:"dm-card-toolbar-left",children:f.jsx(aut,{id:n,placeholder:"Search fields",value:t,onChange:i,className:"dm-card-toolbar-search-input","aria-label":"Search fields"})}),f.jsxs("div",{className:"dm-card-toolbar-right",children:[s&&f.jsx("div",{className:"mr-3 flex items-center gap-3",children:Object.entries(s).map(([o,a])=>a===0?null:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(MIe,{status:o}),f.jsx("span",{className:"text-sm font-medium text-gray-500",children:a})]},o))}),f.jsxs(rt,{variant:"outline",className:"dm-card-table-add-field-btn cursor-pointer",onClick:e,disabled:r,"aria-label":"Add new field",children:[f.jsx(Gd,{className:"h-4 w-4","aria-hidden":"true"}),"Add Field"]})]})]})}const cut={dragHandle:{left:0,zIndex:1},status:{left:20,zIndex:1},name:{left:56,zIndex:1},actions:{right:0,zIndex:1}};function n_e(n,e={}){const t=cut[n];return t?{...e,position:"sticky",zIndex:t.zIndex,...t.left!==void 0&&{left:t.left},...t.right!==void 0&&{right:t.right}}:e}function dut({fields:n,columns:e,onAddRow:t,fieldsForStatusCount:i,onSearchChange:s,dragContext:r,dragContextProps:o,rowComponent:a=qr,getRowId:l}){const{isSchemaActualizationLoading:c}=Zu(),d=e,u=r,h=a,{columnVisibility:g,setColumnVisibility:m}=uct(d),b=pC({data:n,columns:d,getCoreRowModel:gC(),getFilteredRowModel:HR(),columnResizeMode:"onChange",enableColumnResizing:!0,state:{columnVisibility:g},onColumnVisibilityChange:m,enableGlobalFilter:!0,globalFilterFn:hct,defaultColumn:{enableResizing:!0,size:0,minSize:0}}),{value:v,onChange:C,searchValue:y}=fct(b),L=x.useRef("");x.useEffect(()=>{s&&y!==L.current&&(L.current=y,s(y))},[y,s]);const E=x.useMemo(()=>{const N={[Mu.CONNECTED]:0,[Mu.CONNECTED_WITH_DEFINITION_MISMATCH]:0,[Mu.DISCONNECTED]:0};return(i??n).forEach(M=>{M.status in N&&N[M.status]++}),N},[n,i]);return f.jsxs("div",{className:"space-y-4",children:[t&&f.jsx(lut,{table:b,searchInputId:"schema-fields-search-input",onAddField:t,filterValue:v,onFilterChange:C,statusCounts:E,disabled:c}),f.jsx("div",{className:"dm-card-table-wrap mb-0",children:f.jsxs(mC,{id:"schema-fields-table",className:"w-full table-auto",role:"table",children:[f.jsx(_C,{className:"dm-card-table-header",children:b.getHeaderGroups().map(N=>f.jsx(qr,{className:"dm-card-table-header-row",children:N.headers.map(I=>f.jsx(vC,{className:"bg-secondary dark:bg-background",style:n_e(I.column.id,{width:I.getSize()!==0?I.getSize():void 0,whiteSpace:"nowrap",cursor:"default"}),children:I.isPlaceholder?null:typeof I.column.columnDef.header=="function"?I.column.columnDef.header(I.getContext()):I.column.columnDef.header},I.id))},N.id))}),f.jsx(bC,{className:"dm-card-table-body",children:b.getRowModel().rows.length?f.jsx(u,{...o,children:b.getRowModel().rows.map(N=>f.jsx(h,{id:l?l(N):N.index,row:N,children:N.getVisibleCells().map(I=>f.jsx(Rl,{className:"bg-background dark:bg-muted",style:n_e(I.column.id,{width:I.column.getSize()!==0?I.column.getSize():void 0,whiteSpace:"pre",paddingTop:8,paddingBottom:8}),children:I.column.columnDef.cell&&typeof I.column.columnDef.cell=="function"?I.column.columnDef.cell(I.getContext()):null},I.id))},N.id))}):f.jsx(qr,{children:f.jsx(Rl,{colSpan:d.length,className:"text-center text-gray-400",style:{whiteSpace:"nowrap"},children:"Output schema has no configured fields"})})})]})}),t&&f.jsxs(rt,{variant:"outline",className:"dm-card-table-add-field-btn bg-background dark:bg-muted w-full cursor-pointer rounded-t-none border-0",onClick:t,disabled:c,"aria-label":"Add new field",children:[f.jsx(Gd,{className:"h-4 w-4","aria-hidden":"true"}),"Add Field"]})]})}function Yre({fields:n,onFieldsChange:e,onAddRow:t,createNewField:i,renderTypeCell:s,additionalColumns:r=[],fieldsForStatusCount:o,onSearchChange:a,nameColumnHeader:l,nameColumnCell:c,primaryKeyColumnCell:d,aliasColumnCell:u,descriptionColumnCell:h,actionsColumnCell:g,dragContext:m,dragContextProps:b,rowComponent:v,getRowId:C}){const y=x.useCallback((N,I)=>{if(e){const M=[...n];M[N]={...M[N],...I},e(M)}},[n,e]),L=x.useCallback(()=>{if(e){const N=i();e([...n,N])}},[n,e,i]),E=x.useCallback(N=>{if(e){const I=[...n];I.splice(N,1),e(I)}},[n,e]),R=x.useMemo(()=>[{id:"dragHandle",header:"",size:24,enableHiding:!1},{accessorKey:"status",header:"",size:36,cell:({row:N})=>f.jsx(MIe,{status:N.getValue("status")}),enableHiding:!1},{accessorKey:"name",header:l??(()=>f.jsxs(Tn,{children:[f.jsx(In,{className:"cursor-default",children:"Name"}),f.jsx(kn,{children:"Field name in the output schema"})]})),size:80,cell:({row:N})=>c?c({row:N,updateField:y}):f.jsx(jE,{value:lct(N.getValue("name")),onValueChange:I=>{y(N.index,{name:I})},placeholder:"Field name is required",isBold:!0}),enableHiding:!1},{accessorKey:"isPrimaryKey",header:()=>f.jsxs(Tn,{children:[f.jsx(In,{className:"cursor-default",children:"PK"}),f.jsx(kn,{children:"Is field must be considered as a part of the output Primary Key"})]}),size:36,cell:({row:N})=>d?d({row:N,updateField:y}):f.jsx(AIe,{isPrimaryKey:N.getValue("isPrimaryKey"),onPrimaryKeyChange:I=>{y(N.index,{isPrimaryKey:I})}}),enableHiding:!1},{accessorKey:"alias",header:()=>f.jsxs(Tn,{children:[f.jsx(In,{className:"cursor-default",children:"Alias"}),f.jsx(kn,{children:"Alternative name for the field"})]}),size:80,cell:({row:N})=>u?u({row:N,updateField:y}):f.jsx(jE,{value:N.getValue("alias"),onValueChange:I=>{y(N.index,{alias:I})},placeholder:"-"})},{accessorKey:"description",header:()=>f.jsxs(Tn,{children:[f.jsx(In,{className:"cursor-default",children:"Description"}),f.jsx(kn,{children:"Detailed information about the field"})]}),cell:({row:N})=>h?h({row:N,updateField:y}):f.jsx(jE,{value:N.getValue("description"),onValueChange:I=>{y(N.index,{description:I})},minRows:5,placeholder:"-"})},{id:"actions",header:({table:N})=>f.jsx(out,{table:N}),cell:({row:N,table:I})=>g?g({row:N,table:I}):f.jsx(xIe,{row:N,onDeleteRow:e?E:void 0}),size:40,enableResizing:!1,enableHiding:!1}],[y,E,e,l,c,d,u,h,g]),T=x.useMemo(()=>{const I={accessorKey:"type",header:()=>f.jsxs(Tn,{children:[f.jsx(In,{className:"cursor-default pl-[12px]",children:"Type"}),f.jsx(kn,{children:"Data type of the field"})]}),size:80,cell:P=>s({row:P.row,updateField:y}),enableHiding:!1},M=[...R];if(M.splice(3,0,I),r.length>0){const P=[...r];P.sort((H,j)=>{const V=H.columnIndex??1/0,W=j.columnIndex??1/0;return V-W}),P.forEach(H=>{if(H.columnIndex!==void 0){const j=Math.min(Math.max(0,H.columnIndex),M.length);M.splice(j,0,H)}else M.splice(M.length-1,0,H)})}return M},[R,s,y,r]);return f.jsx(dut,{fields:n,columns:T,onFieldsChange:e,onAddRow:t??(e?L:void 0),fieldsForStatusCount:o,onSearchChange:a,dragContext:m,dragContextProps:b,rowComponent:v,getRowId:C})}function uut({fields:n,onFieldsChange:e}){const{expandedRecords:t,hasRecordFields:i,toggleRecordExpansion:s,toggleAllRecords:r,flattenedFields:o,handleSearchChange:a,isRecordType:l,topLevelFields:c,allExpanded:d}=gct(n),{updateField:u,handleDeleteRow:h,handleAddNestedField:g,handleAddRow:m}=pct(n,o,e,H=>H),b=x.useCallback(()=>({name:"",type:Ho.STRING,mode:d2.NULLABLE,isPrimaryKey:!1,status:Mu.DISCONNECTED}),[]),v=x.useCallback(({row:H})=>f.jsx(Zre,{type:H.getValue("type"),storageType:lt.GOOGLE_BIGQUERY,onTypeChange:j=>{u(H.index,{type:j})}}),[u]),C=x.useMemo(()=>[{accessorKey:"mode",header:()=>f.jsxs(Tn,{children:[f.jsx(In,{className:"cursor-default pl-[12px]",children:"Mode"}),f.jsx(kn,{style:{whiteSpace:"pre"},children:`BigQuery Field mode:
|
|
739
739
|
NULLABLE - field can be NULL
|
|
740
740
|
REQUIRED - field cant be NULL
|
|
741
|
-
REPEATED - field is an Array of Type`})]}),size:80,cell:({row:H})=>f.jsx(eut,{mode:H.getValue("mode"),onModeChange:j=>{u(H.index,{mode:j})}}),columnIndex:4}],[u]),y=x.useCallback(()=>f.jsxs("div",{className:"flex items-center",children:[i&&f.jsx(Xdt,{isAllExpanded:d,onToggle:r}),f.jsxs(Tn,{children:[f.jsx(In,{className:"cursor-default",children:"Name"}),f.jsx(kn,{children:"Field name in the output schema"})]})]}),[i,d,r]),L=x.useCallback(({row:H})=>{const j=o[H.index],W=(j.type===Ho.RECORD||j.type===Ho.STRUCT)&&j.fields&&j.fields.length>0,U=j.path??"",B=j.level??0,K=t.has(U);return f.jsxs("div",{className:"flex items-center",children:[B>0&&f.jsx("div",{style:{width:`${String(B*16-(W?4:0))}px`},className:"flex-shrink-0"}),W?f.jsx(Qdt,{isExpanded:K,onToggle:()=>{s(U)},ariaLabel:K?"Collapse nested fields":"Expand nested fields"}):i&&f.jsx("div",{className:"w-5"}),f.jsx(jE,{value:H.getValue("name"),onValueChange:X=>{u(H.index,{name:X})},placeholder:"Field name is required",isBold:!0})]})},[o,t,i,s,u]),E=x.useCallback(({row:H})=>{const j=o[H.index],V=j.type===Ho.RECORD||j.type===Ho.STRUCT;return(j.level??0)===0&&!V?f.jsx(AIe,{isPrimaryKey:H.getValue("isPrimaryKey"),onPrimaryKeyChange:U=>{u(H.index,{isPrimaryKey:U})}}):f.jsx("div",{})},[o,u]),R=x.useCallback(({row:H})=>f.jsx(jE,{value:H.getValue("description"),onValueChange:j=>{u(H.index,{description:j})},minRows:5,placeholder:"-"}),[u]),T=x.useCallback(({row:H})=>f.jsx(jE,{value:H.getValue("alias"),onValueChange:j=>{u(H.index,{alias:j})},placeholder:"-"}),[u]),N=x.useCallback(({row:H})=>f.jsx(xIe,{row:H,onDeleteRow:e?h:void 0,onAddNestedField:e?g:void 0,isRecordType:l}),[e,h,g,l]),{handleDragEnd:I}=Are(n,e,o),M=x.useCallback(H=>{const j=o[H.index];return j.path??String(o.indexOf(j))},[o]),P=Hre(jre(UM,{activationConstraint:{distance:5}}));return f.jsx(Ure,{sensors:P,collisionDetection:Bre,onDragEnd:I,children:f.jsx(Yre,{fields:o,onFieldsChange:e,onAddRow:m,createNewField:b,renderTypeCell:v,additionalColumns:C,fieldsForStatusCount:c,onSearchChange:a,nameColumnHeader:y,nameColumnCell:L,primaryKeyColumnCell:E,aliasColumnCell:T,descriptionColumnCell:R,actionsColumnCell:N,dragContext:Gre,dragContextProps:{items:o.map(H=>H.path??String(o.indexOf(H))),strategy:$re},rowComponent:qre,getRowId:M})})}function hut({fields:n,onFieldsChange:e}){const t=x.useCallback(()=>({name:"",type:Gse.STRING,isPrimaryKey:!1,status:Mu.DISCONNECTED}),[]),i=x.useCallback(({row:o,updateField:a})=>f.jsx(Zre,{type:o.getValue("type"),storageType:lt.AWS_ATHENA,onTypeChange:l=>{a(o.index,{type:l})}}),[]),{handleDragEnd:s}=Are(n,e),r=Hre(jre(UM,{activationConstraint:{distance:5}}));return f.jsx(Ure,{sensors:r,collisionDetection:Bre,onDragEnd:s,children:f.jsx(Yre,{fields:n,onFieldsChange:e,createNewField:t,renderTypeCell:i,dragContext:Gre,dragContextProps:{items:n.map((o,a)=>a),strategy:$re},rowComponent:qre})})}function fut({fields:n,onFieldsChange:e}){const t=x.useCallback(()=>({name:"",type:qse.VARCHAR,isPrimaryKey:!1,status:Mu.DISCONNECTED}),[]),i=x.useCallback(({row:o,updateField:a})=>f.jsx(Zre,{type:o.getValue("type"),storageType:lt.SNOWFLAKE,onTypeChange:l=>{a(o.index,{type:l})}}),[]),{handleDragEnd:s}=Are(n,e),r=Hre(jre(UM,{activationConstraint:{distance:5}}));return f.jsx(Ure,{sensors:r,collisionDetection:Bre,onDragEnd:s,children:f.jsx(Yre,{fields:n,onFieldsChange:e,createNewField:t,renderTypeCell:i,dragContext:Gre,dragContextProps:{items:n.map((o,a)=>a),strategy:$re},rowComponent:qre})})}function gut({schema:n,storageType:e,onFieldsChange:t}){const i=x.useMemo(()=>{if(!n){const s=act(e);return t(s.fields),s}return n},[n,e,t]);return QTe(i)?f.jsx(uut,{fields:i.fields,onFieldsChange:t}):JTe(i)?f.jsx(hut,{fields:i.fields,onFieldsChange:t}):eIe(i)?f.jsx(fut,{fields:i.fields,onFieldsChange:t}):f.jsx("div",{className:"p-4 text-center",children:f.jsx("p",{children:"Unsupported schema type"})})}function put({definitionType:n}){const{dataMart:e,updateDataMartSchema:t,isLoading:i,error:s,runSchemaActualization:r,isSchemaActualizationLoading:o}=Zu(),{id:a="",schema:l}=e??{},{schema:c,isDirty:d,updateSchema:u,resetSchema:h}=cct(l),{operationStatus:g,startSaveOperation:m}=dct(i,s);x.useEffect(()=>{g==="success"&&h()},[g,h]);const b=x.useCallback(E=>{u(E)},[u]),v=x.useCallback(()=>{a&&c&&(m(),t(a,c).then(()=>{r==null||r()}))},[a,c,m,t,r]),C=x.useCallback(()=>{r==null||r()},[r]),y=x.useCallback(()=>{h()},[h]),L=i||o;return e?f.jsxs("div",{className:"space-y-4",children:[f.jsx(gut,{schema:c,storageType:e.storage.type,onFieldsChange:b}),f.jsxs("div",{className:"align-items-center mt-8 flex justify-between",children:[f.jsxs("div",{className:"flex space-x-4",children:[f.jsx(rt,{variant:"default",onClick:v,disabled:!d||L,children:"Save"}),f.jsx(rt,{type:"button",variant:"ghost",onClick:y,disabled:!d||L,children:"Discard"})]}),f.jsx(rt,{type:"button",variant:"outline",onClick:C,disabled:!n||L,children:"Refresh schema"})]})]}):f.jsx("div",{children:"Error: Data mart not found"})}function mut(){const n=Dne(),{id:e,projectId:t}=n;return e?t?f.jsx("div",{className:"dm-page",children:f.jsx(LRe,{children:f.jsx(Qst,{id:e})})}):f.jsx("div",{className:"dm-page-header",children:"Project ID is required"}):f.jsx("div",{className:"dm-page-header",children:"Data Mart ID is required"})}function _ut({className:n,...e}){return f.jsx("div",{"data-slot":"card",className:Le("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),...e})}function but({className:n,...e}){return f.jsx("div",{"data-slot":"card-header",className:Le("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...e})}function vut({className:n,...e}){return f.jsx("div",{"data-slot":"card-title",className:Le("leading-none font-semibold",n),...e})}function Cut({className:n,...e}){return f.jsx("div",{"data-slot":"card-description",className:Le("text-muted-foreground text-sm",n),...e})}function wut({className:n,...e}){return f.jsx("div",{"data-slot":"card-content",className:Le("px-6",n),...e})}function yut({className:n,...e}){return f.jsx("div",{"data-slot":"card-footer",className:Le("flex items-center px-6 [.border-t]:pt-6",n),...e})}const Xre=x.createContext({isCollapsed:!1,collapsible:!1,handleCollapse:()=>{throw new Error("CollapsibleCardContext: handleCollapse not implemented")}});function hp({icon:n,tooltip:e,subtitle:t,children:i}){const{isCollapsed:s}=x.useContext(Xre);return f.jsxs("div",{className:"flex items-center gap-2 self-center",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"text-foreground flex h-7 w-7 items-center justify-center rounded-sm bg-gray-200/50 transition-colors duration-200 group-hover:bg-gray-200/75 dark:bg-white/8 dark:group-hover:bg-white/10",children:f.jsx(n,{size:18})}),f.jsx(vut,{className:"text-md text-foreground leading-none font-medium",children:i})]}),t&&f.jsx(Cut,{className:Le("text-md text-muted-foreground/50",!s&&"hidden"),children:t}),e&&f.jsx(Nf,{children:f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsxs("div",{className:"pointer-events-none ml-2 flex items-center opacity-0 transition-opacity duration-200 group-hover:pointer-events-auto group-hover:opacity-100",children:[f.jsx(sc,{className:"text-muted-foreground/50 hover:text-muted-foreground size-4 shrink-0 transition-colors"}),f.jsx("span",{className:"sr-only",children:e})]})}),f.jsx(kn,{children:f.jsx("p",{children:e})})]})})]})}hp.displayName="CollapsibleCardHeaderTitle";function $M({children:n,className:e}){const t=i=>{i.stopPropagation()};return f.jsx("div",{className:Le("flex items-center gap-2 self-center",e),onClick:t,children:n})}$M.displayName="CollapsibleCardHeaderActions";function fp({children:n}){const{collapsible:e,isCollapsed:t,handleCollapse:i}=x.useContext(Xre);let s,r;return x.Children.forEach(n,o=>{if(x.isValidElement(o))switch(o.type){case hp:s=o;break;case $M:r=o;break}}),f.jsxs(but,{className:Le("group flex items-start justify-between gap-4 px-4 py-4",e&&"cursor-pointer"),onClick:e?i:void 0,children:[s,f.jsxs("div",{className:"flex items-center gap-2",children:[r,e&&f.jsx("div",{className:Le("flex h-7 w-7 items-center justify-center rounded-full transition-colors duration-200 hover:bg-gray-200/50 dark:hover:bg-white/4"),children:f.jsx("div",{className:Le("transform transition-transform duration-200",t?"rotate-0":"rotate-180"),children:f.jsx(Pp,{className:"text-muted-foreground/75 dark:text-muted-foreground/50 h-4 w-4"})})})]})]})}fp.displayName="CollapsibleCardHeader";function gp({children:n}){return f.jsx(wut,{className:"px-4 pt-1",children:n})}gp.displayName="CollapsibleCardContent";function E_({left:n,right:e}){return f.jsxs(yut,{className:"flex items-center gap-2 px-4 py-4",children:[f.jsx("div",{className:"flex flex-grow items-center gap-2",children:n}),e&&f.jsx("div",{className:"flex items-center",children:e})]})}E_.displayName="CollapsibleCardFooter";const s_e="collapsed-card-";function c1({children:n,className:e,variant:t="default",collapsible:i=!1,defaultCollapsed:s=!1,onCollapsedChange:r,name:o}){const a=o?np.get(`${s_e}${o}`,"boolean")??s:s,[l,c]=x.useState(a);x.useEffect(()=>{o&&np.set(`${s_e}${o}`,l)},[l,o]);const d=()=>{const b=!l;c(b),r==null||r(b)};let u,h,g;x.Children.forEach(n,b=>{if(x.isValidElement(b))switch(b.type){case fp:u=b;break;case gp:h=b;break;case E_:g=b;break}});const m={default:"rounded-md p-0 gap-0 bg-muted/50 dark:bg-white/4 border-0 border-b border-gray-200 dark:border-white/8 shadow-none",dense:"rounded-md p-0 gap-0 bg-muted/50 dark:bg-white/4 border-0 border-b border-gray-200 dark:border-white/8 shadow-none text-sm",flat:"rounded-md p-0 gap-0 border-0 border-b-0 shadow-none"};return f.jsx(Xre.Provider,{value:{isCollapsed:l,collapsible:i,handleCollapse:d},children:f.jsxs(_ut,{className:Le(m[t],e),children:[u,f.jsx("div",{className:Le("grid transition-all duration-200",l?"grid-rows-[0fr]":"grid-rows-[1fr]"),children:f.jsxs("div",{className:"overflow-hidden",children:[h,g]})})]})})}function Sut(){const{dataMart:n,updateDataMartStorage:e}=og(),t=(n==null?void 0:n.definitionType)??null,[i,s]=x.useState(t);return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsxs(c1,{collapsible:!0,name:"data-storage",children:[f.jsx(fp,{children:f.jsx(hp,{icon:j1,tooltip:"Configure where your data will be stored",children:"Storage"})}),f.jsx(gp,{children:(n==null?void 0:n.storage)&&f.jsx(wat,{dataStorage:n.storage,onDataStorageChange:e})}),f.jsx(E_,{})]}),f.jsxs(c1,{collapsible:!0,name:"input-source",children:[f.jsx(fp,{children:f.jsx(hp,{icon:Pne,tooltip:"Configure how to extract data from your data warehouse",children:"Input Source"})}),f.jsx(gp,{children:n&&f.jsx(oct,{definitionType:i,initialDefinitionType:t,setDefinitionType:s})}),f.jsx(E_,{})]}),f.jsxs(c1,{collapsible:!0,name:"output-schema",children:[f.jsx(fp,{children:f.jsx(hp,{icon:KHe,tooltip:"Configure your data mart output schema",children:"Output Schema"})}),f.jsx(gp,{children:n&&f.jsx(put,{definitionType:i})}),f.jsx(E_,{})]})]})}function xut({row:n,onDeleteSuccess:e,onEditReport:t}){const[i,s]=x.useState(!1),[r,o]=x.useState(!1),[a,l]=x.useState(!1),{deleteReport:c,fetchReportsByDataMartId:d,runReport:u}=rg(),h=`actions-menu-${n.original.id}`,g=x.useCallback(async()=>{try{await c(n.original.id),await d(n.original.dataMart.id),e==null||e(),l(!1)}catch(C){console.error("Failed to delete Google Sheet:",C)}},[c,d,e,n.original.id,n.original.dataMart.id]),m=x.useCallback(()=>{t==null||t(n.original),o(!1)},[t,n.original]),b=x.useCallback(async()=>{try{s(!0),await u(n.original.id)}catch(C){console.error("Failed to run report:",C)}finally{s(!1)}},[u,n.original.id]),v=x.useCallback(()=>{l(!0),o(!1)},[]);return f.jsxs("div",{className:"text-right",onClick:C=>{C.stopPropagation()},children:[f.jsxs(Al,{open:r,onOpenChange:o,children:[f.jsx(Ml,{asChild:!0,children:f.jsxs(rt,{variant:"ghost",className:`dm-card-table-body-row-actionbtn opacity-0 transition-opacity ${r?"opacity-100":"group-hover:opacity-100"}`,"aria-label":`Actions for report: ${n.original.title}`,"aria-haspopup":"true","aria-expanded":r,"aria-controls":h,children:[f.jsx("span",{className:"sr-only",children:"Open menu"}),f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon","aria-hidden":"true"})]})}),f.jsxs(Ol,{id:h,align:"end",role:"menu",children:[f.jsxs(wn,{onClick:C=>{C.stopPropagation(),m()},role:"menuitem",children:[f.jsx(TR,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),"Edit report"]}),VH(n.original.destinationConfig)&&f.jsxs(f.Fragment,{children:[f.jsx(Vd,{}),f.jsxs(wn,{onClick:C=>{C.stopPropagation(),b()},disabled:i,role:"menuitem","aria-label":i?"Running report...":`Run report: ${n.original.title}`,children:[f.jsx(rH,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),i?"Running...":"Run report"]}),f.jsx(wn,{asChild:!0,children:f.jsxs("a",{href:Ese(n.original.destinationConfig.spreadsheetId,n.original.destinationConfig.sheetId),target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:C=>{C.stopPropagation()},children:[f.jsx(lBe,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),"Open document"]})})]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:C=>{C.stopPropagation(),v()},role:"menuitem","aria-label":`Delete report: ${n.original.title}`,children:[f.jsx(Wh,{className:"h-4 w-4 text-red-600","aria-hidden":"true"}),f.jsx("span",{className:"text-red-600",children:"Delete report"})]})]})]}),f.jsx(Ma,{open:a,onOpenChange:l,title:"Delete Report",description:`Are you sure you want to delete "${n.original.title}"? This action cannot be undone.`,confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{g()},variant:"destructive"})]})}const Lut={[Fr.SUCCESS]:{icon:sH,color:"text-green-500",label:"Success"},[Fr.ERROR]:{icon:rF,color:"text-red-500",label:"Fail"},[Fr.RUNNING]:{icon:NR,color:"text-primary animate-spin",label:"In progress"},[Fr.CANCELLED]:{icon:rF,color:"text-gray-500",label:"Cancelled"}};function OIe({status:n,error:e}){if(!n)return null;const t=Lut[n],{icon:i,color:s,label:r}=t,o=`status-tooltip-${n}-${e?"error":"normal"}`,a=()=>n===Fr.ERROR&&e?`${r}: ${e}`:r;return f.jsx(Nf,{children:f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx(i,{className:Le("h-5 w-5",s),role:"img","aria-label":a(),"aria-describedby":o,tabIndex:0})}),f.jsxs(kn,{id:o,side:"bottom",role:"tooltip",children:[f.jsx("div",{className:"text-xs",children:r}),n===Fr.ERROR&&e&&f.jsx("div",{className:"mt-1 max-w-xs text-xs break-words whitespace-normal",children:e})]})]})})}var Bv=(n=>(n.TITLE="title",n.LAST_RUN_DATE="lastRunDate",n.LAST_RUN_STATUS="lastRunStatus",n))(Bv||{});const Eut={[Bv.TITLE]:"Title",[Bv.LAST_RUN_DATE]:"Last Run Date",[Bv.LAST_RUN_STATUS]:"Last Run Status"},r_e=n=>{switch(n){case"right":return"text-right";case"center":return"text-center";default:return"text-left"}},Dut=({onDeleteSuccess:n,onEditReport:e}={})=>[{accessorKey:Bv.TITLE,header:({column:t})=>f.jsx(La,{column:t,children:Eut[Bv.TITLE]}),cell:({row:t})=>t.original.title,enableColumnFilter:!0,size:50},{accessorKey:Bv.LAST_RUN_DATE,header:({column:t})=>f.jsx(La,{column:t,children:"Last Run Date"}),cell:({row:t})=>{const i=t.original.lastRunDate;return f.jsx("div",{className:"text-muted-foreground text-sm",children:i?f.jsx(W1,{date:new Date(i)}):"Never run"})},size:25},{accessorKey:Bv.LAST_RUN_STATUS,header:({column:t})=>f.jsx(La,{column:t,children:"Last Run Status"}),cell:({row:t})=>t.original.lastRunStatus?f.jsx(OIe,{status:t.original.lastRunStatus,error:t.original.lastRunError}):f.jsx("span",{className:"text-muted-foreground text-sm",children:"—"}),size:25},{id:"actions",header:({table:t})=>f.jsx(BR,{table:t}),cell:({row:t})=>f.jsx(xut,{row:t,onDeleteSuccess:n,onEditReport:e}),size:80}];function Rut({destination:n,onEditReport:e}){const{reports:t,setPollingConfig:i}=rg(),s=x.useMemo(()=>t.filter(h=>h.dataDestination.type===St.GOOGLE_SHEETS&&h.dataDestination.id===n.id),[t,n.id]);x.useEffect(()=>{i({initialPollingIntervalMs:2e3,initialPollCount:3,regularPollingIntervalMs:5e3})},[i]);const r=x.useMemo(()=>Dut({onDeleteSuccess:()=>{},onEditReport:e}),[e]),{sorting:o,setSorting:a,columnVisibility:l,setColumnVisibility:c}=zS({columns:r,storageKeyPrefix:`data-mart-google-sheets-reports-${n.id}`,defaultSortingColumn:"lastRunDate"}),d=pC({data:s,columns:r,getCoreRowModel:gC(),onSortingChange:a,getSortedRowModel:WS(),state:{sorting:o,columnVisibility:l},onColumnVisibilityChange:c}),u=`google-sheets-reports-table-${n.id}`;return f.jsx("div",{className:"w-full",children:f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{id:u,className:"dm-card-table",role:"table","aria-label":`${n.title} reports`,children:[f.jsx(_C,{className:"dm-card-table-header",children:d.getHeaderGroups().map(h=>f.jsx(qr,{className:"dm-card-table-header-row",children:h.headers.map(g=>f.jsx(vC,{className:r_e(g.column.columnDef._align),style:g.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(g.column.getSize())}%`},scope:"col",children:g.isPlaceholder?null:typeof g.column.columnDef.header=="function"?g.column.columnDef.header(g.getContext()):g.column.columnDef.header},g.id))},h.id))}),f.jsx(bC,{className:"dm-card-table-body",children:d.getRowModel().rows.length?d.getRowModel().rows.map((h,g)=>f.jsx(qr,{onClick:()=>{const m=t.find(b=>b.id===h.original.id);m&&e(m)},className:"dm-card-table-body-row group",role:"row","aria-rowindex":g+1,children:h.getVisibleCells().map((m,b)=>f.jsx(Rl,{className:`px-6 whitespace-normal ${r_e(m.column.columnDef._align)}`,style:m.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(m.column.getSize())}%`},role:"cell","aria-colindex":b+1,children:typeof m.column.columnDef.cell=="function"?m.column.columnDef.cell(m.getContext()):m.column.columnDef.cell},m.id))},h.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:r.length,className:"dm-card-table-body-row-empty",role:"cell",children:f.jsx("span",{role:"status","aria-live":"polite",children:"No reports for this destination"})})})})]})})})}function Nut({row:n,onDeleteSuccess:e,onEditReport:t}){const[i,s]=x.useState(!1),[r,o]=x.useState(!1),[a,l]=x.useState(!1),{deleteReport:c,fetchReportsByDataMartId:d,runReport:u}=rg(),h=`actions-menu-${n.original.id}`,g=x.useCallback(async()=>{try{await c(n.original.id),await d(n.original.dataMart.id),e==null||e(),l(!1)}catch(C){console.error("Failed to delete report:",C)}},[c,d,e,n.original.id,n.original.dataMart.id]),m=x.useCallback(()=>{t==null||t(n.original),o(!1)},[t,n.original]),b=x.useCallback(async()=>{try{s(!0),await u(n.original.id)}catch(C){console.error("Failed to run report:",C)}finally{s(!1)}},[u,n.original.id]),v=x.useCallback(()=>{l(!0),o(!1)},[]);return f.jsxs("div",{className:"text-right",onClick:C=>{C.stopPropagation()},children:[f.jsxs(Al,{open:r,onOpenChange:o,children:[f.jsx(Ml,{asChild:!0,children:f.jsxs(rt,{variant:"ghost",className:`dm-card-table-body-row-actionbtn opacity-0 transition-opacity ${r?"opacity-100":"group-hover:opacity-100"}`,"aria-label":`Actions for report: ${n.original.title}`,"aria-haspopup":"true","aria-expanded":r,"aria-controls":h,children:[f.jsx("span",{className:"sr-only",children:"Open menu"}),f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon","aria-hidden":"true"})]})}),f.jsxs(Ol,{id:h,align:"end",role:"menu",children:[f.jsxs(wn,{onClick:C=>{C.stopPropagation(),m()},role:"menuitem",children:[f.jsx(TR,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),"Edit report"]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:C=>{C.stopPropagation(),b()},disabled:i,role:"menuitem","aria-label":i?"Running report...":`Run report: ${n.original.title}`,children:[f.jsx(rH,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),i?"Running...":"Run report"]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:C=>{C.stopPropagation(),v()},role:"menuitem","aria-label":`Delete report: ${n.original.title}`,children:[f.jsx(Wh,{className:"h-4 w-4 text-red-600","aria-hidden":"true"}),f.jsx("span",{className:"text-red-600",children:"Delete report"})]})]})]}),f.jsx(Ma,{open:a,onOpenChange:l,title:"Delete Report",description:`Are you sure you want to delete "${n.original.title}"? This action cannot be undone.`,confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{g()},variant:"destructive"})]})}function d$({column:n,children:e,label:t}){const i=n.getIsSorted(),s=x.useCallback(()=>{n.toggleSorting(n.getIsSorted()==="asc")},[n]),r=()=>i==="asc"?"sorted ascending":i==="desc"?"sorted descending":"not sorted",o=()=>i==="asc"?"ascending":i==="desc"?"descending":"none",a=t??(typeof e=="string"?e:"Column");return f.jsxs(rt,{variant:"ghost",onClick:s,className:"group dm-card-table-header-row-btn","aria-label":`${a} - ${r()}. Click to sort.`,"aria-sort":o(),children:[e,f.jsxs("span",{className:"flex h-4 w-4 items-center justify-center","aria-hidden":"true",children:[i==="asc"&&f.jsx(TD,{className:"text-foreground h-4 w-4"}),i==="desc"&&f.jsx(Pp,{className:"text-foreground h-4 w-4"}),!i&&f.jsx("span",{className:"opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:f.jsx(TD,{className:"text-muted-foreground h-4 w-4"})})]})]})}var Vv=(n=>(n.TITLE="title",n.LAST_RUN_DATE="lastRunDate",n.LAST_RUN_STATUS="lastRunStatus",n))(Vv||{});const PIe={[Vv.TITLE]:"Title",[Vv.LAST_RUN_DATE]:"Last Run Date",[Vv.LAST_RUN_STATUS]:"Last Run Status"};function Tut({table:n}){return f.jsx("div",{className:"px-4 text-right",children:f.jsxs(Al,{children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:"dm-card-table-body-row-actionbtn","aria-label":"Toggle columns",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsx(Ol,{align:"end",children:n.getAllColumns().filter(e=>e.getCanHide()&&e.id!=="actions").map(e=>{const t=PIe[e.id]||e.id;return f.jsx(wn,{className:"capitalize",children:f.jsxs("label",{className:"flex items-center space-x-2",children:[f.jsx("button",{type:"button",role:"checkbox","aria-checked":e.getIsVisible(),"data-state":e.getIsVisible()?"checked":"unchecked","aria-label":`Toggle column ${e.id}`,className:"peer border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border bg-white shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white/8",onClick:()=>{e.toggleVisibility(!e.getIsVisible())},children:e.getIsVisible()&&f.jsx("span",{"data-state":"checked","data-slot":"checkbox-indicator",className:"pointer-events-none flex items-center justify-center text-current transition-none",children:f.jsx(Wc,{className:"size-3.5 text-white"})})}),f.jsx("span",{children:t})]})},e.id)})})]})})}const o_e=n=>{switch(n){case"right":return"text-right";case"center":return"text-center";default:return"text-left"}},Iut=({onDeleteSuccess:n,onEditReport:e}={})=>[{accessorKey:Vv.TITLE,header:({column:t})=>f.jsx(d$,{column:t,children:PIe[Vv.TITLE]}),cell:({row:t})=>t.original.title,enableColumnFilter:!0,size:50},{accessorKey:Vv.LAST_RUN_DATE,header:({column:t})=>f.jsx(d$,{column:t,children:"Last Run Date"}),cell:({row:t})=>{const i=t.original.lastRunDate;return f.jsx("div",{className:"text-muted-foreground text-sm",children:i?f.jsx(W1,{date:new Date(i)}):"Never run"})},size:25},{accessorKey:Vv.LAST_RUN_STATUS,header:({column:t})=>f.jsx(d$,{column:t,children:"Last Run Status"}),cell:({row:t})=>t.original.lastRunStatus?f.jsx(OIe,{status:t.original.lastRunStatus,error:t.original.lastRunError}):f.jsx("span",{className:"text-muted-foreground text-sm",children:"—"}),size:25},{id:"actions",header:({table:t})=>f.jsx(Tut,{table:t}),cell:({row:t})=>f.jsx(Nut,{row:t,onDeleteSuccess:n,onEditReport:e}),size:80}];function kut({destinationType:n,destination:e,onEditReport:t}){const{reports:i,setPollingConfig:s}=rg(),r=x.useMemo(()=>i.filter(g=>g.dataDestination.type===n&&g.dataDestination.id===e.id),[i,e.id,n]);x.useEffect(()=>{s({initialPollingIntervalMs:2e3,initialPollCount:3,regularPollingIntervalMs:5e3})},[s]);const o=x.useMemo(()=>Iut({onDeleteSuccess:()=>{},onEditReport:t}),[t]),{sorting:a,setSorting:l,columnVisibility:c,setColumnVisibility:d}=zS({columns:o,storageKeyPrefix:`data-mart-email-reports-${e.id}`,defaultSortingColumn:"lastRunDate"}),u=pC({data:r,columns:o,getCoreRowModel:gC(),onSortingChange:l,getSortedRowModel:WS(),state:{sorting:a,columnVisibility:c},onColumnVisibilityChange:d}),h=`email-reports-table-${e.id}`;return f.jsx("div",{className:"w-full",children:f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{id:h,className:"dm-card-table",role:"table","aria-label":`${e.title} reports`,children:[f.jsx(_C,{className:"dm-card-table-header",children:u.getHeaderGroups().map(g=>f.jsx(qr,{className:"dm-card-table-header-row",children:g.headers.map(m=>f.jsx(vC,{className:o_e(m.column.columnDef._align),style:m.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(m.column.getSize())}%`},scope:"col",children:m.isPlaceholder?null:typeof m.column.columnDef.header=="function"?m.column.columnDef.header(m.getContext()):m.column.columnDef.header},m.id))},g.id))}),f.jsx(bC,{className:"dm-card-table-body",children:u.getRowModel().rows.length?u.getRowModel().rows.map((g,m)=>f.jsx(qr,{onClick:()=>{const b=i.find(v=>v.id===g.original.id);b&&t(b)},className:"dm-card-table-body-row group",role:"row","aria-rowindex":m+1,children:g.getVisibleCells().map((b,v)=>f.jsx(Rl,{className:`px-6 whitespace-normal ${o_e(b.column.columnDef._align)}`,style:b.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(b.column.getSize())}%`},role:"cell","aria-colindex":v+1,children:typeof b.column.columnDef.cell=="function"?b.column.columnDef.cell(b.getContext()):b.column.columnDef.cell},b.id))},g.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:o.length,className:"dm-card-table-body-row-empty",role:"cell",children:f.jsx("span",{role:"status","aria-live":"polite",children:"No reports for this destination"})})})})]})})})}function Aut({children:n,className:e,...t}){return f.jsx("div",{className:Le("group flex items-start justify-center gap-3 rounded-md border-b border-gray-200 bg-white transition-shadow duration-200 hover:shadow-xs dark:border-0 dark:bg-white/2",e),...t,children:n})}function Mut({children:n,className:e,...t}){return f.jsx("div",{className:Le("flex flex-grow flex-col gap-1 py-4",e),...t,children:n})}function Out({children:n,className:e,...t}){return f.jsx("div",{className:Le("text-md font-medium",e),...t,children:n})}function Put({children:n,className:e,...t}){return f.jsx("div",{className:Le("text-muted-foreground text-sm",e),...t,children:n})}function Fut({checked:n,disabled:e,loading:t,onCheckedChange:i,tooltipTextSwitchOn:s,tooltipTextSwitchOff:r,tooltipTextSwitchDisabled:o}){const a=e?o??"Disabled":n?s:r;return f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("div",{className:"flex items-center justify-center py-5 pl-6",onClick:l=>l.stopPropagation(),children:t?f.jsx(NR,{className:"text-muted-foreground h-5 w-5 animate-spin"}):f.jsx(WTe,{checked:n,disabled:e,onCheckedChange:i})})}),f.jsx(kn,{children:a})]})}function jut({icon:n,className:e,...t}){return f.jsx("div",{className:Le("flex flex-shrink-0 items-center justify-center self-center p-4",e),...t,children:f.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full transition-colors duration-200 group-hover:bg-gray-200/50 dark:group-hover:bg-white/4",children:n??f.jsx($d,{className:"text-muted-foreground/75 dark:text-muted-foreground/50 h-4 w-4"})})})}function Hut(n){const{dataMart:e}=Zu(),{reports:t,createReport:i,deleteReport:s,fetchReportsByDataMartId:r}=rg(),[o,a]=x.useState(!1),l=x.useMemo(()=>t.find(g=>g.dataDestination.type===St.LOOKER_STUDIO&&g.dataDestination.id===n.id),[t,n.id]),c=x.useMemo(()=>(e==null?void 0:e.status.code)===Ll.PUBLISHED,[e==null?void 0:e.status.code]),d=x.useMemo(()=>!!l,[l]),u=x.useMemo(()=>d?"Available in Looker Studio":"Not available in Looker Studio",[d]),h=x.useCallback(async g=>{if(!(!e||!c)){a(!0);try{if(g){const m={title:`Looker Studio Report - ${n.title}`,dataMartId:e.id,dataDestinationId:n.id,destinationConfig:{type:nl.LOOKER_STUDIO_CONFIG,cacheLifetime:300}};await i(m),await r(e.id)}else l&&(await s(l.id),await r(e.id))}catch(m){console.error("Failed to toggle Looker Studio report:",m)}finally{a(!1)}}},[e,c,n,l,i,s,r]);return{existingReport:l,isLoading:o,isEnabled:c,isChecked:d,dynamicTitle:u,handleSwitchChange:h}}function But({destination:n,onEditReport:e,...t}){const{existingReport:i,isLoading:s,isEnabled:r,isChecked:o,dynamicTitle:a,handleSwitchChange:l}=Hut(n),c=x.useCallback(()=>{i&&e(i)},[i,e]);return f.jsxs(Aut,{className:i?"cursor-pointer dark:hover:bg-white/5":"",onClick:i?c:void 0,...t,children:[f.jsx(Fut,{checked:o,disabled:!r,loading:s,onCheckedChange:d=>void l(d),tooltipTextSwitchOn:"Switch off to remove access",tooltipTextSwitchOff:"Switch on to enable access",tooltipTextSwitchDisabled:"Publish the Data Mart first to enable access in Looker Studio"}),f.jsxs(Mut,{children:[f.jsx(Out,{children:a}),f.jsx(Put,{children:o&&i?f.jsx(f.Fragment,{children:i.lastRunDate?f.jsxs(f.Fragment,{children:["Last fetched"," ",i.lastRunStatus===Fr.SUCCESS&&"successfully ",f.jsx(W1,{date:new Date(i.lastRunDate)}),i.lastRunStatus===Fr.ERROR&&" but failed with error",i.lastRunError&&f.jsx("div",{className:"mt-1 text-red-600 dark:text-red-400",children:i.lastRunError})]}):"Waiting for Looker Studio to fetch data"}):"Switch on to enable access"})]}),o&&i&&f.jsx(jut,{})]})}function Vut(){const{scope:n}=hb();return f.jsx("div",{className:"dm-card",children:f.jsxs("div",{className:"dm-empty-state",children:[f.jsx(Mne,{className:"dm-empty-state-ico",strokeWidth:1}),f.jsx("h2",{className:"dm-empty-state-title",children:"Google Sheets, Looker Studio… and friends!"}),f.jsx("p",{className:"dm-empty-state-subtitle",children:"To send your Data Mart's data to your favorite tools, create a Destination first."}),f.jsx(rt,{variant:"outline",asChild:!0,children:f.jsxs(Vc,{to:n("/data-destinations"),className:"flex items-center gap-1",children:["Go to Destinations",f.jsx($d,{className:"h-4 w-4"})]})})]})})}function Wut(){const[n,e]=x.useState(!1),[t,i]=x.useState(xr.CREATE),[s,r]=x.useState(null);return{isOpen:n,mode:t,editingReport:s,handleAddReport:()=>{i(xr.CREATE),r(null),e(!0),Vt({event:"report_open",category:"Report",action:"CreateReport",label:"ReportForm"})},handleEditReport:c=>{i(xr.EDIT),r(c),e(!0),Vt({event:"report_open",category:"Report",action:"EditReport",label:c.dataDestination.type})},handleCloseModal:()=>{e(!1),r(null),Vt({event:"report_close",category:"Report",action:t===xr.EDIT?"Edit":"Create",label:"ReportForm"})}}}const zut=[St.GOOGLE_SHEETS,St.EMAIL,St.SLACK,St.MS_TEAMS,St.GOOGLE_CHAT];function Uut({destination:n,dataMartStatus:e}){const{destinationInfo:t,isVisible:i}=RJe(n),{isOpen:s,mode:r,editingReport:o,handleAddReport:a,handleEditReport:l,handleCloseModal:c}=Wut();return i?f.jsxs(f.Fragment,{children:[f.jsxs(c1,{name:n.id,collapsible:!0,defaultCollapsed:!1,children:[f.jsxs(fp,{children:[f.jsx(hp,{icon:t.icon,children:n.title}),f.jsx($M,{children:zut.includes(n.type)&&f.jsx($ut,{dataMartStatus:e,onAddReport:a})})]}),f.jsx(gp,{children:f.jsx(bht,{destination:n,onEditReport:l})}),f.jsx(E_,{})]}),f.jsx(_ht,{destination:n,isOpen:s,onClose:c,mode:r,initialReport:o})]}):null}function $ut({dataMartStatus:n,onAddReport:e}){const t=(n==null?void 0:n.code)===Ll.DRAFT;return f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("span",{children:f.jsxs(rt,{onClick:e,variant:"outline",size:"sm","aria-label":"Add new report",disabled:t,children:[f.jsx(Gd,{className:"h-4 w-4"}),"Add Report"]})})}),t&&f.jsx(kn,{children:f.jsx("p",{children:"To create a report, publish the Data Mart first"})})]})}function Gut({elementId:n,isOpen:e,delay:t=100,selectText:i=!1}){x.useEffect(()=>{{const s=setTimeout(()=>{const r=document.getElementById(n);if(r){const o=r;o.focus(),i&&o.value?o.select():o.value&&o.setSelectionRange(o.value.length,o.value.length)}},t);return()=>{clearTimeout(s)}}},[e,n,t,i])}const qut=_s({title:pn().min(1,"Title is required"),documentUrl:pn().refine(ADe,"Enter a valid Google Sheets URL"),dataDestinationId:pn().min(1,"Destination is required")});function Kut({initialReport:n,mode:e,dataMartId:t,onSuccess:i,preSelectedDestination:s}){const[r,o]=x.useState(null),[a,l]=x.useState(!1),{updateReport:c,createReport:d,error:u,clearError:h}=rg();x.useEffect(()=>{a&&u&&(o(u),l(!1))},[u,a]);const g=Bp({resolver:pb(qut),defaultValues:{title:(n==null?void 0:n.title)??"",documentUrl:n!=null&&n.destinationConfig&&VH(n.destinationConfig)?`https://docs.google.com/spreadsheets/d/${n.destinationConfig.spreadsheetId}/edit#gid=${n.destinationConfig.sheetId}`:"",dataDestinationId:(n==null?void 0:n.dataDestination.id)??(s==null?void 0:s.id)??""},mode:"onTouched"}),{register:m,handleSubmit:b,formState:v,reset:C}=g,{errors:y,isDirty:L}=v,E=x.useCallback(async R=>{try{o(null),h(),l(!0);const{spreadsheetId:T,sheetId:N}=rJe(R.documentUrl);if(!T){o("Invalid Google Sheets URL");return}let I;if(e===xr.CREATE)I=await d({title:R.title,dataMartId:t,dataDestinationId:R.dataDestinationId,destinationConfig:{type:nl.GOOGLE_SHEETS_CONFIG,spreadsheetId:T,sheetId:N}});else{if(!n){o("Initial report is required for edit mode");return}I=await c(n.id,{title:R.title,dataDestinationId:R.dataDestinationId,destinationConfig:{type:nl.GOOGLE_SHEETS_CONFIG,spreadsheetId:T,sheetId:N}})}if(!I||u){o(u??"An error occurred while submitting the form");return}i==null||i()}catch(T){console.error("Error submitting form:",T),o("An error occurred while submitting the form")}},[e,n,t,d,c,i,h,u]);return{form:g,register:m,handleSubmit:b,errors:y,isDirty:L,reset:C,formError:r,isSubmitting:a,setFormError:o,getValues:g.getValues,onSubmit:E}}function Zut(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"service-account-details",children:[f.jsx(is,{children:"How do I get a correct document link?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"To get the correct Google Sheets document URL with a Sheet ID (GID), follow these steps:"}),f.jsxs("ol",{className:"list-inside list-decimal space-y-2 text-sm",children:[f.jsxs("li",{children:["Open your Google Sheets document and select the specific ",f.jsx("strong",{children:"sheet tab"})," ","where the data should be inserted."]}),f.jsxs("li",{children:["Share the document with the service account email and grant it ",f.jsx("strong",{children:"Editor"})," ","access."]}),f.jsxs("li",{children:["While the correct sheet is selected, copy the URL from your browser's address bar — it should include the ",f.jsx("code",{className:"text-sm font-semibold",children:"gid"})," of that sheet."]}),f.jsx("li",{children:"Paste this URL into the field above."})]})]})]})})}function u$(n){return"serviceAccount"in n}function FIe({value:n,children:e,doNotTruncateContent:t}){const[i,s]=x.useState(!1),r=async()=>{n&&(await navigator.clipboard.writeText(n),s(!0),setTimeout(()=>s(!1),2e3))};return f.jsx(Nf,{children:f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsxs("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:o=>o.key==="Enter"&&r(),className:Le("flex cursor-pointer items-center justify-between gap-2 select-none","text-muted-foreground border-input rounded-md border px-3 py-1.5 text-sm","hover:bg-accent hover:text-accent-foreground transition-colors"),children:[f.jsx("span",{className:t?"w-[95%]":"truncate",children:e||n||"No data"}),i?f.jsx(Wc,{className:"h-4 w-4 text-green-500"}):f.jsx(t2,{className:"h-4 w-4"})]})}),f.jsx(kn,{children:f.jsx("p",{children:i?"Copied!":"Click to copy"})})]})})}const Yut=x.forwardRef(({initialReport:n,mode:e=xr.EDIT,onDirtyChange:t,onFormErrorChange:i,onSubmit:s,onCancel:r,preSelectedDestination:o},a)=>{const l="google-sheets-edit-form",c="google-sheets-title-input",d="google-sheets-document-url-input",u="google-sheets-data-destination-select",{dataMart:h}=Zu(),{scope:g}=hb(),{dataDestinations:m,fetchDataDestinations:b,loading:v}=MM(),[C,y]=x.useState([]);x.useEffect(()=>{h&&b()},[h,b]),x.useEffect(()=>{if(m.length>0){const H=m.filter(j=>j.type===St.GOOGLE_SHEETS);y(H)}},[m]),Gut({elementId:c,isOpen:!0,delay:150});const{isDirty:L,reset:E,form:R,isSubmitting:T,formError:N,onSubmit:I}=Kut({initialReport:n,mode:e,dataMartId:(h==null?void 0:h.id)??"",onSuccess:()=>{s==null||s()},preSelectedDestination:o});x.useEffect(()=>{i&&i(N)},[N,i]),x.useEffect(()=>{if(e===xr.EDIT&&n&&VH(n.destinationConfig))E({title:n.title,documentUrl:Ese(n.destinationConfig.spreadsheetId,n.destinationConfig.sheetId),dataDestinationId:n.dataDestination.id});else if(e===xr.CREATE){const H=(o==null?void 0:o.id)??"";E({title:"",documentUrl:"",dataDestinationId:H})}},[n,e,E,o]),x.useEffect(()=>{t==null||t(L)},[L,t]);const M=R.watch("documentUrl"),P=M&&ADe(M.trim());return f.jsx(CC,{...R,children:f.jsxs(gb,{id:l,ref:a,noValidate:!0,onSubmit:H=>void R.handleSubmit(I)(H),children:[f.jsxs(wC,{children:[f.jsxs(tc,{title:"General",children:[f.jsx(fn,{control:R.control,name:"title",render:({field:H})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Add a title that reflects the report`s purpose",children:"Title"}),f.jsx(cn,{children:f.jsx(vn,{id:c,placeholder:"Enter a report title",...H})}),f.jsx(Cn,{})]})}),f.jsx(fn,{control:R.control,name:"dataDestinationId",render:({field:H})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Select one of your existing destinations",children:"Destination"}),f.jsxs($c,{onValueChange:H.onChange,value:H.value,disabled:v||C.length===0,children:[f.jsx(cn,{children:f.jsx(qc,{id:u,className:"w-full max-w-full overflow-hidden",children:f.jsx(Gc,{className:"truncate",placeholder:"Select a destination",children:H.value&&C.length>0&&(()=>{const j=C.find(V=>V.id===H.value);if(j){const W=Nc.getInfo(j.type).icon;return f.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[f.jsx(W,{className:"flex-shrink-0",size:18}),f.jsx("div",{className:"flex min-w-0 flex-col",children:f.jsx("span",{className:"truncate",children:j.title})})]})}return null})()})})}),f.jsx(Kc,{children:C.map(j=>{const W=Nc.getInfo(j.type).icon;return f.jsx(fo,{value:j.id,children:f.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[f.jsx(W,{className:"flex-shrink-0",size:18}),f.jsxs("div",{className:"flex min-w-0 flex-col",children:[f.jsx("span",{className:"truncate",children:j.title}),f.jsx("span",{className:"text-muted-foreground truncate text-xs",children:(u$(j.credentials)&&HU(j.credentials.serviceAccount))??"No email found"})]})]})},j.id)})})]}),C.length===0&&!v&&f.jsxs(Dre,{className:"mt-2",children:[f.jsx(fM,{className:"h-4 w-4"}),f.jsx(kTe,{children:"No destinations available"}),f.jsxs(Rre,{children:["You need to create a Destination before you can create a report."," ",f.jsx(Vc,{to:g("/data-destinations"),className:"font-medium text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:"Go to Destinations"})]})]}),H.value&&C.length>0&&(()=>{const j=C.find(V=>V.id===H.value);return j?f.jsxs("div",{className:"mt-2 flex flex-col gap-1",children:[f.jsx(Ji,{children:"Service Account Email"}),f.jsx(FIe,{value:u$(j.credentials)?HU(j.credentials.serviceAccount)??"No email found":"",children:u$(j.credentials)?HU(j.credentials.serviceAccount):"No email found"})]}):null})(),f.jsx(Cn,{})]})}),f.jsx(fn,{control:R.control,name:"documentUrl",render:({field:H})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"The link must include the Sheet ID to insert data into the correct tab",children:"Document Link with Sheet ID (GID)"}),f.jsx(cn,{children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(vn,{id:d,placeholder:"Document URL",className:"flex-1",...H}),f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("button",{type:"button",className:`flex-shrink-0 rounded-md p-2 transition-all duration-200 ${P?"text-blue-600 hover:bg-blue-50 hover:text-blue-700 dark:text-blue-400 dark:hover:bg-blue-950/20 dark:hover:text-blue-300":"text-muted-foreground/30 cursor-not-allowed"}`,onClick:()=>{P&&window.open(M.trim(),"_blank","noopener,noreferrer")},disabled:!P,"aria-label":P?"Open document in new tab":"Document link is not valid",children:f.jsx(F_,{className:"h-4 w-4","aria-hidden":"true"})})}),f.jsx(kn,{side:"top",align:"center",role:"tooltip",children:P?"Open document in new tab":"Enter a valid URL to enable link"})]})]})}),f.jsx(Hs,{children:f.jsx(Zut,{})}),f.jsx(Cn,{})]})})]}),f.jsx(tc,{title:"Automate Report Runs",children:f.jsx(Ire,{})})]}),f.jsxs(yC,{children:[f.jsx(rt,{variant:"default",type:"submit",className:"w-full","aria-label":e===xr.CREATE?"Create new report":"Save changes to report",disabled:!L||T,children:T?e===xr.CREATE?"Creating...":"Saving...":e===xr.CREATE?"Create new report":"Save changes to report"}),r&&f.jsx(rt,{variant:"outline",type:"button",onClick:r,className:"w-full","aria-label":"Cancel",children:"Cancel"})]})]})})});function Xut({isOpen:n,onClose:e,initialReport:t,mode:i,preSelectedDestination:s}){const[r,o]=x.useState(!1),[a,l]=x.useState(!1),c=x.useCallback(()=>{a?o(!0):e()},[a,e]),d=x.useCallback(()=>{o(!1),l(!1),e()},[e]),u=x.useCallback(g=>{l(g)},[]),h=x.useCallback(()=>{l(!1),e()},[e]);return f.jsxs(f.Fragment,{children:[f.jsx(ab,{open:n,onOpenChange:g=>{g||c()},children:f.jsxs(lb,{children:[f.jsxs(cb,{children:[f.jsx(db,{children:i===xr.CREATE?"Create new report":"Edit report"}),f.jsx(cC,{children:i===xr.CREATE?"Fill in the details to create a new Google Sheets report":"Update details of an existing Google Sheets report"})]}),f.jsx(AM,{children:f.jsx(Yut,{initialReport:t,mode:i,onDirtyChange:u,onSubmit:h,onCancel:c,preSelectedDestination:s})})]})}),f.jsx(Ma,{open:r,onOpenChange:o,title:"Unsaved Changes",description:"You have unsaved changes. Exit without saving?",confirmLabel:"Yes, leave now",cancelLabel:"No, stay here",onConfirm:d,variant:"destructive"})]})}const Qut=_s({cacheLifetime:NYe().min(300,"Cache time must be at least 5 minutes (300 seconds)")});function Jut({initialReport:n,dataMartId:e,onSuccess:t,preSelectedDestination:i}){const[s,r]=x.useState(null),{createReport:o,updateReport:a}=rg(),l=Bp({resolver:pb(Qut),defaultValues:{cacheLifetime:n!=null&&n.destinationConfig&&UDe(n.destinationConfig)?n.destinationConfig.cacheLifetime:300},mode:"onTouched"});return{form:l,onSubmit:async d=>{try{r(null);const{cacheLifetime:u}=d,h={type:nl.LOOKER_STUDIO_CONFIG,cacheLifetime:u};n?await a(n.id,{title:"Looker Studio Report",dataDestinationId:n.dataDestination.id,destinationConfig:h}):await o({title:"Looker Studio Report",dataMartId:e,dataDestinationId:(i==null?void 0:i.id)??"",destinationConfig:h}),t==null||t()}catch(u){console.error("Error submitting form:",u),r("Failed to save report. Please try again.")}},formError:s,isSubmitting:l.formState.isSubmitting,isDirty:l.formState.isDirty,reset:l.reset}}function eht(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"cache-lifetime-details",children:[f.jsx(is,{children:"What is the Cache Lifetime for Looker Studio?"}),f.jsx(ns,{children:f.jsx("p",{className:"mb-2",children:"Cache Lifetime - defines the period during which results from previous query executions are served from storage-side cache, eliminating the need to re-execute the query"})})]})})}const tht=[{value:300,label:"5 minutes"},{value:600,label:"10 minutes"},{value:900,label:"15 minutes"},{value:1800,label:"30 minutes"},{value:3600,label:"1 hour"},{value:7200,label:"2 hours"},{value:14400,label:"4 hours"},{value:28800,label:"8 hours"},{value:43200,label:"12 hours"}],iht=x.forwardRef(({initialReport:n,mode:e=xr.EDIT,onDirtyChange:t,onFormErrorChange:i,onSubmit:s,onCancel:r,preSelectedDestination:o},a)=>{const l="looker-studio-edit-form",{dataMart:c}=Zu(),{isDirty:d,reset:u,form:h,isSubmitting:g,formError:m,onSubmit:b}=Jut({initialReport:n,dataMartId:(c==null?void 0:c.id)??"",onSuccess:()=>{s==null||s()},preSelectedDestination:o});return x.useEffect(()=>{i&&i(m)},[m,i]),x.useEffect(()=>{e===xr.EDIT&&n&&UDe(n.destinationConfig)?u({cacheLifetime:n.destinationConfig.cacheLifetime}):e===xr.CREATE&&u({cacheLifetime:300})},[n,e,u]),x.useEffect(()=>{t==null||t(d)},[d,t]),f.jsx(CC,{...h,children:f.jsxs(gb,{id:l,ref:a,noValidate:!0,onSubmit:v=>void h.handleSubmit(b)(v),children:[f.jsx(wC,{children:f.jsx(tc,{title:"Cache Configuration",children:f.jsx(fn,{control:h.control,name:"cacheLifetime",render:({field:v})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Period during which query results are served from storage-side cache, avoiding re-execution",children:"Cache Lifetime"}),f.jsxs($c,{onValueChange:C=>{v.onChange(parseInt(C,10))},value:v.value.toString(),defaultValue:"300",children:[f.jsx(cn,{children:f.jsx(qc,{className:"w-full",children:f.jsx(Gc,{placeholder:"Select cache time"})})}),f.jsx(Kc,{children:tht.map(C=>f.jsx(fo,{value:C.value.toString(),children:C.label},C.value))})]}),f.jsx(Cn,{}),f.jsx(Hs,{children:f.jsx(eht,{})})]})})})}),f.jsxs(yC,{children:[f.jsx(rt,{variant:"default",type:"submit",className:"w-full","aria-label":e===xr.CREATE?"Create":"Save changes",disabled:!d||g,children:g?e===xr.CREATE?"Creating...":"Saving...":e===xr.CREATE?"Create":"Save changes"}),r&&f.jsx(rt,{variant:"outline",type:"button",onClick:r,className:"w-full","aria-label":"Cancel",children:"Cancel"})]})]})})});function nht({isOpen:n,onClose:e,initialReport:t,mode:i,preSelectedDestination:s}){const[r,o]=x.useState(!1),[a,l]=x.useState(!1),c=x.useCallback(()=>{a?o(!0):e()},[a,e]),d=x.useCallback(()=>{o(!1),l(!1),e()},[e]),u=x.useCallback(g=>{l(g)},[]),h=x.useCallback(()=>{l(!1),e()},[e]);return f.jsxs(f.Fragment,{children:[f.jsx(ab,{open:n,onOpenChange:g=>{g||c()},children:f.jsxs(lb,{children:[f.jsxs(cb,{children:[f.jsx(db,{children:(s==null?void 0:s.title)??"Looker Studio"}),f.jsx(cC,{children:i===xr.CREATE?"Set up Data Mart as a data source":"Update connection details"})]}),f.jsx(AM,{children:f.jsx(iht,{initialReport:t,mode:i,onDirtyChange:u,onSubmit:h,onCancel:c,preSelectedDestination:s})})]})}),f.jsx(Ma,{open:r,onOpenChange:o,title:"Unsaved Changes",description:"You have unsaved changes. Exit without saving?",confirmLabel:"Yes, leave now",cancelLabel:"No, stay here",onConfirm:d,variant:"destructive"})]})}const a_e=({destination:n})=>{const t=Nc.getInfo(n.type).icon;return f.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[f.jsx(t,{className:"flex-shrink-0",size:18}),f.jsx("div",{className:"flex min-w-0 flex-col",children:f.jsx("span",{className:"truncate",children:n.title})})]})};function sht(n){return"to"in n}const rht=({destination:n})=>{if(!n)return null;const e=n.credentials,t=sht(e)&&e.to.length?e.to.join(", "):"";return f.jsxs("div",{className:"mt-2 flex flex-col gap-1",children:[f.jsx(Ji,{children:"Recipients of this report"}),f.jsx(FIe,{doNotTruncateContent:!0,value:t,children:t||"No recipients found"})]})};var ay=(n=>(n.ALWAYS="ALWAYS",n.RESULT_IS_EMPTY="RESULT_IS_EMPTY",n.RESULT_IS_NOT_EMPTY="RESULT_IS_NOT_EMPTY",n))(ay||{});const oht=_s({title:pn().min(1,"Title is required"),dataDestinationId:pn().min(1,"Destination is required"),reportCondition:TH(ay),subject:pn().min(1,"Subject is required"),messageTemplate:pn().min(1,"Message body is required")});function aht({initialReport:n,mode:e,dataMartId:t,onSuccess:i,preSelectedDestination:s}){const[r,o]=x.useState(null),[a,l]=x.useState(!1),{updateReport:c,createReport:d,error:u,clearError:h}=rg();x.useEffect(()=>{a&&u&&(o(u),l(!1))},[u,a]);const g=Bp({resolver:pb(oht),defaultValues:{title:(n==null?void 0:n.title)??"",dataDestinationId:(n==null?void 0:n.dataDestination.id)??(s==null?void 0:s.id)??"",reportCondition:n!=null&&n.destinationConfig&&VU(n.destinationConfig)?n.destinationConfig.reportCondition:ay.ALWAYS,subject:n!=null&&n.destinationConfig&&VU(n.destinationConfig)?n.destinationConfig.subject:"",messageTemplate:n!=null&&n.destinationConfig&&VU(n.destinationConfig)?n.destinationConfig.messageTemplate:""},mode:"onTouched"}),{handleSubmit:m,formState:b,reset:v}=g,{isDirty:C,errors:y}=b,L=x.useCallback(async E=>{try{o(null),h(),l(!0);let R;const T={type:nl.EMAIL_CONFIG,reportCondition:E.reportCondition,subject:E.subject,messageTemplate:E.messageTemplate};if(e===xr.CREATE)R=await d({title:E.title,dataMartId:t,dataDestinationId:E.dataDestinationId,destinationConfig:T});else{if(!n){o("Initial report is required for edit mode");return}R=await c(n.id,{title:E.title,dataDestinationId:E.dataDestinationId,destinationConfig:T})}if(!R||u){o(u??"An error occurred while submitting the form");return}i==null||i()}catch(R){console.error("Error submitting form:",R),o("An error occurred while submitting the form")}},[e,n,t,d,c,i,h,u]);return{form:g,handleSubmit:m,errors:y,isDirty:C,reset:v,formError:r,isSubmitting:a,setFormError:o,onSubmit:L}}function lht({value:n,onChange:e,onBlur:t,height:i=240,theme:s="light",options:r,className:o,placeholder:a="Start writing your message…"}){const l=c=>{t&&c.onDidBlurEditorText(t)};return f.jsx(vre,{language:"markdown",height:i,value:n,onChange:c=>{e(c??"")},onMount:l,theme:s,options:{wordWrap:"on",minimap:{enabled:!1},lineNumbers:"off",folding:!1,scrollBeyondLastLine:!1,automaticLayout:!0,placeholder:a,...r},className:o})}const cht=()=>f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(bl,{className:"h-6 w-3/4"}),f.jsx(bl,{className:"h-4 w-1/2"})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(bl,{className:"h-4 w-full"}),f.jsx(bl,{className:"h-4 w-5/6"}),f.jsx(bl,{className:"h-4 w-4/5"}),f.jsx(bl,{className:"h-4 w-3/4"})]})]});function jIe({html:n,loading:e=!1,error:t=null,height:i=240,className:s,emptyState:r=f.jsx("div",{className:"text-muted-foreground text-sm",children:"Nothing to preview"})}){let o="#fff",a="#000";if(typeof window<"u"){const l=getComputedStyle(document.documentElement),c=l.getPropertyValue("--background").trim(),d=l.getPropertyValue("--foreground").trim();c&&(o=c),d&&(a=d)}return f.jsxs("div",{className:`bg-background overflow-auto p-4 ${s??""}`,style:{height:i},children:[e&&f.jsx(cht,{}),!e&&t&&f.jsxs("div",{className:"text-destructive text-sm",children:["Error: ",t]}),!e&&!t&&!n&&r,!e&&!t&&!!n&&f.jsx("iframe",{title:"Markdown preview",sandbox:"allow-popups allow-popups-to-escape-sandbox",srcDoc:`<!doctype html><html lang='en' style="background:${o};color:${a}"><head><meta charset='utf-8'/><base target='_blank'></head><body>${n}</body></html>`,className:"h-full w-full border-0"})]})}function dht({value:n,onChange:e}){return f.jsx(ore,{value:n,onValueChange:t=>{e(t)},children:f.jsxs(are,{children:[f.jsx(u2,{value:"markdown",children:"Markdown"}),f.jsx(u2,{value:"preview",children:"Preview"})]})})}function uht({markdown:n,enabled:e=!0,debounceMs:t=300,toHtml:i}){const[s,r]=x.useState(""),[o,a]=x.useState(!1),[l,c]=x.useState(null),d=x.useRef(null);return x.useEffect(()=>{var m;if(!e)return;const u=n;if(!u.trim()){r(""),c(null),a(!1);return}const h=new AbortController;(m=d.current)==null||m.abort(),d.current=h,a(!0),c(null);const g=setTimeout(()=>{i(u,h.signal).then(b=>{r(b)}).catch(b=>{if(h.signal.aborted)return;const v=b instanceof Error?b.message:"Failed to load preview";c(v)}).finally(()=>{h.signal.aborted||a(!1)})},t);return()=>{clearTimeout(g),h.abort()}},[n,e,t,i]),{html:s,loading:o,error:l}}function hht(n,e){return Rd.post("/markdown/parse-to-html",{markdown:n},{headers:{"Content-Type":"application/json"},responseType:"text",signal:e}).then(t=>t.data)}function HIe(n){const e=x.useCallback(hht,[]);return uht({...n,toHtml:e})}function fht(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"message-details",children:[f.jsx(is,{children:"How can I format my message?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"You can format your message using Markdown — a simple text formatting syntax that lets you add structure and style without using complex editors."}),f.jsxs("p",{className:"mb-2",children:["For example:",f.jsx("br",{}),"**bold text** → ",f.jsx("b",{children:"bold text"}),f.jsx("br",{}),"__italic text__ → ",f.jsx("i",{children:"italic text"}),f.jsx("br",{}),"- list item → • list item"]}),f.jsxs("p",{children:["Use the Preview tab to see how your message will look after formatting.",f.jsx("br",{}),"If you’re new to Markdown, learn more from this"," ",f.jsx(ir,{className:"underline",href:"https://www.markdownguide.org/basic-syntax/",children:"quick guide"})]})]})]})})}function ght(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"sending-condition-details",children:[f.jsx(is,{children:"What are Data Mart Run results?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"A Data Mart Run result is the outcome of processing your Data Mart — for example, running an SQL query that retrieves data for your report."}),f.jsx("p",{children:"Before sending a report, OWOX automatically runs the Data Mart and checks its result. Depending on your settings, the report can be sent always, only if the result is not empty, or only if it’s empty."})]})]})})}const pht=[St.EMAIL,St.SLACK,St.GOOGLE_CHAT,St.MS_TEAMS],BIe=x.forwardRef(({initialReport:n,mode:e=xr.EDIT,onDirtyChange:t,onFormErrorChange:i,onSubmit:s,onCancel:r,preSelectedDestination:o},a)=>{const l="email-report-edit-form",{dataMart:c}=Zu(),{dataDestinations:d,fetchDataDestinations:u,loading:h}=MM(),[g,m]=x.useState([]);x.useEffect(()=>{c&&u()},[c,u]),x.useEffect(()=>{if(d.length>0){const B=o!=null&&o.type?[o.type]:pht,K=d.filter(X=>B.includes(X.type));m(K)}},[d,o==null?void 0:o.type]);const{isDirty:b,reset:v,form:C,isSubmitting:y,formError:L,onSubmit:E}=aht({initialReport:n,mode:e,dataMartId:(c==null?void 0:c.id)??"",onSuccess:()=>{s==null||s()},preSelectedDestination:o});x.useEffect(()=>{i&&i(L)},[L,i]),x.useEffect(()=>{if(!(e===xr.EDIT&&n)){if(e===xr.CREATE){const B=(o==null?void 0:o.id)??"";v({title:"",dataDestinationId:B,reportCondition:ay.ALWAYS,subject:"",messageTemplate:""})}}},[n,e,v,o]),x.useEffect(()=>{t==null||t(b)},[b,t]);const R=x.useMemo(()=>[{value:ay.ALWAYS,label:"Send always"},{value:ay.RESULT_IS_EMPTY,label:"Send only when result is empty"},{value:ay.RESULT_IS_NOT_EMPTY,label:"Send only when result is not empty"}],[]),{resolvedTheme:T}=AH(),N=T==="dark"?"vs-dark":"light",[I,M]=x.useState("markdown"),P=C.watch("messageTemplate"),{html:H,loading:j,error:V}=HIe({markdown:P,enabled:I==="preview"}),W=C.watch("dataDestinationId"),U=x.useMemo(()=>W&&g.length>0?g.find(B=>B.id===W)??null:null,[W,g]);return f.jsx(CC,{...C,children:f.jsxs(gb,{id:l,ref:a,noValidate:!0,onSubmit:B=>{C.handleSubmit(E)(B)},children:[f.jsxs(wC,{children:[f.jsxs(tc,{title:"General",children:[f.jsx(fn,{control:C.control,name:"title",render:({field:B})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Add a title that reflects the report`s purpose",children:"Title"}),f.jsx(cn,{children:f.jsx(vn,{placeholder:"Enter a report title",...B})}),f.jsx(Cn,{})]})}),f.jsx(fn,{control:C.control,name:"dataDestinationId",render:({field:B})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Select one of your existing destinations",children:"Destination"}),f.jsxs($c,{onValueChange:B.onChange,value:B.value,disabled:h||g.length===0,children:[f.jsx(cn,{children:f.jsx(qc,{className:"w-full max-w-full overflow-hidden",children:f.jsx(Gc,{className:"truncate",placeholder:"Select a destination",children:U&&f.jsx(a_e,{destination:U})})})}),f.jsx(Kc,{children:g.map(K=>f.jsx(fo,{value:K.id,children:f.jsx(a_e,{destination:K})},K.id))})]}),f.jsx(rht,{destination:U}),f.jsx(Cn,{})]})})]}),f.jsxs(tc,{title:"Template",children:[f.jsx(fn,{control:C.control,name:"subject",render:({field:B})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Add a short, clear subject line for your report",children:"Subject"}),f.jsx(cn,{children:f.jsx(vn,{placeholder:"Enter a message title",...B})}),f.jsx(Cn,{})]})}),f.jsx(fn,{control:C.control,name:"messageTemplate",render:({field:B})=>f.jsxs(tn,{children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx(Ji,{tooltip:"Write your report message in Markdown and check the final format in Preview",children:"Message"}),f.jsx(dht,{value:I,onChange:M})]}),f.jsx(cn,{children:f.jsx("div",{className:"overflow-hidden rounded-md border",children:I==="markdown"?f.jsx(lht,{value:B.value,onChange:K=>{B.onChange(K)},onBlur:B.onBlur,height:240,theme:N}):f.jsx(jIe,{html:H,loading:j,error:V,height:240})})}),f.jsx(Hs,{children:f.jsx(fht,{})}),f.jsx(Cn,{})]})})]}),f.jsx(tc,{title:"Sending conditions",children:f.jsx(fn,{control:C.control,name:"reportCondition",render:({field:B})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Define when the report should be sent based on your Data Mart’s execution result",children:"Data Mart Run results"}),f.jsxs($c,{onValueChange:B.onChange,value:B.value,children:[f.jsx(cn,{children:f.jsx(qc,{className:"w-full max-w-full overflow-hidden",children:f.jsx(Gc,{})})}),f.jsx(Kc,{children:R.map(K=>f.jsx(fo,{value:K.value,children:K.label},K.value))})]}),f.jsx(Hs,{children:f.jsx(ght,{})}),f.jsx(Cn,{})]})})}),f.jsx(tc,{title:"Automate Report Runs",children:f.jsx(Ire,{})})]}),f.jsxs(yC,{children:[f.jsx(rt,{variant:"default",type:"submit",disabled:y,children:e===xr.CREATE?"Create new report":"Save changes to report"}),f.jsx(rt,{variant:"outline",type:"button",onClick:r,disabled:y,children:"Cancel"})]})]})})});BIe.displayName="EmailReportEditForm";function mht({isOpen:n,onClose:e,initialReport:t,mode:i,preSelectedDestination:s}){const[r,o]=x.useState(!1),[a,l]=x.useState(!1),c=x.useCallback(()=>{a?o(!0):e()},[a,e]),d=x.useCallback(()=>{o(!1),l(!1),e()},[e]),u=x.useCallback(g=>{l(g)},[]),h=x.useCallback(()=>{l(!1),e()},[e]);return f.jsxs(f.Fragment,{children:[f.jsx(ab,{open:n,onOpenChange:g=>{g||c()},children:f.jsxs(lb,{children:[f.jsxs(cb,{children:[f.jsx(db,{children:(s==null?void 0:s.title)??"Report"}),f.jsx(cC,{children:i===xr.CREATE?"Fill in the details to create a new report":"Update details of an existing report"})]}),f.jsx(AM,{children:f.jsx(BIe,{initialReport:t,mode:i,onDirtyChange:u,onSubmit:h,onCancel:c,preSelectedDestination:s})})]})}),f.jsx(Ma,{open:r,onOpenChange:o,title:"Unsaved Changes",description:"You have unsaved changes. Exit without saving?",confirmLabel:"Yes, leave now",cancelLabel:"No, stay here",onConfirm:d,variant:"destructive"})]})}function _ht({destination:n,isOpen:e,onClose:t,mode:i,initialReport:s}){switch(n.type){case St.GOOGLE_SHEETS:return f.jsx(Xut,{isOpen:e,onClose:t,mode:i,preSelectedDestination:n,initialReport:s??void 0});case St.LOOKER_STUDIO:return f.jsx(nht,{isOpen:e,onClose:t,mode:i,preSelectedDestination:n,initialReport:s??void 0});case St.EMAIL:case St.SLACK:case St.GOOGLE_CHAT:case St.MS_TEAMS:return f.jsx(mht,{isOpen:e,onClose:t,mode:i,preSelectedDestination:n,initialReport:s??void 0});default:return null}}function bht({destination:n,onEditReport:e}){switch(n.type){case St.GOOGLE_SHEETS:return f.jsx(Rut,{destination:n,onEditReport:e});case St.EMAIL:case St.SLACK:case St.GOOGLE_CHAT:case St.MS_TEAMS:return f.jsx(kut,{destinationType:n.type,destination:n,onEditReport:e});case St.LOOKER_STUDIO:return f.jsx(But,{destination:n,onEditReport:e});default:return null}}function VIe(){return f.jsx("div",{className:"flex flex-col gap-4",children:f.jsx("div",{className:"space-y-2 pb-4",children:Array.from({length:3}).map((n,e)=>f.jsx("div",{className:"border-border rounded-lg border p-4",children:f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(bl,{className:"h-4 w-4 rounded-full"}),f.jsx(bl,{className:"h-4 w-40"}),f.jsx(bl,{className:"h-3 w-32"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(bl,{className:"h-6 w-16 rounded-full"}),f.jsx(bl,{className:"h-4 w-4"})]})]})},e))})})}function Qre({enabled:n,intervalMs:e=5e3,onlyWhenVisible:t=!0,onTick:i}){const s=x.useRef(i);s.current=i;const r=x.useRef(null);x.useEffect(()=>{var l;if(!n)return;(l=r.current)==null||l.abort(),r.current=new AbortController;const o=()=>{if(!t||document.visibilityState==="visible"){const c=new AbortController;s.current(c.signal)}};o();const a=window.setInterval(o,e);return()=>{var c;window.clearInterval(a),(c=r.current)==null||c.abort()}},[n,e,t])}function vht({enabled:n=!0,intervalMs:e=5e3}={}){const{dataMart:t}=Zu(),{fetchReportsByDataMartId:i}=rg(),s=t==null?void 0:t.id;x.useEffect(()=>{s&&i(s)},[s,i]),Qre({enabled:!!s&&n,intervalMs:e,onTick:()=>{s&&i(s,{silent:!0})}})}function Cht(){const{dataMart:n}=Zu(),{dataDestinations:e,isLoading:t}=NJe();return vht({enabled:!0,intervalMs:5e3}),n?f.jsx("div",{className:"flex flex-col gap-4",children:t?f.jsx(VIe,{}):e.length===0?f.jsx(Vut,{}):e.map(i=>f.jsx(Uut,{destination:i,dataMartStatus:n.status},i.id))}):null}function wht(){return f.jsx(AM,{children:f.jsx(ODe,{children:f.jsx(Cht,{})})})}function l_e(){return f.jsxs(c1,{children:[f.jsx(fp,{children:f.jsx(hp,{icon:SHe,tooltip:"Description of the Data Mart",children:"Description"})}),f.jsx(gp,{children:f.jsx(ert,{})}),f.jsx(E_,{})]})}function yht(){const{dataMart:n}=og(),[e,t]=x.useState(!1),i=x.useCallback(()=>{t(!0)},[]),s=x.useCallback(()=>{t(!1)},[]);return f.jsxs(c1,{children:[f.jsxs(fp,{children:[f.jsx(hp,{icon:oxe,tooltip:"Time triggers allow you to schedule Data Mart runs at specific times",children:"Time triggers"}),f.jsx($M,{children:f.jsxs(rt,{variant:"outline",onClick:i,"aria-label":"Add new trigger",children:[f.jsx(Gd,{className:"h-4 w-4","aria-hidden":"true"}),"Add Trigger"]})})]}),f.jsx(gp,{children:f.jsx(HD,{children:f.jsx(elt,{children:n&&f.jsxs(f.Fragment,{children:[f.jsx(Vlt,{dataMartId:n.id}),f.jsx(Tre,{isOpen:e,onClose:s,dataMartId:n.id})]})})})}),f.jsx(E_,{})]})}const Sht={list:[],listLoadingStatus:an.IDLE,activeInsight:null,activeInsightLoadingStatus:an.IDLE,executionStatus:an.IDLE,executionTriggerId:null,error:null};var Vi=(n=>(n.FETCH_INSIGHTS_START="FETCH_INSIGHTS_START",n.FETCH_INSIGHTS_SUCCESS="FETCH_INSIGHTS_SUCCESS",n.FETCH_INSIGHTS_ERROR="FETCH_INSIGHTS_ERROR",n.GET_INSIGHT_START="GET_INSIGHT_START",n.GET_INSIGHT_SUCCESS="GET_INSIGHT_SUCCESS",n.GET_INSIGHT_ERROR="GET_INSIGHT_ERROR",n.CREATE_INSIGHT_START="CREATE_INSIGHT_START",n.CREATE_INSIGHT_SUCCESS="CREATE_INSIGHT_SUCCESS",n.CREATE_INSIGHT_ERROR="CREATE_INSIGHT_ERROR",n.UPDATE_INSIGHT_START="UPDATE_INSIGHT_START",n.UPDATE_INSIGHT_SUCCESS="UPDATE_INSIGHT_SUCCESS",n.UPDATE_INSIGHT_ERROR="UPDATE_INSIGHT_ERROR",n.DELETE_INSIGHT_START="DELETE_INSIGHT_START",n.DELETE_INSIGHT_SUCCESS="DELETE_INSIGHT_SUCCESS",n.DELETE_INSIGHT_ERROR="DELETE_INSIGHT_ERROR",n.RUN_INSIGHT_START="RUN_INSIGHT_START",n.RUN_INSIGHT_START_ERROR="RUN_INSIGHT_START_ERROR",n.RUN_INSIGHT_STARTED="RUN_INSIGHT_STARTED",n.RUN_INSIGHT_SUCCESS="RUN_INSIGHT_SUCCESS",n.RUN_INSIGHT_ERROR="RUN_INSIGHT_ERROR",n.CLEAR_ERROR="CLEAR_ERROR",n))(Vi||{});class xht extends hC{constructor(){super("/data-marts")}async getInsights(e){return this.get(`/${e}/insights`)}async getInsightById(e,t){return await this.get(`/${e}/insights/${t}`)}async createInsight(e,t){return this.post(`/${e}/insights`,t)}async updateInsight(e,t,i){return this.put(`/${e}/insights/${t}`,i)}async updateInsightTitle(e,t,i){return this.put(`/${e}/insights/${t}/title`,i)}async deleteInsight(e,t){return this.delete(`/${e}/insights/${t}`)}async startInsightExecution(e,t){return this.post(`/${e}/insights/${t}/run-triggers`,{})}async checkInsightExecutionStatus(e,t,i,s){return this.get(`/${e}/insights/${i}/run-triggers/${t}/status`,null,s)}async getInsightRunTriggers(e,t,i){return this.get(`/${e}/insights/${t}/run-triggers/`,null,i)}}const Tm=new xht,cI=n=>({id:n.id,title:n.title,template:n.template??null,output:n.output??null,outputUpdatedAt:n.outputUpdatedAt?new Date(n.outputUpdatedAt):null,lastRun:n.lastManualDataMartRun?{status:n.lastManualDataMartRun.status,id:n.lastManualDataMartRun.id}:null,createdById:n.createdById,createdAt:new Date(n.createdAt),modifiedAt:new Date(n.modifiedAt)}),Lht=n=>n.data.map(cI),Eht=n=>({title:n.title,template:n.template??null}),Dht=n=>({title:n.title,template:n.template??null}),WIe=x.createContext(void 0);function zIe(){const n=x.useContext(WIe);if(!n)throw new Error("useInsightsContext must be used within InsightsProvider");return n}function Jre(){const{state:n,dispatch:e}=zIe(),{dataMart:t}=og();if(!t)throw new Error("useInsights must be used within a DataMart context");const i=x.useCallback(async()=>{e({type:Vi.FETCH_INSIGHTS_START});try{const g=await Tm.getInsights(t.id),m=Lht(g);e({type:Vi.FETCH_INSIGHTS_SUCCESS,payload:m})}catch(g){throw e({type:Vi.FETCH_INSIGHTS_ERROR,payload:ys(g)}),g}},[t.id,e]),s=x.useCallback(async g=>{e({type:Vi.GET_INSIGHT_START});try{const m=await Tm.getInsightById(t.id,g),b=cI(m);return e({type:Vi.GET_INSIGHT_SUCCESS,payload:b}),b}catch(m){throw e({type:Vi.GET_INSIGHT_ERROR,payload:ys(m)}),m}},[t.id,e]),r=x.useCallback(async g=>{e({type:Vi.CREATE_INSIGHT_START});try{const m=Eht(g),b=await Tm.createInsight(t.id,m),v=cI(b);return e({type:Vi.CREATE_INSIGHT_SUCCESS,payload:v}),Vt({event:"insight_created",category:"Insights",action:"Create",label:v.id}),Rn.success("Insight created"),v}catch(m){return e({type:Vi.CREATE_INSIGHT_ERROR,payload:ys(m)}),null}},[t.id,e]),o=x.useCallback(async(g,m)=>{e({type:Vi.UPDATE_INSIGHT_START});try{const b=Dht(m),v=await Tm.updateInsight(t.id,g,b),C=cI(v);return e({type:Vi.UPDATE_INSIGHT_SUCCESS,payload:C}),Vt({event:"insight_updated",category:"Insights",action:"Update",label:C.id}),Rn.success("Insight updated"),C}catch(b){return e({type:Vi.UPDATE_INSIGHT_ERROR,payload:ys(b)}),null}},[t.id,e]),a=x.useCallback(async g=>{e({type:Vi.DELETE_INSIGHT_START});try{await Tm.deleteInsight(t.id,g),e({type:Vi.DELETE_INSIGHT_SUCCESS,payload:g}),Vt({event:"insight_deleted",category:"Insights",action:"Delete",label:g}),Rn.success("Insight deleted")}catch(m){throw e({type:Vi.DELETE_INSIGHT_ERROR,payload:ys(m)}),m}},[t.id,e]),l=x.useCallback(async(g,m)=>{e({type:Vi.UPDATE_INSIGHT_START});try{const b=await Tm.updateInsightTitle(t.id,g,{title:m}),v=cI(b),C=n.list.find(L=>L.id===g)??n.activeInsight,y=C?{...v,template:C.template}:v;return e({type:Vi.UPDATE_INSIGHT_SUCCESS,payload:y}),Vt({event:"insight_title_updated",category:"Insights",action:"Update title",label:y.id}),Rn.success("Title updated"),y}catch(b){return e({type:Vi.UPDATE_INSIGHT_ERROR,payload:ys(b)}),null}},[t.id,e,n.activeInsight,n.list]),c=x.useCallback(async g=>{e({type:Vi.RUN_INSIGHT_START});try{const m=await Tm.startInsightExecution(t.id,g);e({type:Vi.RUN_INSIGHT_STARTED,payload:{triggerId:m.triggerId}})}catch(m){e({type:Vi.RUN_INSIGHT_ERROR,payload:ys(m)})}},[e,t.id]),d=x.useCallback(()=>{e({type:Vi.RUN_INSIGHT_SUCCESS,payload:{triggerId:""}})},[e]),u=x.useCallback(g=>{e({type:Vi.RUN_INSIGHT_STARTED,payload:{triggerId:g}})},[e]),h=x.useCallback(async()=>{const g=n.activeInsight;if(!(!g||!t.id)&&!n.executionTriggerId&&!(!g.lastRun||JJe(g.lastRun.status)))try{const b=(await Tm.getInsightRunTriggers(t.id,g.id,{skipLoadingIndicator:!0})).data.sort((v,C)=>new Date(C.modifiedAt).getTime()-new Date(v.modifiedAt).getTime()).find(v=>!eet(v.status));b!=null&&b.id&&(e({type:Vi.RUN_INSIGHT_START}),e({type:Vi.RUN_INSIGHT_STARTED,payload:{triggerId:b.id}}))}catch(m){e({type:Vi.RUN_INSIGHT_ERROR,payload:ys(m)})}},[n.activeInsight,n.executionTriggerId,t.id,e]);return{insights:n.list,activeInsight:n.activeInsight,listLoading:n.listLoadingStatus===an.LOADING,insightLoading:n.activeInsightLoadingStatus===an.LOADING,isRunning:n.executionStatus===an.LOADING,triggerId:n.executionTriggerId,error:n.error,fetchInsights:i,getInsight:s,createInsight:r,updateInsight:o,updateInsightTitle:l,deleteInsight:a,runInsight:c,setTriggerId:u,resetTriggerId:d,ensureActiveRunPolling:h}}function Rht(){const{state:n}=zIe(),e=x.useMemo(()=>n.list,[n.list]),t=x.useMemo(()=>n.listLoadingStatus===an.LOADING,[n.listLoadingStatus]),i=x.useMemo(()=>n.listLoadingStatus===an.LOADED||n.listLoadingStatus===an.ERROR,[n.listLoadingStatus]),s=x.useMemo(()=>n.error,[n.error]),r=x.useMemo(()=>e.length>0,[e.length]);return{insights:e,isLoading:t,isLoaded:i,error:s,hasInsights:r}}function Nht(n,e){var t,i;switch(e.type){case Vi.FETCH_INSIGHTS_START:return{...n,listLoadingStatus:an.LOADING,error:null};case Vi.GET_INSIGHT_START:return{...n,activeInsightLoadingStatus:an.LOADING,error:null};case Vi.CREATE_INSIGHT_START:return{...n,activeInsightLoadingStatus:an.LOADING,error:null};case Vi.UPDATE_INSIGHT_START:return{...n,error:null};case Vi.DELETE_INSIGHT_START:return{...n,listLoadingStatus:an.LOADING,error:null};case Vi.FETCH_INSIGHTS_SUCCESS:return{...n,list:e.payload,listLoadingStatus:an.LOADED,error:null};case Vi.GET_INSIGHT_SUCCESS:return{...n,activeInsight:e.payload,activeInsightLoadingStatus:an.LOADED,error:null};case Vi.CREATE_INSIGHT_SUCCESS:return{...n,list:[...n.list,e.payload],listLoadingStatus:an.LOADED,activeInsightLoadingStatus:an.LOADED,error:null};case Vi.UPDATE_INSIGHT_SUCCESS:return{...n,list:n.list.map(s=>s.id===e.payload.id?e.payload:s),activeInsight:((t=n.activeInsight)==null?void 0:t.id)===e.payload.id?e.payload:n.activeInsight,listLoadingStatus:an.LOADED,error:null};case Vi.DELETE_INSIGHT_SUCCESS:return{...n,list:n.list.filter(s=>s.id!==e.payload),activeInsight:((i=n.activeInsight)==null?void 0:i.id)===e.payload?null:n.activeInsight,listLoadingStatus:an.LOADED,error:null};case Vi.FETCH_INSIGHTS_ERROR:return{...n,listLoadingStatus:an.ERROR,error:e.payload};case Vi.GET_INSIGHT_ERROR:return{...n,activeInsightLoadingStatus:an.ERROR,error:e.payload};case Vi.CREATE_INSIGHT_ERROR:return{...n,listLoadingStatus:an.ERROR,activeInsightLoadingStatus:an.ERROR,error:e.payload};case Vi.UPDATE_INSIGHT_ERROR:case Vi.DELETE_INSIGHT_ERROR:return{...n,listLoadingStatus:an.ERROR,error:e.payload};case Vi.RUN_INSIGHT_START:return{...n,executionStatus:an.LOADING,error:null};case Vi.RUN_INSIGHT_STARTED:return{...n,executionTriggerId:e.payload.triggerId,error:null};case Vi.RUN_INSIGHT_SUCCESS:return{...n,executionStatus:an.LOADED,executionTriggerId:null,error:null};case Vi.CLEAR_ERROR:return{...n,error:null};default:return n}}function UIe({children:n,initialState:e}){const[t,i]=x.useReducer(Nht,e??Sht);return f.jsx(WIe.Provider,{value:{state:t,dispatch:i},children:n})}function Tht(){return f.jsx(UIe,{children:f.jsx(Tne,{})})}function Iht({status:n}){switch(n){case $r.RUNNING:return f.jsx(Ya,{variant:"secondary",className:"text-primary bg-primary/10",children:"Running"});case $r.SUCCESS:return f.jsx(Ya,{variant:"secondary",className:"bg-green-50 text-green-600 dark:bg-green-950 dark:text-green-400",children:"Success"});case $r.FAILED:return f.jsx(Ya,{variant:"secondary",className:"bg-red-50 text-red-600 dark:bg-red-950 dark:text-red-400",children:"Failed"});case $r.CANCELLED:return f.jsx(Ya,{variant:"secondary",className:"bg-gray-50 text-gray-500 dark:bg-gray-950 dark:text-gray-400",children:"Cancelled"});case $r.INTERRUPTED:return f.jsx(Ya,{variant:"secondary",className:"bg-gray-50 text-gray-500 dark:bg-gray-950 dark:text-gray-400",children:"Interrupted"});case $r.PENDING:return f.jsx(Ya,{variant:"secondary",className:"bg-gray-50 text-gray-500 dark:bg-gray-950 dark:text-gray-400",children:"Pending"});default:return f.jsx(Ya,{variant:"secondary",className:"bg-gray-50 text-gray-500 dark:bg-gray-950 dark:text-gray-400",children:"Unknown"})}}var Tc=(n=>(n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.SYSTEM="SYSTEM",n))(Tc||{}),hf=(n=>(n.STRUCTURED="structured",n.RAW="raw",n.CONFIGURATION="configuration",n))(hf||{});const c_e=(n,e,t=!1)=>{var o,a,l,c;const i=n.split(`
|
|
741
|
+
REPEATED - field is an Array of Type`})]}),size:80,cell:({row:H})=>f.jsx(eut,{mode:H.getValue("mode"),onModeChange:j=>{u(H.index,{mode:j})}}),columnIndex:4}],[u]),y=x.useCallback(()=>f.jsxs("div",{className:"flex items-center",children:[i&&f.jsx(Xdt,{isAllExpanded:d,onToggle:r}),f.jsxs(Tn,{children:[f.jsx(In,{className:"cursor-default",children:"Name"}),f.jsx(kn,{children:"Field name in the output schema"})]})]}),[i,d,r]),L=x.useCallback(({row:H})=>{const j=o[H.index],W=(j.type===Ho.RECORD||j.type===Ho.STRUCT)&&j.fields&&j.fields.length>0,U=j.path??"",B=j.level??0,K=t.has(U);return f.jsxs("div",{className:"flex items-center",children:[B>0&&f.jsx("div",{style:{width:`${String(B*16-(W?4:0))}px`},className:"flex-shrink-0"}),W?f.jsx(Qdt,{isExpanded:K,onToggle:()=>{s(U)},ariaLabel:K?"Collapse nested fields":"Expand nested fields"}):i&&f.jsx("div",{className:"w-5"}),f.jsx(jE,{value:H.getValue("name"),onValueChange:X=>{u(H.index,{name:X})},placeholder:"Field name is required",isBold:!0})]})},[o,t,i,s,u]),E=x.useCallback(({row:H})=>{const j=o[H.index],V=j.type===Ho.RECORD||j.type===Ho.STRUCT;return(j.level??0)===0&&!V?f.jsx(AIe,{isPrimaryKey:H.getValue("isPrimaryKey"),onPrimaryKeyChange:U=>{u(H.index,{isPrimaryKey:U})}}):f.jsx("div",{})},[o,u]),R=x.useCallback(({row:H})=>f.jsx(jE,{value:H.getValue("description"),onValueChange:j=>{u(H.index,{description:j})},minRows:5,placeholder:"-"}),[u]),T=x.useCallback(({row:H})=>f.jsx(jE,{value:H.getValue("alias"),onValueChange:j=>{u(H.index,{alias:j})},placeholder:"-"}),[u]),N=x.useCallback(({row:H})=>f.jsx(xIe,{row:H,onDeleteRow:e?h:void 0,onAddNestedField:e?g:void 0,isRecordType:l}),[e,h,g,l]),{handleDragEnd:I}=Are(n,e,o),M=x.useCallback(H=>{const j=o[H.index];return j.path??String(o.indexOf(j))},[o]),P=Hre(jre(UM,{activationConstraint:{distance:5}}));return f.jsx(Ure,{sensors:P,collisionDetection:Bre,onDragEnd:I,children:f.jsx(Yre,{fields:o,onFieldsChange:e,onAddRow:m,createNewField:b,renderTypeCell:v,additionalColumns:C,fieldsForStatusCount:c,onSearchChange:a,nameColumnHeader:y,nameColumnCell:L,primaryKeyColumnCell:E,aliasColumnCell:T,descriptionColumnCell:R,actionsColumnCell:N,dragContext:Gre,dragContextProps:{items:o.map(H=>H.path??String(o.indexOf(H))),strategy:$re},rowComponent:qre,getRowId:M})})}function hut({fields:n,onFieldsChange:e}){const t=x.useCallback(()=>({name:"",type:Gse.STRING,isPrimaryKey:!1,status:Mu.DISCONNECTED}),[]),i=x.useCallback(({row:o,updateField:a})=>f.jsx(Zre,{type:o.getValue("type"),storageType:lt.AWS_ATHENA,onTypeChange:l=>{a(o.index,{type:l})}}),[]),{handleDragEnd:s}=Are(n,e),r=Hre(jre(UM,{activationConstraint:{distance:5}}));return f.jsx(Ure,{sensors:r,collisionDetection:Bre,onDragEnd:s,children:f.jsx(Yre,{fields:n,onFieldsChange:e,createNewField:t,renderTypeCell:i,dragContext:Gre,dragContextProps:{items:n.map((o,a)=>a),strategy:$re},rowComponent:qre})})}function fut({fields:n,onFieldsChange:e}){const t=x.useCallback(()=>({name:"",type:qse.VARCHAR,isPrimaryKey:!1,status:Mu.DISCONNECTED}),[]),i=x.useCallback(({row:o,updateField:a})=>f.jsx(Zre,{type:o.getValue("type"),storageType:lt.SNOWFLAKE,onTypeChange:l=>{a(o.index,{type:l})}}),[]),{handleDragEnd:s}=Are(n,e),r=Hre(jre(UM,{activationConstraint:{distance:5}}));return f.jsx(Ure,{sensors:r,collisionDetection:Bre,onDragEnd:s,children:f.jsx(Yre,{fields:n,onFieldsChange:e,createNewField:t,renderTypeCell:i,dragContext:Gre,dragContextProps:{items:n.map((o,a)=>a),strategy:$re},rowComponent:qre})})}function gut({schema:n,storageType:e,onFieldsChange:t}){const i=x.useMemo(()=>{if(!n){const s=act(e);return t(s.fields),s}return n},[n,e,t]);return QTe(i)?f.jsx(uut,{fields:i.fields,onFieldsChange:t}):JTe(i)?f.jsx(hut,{fields:i.fields,onFieldsChange:t}):eIe(i)?f.jsx(fut,{fields:i.fields,onFieldsChange:t}):f.jsx("div",{className:"p-4 text-center",children:f.jsx("p",{children:"Unsupported schema type"})})}function put({definitionType:n}){const{dataMart:e,updateDataMartSchema:t,isLoading:i,error:s,runSchemaActualization:r,isSchemaActualizationLoading:o}=Zu(),{id:a="",schema:l}=e??{},{schema:c,isDirty:d,updateSchema:u,resetSchema:h}=cct(l),{operationStatus:g,startSaveOperation:m}=dct(i,s);x.useEffect(()=>{g==="success"&&h()},[g,h]);const b=x.useCallback(E=>{u(E)},[u]),v=x.useCallback(()=>{a&&c&&(m(),t(a,c).then(()=>{r==null||r()}))},[a,c,m,t,r]),C=x.useCallback(()=>{r==null||r()},[r]),y=x.useCallback(()=>{h()},[h]),L=i||o;return e?f.jsxs("div",{className:"space-y-4",children:[f.jsx(gut,{schema:c,storageType:e.storage.type,onFieldsChange:b}),f.jsxs("div",{className:"align-items-center mt-8 flex justify-between",children:[f.jsxs("div",{className:"flex space-x-4",children:[f.jsx(rt,{variant:"default",onClick:v,disabled:!d||L,children:"Save"}),f.jsx(rt,{type:"button",variant:"ghost",onClick:y,disabled:!d||L,children:"Discard"})]}),f.jsx(rt,{type:"button",variant:"outline",onClick:C,disabled:!n||L,children:"Refresh schema"})]})]}):f.jsx("div",{children:"Error: Data mart not found"})}function mut(){const n=Dne(),{id:e,projectId:t}=n;return e?t?f.jsx("div",{className:"dm-page",children:f.jsx(LRe,{children:f.jsx(Qst,{id:e})})}):f.jsx("div",{className:"dm-page-header",children:"Project ID is required"}):f.jsx("div",{className:"dm-page-header",children:"Data Mart ID is required"})}function _ut({className:n,...e}){return f.jsx("div",{"data-slot":"card",className:Le("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),...e})}function but({className:n,...e}){return f.jsx("div",{"data-slot":"card-header",className:Le("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...e})}function vut({className:n,...e}){return f.jsx("div",{"data-slot":"card-title",className:Le("leading-none font-semibold",n),...e})}function Cut({className:n,...e}){return f.jsx("div",{"data-slot":"card-description",className:Le("text-muted-foreground text-sm",n),...e})}function wut({className:n,...e}){return f.jsx("div",{"data-slot":"card-content",className:Le("px-6",n),...e})}function yut({className:n,...e}){return f.jsx("div",{"data-slot":"card-footer",className:Le("flex items-center px-6 [.border-t]:pt-6",n),...e})}const Xre=x.createContext({isCollapsed:!1,collapsible:!1,handleCollapse:()=>{throw new Error("CollapsibleCardContext: handleCollapse not implemented")}});function hp({icon:n,tooltip:e,subtitle:t,children:i}){const{isCollapsed:s}=x.useContext(Xre);return f.jsxs("div",{className:"flex items-center gap-2 self-center",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"text-foreground flex h-7 w-7 items-center justify-center rounded-sm bg-gray-200/50 transition-colors duration-200 group-hover:bg-gray-200/75 dark:bg-white/8 dark:group-hover:bg-white/10",children:f.jsx(n,{size:18})}),f.jsx(vut,{className:"text-md text-foreground leading-none font-medium",children:i})]}),t&&f.jsx(Cut,{className:Le("text-md text-muted-foreground/50",!s&&"hidden"),children:t}),e&&f.jsx(Nf,{children:f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsxs("div",{className:"pointer-events-none ml-2 flex items-center opacity-0 transition-opacity duration-200 group-hover:pointer-events-auto group-hover:opacity-100",children:[f.jsx(sc,{className:"text-muted-foreground/50 hover:text-muted-foreground size-4 shrink-0 transition-colors"}),f.jsx("span",{className:"sr-only",children:e})]})}),f.jsx(kn,{children:f.jsx("p",{children:e})})]})})]})}hp.displayName="CollapsibleCardHeaderTitle";function $M({children:n,className:e}){const t=i=>{i.stopPropagation()};return f.jsx("div",{className:Le("flex items-center gap-2 self-center",e),onClick:t,children:n})}$M.displayName="CollapsibleCardHeaderActions";function fp({children:n}){const{collapsible:e,isCollapsed:t,handleCollapse:i}=x.useContext(Xre);let s,r;return x.Children.forEach(n,o=>{if(x.isValidElement(o))switch(o.type){case hp:s=o;break;case $M:r=o;break}}),f.jsxs(but,{className:Le("group flex items-start justify-between gap-4 px-4 py-4",e&&"cursor-pointer"),onClick:e?i:void 0,children:[s,f.jsxs("div",{className:"flex items-center gap-2",children:[r,e&&f.jsx("div",{className:Le("flex h-7 w-7 items-center justify-center rounded-full transition-colors duration-200 hover:bg-gray-200/50 dark:hover:bg-white/4"),children:f.jsx("div",{className:Le("transform transition-transform duration-200",t?"rotate-0":"rotate-180"),children:f.jsx(Pp,{className:"text-muted-foreground/75 dark:text-muted-foreground/50 h-4 w-4"})})})]})]})}fp.displayName="CollapsibleCardHeader";function gp({children:n}){return f.jsx(wut,{className:"px-4 pt-1",children:n})}gp.displayName="CollapsibleCardContent";function E_({left:n,right:e}){return f.jsxs(yut,{className:"flex items-center gap-2 px-4 py-4",children:[f.jsx("div",{className:"flex flex-grow items-center gap-2",children:n}),e&&f.jsx("div",{className:"flex items-center",children:e})]})}E_.displayName="CollapsibleCardFooter";const s_e="collapsed-card-";function c1({children:n,className:e,variant:t="default",collapsible:i=!1,defaultCollapsed:s=!1,onCollapsedChange:r,name:o}){const a=o?np.get(`${s_e}${o}`,"boolean")??s:s,[l,c]=x.useState(a);x.useEffect(()=>{o&&np.set(`${s_e}${o}`,l)},[l,o]);const d=()=>{const b=!l;c(b),r==null||r(b)};let u,h,g;x.Children.forEach(n,b=>{if(x.isValidElement(b))switch(b.type){case fp:u=b;break;case gp:h=b;break;case E_:g=b;break}});const m={default:"rounded-md p-0 gap-0 bg-muted/50 dark:bg-white/4 border-0 border-b border-gray-200 dark:border-white/8 shadow-none",dense:"rounded-md p-0 gap-0 bg-muted/50 dark:bg-white/4 border-0 border-b border-gray-200 dark:border-white/8 shadow-none text-sm",flat:"rounded-md p-0 gap-0 border-0 border-b-0 shadow-none"};return f.jsx(Xre.Provider,{value:{isCollapsed:l,collapsible:i,handleCollapse:d},children:f.jsxs(_ut,{className:Le(m[t],e),children:[u,f.jsx("div",{className:Le("grid transition-all duration-200",l?"grid-rows-[0fr]":"grid-rows-[1fr]"),children:f.jsxs("div",{className:"overflow-hidden",children:[h,g]})})]})})}function Sut(){const{dataMart:n,updateDataMartStorage:e}=og(),t=(n==null?void 0:n.definitionType)??null,[i,s]=x.useState(t);return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsxs(c1,{collapsible:!0,name:"data-storage",children:[f.jsx(fp,{children:f.jsx(hp,{icon:j1,tooltip:"Configure where your data will be stored",children:"Storage"})}),f.jsx(gp,{children:(n==null?void 0:n.storage)&&f.jsx(wat,{dataStorage:n.storage,onDataStorageChange:e})}),f.jsx(E_,{})]}),f.jsxs(c1,{collapsible:!0,name:"input-source",children:[f.jsx(fp,{children:f.jsx(hp,{icon:Pne,tooltip:"Configure how to extract data from your data warehouse",children:"Input Source"})}),f.jsx(gp,{children:n&&f.jsx(oct,{definitionType:i,initialDefinitionType:t,setDefinitionType:s})}),f.jsx(E_,{})]}),f.jsxs(c1,{collapsible:!0,name:"output-schema",children:[f.jsx(fp,{children:f.jsx(hp,{icon:KHe,tooltip:"Configure your data mart output schema",children:"Output Schema"})}),f.jsx(gp,{children:n&&f.jsx(put,{definitionType:i})}),f.jsx(E_,{})]})]})}function xut({row:n,onDeleteSuccess:e,onEditReport:t}){const[i,s]=x.useState(!1),[r,o]=x.useState(!1),[a,l]=x.useState(!1),{deleteReport:c,fetchReportsByDataMartId:d,runReport:u}=rg(),h=`actions-menu-${n.original.id}`,g=x.useCallback(async()=>{try{await c(n.original.id),await d(n.original.dataMart.id),e==null||e(),l(!1)}catch(C){console.error("Failed to delete Google Sheet:",C)}},[c,d,e,n.original.id,n.original.dataMart.id]),m=x.useCallback(()=>{t==null||t(n.original),o(!1)},[t,n.original]),b=x.useCallback(async()=>{try{s(!0),await u(n.original.id)}catch(C){console.error("Failed to run report:",C)}finally{s(!1)}},[u,n.original.id]),v=x.useCallback(()=>{l(!0),o(!1)},[]);return f.jsxs("div",{className:"text-right",onClick:C=>{C.stopPropagation()},children:[f.jsxs(Al,{open:r,onOpenChange:o,children:[f.jsx(Ml,{asChild:!0,children:f.jsxs(rt,{variant:"ghost",className:`dm-card-table-body-row-actionbtn opacity-0 transition-opacity ${r?"opacity-100":"group-hover:opacity-100"}`,"aria-label":`Actions for report: ${n.original.title}`,"aria-haspopup":"true","aria-expanded":r,"aria-controls":h,children:[f.jsx("span",{className:"sr-only",children:"Open menu"}),f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon","aria-hidden":"true"})]})}),f.jsxs(Ol,{id:h,align:"end",role:"menu",children:[f.jsxs(wn,{onClick:C=>{C.stopPropagation(),m()},role:"menuitem",children:[f.jsx(TR,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),"Edit report"]}),VH(n.original.destinationConfig)&&f.jsxs(f.Fragment,{children:[f.jsx(Vd,{}),f.jsxs(wn,{onClick:C=>{C.stopPropagation(),b()},disabled:i,role:"menuitem","aria-label":i?"Running report...":`Run report: ${n.original.title}`,children:[f.jsx(rH,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),i?"Running...":"Run report"]}),f.jsx(wn,{asChild:!0,children:f.jsxs("a",{href:Ese(n.original.destinationConfig.spreadsheetId,n.original.destinationConfig.sheetId),target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:C=>{C.stopPropagation()},children:[f.jsx(lBe,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),"Open document"]})})]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:C=>{C.stopPropagation(),v()},role:"menuitem","aria-label":`Delete report: ${n.original.title}`,children:[f.jsx(Wh,{className:"h-4 w-4 text-red-600","aria-hidden":"true"}),f.jsx("span",{className:"text-red-600",children:"Delete report"})]})]})]}),f.jsx(Ma,{open:a,onOpenChange:l,title:"Delete Report",description:`Are you sure you want to delete "${n.original.title}"? This action cannot be undone.`,confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{g()},variant:"destructive"})]})}const Lut={[Fr.SUCCESS]:{icon:sH,color:"text-green-500",label:"Success"},[Fr.ERROR]:{icon:rF,color:"text-red-500",label:"Fail"},[Fr.RUNNING]:{icon:NR,color:"text-primary animate-spin",label:"In progress"},[Fr.CANCELLED]:{icon:rF,color:"text-gray-500",label:"Cancelled"}};function OIe({status:n,error:e}){if(!n)return null;const t=Lut[n],{icon:i,color:s,label:r}=t,o=`status-tooltip-${n}-${e?"error":"normal"}`,a=()=>n===Fr.ERROR&&e?`${r}: ${e}`:r;return f.jsx(Nf,{children:f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx(i,{className:Le("h-5 w-5",s),role:"img","aria-label":a(),"aria-describedby":o,tabIndex:0})}),f.jsxs(kn,{id:o,side:"bottom",role:"tooltip",children:[f.jsx("div",{className:"text-xs",children:r}),n===Fr.ERROR&&e&&f.jsx("div",{className:"mt-1 max-w-xs text-xs break-words whitespace-normal",children:e})]})]})})}var Bv=(n=>(n.TITLE="title",n.LAST_RUN_DATE="lastRunDate",n.LAST_RUN_STATUS="lastRunStatus",n))(Bv||{});const Eut={[Bv.TITLE]:"Title",[Bv.LAST_RUN_DATE]:"Last Run Date",[Bv.LAST_RUN_STATUS]:"Last Run Status"},r_e=n=>{switch(n){case"right":return"text-right";case"center":return"text-center";default:return"text-left"}},Dut=({onDeleteSuccess:n,onEditReport:e}={})=>[{accessorKey:Bv.TITLE,header:({column:t})=>f.jsx(La,{column:t,children:Eut[Bv.TITLE]}),cell:({row:t})=>t.original.title,enableColumnFilter:!0,size:50},{accessorKey:Bv.LAST_RUN_DATE,header:({column:t})=>f.jsx(La,{column:t,children:"Last Run Date"}),cell:({row:t})=>{const i=t.original.lastRunDate;return f.jsx("div",{className:"text-muted-foreground text-sm",children:i?f.jsx(W1,{date:new Date(i)}):"Never run"})},size:25},{accessorKey:Bv.LAST_RUN_STATUS,header:({column:t})=>f.jsx(La,{column:t,children:"Last Run Status"}),cell:({row:t})=>t.original.lastRunStatus?f.jsx(OIe,{status:t.original.lastRunStatus,error:t.original.lastRunError}):f.jsx("span",{className:"text-muted-foreground text-sm",children:"—"}),size:25},{id:"actions",header:({table:t})=>f.jsx(BR,{table:t}),cell:({row:t})=>f.jsx(xut,{row:t,onDeleteSuccess:n,onEditReport:e}),size:80}];function Rut({destination:n,onEditReport:e}){const{reports:t,setPollingConfig:i}=rg(),s=x.useMemo(()=>t.filter(h=>h.dataDestination.type===St.GOOGLE_SHEETS&&h.dataDestination.id===n.id),[t,n.id]);x.useEffect(()=>{i({initialPollingIntervalMs:2e3,initialPollCount:3,regularPollingIntervalMs:5e3})},[i]);const r=x.useMemo(()=>Dut({onDeleteSuccess:()=>{},onEditReport:e}),[e]),{sorting:o,setSorting:a,columnVisibility:l,setColumnVisibility:c}=zS({columns:r,storageKeyPrefix:`data-mart-google-sheets-reports-${n.id}`,defaultSortingColumn:"lastRunDate"}),d=pC({data:s,columns:r,getCoreRowModel:gC(),onSortingChange:a,getSortedRowModel:WS(),state:{sorting:o,columnVisibility:l},onColumnVisibilityChange:c}),u=`google-sheets-reports-table-${n.id}`;return f.jsx("div",{className:"w-full",children:f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{id:u,className:"dm-card-table",role:"table","aria-label":`${n.title} reports`,children:[f.jsx(_C,{className:"dm-card-table-header",children:d.getHeaderGroups().map(h=>f.jsx(qr,{className:"dm-card-table-header-row",children:h.headers.map(g=>f.jsx(vC,{className:r_e(g.column.columnDef._align),style:g.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(g.column.getSize())}%`},scope:"col",children:g.isPlaceholder?null:typeof g.column.columnDef.header=="function"?g.column.columnDef.header(g.getContext()):g.column.columnDef.header},g.id))},h.id))}),f.jsx(bC,{className:"dm-card-table-body",children:d.getRowModel().rows.length?d.getRowModel().rows.map((h,g)=>f.jsx(qr,{onClick:()=>{const m=t.find(b=>b.id===h.original.id);m&&e(m)},className:"dm-card-table-body-row group",role:"row","aria-rowindex":g+1,children:h.getVisibleCells().map((m,b)=>f.jsx(Rl,{className:`px-6 whitespace-normal ${r_e(m.column.columnDef._align)}`,style:m.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(m.column.getSize())}%`},role:"cell","aria-colindex":b+1,children:typeof m.column.columnDef.cell=="function"?m.column.columnDef.cell(m.getContext()):m.column.columnDef.cell},m.id))},h.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:r.length,className:"dm-card-table-body-row-empty",role:"cell",children:f.jsx("span",{role:"status","aria-live":"polite",children:"No reports for this destination"})})})})]})})})}function Nut({row:n,onDeleteSuccess:e,onEditReport:t}){const[i,s]=x.useState(!1),[r,o]=x.useState(!1),[a,l]=x.useState(!1),{deleteReport:c,fetchReportsByDataMartId:d,runReport:u}=rg(),h=`actions-menu-${n.original.id}`,g=x.useCallback(async()=>{try{await c(n.original.id),await d(n.original.dataMart.id),e==null||e(),l(!1)}catch(C){console.error("Failed to delete report:",C)}},[c,d,e,n.original.id,n.original.dataMart.id]),m=x.useCallback(()=>{t==null||t(n.original),o(!1)},[t,n.original]),b=x.useCallback(async()=>{try{s(!0),await u(n.original.id)}catch(C){console.error("Failed to run report:",C)}finally{s(!1)}},[u,n.original.id]),v=x.useCallback(()=>{l(!0),o(!1)},[]);return f.jsxs("div",{className:"text-right",onClick:C=>{C.stopPropagation()},children:[f.jsxs(Al,{open:r,onOpenChange:o,children:[f.jsx(Ml,{asChild:!0,children:f.jsxs(rt,{variant:"ghost",className:`dm-card-table-body-row-actionbtn opacity-0 transition-opacity ${r?"opacity-100":"group-hover:opacity-100"}`,"aria-label":`Actions for report: ${n.original.title}`,"aria-haspopup":"true","aria-expanded":r,"aria-controls":h,children:[f.jsx("span",{className:"sr-only",children:"Open menu"}),f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon","aria-hidden":"true"})]})}),f.jsxs(Ol,{id:h,align:"end",role:"menu",children:[f.jsxs(wn,{onClick:C=>{C.stopPropagation(),m()},role:"menuitem",children:[f.jsx(TR,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),"Edit report"]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:C=>{C.stopPropagation(),b()},disabled:i,role:"menuitem","aria-label":i?"Running report...":`Run report: ${n.original.title}`,children:[f.jsx(rH,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),i?"Running...":"Run report"]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:C=>{C.stopPropagation(),v()},role:"menuitem","aria-label":`Delete report: ${n.original.title}`,children:[f.jsx(Wh,{className:"h-4 w-4 text-red-600","aria-hidden":"true"}),f.jsx("span",{className:"text-red-600",children:"Delete report"})]})]})]}),f.jsx(Ma,{open:a,onOpenChange:l,title:"Delete Report",description:`Are you sure you want to delete "${n.original.title}"? This action cannot be undone.`,confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{g()},variant:"destructive"})]})}function d$({column:n,children:e,label:t}){const i=n.getIsSorted(),s=x.useCallback(()=>{n.toggleSorting(n.getIsSorted()==="asc")},[n]),r=()=>i==="asc"?"sorted ascending":i==="desc"?"sorted descending":"not sorted",o=()=>i==="asc"?"ascending":i==="desc"?"descending":"none",a=t??(typeof e=="string"?e:"Column");return f.jsxs(rt,{variant:"ghost",onClick:s,className:"group dm-card-table-header-row-btn","aria-label":`${a} - ${r()}. Click to sort.`,"aria-sort":o(),children:[e,f.jsxs("span",{className:"flex h-4 w-4 items-center justify-center","aria-hidden":"true",children:[i==="asc"&&f.jsx(TD,{className:"text-foreground h-4 w-4"}),i==="desc"&&f.jsx(Pp,{className:"text-foreground h-4 w-4"}),!i&&f.jsx("span",{className:"opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:f.jsx(TD,{className:"text-muted-foreground h-4 w-4"})})]})]})}var Vv=(n=>(n.TITLE="title",n.LAST_RUN_DATE="lastRunDate",n.LAST_RUN_STATUS="lastRunStatus",n))(Vv||{});const PIe={[Vv.TITLE]:"Title",[Vv.LAST_RUN_DATE]:"Last Run Date",[Vv.LAST_RUN_STATUS]:"Last Run Status"};function Tut({table:n}){return f.jsx("div",{className:"px-4 text-right",children:f.jsxs(Al,{children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:"dm-card-table-body-row-actionbtn","aria-label":"Toggle columns",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsx(Ol,{align:"end",children:n.getAllColumns().filter(e=>e.getCanHide()&&e.id!=="actions").map(e=>{const t=PIe[e.id]||e.id;return f.jsx(wn,{className:"capitalize",children:f.jsxs("label",{className:"flex items-center space-x-2",children:[f.jsx("button",{type:"button",role:"checkbox","aria-checked":e.getIsVisible(),"data-state":e.getIsVisible()?"checked":"unchecked","aria-label":`Toggle column ${e.id}`,className:"peer border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border bg-white shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white/8",onClick:()=>{e.toggleVisibility(!e.getIsVisible())},children:e.getIsVisible()&&f.jsx("span",{"data-state":"checked","data-slot":"checkbox-indicator",className:"pointer-events-none flex items-center justify-center text-current transition-none",children:f.jsx(Wc,{className:"size-3.5 text-white"})})}),f.jsx("span",{children:t})]})},e.id)})})]})})}const o_e=n=>{switch(n){case"right":return"text-right";case"center":return"text-center";default:return"text-left"}},Iut=({onDeleteSuccess:n,onEditReport:e}={})=>[{accessorKey:Vv.TITLE,header:({column:t})=>f.jsx(d$,{column:t,children:PIe[Vv.TITLE]}),cell:({row:t})=>t.original.title,enableColumnFilter:!0,size:50},{accessorKey:Vv.LAST_RUN_DATE,header:({column:t})=>f.jsx(d$,{column:t,children:"Last Run Date"}),cell:({row:t})=>{const i=t.original.lastRunDate;return f.jsx("div",{className:"text-muted-foreground text-sm",children:i?f.jsx(W1,{date:new Date(i)}):"Never run"})},size:25},{accessorKey:Vv.LAST_RUN_STATUS,header:({column:t})=>f.jsx(d$,{column:t,children:"Last Run Status"}),cell:({row:t})=>t.original.lastRunStatus?f.jsx(OIe,{status:t.original.lastRunStatus,error:t.original.lastRunError}):f.jsx("span",{className:"text-muted-foreground text-sm",children:"—"}),size:25},{id:"actions",header:({table:t})=>f.jsx(Tut,{table:t}),cell:({row:t})=>f.jsx(Nut,{row:t,onDeleteSuccess:n,onEditReport:e}),size:80}];function kut({destinationType:n,destination:e,onEditReport:t}){const{reports:i,setPollingConfig:s}=rg(),r=x.useMemo(()=>i.filter(g=>g.dataDestination.type===n&&g.dataDestination.id===e.id),[i,e.id,n]);x.useEffect(()=>{s({initialPollingIntervalMs:2e3,initialPollCount:3,regularPollingIntervalMs:5e3})},[s]);const o=x.useMemo(()=>Iut({onDeleteSuccess:()=>{},onEditReport:t}),[t]),{sorting:a,setSorting:l,columnVisibility:c,setColumnVisibility:d}=zS({columns:o,storageKeyPrefix:`data-mart-email-reports-${e.id}`,defaultSortingColumn:"lastRunDate"}),u=pC({data:r,columns:o,getCoreRowModel:gC(),onSortingChange:l,getSortedRowModel:WS(),state:{sorting:a,columnVisibility:c},onColumnVisibilityChange:d}),h=`email-reports-table-${e.id}`;return f.jsx("div",{className:"w-full",children:f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{id:h,className:"dm-card-table",role:"table","aria-label":`${e.title} reports`,children:[f.jsx(_C,{className:"dm-card-table-header",children:u.getHeaderGroups().map(g=>f.jsx(qr,{className:"dm-card-table-header-row",children:g.headers.map(m=>f.jsx(vC,{className:o_e(m.column.columnDef._align),style:m.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(m.column.getSize())}%`},scope:"col",children:m.isPlaceholder?null:typeof m.column.columnDef.header=="function"?m.column.columnDef.header(m.getContext()):m.column.columnDef.header},m.id))},g.id))}),f.jsx(bC,{className:"dm-card-table-body",children:u.getRowModel().rows.length?u.getRowModel().rows.map((g,m)=>f.jsx(qr,{onClick:()=>{const b=i.find(v=>v.id===g.original.id);b&&t(b)},className:"dm-card-table-body-row group",role:"row","aria-rowindex":m+1,children:g.getVisibleCells().map((b,v)=>f.jsx(Rl,{className:`px-6 whitespace-normal ${o_e(b.column.columnDef._align)}`,style:b.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(b.column.getSize())}%`},role:"cell","aria-colindex":v+1,children:typeof b.column.columnDef.cell=="function"?b.column.columnDef.cell(b.getContext()):b.column.columnDef.cell},b.id))},g.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:o.length,className:"dm-card-table-body-row-empty",role:"cell",children:f.jsx("span",{role:"status","aria-live":"polite",children:"No reports for this destination"})})})})]})})})}function Aut({children:n,className:e,...t}){return f.jsx("div",{className:Le("group flex items-start justify-center gap-3 rounded-md border-b border-gray-200 bg-white transition-shadow duration-200 hover:shadow-xs dark:border-0 dark:bg-white/2",e),...t,children:n})}function Mut({children:n,className:e,...t}){return f.jsx("div",{className:Le("flex flex-grow flex-col gap-1 py-4",e),...t,children:n})}function Out({children:n,className:e,...t}){return f.jsx("div",{className:Le("text-md font-medium",e),...t,children:n})}function Put({children:n,className:e,...t}){return f.jsx("div",{className:Le("text-muted-foreground text-sm",e),...t,children:n})}function Fut({checked:n,disabled:e,loading:t,onCheckedChange:i,tooltipTextSwitchOn:s,tooltipTextSwitchOff:r,tooltipTextSwitchDisabled:o}){const a=e?o??"Disabled":n?s:r;return f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("div",{className:"flex items-center justify-center py-5 pl-6",onClick:l=>l.stopPropagation(),children:t?f.jsx(NR,{className:"text-muted-foreground h-5 w-5 animate-spin"}):f.jsx(WTe,{checked:n,disabled:e,onCheckedChange:i})})}),f.jsx(kn,{children:a})]})}function jut({icon:n,className:e,...t}){return f.jsx("div",{className:Le("flex flex-shrink-0 items-center justify-center self-center p-4",e),...t,children:f.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full transition-colors duration-200 group-hover:bg-gray-200/50 dark:group-hover:bg-white/4",children:n??f.jsx($d,{className:"text-muted-foreground/75 dark:text-muted-foreground/50 h-4 w-4"})})})}function Hut(n){const{dataMart:e}=Zu(),{reports:t,createReport:i,deleteReport:s,fetchReportsByDataMartId:r}=rg(),[o,a]=x.useState(!1),l=x.useMemo(()=>t.find(g=>g.dataDestination.type===St.LOOKER_STUDIO&&g.dataDestination.id===n.id),[t,n.id]),c=x.useMemo(()=>(e==null?void 0:e.status.code)===Ll.PUBLISHED,[e==null?void 0:e.status.code]),d=x.useMemo(()=>!!l,[l]),u=x.useMemo(()=>d?"Available in Looker Studio":"Not available in Looker Studio",[d]),h=x.useCallback(async g=>{if(!(!e||!c)){a(!0);try{if(g){const m={title:`Looker Studio Report - ${n.title}`,dataMartId:e.id,dataDestinationId:n.id,destinationConfig:{type:nl.LOOKER_STUDIO_CONFIG,cacheLifetime:300}};await i(m),await r(e.id)}else l&&(await s(l.id),await r(e.id))}catch(m){console.error("Failed to toggle Looker Studio report:",m)}finally{a(!1)}}},[e,c,n,l,i,s,r]);return{existingReport:l,isLoading:o,isEnabled:c,isChecked:d,dynamicTitle:u,handleSwitchChange:h}}function But({destination:n,onEditReport:e,...t}){const{existingReport:i,isLoading:s,isEnabled:r,isChecked:o,dynamicTitle:a,handleSwitchChange:l}=Hut(n),c=x.useCallback(()=>{i&&e(i)},[i,e]);return f.jsxs(Aut,{className:i?"cursor-pointer dark:hover:bg-white/5":"",onClick:i?c:void 0,...t,children:[f.jsx(Fut,{checked:o,disabled:!r,loading:s,onCheckedChange:d=>void l(d),tooltipTextSwitchOn:"Switch off to remove access",tooltipTextSwitchOff:"Switch on to enable access",tooltipTextSwitchDisabled:"Publish the Data Mart first to enable access in Looker Studio"}),f.jsxs(Mut,{children:[f.jsx(Out,{children:a}),f.jsx(Put,{children:o&&i?f.jsx(f.Fragment,{children:i.lastRunDate?f.jsxs(f.Fragment,{children:["Last fetched"," ",i.lastRunStatus===Fr.SUCCESS&&"successfully ",f.jsx(W1,{date:new Date(i.lastRunDate)}),i.lastRunStatus===Fr.ERROR&&" but failed with error",i.lastRunError&&f.jsx("div",{className:"mt-1 text-red-600 dark:text-red-400",children:i.lastRunError})]}):"Waiting for Looker Studio to fetch data"}):"Switch on to enable access"})]}),o&&i&&f.jsx(jut,{})]})}function Vut(){const{scope:n}=hb();return f.jsx("div",{className:"dm-card",children:f.jsxs("div",{className:"dm-empty-state",children:[f.jsx(Mne,{className:"dm-empty-state-ico",strokeWidth:1}),f.jsx("h2",{className:"dm-empty-state-title",children:"Google Sheets, Looker Studio… and friends!"}),f.jsx("p",{className:"dm-empty-state-subtitle",children:"To send your Data Mart's data to your favorite tools, create a Destination first."}),f.jsx(rt,{variant:"outline",asChild:!0,children:f.jsxs(Vc,{to:n("/data-destinations"),className:"flex items-center gap-1",children:["Go to Destinations",f.jsx($d,{className:"h-4 w-4"})]})})]})})}function Wut(){const[n,e]=x.useState(!1),[t,i]=x.useState(xr.CREATE),[s,r]=x.useState(null);return{isOpen:n,mode:t,editingReport:s,handleAddReport:()=>{i(xr.CREATE),r(null),e(!0),Vt({event:"report_open",category:"Report",action:"CreateReport",label:"ReportForm"})},handleEditReport:c=>{i(xr.EDIT),r(c),e(!0),Vt({event:"report_open",category:"Report",action:"EditReport",label:c.dataDestination.type})},handleCloseModal:()=>{e(!1),r(null),Vt({event:"report_close",category:"Report",action:t===xr.EDIT?"Edit":"Create",label:"ReportForm"})}}}const zut=[St.GOOGLE_SHEETS,St.EMAIL,St.SLACK,St.MS_TEAMS,St.GOOGLE_CHAT];function Uut({destination:n,dataMartStatus:e}){const{destinationInfo:t,isVisible:i}=RJe(n),{isOpen:s,mode:r,editingReport:o,handleAddReport:a,handleEditReport:l,handleCloseModal:c}=Wut();return i?f.jsxs(f.Fragment,{children:[f.jsxs(c1,{name:n.id,collapsible:!0,defaultCollapsed:!1,children:[f.jsxs(fp,{children:[f.jsx(hp,{icon:t.icon,children:n.title}),f.jsx($M,{children:zut.includes(n.type)&&f.jsx($ut,{dataMartStatus:e,onAddReport:a})})]}),f.jsx(gp,{children:f.jsx(bht,{destination:n,onEditReport:l})}),f.jsx(E_,{})]}),f.jsx(_ht,{destination:n,isOpen:s,onClose:c,mode:r,initialReport:o})]}):null}function $ut({dataMartStatus:n,onAddReport:e}){const t=(n==null?void 0:n.code)===Ll.DRAFT;return f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("span",{children:f.jsxs(rt,{onClick:e,variant:"outline",size:"sm","aria-label":"Add new report",disabled:t,children:[f.jsx(Gd,{className:"h-4 w-4"}),"Add Report"]})})}),t&&f.jsx(kn,{children:f.jsx("p",{children:"To create a report, publish the Data Mart first"})})]})}function Gut({elementId:n,isOpen:e,delay:t=100,selectText:i=!1}){x.useEffect(()=>{{const s=setTimeout(()=>{const r=document.getElementById(n);if(r){const o=r;o.focus(),i&&o.value?o.select():o.value&&o.setSelectionRange(o.value.length,o.value.length)}},t);return()=>{clearTimeout(s)}}},[e,n,t,i])}const qut=_s({title:pn().min(1,"Title is required"),documentUrl:pn().refine(ADe,"Enter a valid Google Sheets URL"),dataDestinationId:pn().min(1,"Destination is required")});function Kut({initialReport:n,mode:e,dataMartId:t,onSuccess:i,preSelectedDestination:s}){const[r,o]=x.useState(null),[a,l]=x.useState(!1),{updateReport:c,createReport:d,error:u,clearError:h}=rg();x.useEffect(()=>{a&&u&&(o(u),l(!1))},[u,a]);const g=Bp({resolver:pb(qut),defaultValues:{title:(n==null?void 0:n.title)??"",documentUrl:n!=null&&n.destinationConfig&&VH(n.destinationConfig)?`https://docs.google.com/spreadsheets/d/${n.destinationConfig.spreadsheetId}/edit#gid=${n.destinationConfig.sheetId}`:"",dataDestinationId:(n==null?void 0:n.dataDestination.id)??(s==null?void 0:s.id)??""},mode:"onTouched"}),{register:m,handleSubmit:b,formState:v,reset:C}=g,{errors:y,isDirty:L}=v,E=x.useCallback(async R=>{try{o(null),h(),l(!0);const{spreadsheetId:T,sheetId:N}=rJe(R.documentUrl);if(!T){o("Invalid Google Sheets URL");return}let I;if(e===xr.CREATE)I=await d({title:R.title,dataMartId:t,dataDestinationId:R.dataDestinationId,destinationConfig:{type:nl.GOOGLE_SHEETS_CONFIG,spreadsheetId:T,sheetId:N}});else{if(!n){o("Initial report is required for edit mode");return}I=await c(n.id,{title:R.title,dataDestinationId:R.dataDestinationId,destinationConfig:{type:nl.GOOGLE_SHEETS_CONFIG,spreadsheetId:T,sheetId:N}})}if(!I||u){o(u??"An error occurred while submitting the form");return}i==null||i()}catch(T){console.error("Error submitting form:",T),o("An error occurred while submitting the form")}},[e,n,t,d,c,i,h,u]);return{form:g,register:m,handleSubmit:b,errors:y,isDirty:L,reset:C,formError:r,isSubmitting:a,setFormError:o,getValues:g.getValues,onSubmit:E}}function Zut(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"service-account-details",children:[f.jsx(is,{children:"How do I get a correct document link?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"To get the correct Google Sheets document URL with a Sheet ID (GID), follow these steps:"}),f.jsxs("ol",{className:"list-inside list-decimal space-y-2 text-sm",children:[f.jsxs("li",{children:["Open your Google Sheets document and select the specific ",f.jsx("strong",{children:"sheet tab"})," ","where the data should be inserted."]}),f.jsxs("li",{children:["Share the document with the service account email and grant it ",f.jsx("strong",{children:"Editor"})," ","access."]}),f.jsxs("li",{children:["While the correct sheet is selected, copy the URL from your browser's address bar — it should include the ",f.jsx("code",{className:"text-sm font-semibold",children:"gid"})," of that sheet."]}),f.jsx("li",{children:"Paste this URL into the field above."})]})]})]})})}function u$(n){return"serviceAccount"in n}function FIe({value:n,children:e,doNotTruncateContent:t}){const[i,s]=x.useState(!1),r=async()=>{n&&(await navigator.clipboard.writeText(n),s(!0),setTimeout(()=>s(!1),2e3))};return f.jsx(Nf,{children:f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsxs("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:o=>o.key==="Enter"&&r(),className:Le("flex cursor-pointer items-center justify-between gap-2 select-none","text-muted-foreground border-input rounded-md border px-3 py-1.5 text-sm","hover:bg-accent hover:text-accent-foreground transition-colors"),children:[f.jsx("span",{className:t?"w-[95%]":"truncate",children:e||n||"No data"}),i?f.jsx(Wc,{className:"h-4 w-4 text-green-500"}):f.jsx(t2,{className:"h-4 w-4"})]})}),f.jsx(kn,{children:f.jsx("p",{children:i?"Copied!":"Click to copy"})})]})})}const Yut=x.forwardRef(({initialReport:n,mode:e=xr.EDIT,onDirtyChange:t,onFormErrorChange:i,onSubmit:s,onCancel:r,preSelectedDestination:o},a)=>{const l="google-sheets-edit-form",c="google-sheets-title-input",d="google-sheets-document-url-input",u="google-sheets-data-destination-select",{dataMart:h}=Zu(),{scope:g}=hb(),{dataDestinations:m,fetchDataDestinations:b,loading:v}=MM(),[C,y]=x.useState([]);x.useEffect(()=>{h&&b()},[h,b]),x.useEffect(()=>{if(m.length>0){const H=m.filter(j=>j.type===St.GOOGLE_SHEETS);y(H)}},[m]),Gut({elementId:c,isOpen:!0,delay:150});const{isDirty:L,reset:E,form:R,isSubmitting:T,formError:N,onSubmit:I}=Kut({initialReport:n,mode:e,dataMartId:(h==null?void 0:h.id)??"",onSuccess:()=>{s==null||s()},preSelectedDestination:o});x.useEffect(()=>{i&&i(N)},[N,i]),x.useEffect(()=>{if(e===xr.EDIT&&n&&VH(n.destinationConfig))E({title:n.title,documentUrl:Ese(n.destinationConfig.spreadsheetId,n.destinationConfig.sheetId),dataDestinationId:n.dataDestination.id});else if(e===xr.CREATE){const H=(o==null?void 0:o.id)??"";E({title:"",documentUrl:"",dataDestinationId:H})}},[n,e,E,o]),x.useEffect(()=>{t==null||t(L)},[L,t]);const M=R.watch("documentUrl"),P=M&&ADe(M.trim());return f.jsx(CC,{...R,children:f.jsxs(gb,{id:l,ref:a,noValidate:!0,onSubmit:H=>void R.handleSubmit(I)(H),children:[f.jsxs(wC,{children:[f.jsxs(tc,{title:"General",children:[f.jsx(fn,{control:R.control,name:"title",render:({field:H})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Add a title that reflects the report`s purpose",children:"Title"}),f.jsx(cn,{children:f.jsx(vn,{id:c,placeholder:"Enter a report title",...H})}),f.jsx(Cn,{})]})}),f.jsx(fn,{control:R.control,name:"dataDestinationId",render:({field:H})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Select one of your existing destinations",children:"Destination"}),f.jsxs($c,{onValueChange:H.onChange,value:H.value,disabled:v||C.length===0,children:[f.jsx(cn,{children:f.jsx(qc,{id:u,className:"w-full max-w-full overflow-hidden",children:f.jsx(Gc,{className:"truncate",placeholder:"Select a destination",children:H.value&&C.length>0&&(()=>{const j=C.find(V=>V.id===H.value);if(j){const W=Nc.getInfo(j.type).icon;return f.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[f.jsx(W,{className:"flex-shrink-0",size:18}),f.jsx("div",{className:"flex min-w-0 flex-col",children:f.jsx("span",{className:"truncate",children:j.title})})]})}return null})()})})}),f.jsx(Kc,{children:C.map(j=>{const W=Nc.getInfo(j.type).icon;return f.jsx(fo,{value:j.id,children:f.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[f.jsx(W,{className:"flex-shrink-0",size:18}),f.jsxs("div",{className:"flex min-w-0 flex-col",children:[f.jsx("span",{className:"truncate",children:j.title}),f.jsx("span",{className:"text-muted-foreground truncate text-xs",children:(u$(j.credentials)&&HU(j.credentials.serviceAccount))??"No email found"})]})]})},j.id)})})]}),C.length===0&&!v&&f.jsxs(Dre,{className:"mt-2",children:[f.jsx(fM,{className:"h-4 w-4"}),f.jsx(kTe,{children:"No destinations available"}),f.jsxs(Rre,{children:["You need to create a Destination before you can create a report."," ",f.jsx(Vc,{to:g("/data-destinations"),className:"font-medium text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:"Go to Destinations"})]})]}),H.value&&C.length>0&&(()=>{const j=C.find(V=>V.id===H.value);return j?f.jsxs("div",{className:"mt-2 flex flex-col gap-1",children:[f.jsx(Ji,{children:"Service Account Email"}),f.jsx(FIe,{value:u$(j.credentials)?HU(j.credentials.serviceAccount)??"No email found":"",children:u$(j.credentials)?HU(j.credentials.serviceAccount):"No email found"})]}):null})(),f.jsx(Cn,{})]})}),f.jsx(fn,{control:R.control,name:"documentUrl",render:({field:H})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"The link must include the Sheet ID to insert data into the correct tab",children:"Document Link with Sheet ID (GID)"}),f.jsx(cn,{children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(vn,{id:d,placeholder:"Document URL",className:"flex-1",...H}),f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("button",{type:"button",className:`flex-shrink-0 rounded-md p-2 transition-all duration-200 ${P?"text-blue-600 hover:bg-blue-50 hover:text-blue-700 dark:text-blue-400 dark:hover:bg-blue-950/20 dark:hover:text-blue-300":"text-muted-foreground/30 cursor-not-allowed"}`,onClick:()=>{P&&window.open(M.trim(),"_blank","noopener,noreferrer")},disabled:!P,"aria-label":P?"Open document in new tab":"Document link is not valid",children:f.jsx(F_,{className:"h-4 w-4","aria-hidden":"true"})})}),f.jsx(kn,{side:"top",align:"center",role:"tooltip",children:P?"Open document in new tab":"Enter a valid URL to enable link"})]})]})}),f.jsx(Hs,{children:f.jsx(Zut,{})}),f.jsx(Cn,{})]})})]}),f.jsx(tc,{title:"Automate Report Runs",children:f.jsx(Ire,{})})]}),f.jsxs(yC,{children:[f.jsx(rt,{variant:"default",type:"submit",className:"w-full","aria-label":e===xr.CREATE?"Create new report":"Save changes to report",disabled:!L||T,children:T?e===xr.CREATE?"Creating...":"Saving...":e===xr.CREATE?"Create new report":"Save changes to report"}),r&&f.jsx(rt,{variant:"outline",type:"button",onClick:r,className:"w-full","aria-label":"Cancel",children:"Cancel"})]})]})})});function Xut({isOpen:n,onClose:e,initialReport:t,mode:i,preSelectedDestination:s}){const[r,o]=x.useState(!1),[a,l]=x.useState(!1),c=x.useCallback(()=>{a?o(!0):e()},[a,e]),d=x.useCallback(()=>{o(!1),l(!1),e()},[e]),u=x.useCallback(g=>{l(g)},[]),h=x.useCallback(()=>{l(!1),e()},[e]);return f.jsxs(f.Fragment,{children:[f.jsx(ab,{open:n,onOpenChange:g=>{g||c()},children:f.jsxs(lb,{children:[f.jsxs(cb,{children:[f.jsx(db,{children:i===xr.CREATE?"Create new report":"Edit report"}),f.jsx(cC,{children:i===xr.CREATE?"Fill in the details to create a new Google Sheets report":"Update details of an existing Google Sheets report"})]}),f.jsx(AM,{children:f.jsx(Yut,{initialReport:t,mode:i,onDirtyChange:u,onSubmit:h,onCancel:c,preSelectedDestination:s})})]})}),f.jsx(Ma,{open:r,onOpenChange:o,title:"Unsaved Changes",description:"You have unsaved changes. Exit without saving?",confirmLabel:"Yes, leave now",cancelLabel:"No, stay here",onConfirm:d,variant:"destructive"})]})}const Qut=_s({cacheLifetime:NYe().min(300,"Cache time must be at least 5 minutes (300 seconds)")});function Jut({initialReport:n,dataMartId:e,onSuccess:t,preSelectedDestination:i}){const[s,r]=x.useState(null),{createReport:o,updateReport:a}=rg(),l=Bp({resolver:pb(Qut),defaultValues:{cacheLifetime:n!=null&&n.destinationConfig&&UDe(n.destinationConfig)?n.destinationConfig.cacheLifetime:300},mode:"onTouched"});return{form:l,onSubmit:async d=>{try{r(null);const{cacheLifetime:u}=d,h={type:nl.LOOKER_STUDIO_CONFIG,cacheLifetime:u};n?await a(n.id,{title:"Looker Studio Report",dataDestinationId:n.dataDestination.id,destinationConfig:h}):await o({title:"Looker Studio Report",dataMartId:e,dataDestinationId:(i==null?void 0:i.id)??"",destinationConfig:h}),t==null||t()}catch(u){console.error("Error submitting form:",u),r("Failed to save report. Please try again.")}},formError:s,isSubmitting:l.formState.isSubmitting,isDirty:l.formState.isDirty,reset:l.reset}}function eht(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"cache-lifetime-details",children:[f.jsx(is,{children:"What is the Cache Lifetime for Looker Studio?"}),f.jsx(ns,{children:f.jsx("p",{className:"mb-2",children:"Cache Lifetime - defines the period during which results from previous query executions are served from storage-side cache, eliminating the need to re-execute the query"})})]})})}const tht=[{value:300,label:"5 minutes"},{value:600,label:"10 minutes"},{value:900,label:"15 minutes"},{value:1800,label:"30 minutes"},{value:3600,label:"1 hour"},{value:7200,label:"2 hours"},{value:14400,label:"4 hours"},{value:28800,label:"8 hours"},{value:43200,label:"12 hours"}],iht=x.forwardRef(({initialReport:n,mode:e=xr.EDIT,onDirtyChange:t,onFormErrorChange:i,onSubmit:s,onCancel:r,preSelectedDestination:o},a)=>{const l="looker-studio-edit-form",{dataMart:c}=Zu(),{isDirty:d,reset:u,form:h,isSubmitting:g,formError:m,onSubmit:b}=Jut({initialReport:n,dataMartId:(c==null?void 0:c.id)??"",onSuccess:()=>{s==null||s()},preSelectedDestination:o});return x.useEffect(()=>{i&&i(m)},[m,i]),x.useEffect(()=>{e===xr.EDIT&&n&&UDe(n.destinationConfig)?u({cacheLifetime:n.destinationConfig.cacheLifetime}):e===xr.CREATE&&u({cacheLifetime:300})},[n,e,u]),x.useEffect(()=>{t==null||t(d)},[d,t]),f.jsx(CC,{...h,children:f.jsxs(gb,{id:l,ref:a,noValidate:!0,onSubmit:v=>void h.handleSubmit(b)(v),children:[f.jsx(wC,{children:f.jsx(tc,{title:"Cache Configuration",children:f.jsx(fn,{control:h.control,name:"cacheLifetime",render:({field:v})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Period during which query results are served from storage-side cache, avoiding re-execution",children:"Cache Lifetime"}),f.jsxs($c,{onValueChange:C=>{v.onChange(parseInt(C,10))},value:v.value.toString(),defaultValue:"300",children:[f.jsx(cn,{children:f.jsx(qc,{className:"w-full",children:f.jsx(Gc,{placeholder:"Select cache time"})})}),f.jsx(Kc,{children:tht.map(C=>f.jsx(fo,{value:C.value.toString(),children:C.label},C.value))})]}),f.jsx(Cn,{}),f.jsx(Hs,{children:f.jsx(eht,{})})]})})})}),f.jsxs(yC,{children:[f.jsx(rt,{variant:"default",type:"submit",className:"w-full","aria-label":e===xr.CREATE?"Create":"Save changes",disabled:!d||g,children:g?e===xr.CREATE?"Creating...":"Saving...":e===xr.CREATE?"Create":"Save changes"}),r&&f.jsx(rt,{variant:"outline",type:"button",onClick:r,className:"w-full","aria-label":"Cancel",children:"Cancel"})]})]})})});function nht({isOpen:n,onClose:e,initialReport:t,mode:i,preSelectedDestination:s}){const[r,o]=x.useState(!1),[a,l]=x.useState(!1),c=x.useCallback(()=>{a?o(!0):e()},[a,e]),d=x.useCallback(()=>{o(!1),l(!1),e()},[e]),u=x.useCallback(g=>{l(g)},[]),h=x.useCallback(()=>{l(!1),e()},[e]);return f.jsxs(f.Fragment,{children:[f.jsx(ab,{open:n,onOpenChange:g=>{g||c()},children:f.jsxs(lb,{children:[f.jsxs(cb,{children:[f.jsx(db,{children:(s==null?void 0:s.title)??"Looker Studio"}),f.jsx(cC,{children:i===xr.CREATE?"Set up Data Mart as a data source":"Update connection details"})]}),f.jsx(AM,{children:f.jsx(iht,{initialReport:t,mode:i,onDirtyChange:u,onSubmit:h,onCancel:c,preSelectedDestination:s})})]})}),f.jsx(Ma,{open:r,onOpenChange:o,title:"Unsaved Changes",description:"You have unsaved changes. Exit without saving?",confirmLabel:"Yes, leave now",cancelLabel:"No, stay here",onConfirm:d,variant:"destructive"})]})}const a_e=({destination:n})=>{const t=Nc.getInfo(n.type).icon;return f.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[f.jsx(t,{className:"flex-shrink-0",size:18}),f.jsx("div",{className:"flex min-w-0 flex-col",children:f.jsx("span",{className:"truncate",children:n.title})})]})};function sht(n){return"to"in n}const rht=({destination:n})=>{if(!n)return null;const e=n.credentials,t=sht(e)&&e.to.length?e.to.join(", "):"";return f.jsxs("div",{className:"mt-2 flex flex-col gap-1",children:[f.jsx(Ji,{children:"Recipients of this report"}),f.jsx(FIe,{doNotTruncateContent:!0,value:t,children:t||"No recipients found"})]})};var ay=(n=>(n.ALWAYS="ALWAYS",n.RESULT_IS_EMPTY="RESULT_IS_EMPTY",n.RESULT_IS_NOT_EMPTY="RESULT_IS_NOT_EMPTY",n))(ay||{});const oht=_s({title:pn().min(1,"Title is required"),dataDestinationId:pn().min(1,"Destination is required"),reportCondition:TH(ay),subject:pn().min(1,"Subject is required"),messageTemplate:pn().min(1,"Message body is required")});function aht({initialReport:n,mode:e,dataMartId:t,onSuccess:i,preSelectedDestination:s}){const[r,o]=x.useState(null),[a,l]=x.useState(!1),{updateReport:c,createReport:d,error:u,clearError:h}=rg();x.useEffect(()=>{a&&u&&(o(u),l(!1))},[u,a]);const g=Bp({resolver:pb(oht),defaultValues:{title:(n==null?void 0:n.title)??"",dataDestinationId:(n==null?void 0:n.dataDestination.id)??(s==null?void 0:s.id)??"",reportCondition:n!=null&&n.destinationConfig&&VU(n.destinationConfig)?n.destinationConfig.reportCondition:ay.ALWAYS,subject:n!=null&&n.destinationConfig&&VU(n.destinationConfig)?n.destinationConfig.subject:"",messageTemplate:n!=null&&n.destinationConfig&&VU(n.destinationConfig)?n.destinationConfig.messageTemplate:""},mode:"onTouched"}),{handleSubmit:m,formState:b,reset:v}=g,{isDirty:C,errors:y}=b,L=x.useCallback(async E=>{try{o(null),h(),l(!0);let R;const T={type:nl.EMAIL_CONFIG,reportCondition:E.reportCondition,subject:E.subject,messageTemplate:E.messageTemplate};if(e===xr.CREATE)R=await d({title:E.title,dataMartId:t,dataDestinationId:E.dataDestinationId,destinationConfig:T});else{if(!n){o("Initial report is required for edit mode");return}R=await c(n.id,{title:E.title,dataDestinationId:E.dataDestinationId,destinationConfig:T})}if(!R||u){o(u??"An error occurred while submitting the form");return}i==null||i()}catch(R){console.error("Error submitting form:",R),o("An error occurred while submitting the form")}},[e,n,t,d,c,i,h,u]);return{form:g,handleSubmit:m,errors:y,isDirty:C,reset:v,formError:r,isSubmitting:a,setFormError:o,onSubmit:L}}function lht({value:n,onChange:e,onBlur:t,height:i=240,theme:s="light",options:r,className:o,placeholder:a="Start writing your message…"}){const l=c=>{t&&c.onDidBlurEditorText(t)};return f.jsx(vre,{language:"markdown",height:i,value:n,onChange:c=>{e(c??"")},onMount:l,theme:s,options:{wordWrap:"on",minimap:{enabled:!1},lineNumbers:"off",folding:!1,scrollBeyondLastLine:!1,automaticLayout:!0,placeholder:a,...r},className:o})}const cht=()=>f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(bl,{className:"h-6 w-3/4"}),f.jsx(bl,{className:"h-4 w-1/2"})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(bl,{className:"h-4 w-full"}),f.jsx(bl,{className:"h-4 w-5/6"}),f.jsx(bl,{className:"h-4 w-4/5"}),f.jsx(bl,{className:"h-4 w-3/4"})]})]});function jIe({html:n,loading:e=!1,error:t=null,height:i=240,className:s,emptyState:r=f.jsx("div",{className:"text-muted-foreground text-sm",children:"Nothing to preview"})}){let o="#fff",a="#000";if(typeof window<"u"){const l=getComputedStyle(document.documentElement),c=l.getPropertyValue("--background").trim(),d=l.getPropertyValue("--foreground").trim();c&&(o=c),d&&(a=d)}return f.jsxs("div",{className:`bg-background overflow-auto p-4 ${s??""}`,style:{height:i},children:[e&&f.jsx(cht,{}),!e&&t&&f.jsxs("div",{className:"text-destructive text-sm",children:["Error: ",t]}),!e&&!t&&!n&&r,!e&&!t&&!!n&&f.jsx("iframe",{title:"Markdown preview",sandbox:"allow-popups allow-popups-to-escape-sandbox",srcDoc:`<!doctype html><html lang='en' style="background:${o};color:${a}"><head><meta charset='utf-8'/><base target='_blank'></head><body>${n}</body></html>`,className:"h-full w-full border-0"})]})}function dht({value:n,onChange:e}){return f.jsx(ore,{value:n,onValueChange:t=>{e(t)},children:f.jsxs(are,{children:[f.jsx(u2,{value:"markdown",children:"Markdown"}),f.jsx(u2,{value:"preview",children:"Preview"})]})})}function uht({markdown:n,enabled:e=!0,debounceMs:t=300,toHtml:i}){const[s,r]=x.useState(""),[o,a]=x.useState(!1),[l,c]=x.useState(null),d=x.useRef(null);return x.useEffect(()=>{var m;if(!e)return;const u=n;if(!u.trim()){r(""),c(null),a(!1);return}const h=new AbortController;(m=d.current)==null||m.abort(),d.current=h,a(!0),c(null);const g=setTimeout(()=>{i(u,h.signal).then(b=>{r(b)}).catch(b=>{if(h.signal.aborted)return;const v=b instanceof Error?b.message:"Failed to load preview";c(v)}).finally(()=>{h.signal.aborted||a(!1)})},t);return()=>{clearTimeout(g),h.abort()}},[n,e,t,i]),{html:s,loading:o,error:l}}function hht(n,e){return Rd.post("/markdown/parse-to-html",{markdown:n},{headers:{"Content-Type":"application/json"},responseType:"text",signal:e}).then(t=>t.data)}function HIe(n){const e=x.useCallback(hht,[]);return uht({...n,toHtml:e})}function fht(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"message-details",children:[f.jsx(is,{children:"How can I format my message?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"You can format your message using Markdown — a simple text formatting syntax that lets you add structure and style without using complex editors."}),f.jsxs("p",{className:"mb-2",children:["For example:",f.jsx("br",{}),"**bold text** → ",f.jsx("b",{children:"bold text"}),f.jsx("br",{}),"*italic text* → ",f.jsx("i",{children:"italic text"}),f.jsx("br",{}),"- list item → • list item"]}),f.jsxs("p",{children:["Use the Preview tab to see how your message will look after formatting.",f.jsx("br",{}),"If you’re new to Markdown, learn more from this"," ",f.jsx(ir,{className:"underline",href:"https://www.markdownguide.org/basic-syntax/",children:"quick guide"})]})]})]})})}function ght(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"sending-condition-details",children:[f.jsx(is,{children:"What are Data Mart Run results?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"A Data Mart Run result is the outcome of processing your Data Mart — for example, running an SQL query that retrieves data for your report."}),f.jsx("p",{children:"Before sending a report, OWOX automatically runs the Data Mart and checks its result. Depending on your settings, the report can be sent always, only if the result is not empty, or only if it’s empty."})]})]})})}const pht=[St.EMAIL,St.SLACK,St.GOOGLE_CHAT,St.MS_TEAMS],BIe=x.forwardRef(({initialReport:n,mode:e=xr.EDIT,onDirtyChange:t,onFormErrorChange:i,onSubmit:s,onCancel:r,preSelectedDestination:o},a)=>{const l="email-report-edit-form",{dataMart:c}=Zu(),{dataDestinations:d,fetchDataDestinations:u,loading:h}=MM(),[g,m]=x.useState([]);x.useEffect(()=>{c&&u()},[c,u]),x.useEffect(()=>{if(d.length>0){const B=o!=null&&o.type?[o.type]:pht,K=d.filter(X=>B.includes(X.type));m(K)}},[d,o==null?void 0:o.type]);const{isDirty:b,reset:v,form:C,isSubmitting:y,formError:L,onSubmit:E}=aht({initialReport:n,mode:e,dataMartId:(c==null?void 0:c.id)??"",onSuccess:()=>{s==null||s()},preSelectedDestination:o});x.useEffect(()=>{i&&i(L)},[L,i]),x.useEffect(()=>{if(!(e===xr.EDIT&&n)){if(e===xr.CREATE){const B=(o==null?void 0:o.id)??"";v({title:"",dataDestinationId:B,reportCondition:ay.ALWAYS,subject:"",messageTemplate:""})}}},[n,e,v,o]),x.useEffect(()=>{t==null||t(b)},[b,t]);const R=x.useMemo(()=>[{value:ay.ALWAYS,label:"Send always"},{value:ay.RESULT_IS_EMPTY,label:"Send only when result is empty"},{value:ay.RESULT_IS_NOT_EMPTY,label:"Send only when result is not empty"}],[]),{resolvedTheme:T}=AH(),N=T==="dark"?"vs-dark":"light",[I,M]=x.useState("markdown"),P=C.watch("messageTemplate"),{html:H,loading:j,error:V}=HIe({markdown:P,enabled:I==="preview"}),W=C.watch("dataDestinationId"),U=x.useMemo(()=>W&&g.length>0?g.find(B=>B.id===W)??null:null,[W,g]);return f.jsx(CC,{...C,children:f.jsxs(gb,{id:l,ref:a,noValidate:!0,onSubmit:B=>{C.handleSubmit(E)(B)},children:[f.jsxs(wC,{children:[f.jsxs(tc,{title:"General",children:[f.jsx(fn,{control:C.control,name:"title",render:({field:B})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Add a title that reflects the report`s purpose",children:"Title"}),f.jsx(cn,{children:f.jsx(vn,{placeholder:"Enter a report title",...B})}),f.jsx(Cn,{})]})}),f.jsx(fn,{control:C.control,name:"dataDestinationId",render:({field:B})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Select one of your existing destinations",children:"Destination"}),f.jsxs($c,{onValueChange:B.onChange,value:B.value,disabled:h||g.length===0,children:[f.jsx(cn,{children:f.jsx(qc,{className:"w-full max-w-full overflow-hidden",children:f.jsx(Gc,{className:"truncate",placeholder:"Select a destination",children:U&&f.jsx(a_e,{destination:U})})})}),f.jsx(Kc,{children:g.map(K=>f.jsx(fo,{value:K.id,children:f.jsx(a_e,{destination:K})},K.id))})]}),f.jsx(rht,{destination:U}),f.jsx(Cn,{})]})})]}),f.jsxs(tc,{title:"Template",children:[f.jsx(fn,{control:C.control,name:"subject",render:({field:B})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Add a short, clear subject line for your report",children:"Subject"}),f.jsx(cn,{children:f.jsx(vn,{placeholder:"Enter a message title",...B})}),f.jsx(Cn,{})]})}),f.jsx(fn,{control:C.control,name:"messageTemplate",render:({field:B})=>f.jsxs(tn,{children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx(Ji,{tooltip:"Write your report message in Markdown and check the final format in Preview",children:"Message"}),f.jsx(dht,{value:I,onChange:M})]}),f.jsx(cn,{children:f.jsx("div",{className:"overflow-hidden rounded-md border",children:I==="markdown"?f.jsx(lht,{value:B.value,onChange:K=>{B.onChange(K)},onBlur:B.onBlur,height:240,theme:N}):f.jsx(jIe,{html:H,loading:j,error:V,height:240})})}),f.jsx(Hs,{children:f.jsx(fht,{})}),f.jsx(Cn,{})]})})]}),f.jsx(tc,{title:"Sending conditions",children:f.jsx(fn,{control:C.control,name:"reportCondition",render:({field:B})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Define when the report should be sent based on your Data Mart’s execution result",children:"Data Mart Run results"}),f.jsxs($c,{onValueChange:B.onChange,value:B.value,children:[f.jsx(cn,{children:f.jsx(qc,{className:"w-full max-w-full overflow-hidden",children:f.jsx(Gc,{})})}),f.jsx(Kc,{children:R.map(K=>f.jsx(fo,{value:K.value,children:K.label},K.value))})]}),f.jsx(Hs,{children:f.jsx(ght,{})}),f.jsx(Cn,{})]})})}),f.jsx(tc,{title:"Automate Report Runs",children:f.jsx(Ire,{})})]}),f.jsxs(yC,{children:[f.jsx(rt,{variant:"default",type:"submit",disabled:y,children:e===xr.CREATE?"Create new report":"Save changes to report"}),f.jsx(rt,{variant:"outline",type:"button",onClick:r,disabled:y,children:"Cancel"})]})]})})});BIe.displayName="EmailReportEditForm";function mht({isOpen:n,onClose:e,initialReport:t,mode:i,preSelectedDestination:s}){const[r,o]=x.useState(!1),[a,l]=x.useState(!1),c=x.useCallback(()=>{a?o(!0):e()},[a,e]),d=x.useCallback(()=>{o(!1),l(!1),e()},[e]),u=x.useCallback(g=>{l(g)},[]),h=x.useCallback(()=>{l(!1),e()},[e]);return f.jsxs(f.Fragment,{children:[f.jsx(ab,{open:n,onOpenChange:g=>{g||c()},children:f.jsxs(lb,{children:[f.jsxs(cb,{children:[f.jsx(db,{children:(s==null?void 0:s.title)??"Report"}),f.jsx(cC,{children:i===xr.CREATE?"Fill in the details to create a new report":"Update details of an existing report"})]}),f.jsx(AM,{children:f.jsx(BIe,{initialReport:t,mode:i,onDirtyChange:u,onSubmit:h,onCancel:c,preSelectedDestination:s})})]})}),f.jsx(Ma,{open:r,onOpenChange:o,title:"Unsaved Changes",description:"You have unsaved changes. Exit without saving?",confirmLabel:"Yes, leave now",cancelLabel:"No, stay here",onConfirm:d,variant:"destructive"})]})}function _ht({destination:n,isOpen:e,onClose:t,mode:i,initialReport:s}){switch(n.type){case St.GOOGLE_SHEETS:return f.jsx(Xut,{isOpen:e,onClose:t,mode:i,preSelectedDestination:n,initialReport:s??void 0});case St.LOOKER_STUDIO:return f.jsx(nht,{isOpen:e,onClose:t,mode:i,preSelectedDestination:n,initialReport:s??void 0});case St.EMAIL:case St.SLACK:case St.GOOGLE_CHAT:case St.MS_TEAMS:return f.jsx(mht,{isOpen:e,onClose:t,mode:i,preSelectedDestination:n,initialReport:s??void 0});default:return null}}function bht({destination:n,onEditReport:e}){switch(n.type){case St.GOOGLE_SHEETS:return f.jsx(Rut,{destination:n,onEditReport:e});case St.EMAIL:case St.SLACK:case St.GOOGLE_CHAT:case St.MS_TEAMS:return f.jsx(kut,{destinationType:n.type,destination:n,onEditReport:e});case St.LOOKER_STUDIO:return f.jsx(But,{destination:n,onEditReport:e});default:return null}}function VIe(){return f.jsx("div",{className:"flex flex-col gap-4",children:f.jsx("div",{className:"space-y-2 pb-4",children:Array.from({length:3}).map((n,e)=>f.jsx("div",{className:"border-border rounded-lg border p-4",children:f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(bl,{className:"h-4 w-4 rounded-full"}),f.jsx(bl,{className:"h-4 w-40"}),f.jsx(bl,{className:"h-3 w-32"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(bl,{className:"h-6 w-16 rounded-full"}),f.jsx(bl,{className:"h-4 w-4"})]})]})},e))})})}function Qre({enabled:n,intervalMs:e=5e3,onlyWhenVisible:t=!0,onTick:i}){const s=x.useRef(i);s.current=i;const r=x.useRef(null);x.useEffect(()=>{var l;if(!n)return;(l=r.current)==null||l.abort(),r.current=new AbortController;const o=()=>{if(!t||document.visibilityState==="visible"){const c=new AbortController;s.current(c.signal)}};o();const a=window.setInterval(o,e);return()=>{var c;window.clearInterval(a),(c=r.current)==null||c.abort()}},[n,e,t])}function vht({enabled:n=!0,intervalMs:e=5e3}={}){const{dataMart:t}=Zu(),{fetchReportsByDataMartId:i}=rg(),s=t==null?void 0:t.id;x.useEffect(()=>{s&&i(s)},[s,i]),Qre({enabled:!!s&&n,intervalMs:e,onTick:()=>{s&&i(s,{silent:!0})}})}function Cht(){const{dataMart:n}=Zu(),{dataDestinations:e,isLoading:t}=NJe();return vht({enabled:!0,intervalMs:5e3}),n?f.jsx("div",{className:"flex flex-col gap-4",children:t?f.jsx(VIe,{}):e.length===0?f.jsx(Vut,{}):e.map(i=>f.jsx(Uut,{destination:i,dataMartStatus:n.status},i.id))}):null}function wht(){return f.jsx(AM,{children:f.jsx(ODe,{children:f.jsx(Cht,{})})})}function l_e(){return f.jsxs(c1,{children:[f.jsx(fp,{children:f.jsx(hp,{icon:SHe,tooltip:"Description of the Data Mart",children:"Description"})}),f.jsx(gp,{children:f.jsx(ert,{})}),f.jsx(E_,{})]})}function yht(){const{dataMart:n}=og(),[e,t]=x.useState(!1),i=x.useCallback(()=>{t(!0)},[]),s=x.useCallback(()=>{t(!1)},[]);return f.jsxs(c1,{children:[f.jsxs(fp,{children:[f.jsx(hp,{icon:oxe,tooltip:"Time triggers allow you to schedule Data Mart runs at specific times",children:"Time triggers"}),f.jsx($M,{children:f.jsxs(rt,{variant:"outline",onClick:i,"aria-label":"Add new trigger",children:[f.jsx(Gd,{className:"h-4 w-4","aria-hidden":"true"}),"Add Trigger"]})})]}),f.jsx(gp,{children:f.jsx(HD,{children:f.jsx(elt,{children:n&&f.jsxs(f.Fragment,{children:[f.jsx(Vlt,{dataMartId:n.id}),f.jsx(Tre,{isOpen:e,onClose:s,dataMartId:n.id})]})})})}),f.jsx(E_,{})]})}const Sht={list:[],listLoadingStatus:an.IDLE,activeInsight:null,activeInsightLoadingStatus:an.IDLE,executionStatus:an.IDLE,executionTriggerId:null,error:null};var Vi=(n=>(n.FETCH_INSIGHTS_START="FETCH_INSIGHTS_START",n.FETCH_INSIGHTS_SUCCESS="FETCH_INSIGHTS_SUCCESS",n.FETCH_INSIGHTS_ERROR="FETCH_INSIGHTS_ERROR",n.GET_INSIGHT_START="GET_INSIGHT_START",n.GET_INSIGHT_SUCCESS="GET_INSIGHT_SUCCESS",n.GET_INSIGHT_ERROR="GET_INSIGHT_ERROR",n.CREATE_INSIGHT_START="CREATE_INSIGHT_START",n.CREATE_INSIGHT_SUCCESS="CREATE_INSIGHT_SUCCESS",n.CREATE_INSIGHT_ERROR="CREATE_INSIGHT_ERROR",n.UPDATE_INSIGHT_START="UPDATE_INSIGHT_START",n.UPDATE_INSIGHT_SUCCESS="UPDATE_INSIGHT_SUCCESS",n.UPDATE_INSIGHT_ERROR="UPDATE_INSIGHT_ERROR",n.DELETE_INSIGHT_START="DELETE_INSIGHT_START",n.DELETE_INSIGHT_SUCCESS="DELETE_INSIGHT_SUCCESS",n.DELETE_INSIGHT_ERROR="DELETE_INSIGHT_ERROR",n.RUN_INSIGHT_START="RUN_INSIGHT_START",n.RUN_INSIGHT_START_ERROR="RUN_INSIGHT_START_ERROR",n.RUN_INSIGHT_STARTED="RUN_INSIGHT_STARTED",n.RUN_INSIGHT_SUCCESS="RUN_INSIGHT_SUCCESS",n.RUN_INSIGHT_ERROR="RUN_INSIGHT_ERROR",n.CLEAR_ERROR="CLEAR_ERROR",n))(Vi||{});class xht extends hC{constructor(){super("/data-marts")}async getInsights(e){return this.get(`/${e}/insights`)}async getInsightById(e,t){return await this.get(`/${e}/insights/${t}`)}async createInsight(e,t){return this.post(`/${e}/insights`,t)}async updateInsight(e,t,i){return this.put(`/${e}/insights/${t}`,i)}async updateInsightTitle(e,t,i){return this.put(`/${e}/insights/${t}/title`,i)}async deleteInsight(e,t){return this.delete(`/${e}/insights/${t}`)}async startInsightExecution(e,t){return this.post(`/${e}/insights/${t}/run-triggers`,{})}async checkInsightExecutionStatus(e,t,i,s){return this.get(`/${e}/insights/${i}/run-triggers/${t}/status`,null,s)}async getInsightRunTriggers(e,t,i){return this.get(`/${e}/insights/${t}/run-triggers/`,null,i)}}const Tm=new xht,cI=n=>({id:n.id,title:n.title,template:n.template??null,output:n.output??null,outputUpdatedAt:n.outputUpdatedAt?new Date(n.outputUpdatedAt):null,lastRun:n.lastManualDataMartRun?{status:n.lastManualDataMartRun.status,id:n.lastManualDataMartRun.id}:null,createdById:n.createdById,createdAt:new Date(n.createdAt),modifiedAt:new Date(n.modifiedAt)}),Lht=n=>n.data.map(cI),Eht=n=>({title:n.title,template:n.template??null}),Dht=n=>({title:n.title,template:n.template??null}),WIe=x.createContext(void 0);function zIe(){const n=x.useContext(WIe);if(!n)throw new Error("useInsightsContext must be used within InsightsProvider");return n}function Jre(){const{state:n,dispatch:e}=zIe(),{dataMart:t}=og();if(!t)throw new Error("useInsights must be used within a DataMart context");const i=x.useCallback(async()=>{e({type:Vi.FETCH_INSIGHTS_START});try{const g=await Tm.getInsights(t.id),m=Lht(g);e({type:Vi.FETCH_INSIGHTS_SUCCESS,payload:m})}catch(g){throw e({type:Vi.FETCH_INSIGHTS_ERROR,payload:ys(g)}),g}},[t.id,e]),s=x.useCallback(async g=>{e({type:Vi.GET_INSIGHT_START});try{const m=await Tm.getInsightById(t.id,g),b=cI(m);return e({type:Vi.GET_INSIGHT_SUCCESS,payload:b}),b}catch(m){throw e({type:Vi.GET_INSIGHT_ERROR,payload:ys(m)}),m}},[t.id,e]),r=x.useCallback(async g=>{e({type:Vi.CREATE_INSIGHT_START});try{const m=Eht(g),b=await Tm.createInsight(t.id,m),v=cI(b);return e({type:Vi.CREATE_INSIGHT_SUCCESS,payload:v}),Vt({event:"insight_created",category:"Insights",action:"Create",label:v.id}),Rn.success("Insight created"),v}catch(m){return e({type:Vi.CREATE_INSIGHT_ERROR,payload:ys(m)}),null}},[t.id,e]),o=x.useCallback(async(g,m)=>{e({type:Vi.UPDATE_INSIGHT_START});try{const b=Dht(m),v=await Tm.updateInsight(t.id,g,b),C=cI(v);return e({type:Vi.UPDATE_INSIGHT_SUCCESS,payload:C}),Vt({event:"insight_updated",category:"Insights",action:"Update",label:C.id}),Rn.success("Insight updated"),C}catch(b){return e({type:Vi.UPDATE_INSIGHT_ERROR,payload:ys(b)}),null}},[t.id,e]),a=x.useCallback(async g=>{e({type:Vi.DELETE_INSIGHT_START});try{await Tm.deleteInsight(t.id,g),e({type:Vi.DELETE_INSIGHT_SUCCESS,payload:g}),Vt({event:"insight_deleted",category:"Insights",action:"Delete",label:g}),Rn.success("Insight deleted")}catch(m){throw e({type:Vi.DELETE_INSIGHT_ERROR,payload:ys(m)}),m}},[t.id,e]),l=x.useCallback(async(g,m)=>{e({type:Vi.UPDATE_INSIGHT_START});try{const b=await Tm.updateInsightTitle(t.id,g,{title:m}),v=cI(b),C=n.list.find(L=>L.id===g)??n.activeInsight,y=C?{...v,template:C.template}:v;return e({type:Vi.UPDATE_INSIGHT_SUCCESS,payload:y}),Vt({event:"insight_title_updated",category:"Insights",action:"Update title",label:y.id}),Rn.success("Title updated"),y}catch(b){return e({type:Vi.UPDATE_INSIGHT_ERROR,payload:ys(b)}),null}},[t.id,e,n.activeInsight,n.list]),c=x.useCallback(async g=>{e({type:Vi.RUN_INSIGHT_START});try{const m=await Tm.startInsightExecution(t.id,g);e({type:Vi.RUN_INSIGHT_STARTED,payload:{triggerId:m.triggerId}})}catch(m){e({type:Vi.RUN_INSIGHT_ERROR,payload:ys(m)})}},[e,t.id]),d=x.useCallback(()=>{e({type:Vi.RUN_INSIGHT_SUCCESS,payload:{triggerId:""}})},[e]),u=x.useCallback(g=>{e({type:Vi.RUN_INSIGHT_STARTED,payload:{triggerId:g}})},[e]),h=x.useCallback(async()=>{const g=n.activeInsight;if(!(!g||!t.id)&&!n.executionTriggerId&&!(!g.lastRun||JJe(g.lastRun.status)))try{const b=(await Tm.getInsightRunTriggers(t.id,g.id,{skipLoadingIndicator:!0})).data.sort((v,C)=>new Date(C.modifiedAt).getTime()-new Date(v.modifiedAt).getTime()).find(v=>!eet(v.status));b!=null&&b.id&&(e({type:Vi.RUN_INSIGHT_START}),e({type:Vi.RUN_INSIGHT_STARTED,payload:{triggerId:b.id}}))}catch(m){e({type:Vi.RUN_INSIGHT_ERROR,payload:ys(m)})}},[n.activeInsight,n.executionTriggerId,t.id,e]);return{insights:n.list,activeInsight:n.activeInsight,listLoading:n.listLoadingStatus===an.LOADING,insightLoading:n.activeInsightLoadingStatus===an.LOADING,isRunning:n.executionStatus===an.LOADING,triggerId:n.executionTriggerId,error:n.error,fetchInsights:i,getInsight:s,createInsight:r,updateInsight:o,updateInsightTitle:l,deleteInsight:a,runInsight:c,setTriggerId:u,resetTriggerId:d,ensureActiveRunPolling:h}}function Rht(){const{state:n}=zIe(),e=x.useMemo(()=>n.list,[n.list]),t=x.useMemo(()=>n.listLoadingStatus===an.LOADING,[n.listLoadingStatus]),i=x.useMemo(()=>n.listLoadingStatus===an.LOADED||n.listLoadingStatus===an.ERROR,[n.listLoadingStatus]),s=x.useMemo(()=>n.error,[n.error]),r=x.useMemo(()=>e.length>0,[e.length]);return{insights:e,isLoading:t,isLoaded:i,error:s,hasInsights:r}}function Nht(n,e){var t,i;switch(e.type){case Vi.FETCH_INSIGHTS_START:return{...n,listLoadingStatus:an.LOADING,error:null};case Vi.GET_INSIGHT_START:return{...n,activeInsightLoadingStatus:an.LOADING,error:null};case Vi.CREATE_INSIGHT_START:return{...n,activeInsightLoadingStatus:an.LOADING,error:null};case Vi.UPDATE_INSIGHT_START:return{...n,error:null};case Vi.DELETE_INSIGHT_START:return{...n,listLoadingStatus:an.LOADING,error:null};case Vi.FETCH_INSIGHTS_SUCCESS:return{...n,list:e.payload,listLoadingStatus:an.LOADED,error:null};case Vi.GET_INSIGHT_SUCCESS:return{...n,activeInsight:e.payload,activeInsightLoadingStatus:an.LOADED,error:null};case Vi.CREATE_INSIGHT_SUCCESS:return{...n,list:[...n.list,e.payload],listLoadingStatus:an.LOADED,activeInsightLoadingStatus:an.LOADED,error:null};case Vi.UPDATE_INSIGHT_SUCCESS:return{...n,list:n.list.map(s=>s.id===e.payload.id?e.payload:s),activeInsight:((t=n.activeInsight)==null?void 0:t.id)===e.payload.id?e.payload:n.activeInsight,listLoadingStatus:an.LOADED,error:null};case Vi.DELETE_INSIGHT_SUCCESS:return{...n,list:n.list.filter(s=>s.id!==e.payload),activeInsight:((i=n.activeInsight)==null?void 0:i.id)===e.payload?null:n.activeInsight,listLoadingStatus:an.LOADED,error:null};case Vi.FETCH_INSIGHTS_ERROR:return{...n,listLoadingStatus:an.ERROR,error:e.payload};case Vi.GET_INSIGHT_ERROR:return{...n,activeInsightLoadingStatus:an.ERROR,error:e.payload};case Vi.CREATE_INSIGHT_ERROR:return{...n,listLoadingStatus:an.ERROR,activeInsightLoadingStatus:an.ERROR,error:e.payload};case Vi.UPDATE_INSIGHT_ERROR:case Vi.DELETE_INSIGHT_ERROR:return{...n,listLoadingStatus:an.ERROR,error:e.payload};case Vi.RUN_INSIGHT_START:return{...n,executionStatus:an.LOADING,error:null};case Vi.RUN_INSIGHT_STARTED:return{...n,executionTriggerId:e.payload.triggerId,error:null};case Vi.RUN_INSIGHT_SUCCESS:return{...n,executionStatus:an.LOADED,executionTriggerId:null,error:null};case Vi.CLEAR_ERROR:return{...n,error:null};default:return n}}function UIe({children:n,initialState:e}){const[t,i]=x.useReducer(Nht,e??Sht);return f.jsx(WIe.Provider,{value:{state:t,dispatch:i},children:n})}function Tht(){return f.jsx(UIe,{children:f.jsx(Tne,{})})}function Iht({status:n}){switch(n){case $r.RUNNING:return f.jsx(Ya,{variant:"secondary",className:"text-primary bg-primary/10",children:"Running"});case $r.SUCCESS:return f.jsx(Ya,{variant:"secondary",className:"bg-green-50 text-green-600 dark:bg-green-950 dark:text-green-400",children:"Success"});case $r.FAILED:return f.jsx(Ya,{variant:"secondary",className:"bg-red-50 text-red-600 dark:bg-red-950 dark:text-red-400",children:"Failed"});case $r.CANCELLED:return f.jsx(Ya,{variant:"secondary",className:"bg-gray-50 text-gray-500 dark:bg-gray-950 dark:text-gray-400",children:"Cancelled"});case $r.INTERRUPTED:return f.jsx(Ya,{variant:"secondary",className:"bg-gray-50 text-gray-500 dark:bg-gray-950 dark:text-gray-400",children:"Interrupted"});case $r.PENDING:return f.jsx(Ya,{variant:"secondary",className:"bg-gray-50 text-gray-500 dark:bg-gray-950 dark:text-gray-400",children:"Pending"});default:return f.jsx(Ya,{variant:"secondary",className:"bg-gray-50 text-gray-500 dark:bg-gray-950 dark:text-gray-400",children:"Unknown"})}}var Tc=(n=>(n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.SYSTEM="SYSTEM",n))(Tc||{}),hf=(n=>(n.STRUCTURED="structured",n.RAW="raw",n.CONFIGURATION="configuration",n))(hf||{});const c_e=(n,e,t=!1)=>{var o,a,l,c;const i=n.split(`
|
|
742
742
|
`).filter(d=>d.trim()!=="");if(i.length>=3){const d=i[0],u=i[1],h=i.slice(2).join(`
|
|
743
743
|
`);if(d.includes("T")&&d.includes("Z")){const g=h$(h);return{id:`log-${e.toString()}`,timestamp:Xx(d),level:t?Tc.ERROR:Tc.INFO,message:g.message,metadata:{at:(o=g.metadata)!=null&&o.at?Xx(g.metadata.at):Xx(d),type:((a=g.metadata)==null?void 0:a.type)??(u!=="unknown"?u:null)}}}}const s=/^\[(.*?)\]\s*\[(.*?)\]\s*(.*)$/.exec(n);if(s){const d=h$(s[3]);return{id:`log-${e.toString()}`,timestamp:Xx(s[1]),level:t?Tc.ERROR:s[2],message:d.message,metadata:(l=d.metadata)!=null&&l.at?{...d.metadata,at:Xx(d.metadata.at)}:d.metadata}}const r=h$(n);return{id:`log-${e.toString()}`,timestamp:"N/A",level:t?Tc.ERROR:Tc.INFO,message:r.message,metadata:(c=r.metadata)!=null&&c.at?{...r.metadata,at:Xx(r.metadata.at)}:r.metadata}},h$=n=>{try{const e=JSON.parse(n);if(typeof e=="object"){const t={},i={...e};"type"in i&&(t.type=i.type,delete i.type),"at"in i&&(t.at=i.at,delete i.at);const s=Object.keys(i);if(s.length===1){const r=s[0],o=i[r];return{message:typeof o=="string"?o:JSON.stringify(o),metadata:Object.keys(t).length>0?t:void 0}}return{message:JSON.stringify(i,null,2),metadata:Object.keys(t).length>0?t:void 0}}}catch{}return{message:n}},$Ie=n=>{var e;return(e=n.metadata)!=null&&e.type?n.metadata.type:n.level},kht=(n,e)=>{var r,o;let t="",i="";switch(n.type){case Kl.CONNECTOR:t=e??"",i="connector";break;case Kl.LOOKER_STUDIO:t="Looker Studio data fetching",i="report";break;case Kl.GOOGLE_SHEETS_EXPORT:case Kl.EMAIL:case Kl.SLACK:case Kl.MS_TEAMS:case Kl.GOOGLE_CHAT:t=((r=n.reportDefinition)==null?void 0:r.title)??"",i="report";break;case Kl.INSIGHT:t=((o=n.insightDefinition)==null?void 0:o.title)??"",i="insight";break}return[Sit(`${n.triggerType} ${i} run`.trim()),t]},Aht=n=>{const e=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=`datamart-run-${n.id.slice(0,8)}-logs.json`,i.click(),URL.revokeObjectURL(t)},Mht=n=>{const e=n.startedAt??n.createdAt;return zH(e.toISOString())},Oht=n=>{const e=d_e(n.startedAt),t=d_e(n.finishedAt);let i="";return n.startedAt&&n.finishedAt&&(i=wit(n.startedAt,n.finishedAt)),{startedAt:e,finishedAt:t,duration:i}},d_e=n=>n?zH(n.toISOString()):"N/A";function Pht({logViewType:n,setLogViewType:e,searchTerm:t,setSearchTerm:i,run:s,cancelDataMartRun:r,dataMartId:o}){const a=d=>{d.stopPropagation()},l=async d=>{if(d.stopPropagation(),o)try{await r(o,s.id),Sr.success("Data mart run cancelled successfully")}catch(u){Sr.error(u instanceof Error?u.message:"Failed to cancel data mart run")}},c=d=>`px-3 py-2 text-sm font-medium transition-colors rounded-none ${d?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-accent"}`;return f.jsxs("div",{className:"bg-background border-border flex items-center justify-between rounded-lg border p-3",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsxs("div",{className:"bg-background border-border flex items-center rounded-lg border",children:[f.jsx("button",{onClick:d=>{d.stopPropagation(),e(hf.STRUCTURED)},className:`${c(n===hf.STRUCTURED)} rounded-l-lg`,children:"Structured"}),f.jsx("button",{onClick:d=>{d.stopPropagation(),e(hf.RAW)},className:`${c(n===hf.RAW)} rounded-none`,children:"Raw"}),f.jsx("button",{onClick:d=>{d.stopPropagation(),e(hf.CONFIGURATION)},className:`${c(n===hf.CONFIGURATION)} rounded-r-lg`,children:"Configuration"})]}),n!==hf.CONFIGURATION&&f.jsxs("div",{className:"relative",children:[f.jsx(FS,{className:"text-muted-foreground absolute top-2.5 left-2 h-4 w-4"}),f.jsx(vn,{type:"text",placeholder:"Search logs...",value:t,onChange:d=>{i(d.target.value)},onClick:a,className:"border-input bg-background text-foreground placeholder:text-muted-foreground focus:ring-ring rounded-md border py-2 pr-4 pl-8 text-xs focus:border-transparent focus:ring-2 focus:outline-none"})]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[s.status===$r.RUNNING&&f.jsxs(rt,{variant:"destructive",size:"sm",onClick:d=>void l(d),children:[f.jsx(ID,{className:"h-4 w-4"}),"Cancel"]}),f.jsxs(rt,{variant:"outline",size:"sm",onClick:d=>{d.stopPropagation(),Aht(s)},className:"flex items-center gap-2",children:[f.jsx(eBe,{className:"h-4 w-4"}),"JSON"]})]})]})}function Fht(n){switch(n){case Tc.INFO:return f.jsx(sc,{className:"h-3 w-3 text-blue-500"});case Tc.WARNING:return f.jsx(oH,{className:"h-3 w-3 text-yellow-500"});case Tc.ERROR:return f.jsx(rF,{className:"h-3 w-3 text-red-500"});case Tc.SYSTEM:return f.jsx(fM,{className:"text-muted-foreground h-3 w-3"});default:return f.jsx(sc,{className:"text-muted-foreground h-3 w-3"})}}function jht(n){switch(n){case Tc.INFO:return"text-blue-600 dark:text-blue-400";case Tc.WARNING:return"text-yellow-600 dark:text-yellow-400";case Tc.ERROR:return"text-red-600 dark:text-red-400";case Tc.SYSTEM:return"text-muted-foreground";default:return"text-muted-foreground"}}function Hht(n){return n===bDe.SCHEDULED?f.jsx(THe,{size:18}):f.jsx(sxe,{size:18})}function Bht({logs:n}){const e=i=>{i.stopPropagation()},t=i=>{var s;return(s=i.metadata)!=null&&s.at?i.metadata.at:i.timestamp};return n.length===0?f.jsx("div",{className:"bg-background border-border rounded-lg border",children:f.jsx("div",{className:"text-muted-foreground p-8 text-center text-sm",children:"No logs found"})}):f.jsx("div",{className:"bg-background border-border rounded-lg border",children:f.jsx("div",{className:"max-h-96 overflow-y-auto",children:n.map((i,s)=>f.jsxs("div",{className:`border-border hover:bg-accent/30 flex items-start gap-3 border-b p-3 text-xs ${s===n.length-1?"border-b-0":""}`,onClick:e,children:[f.jsx("div",{className:"text-muted-foreground flex-shrink-0 font-mono text-xs",children:t(i)}),f.jsxs("div",{className:"flex min-w-0 flex-shrink-0 items-center gap-2",children:[Fht(i.level),f.jsx("span",{className:`text-xs font-medium ${jht(i.level)}`,children:$Ie(i)})]}),f.jsx("div",{className:`min-w-0 flex-1 text-xs break-words ${i.level===Tc.ERROR?"text-red-700 dark:text-red-300":"text-foreground"}`,children:i.message.includes(`
|
|
744
744
|
`)?f.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap",children:i.message}):f.jsx("span",{children:i.message})})]},i.id))})})}var zF=(n=>(n.ERROR="error",n.DEFAULT="default",n))(zF||{});function UF({text:n,section:e,variant:t="default",copiedSection:i,onCopy:s,iconOnly:r=!1}){const o=t==="error",a=i===e,l="flex items-center gap-1 px-2 py-1 text-xs rounded transition-colors cursor-pointer",c=o?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/40":"text-foreground hover:bg-muted";return f.jsx("button",{onClick:d=>{s(n,e),d.stopPropagation()},className:`${l} ${c}`,title:`Copy ${e} to clipboard`,children:r?f.jsx(f.Fragment,{children:a?f.jsx(Wc,{className:"h-3 w-3"}):f.jsx(t2,{className:"h-3 w-3"})}):a?f.jsxs(f.Fragment,{children:[f.jsx(Wc,{className:"h-3 w-3"}),"Copied"]}):f.jsxs(f.Fragment,{children:[f.jsx(t2,{className:"h-3 w-3"}),"Copy"]})})}function eoe(){const[n,e]=x.useState(null),t=async(s,r)=>{try{await navigator.clipboard.writeText(s),e(r),setTimeout(()=>{e(null)},2e3)}catch(o){console.error("Failed to copy text: ",o)}};return{copiedSection:n,copyToClipboard:t,handleCopy:(s,r)=>{t(s,r)}}}function Vht({logs:n,errors:e}){const{copiedSection:t,handleCopy:i}=eoe(),s=r=>{r.stopPropagation()};return f.jsxs("div",{className:"border-border space-y-4 rounded-lg border p-4",onClick:s,children:[e.length>0&&f.jsxs("div",{children:[f.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[f.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-red-600 dark:text-red-400",children:[f.jsx(fM,{className:"h-4 w-4 text-red-500"}),"Error Output:"]}),f.jsx(UF,{text:e.join(`
|
|
745
745
|
`),section:"errors",variant:zF.ERROR,copiedSection:t,onCopy:i})]}),f.jsx("div",{className:"max-h-96 overflow-y-auto rounded-md bg-red-50 p-3 font-mono text-xs dark:border-red-800 dark:bg-red-950/40",children:e.map((r,o)=>f.jsx("div",{className:"mb-1 leading-relaxed text-red-700 dark:text-red-300",children:r},o))})]}),n.length>0&&f.jsxs("div",{children:[f.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[f.jsxs("h4",{className:"text-foreground flex items-center gap-2 text-sm font-medium",children:[f.jsx(sc,{className:"h-4 w-4 text-blue-500"}),"Standard Output:"]}),f.jsx(UF,{text:n.join(`
|
|
746
|
-
`),section:"logs",variant:zF.DEFAULT,copiedSection:t,onCopy:i})]}),f.jsx("div",{className:"bg-muted max-h-96 overflow-y-auto rounded-md p-3 font-mono text-xs dark:bg-white/3",children:n.map((r,o)=>f.jsx("div",{className:"mb-1 leading-relaxed",children:r},o))})]})]})}function Wht({definitionRun:n,reportDefinition:e,insightDefinition:t}){const{copiedSection:i,handleCopy:s}=eoe(),r=o=>{o.stopPropagation()};return f.jsx("div",{className:"border-border rounded-lg border",onClick:r,children:n!=null?f.jsxs("div",{className:"p-4",children:[f.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[f.jsx("h4",{className:"text-foreground text-sm font-medium",children:"Configuration:"}),f.jsx(UF,{text:JSON.stringify(n,null,2),section:"configuration",variant:zF.DEFAULT,copiedSection:i,onCopy:s})]}),f.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded p-3 font-mono text-xs whitespace-pre-wrap dark:bg-white/3",children:JSON.stringify(n,null,2)}),e&&f.jsxs(f.Fragment,{children:[f.jsx("h4",{className:"text-foreground mt-3 mb-3 text-sm font-medium",children:"Report definition:"}),f.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded p-3 font-mono text-xs whitespace-pre-wrap dark:bg-white/3",children:JSON.stringify(e,null,2)})]}),t&&f.jsxs(f.Fragment,{children:[f.jsx("h4",{className:"text-foreground mt-3 mb-3 text-sm font-medium",children:"Insight definition:"}),f.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded p-3 font-mono text-xs whitespace-pre-wrap dark:bg-white/3",children:JSON.stringify(t,null,2)})]})]}):f.jsx("div",{className:"text-muted-foreground p-8 text-center",children:"No configuration data available for this run"})})}const mm=18;function zht({type:n,base64Icon:e}){switch(n){case Kl.CONNECTOR:return e?f.jsx(VS,{base64:e,size:mm}):f.jsx(j1,{size:mm});case Kl.GOOGLE_SHEETS_EXPORT:{const t=Nc.getInfo(St.GOOGLE_SHEETS).icon;return f.jsx(t,{size:mm})}case Kl.LOOKER_STUDIO:{const t=Nc.getInfo(St.LOOKER_STUDIO).icon;return f.jsx(t,{size:mm})}case Kl.EMAIL:{const t=Nc.getInfo(St.EMAIL).icon;return f.jsx(t,{size:mm})}case Kl.SLACK:{const t=Nc.getInfo(St.SLACK).icon;return f.jsx(t,{size:mm})}case Kl.MS_TEAMS:{const t=Nc.getInfo(St.MS_TEAMS).icon;return f.jsx(t,{size:mm})}case Kl.GOOGLE_CHAT:{const t=Nc.getInfo(St.GOOGLE_CHAT).icon;return f.jsx(t,{size:mm})}default:return f.jsx(j1,{size:mm})}}function Uht({run:n,isExpanded:e,onToggle:t,logViewType:i,setLogViewType:s,searchTerm:r,setSearchTerm:o,cancelDataMartRun:a,dataMartId:l,dataMartConnectorInfo:c}){const{copiedSection:d,handleCopy:u}=eoe(),h=x.useMemo(()=>{if(n.logs.length===0&&n.errors.length===0)return[];const y=n.logs.map((R,T)=>c_e(R,T)),L=n.errors.map((R,T)=>c_e(R,n.logs.length+T,!0));return[...y,...L].filter(R=>{const T=$Ie(R);return r===""||R.message.toLowerCase().includes(r.toLowerCase())||T.toLowerCase().includes(r.toLowerCase())})},[n.logs,n.errors,r]),g=x.useCallback(()=>i===hf.STRUCTURED?f.jsx(Bht,{logs:h}):i===hf.RAW?f.jsx(Vht,{logs:n.logs,errors:n.errors}):f.jsx(Wht,{definitionRun:n.definitionRun,reportDefinition:n.reportDefinition,insightDefinition:n.insightDefinition}),[i,h,n.logs,n.errors,n.definitionRun,n.reportDefinition,n.insightDefinition]),m=Mht(n),b=Oht(n),[v,C]=kht(n,c==null?void 0:c.displayName);return f.jsxs("div",{className:"dm-card-block",children:[f.jsxs("div",{className:"flex cursor-pointer items-center justify-between",onClick:()=>{t(n.id)},children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{children:f.jsx(zht,{type:n.type,base64Icon:c==null?void 0:c.logoBase64})}),f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("div",{className:"text-foreground align-center mr-12 flex items-center font-mono text-sm font-medium",children:m})}),f.jsx(kn,{children:f.jsxs("div",{className:"space-y-1",children:[f.jsxs("div",{children:["Started At: ",b.startedAt]}),f.jsxs("div",{children:["Finished At: ",b.finishedAt]}),b.duration&&f.jsxs("div",{children:["Duration: ",b.duration]})]})})]}),f.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[Hht(n.triggerType),f.jsxs("span",{className:"inline-flex items-center",children:[v,n.createdByUser&&f.jsxs(f.Fragment,{children:[" by ",f.jsx(mRe,{userProjection:n.createdByUser})]}),C&&f.jsxs(f.Fragment,{children:[" • ",C]})]})]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Iht,{status:n.status}),f.jsx($d,{className:`text-muted-foreground h-4 w-4 transition-transform ${e?"rotate-90":""}`})]})]}),e&&f.jsxs("div",{className:"border-border bg-muted/30 space-y-4 border-t p-4",children:[f.jsxs("div",{className:"flex items-center",children:[f.jsxs("h3",{className:"text-foreground mr-2 font-medium",children:["Run ID: ",n.id]}),f.jsx(UF,{text:n.id,section:"run-id",onCopy:u,copiedSection:d,iconOnly:!0})]}),f.jsx(Pht,{logViewType:i,setLogViewType:s,searchTerm:r,setSearchTerm:o,run:n,cancelDataMartRun:a,dataMartId:l}),g()]})]})}function $ht(){const{dataMart:e,getDataMartRuns:t,loadMoreDataMartRuns:i,cancelDataMartRun:s,runs:r=[],isLoading:o}=Zu(),[a,l]=x.useState(!1),[c,d]=x.useState(!0),[u,h]=x.useState(0),[g,m]=x.useState(null),[b,v]=x.useState(hf.STRUCTURED),[C,y]=x.useState(""),L=x.useCallback(async()=>{if(!(e!=null&&e.id))return;const N=await t(e.id,20,0);h(N.length),d(N.length===20)},[e==null?void 0:e.id,t,20]),E=x.useCallback(async()=>{if(!(e!=null&&e.id)||a)return;l(!0);const N=await i(e.id,u,20);h(I=>I+N.length),d(N.length===20),l(!1)},[e==null?void 0:e.id,i,u,a,20]);x.useEffect(()=>{e!=null&&e.id&&L()},[e==null?void 0:e.id,L]);const R=x.useMemo(()=>(e==null?void 0:e.definitionType)===Yt.CONNECTOR&&e.definition&&"connector"in e.definition?e.definition.connector.info??null:null,[e]),T=N=>{m(g===N?null:N)};return o?f.jsx(VIe,{}):f.jsx("div",{className:"flex flex-col gap-4 pb-4",children:r.length===0?f.jsx("div",{className:"text-muted-foreground py-8 text-center",children:"No runs found for this Data Mart"}):f.jsxs("div",{className:"space-y-2",children:[r.map(N=>f.jsx(Uht,{run:N,isExpanded:g===N.id,onToggle:T,logViewType:b,setLogViewType:v,searchTerm:C,setSearchTerm:y,cancelDataMartRun:s,dataMartId:e==null?void 0:e.id,dataMartConnectorInfo:R},N.id)),c&&f.jsx("div",{className:"flex justify-center pt-4",children:f.jsx(OE,{variant:"outline",size:"sm",onClick:()=>void E(),disabled:a,className:"flex items-center gap-2",children:a?f.jsxs(f.Fragment,{children:[f.jsx(qBe,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):"Load More"})})]})})}const Ght=5e3,qht=20;function Kht(){const{dataMart:n,getDataMartRuns:e}=og();return Qre({enabled:!!(n!=null&&n.id),intervalMs:Ght,onTick:()=>{n!=null&&n.id&&e(n.id,qht,0,{silent:!0})}}),f.jsx("div",{className:"flex flex-col gap-4",children:f.jsxs(c1,{collapsible:!1,name:"run-history",children:[f.jsx(fp,{children:f.jsx(hp,{icon:mBe,tooltip:"View all Data Mart execution runs with detailed logs and errors",children:"Run History"})}),f.jsx(gp,{children:f.jsx($ht,{})})]})})}function Zht(){const n=XTe(),{navigate:e}=hb(),t=i=>{const s=n?`/data-marts/${i.id}/data-setup?preset=${n.key}`:`/data-marts/${i.id}/data-setup`;e(s)};return f.jsx("div",{className:"flex h-full w-full items-center justify-center",children:f.jsx("div",{className:"m-auto w-lg",children:f.jsxs("div",{className:"bg-muted/50 dark:bg-sidebar rounded-xl border-b border-gray-200 p-12 pt-8 dark:border-gray-700/50",children:[f.jsx("h2",{className:"mb-4 text-xl font-medium",children:"Create Data Mart"}),f.jsx(sre,{children:f.jsx(LRe,{children:f.jsx(rst,{initialData:{title:(n==null?void 0:n.datamartTitle)??"New Data Mart"},onSuccess:t})})})]})})})}function GIe({isOpen:n,onClose:e,id:t}){const{getDataStorageById:i,currentDataStorage:s,loading:r,clearCurrentDataStorage:o}=ZH();x.useEffect(()=>(n&&t&&i(t),()=>{n||o()}),[n,t,i,o]);const a=()=>{o(),e()};return f.jsx(Vse,{open:n,onOpenChange:l=>{l||a()},children:f.jsxs(Wse,{children:[f.jsxs(zse,{children:[f.jsx(Use,{children:"Storage Details"}),f.jsx($se,{children:"View detailed information about this storage."})]}),f.jsx("div",{className:"py-4",children:f.jsx(EQe,{dataStorage:s,isLoading:r})})]})})}const Yht=({id:n,onViewDetails:e,onEdit:t,onDelete:i})=>{const[s,r]=x.useState(!1);return f.jsx("div",{className:"text-right",children:f.jsxs(Al,{open:s,onOpenChange:r,children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:`dm-card-table-body-row-actionbtn opacity-0 transition-opacity ${s?"opacity-100":"group-hover:opacity-100"}`,"aria-label":"Open menu",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsxs(Ol,{align:"end",children:[f.jsxs(wn,{onClick:()=>e==null?void 0:e(n),children:[f.jsx(QSe,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"View details"})]}),f.jsxs(wn,{onClick:()=>void(t==null?void 0:t(n)),children:[f.jsx(TR,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"Edit"})]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:()=>i==null?void 0:i(n),children:[f.jsx(Wh,{className:"h-4 w-4 text-red-600","aria-hidden":"true"}),f.jsx("span",{className:"text-red-600",children:"Delete"})]})]})]})})},Xht=({onViewDetails:n,onEdit:e,onDelete:t}={})=>[{accessorKey:"title",size:50,header:({column:i})=>f.jsx(La,{column:i,children:"Title"}),cell:({row:i})=>{const s=i.getValue("title");return f.jsx("div",{children:s})}},{accessorKey:"type",size:30,header:({column:i})=>f.jsx(La,{column:i,children:"Type"}),cell:({row:i})=>{const s=i.getValue("type"),{displayName:r,icon:o}=fC.getInfo(s);return f.jsxs("div",{className:"text-muted-foreground flex items-center gap-2",children:[f.jsx(o,{size:18}),r]})}},{accessorKey:"createdAt",size:20,sortDescFirst:!0,header:({column:i})=>f.jsx(La,{column:i,children:"Created at"}),cell:({row:i})=>{const s=i.getValue("createdAt"),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(s);return f.jsx("div",{className:"text-muted-foreground",children:r})}},{id:"actions",size:80,header:({table:i})=>f.jsx(BR,{table:i}),cell:({row:i})=>f.jsx(Yht,{id:i.original.id,onViewDetails:n,onEdit:e,onDelete:t})}];function Qht({onOpenTypeDialog:n}){return f.jsxs("div",{className:"dm-empty-state",children:[f.jsx(XHe,{className:"dm-empty-state-ico",strokeWidth:1}),f.jsx("h2",{className:"dm-empty-state-title",children:"Create your first Storage"}),f.jsx("p",{className:"dm-empty-state-subtitle",children:"A Storage combines your data warehouse and access credentials — both required to start building Data Marts."}),f.jsxs(rt,{variant:"outline",onClick:n,children:[f.jsx(Gd,{className:"h-4 w-4"}),"New Storage"]})]})}function Jht({columns:n,data:e,onEdit:t,onOpenTypeDialog:i}){var C;const{sorting:s,setSorting:r,columnVisibility:o,setColumnVisibility:a}=zS({columns:n,storageKeyPrefix:"data-storage-list"}),[l,c]=x.useState([]),[d,u]=x.useState({}),[h,g]=x.useState(!1),[m]=x.useState(null),b=pC({data:e,columns:[...n],getCoreRowModel:gC(),getPaginationRowModel:OM(),onSortingChange:r,getSortedRowModel:WS(),onColumnFiltersChange:c,getFilteredRowModel:HR(),onColumnVisibilityChange:a,onRowSelectionChange:u,state:{sorting:s,columnFilters:l,columnVisibility:o,rowSelection:d},enableRowSelection:!0}),v=(y,L)=>{L.target instanceof HTMLElement&&(L.target.closest('[role="checkbox"]')||L.target.closest(".actions-cell")||L.target.closest('[role="menuitem"]'))||t==null||t(y)};return e.length?f.jsxs("div",{children:[m&&f.jsx(GIe,{isOpen:h,onClose:()=>{g(!1)},id:m.id}),f.jsxs("div",{className:"dm-card",children:[f.jsxs("div",{className:"dm-card-toolbar",children:[f.jsx("div",{className:"dm-card-toolbar-left",children:f.jsxs("div",{className:"dm-card-toolbar-search",children:[f.jsx(FS,{className:"dm-card-toolbar-search-icon"}),f.jsx(vn,{placeholder:"Search by title",value:(C=b.getColumn("title"))==null?void 0:C.getFilterValue(),onChange:y=>{var L;return(L=b.getColumn("title"))==null?void 0:L.setFilterValue(y.target.value)},className:"dm-card-toolbar-search-input"})]})}),f.jsx("div",{className:"dm-card-toolbar-right",children:f.jsxs(rt,{variant:"outline",className:"dm-card-toolbar-btn-primary",onClick:()=>{i==null||i()},children:[f.jsx(Gd,{className:"h-4 w-4"}),"New Storage"]})})]}),f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{className:"dm-card-table",role:"table","aria-label":"Storages table",children:[f.jsx(_C,{className:"dm-card-table-header",children:b.getHeaderGroups().map(y=>f.jsx(qr,{className:"dm-card-table-header-row",children:y.headers.map(L=>f.jsx(vC,{className:"[&:has([role=checkbox])]:pl-6 [&>[role=checkbox]]:translate-y-[2px]",style:L.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(L.getSize())}%`},children:L.isPlaceholder?null:jD(L.column.columnDef.header,L.getContext())},L.id))},y.id))}),f.jsx(bC,{className:"dm-card-table-body",children:b.getRowModel().rows.length?b.getRowModel().rows.map(y=>f.jsx(qr,{"data-state":y.getIsSelected()&&"selected",className:"dm-card-table-body-row group",onClick:L=>{const E=y.original.id;v(E,L)},children:y.getVisibleCells().map(L=>f.jsx(Rl,{className:`[&:has([role=checkbox])]pr-0 px-6 whitespace-normal [&>[role=checkbox]]:translate-y-[2px] ${L.column.id==="actions"?"actions-cell":""} ${L.column.id==="createdAt"?"whitespace-nowrap":""}`,style:L.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(L.column.getSize())}%`},children:jD(L.column.columnDef.cell,L.getContext())},L.id))},y.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:n.length+1,className:"dm-card-table-body-row-empty",children:"No results"})})})]})}),f.jsxs("div",{className:"dm-card-pagination",children:[f.jsx(rt,{variant:"outline",size:"sm",onClick:()=>{b.previousPage()},disabled:!b.getCanPreviousPage(),children:"Previous"}),f.jsx(rt,{variant:"outline",size:"sm",onClick:()=>{b.nextPage()},disabled:!b.getCanNextPage(),children:"Next"})]})]})]}):f.jsx("div",{className:"dm-card",children:f.jsx(Qht,{onOpenTypeDialog:i})})}const eft=({initialTypeDialogOpen:n=!1,onTypeDialogClose:e})=>{const[t,i]=x.useState(n),{dataStorages:s,currentDataStorage:r,clearCurrentDataStorage:o,fetchDataStorages:a,getDataStorageById:l,deleteDataStorage:c,createDataStorage:d}=ZH();x.useEffect(()=>{a()},[a]),x.useEffect(()=>{i(n)},[n]);const u=()=>{i(!1),e==null||e()},[h,g]=x.useState(!1),[m,b]=x.useState(!1),[v,C]=x.useState(null),[y,L]=x.useState(!1),[E,R]=x.useState(null),T=async B=>{try{const K=await d(B);u(),K!=null&&K.id&&(await l(K.id),g(!0))}catch(K){console.error("Failed to create storage:",K)}},N=B=>{R(B),L(!0)},I=()=>{L(!1),R(null)},M=async B=>{await l(B),g(!0)},P=B=>{C(B),b(!0)},H=async()=>{if(v)try{await c(v),await a()}catch(B){console.error("Failed to delete storage:",B)}finally{b(!1),C(null)}},j=async()=>{try{g(!1),await a()}catch(B){console.error("Failed to save storage:",B)}},V=()=>{g(!1),o()},W=s.map(B=>({id:B.id,title:B.title,type:B.type,createdAt:B.createdAt,modifiedAt:B.modifiedAt})),U=Xht({onViewDetails:N,onEdit:M,onDelete:P});return f.jsxs("div",{children:[f.jsx(Jht,{columns:U,data:W,onEdit:M,onOpenTypeDialog:()=>{i(!0)}}),f.jsx(GIe,{isOpen:y,onClose:I,id:E??""}),f.jsx(yNe,{isOpen:t,onClose:u,onSelect:T}),f.jsx(ITe,{isOpen:h,onClose:V,dataStorage:r,onSaveSuccess:()=>void j()}),f.jsx(Ma,{open:m,onOpenChange:b,title:"Delete Storage",description:"Are you sure you want to delete this storage? This action cannot be undone.",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{H()},onCancel:()=>{C(null)},variant:"destructive"})]})},tft=()=>{const[n,e]=x.useState(!1);return f.jsxs("div",{className:"dm-page",children:[f.jsx("header",{className:"dm-page-header",children:f.jsx("h1",{className:"dm-page-header-title",children:"Storages"})}),f.jsx("div",{className:"dm-page-content",children:f.jsx(sre,{children:f.jsx(eft,{initialTypeDialogOpen:n,onTypeDialogClose:()=>{e(!1)}})})})]})};function ift({onOpenTypeDialog:n}){return f.jsxs("div",{className:"dm-empty-state",children:[f.jsx(Mne,{className:"dm-empty-state-ico",strokeWidth:1}),f.jsx("h2",{className:"dm-empty-state-title",children:"Create your first Destination"}),f.jsx("p",{className:"dm-empty-state-subtitle",children:"A Destination combines your reporting tool and access credentials — both needed to deliver data from Data Marts to your reports and dashboards."}),f.jsxs(rt,{variant:"outline",onClick:n,children:[f.jsx(Gd,{className:"h-4 w-4"}),"New Destination"]})]})}function nft({columns:n,data:e,onEdit:t,onOpenTypeDialog:i}){var m;const{sorting:s,setSorting:r,columnVisibility:o,setColumnVisibility:a}=zS({columns:n,storageKeyPrefix:"data-destination-list"}),[l,c]=x.useState([]),[d,u]=x.useState({}),h=pC({data:e,columns:[...n],getCoreRowModel:gC(),getPaginationRowModel:OM(),onSortingChange:r,getSortedRowModel:WS(),onColumnFiltersChange:c,getFilteredRowModel:HR(),onColumnVisibilityChange:a,onRowSelectionChange:u,state:{sorting:s,columnFilters:l,columnVisibility:o,rowSelection:d},enableRowSelection:!0}),g=(b,v)=>{v.target instanceof HTMLElement&&(v.target.closest('[role="checkbox"]')||v.target.closest(".actions-cell")||v.target.closest('[role="menuitem"]'))||t==null||t(b)};return e.length?f.jsx("div",{children:f.jsxs("div",{className:"dm-card",children:[f.jsxs("div",{className:"dm-card-toolbar",children:[f.jsx("div",{className:"dm-card-toolbar-left",children:f.jsxs("div",{className:"dm-card-toolbar-search",children:[f.jsx(FS,{className:"dm-card-toolbar-search-icon"}),f.jsx(vn,{placeholder:"Search by title",value:(m=h.getColumn("title"))==null?void 0:m.getFilterValue(),onChange:b=>{var v;return(v=h.getColumn("title"))==null?void 0:v.setFilterValue(b.target.value)},className:"dm-card-toolbar-search-input"})]})}),f.jsx("div",{className:"dm-card-toolbar-right",children:f.jsxs(rt,{variant:"outline",className:"dm-card-toolbar-btn-primary",onClick:()=>{i==null||i()},children:[f.jsx(Gd,{className:"h-4 w-4"}),"New Destination"]})})]}),f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{className:"dm-card-table",role:"table","aria-label":"Destinations table",children:[f.jsx(_C,{className:"dm-card-table-header",children:h.getHeaderGroups().map(b=>f.jsx(qr,{className:"dm-card-table-header-row",children:b.headers.map(v=>f.jsx(vC,{className:"[&:has([role=checkbox])]:pl-6 [&>[role=checkbox]]:translate-y-[2px]",style:v.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(v.getSize())}%`},children:v.isPlaceholder?null:jD(v.column.columnDef.header,v.getContext())},v.id))},b.id))}),f.jsx(bC,{className:"dm-card-table-body",children:h.getRowModel().rows.length?h.getRowModel().rows.map(b=>f.jsx(qr,{"data-state":b.getIsSelected()&&"selected",className:"dm-card-table-body-row group",onClick:v=>{const C=b.original.id;g(C,v)},children:b.getVisibleCells().map(v=>f.jsx(Rl,{className:`[&:has([role=checkbox])]pr-0 px-6 whitespace-normal [&>[role=checkbox]]:translate-y-[2px] ${v.column.id==="actions"?"actions-cell":""} ${v.column.id==="createdAt"?"whitespace-nowrap":""}`,style:v.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(v.column.getSize())}%`},children:jD(v.column.columnDef.cell,v.getContext())},v.id))},b.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:n.length+1,className:"dm-card-table-body-row-empty",children:"No results"})})})]})}),f.jsxs("div",{className:"dm-card-pagination",children:[f.jsx(rt,{variant:"outline",size:"sm",onClick:()=>{h.previousPage()},disabled:!h.getCanPreviousPage(),children:"Previous"}),f.jsx(rt,{variant:"outline",size:"sm",onClick:()=>{h.nextPage()},disabled:!h.getCanNextPage(),children:"Next"})]})]})}):f.jsx("div",{className:"dm-card",children:f.jsx(ift,{onOpenTypeDialog:i})})}function toe(n){return"destinationSecretKey"in n}const sft=({id:n,type:e,credentials:t,onEdit:i,onDelete:s,onRotateSecretKey:r})=>{const[o,a]=x.useState(!1),l=()=>{if(t&&toe(t)){const u=Rse(t);navigator.clipboard.writeText(u),Rn.success("JSON Config copied to clipboard")}},c=e===St.LOOKER_STUDIO,d=t&&"destinationSecretKey"in t&&t.destinationSecretKey;return f.jsx(f.Fragment,{children:f.jsx("div",{className:"text-right",children:f.jsxs(Al,{open:o,onOpenChange:a,children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:`dm-card-table-body-row-actionbtn opacity-0 transition-opacity ${o?"opacity-100":"group-hover:opacity-100"}`,"aria-label":"Open menu",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsxs(Ol,{align:"end",children:[f.jsxs(wn,{onClick:()=>void(i==null?void 0:i(n)),children:[f.jsx(TR,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"Edit"})]}),c&&d&&f.jsxs(f.Fragment,{children:[f.jsx(Vd,{}),f.jsxs(wn,{onClick:l,children:[f.jsx(t2,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"Copy JSON Config"})]}),f.jsxs(wn,{onClick:()=>{r==null||r(n)},children:[f.jsx(nK,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"Rotate Secret Key"})]})]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:()=>s==null?void 0:s(n),children:[f.jsx(Wh,{className:"h-4 w-4 text-red-600","aria-hidden":"true"}),f.jsx("span",{className:"text-red-600",children:"Delete"})]})]})]})})})},rft=({onEdit:n,onDelete:e,onRotateSecretKey:t}={})=>[{accessorKey:"title",size:50,header:({column:i})=>f.jsx(La,{column:i,children:"Title"}),cell:({row:i})=>{const s=i.getValue("title");return f.jsx("div",{className:"overflow-hidden text-ellipsis",children:s})}},{accessorKey:"type",size:30,header:({column:i})=>f.jsx(La,{column:i,children:"Type"}),cell:({row:i})=>{const s=i.getValue("type"),{displayName:r,icon:o}=Nc.getInfo(s);return f.jsxs("div",{className:"text-muted-foreground flex items-center gap-2",children:[f.jsx(o,{size:18}),r]})}},{accessorKey:"createdAt",size:20,sortDescFirst:!0,header:({column:i})=>f.jsx(La,{column:i,children:"Created at"}),cell:({row:i})=>{const s=i.getValue("createdAt"),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(s);return f.jsx("div",{className:"text-muted-foreground",children:r})}},{id:"actions",size:80,header:({table:i})=>f.jsx(BR,{table:i}),cell:({row:i})=>f.jsx(sft,{id:i.original.id,type:i.original.type,credentials:i.original.credentials,onEdit:n,onDelete:e,onRotateSecretKey:t})}];function oft(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"service-account-details",children:[f.jsx(is,{children:"How do I get a Service Account JSON key?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"To get the JSON key, you'll need to create or use an existing service account in Google Cloud."}),f.jsx("p",{className:"mb-2",children:"Here's what to do:"}),f.jsxs("ol",{className:"list-inside list-decimal space-y-2 text-sm",children:[f.jsxs("li",{children:["Go to"," ",f.jsx(ir,{href:"https://console.cloud.google.com/iam-admin/serviceaccounts",children:"Google Cloud Console"})," ","."]}),f.jsxs("li",{children:["Open ",f.jsx("strong",{children:"IAM & Admin → Service Accounts"}),"."]}),f.jsx("li",{children:"Create a new service account or select an existing one."}),f.jsxs("li",{children:["Open the Service Accounts page, go to the ",f.jsx("strong",{children:"Keys"})," tab, click"," ",f.jsx("strong",{children:"Add key"}),", and select ",f.jsx("strong",{children:"Create new key"}),"."]}),f.jsxs("li",{children:["Choose ",f.jsx("strong",{children:"JSON"})," format and click ",f.jsx("strong",{children:"Create"}),"."]}),f.jsx("li",{children:"Open the downloaded file, copy its entire content, and paste it into the field above."})]})]})]})})}function aft({form:n}){const[e,t]=x.useState(!1),i=()=>{t(!0),n.setValue("credentials.serviceAccount","",{shouldDirty:!0})},s=()=>{t(!1),n.resetField("credentials.serviceAccount")},r=n.watch("credentials.serviceAccount"),o=r?xRe(r):null;return f.jsx(fn,{control:n.control,name:"credentials.serviceAccount",render:({field:a})=>f.jsxs(tn,{children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(Ji,{tooltip:"Paste a JSON key from a service account that has access to the selected destination provider",children:"Service Account"}),!e&&r&&f.jsx(rt,{variant:"ghost",size:"sm",onClick:i,type:"button",children:"Edit"}),e&&f.jsx(rt,{variant:"ghost",size:"sm",onClick:s,type:"button",children:"Cancel"})]}),f.jsx(cn,{children:!e&&o?f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx(ir,{href:o.url,children:o.email})}),f.jsx(kn,{children:f.jsx("p",{children:"View in Google Cloud Console"})})]}):f.jsx(Hp,{...a,className:"min-h-[150px] font-mono",rows:8,placeholder:"Paste your service account JSON here"})}),f.jsx(Hs,{children:f.jsx(oft,{})}),f.jsx(Cn,{})]})})}function lft(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"json-config-details",children:[f.jsx(is,{children:"What is the JSON Config for Looker Studio?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"The JSON Config contains the necessary credentials and configuration for connecting to Looker Studio."}),f.jsxs("ul",{className:"list-inside space-y-2 text-sm",children:[f.jsx("li",{children:"You need to copy this JSON config to use it in the Looker Studio Connector."}),f.jsx("li",{children:"If you need to rotate a previous secret key, you can use the corresponding function in the menu on the destinations list."})]})]})]})})}function cft({form:n}){const e=n.getValues("credentials"),t=x.useMemo(()=>e&&toe(e)?e:{deploymentUrl:"",destinationId:"",destinationSecretKey:""},[e]),i=x.useMemo(()=>Rse(t),[t]);return f.jsx(f.Fragment,{children:t.destinationSecretKey&&f.jsx(fn,{control:n.control,name:"credentials.destinationSecretKey",render:()=>f.jsxs(tn,{children:[f.jsx(Ji,{children:"JSON Config"}),f.jsx(cn,{children:f.jsx(eDe,{value:i,displayOnly:!0,keysToMask:["destinationSecretKey"],className:"bg-muted overflow-auto rounded-md text-sm",showCopyButton:!0})}),f.jsx(Cn,{}),f.jsx(Hs,{children:f.jsx(lft,{})})]})})})}const qIe="credentials.to",dft=/[,;\n]/,uft=", ",KIe="Enter emails separated by comma, semicolon or newline",hft="Emails list";function u_e(n){const e=new Set,t=[];for(const i of n.split(dft)){const s=i.trim();if(!s)continue;const r=s.toLowerCase();e.has(r)||(e.add(r),t.push(s))}return t}function f$(n){return n.join(uft)}function h_e(n,e){n.setValue(qIe,e,{shouldDirty:!0,shouldTouch:!0})}function fft({field:n,form:e}){const t=Array.isArray(n.value)?f$(n.value):"",[i,s]=x.useState(t),[r,o]=x.useState(!1),a=Array.isArray(n.value)?f$(n.value):"";x.useEffect(()=>{r||s(a)},[a,r]);const l=u=>{const h=u.target.value;s(h),h_e(e,u_e(h))},c=()=>{o(!0)},d=u=>{o(!1),n.onBlur();const h=u_e(u.target.value);h_e(e,h),s(f$(h))};return f.jsx(Hp,{name:n.name,ref:n.ref,onFocus:c,onBlur:d,value:i,onChange:l,className:"min-h-[150px] font-mono",rows:8,placeholder:KIe})}function C4({form:n,emailsFieldTitle:e=hft}){return f.jsx(fn,{control:n.control,name:qIe,render:({field:t})=>f.jsxs(tn,{children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsx(Ji,{tooltip:KIe,children:e})}),f.jsx(cn,{children:f.jsx(fft,{field:t,form:n})}),f.jsx(Cn,{})]})})}function gft(){return f.jsxs(ts,{value:"sheets-api-details",children:[f.jsx(is,{children:"How do I enable the Google Sheets API?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send data to Google Sheets, you need to enable the"," ",f.jsx(ir,{href:"https://console.cloud.google.com/apis/library/sheets.googleapis.com",children:"Google Sheets API"})," ","in your Google Cloud project."]}),f.jsx("p",{className:"mb-2",children:"Here's how to do it:"}),f.jsxs("ol",{className:"list-inside list-decimal space-y-2 text-sm",children:[f.jsx("li",{children:"Open the link above and make sure the correct project is selected."}),f.jsxs("li",{children:["If the API isn't enabled yet, click ",f.jsx("strong",{children:"Enable"}),"."]}),f.jsx("li",{children:"If it's already enabled, you'll see the API dashboard — that's fine."})]})]})]})}function pft(){return f.jsxs(ts,{value:"looker-studio-details",children:[f.jsx(is,{children:"How do I connect to Looker Studio?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send data to Looker Studio, you need to provide a deployment URL that the"," ",f.jsx(ir,{className:"p-0",href:"https://datastudio.google.com/datasources/create?connectorId=AKfycbz6kcYn3qGuG0jVNFjcDnkXvVDiz4hewKdAFjOm-_d4VkKVcBidPjqZO991AvGL3FtM4A",children:"Looker Studio connector"})," ","will use to access your data."]}),f.jsx("p",{className:"mb-2",children:"Make sure the deployment URL is accessible from the internet and properly secured."}),f.jsx(ir,{className:"p-0",href:"https://docs.owox.com/docs/destinations/supported-destinations/looker-studio/?utm_source=owox_data_marts&utm_medium=destination_enity&utm_campaign=tooltip",children:"Learn more"})]})]})}function mft(){return f.jsxs(ts,{value:"odata-details",children:[f.jsx(is,{children:"How do I use OData?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"OData (Open Data Protocol) is an ISO/IEC approved, OASIS standard that defines a set of best practices for building and consuming RESTful APIs."}),f.jsx("p",{className:"mb-2",children:"This feature is coming soon."})]})]})}function _ft(){return f.jsxs(ts,{value:"email-details",children:[f.jsx(is,{children:"How do I start sending Email?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send reports by email, first configure the ",f.jsx("strong",{children:"Email"})," destination in this form. Then, go to your Data Mart page, open the ",f.jsx("strong",{children:"Destinations"})," tab, and create a report in the Email block."]}),f.jsx("p",{className:"mb-2",children:"In the report settings, specify recipient addresses, add a message, and define delivery conditions. The generated report will be delivered by OWOX Data Marts to the selected addresses as formatted text."}),f.jsx("p",{className:"mb-2 text-sm",children:"Make sure recipients have permission to view the report data."}),f.jsxs("p",{className:"mb-2",children:["For more details, read the"," ",f.jsx(ir,{className:"underline",href:"https://docs.owox.com/docs/destinations/manage-destinations/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=tooltip-email",children:"OWOX documentation"}),"."]})]})]})}function bft(){return f.jsxs(ts,{value:"slack-details",children:[f.jsx(is,{children:"How do I start sending to Slack?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send reports to Slack, first configure the ",f.jsx("strong",{children:"Slack"})," destination in this form. Then, go to your Data Mart page, open the ",f.jsx("strong",{children:"Destinations"})," tab, and create a report in the Slack block."]}),f.jsx("p",{className:"mb-2",children:"In the report settings, choose the workspace, channel, message text, and define delivery conditions. The generated report will be delivered by OWOX Data Marts to the selected channel as a message."}),f.jsx("p",{className:"mb-2 text-sm",children:"Make sure OWOX has permission to post messages in the chosen channel."}),f.jsxs("p",{className:"mb-2",children:["For more details, read the"," ",f.jsx(ir,{className:"underline",href:"https://docs.owox.com/docs/destinations/manage-destinations/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=tooltip-slack",children:"OWOX documentation"}),"."]})]})]})}function vft(){return f.jsxs(ts,{value:"msteams-details",children:[f.jsx(is,{children:"How do I start sending to Microsoft Teams?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send reports to Microsoft Teams, first configure the ",f.jsx("strong",{children:"Microsoft Teams"})," ","destination in this form. Then, go to your Data Mart page, open the"," ",f.jsx("strong",{children:"Destinations"})," tab, and create a report in the Microsoft Teams block."]}),f.jsx("p",{className:"mb-2",children:"In the report settings, select the channel, add a message, and define delivery conditions. The generated report will be delivered by OWOX Data Marts to the selected channel as a message."}),f.jsx("p",{className:"mb-2 text-sm",children:"Make sure OWOX has permission to post messages in your Teams workspace."}),f.jsxs("p",{className:"mb-2",children:["For more details, read the"," ",f.jsx(ir,{className:"underline",href:"https://docs.owox.com/docs/destinations/manage-destinations/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=tooltip-microsoft-teams",children:"OWOX documentation"}),"."]})]})]})}function Cft(){return f.jsxs(ts,{value:"googlechat-details",children:[f.jsx(is,{children:"How do I start sending to Google Chat?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send reports to Google Chat, first configure the ",f.jsx("strong",{children:"Google Chat"})," ","destination in this form. Then, go to your Data Mart page, open the"," ",f.jsx("strong",{children:"Destinations"})," tab, and create a report in the Google Chat block."]}),f.jsx("p",{className:"mb-2",children:"In the report settings, select the channel, add a message, and define delivery conditions. The generated report will be delivered by OWOX Data Marts to the connected space as chat messages."}),f.jsxs("p",{className:"mb-2",children:["For more details, read the"," ",f.jsx(ir,{className:"underline",href:"https://docs.owox.com/docs/destinations/manage-destinations/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=tooltip-google-chat",children:"OWOX documentation"}),"."]})]})]})}const wft={[St.GOOGLE_SHEETS]:gft,[St.LOOKER_STUDIO]:pft,[St.ODATA]:mft,[St.EMAIL]:_ft,[St.SLACK]:bft,[St.MS_TEAMS]:vft,[St.GOOGLE_CHAT]:Cft};function yft({destinationType:n}){const e=wft[n];return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsx(e,{})})}function Sft({form:n,initialData:e}){const{flags:t}=EM();return f.jsx(fn,{control:n.control,name:"type",render:({field:i})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Select the destination to send your data",children:"Destination Type"}),f.jsxs($c,{onValueChange:i.onChange,defaultValue:i.value,disabled:!!e,children:[f.jsx(cn,{children:f.jsx(qc,{className:"w-full",children:f.jsx(Gc,{placeholder:"Select a destination type"})})}),f.jsx(Kc,{children:f.jsx(KH,{children:Nc.getAllTypes().map(({type:s,displayName:r,icon:o,status:a})=>{const l=a===uf.COMING_SOON,c=a===uf.CLOUD_ONLY&&xit(t);return f.jsx(f.Fragment,{children:c?f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("div",{children:f.jsx(fo,{value:s,disabled:!0,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(o,{size:18}),r,f.jsx(Ya,{variant:"secondary",children:"Cloud & Enterprise"})]})},s)})}),f.jsxs(kn,{side:"left",align:"start",className:"w-[220px]",children:["Available only in"," ",f.jsxs(Vc,{className:"inline-flex items-center gap-1 underline",target:"_blank",to:"https://docs.owox.com/docs/editions/owox-cloud-editions/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=unavailable_select_item_tooltip",children:["Cloud edition",f.jsx(F_,{className:"h-3 w-3"})]})," ","or with"," ",f.jsxs(Vc,{className:"inline-flex items-center gap-1 underline",target:"_blank",to:"https://docs.owox.com/docs/editions/self-managed-editions/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=unavailable_select_item_tooltip",children:["an Enterprise plan",f.jsx(F_,{className:"h-3 w-3"})]}),"."]})]}):f.jsx(fo,{value:s,disabled:l,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(o,{size:18}),r,l&&f.jsx(Ya,{variant:"outline",children:a})]})},s)})})})})]}),f.jsx(Hs,{children:f.jsx(yft,{destinationType:i.value})}),f.jsx(Cn,{})]})})}function xft({initialData:n,onSubmit:e,onCancel:t,onDirtyChange:i}){const s=Bp({resolver:pb(yJe),defaultValues:n??{title:"New Destination",type:St.GOOGLE_SHEETS},mode:"onTouched"}),r=s.watch("type");x.useEffect(()=>{i==null||i(s.formState.isDirty)},[s.formState.isDirty,i]);const o=async a=>{const{dirtyFields:l}=s.formState,c=SRe(a);return l.credentials||delete c.credentials,e(c)};return f.jsx(CC,{...s,children:f.jsxs(gb,{onSubmit:a=>{s.handleSubmit(o)(a)},children:[f.jsxs(wC,{children:[f.jsx(fn,{control:s.control,name:"title",render:({field:a})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Name the destination to clarify its purpose",children:"Title"}),f.jsx(cn,{children:f.jsx(vn,{placeholder:"Enter title",...a})}),f.jsx(Cn,{})]})}),f.jsx(Sft,{form:s,initialData:n}),r===St.GOOGLE_SHEETS&&f.jsx(aft,{form:s}),r===St.LOOKER_STUDIO&&f.jsx(cft,{form:s}),r===St.EMAIL&&f.jsx(C4,{form:s,emailsFieldTitle:"Enter user emails list"}),r===St.SLACK&&f.jsx(C4,{form:s,emailsFieldTitle:"Enter Slack channel emails list"}),r===St.MS_TEAMS&&f.jsx(C4,{form:s,emailsFieldTitle:"Enter Microsoft Teams channel emails list"}),r===St.GOOGLE_CHAT&&f.jsx(C4,{form:s,emailsFieldTitle:"Enter Google Chat channel emails list"})]}),f.jsxs(yC,{children:[f.jsxs(rt,{variant:"default",type:"submit",className:"w-full","aria-label":"Save",disabled:!s.formState.isDirty||s.formState.isSubmitting,children:[s.formState.isSubmitting&&f.jsx(NR,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]}),f.jsx(rt,{variant:"outline",type:"button",onClick:t,className:"w-full","aria-label":"Cancel",children:"Cancel"})]})]})})}function Lft({isOpen:n,onClose:e,dataDestination:t,onSaveSuccess:i}){const{updateDataDestination:s,createDataDestination:r}=MM(),[o,a]=x.useState(!1),[l,c]=x.useState(!1),d=x.useCallback(()=>{l?a(!0):e()},[l,e]),u=x.useCallback(()=>{a(!1),c(!1),e()},[e]),h=x.useCallback(b=>{c(b)},[]),g=async b=>{const v=FDe.getMapper(b.type);if(t){const C=v.mapToUpdateRequest(b),y=await s(t.id,C);y&&i(y)}else{const C=v.mapToCreateRequest(b),y=await r(C);y&&i(y)}e()},m=x.useRef(!1);return x.useEffect(()=>{const b=t?"Edit":"Create";n&&!m.current?(Vt({event:"data_destination_config_open",category:"DataDestination",action:b,label:t==null?void 0:t.type}),m.current=!0):!n&&m.current&&(Vt({event:"data_destination_config_close",category:"DataDestination",action:b,label:t==null?void 0:t.type}),m.current=!1)},[n,t]),f.jsxs(f.Fragment,{children:[f.jsx(ab,{open:n,onOpenChange:b=>{b||d()},children:f.jsxs(lb,{children:[f.jsxs(cb,{children:[f.jsx(db,{children:"Configure destination"}),f.jsx(cC,{children:"Customize settings for your destination"})]}),f.jsx(xft,{initialData:t??void 0,onSubmit:g,onCancel:d,onDirtyChange:h})]})}),f.jsx(Ma,{open:o,onOpenChange:a,title:"Unsaved Changes",description:"You have unsaved changes. Exit without saving?",confirmLabel:"Yes, leave now",cancelLabel:"No, stay here",onConfirm:u,variant:"destructive"})]})}const Eft=({isCreateSheetInitiallyOpen:n=!1,onCreateSheetClose:e})=>{const{dataDestinations:t,currentDataDestination:i,clearCurrentDataDestination:s,fetchDataDestinations:r,getDataDestinationById:o,deleteDataDestination:a,rotateSecretKey:l}=MM(),c=x.useCallback(()=>{s(),u(!0),e==null||e()},[s,e]),[d,u]=x.useState(!1),[h,g]=x.useState(!1),[m,b]=x.useState(!1),[v,C]=x.useState(null),[y,L]=x.useState(null);x.useEffect(()=>{r()},[r]),x.useEffect(()=>{n&&c()},[n,c]);const E=async V=>{await o(V),u(!0)},R=V=>{C(V),g(!0)},T=V=>{L(V),b(!0)},N=async()=>{if(y)try{const V=await l(y);if(toe(V.credentials)){Rn.success("New JSON Config copied to clipboard");const W=Rse(V.credentials);navigator.clipboard.writeText(W)}await r()}catch(V){console.error("Failed to rotate secret key:",V)}finally{b(!1),L(null)}},I=async()=>{if(v)try{await a(v),await r()}catch(V){console.error("Failed to delete destination:",V)}finally{g(!1),C(null)}},M=async()=>{try{u(!1),await r()}catch(V){console.error("Failed to save destination:",V)}},P=()=>{u(!1),s()},H=t.map(V=>({id:V.id,title:V.title,type:V.type,createdAt:V.createdAt,modifiedAt:V.modifiedAt,credentials:V.credentials})),j=rft({onEdit:E,onDelete:R,onRotateSecretKey:T});return f.jsxs("div",{children:[f.jsx(nft,{columns:j,data:H,onEdit:E,onDelete:R,onRotateSecretKey:T,onOpenTypeDialog:c}),f.jsx(Lft,{isOpen:d,onClose:P,dataDestination:i,onSaveSuccess:()=>void M()}),f.jsx(Ma,{open:h,onOpenChange:g,title:"Delete Destination",description:"Are you sure you want to delete this destination? This action cannot be undone.",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{I()},onCancel:()=>{C(null)},variant:"destructive"}),f.jsx(Ma,{open:m,onOpenChange:b,title:"Rotate Secret Key",description:"Rotating the secret key will invalidate the previous key",confirmLabel:"Rotate Key",cancelLabel:"Cancel",onConfirm:()=>void N(),onCancel:()=>{b(!1)},variant:"destructive",children:f.jsxs("div",{className:"text-sm",children:[f.jsx("p",{className:"mb-2",children:"After rotation, you will need to:"}),f.jsxs("ol",{className:"mb-2 list-decimal pl-5",children:[f.jsx("li",{children:"The new JSON Config will be automatically copied to your clipboard"}),f.jsx("li",{children:"Go to your Looker Studio Connector"}),f.jsx("li",{children:"Update the configuration with the new JSON Config"}),f.jsx("li",{children:"Save the changes to restore access to your data marts"})]}),f.jsx("p",{className:"font-semibold",children:"Are you sure you want to rotate the secret key?"})]})})]})},Dft=()=>{const[n,e]=x.useState(!1);return f.jsxs("div",{className:"dm-page",children:[f.jsx("header",{className:"dm-page-header",children:f.jsx("h1",{className:"dm-page-header-title",children:"Destinations"})}),f.jsx("div",{className:"dm-page-content",children:f.jsx(AM,{children:f.jsx(Eft,{isCreateSheetInitiallyOpen:n,onCreateSheetClose:()=>{e(!1)}})})})]})};function l5({className:n,...e}){return f.jsx("div",{"data-slot":"empty",className:Le("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",n),...e})}function c5({className:n,...e}){return f.jsx("div",{"data-slot":"empty-header",className:Le("flex max-w-sm flex-col items-center gap-2 text-center",n),...e})}const Rft=RR("flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function d5({className:n,variant:e="default",...t}){return f.jsx("div",{"data-slot":"empty-icon","data-variant":e,className:Le(Rft({variant:e,className:n})),...t})}function u5({className:n,...e}){return f.jsx("div",{"data-slot":"empty-title",className:Le("text-lg font-medium tracking-tight",n),...e})}function h5({className:n,...e}){return f.jsx("div",{"data-slot":"empty-description",className:Le("text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",n),...e})}function Nft({className:n,...e}){return f.jsx("div",{"data-slot":"empty-content",className:Le("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",n),...e})}const Tft=()=>{const n=PS(),{createInsight:e,insightLoading:t}=Jre(),i=()=>{(async()=>{const s=await e({title:"Untitled insight"});s&&n(s.id)})()};return f.jsxs(l5,{children:[f.jsxs(c5,{children:[f.jsx(d5,{variant:"icon",children:f.jsx(nxe,{})}),f.jsx(u5,{children:"No Insights Yet"}),f.jsx(h5,{children:"You haven't created any insights yet. Get started by creating your first insight."})]}),f.jsx(Nft,{children:f.jsx("div",{className:"flex gap-2",children:f.jsx(rt,{onClick:i,disabled:t,children:"Create Insight"})})}),f.jsx(rt,{variant:"link",asChild:!0,className:"text-muted-foreground",size:"sm",children:f.jsxs("a",{href:"#",children:["Learn More ",f.jsx(_He,{})]})})]})},Ift=({onDelete:n}={})=>[{accessorKey:"title",size:50,header:({column:e})=>f.jsx(La,{column:e,children:"Title"}),cell:({row:e})=>{const t=e.getValue("title");return f.jsx("div",{className:"overflow-hidden text-ellipsis",children:t})},meta:{title:"Title"}},{accessorKey:"lastUpdated",size:50,sortDescFirst:!0,header:({column:e})=>f.jsx(La,{column:e,children:"Last updated"}),cell:({row:e})=>{const t=e.getValue("lastUpdated"),i=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t);return f.jsx("div",{className:"text-muted-foreground",children:i})},meta:{title:"Last updated"}},{id:"actions",size:80,header:({table:e})=>f.jsx(BR,{table:e}),cell:({row:e})=>f.jsx("div",{className:"actions-cell text-right",onClick:t=>{t.stopPropagation()},children:f.jsxs(Al,{children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:"dm-card-table-body-row-actionbtn opacity-0 transition-opacity group-hover:opacity-100","aria-label":"Open menu",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsx(Ol,{align:"end",children:f.jsxs(wn,{className:"text-destructive",onClick:()=>n==null?void 0:n(e.original.id),children:[f.jsx(Wh,{className:"mr-2 h-4 w-4 text-red-600"}),f.jsx("span",{className:"text-red-600",children:"Delete insight"})]})})]})}),meta:{title:"Actions"}}];function kft({items:n,onRowClick:e,onDelete:t}){const i=x.useMemo(()=>Ift({onDelete:t}),[t]),{sorting:s,setSorting:r,columnVisibility:o,setColumnVisibility:a}=zS({columns:i,storageKeyPrefix:"data-mart-insights",defaultSortingColumn:"lastUpdated"}),l=pC({data:n,columns:i,getCoreRowModel:gC(),getPaginationRowModel:OM(),onSortingChange:r,getSortedRowModel:WS(),getFilteredRowModel:HR(),state:{sorting:s,columnVisibility:o},onColumnVisibilityChange:a,enableGlobalFilter:!0,enableColumnResizing:!1}),c=x.useCallback(()=>{l.previousPage()},[l]),d=x.useCallback(()=>{l.nextPage()},[l]);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{id:"insights-table",className:"dm-card-table",role:"table","aria-label":"Insights",children:[f.jsx(_C,{className:"dm-card-table-header",children:l.getHeaderGroups().map(h=>f.jsx(qr,{className:"dm-card-table-header-row",children:h.headers.map(g=>f.jsx(vC,{className:"[&:has([role=checkbox])]:pl-6 [&>[role=checkbox]]:translate-y-[2px]",scope:"col",style:g.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(g.getSize())}%`},children:g.isPlaceholder?null:typeof g.column.columnDef.header=="function"?g.column.columnDef.header(g.getContext()):g.column.columnDef.header},g.id))},h.id))}),f.jsx(bC,{className:"dm-card-table-body",children:l.getRowModel().rows.length?l.getRowModel().rows.map((h,g)=>f.jsx(qr,{onClick:()=>{e(h.original.id)},className:"dm-card-table-body-row group cursor-pointer",role:"row","aria-rowindex":g+1,children:h.getVisibleCells().map((m,b)=>f.jsx(Rl,{className:`whitespace-normal ${m.column.id==="actions"?"actions-cell":""}`,role:"cell","aria-colindex":b+1,style:m.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(m.column.getSize())}%`},children:typeof m.column.columnDef.cell=="function"?m.column.columnDef.cell(m.getContext()):m.column.columnDef.cell},m.id))},h.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:i.length,className:"dm-card-table-body-row-empty",role:"cell",children:f.jsx("span",{role:"status","aria-live":"polite",children:"No insights found."})})})})]})}),f.jsxs("div",{className:"dm-card-pagination",role:"navigation","aria-label":"Table pagination",children:[f.jsx(rt,{variant:"outline",size:"sm",onClick:c,disabled:!l.getCanPreviousPage(),"aria-label":"Go to previous page",children:"Previous"}),f.jsx(rt,{variant:"outline",size:"sm",onClick:d,disabled:!l.getCanNextPage(),"aria-label":"Go to next page",children:"Next"})]})]})}function Aft(){const n=PS(),{fetchInsights:e,deleteInsight:t,createInsight:i,insightLoading:s}=Jre(),{insights:r,isLoading:o,error:a,hasInsights:l}=Rht(),[c,d]=x.useState(null);x.useEffect(()=>{e()},[e]);const u=m=>{n(m)},h=()=>{(async()=>{const m=await i({title:"Untitled insight"});m&&n(m.id)})()},g=()=>{(async()=>{if(c)try{await t(c)}finally{d(null)}})()};return f.jsxs(c1,{children:[f.jsxs(fp,{children:[f.jsx(hp,{tooltip:"Manage and review your insights",icon:nxe,children:"Insights"}),f.jsx($M,{children:f.jsxs(rt,{variant:"outline","aria-label":"Add new insight",disabled:s,onClick:h,children:[f.jsx(Gd,{className:"h-4 w-4","aria-hidden":"true"}),"New insight"]})})]}),f.jsxs(gp,{children:[o&&!l?f.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading insights…"}):a?f.jsx("div",{className:"text-destructive p-4 text-sm",children:"Failed to load insights"}):l?f.jsx(kft,{items:r.map(m=>({id:m.id,title:m.title,lastUpdated:m.modifiedAt})),onRowClick:u,onDelete:m=>{d(m)}}):f.jsx(Tft,{}),f.jsx(Ma,{open:!!c,onOpenChange:m=>{m||d(null)},title:"Delete Insight",description:"Are you sure you want to delete this insight? This action cannot be undone.",confirmLabel:"Delete",cancelLabel:"Cancel",variant:"destructive",onConfirm:g})]}),f.jsx(E_,{})]})}function Mft(){return f.jsx(UIe,{children:f.jsx(Aft,{})})}const lB=x.createContext(null);lB.displayName="PanelGroupContext";const Eo={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},ioe=10,Dy=x.useLayoutEffect,f_e=Qj.useId,Oft=typeof f_e=="function"?f_e:()=>null;let Pft=0;function noe(n=null){const e=Oft(),t=x.useRef(n||e||null);return t.current===null&&(t.current=""+Pft++),n??t.current}function ZIe({children:n,className:e="",collapsedSize:t,collapsible:i,defaultSize:s,forwardedRef:r,id:o,maxSize:a,minSize:l,onCollapse:c,onExpand:d,onResize:u,order:h,style:g,tagName:m="div",...b}){const v=x.useContext(lB);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:C,expandPanel:y,getPanelSize:L,getPanelStyle:E,groupId:R,isPanelCollapsed:T,reevaluatePanelConstraints:N,registerPanel:I,resizePanel:M,unregisterPanel:P}=v,H=noe(o),j=x.useRef({callbacks:{onCollapse:c,onExpand:d,onResize:u},constraints:{collapsedSize:t,collapsible:i,defaultSize:s,maxSize:a,minSize:l},id:H,idIsFromProps:o!==void 0,order:h});x.useRef({didLogMissingDefaultSizeWarning:!1}),Dy(()=>{const{callbacks:W,constraints:U}=j.current,B={...U};j.current.id=H,j.current.idIsFromProps=o!==void 0,j.current.order=h,W.onCollapse=c,W.onExpand=d,W.onResize=u,U.collapsedSize=t,U.collapsible=i,U.defaultSize=s,U.maxSize=a,U.minSize=l,(B.collapsedSize!==U.collapsedSize||B.collapsible!==U.collapsible||B.maxSize!==U.maxSize||B.minSize!==U.minSize)&&N(j.current,B)}),Dy(()=>{const W=j.current;return I(W),()=>{P(W)}},[h,H,I,P]),x.useImperativeHandle(r,()=>({collapse:()=>{C(j.current)},expand:W=>{y(j.current,W)},getId(){return H},getSize(){return L(j.current)},isCollapsed(){return T(j.current)},isExpanded(){return!T(j.current)},resize:W=>{M(j.current,W)}}),[C,y,L,T,H,M]);const V=E(j.current,s);return x.createElement(m,{...b,children:n,className:e,id:H,style:{...V,...g},[Eo.groupId]:R,[Eo.panel]:"",[Eo.panelCollapsible]:i||void 0,[Eo.panelId]:H,[Eo.panelSize]:parseFloat(""+V.flexGrow).toFixed(1)})}const YIe=x.forwardRef((n,e)=>x.createElement(ZIe,{...n,forwardedRef:e}));ZIe.displayName="Panel";YIe.displayName="forwardRef(Panel)";let oZ=null,f5=-1,xv=null;function Fft(n,e,t){const i=(e&tke)!==0,s=(e&ike)!==0,r=(e&nke)!==0,o=(e&ske)!==0;if(e){if(i)return r?"se-resize":o?"ne-resize":"e-resize";if(s)return r?"sw-resize":o?"nw-resize":"w-resize";if(r)return"s-resize";if(o)return"n-resize"}switch(n){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function jft(){xv!==null&&(document.head.removeChild(xv),oZ=null,xv=null,f5=-1)}function g$(n,e,t){var i,s;const r=Fft(n,e);if(oZ!==r){if(oZ=r,xv===null&&(xv=document.createElement("style"),document.head.appendChild(xv)),f5>=0){var o;(o=xv.sheet)===null||o===void 0||o.removeRule(f5)}f5=(i=(s=xv.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${r} !important;}`))!==null&&i!==void 0?i:-1}}function XIe(n){return n.type==="keydown"}function QIe(n){return n.type.startsWith("pointer")}function JIe(n){return n.type.startsWith("mouse")}function cB(n){if(QIe(n)){if(n.isPrimary)return{x:n.clientX,y:n.clientY}}else if(JIe(n))return{x:n.clientX,y:n.clientY};return{x:1/0,y:1/0}}function Hft(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Bft(n,e,t){return n.x<e.x+e.width&&n.x+n.width>e.x&&n.y<e.y+e.height&&n.y+n.height>e.y}function Vft(n,e){if(n===e)throw new Error("Cannot compare node with itself");const t={a:m_e(n),b:m_e(e)};let i;for(;t.a.at(-1)===t.b.at(-1);)n=t.a.pop(),e=t.b.pop(),i=n;bn(i,"Stacking order can only be calculated for elements with a common ancestor");const s={a:p_e(g_e(t.a)),b:p_e(g_e(t.b))};if(s.a===s.b){const r=i.childNodes,o={a:t.a.at(-1),b:t.b.at(-1)};let a=r.length;for(;a--;){const l=r[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(s.a-s.b)}const Wft=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function zft(n){var e;const t=getComputedStyle((e=eke(n))!==null&&e!==void 0?e:n).display;return t==="flex"||t==="inline-flex"}function Uft(n){const e=getComputedStyle(n);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||zft(n))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Wft.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function g_e(n){let e=n.length;for(;e--;){const t=n[e];if(bn(t,"Missing node"),Uft(t))return t}return null}function p_e(n){return n&&Number(getComputedStyle(n).zIndex)||0}function m_e(n){const e=[];for(;n;)e.push(n),n=eke(n);return e}function eke(n){const{parentNode:e}=n;return e&&e instanceof ShadowRoot?e.host:e}const tke=1,ike=2,nke=4,ske=8,$ft=Hft()==="coarse";let Of=[],HE=!1,Lv=new Map,dB=new Map;const m2=new Set;function Gft(n,e,t,i,s){var r;const{ownerDocument:o}=e,a={direction:t,element:e,hitAreaMargins:i,setResizeHandlerState:s},l=(r=Lv.get(o))!==null&&r!==void 0?r:0;return Lv.set(o,l+1),m2.add(a),$F(),function(){var d;dB.delete(n),m2.delete(a);const u=(d=Lv.get(o))!==null&&d!==void 0?d:1;if(Lv.set(o,u-1),$F(),u===1&&Lv.delete(o),Of.includes(a)){const h=Of.indexOf(a);h>=0&&Of.splice(h,1),uB(),s("up",!0,null)}}}function qft(n){const{target:e}=n,{x:t,y:i}=cB(n);HE=!0,soe({target:e,x:t,y:i}),$F(),Of.length>0&&(GF("down",n),uB(),n.preventDefault(),rke(e)||n.stopImmediatePropagation())}function p$(n){const{x:e,y:t}=cB(n);if(HE&&n.type!=="pointerleave"&&n.buttons===0&&(HE=!1,GF("up",n)),!HE){const{target:i}=n;soe({target:i,x:e,y:t})}GF("move",n),uB(),Of.length>0&&n.preventDefault()}function m$(n){const{target:e}=n,{x:t,y:i}=cB(n);dB.clear(),HE=!1,Of.length>0&&(n.preventDefault(),rke(e)||n.stopImmediatePropagation()),GF("up",n),soe({target:e,x:t,y:i}),uB(),$F()}function rke(n){let e=n;for(;e;){if(e.hasAttribute(Eo.resizeHandle))return!0;e=e.parentElement}return!1}function soe({target:n,x:e,y:t}){Of.splice(0);let i=null;(n instanceof HTMLElement||n instanceof SVGElement)&&(i=n),m2.forEach(s=>{const{element:r,hitAreaMargins:o}=s,a=r.getBoundingClientRect(),{bottom:l,left:c,right:d,top:u}=a,h=$ft?o.coarse:o.fine;if(e>=c-h&&e<=d+h&&t>=u-h&&t<=l+h){if(i!==null&&document.contains(i)&&r!==i&&!r.contains(i)&&!i.contains(r)&&Vft(i,r)>0){let m=i,b=!1;for(;m&&!m.contains(r);){if(Bft(m.getBoundingClientRect(),a)){b=!0;break}m=m.parentElement}if(b)return}Of.push(s)}})}function _$(n,e){dB.set(n,e)}function uB(){let n=!1,e=!1;Of.forEach(i=>{const{direction:s}=i;s==="horizontal"?n=!0:e=!0});let t=0;dB.forEach(i=>{t|=i}),n&&e?g$("intersection",t):n?g$("horizontal",t):e?g$("vertical",t):jft()}let b$;function $F(){var n;(n=b$)===null||n===void 0||n.abort(),b$=new AbortController;const e={capture:!0,signal:b$.signal};m2.size&&(HE?(Of.length>0&&Lv.forEach((t,i)=>{const{body:s}=i;t>0&&(s.addEventListener("contextmenu",m$,e),s.addEventListener("pointerleave",p$,e),s.addEventListener("pointermove",p$,e))}),Lv.forEach((t,i)=>{const{body:s}=i;s.addEventListener("pointerup",m$,e),s.addEventListener("pointercancel",m$,e)})):Lv.forEach((t,i)=>{const{body:s}=i;t>0&&(s.addEventListener("pointerdown",qft,e),s.addEventListener("pointermove",p$,e))}))}function GF(n,e){m2.forEach(t=>{const{setResizeHandlerState:i}=t,s=Of.includes(t);i(n,s,e)})}function Kft(){const[n,e]=x.useState(0);return x.useCallback(()=>e(t=>t+1),[])}function bn(n,e){if(!n)throw console.error(e),Error(e)}function Q0(n,e,t=ioe){return n.toFixed(t)===e.toFixed(t)?0:n>e?1:-1}function e_(n,e,t=ioe){return Q0(n,e,t)===0}function fu(n,e,t){return Q0(n,e,t)===0}function Zft(n,e,t){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++){const s=n[i],r=e[i];if(!fu(s,r,t))return!1}return!0}function $L({panelConstraints:n,panelIndex:e,size:t}){const i=n[e];bn(i!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:s=0,collapsible:r,maxSize:o=100,minSize:a=0}=i;if(Q0(t,a)<0)if(r){const l=(s+a)/2;Q0(t,l)<0?t=s:t=a}else t=a;return t=Math.min(o,t),t=parseFloat(t.toFixed(ioe)),t}function dI({delta:n,initialLayout:e,panelConstraints:t,pivotIndices:i,prevLayout:s,trigger:r}){if(fu(n,0))return e;const o=[...e],[a,l]=i;bn(a!=null,"Invalid first pivot index"),bn(l!=null,"Invalid second pivot index");let c=0;if(r==="keyboard"){{const u=n<0?l:a,h=t[u];bn(h,`Panel constraints not found for index ${u}`);const{collapsedSize:g=0,collapsible:m,minSize:b=0}=h;if(m){const v=e[u];if(bn(v!=null,`Previous layout not found for panel index ${u}`),fu(v,g)){const C=b-v;Q0(C,Math.abs(n))>0&&(n=n<0?0-C:C)}}}{const u=n<0?a:l,h=t[u];bn(h,`No panel constraints found for index ${u}`);const{collapsedSize:g=0,collapsible:m,minSize:b=0}=h;if(m){const v=e[u];if(bn(v!=null,`Previous layout not found for panel index ${u}`),fu(v,b)){const C=v-g;Q0(C,Math.abs(n))>0&&(n=n<0?0-C:C)}}}}{const u=n<0?1:-1;let h=n<0?l:a,g=0;for(;;){const b=e[h];bn(b!=null,`Previous layout not found for panel index ${h}`);const C=$L({panelConstraints:t,panelIndex:h,size:100})-b;if(g+=C,h+=u,h<0||h>=t.length)break}const m=Math.min(Math.abs(n),Math.abs(g));n=n<0?0-m:m}{let h=n<0?a:l;for(;h>=0&&h<t.length;){const g=Math.abs(n)-Math.abs(c),m=e[h];bn(m!=null,`Previous layout not found for panel index ${h}`);const b=m-g,v=$L({panelConstraints:t,panelIndex:h,size:b});if(!fu(m,v)&&(c+=m-v,o[h]=v,c.toFixed(3).localeCompare(Math.abs(n).toFixed(3),void 0,{numeric:!0})>=0))break;n<0?h--:h++}}if(Zft(s,o))return s;{const u=n<0?l:a,h=e[u];bn(h!=null,`Previous layout not found for panel index ${u}`);const g=h+c,m=$L({panelConstraints:t,panelIndex:u,size:g});if(o[u]=m,!fu(m,g)){let b=g-m,C=n<0?l:a;for(;C>=0&&C<t.length;){const y=o[C];bn(y!=null,`Previous layout not found for panel index ${C}`);const L=y+b,E=$L({panelConstraints:t,panelIndex:C,size:L});if(fu(y,E)||(b-=E-y,o[C]=E),fu(b,0))break;n>0?C--:C++}}}const d=o.reduce((u,h)=>h+u,0);return fu(d,100)?o:s}function Yft({layout:n,panelsArray:e,pivotIndices:t}){let i=0,s=100,r=0,o=0;const a=t[0];bn(a!=null,"No pivot index found"),e.forEach((u,h)=>{const{constraints:g}=u,{maxSize:m=100,minSize:b=0}=g;h===a?(i=b,s=m):(r+=b,o+=m)});const l=Math.min(s,100-r),c=Math.max(i,100-o),d=n[a];return{valueMax:l,valueMin:c,valueNow:d}}function _2(n,e=document){return Array.from(e.querySelectorAll(`[${Eo.resizeHandleId}][data-panel-group-id="${n}"]`))}function oke(n,e,t=document){const s=_2(n,t).findIndex(r=>r.getAttribute(Eo.resizeHandleId)===e);return s??null}function ake(n,e,t){const i=oke(n,e,t);return i!=null?[i,i+1]:[-1,-1]}function Xft(n){return n instanceof HTMLElement?!0:typeof n=="object"&&n!==null&&"tagName"in n&&"getAttribute"in n}function lke(n,e=document){if(Xft(e)&&e.dataset.panelGroupId==n)return e;const t=e.querySelector(`[data-panel-group][data-panel-group-id="${n}"]`);return t||null}function hB(n,e=document){const t=e.querySelector(`[${Eo.resizeHandleId}="${n}"]`);return t||null}function Qft(n,e,t,i=document){var s,r,o,a;const l=hB(e,i),c=_2(n,i),d=l?c.indexOf(l):-1,u=(s=(r=t[d])===null||r===void 0?void 0:r.id)!==null&&s!==void 0?s:null,h=(o=(a=t[d+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null;return[u,h]}function Jft({committedValuesRef:n,eagerValuesRef:e,groupId:t,layout:i,panelDataArray:s,panelGroupElement:r,setLayout:o}){x.useRef({didWarnAboutMissingResizeHandle:!1}),Dy(()=>{if(!r)return;const a=_2(t,r);for(let l=0;l<s.length-1;l++){const{valueMax:c,valueMin:d,valueNow:u}=Yft({layout:i,panelsArray:s,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const g=s[l];bn(g,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",g.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(d)),h.setAttribute("aria-valuenow",u!=null?""+Math.round(u):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[t,i,s,r]),x.useEffect(()=>{if(!r)return;const a=e.current;bn(a,"Eager values not found");const{panelDataArray:l}=a,c=lke(t,r);bn(c!=null,`No group found for id "${t}"`);const d=_2(t,r);bn(d,`No resize handles found for group id "${t}"`);const u=d.map(h=>{const g=h.getAttribute(Eo.resizeHandleId);bn(g,"Resize handle element has no handle id attribute");const[m,b]=Qft(t,g,l,r);if(m==null||b==null)return()=>{};const v=C=>{if(!C.defaultPrevented)switch(C.key){case"Enter":{C.preventDefault();const y=l.findIndex(L=>L.id===m);if(y>=0){const L=l[y];bn(L,`No panel data found for index ${y}`);const E=i[y],{collapsedSize:R=0,collapsible:T,minSize:N=0}=L.constraints;if(E!=null&&T){const I=dI({delta:fu(E,R)?N-R:R-E,initialLayout:i,panelConstraints:l.map(M=>M.constraints),pivotIndices:ake(t,g,r),prevLayout:i,trigger:"keyboard"});i!==I&&o(I)}}break}}};return h.addEventListener("keydown",v),()=>{h.removeEventListener("keydown",v)}});return()=>{u.forEach(h=>h())}},[r,n,e,t,i,s,o])}function __e(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function cke(n,e){const t=n==="horizontal",{x:i,y:s}=cB(e);return t?i:s}function egt(n,e,t,i,s){const r=t==="horizontal",o=hB(e,s);bn(o,`No resize handle element found for id "${e}"`);const a=o.getAttribute(Eo.groupId);bn(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=i;const c=cke(t,n),d=lke(a,s);bn(d,`No group element found for id "${a}"`);const u=d.getBoundingClientRect(),h=r?u.width:u.height;return(c-l)/h*100}function tgt(n,e,t,i,s,r){if(XIe(n)){const o=t==="horizontal";let a=0;n.shiftKey?a=100:s!=null?a=s:a=10;let l=0;switch(n.key){case"ArrowDown":l=o?0:a;break;case"ArrowLeft":l=o?-a:0;break;case"ArrowRight":l=o?a:0;break;case"ArrowUp":l=o?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return i==null?0:egt(n,e,t,i,r)}function igt({panelDataArray:n}){const e=Array(n.length),t=n.map(r=>r.constraints);let i=0,s=100;for(let r=0;r<n.length;r++){const o=t[r];bn(o,`Panel constraints not found for index ${r}`);const{defaultSize:a}=o;a!=null&&(i++,e[r]=a,s-=a)}for(let r=0;r<n.length;r++){const o=t[r];bn(o,`Panel constraints not found for index ${r}`);const{defaultSize:a}=o;if(a!=null)continue;const l=n.length-i,c=s/l;i++,e[r]=c,s-=c}return e}function eL(n,e,t){e.forEach((i,s)=>{const r=n[s];bn(r,`Panel data not found for index ${s}`);const{callbacks:o,constraints:a,id:l}=r,{collapsedSize:c=0,collapsible:d}=a,u=t[l];if(u==null||i!==u){t[l]=i;const{onCollapse:h,onExpand:g,onResize:m}=o;m&&m(i,u),d&&(h||g)&&(g&&(u==null||e_(u,c))&&!e_(i,c)&&g(),h&&(u==null||!e_(u,c))&&e_(i,c)&&h())}})}function w4(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t])return!1;return!0}function ngt({defaultSize:n,dragState:e,layout:t,panelData:i,panelIndex:s,precision:r=3}){const o=t[s];let a;return o==null?a=n!=null?n.toFixed(r):"1":i.length===1?a="1":a=o.toFixed(r),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function sgt(n,e=10){let t=null;return(...s)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...s)},e)}}function b_e(n){try{if(typeof localStorage<"u")n.getItem=e=>localStorage.getItem(e),n.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),n.getItem=()=>null,n.setItem=()=>{}}}function dke(n){return`react-resizable-panels:${n}`}function uke(n){return n.map(e=>{const{constraints:t,id:i,idIsFromProps:s,order:r}=e;return s?i:r?`${r}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function hke(n,e){try{const t=dke(n),i=e.getItem(t);if(i){const s=JSON.parse(i);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function rgt(n,e,t){var i,s;const r=(i=hke(n,t))!==null&&i!==void 0?i:{},o=uke(e);return(s=r[o])!==null&&s!==void 0?s:null}function ogt(n,e,t,i,s){var r;const o=dke(n),a=uke(e),l=(r=hke(n,s))!==null&&r!==void 0?r:{};l[a]={expandToSizes:Object.fromEntries(t.entries()),layout:i};try{s.setItem(o,JSON.stringify(l))}catch(c){console.error(c)}}function v_e({layout:n,panelConstraints:e}){const t=[...n],i=t.reduce((r,o)=>r+o,0);if(t.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${t.map(r=>`${r}%`).join(", ")}`);if(!fu(i,100)&&t.length>0)for(let r=0;r<e.length;r++){const o=t[r];bn(o!=null,`No layout data found for index ${r}`);const a=100/i*o;t[r]=a}let s=0;for(let r=0;r<e.length;r++){const o=t[r];bn(o!=null,`No layout data found for index ${r}`);const a=$L({panelConstraints:e,panelIndex:r,size:o});o!=a&&(s+=o-a,t[r]=a)}if(!fu(s,0))for(let r=0;r<e.length;r++){const o=t[r];bn(o!=null,`No layout data found for index ${r}`);const a=o+s,l=$L({panelConstraints:e,panelIndex:r,size:a});if(o!==l&&(s-=l-o,t[r]=l,fu(s,0)))break}return t}const agt=100,uI={getItem:n=>(b_e(uI),uI.getItem(n)),setItem:(n,e)=>{b_e(uI),uI.setItem(n,e)}},C_e={};function fke({autoSaveId:n=null,children:e,className:t="",direction:i,forwardedRef:s,id:r=null,onLayout:o=null,keyboardResizeBy:a=null,storage:l=uI,style:c,tagName:d="div",...u}){const h=noe(r),g=x.useRef(null),[m,b]=x.useState(null),[v,C]=x.useState([]),y=Kft(),L=x.useRef({}),E=x.useRef(new Map),R=x.useRef(0),T=x.useRef({autoSaveId:n,direction:i,dragState:m,id:h,keyboardResizeBy:a,onLayout:o,storage:l}),N=x.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});x.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),x.useImperativeHandle(s,()=>({getId:()=>T.current.id,getLayout:()=>{const{layout:ee}=N.current;return ee},setLayout:ee=>{const{onLayout:se}=T.current,{layout:ae,panelDataArray:Se}=N.current,ue=v_e({layout:ee,panelConstraints:Se.map(Re=>Re.constraints)});__e(ae,ue)||(C(ue),N.current.layout=ue,se&&se(ue),eL(Se,ue,L.current))}}),[]),Dy(()=>{T.current.autoSaveId=n,T.current.direction=i,T.current.dragState=m,T.current.id=h,T.current.onLayout=o,T.current.storage=l}),Jft({committedValuesRef:T,eagerValuesRef:N,groupId:h,layout:v,panelDataArray:N.current.panelDataArray,setLayout:C,panelGroupElement:g.current}),x.useEffect(()=>{const{panelDataArray:ee}=N.current;if(n){if(v.length===0||v.length!==ee.length)return;let se=C_e[n];se==null&&(se=sgt(ogt,agt),C_e[n]=se);const ae=[...ee],Se=new Map(E.current);se(n,ae,Se,v,l)}},[n,v,l]),x.useEffect(()=>{});const I=x.useCallback(ee=>{const{onLayout:se}=T.current,{layout:ae,panelDataArray:Se}=N.current;if(ee.constraints.collapsible){const ue=Se.map(dt=>dt.constraints),{collapsedSize:Re=0,panelSize:Ve,pivotIndices:Qe}=JC(Se,ee,ae);if(bn(Ve!=null,`Panel size not found for panel "${ee.id}"`),!e_(Ve,Re)){E.current.set(ee.id,Ve);const yt=AL(Se,ee)===Se.length-1?Ve-Re:Re-Ve,fi=dI({delta:yt,initialLayout:ae,panelConstraints:ue,pivotIndices:Qe,prevLayout:ae,trigger:"imperative-api"});w4(ae,fi)||(C(fi),N.current.layout=fi,se&&se(fi),eL(Se,fi,L.current))}}},[]),M=x.useCallback((ee,se)=>{const{onLayout:ae}=T.current,{layout:Se,panelDataArray:ue}=N.current;if(ee.constraints.collapsible){const Re=ue.map(_i=>_i.constraints),{collapsedSize:Ve=0,panelSize:Qe=0,minSize:dt=0,pivotIndices:yt}=JC(ue,ee,Se),fi=se??dt;if(e_(Qe,Ve)){const _i=E.current.get(ee.id),Sn=_i!=null&&_i>=fi?_i:fi,br=AL(ue,ee)===ue.length-1?Qe-Sn:Sn-Qe,hs=dI({delta:br,initialLayout:Se,panelConstraints:Re,pivotIndices:yt,prevLayout:Se,trigger:"imperative-api"});w4(Se,hs)||(C(hs),N.current.layout=hs,ae&&ae(hs),eL(ue,hs,L.current))}}},[]),P=x.useCallback(ee=>{const{layout:se,panelDataArray:ae}=N.current,{panelSize:Se}=JC(ae,ee,se);return bn(Se!=null,`Panel size not found for panel "${ee.id}"`),Se},[]),H=x.useCallback((ee,se)=>{const{panelDataArray:ae}=N.current,Se=AL(ae,ee);return ngt({defaultSize:se,dragState:m,layout:v,panelData:ae,panelIndex:Se})},[m,v]),j=x.useCallback(ee=>{const{layout:se,panelDataArray:ae}=N.current,{collapsedSize:Se=0,collapsible:ue,panelSize:Re}=JC(ae,ee,se);return bn(Re!=null,`Panel size not found for panel "${ee.id}"`),ue===!0&&e_(Re,Se)},[]),V=x.useCallback(ee=>{const{layout:se,panelDataArray:ae}=N.current,{collapsedSize:Se=0,collapsible:ue,panelSize:Re}=JC(ae,ee,se);return bn(Re!=null,`Panel size not found for panel "${ee.id}"`),!ue||Q0(Re,Se)>0},[]),W=x.useCallback(ee=>{const{panelDataArray:se}=N.current;se.push(ee),se.sort((ae,Se)=>{const ue=ae.order,Re=Se.order;return ue==null&&Re==null?0:ue==null?-1:Re==null?1:ue-Re}),N.current.panelDataArrayChanged=!0,y()},[y]);Dy(()=>{if(N.current.panelDataArrayChanged){N.current.panelDataArrayChanged=!1;const{autoSaveId:ee,onLayout:se,storage:ae}=T.current,{layout:Se,panelDataArray:ue}=N.current;let Re=null;if(ee){const Qe=rgt(ee,ue,ae);Qe&&(E.current=new Map(Object.entries(Qe.expandToSizes)),Re=Qe.layout)}Re==null&&(Re=igt({panelDataArray:ue}));const Ve=v_e({layout:Re,panelConstraints:ue.map(Qe=>Qe.constraints)});__e(Se,Ve)||(C(Ve),N.current.layout=Ve,se&&se(Ve),eL(ue,Ve,L.current))}}),Dy(()=>{const ee=N.current;return()=>{ee.layout=[]}},[]);const U=x.useCallback(ee=>{let se=!1;const ae=g.current;return ae&&window.getComputedStyle(ae,null).getPropertyValue("direction")==="rtl"&&(se=!0),function(ue){ue.preventDefault();const Re=g.current;if(!Re)return()=>null;const{direction:Ve,dragState:Qe,id:dt,keyboardResizeBy:yt,onLayout:fi}=T.current,{layout:_i,panelDataArray:Sn}=N.current,{initialLayout:Es}=Qe??{},br=ake(dt,ee,Re);let hs=tgt(ue,ee,Ve,Qe,yt,Re);const Ht=Ve==="horizontal";Ht&&se&&(hs=-hs);const oe=Sn.map(bt=>bt.constraints),Ce=dI({delta:hs,initialLayout:Es??_i,panelConstraints:oe,pivotIndices:br,prevLayout:_i,trigger:XIe(ue)?"keyboard":"mouse-or-touch"}),je=!w4(_i,Ce);(QIe(ue)||JIe(ue))&&R.current!=hs&&(R.current=hs,!je&&hs!==0?Ht?_$(ee,hs<0?tke:ike):_$(ee,hs<0?nke:ske):_$(ee,0)),je&&(C(Ce),N.current.layout=Ce,fi&&fi(Ce),eL(Sn,Ce,L.current))}},[]),B=x.useCallback((ee,se)=>{const{onLayout:ae}=T.current,{layout:Se,panelDataArray:ue}=N.current,Re=ue.map(_i=>_i.constraints),{panelSize:Ve,pivotIndices:Qe}=JC(ue,ee,Se);bn(Ve!=null,`Panel size not found for panel "${ee.id}"`);const yt=AL(ue,ee)===ue.length-1?Ve-se:se-Ve,fi=dI({delta:yt,initialLayout:Se,panelConstraints:Re,pivotIndices:Qe,prevLayout:Se,trigger:"imperative-api"});w4(Se,fi)||(C(fi),N.current.layout=fi,ae&&ae(fi),eL(ue,fi,L.current))},[]),K=x.useCallback((ee,se)=>{const{layout:ae,panelDataArray:Se}=N.current,{collapsedSize:ue=0,collapsible:Re}=se,{collapsedSize:Ve=0,collapsible:Qe,maxSize:dt=100,minSize:yt=0}=ee.constraints,{panelSize:fi}=JC(Se,ee,ae);fi!=null&&(Re&&Qe&&e_(fi,ue)?e_(ue,Ve)||B(ee,Ve):fi<yt?B(ee,yt):fi>dt&&B(ee,dt))},[B]),X=x.useCallback((ee,se)=>{const{direction:ae}=T.current,{layout:Se}=N.current;if(!g.current)return;const ue=hB(ee,g.current);bn(ue,`Drag handle element not found for id "${ee}"`);const Re=cke(ae,se);b({dragHandleId:ee,dragHandleRect:ue.getBoundingClientRect(),initialCursorPosition:Re,initialLayout:Se})},[]),ne=x.useCallback(()=>{b(null)},[]),fe=x.useCallback(ee=>{const{panelDataArray:se}=N.current,ae=AL(se,ee);ae>=0&&(se.splice(ae,1),delete L.current[ee.id],N.current.panelDataArrayChanged=!0,y())},[y]),Z=x.useMemo(()=>({collapsePanel:I,direction:i,dragState:m,expandPanel:M,getPanelSize:P,getPanelStyle:H,groupId:h,isPanelCollapsed:j,isPanelExpanded:V,reevaluatePanelConstraints:K,registerPanel:W,registerResizeHandle:U,resizePanel:B,startDragging:X,stopDragging:ne,unregisterPanel:fe,panelGroupElement:g.current}),[I,m,i,M,P,H,h,j,V,K,W,U,B,X,ne,fe]),Y={display:"flex",flexDirection:i==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return x.createElement(lB.Provider,{value:Z},x.createElement(d,{...u,children:e,className:t,id:r,ref:g,style:{...Y,...c},[Eo.group]:"",[Eo.groupDirection]:i,[Eo.groupId]:h}))}const gke=x.forwardRef((n,e)=>x.createElement(fke,{...n,forwardedRef:e}));fke.displayName="PanelGroup";gke.displayName="forwardRef(PanelGroup)";function AL(n,e){return n.findIndex(t=>t===e||t.id===e.id)}function JC(n,e,t){const i=AL(n,e),r=i===n.length-1?[i-1,i]:[i,i+1],o=t[i];return{...e.constraints,panelSize:o,pivotIndices:r}}function lgt({disabled:n,handleId:e,resizeHandler:t,panelGroupElement:i}){x.useEffect(()=>{if(n||t==null||i==null)return;const s=hB(e,i);if(s==null)return;const r=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),t(o);break}case"F6":{o.preventDefault();const a=s.getAttribute(Eo.groupId);bn(a,`No group element found for id "${a}"`);const l=_2(a,i),c=oke(a,e,i);bn(c!==null,`No resize element found for id "${e}"`);const d=o.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[d].focus();break}}};return s.addEventListener("keydown",r),()=>{s.removeEventListener("keydown",r)}},[i,n,e,t])}function pke({children:n=null,className:e="",disabled:t=!1,hitAreaMargins:i,id:s,onBlur:r,onClick:o,onDragging:a,onFocus:l,onPointerDown:c,onPointerUp:d,style:u={},tabIndex:h=0,tagName:g="div",...m}){var b,v;const C=x.useRef(null),y=x.useRef({onClick:o,onDragging:a,onPointerDown:c,onPointerUp:d});x.useEffect(()=>{y.current.onClick=o,y.current.onDragging=a,y.current.onPointerDown=c,y.current.onPointerUp=d});const L=x.useContext(lB);if(L===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:E,groupId:R,registerResizeHandle:T,startDragging:N,stopDragging:I,panelGroupElement:M}=L,P=noe(s),[H,j]=x.useState("inactive"),[V,W]=x.useState(!1),[U,B]=x.useState(null),K=x.useRef({state:H});Dy(()=>{K.current.state=H}),x.useEffect(()=>{if(t)B(null);else{const Z=T(P);B(()=>Z)}},[t,P,T]);const X=(b=i==null?void 0:i.coarse)!==null&&b!==void 0?b:15,ne=(v=i==null?void 0:i.fine)!==null&&v!==void 0?v:5;x.useEffect(()=>{if(t||U==null)return;const Z=C.current;bn(Z,"Element ref not attached");let Y=!1;return Gft(P,Z,E,{coarse:X,fine:ne},(se,ae,Se)=>{if(!ae){j("inactive");return}switch(se){case"down":{j("drag"),Y=!1,bn(Se,'Expected event to be defined for "down" action'),N(P,Se);const{onDragging:ue,onPointerDown:Re}=y.current;ue==null||ue(!0),Re==null||Re();break}case"move":{const{state:ue}=K.current;Y=!0,ue!=="drag"&&j("hover"),bn(Se,'Expected event to be defined for "move" action'),U(Se);break}case"up":{j("hover"),I();const{onClick:ue,onDragging:Re,onPointerUp:Ve}=y.current;Re==null||Re(!1),Ve==null||Ve(),Y||ue==null||ue();break}}})},[X,E,t,ne,T,P,U,N,I]),lgt({disabled:t,handleId:P,resizeHandler:U,panelGroupElement:M});const fe={touchAction:"none",userSelect:"none"};return x.createElement(g,{...m,children:n,className:e,id:s,onBlur:()=>{W(!1),r==null||r()},onFocus:()=>{W(!0),l==null||l()},ref:C,role:"separator",style:{...fe,...u},tabIndex:h,[Eo.groupDirection]:E,[Eo.groupId]:R,[Eo.resizeHandle]:"",[Eo.resizeHandleActive]:H==="drag"?"pointer":V?"keyboard":void 0,[Eo.resizeHandleEnabled]:!t,[Eo.resizeHandleId]:P,[Eo.resizeHandleState]:H})}pke.displayName="PanelResizeHandle";function cgt({className:n,...e}){return f.jsx(gke,{"data-slot":"resizable-panel-group",className:Le("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),...e})}function w_e({...n}){return f.jsx(YIe,{"data-slot":"resizable-panel",...n})}function dgt({withHandle:n,className:e,...t}){return f.jsx(pke,{"data-slot":"resizable-handle",className:Le("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",e),...t,children:n&&f.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:f.jsx(JSe,{className:"size-2.5"})})})}function ugt({storageKey:n,left:e,right:t,initialRatio:i=.5,minWidth:s=240,className:r}){const o=x.useMemo(()=>{const h=np.get(n);if(h!==null){const g=Number(h);if(!Number.isNaN(g))return v$(g,.1,.9)}return v$(i,.1,.9)},[n,i]),a=Math.round(o*100),l=100-a,d=Math.min(45,Math.max(5,Math.round(s/1200*100)));function u(h){const g=h[0],m=v$(g/100,.1,.9);np.set(n,m)}return f.jsxs(cgt,{direction:"horizontal",onLayout:u,className:Le("relative flex h-full w-full items-stretch overflow-hidden",r),children:[f.jsx(w_e,{defaultSize:a,minSize:d,className:"overflow-auto",children:e}),f.jsx(dgt,{withHandle:!0}),f.jsx(w_e,{defaultSize:l,minSize:d,className:"overflow-auto",children:t})]})}function v$(n,e,t){return Math.max(e,Math.min(t,n))}const hgt="modulepreload",fgt=function(n){return"/"+n},y_e={},pt=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(t.map(c=>{if(c=fgt(c),c in y_e)return;y_e[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":hgt,d||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),d)return new Promise((g,m)=>{h.addEventListener("load",g),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};function mke(){return globalThis._VSCODE_NLS_MESSAGES}function roe(){return globalThis._VSCODE_NLS_LANGUAGE}const ggt=roe()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function qF(n,e){let t;return e.length===0?t=n:t=n.replace(/\{(\d+)\}/g,(i,s)=>{const r=s[0],o=e[r];let a=i;return typeof o=="string"?a=o:(typeof o=="number"||typeof o=="boolean"||o===void 0||o===null)&&(a=String(o)),a}),ggt&&(t="["+t.replace(/[aouei]/g,"$&$&")+"]"),t}function S(n,e,...t){return qF(typeof n=="number"?_ke(n,e):e,t)}function _ke(n,e){var i;const t=(i=mke())==null?void 0:i[n];if(typeof t!="string"){if(typeof e=="string")return e;throw new Error(`!!! NLS MISSING: ${n} !!!`)}return t}function ce(n,e,...t){let i;typeof n=="number"?i=_ke(n,e):i=e;const s=qF(i,t);return{value:s,original:e===i?s:qF(e,t)}}function pgt(n,e){const t=n;typeof t.vscodeWindowId!="number"&&Object.defineProperty(t,"vscodeWindowId",{get:()=>e})}const dn=window,f7=class f7{constructor(){this.mapWindowIdToZoomFactor=new Map}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}getWindowId(e){return e.vscodeWindowId}};f7.INSTANCE=new f7;let aZ=f7;function bke(n,e,t){typeof e=="string"&&(e=n.matchMedia(e)),e.addEventListener("change",t)}function lZ(n){return aZ.INSTANCE.getZoomFactor(n)}const qR=navigator.userAgent,lc=qR.indexOf("Firefox")>=0,fB=qR.indexOf("AppleWebKit")>=0,GM=qR.indexOf("Chrome")>=0,J0=!GM&&qR.indexOf("Safari")>=0,vke=!GM&&!J0&&fB;qR.indexOf("Electron/")>=0;const S_e=qR.indexOf("Android")>=0;let C$=!1;if(typeof dn.matchMedia=="function"){const n=dn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=dn.matchMedia("(display-mode: fullscreen)");C$=n.matches,bke(dn,n,({matches:t})=>{C$&&e.matches||(C$=t)})}function ooe(){return globalThis.MonacoEnvironment}class mgt{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?VD.isErrorNoTelemetry(e)?new VD(e.message+`
|
|
746
|
+
`),section:"logs",variant:zF.DEFAULT,copiedSection:t,onCopy:i})]}),f.jsx("div",{className:"bg-muted max-h-96 overflow-y-auto rounded-md p-3 font-mono text-xs dark:bg-white/3",children:n.map((r,o)=>f.jsx("div",{className:"mb-1 leading-relaxed",children:r},o))})]})]})}function Wht({definitionRun:n,reportDefinition:e,insightDefinition:t}){const{copiedSection:i,handleCopy:s}=eoe(),r=o=>{o.stopPropagation()};return f.jsx("div",{className:"border-border rounded-lg border",onClick:r,children:n!=null?f.jsxs("div",{className:"p-4",children:[f.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[f.jsx("h4",{className:"text-foreground text-sm font-medium",children:"Configuration:"}),f.jsx(UF,{text:JSON.stringify(n,null,2),section:"configuration",variant:zF.DEFAULT,copiedSection:i,onCopy:s})]}),f.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded p-3 font-mono text-xs whitespace-pre-wrap dark:bg-white/3",children:JSON.stringify(n,null,2)}),e&&f.jsxs(f.Fragment,{children:[f.jsx("h4",{className:"text-foreground mt-3 mb-3 text-sm font-medium",children:"Report definition:"}),f.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded p-3 font-mono text-xs whitespace-pre-wrap dark:bg-white/3",children:JSON.stringify(e,null,2)})]}),t&&f.jsxs(f.Fragment,{children:[f.jsx("h4",{className:"text-foreground mt-3 mb-3 text-sm font-medium",children:"Insight definition:"}),f.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded p-3 font-mono text-xs whitespace-pre-wrap dark:bg-white/3",children:JSON.stringify(t,null,2)})]})]}):f.jsx("div",{className:"text-muted-foreground p-8 text-center",children:"No configuration data available for this run"})})}const mm=18;function zht({type:n,base64Icon:e}){switch(n){case Kl.CONNECTOR:return e?f.jsx(VS,{base64:e,size:mm}):f.jsx(j1,{size:mm});case Kl.GOOGLE_SHEETS_EXPORT:{const t=Nc.getInfo(St.GOOGLE_SHEETS).icon;return f.jsx(t,{size:mm})}case Kl.LOOKER_STUDIO:{const t=Nc.getInfo(St.LOOKER_STUDIO).icon;return f.jsx(t,{size:mm})}case Kl.EMAIL:{const t=Nc.getInfo(St.EMAIL).icon;return f.jsx(t,{size:mm})}case Kl.SLACK:{const t=Nc.getInfo(St.SLACK).icon;return f.jsx(t,{size:mm})}case Kl.MS_TEAMS:{const t=Nc.getInfo(St.MS_TEAMS).icon;return f.jsx(t,{size:mm})}case Kl.GOOGLE_CHAT:{const t=Nc.getInfo(St.GOOGLE_CHAT).icon;return f.jsx(t,{size:mm})}default:return f.jsx(j1,{size:mm})}}function Uht({run:n,isExpanded:e,onToggle:t,logViewType:i,setLogViewType:s,searchTerm:r,setSearchTerm:o,cancelDataMartRun:a,dataMartId:l,dataMartConnectorInfo:c}){const{copiedSection:d,handleCopy:u}=eoe(),h=x.useMemo(()=>{if(n.logs.length===0&&n.errors.length===0)return[];const y=n.logs.map((R,T)=>c_e(R,T)),L=n.errors.map((R,T)=>c_e(R,n.logs.length+T,!0));return[...y,...L].filter(R=>{const T=$Ie(R);return r===""||R.message.toLowerCase().includes(r.toLowerCase())||T.toLowerCase().includes(r.toLowerCase())})},[n.logs,n.errors,r]),g=x.useCallback(()=>i===hf.STRUCTURED?f.jsx(Bht,{logs:h}):i===hf.RAW?f.jsx(Vht,{logs:n.logs,errors:n.errors}):f.jsx(Wht,{definitionRun:n.definitionRun,reportDefinition:n.reportDefinition,insightDefinition:n.insightDefinition}),[i,h,n.logs,n.errors,n.definitionRun,n.reportDefinition,n.insightDefinition]),m=Mht(n),b=Oht(n),[v,C]=kht(n,c==null?void 0:c.displayName);return f.jsxs("div",{className:"dm-card-block",children:[f.jsxs("div",{className:"flex cursor-pointer items-center justify-between",onClick:()=>{t(n.id)},children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{children:f.jsx(zht,{type:n.type,base64Icon:c==null?void 0:c.logoBase64})}),f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("div",{className:"text-foreground align-center mr-12 flex items-center font-mono text-sm font-medium",children:m})}),f.jsx(kn,{children:f.jsxs("div",{className:"space-y-1",children:[f.jsxs("div",{children:["Started At: ",b.startedAt]}),f.jsxs("div",{children:["Finished At: ",b.finishedAt]}),b.duration&&f.jsxs("div",{children:["Duration: ",b.duration]})]})})]}),f.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[Hht(n.triggerType),f.jsxs("span",{className:"inline-flex items-center",children:[v,n.createdByUser&&f.jsxs(f.Fragment,{children:[" by ",f.jsx(mRe,{userProjection:n.createdByUser})]}),C&&f.jsxs(f.Fragment,{children:[" • ",C]})]})]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Iht,{status:n.status}),f.jsx($d,{className:`text-muted-foreground h-4 w-4 transition-transform ${e?"rotate-90":""}`})]})]}),e&&f.jsxs("div",{className:"border-border bg-muted/30 space-y-4 border-t p-4",children:[f.jsxs("div",{className:"flex items-center",children:[f.jsxs("h3",{className:"text-foreground mr-2 font-medium",children:["Run ID: ",n.id]}),f.jsx(UF,{text:n.id,section:"run-id",onCopy:u,copiedSection:d,iconOnly:!0})]}),f.jsx(Pht,{logViewType:i,setLogViewType:s,searchTerm:r,setSearchTerm:o,run:n,cancelDataMartRun:a,dataMartId:l}),g()]})]})}function $ht(){const{dataMart:e,getDataMartRuns:t,loadMoreDataMartRuns:i,cancelDataMartRun:s,runs:r=[],isLoading:o}=Zu(),[a,l]=x.useState(!1),[c,d]=x.useState(!0),[u,h]=x.useState(0),[g,m]=x.useState(null),[b,v]=x.useState(hf.STRUCTURED),[C,y]=x.useState(""),L=x.useCallback(async()=>{if(!(e!=null&&e.id))return;const N=await t(e.id,20,0);h(N.length),d(N.length===20)},[e==null?void 0:e.id,t,20]),E=x.useCallback(async()=>{if(!(e!=null&&e.id)||a)return;l(!0);const N=await i(e.id,u,20);h(I=>I+N.length),d(N.length===20),l(!1)},[e==null?void 0:e.id,i,u,a,20]);x.useEffect(()=>{e!=null&&e.id&&L()},[e==null?void 0:e.id,L]);const R=x.useMemo(()=>(e==null?void 0:e.definitionType)===Yt.CONNECTOR&&e.definition&&"connector"in e.definition?e.definition.connector.info??null:null,[e]),T=N=>{m(g===N?null:N)};return o?f.jsx(VIe,{}):f.jsx("div",{className:"flex flex-col gap-4 pb-4",children:r.length===0?f.jsx("div",{className:"text-muted-foreground py-8 text-center",children:"No runs found for this Data Mart"}):f.jsxs("div",{className:"space-y-2",children:[r.map(N=>f.jsx(Uht,{run:N,isExpanded:g===N.id,onToggle:T,logViewType:b,setLogViewType:v,searchTerm:C,setSearchTerm:y,cancelDataMartRun:s,dataMartId:e==null?void 0:e.id,dataMartConnectorInfo:R},N.id)),c&&f.jsx("div",{className:"flex justify-center pt-4",children:f.jsx(OE,{variant:"outline",size:"sm",onClick:()=>void E(),disabled:a,className:"flex items-center gap-2",children:a?f.jsxs(f.Fragment,{children:[f.jsx(qBe,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):"Load More"})})]})})}const Ght=5e3,qht=20;function Kht(){const{dataMart:n,getDataMartRuns:e}=og();return Qre({enabled:!!(n!=null&&n.id),intervalMs:Ght,onTick:()=>{n!=null&&n.id&&e(n.id,qht,0,{silent:!0})}}),f.jsx("div",{className:"flex flex-col gap-4",children:f.jsxs(c1,{collapsible:!1,name:"run-history",children:[f.jsx(fp,{children:f.jsx(hp,{icon:mBe,tooltip:"View all Data Mart execution runs with detailed logs and errors",children:"Run History"})}),f.jsx(gp,{children:f.jsx($ht,{})})]})})}function Zht(){const n=XTe(),{navigate:e}=hb(),t=i=>{const s=n?`/data-marts/${i.id}/data-setup?preset=${n.key}`:`/data-marts/${i.id}/data-setup`;e(s)};return f.jsx("div",{className:"flex h-full w-full items-center justify-center",children:f.jsx("div",{className:"m-auto w-lg",children:f.jsxs("div",{className:"bg-muted/50 dark:bg-sidebar rounded-xl border-b border-gray-200 p-12 pt-8 dark:border-gray-700/50",children:[f.jsx("h2",{className:"mb-4 text-xl font-medium",children:"Create Data Mart"}),f.jsx(sre,{children:f.jsx(LRe,{children:f.jsx(rst,{initialData:{title:(n==null?void 0:n.datamartTitle)??"New Data Mart"},onSuccess:t})})})]})})})}function GIe({isOpen:n,onClose:e,id:t}){const{getDataStorageById:i,currentDataStorage:s,loading:r,clearCurrentDataStorage:o}=ZH();x.useEffect(()=>(n&&t&&i(t),()=>{n||o()}),[n,t,i,o]);const a=()=>{o(),e()};return f.jsx(Vse,{open:n,onOpenChange:l=>{l||a()},children:f.jsxs(Wse,{children:[f.jsxs(zse,{children:[f.jsx(Use,{children:"Storage Details"}),f.jsx($se,{children:"View detailed information about this storage."})]}),f.jsx("div",{className:"py-4",children:f.jsx(EQe,{dataStorage:s,isLoading:r})})]})})}const Yht=({id:n,onViewDetails:e,onEdit:t,onDelete:i})=>{const[s,r]=x.useState(!1);return f.jsx("div",{className:"text-right",children:f.jsxs(Al,{open:s,onOpenChange:r,children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:`dm-card-table-body-row-actionbtn opacity-0 transition-opacity ${s?"opacity-100":"group-hover:opacity-100"}`,"aria-label":"Open menu",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsxs(Ol,{align:"end",children:[f.jsxs(wn,{onClick:()=>e==null?void 0:e(n),children:[f.jsx(QSe,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"View details"})]}),f.jsxs(wn,{onClick:()=>void(t==null?void 0:t(n)),children:[f.jsx(TR,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"Edit"})]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:()=>i==null?void 0:i(n),children:[f.jsx(Wh,{className:"h-4 w-4 text-red-600","aria-hidden":"true"}),f.jsx("span",{className:"text-red-600",children:"Delete"})]})]})]})})},Xht=({onViewDetails:n,onEdit:e,onDelete:t}={})=>[{accessorKey:"title",size:50,header:({column:i})=>f.jsx(La,{column:i,children:"Title"}),cell:({row:i})=>{const s=i.getValue("title");return f.jsx("div",{children:s})}},{accessorKey:"type",size:30,header:({column:i})=>f.jsx(La,{column:i,children:"Type"}),cell:({row:i})=>{const s=i.getValue("type"),{displayName:r,icon:o}=fC.getInfo(s);return f.jsxs("div",{className:"text-muted-foreground flex items-center gap-2",children:[f.jsx(o,{size:18}),r]})}},{accessorKey:"createdAt",size:20,sortDescFirst:!0,header:({column:i})=>f.jsx(La,{column:i,children:"Created at"}),cell:({row:i})=>{const s=i.getValue("createdAt"),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(s);return f.jsx("div",{className:"text-muted-foreground",children:r})}},{id:"actions",size:80,header:({table:i})=>f.jsx(BR,{table:i}),cell:({row:i})=>f.jsx(Yht,{id:i.original.id,onViewDetails:n,onEdit:e,onDelete:t})}];function Qht({onOpenTypeDialog:n}){return f.jsxs("div",{className:"dm-empty-state",children:[f.jsx(XHe,{className:"dm-empty-state-ico",strokeWidth:1}),f.jsx("h2",{className:"dm-empty-state-title",children:"Create your first Storage"}),f.jsx("p",{className:"dm-empty-state-subtitle",children:"A Storage combines your data warehouse and access credentials — both required to start building Data Marts."}),f.jsxs(rt,{variant:"outline",onClick:n,children:[f.jsx(Gd,{className:"h-4 w-4"}),"New Storage"]})]})}function Jht({columns:n,data:e,onEdit:t,onOpenTypeDialog:i}){var C;const{sorting:s,setSorting:r,columnVisibility:o,setColumnVisibility:a}=zS({columns:n,storageKeyPrefix:"data-storage-list"}),[l,c]=x.useState([]),[d,u]=x.useState({}),[h,g]=x.useState(!1),[m]=x.useState(null),b=pC({data:e,columns:[...n],getCoreRowModel:gC(),getPaginationRowModel:OM(),onSortingChange:r,getSortedRowModel:WS(),onColumnFiltersChange:c,getFilteredRowModel:HR(),onColumnVisibilityChange:a,onRowSelectionChange:u,state:{sorting:s,columnFilters:l,columnVisibility:o,rowSelection:d},enableRowSelection:!0}),v=(y,L)=>{L.target instanceof HTMLElement&&(L.target.closest('[role="checkbox"]')||L.target.closest(".actions-cell")||L.target.closest('[role="menuitem"]'))||t==null||t(y)};return e.length?f.jsxs("div",{children:[m&&f.jsx(GIe,{isOpen:h,onClose:()=>{g(!1)},id:m.id}),f.jsxs("div",{className:"dm-card",children:[f.jsxs("div",{className:"dm-card-toolbar",children:[f.jsx("div",{className:"dm-card-toolbar-left",children:f.jsxs("div",{className:"dm-card-toolbar-search",children:[f.jsx(FS,{className:"dm-card-toolbar-search-icon"}),f.jsx(vn,{placeholder:"Search by title",value:(C=b.getColumn("title"))==null?void 0:C.getFilterValue(),onChange:y=>{var L;return(L=b.getColumn("title"))==null?void 0:L.setFilterValue(y.target.value)},className:"dm-card-toolbar-search-input"})]})}),f.jsx("div",{className:"dm-card-toolbar-right",children:f.jsxs(rt,{variant:"outline",className:"dm-card-toolbar-btn-primary",onClick:()=>{i==null||i()},children:[f.jsx(Gd,{className:"h-4 w-4"}),"New Storage"]})})]}),f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{className:"dm-card-table",role:"table","aria-label":"Storages table",children:[f.jsx(_C,{className:"dm-card-table-header",children:b.getHeaderGroups().map(y=>f.jsx(qr,{className:"dm-card-table-header-row",children:y.headers.map(L=>f.jsx(vC,{className:"[&:has([role=checkbox])]:pl-6 [&>[role=checkbox]]:translate-y-[2px]",style:L.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(L.getSize())}%`},children:L.isPlaceholder?null:jD(L.column.columnDef.header,L.getContext())},L.id))},y.id))}),f.jsx(bC,{className:"dm-card-table-body",children:b.getRowModel().rows.length?b.getRowModel().rows.map(y=>f.jsx(qr,{"data-state":y.getIsSelected()&&"selected",className:"dm-card-table-body-row group",onClick:L=>{const E=y.original.id;v(E,L)},children:y.getVisibleCells().map(L=>f.jsx(Rl,{className:`[&:has([role=checkbox])]pr-0 px-6 whitespace-normal [&>[role=checkbox]]:translate-y-[2px] ${L.column.id==="actions"?"actions-cell":""} ${L.column.id==="createdAt"?"whitespace-nowrap":""}`,style:L.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(L.column.getSize())}%`},children:jD(L.column.columnDef.cell,L.getContext())},L.id))},y.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:n.length+1,className:"dm-card-table-body-row-empty",children:"No results"})})})]})}),f.jsxs("div",{className:"dm-card-pagination",children:[f.jsx(rt,{variant:"outline",size:"sm",onClick:()=>{b.previousPage()},disabled:!b.getCanPreviousPage(),children:"Previous"}),f.jsx(rt,{variant:"outline",size:"sm",onClick:()=>{b.nextPage()},disabled:!b.getCanNextPage(),children:"Next"})]})]})]}):f.jsx("div",{className:"dm-card",children:f.jsx(Qht,{onOpenTypeDialog:i})})}const eft=({initialTypeDialogOpen:n=!1,onTypeDialogClose:e})=>{const[t,i]=x.useState(n),{dataStorages:s,currentDataStorage:r,clearCurrentDataStorage:o,fetchDataStorages:a,getDataStorageById:l,deleteDataStorage:c,createDataStorage:d}=ZH();x.useEffect(()=>{a()},[a]),x.useEffect(()=>{i(n)},[n]);const u=()=>{i(!1),e==null||e()},[h,g]=x.useState(!1),[m,b]=x.useState(!1),[v,C]=x.useState(null),[y,L]=x.useState(!1),[E,R]=x.useState(null),T=async B=>{try{const K=await d(B);u(),K!=null&&K.id&&(await l(K.id),g(!0))}catch(K){console.error("Failed to create storage:",K)}},N=B=>{R(B),L(!0)},I=()=>{L(!1),R(null)},M=async B=>{await l(B),g(!0)},P=B=>{C(B),b(!0)},H=async()=>{if(v)try{await c(v),await a()}catch(B){console.error("Failed to delete storage:",B)}finally{b(!1),C(null)}},j=async()=>{try{g(!1),await a()}catch(B){console.error("Failed to save storage:",B)}},V=()=>{g(!1),o()},W=s.map(B=>({id:B.id,title:B.title,type:B.type,createdAt:B.createdAt,modifiedAt:B.modifiedAt})),U=Xht({onViewDetails:N,onEdit:M,onDelete:P});return f.jsxs("div",{children:[f.jsx(Jht,{columns:U,data:W,onEdit:M,onOpenTypeDialog:()=>{i(!0)}}),f.jsx(GIe,{isOpen:y,onClose:I,id:E??""}),f.jsx(yNe,{isOpen:t,onClose:u,onSelect:T}),f.jsx(ITe,{isOpen:h,onClose:V,dataStorage:r,onSaveSuccess:()=>void j()}),f.jsx(Ma,{open:m,onOpenChange:b,title:"Delete Storage",description:"Are you sure you want to delete this storage? This action cannot be undone.",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{H()},onCancel:()=>{C(null)},variant:"destructive"})]})},tft=()=>{const[n,e]=x.useState(!1);return f.jsxs("div",{className:"dm-page",children:[f.jsx("header",{className:"dm-page-header",children:f.jsx("h1",{className:"dm-page-header-title",children:"Storages"})}),f.jsx("div",{className:"dm-page-content",children:f.jsx(sre,{children:f.jsx(eft,{initialTypeDialogOpen:n,onTypeDialogClose:()=>{e(!1)}})})})]})};function ift({onOpenTypeDialog:n}){return f.jsxs("div",{className:"dm-empty-state",children:[f.jsx(Mne,{className:"dm-empty-state-ico",strokeWidth:1}),f.jsx("h2",{className:"dm-empty-state-title",children:"Create your first Destination"}),f.jsx("p",{className:"dm-empty-state-subtitle",children:"A Destination combines your reporting tool and access credentials — both needed to deliver data from Data Marts to your reports and dashboards."}),f.jsxs(rt,{variant:"outline",onClick:n,children:[f.jsx(Gd,{className:"h-4 w-4"}),"New Destination"]})]})}function nft({columns:n,data:e,onEdit:t,onOpenTypeDialog:i}){var m;const{sorting:s,setSorting:r,columnVisibility:o,setColumnVisibility:a}=zS({columns:n,storageKeyPrefix:"data-destination-list"}),[l,c]=x.useState([]),[d,u]=x.useState({}),h=pC({data:e,columns:[...n],getCoreRowModel:gC(),getPaginationRowModel:OM(),onSortingChange:r,getSortedRowModel:WS(),onColumnFiltersChange:c,getFilteredRowModel:HR(),onColumnVisibilityChange:a,onRowSelectionChange:u,state:{sorting:s,columnFilters:l,columnVisibility:o,rowSelection:d},enableRowSelection:!0}),g=(b,v)=>{v.target instanceof HTMLElement&&(v.target.closest('[role="checkbox"]')||v.target.closest(".actions-cell")||v.target.closest('[role="menuitem"]'))||t==null||t(b)};return e.length?f.jsx("div",{children:f.jsxs("div",{className:"dm-card",children:[f.jsxs("div",{className:"dm-card-toolbar",children:[f.jsx("div",{className:"dm-card-toolbar-left",children:f.jsxs("div",{className:"dm-card-toolbar-search",children:[f.jsx(FS,{className:"dm-card-toolbar-search-icon"}),f.jsx(vn,{placeholder:"Search by title",value:(m=h.getColumn("title"))==null?void 0:m.getFilterValue(),onChange:b=>{var v;return(v=h.getColumn("title"))==null?void 0:v.setFilterValue(b.target.value)},className:"dm-card-toolbar-search-input"})]})}),f.jsx("div",{className:"dm-card-toolbar-right",children:f.jsxs(rt,{variant:"outline",className:"dm-card-toolbar-btn-primary",onClick:()=>{i==null||i()},children:[f.jsx(Gd,{className:"h-4 w-4"}),"New Destination"]})})]}),f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{className:"dm-card-table",role:"table","aria-label":"Destinations table",children:[f.jsx(_C,{className:"dm-card-table-header",children:h.getHeaderGroups().map(b=>f.jsx(qr,{className:"dm-card-table-header-row",children:b.headers.map(v=>f.jsx(vC,{className:"[&:has([role=checkbox])]:pl-6 [&>[role=checkbox]]:translate-y-[2px]",style:v.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(v.getSize())}%`},children:v.isPlaceholder?null:jD(v.column.columnDef.header,v.getContext())},v.id))},b.id))}),f.jsx(bC,{className:"dm-card-table-body",children:h.getRowModel().rows.length?h.getRowModel().rows.map(b=>f.jsx(qr,{"data-state":b.getIsSelected()&&"selected",className:"dm-card-table-body-row group",onClick:v=>{const C=b.original.id;g(C,v)},children:b.getVisibleCells().map(v=>f.jsx(Rl,{className:`[&:has([role=checkbox])]pr-0 px-6 whitespace-normal [&>[role=checkbox]]:translate-y-[2px] ${v.column.id==="actions"?"actions-cell":""} ${v.column.id==="createdAt"?"whitespace-nowrap":""}`,style:v.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(v.column.getSize())}%`},children:jD(v.column.columnDef.cell,v.getContext())},v.id))},b.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:n.length+1,className:"dm-card-table-body-row-empty",children:"No results"})})})]})}),f.jsxs("div",{className:"dm-card-pagination",children:[f.jsx(rt,{variant:"outline",size:"sm",onClick:()=>{h.previousPage()},disabled:!h.getCanPreviousPage(),children:"Previous"}),f.jsx(rt,{variant:"outline",size:"sm",onClick:()=>{h.nextPage()},disabled:!h.getCanNextPage(),children:"Next"})]})]})}):f.jsx("div",{className:"dm-card",children:f.jsx(ift,{onOpenTypeDialog:i})})}function toe(n){return"destinationSecretKey"in n}const sft=({id:n,type:e,credentials:t,onEdit:i,onDelete:s,onRotateSecretKey:r})=>{const[o,a]=x.useState(!1),l=()=>{if(t&&toe(t)){const u=Rse(t);navigator.clipboard.writeText(u),Rn.success("JSON Config copied to clipboard")}},c=e===St.LOOKER_STUDIO,d=t&&"destinationSecretKey"in t&&t.destinationSecretKey;return f.jsx(f.Fragment,{children:f.jsx("div",{className:"text-right",children:f.jsxs(Al,{open:o,onOpenChange:a,children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:`dm-card-table-body-row-actionbtn opacity-0 transition-opacity ${o?"opacity-100":"group-hover:opacity-100"}`,"aria-label":"Open menu",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsxs(Ol,{align:"end",children:[f.jsxs(wn,{onClick:()=>void(i==null?void 0:i(n)),children:[f.jsx(TR,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"Edit"})]}),c&&d&&f.jsxs(f.Fragment,{children:[f.jsx(Vd,{}),f.jsxs(wn,{onClick:l,children:[f.jsx(t2,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"Copy JSON Config"})]}),f.jsxs(wn,{onClick:()=>{r==null||r(n)},children:[f.jsx(nK,{className:"text-foreground h-4 w-4","aria-hidden":"true"}),f.jsx("span",{children:"Rotate Secret Key"})]})]}),f.jsx(Vd,{}),f.jsxs(wn,{onClick:()=>s==null?void 0:s(n),children:[f.jsx(Wh,{className:"h-4 w-4 text-red-600","aria-hidden":"true"}),f.jsx("span",{className:"text-red-600",children:"Delete"})]})]})]})})})},rft=({onEdit:n,onDelete:e,onRotateSecretKey:t}={})=>[{accessorKey:"title",size:50,header:({column:i})=>f.jsx(La,{column:i,children:"Title"}),cell:({row:i})=>{const s=i.getValue("title");return f.jsx("div",{className:"overflow-hidden text-ellipsis",children:s})}},{accessorKey:"type",size:30,header:({column:i})=>f.jsx(La,{column:i,children:"Type"}),cell:({row:i})=>{const s=i.getValue("type"),{displayName:r,icon:o}=Nc.getInfo(s);return f.jsxs("div",{className:"text-muted-foreground flex items-center gap-2",children:[f.jsx(o,{size:18}),r]})}},{accessorKey:"createdAt",size:20,sortDescFirst:!0,header:({column:i})=>f.jsx(La,{column:i,children:"Created at"}),cell:({row:i})=>{const s=i.getValue("createdAt"),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(s);return f.jsx("div",{className:"text-muted-foreground",children:r})}},{id:"actions",size:80,header:({table:i})=>f.jsx(BR,{table:i}),cell:({row:i})=>f.jsx(sft,{id:i.original.id,type:i.original.type,credentials:i.original.credentials,onEdit:n,onDelete:e,onRotateSecretKey:t})}];function oft(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"service-account-details",children:[f.jsx(is,{children:"How do I get a Service Account JSON key?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"To get the JSON key, you'll need to create or use an existing service account in Google Cloud."}),f.jsx("p",{className:"mb-2",children:"Here's what to do:"}),f.jsxs("ol",{className:"list-inside list-decimal space-y-2 text-sm",children:[f.jsxs("li",{children:["Go to"," ",f.jsx(ir,{href:"https://console.cloud.google.com/iam-admin/serviceaccounts",children:"Google Cloud Console"})," ","."]}),f.jsxs("li",{children:["Open ",f.jsx("strong",{children:"IAM & Admin → Service Accounts"}),"."]}),f.jsx("li",{children:"Create a new service account or select an existing one."}),f.jsxs("li",{children:["Open the Service Accounts page, go to the ",f.jsx("strong",{children:"Keys"})," tab, click"," ",f.jsx("strong",{children:"Add key"}),", and select ",f.jsx("strong",{children:"Create new key"}),"."]}),f.jsxs("li",{children:["Choose ",f.jsx("strong",{children:"JSON"})," format and click ",f.jsx("strong",{children:"Create"}),"."]}),f.jsx("li",{children:"Open the downloaded file, copy its entire content, and paste it into the field above."})]})]})]})})}function aft({form:n}){const[e,t]=x.useState(!1),i=()=>{t(!0),n.setValue("credentials.serviceAccount","",{shouldDirty:!0})},s=()=>{t(!1),n.resetField("credentials.serviceAccount")},r=n.watch("credentials.serviceAccount"),o=r?xRe(r):null;return f.jsx(fn,{control:n.control,name:"credentials.serviceAccount",render:({field:a})=>f.jsxs(tn,{children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(Ji,{tooltip:"Paste a JSON key from a service account that has access to the selected destination provider",children:"Service Account"}),!e&&r&&f.jsx(rt,{variant:"ghost",size:"sm",onClick:i,type:"button",children:"Edit"}),e&&f.jsx(rt,{variant:"ghost",size:"sm",onClick:s,type:"button",children:"Cancel"})]}),f.jsx(cn,{children:!e&&o?f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx(ir,{href:o.url,children:o.email})}),f.jsx(kn,{children:f.jsx("p",{children:"View in Google Cloud Console"})})]}):f.jsx(Hp,{...a,className:"min-h-[150px] font-mono",rows:8,placeholder:"Paste your service account JSON here"})}),f.jsx(Hs,{children:f.jsx(oft,{})}),f.jsx(Cn,{})]})})}function lft(){return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsxs(ts,{value:"json-config-details",children:[f.jsx(is,{children:"What is the JSON Config for Looker Studio?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"The JSON Config contains the necessary credentials and configuration for connecting to Looker Studio."}),f.jsxs("ul",{className:"list-inside space-y-2 text-sm",children:[f.jsx("li",{children:"You need to copy this JSON config to use it in the Looker Studio Connector."}),f.jsx("li",{children:"If you need to rotate a previous secret key, you can use the corresponding function in the menu on the destinations list."})]})]})]})})}function cft({form:n}){const e=n.getValues("credentials"),t=x.useMemo(()=>e&&toe(e)?e:{deploymentUrl:"",destinationId:"",destinationSecretKey:""},[e]),i=x.useMemo(()=>Rse(t),[t]);return f.jsx(f.Fragment,{children:t.destinationSecretKey&&f.jsx(fn,{control:n.control,name:"credentials.destinationSecretKey",render:()=>f.jsxs(tn,{children:[f.jsx(Ji,{children:"JSON Config"}),f.jsx(cn,{children:f.jsx(eDe,{value:i,displayOnly:!0,keysToMask:["destinationSecretKey"],className:"bg-muted overflow-auto rounded-md text-sm",showCopyButton:!0})}),f.jsx(Cn,{}),f.jsx(Hs,{children:f.jsx(lft,{})})]})})})}const qIe="credentials.to",dft=/[,;\n]/,uft=", ",KIe="Enter emails separated by comma, semicolon or newline",hft="Emails list";function u_e(n){const e=new Set,t=[];for(const i of n.split(dft)){const s=i.trim();if(!s)continue;const r=s.toLowerCase();e.has(r)||(e.add(r),t.push(s))}return t}function f$(n){return n.join(uft)}function h_e(n,e){n.setValue(qIe,e,{shouldDirty:!0,shouldTouch:!0})}function fft({field:n,form:e}){const t=Array.isArray(n.value)?f$(n.value):"",[i,s]=x.useState(t),[r,o]=x.useState(!1),a=Array.isArray(n.value)?f$(n.value):"";x.useEffect(()=>{r||s(a)},[a,r]);const l=u=>{const h=u.target.value;s(h),h_e(e,u_e(h))},c=()=>{o(!0)},d=u=>{o(!1),n.onBlur();const h=u_e(u.target.value);h_e(e,h),s(f$(h))};return f.jsx(Hp,{name:n.name,ref:n.ref,onFocus:c,onBlur:d,value:i,onChange:l,className:"min-h-[150px] font-mono",rows:8,placeholder:KIe})}function C4({form:n,emailsFieldTitle:e=hft}){return f.jsx(fn,{control:n.control,name:qIe,render:({field:t})=>f.jsxs(tn,{children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsx(Ji,{tooltip:KIe,children:e})}),f.jsx(cn,{children:f.jsx(fft,{field:t,form:n})}),f.jsx(Cn,{})]})})}function gft(){return f.jsxs(ts,{value:"sheets-api-details",children:[f.jsx(is,{children:"How do I enable the Google Sheets API?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send data to Google Sheets, you need to enable the"," ",f.jsx(ir,{href:"https://console.cloud.google.com/apis/library/sheets.googleapis.com",children:"Google Sheets API"})," ","in your Google Cloud project."]}),f.jsx("p",{className:"mb-2",children:"Here's how to do it:"}),f.jsxs("ol",{className:"list-inside list-decimal space-y-2 text-sm",children:[f.jsx("li",{children:"Open the link above and make sure the correct project is selected."}),f.jsxs("li",{children:["If the API isn't enabled yet, click ",f.jsx("strong",{children:"Enable"}),"."]}),f.jsx("li",{children:"If it's already enabled, you'll see the API dashboard — that's fine."})]})]})]})}function pft(){return f.jsxs(ts,{value:"looker-studio-details",children:[f.jsx(is,{children:"How do I connect to Looker Studio?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send data to Looker Studio, you need to provide a deployment URL that the"," ",f.jsx(ir,{className:"p-0",href:"https://datastudio.google.com/datasources/create?connectorId=AKfycbz6kcYn3qGuG0jVNFjcDnkXvVDiz4hewKdAFjOm-_d4VkKVcBidPjqZO991AvGL3FtM4A",children:"Looker Studio connector"})," ","will use to access your data."]}),f.jsx("p",{className:"mb-2",children:"Make sure the deployment URL is accessible from the internet and properly secured."}),f.jsx(ir,{className:"p-0",href:"https://docs.owox.com/docs/destinations/supported-destinations/looker-studio/?utm_source=owox_data_marts&utm_medium=destination_enity&utm_campaign=tooltip",children:"Learn more"})]})]})}function mft(){return f.jsxs(ts,{value:"odata-details",children:[f.jsx(is,{children:"How do I use OData?"}),f.jsxs(ns,{children:[f.jsx("p",{className:"mb-2",children:"OData (Open Data Protocol) is an ISO/IEC approved, OASIS standard that defines a set of best practices for building and consuming RESTful APIs."}),f.jsx("p",{className:"mb-2",children:"This feature is coming soon."})]})]})}function _ft(){return f.jsxs(ts,{value:"email-details",children:[f.jsx(is,{children:"How do I start sending Email?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send reports by email, first configure the ",f.jsx("strong",{children:"Email"})," destination in this form (add a title and specify recipient addresses). Then, go to your Data Mart page, open the ",f.jsx("strong",{children:"Destinations"})," tab, and create a report in the Email block."]}),f.jsx("p",{className:"mb-2",children:"In the report settings, add a subject and message, and set the delivery conditions. The generated report will be delivered by OWOX Data Marts to the selected addresses as formatted text."}),f.jsxs("p",{className:"mb-2",children:["For more details, read the"," ",f.jsx(ir,{className:"underline",href:"https://docs.owox.com/docs/destinations/supported-destinations/email/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=tooltip-email",children:"OWOX documentation"}),"."]})]})]})}function bft(){return f.jsxs(ts,{value:"slack-details",children:[f.jsx(is,{children:"How do I start sending to Slack?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send reports to Slack, first configure the ",f.jsx("strong",{children:"Slack"})," destination in this form (add a title and specify recipient addresses). Then, go to your Data Mart page, open the ",f.jsx("strong",{children:"Destinations"})," tab, and create a report in the Slack block."]}),f.jsx("p",{className:"mb-2",children:"In the report settings, add a subject and message, and set the delivery conditions. The generated report will be delivered by OWOX Data Marts to the selected channel as a message."}),f.jsxs("p",{className:"mb-2",children:["For more details, read the"," ",f.jsx(ir,{className:"underline",href:"https://docs.owox.com/docs/destinations/supported-destinations/slack/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=tooltip-slack",children:"OWOX documentation"}),"."]})]})]})}function vft(){return f.jsxs(ts,{value:"msteams-details",children:[f.jsx(is,{children:"How do I start sending to Microsoft Teams?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send reports to Microsoft Teams, first configure the ",f.jsx("strong",{children:"Microsoft Teams"})," ","destination in this form (add a title and specify recipient addresses). Then, go to your Data Mart page, open the ",f.jsx("strong",{children:"Destinations"})," tab, and create a report in the Microsoft Teams block."]}),f.jsx("p",{className:"mb-2",children:"In the report settings, add a subject and message, and set the delivery conditions. The generated report will be delivered by OWOX Data Marts to the selected channel as a message."}),f.jsxs("p",{className:"mb-2",children:["For more details, read the"," ",f.jsx(ir,{className:"underline",href:"https://docs.owox.com/docs/destinations/supported-destinations/microsoft-teams/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=tooltip-microsoft-teams",children:"OWOX documentation"}),"."]})]})]})}function Cft(){return f.jsxs(ts,{value:"googlechat-details",children:[f.jsx(is,{children:"How do I start sending to Google Chat?"}),f.jsxs(ns,{children:[f.jsxs("p",{className:"mb-2",children:["To send reports to Google Chat, first configure the ",f.jsx("strong",{children:"Google Chat"})," ","destination in this form (add a title and specify recipient addresses). Then, go to your Data Mart page, open the ",f.jsx("strong",{children:"Destinations"})," tab, and create a report in the Google Chat block."]}),f.jsx("p",{className:"mb-2",children:"In the report settings, add a subject and message, and set the delivery conditions. The generated report will be delivered by OWOX Data Marts to the connected space as chat messages."}),f.jsxs("p",{className:"mb-2",children:["For more details, read the"," ",f.jsx(ir,{className:"underline",href:"https://docs.owox.com/docs/destinations/supported-destinations/google-chat/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=tooltip-google-chat",children:"OWOX documentation"}),"."]})]})]})}const wft={[St.GOOGLE_SHEETS]:gft,[St.LOOKER_STUDIO]:pft,[St.ODATA]:mft,[St.EMAIL]:_ft,[St.SLACK]:bft,[St.MS_TEAMS]:vft,[St.GOOGLE_CHAT]:Cft};function yft({destinationType:n}){const e=wft[n];return f.jsx(sr,{variant:"common",type:"single",collapsible:!0,children:f.jsx(e,{})})}function Sft({form:n,initialData:e}){const{flags:t}=EM();return f.jsx(fn,{control:n.control,name:"type",render:({field:i})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Select the destination to send your data",children:"Destination Type"}),f.jsxs($c,{onValueChange:i.onChange,defaultValue:i.value,disabled:!!e,children:[f.jsx(cn,{children:f.jsx(qc,{className:"w-full",children:f.jsx(Gc,{placeholder:"Select a destination type"})})}),f.jsx(Kc,{children:f.jsx(KH,{children:Nc.getAllTypes().map(({type:s,displayName:r,icon:o,status:a})=>{const l=a===uf.COMING_SOON,c=a===uf.CLOUD_ONLY&&xit(t);return f.jsx(f.Fragment,{children:c?f.jsxs(Tn,{children:[f.jsx(In,{asChild:!0,children:f.jsx("div",{children:f.jsx(fo,{value:s,disabled:!0,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(o,{size:18}),r,f.jsx(Ya,{variant:"secondary",children:"Cloud & Enterprise"})]})},s)})}),f.jsxs(kn,{side:"left",align:"start",className:"w-[220px]",children:["Available only in"," ",f.jsxs(Vc,{className:"inline-flex items-center gap-1 underline",target:"_blank",to:"https://docs.owox.com/docs/editions/owox-cloud-editions/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=unavailable_select_item_tooltip",children:["Cloud edition",f.jsx(F_,{className:"h-3 w-3"})]})," ","or with"," ",f.jsxs(Vc,{className:"inline-flex items-center gap-1 underline",target:"_blank",to:"https://docs.owox.com/docs/editions/self-managed-editions/?utm_source=owox_data_marts&utm_medium=destination_entity&utm_campaign=unavailable_select_item_tooltip",children:["an Enterprise plan",f.jsx(F_,{className:"h-3 w-3"})]}),"."]})]}):f.jsx(fo,{value:s,disabled:l,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(o,{size:18}),r,l&&f.jsx(Ya,{variant:"outline",children:a})]})},s)})})})})]}),f.jsx(Hs,{children:f.jsx(yft,{destinationType:i.value})}),f.jsx(Cn,{})]})})}function xft({initialData:n,onSubmit:e,onCancel:t,onDirtyChange:i}){const s=Bp({resolver:pb(yJe),defaultValues:n??{title:"New Destination",type:St.GOOGLE_SHEETS},mode:"onTouched"}),r=s.watch("type");x.useEffect(()=>{i==null||i(s.formState.isDirty)},[s.formState.isDirty,i]);const o=async a=>{const{dirtyFields:l}=s.formState,c=SRe(a);return l.credentials||delete c.credentials,e(c)};return f.jsx(CC,{...s,children:f.jsxs(gb,{onSubmit:a=>{s.handleSubmit(o)(a)},children:[f.jsxs(wC,{children:[f.jsx(fn,{control:s.control,name:"title",render:({field:a})=>f.jsxs(tn,{children:[f.jsx(Ji,{tooltip:"Name the destination to clarify its purpose",children:"Title"}),f.jsx(cn,{children:f.jsx(vn,{placeholder:"Enter title",...a})}),f.jsx(Cn,{})]})}),f.jsx(Sft,{form:s,initialData:n}),r===St.GOOGLE_SHEETS&&f.jsx(aft,{form:s}),r===St.LOOKER_STUDIO&&f.jsx(cft,{form:s}),r===St.EMAIL&&f.jsx(C4,{form:s,emailsFieldTitle:"Enter user emails list"}),r===St.SLACK&&f.jsx(C4,{form:s,emailsFieldTitle:"Enter Slack channel emails list"}),r===St.MS_TEAMS&&f.jsx(C4,{form:s,emailsFieldTitle:"Enter Microsoft Teams channel emails list"}),r===St.GOOGLE_CHAT&&f.jsx(C4,{form:s,emailsFieldTitle:"Enter Google Chat channel emails list"})]}),f.jsxs(yC,{children:[f.jsxs(rt,{variant:"default",type:"submit",className:"w-full","aria-label":"Save",disabled:!s.formState.isDirty||s.formState.isSubmitting,children:[s.formState.isSubmitting&&f.jsx(NR,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]}),f.jsx(rt,{variant:"outline",type:"button",onClick:t,className:"w-full","aria-label":"Cancel",children:"Cancel"})]})]})})}function Lft({isOpen:n,onClose:e,dataDestination:t,onSaveSuccess:i}){const{updateDataDestination:s,createDataDestination:r}=MM(),[o,a]=x.useState(!1),[l,c]=x.useState(!1),d=x.useCallback(()=>{l?a(!0):e()},[l,e]),u=x.useCallback(()=>{a(!1),c(!1),e()},[e]),h=x.useCallback(b=>{c(b)},[]),g=async b=>{const v=FDe.getMapper(b.type);if(t){const C=v.mapToUpdateRequest(b),y=await s(t.id,C);y&&i(y)}else{const C=v.mapToCreateRequest(b),y=await r(C);y&&i(y)}e()},m=x.useRef(!1);return x.useEffect(()=>{const b=t?"Edit":"Create";n&&!m.current?(Vt({event:"data_destination_config_open",category:"DataDestination",action:b,label:t==null?void 0:t.type}),m.current=!0):!n&&m.current&&(Vt({event:"data_destination_config_close",category:"DataDestination",action:b,label:t==null?void 0:t.type}),m.current=!1)},[n,t]),f.jsxs(f.Fragment,{children:[f.jsx(ab,{open:n,onOpenChange:b=>{b||d()},children:f.jsxs(lb,{children:[f.jsxs(cb,{children:[f.jsx(db,{children:"Configure destination"}),f.jsx(cC,{children:"Customize settings for your destination"})]}),f.jsx(xft,{initialData:t??void 0,onSubmit:g,onCancel:d,onDirtyChange:h})]})}),f.jsx(Ma,{open:o,onOpenChange:a,title:"Unsaved Changes",description:"You have unsaved changes. Exit without saving?",confirmLabel:"Yes, leave now",cancelLabel:"No, stay here",onConfirm:u,variant:"destructive"})]})}const Eft=({isCreateSheetInitiallyOpen:n=!1,onCreateSheetClose:e})=>{const{dataDestinations:t,currentDataDestination:i,clearCurrentDataDestination:s,fetchDataDestinations:r,getDataDestinationById:o,deleteDataDestination:a,rotateSecretKey:l}=MM(),c=x.useCallback(()=>{s(),u(!0),e==null||e()},[s,e]),[d,u]=x.useState(!1),[h,g]=x.useState(!1),[m,b]=x.useState(!1),[v,C]=x.useState(null),[y,L]=x.useState(null);x.useEffect(()=>{r()},[r]),x.useEffect(()=>{n&&c()},[n,c]);const E=async V=>{await o(V),u(!0)},R=V=>{C(V),g(!0)},T=V=>{L(V),b(!0)},N=async()=>{if(y)try{const V=await l(y);if(toe(V.credentials)){Rn.success("New JSON Config copied to clipboard");const W=Rse(V.credentials);navigator.clipboard.writeText(W)}await r()}catch(V){console.error("Failed to rotate secret key:",V)}finally{b(!1),L(null)}},I=async()=>{if(v)try{await a(v),await r()}catch(V){console.error("Failed to delete destination:",V)}finally{g(!1),C(null)}},M=async()=>{try{u(!1),await r()}catch(V){console.error("Failed to save destination:",V)}},P=()=>{u(!1),s()},H=t.map(V=>({id:V.id,title:V.title,type:V.type,createdAt:V.createdAt,modifiedAt:V.modifiedAt,credentials:V.credentials})),j=rft({onEdit:E,onDelete:R,onRotateSecretKey:T});return f.jsxs("div",{children:[f.jsx(nft,{columns:j,data:H,onEdit:E,onDelete:R,onRotateSecretKey:T,onOpenTypeDialog:c}),f.jsx(Lft,{isOpen:d,onClose:P,dataDestination:i,onSaveSuccess:()=>void M()}),f.jsx(Ma,{open:h,onOpenChange:g,title:"Delete Destination",description:"Are you sure you want to delete this destination? This action cannot be undone.",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{I()},onCancel:()=>{C(null)},variant:"destructive"}),f.jsx(Ma,{open:m,onOpenChange:b,title:"Rotate Secret Key",description:"Rotating the secret key will invalidate the previous key",confirmLabel:"Rotate Key",cancelLabel:"Cancel",onConfirm:()=>void N(),onCancel:()=>{b(!1)},variant:"destructive",children:f.jsxs("div",{className:"text-sm",children:[f.jsx("p",{className:"mb-2",children:"After rotation, you will need to:"}),f.jsxs("ol",{className:"mb-2 list-decimal pl-5",children:[f.jsx("li",{children:"The new JSON Config will be automatically copied to your clipboard"}),f.jsx("li",{children:"Go to your Looker Studio Connector"}),f.jsx("li",{children:"Update the configuration with the new JSON Config"}),f.jsx("li",{children:"Save the changes to restore access to your data marts"})]}),f.jsx("p",{className:"font-semibold",children:"Are you sure you want to rotate the secret key?"})]})})]})},Dft=()=>{const[n,e]=x.useState(!1);return f.jsxs("div",{className:"dm-page",children:[f.jsx("header",{className:"dm-page-header",children:f.jsx("h1",{className:"dm-page-header-title",children:"Destinations"})}),f.jsx("div",{className:"dm-page-content",children:f.jsx(AM,{children:f.jsx(Eft,{isCreateSheetInitiallyOpen:n,onCreateSheetClose:()=>{e(!1)}})})})]})};function l5({className:n,...e}){return f.jsx("div",{"data-slot":"empty",className:Le("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",n),...e})}function c5({className:n,...e}){return f.jsx("div",{"data-slot":"empty-header",className:Le("flex max-w-sm flex-col items-center gap-2 text-center",n),...e})}const Rft=RR("flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function d5({className:n,variant:e="default",...t}){return f.jsx("div",{"data-slot":"empty-icon","data-variant":e,className:Le(Rft({variant:e,className:n})),...t})}function u5({className:n,...e}){return f.jsx("div",{"data-slot":"empty-title",className:Le("text-lg font-medium tracking-tight",n),...e})}function h5({className:n,...e}){return f.jsx("div",{"data-slot":"empty-description",className:Le("text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",n),...e})}function Nft({className:n,...e}){return f.jsx("div",{"data-slot":"empty-content",className:Le("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",n),...e})}const Tft=()=>{const n=PS(),{createInsight:e,insightLoading:t}=Jre(),i=()=>{(async()=>{const s=await e({title:"Untitled insight"});s&&n(s.id)})()};return f.jsxs(l5,{children:[f.jsxs(c5,{children:[f.jsx(d5,{variant:"icon",children:f.jsx(nxe,{})}),f.jsx(u5,{children:"No Insights Yet"}),f.jsx(h5,{children:"You haven't created any insights yet. Get started by creating your first insight."})]}),f.jsx(Nft,{children:f.jsx("div",{className:"flex gap-2",children:f.jsx(rt,{onClick:i,disabled:t,children:"Create Insight"})})}),f.jsx(rt,{variant:"link",asChild:!0,className:"text-muted-foreground",size:"sm",children:f.jsxs("a",{href:"#",children:["Learn More ",f.jsx(_He,{})]})})]})},Ift=({onDelete:n}={})=>[{accessorKey:"title",size:50,header:({column:e})=>f.jsx(La,{column:e,children:"Title"}),cell:({row:e})=>{const t=e.getValue("title");return f.jsx("div",{className:"overflow-hidden text-ellipsis",children:t})},meta:{title:"Title"}},{accessorKey:"lastUpdated",size:50,sortDescFirst:!0,header:({column:e})=>f.jsx(La,{column:e,children:"Last updated"}),cell:({row:e})=>{const t=e.getValue("lastUpdated"),i=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t);return f.jsx("div",{className:"text-muted-foreground",children:i})},meta:{title:"Last updated"}},{id:"actions",size:80,header:({table:e})=>f.jsx(BR,{table:e}),cell:({row:e})=>f.jsx("div",{className:"actions-cell text-right",onClick:t=>{t.stopPropagation()},children:f.jsxs(Al,{children:[f.jsx(Ml,{asChild:!0,children:f.jsx(rt,{variant:"ghost",className:"dm-card-table-body-row-actionbtn opacity-0 transition-opacity group-hover:opacity-100","aria-label":"Open menu",children:f.jsx(ig,{className:"dm-card-table-body-row-actionbtn-icon"})})}),f.jsx(Ol,{align:"end",children:f.jsxs(wn,{className:"text-destructive",onClick:()=>n==null?void 0:n(e.original.id),children:[f.jsx(Wh,{className:"mr-2 h-4 w-4 text-red-600"}),f.jsx("span",{className:"text-red-600",children:"Delete insight"})]})})]})}),meta:{title:"Actions"}}];function kft({items:n,onRowClick:e,onDelete:t}){const i=x.useMemo(()=>Ift({onDelete:t}),[t]),{sorting:s,setSorting:r,columnVisibility:o,setColumnVisibility:a}=zS({columns:i,storageKeyPrefix:"data-mart-insights",defaultSortingColumn:"lastUpdated"}),l=pC({data:n,columns:i,getCoreRowModel:gC(),getPaginationRowModel:OM(),onSortingChange:r,getSortedRowModel:WS(),getFilteredRowModel:HR(),state:{sorting:s,columnVisibility:o},onColumnVisibilityChange:a,enableGlobalFilter:!0,enableColumnResizing:!1}),c=x.useCallback(()=>{l.previousPage()},[l]),d=x.useCallback(()=>{l.nextPage()},[l]);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"dm-card-table-wrap",children:f.jsxs(mC,{id:"insights-table",className:"dm-card-table",role:"table","aria-label":"Insights",children:[f.jsx(_C,{className:"dm-card-table-header",children:l.getHeaderGroups().map(h=>f.jsx(qr,{className:"dm-card-table-header-row",children:h.headers.map(g=>f.jsx(vC,{className:"[&:has([role=checkbox])]:pl-6 [&>[role=checkbox]]:translate-y-[2px]",scope:"col",style:g.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(g.getSize())}%`},children:g.isPlaceholder?null:typeof g.column.columnDef.header=="function"?g.column.columnDef.header(g.getContext()):g.column.columnDef.header},g.id))},h.id))}),f.jsx(bC,{className:"dm-card-table-body",children:l.getRowModel().rows.length?l.getRowModel().rows.map((h,g)=>f.jsx(qr,{onClick:()=>{e(h.original.id)},className:"dm-card-table-body-row group cursor-pointer",role:"row","aria-rowindex":g+1,children:h.getVisibleCells().map((m,b)=>f.jsx(Rl,{className:`whitespace-normal ${m.column.id==="actions"?"actions-cell":""}`,role:"cell","aria-colindex":b+1,style:m.column.id==="actions"?{width:80,minWidth:80,maxWidth:80}:{width:`${String(m.column.getSize())}%`},children:typeof m.column.columnDef.cell=="function"?m.column.columnDef.cell(m.getContext()):m.column.columnDef.cell},m.id))},h.id)):f.jsx(qr,{children:f.jsx(Rl,{colSpan:i.length,className:"dm-card-table-body-row-empty",role:"cell",children:f.jsx("span",{role:"status","aria-live":"polite",children:"No insights found."})})})})]})}),f.jsxs("div",{className:"dm-card-pagination",role:"navigation","aria-label":"Table pagination",children:[f.jsx(rt,{variant:"outline",size:"sm",onClick:c,disabled:!l.getCanPreviousPage(),"aria-label":"Go to previous page",children:"Previous"}),f.jsx(rt,{variant:"outline",size:"sm",onClick:d,disabled:!l.getCanNextPage(),"aria-label":"Go to next page",children:"Next"})]})]})}function Aft(){const n=PS(),{fetchInsights:e,deleteInsight:t,createInsight:i,insightLoading:s}=Jre(),{insights:r,isLoading:o,error:a,hasInsights:l}=Rht(),[c,d]=x.useState(null);x.useEffect(()=>{e()},[e]);const u=m=>{n(m)},h=()=>{(async()=>{const m=await i({title:"Untitled insight"});m&&n(m.id)})()},g=()=>{(async()=>{if(c)try{await t(c)}finally{d(null)}})()};return f.jsxs(c1,{children:[f.jsxs(fp,{children:[f.jsx(hp,{tooltip:"Manage and review your insights",icon:nxe,children:"Insights"}),f.jsx($M,{children:f.jsxs(rt,{variant:"outline","aria-label":"Add new insight",disabled:s,onClick:h,children:[f.jsx(Gd,{className:"h-4 w-4","aria-hidden":"true"}),"New insight"]})})]}),f.jsxs(gp,{children:[o&&!l?f.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading insights…"}):a?f.jsx("div",{className:"text-destructive p-4 text-sm",children:"Failed to load insights"}):l?f.jsx(kft,{items:r.map(m=>({id:m.id,title:m.title,lastUpdated:m.modifiedAt})),onRowClick:u,onDelete:m=>{d(m)}}):f.jsx(Tft,{}),f.jsx(Ma,{open:!!c,onOpenChange:m=>{m||d(null)},title:"Delete Insight",description:"Are you sure you want to delete this insight? This action cannot be undone.",confirmLabel:"Delete",cancelLabel:"Cancel",variant:"destructive",onConfirm:g})]}),f.jsx(E_,{})]})}function Mft(){return f.jsx(UIe,{children:f.jsx(Aft,{})})}const lB=x.createContext(null);lB.displayName="PanelGroupContext";const Eo={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},ioe=10,Dy=x.useLayoutEffect,f_e=Qj.useId,Oft=typeof f_e=="function"?f_e:()=>null;let Pft=0;function noe(n=null){const e=Oft(),t=x.useRef(n||e||null);return t.current===null&&(t.current=""+Pft++),n??t.current}function ZIe({children:n,className:e="",collapsedSize:t,collapsible:i,defaultSize:s,forwardedRef:r,id:o,maxSize:a,minSize:l,onCollapse:c,onExpand:d,onResize:u,order:h,style:g,tagName:m="div",...b}){const v=x.useContext(lB);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:C,expandPanel:y,getPanelSize:L,getPanelStyle:E,groupId:R,isPanelCollapsed:T,reevaluatePanelConstraints:N,registerPanel:I,resizePanel:M,unregisterPanel:P}=v,H=noe(o),j=x.useRef({callbacks:{onCollapse:c,onExpand:d,onResize:u},constraints:{collapsedSize:t,collapsible:i,defaultSize:s,maxSize:a,minSize:l},id:H,idIsFromProps:o!==void 0,order:h});x.useRef({didLogMissingDefaultSizeWarning:!1}),Dy(()=>{const{callbacks:W,constraints:U}=j.current,B={...U};j.current.id=H,j.current.idIsFromProps=o!==void 0,j.current.order=h,W.onCollapse=c,W.onExpand=d,W.onResize=u,U.collapsedSize=t,U.collapsible=i,U.defaultSize=s,U.maxSize=a,U.minSize=l,(B.collapsedSize!==U.collapsedSize||B.collapsible!==U.collapsible||B.maxSize!==U.maxSize||B.minSize!==U.minSize)&&N(j.current,B)}),Dy(()=>{const W=j.current;return I(W),()=>{P(W)}},[h,H,I,P]),x.useImperativeHandle(r,()=>({collapse:()=>{C(j.current)},expand:W=>{y(j.current,W)},getId(){return H},getSize(){return L(j.current)},isCollapsed(){return T(j.current)},isExpanded(){return!T(j.current)},resize:W=>{M(j.current,W)}}),[C,y,L,T,H,M]);const V=E(j.current,s);return x.createElement(m,{...b,children:n,className:e,id:H,style:{...V,...g},[Eo.groupId]:R,[Eo.panel]:"",[Eo.panelCollapsible]:i||void 0,[Eo.panelId]:H,[Eo.panelSize]:parseFloat(""+V.flexGrow).toFixed(1)})}const YIe=x.forwardRef((n,e)=>x.createElement(ZIe,{...n,forwardedRef:e}));ZIe.displayName="Panel";YIe.displayName="forwardRef(Panel)";let oZ=null,f5=-1,xv=null;function Fft(n,e,t){const i=(e&tke)!==0,s=(e&ike)!==0,r=(e&nke)!==0,o=(e&ske)!==0;if(e){if(i)return r?"se-resize":o?"ne-resize":"e-resize";if(s)return r?"sw-resize":o?"nw-resize":"w-resize";if(r)return"s-resize";if(o)return"n-resize"}switch(n){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function jft(){xv!==null&&(document.head.removeChild(xv),oZ=null,xv=null,f5=-1)}function g$(n,e,t){var i,s;const r=Fft(n,e);if(oZ!==r){if(oZ=r,xv===null&&(xv=document.createElement("style"),document.head.appendChild(xv)),f5>=0){var o;(o=xv.sheet)===null||o===void 0||o.removeRule(f5)}f5=(i=(s=xv.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${r} !important;}`))!==null&&i!==void 0?i:-1}}function XIe(n){return n.type==="keydown"}function QIe(n){return n.type.startsWith("pointer")}function JIe(n){return n.type.startsWith("mouse")}function cB(n){if(QIe(n)){if(n.isPrimary)return{x:n.clientX,y:n.clientY}}else if(JIe(n))return{x:n.clientX,y:n.clientY};return{x:1/0,y:1/0}}function Hft(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Bft(n,e,t){return n.x<e.x+e.width&&n.x+n.width>e.x&&n.y<e.y+e.height&&n.y+n.height>e.y}function Vft(n,e){if(n===e)throw new Error("Cannot compare node with itself");const t={a:m_e(n),b:m_e(e)};let i;for(;t.a.at(-1)===t.b.at(-1);)n=t.a.pop(),e=t.b.pop(),i=n;bn(i,"Stacking order can only be calculated for elements with a common ancestor");const s={a:p_e(g_e(t.a)),b:p_e(g_e(t.b))};if(s.a===s.b){const r=i.childNodes,o={a:t.a.at(-1),b:t.b.at(-1)};let a=r.length;for(;a--;){const l=r[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(s.a-s.b)}const Wft=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function zft(n){var e;const t=getComputedStyle((e=eke(n))!==null&&e!==void 0?e:n).display;return t==="flex"||t==="inline-flex"}function Uft(n){const e=getComputedStyle(n);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||zft(n))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Wft.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function g_e(n){let e=n.length;for(;e--;){const t=n[e];if(bn(t,"Missing node"),Uft(t))return t}return null}function p_e(n){return n&&Number(getComputedStyle(n).zIndex)||0}function m_e(n){const e=[];for(;n;)e.push(n),n=eke(n);return e}function eke(n){const{parentNode:e}=n;return e&&e instanceof ShadowRoot?e.host:e}const tke=1,ike=2,nke=4,ske=8,$ft=Hft()==="coarse";let Of=[],HE=!1,Lv=new Map,dB=new Map;const m2=new Set;function Gft(n,e,t,i,s){var r;const{ownerDocument:o}=e,a={direction:t,element:e,hitAreaMargins:i,setResizeHandlerState:s},l=(r=Lv.get(o))!==null&&r!==void 0?r:0;return Lv.set(o,l+1),m2.add(a),$F(),function(){var d;dB.delete(n),m2.delete(a);const u=(d=Lv.get(o))!==null&&d!==void 0?d:1;if(Lv.set(o,u-1),$F(),u===1&&Lv.delete(o),Of.includes(a)){const h=Of.indexOf(a);h>=0&&Of.splice(h,1),uB(),s("up",!0,null)}}}function qft(n){const{target:e}=n,{x:t,y:i}=cB(n);HE=!0,soe({target:e,x:t,y:i}),$F(),Of.length>0&&(GF("down",n),uB(),n.preventDefault(),rke(e)||n.stopImmediatePropagation())}function p$(n){const{x:e,y:t}=cB(n);if(HE&&n.type!=="pointerleave"&&n.buttons===0&&(HE=!1,GF("up",n)),!HE){const{target:i}=n;soe({target:i,x:e,y:t})}GF("move",n),uB(),Of.length>0&&n.preventDefault()}function m$(n){const{target:e}=n,{x:t,y:i}=cB(n);dB.clear(),HE=!1,Of.length>0&&(n.preventDefault(),rke(e)||n.stopImmediatePropagation()),GF("up",n),soe({target:e,x:t,y:i}),uB(),$F()}function rke(n){let e=n;for(;e;){if(e.hasAttribute(Eo.resizeHandle))return!0;e=e.parentElement}return!1}function soe({target:n,x:e,y:t}){Of.splice(0);let i=null;(n instanceof HTMLElement||n instanceof SVGElement)&&(i=n),m2.forEach(s=>{const{element:r,hitAreaMargins:o}=s,a=r.getBoundingClientRect(),{bottom:l,left:c,right:d,top:u}=a,h=$ft?o.coarse:o.fine;if(e>=c-h&&e<=d+h&&t>=u-h&&t<=l+h){if(i!==null&&document.contains(i)&&r!==i&&!r.contains(i)&&!i.contains(r)&&Vft(i,r)>0){let m=i,b=!1;for(;m&&!m.contains(r);){if(Bft(m.getBoundingClientRect(),a)){b=!0;break}m=m.parentElement}if(b)return}Of.push(s)}})}function _$(n,e){dB.set(n,e)}function uB(){let n=!1,e=!1;Of.forEach(i=>{const{direction:s}=i;s==="horizontal"?n=!0:e=!0});let t=0;dB.forEach(i=>{t|=i}),n&&e?g$("intersection",t):n?g$("horizontal",t):e?g$("vertical",t):jft()}let b$;function $F(){var n;(n=b$)===null||n===void 0||n.abort(),b$=new AbortController;const e={capture:!0,signal:b$.signal};m2.size&&(HE?(Of.length>0&&Lv.forEach((t,i)=>{const{body:s}=i;t>0&&(s.addEventListener("contextmenu",m$,e),s.addEventListener("pointerleave",p$,e),s.addEventListener("pointermove",p$,e))}),Lv.forEach((t,i)=>{const{body:s}=i;s.addEventListener("pointerup",m$,e),s.addEventListener("pointercancel",m$,e)})):Lv.forEach((t,i)=>{const{body:s}=i;t>0&&(s.addEventListener("pointerdown",qft,e),s.addEventListener("pointermove",p$,e))}))}function GF(n,e){m2.forEach(t=>{const{setResizeHandlerState:i}=t,s=Of.includes(t);i(n,s,e)})}function Kft(){const[n,e]=x.useState(0);return x.useCallback(()=>e(t=>t+1),[])}function bn(n,e){if(!n)throw console.error(e),Error(e)}function Q0(n,e,t=ioe){return n.toFixed(t)===e.toFixed(t)?0:n>e?1:-1}function e_(n,e,t=ioe){return Q0(n,e,t)===0}function fu(n,e,t){return Q0(n,e,t)===0}function Zft(n,e,t){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++){const s=n[i],r=e[i];if(!fu(s,r,t))return!1}return!0}function $L({panelConstraints:n,panelIndex:e,size:t}){const i=n[e];bn(i!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:s=0,collapsible:r,maxSize:o=100,minSize:a=0}=i;if(Q0(t,a)<0)if(r){const l=(s+a)/2;Q0(t,l)<0?t=s:t=a}else t=a;return t=Math.min(o,t),t=parseFloat(t.toFixed(ioe)),t}function dI({delta:n,initialLayout:e,panelConstraints:t,pivotIndices:i,prevLayout:s,trigger:r}){if(fu(n,0))return e;const o=[...e],[a,l]=i;bn(a!=null,"Invalid first pivot index"),bn(l!=null,"Invalid second pivot index");let c=0;if(r==="keyboard"){{const u=n<0?l:a,h=t[u];bn(h,`Panel constraints not found for index ${u}`);const{collapsedSize:g=0,collapsible:m,minSize:b=0}=h;if(m){const v=e[u];if(bn(v!=null,`Previous layout not found for panel index ${u}`),fu(v,g)){const C=b-v;Q0(C,Math.abs(n))>0&&(n=n<0?0-C:C)}}}{const u=n<0?a:l,h=t[u];bn(h,`No panel constraints found for index ${u}`);const{collapsedSize:g=0,collapsible:m,minSize:b=0}=h;if(m){const v=e[u];if(bn(v!=null,`Previous layout not found for panel index ${u}`),fu(v,b)){const C=v-g;Q0(C,Math.abs(n))>0&&(n=n<0?0-C:C)}}}}{const u=n<0?1:-1;let h=n<0?l:a,g=0;for(;;){const b=e[h];bn(b!=null,`Previous layout not found for panel index ${h}`);const C=$L({panelConstraints:t,panelIndex:h,size:100})-b;if(g+=C,h+=u,h<0||h>=t.length)break}const m=Math.min(Math.abs(n),Math.abs(g));n=n<0?0-m:m}{let h=n<0?a:l;for(;h>=0&&h<t.length;){const g=Math.abs(n)-Math.abs(c),m=e[h];bn(m!=null,`Previous layout not found for panel index ${h}`);const b=m-g,v=$L({panelConstraints:t,panelIndex:h,size:b});if(!fu(m,v)&&(c+=m-v,o[h]=v,c.toFixed(3).localeCompare(Math.abs(n).toFixed(3),void 0,{numeric:!0})>=0))break;n<0?h--:h++}}if(Zft(s,o))return s;{const u=n<0?l:a,h=e[u];bn(h!=null,`Previous layout not found for panel index ${u}`);const g=h+c,m=$L({panelConstraints:t,panelIndex:u,size:g});if(o[u]=m,!fu(m,g)){let b=g-m,C=n<0?l:a;for(;C>=0&&C<t.length;){const y=o[C];bn(y!=null,`Previous layout not found for panel index ${C}`);const L=y+b,E=$L({panelConstraints:t,panelIndex:C,size:L});if(fu(y,E)||(b-=E-y,o[C]=E),fu(b,0))break;n>0?C--:C++}}}const d=o.reduce((u,h)=>h+u,0);return fu(d,100)?o:s}function Yft({layout:n,panelsArray:e,pivotIndices:t}){let i=0,s=100,r=0,o=0;const a=t[0];bn(a!=null,"No pivot index found"),e.forEach((u,h)=>{const{constraints:g}=u,{maxSize:m=100,minSize:b=0}=g;h===a?(i=b,s=m):(r+=b,o+=m)});const l=Math.min(s,100-r),c=Math.max(i,100-o),d=n[a];return{valueMax:l,valueMin:c,valueNow:d}}function _2(n,e=document){return Array.from(e.querySelectorAll(`[${Eo.resizeHandleId}][data-panel-group-id="${n}"]`))}function oke(n,e,t=document){const s=_2(n,t).findIndex(r=>r.getAttribute(Eo.resizeHandleId)===e);return s??null}function ake(n,e,t){const i=oke(n,e,t);return i!=null?[i,i+1]:[-1,-1]}function Xft(n){return n instanceof HTMLElement?!0:typeof n=="object"&&n!==null&&"tagName"in n&&"getAttribute"in n}function lke(n,e=document){if(Xft(e)&&e.dataset.panelGroupId==n)return e;const t=e.querySelector(`[data-panel-group][data-panel-group-id="${n}"]`);return t||null}function hB(n,e=document){const t=e.querySelector(`[${Eo.resizeHandleId}="${n}"]`);return t||null}function Qft(n,e,t,i=document){var s,r,o,a;const l=hB(e,i),c=_2(n,i),d=l?c.indexOf(l):-1,u=(s=(r=t[d])===null||r===void 0?void 0:r.id)!==null&&s!==void 0?s:null,h=(o=(a=t[d+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null;return[u,h]}function Jft({committedValuesRef:n,eagerValuesRef:e,groupId:t,layout:i,panelDataArray:s,panelGroupElement:r,setLayout:o}){x.useRef({didWarnAboutMissingResizeHandle:!1}),Dy(()=>{if(!r)return;const a=_2(t,r);for(let l=0;l<s.length-1;l++){const{valueMax:c,valueMin:d,valueNow:u}=Yft({layout:i,panelsArray:s,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const g=s[l];bn(g,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",g.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(d)),h.setAttribute("aria-valuenow",u!=null?""+Math.round(u):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[t,i,s,r]),x.useEffect(()=>{if(!r)return;const a=e.current;bn(a,"Eager values not found");const{panelDataArray:l}=a,c=lke(t,r);bn(c!=null,`No group found for id "${t}"`);const d=_2(t,r);bn(d,`No resize handles found for group id "${t}"`);const u=d.map(h=>{const g=h.getAttribute(Eo.resizeHandleId);bn(g,"Resize handle element has no handle id attribute");const[m,b]=Qft(t,g,l,r);if(m==null||b==null)return()=>{};const v=C=>{if(!C.defaultPrevented)switch(C.key){case"Enter":{C.preventDefault();const y=l.findIndex(L=>L.id===m);if(y>=0){const L=l[y];bn(L,`No panel data found for index ${y}`);const E=i[y],{collapsedSize:R=0,collapsible:T,minSize:N=0}=L.constraints;if(E!=null&&T){const I=dI({delta:fu(E,R)?N-R:R-E,initialLayout:i,panelConstraints:l.map(M=>M.constraints),pivotIndices:ake(t,g,r),prevLayout:i,trigger:"keyboard"});i!==I&&o(I)}}break}}};return h.addEventListener("keydown",v),()=>{h.removeEventListener("keydown",v)}});return()=>{u.forEach(h=>h())}},[r,n,e,t,i,s,o])}function __e(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function cke(n,e){const t=n==="horizontal",{x:i,y:s}=cB(e);return t?i:s}function egt(n,e,t,i,s){const r=t==="horizontal",o=hB(e,s);bn(o,`No resize handle element found for id "${e}"`);const a=o.getAttribute(Eo.groupId);bn(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=i;const c=cke(t,n),d=lke(a,s);bn(d,`No group element found for id "${a}"`);const u=d.getBoundingClientRect(),h=r?u.width:u.height;return(c-l)/h*100}function tgt(n,e,t,i,s,r){if(XIe(n)){const o=t==="horizontal";let a=0;n.shiftKey?a=100:s!=null?a=s:a=10;let l=0;switch(n.key){case"ArrowDown":l=o?0:a;break;case"ArrowLeft":l=o?-a:0;break;case"ArrowRight":l=o?a:0;break;case"ArrowUp":l=o?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return i==null?0:egt(n,e,t,i,r)}function igt({panelDataArray:n}){const e=Array(n.length),t=n.map(r=>r.constraints);let i=0,s=100;for(let r=0;r<n.length;r++){const o=t[r];bn(o,`Panel constraints not found for index ${r}`);const{defaultSize:a}=o;a!=null&&(i++,e[r]=a,s-=a)}for(let r=0;r<n.length;r++){const o=t[r];bn(o,`Panel constraints not found for index ${r}`);const{defaultSize:a}=o;if(a!=null)continue;const l=n.length-i,c=s/l;i++,e[r]=c,s-=c}return e}function eL(n,e,t){e.forEach((i,s)=>{const r=n[s];bn(r,`Panel data not found for index ${s}`);const{callbacks:o,constraints:a,id:l}=r,{collapsedSize:c=0,collapsible:d}=a,u=t[l];if(u==null||i!==u){t[l]=i;const{onCollapse:h,onExpand:g,onResize:m}=o;m&&m(i,u),d&&(h||g)&&(g&&(u==null||e_(u,c))&&!e_(i,c)&&g(),h&&(u==null||!e_(u,c))&&e_(i,c)&&h())}})}function w4(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t])return!1;return!0}function ngt({defaultSize:n,dragState:e,layout:t,panelData:i,panelIndex:s,precision:r=3}){const o=t[s];let a;return o==null?a=n!=null?n.toFixed(r):"1":i.length===1?a="1":a=o.toFixed(r),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function sgt(n,e=10){let t=null;return(...s)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...s)},e)}}function b_e(n){try{if(typeof localStorage<"u")n.getItem=e=>localStorage.getItem(e),n.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),n.getItem=()=>null,n.setItem=()=>{}}}function dke(n){return`react-resizable-panels:${n}`}function uke(n){return n.map(e=>{const{constraints:t,id:i,idIsFromProps:s,order:r}=e;return s?i:r?`${r}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function hke(n,e){try{const t=dke(n),i=e.getItem(t);if(i){const s=JSON.parse(i);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function rgt(n,e,t){var i,s;const r=(i=hke(n,t))!==null&&i!==void 0?i:{},o=uke(e);return(s=r[o])!==null&&s!==void 0?s:null}function ogt(n,e,t,i,s){var r;const o=dke(n),a=uke(e),l=(r=hke(n,s))!==null&&r!==void 0?r:{};l[a]={expandToSizes:Object.fromEntries(t.entries()),layout:i};try{s.setItem(o,JSON.stringify(l))}catch(c){console.error(c)}}function v_e({layout:n,panelConstraints:e}){const t=[...n],i=t.reduce((r,o)=>r+o,0);if(t.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${t.map(r=>`${r}%`).join(", ")}`);if(!fu(i,100)&&t.length>0)for(let r=0;r<e.length;r++){const o=t[r];bn(o!=null,`No layout data found for index ${r}`);const a=100/i*o;t[r]=a}let s=0;for(let r=0;r<e.length;r++){const o=t[r];bn(o!=null,`No layout data found for index ${r}`);const a=$L({panelConstraints:e,panelIndex:r,size:o});o!=a&&(s+=o-a,t[r]=a)}if(!fu(s,0))for(let r=0;r<e.length;r++){const o=t[r];bn(o!=null,`No layout data found for index ${r}`);const a=o+s,l=$L({panelConstraints:e,panelIndex:r,size:a});if(o!==l&&(s-=l-o,t[r]=l,fu(s,0)))break}return t}const agt=100,uI={getItem:n=>(b_e(uI),uI.getItem(n)),setItem:(n,e)=>{b_e(uI),uI.setItem(n,e)}},C_e={};function fke({autoSaveId:n=null,children:e,className:t="",direction:i,forwardedRef:s,id:r=null,onLayout:o=null,keyboardResizeBy:a=null,storage:l=uI,style:c,tagName:d="div",...u}){const h=noe(r),g=x.useRef(null),[m,b]=x.useState(null),[v,C]=x.useState([]),y=Kft(),L=x.useRef({}),E=x.useRef(new Map),R=x.useRef(0),T=x.useRef({autoSaveId:n,direction:i,dragState:m,id:h,keyboardResizeBy:a,onLayout:o,storage:l}),N=x.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});x.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),x.useImperativeHandle(s,()=>({getId:()=>T.current.id,getLayout:()=>{const{layout:ee}=N.current;return ee},setLayout:ee=>{const{onLayout:se}=T.current,{layout:ae,panelDataArray:Se}=N.current,ue=v_e({layout:ee,panelConstraints:Se.map(Re=>Re.constraints)});__e(ae,ue)||(C(ue),N.current.layout=ue,se&&se(ue),eL(Se,ue,L.current))}}),[]),Dy(()=>{T.current.autoSaveId=n,T.current.direction=i,T.current.dragState=m,T.current.id=h,T.current.onLayout=o,T.current.storage=l}),Jft({committedValuesRef:T,eagerValuesRef:N,groupId:h,layout:v,panelDataArray:N.current.panelDataArray,setLayout:C,panelGroupElement:g.current}),x.useEffect(()=>{const{panelDataArray:ee}=N.current;if(n){if(v.length===0||v.length!==ee.length)return;let se=C_e[n];se==null&&(se=sgt(ogt,agt),C_e[n]=se);const ae=[...ee],Se=new Map(E.current);se(n,ae,Se,v,l)}},[n,v,l]),x.useEffect(()=>{});const I=x.useCallback(ee=>{const{onLayout:se}=T.current,{layout:ae,panelDataArray:Se}=N.current;if(ee.constraints.collapsible){const ue=Se.map(dt=>dt.constraints),{collapsedSize:Re=0,panelSize:Ve,pivotIndices:Qe}=JC(Se,ee,ae);if(bn(Ve!=null,`Panel size not found for panel "${ee.id}"`),!e_(Ve,Re)){E.current.set(ee.id,Ve);const yt=AL(Se,ee)===Se.length-1?Ve-Re:Re-Ve,fi=dI({delta:yt,initialLayout:ae,panelConstraints:ue,pivotIndices:Qe,prevLayout:ae,trigger:"imperative-api"});w4(ae,fi)||(C(fi),N.current.layout=fi,se&&se(fi),eL(Se,fi,L.current))}}},[]),M=x.useCallback((ee,se)=>{const{onLayout:ae}=T.current,{layout:Se,panelDataArray:ue}=N.current;if(ee.constraints.collapsible){const Re=ue.map(_i=>_i.constraints),{collapsedSize:Ve=0,panelSize:Qe=0,minSize:dt=0,pivotIndices:yt}=JC(ue,ee,Se),fi=se??dt;if(e_(Qe,Ve)){const _i=E.current.get(ee.id),Sn=_i!=null&&_i>=fi?_i:fi,br=AL(ue,ee)===ue.length-1?Qe-Sn:Sn-Qe,hs=dI({delta:br,initialLayout:Se,panelConstraints:Re,pivotIndices:yt,prevLayout:Se,trigger:"imperative-api"});w4(Se,hs)||(C(hs),N.current.layout=hs,ae&&ae(hs),eL(ue,hs,L.current))}}},[]),P=x.useCallback(ee=>{const{layout:se,panelDataArray:ae}=N.current,{panelSize:Se}=JC(ae,ee,se);return bn(Se!=null,`Panel size not found for panel "${ee.id}"`),Se},[]),H=x.useCallback((ee,se)=>{const{panelDataArray:ae}=N.current,Se=AL(ae,ee);return ngt({defaultSize:se,dragState:m,layout:v,panelData:ae,panelIndex:Se})},[m,v]),j=x.useCallback(ee=>{const{layout:se,panelDataArray:ae}=N.current,{collapsedSize:Se=0,collapsible:ue,panelSize:Re}=JC(ae,ee,se);return bn(Re!=null,`Panel size not found for panel "${ee.id}"`),ue===!0&&e_(Re,Se)},[]),V=x.useCallback(ee=>{const{layout:se,panelDataArray:ae}=N.current,{collapsedSize:Se=0,collapsible:ue,panelSize:Re}=JC(ae,ee,se);return bn(Re!=null,`Panel size not found for panel "${ee.id}"`),!ue||Q0(Re,Se)>0},[]),W=x.useCallback(ee=>{const{panelDataArray:se}=N.current;se.push(ee),se.sort((ae,Se)=>{const ue=ae.order,Re=Se.order;return ue==null&&Re==null?0:ue==null?-1:Re==null?1:ue-Re}),N.current.panelDataArrayChanged=!0,y()},[y]);Dy(()=>{if(N.current.panelDataArrayChanged){N.current.panelDataArrayChanged=!1;const{autoSaveId:ee,onLayout:se,storage:ae}=T.current,{layout:Se,panelDataArray:ue}=N.current;let Re=null;if(ee){const Qe=rgt(ee,ue,ae);Qe&&(E.current=new Map(Object.entries(Qe.expandToSizes)),Re=Qe.layout)}Re==null&&(Re=igt({panelDataArray:ue}));const Ve=v_e({layout:Re,panelConstraints:ue.map(Qe=>Qe.constraints)});__e(Se,Ve)||(C(Ve),N.current.layout=Ve,se&&se(Ve),eL(ue,Ve,L.current))}}),Dy(()=>{const ee=N.current;return()=>{ee.layout=[]}},[]);const U=x.useCallback(ee=>{let se=!1;const ae=g.current;return ae&&window.getComputedStyle(ae,null).getPropertyValue("direction")==="rtl"&&(se=!0),function(ue){ue.preventDefault();const Re=g.current;if(!Re)return()=>null;const{direction:Ve,dragState:Qe,id:dt,keyboardResizeBy:yt,onLayout:fi}=T.current,{layout:_i,panelDataArray:Sn}=N.current,{initialLayout:Es}=Qe??{},br=ake(dt,ee,Re);let hs=tgt(ue,ee,Ve,Qe,yt,Re);const Ht=Ve==="horizontal";Ht&&se&&(hs=-hs);const oe=Sn.map(bt=>bt.constraints),Ce=dI({delta:hs,initialLayout:Es??_i,panelConstraints:oe,pivotIndices:br,prevLayout:_i,trigger:XIe(ue)?"keyboard":"mouse-or-touch"}),je=!w4(_i,Ce);(QIe(ue)||JIe(ue))&&R.current!=hs&&(R.current=hs,!je&&hs!==0?Ht?_$(ee,hs<0?tke:ike):_$(ee,hs<0?nke:ske):_$(ee,0)),je&&(C(Ce),N.current.layout=Ce,fi&&fi(Ce),eL(Sn,Ce,L.current))}},[]),B=x.useCallback((ee,se)=>{const{onLayout:ae}=T.current,{layout:Se,panelDataArray:ue}=N.current,Re=ue.map(_i=>_i.constraints),{panelSize:Ve,pivotIndices:Qe}=JC(ue,ee,Se);bn(Ve!=null,`Panel size not found for panel "${ee.id}"`);const yt=AL(ue,ee)===ue.length-1?Ve-se:se-Ve,fi=dI({delta:yt,initialLayout:Se,panelConstraints:Re,pivotIndices:Qe,prevLayout:Se,trigger:"imperative-api"});w4(Se,fi)||(C(fi),N.current.layout=fi,ae&&ae(fi),eL(ue,fi,L.current))},[]),K=x.useCallback((ee,se)=>{const{layout:ae,panelDataArray:Se}=N.current,{collapsedSize:ue=0,collapsible:Re}=se,{collapsedSize:Ve=0,collapsible:Qe,maxSize:dt=100,minSize:yt=0}=ee.constraints,{panelSize:fi}=JC(Se,ee,ae);fi!=null&&(Re&&Qe&&e_(fi,ue)?e_(ue,Ve)||B(ee,Ve):fi<yt?B(ee,yt):fi>dt&&B(ee,dt))},[B]),X=x.useCallback((ee,se)=>{const{direction:ae}=T.current,{layout:Se}=N.current;if(!g.current)return;const ue=hB(ee,g.current);bn(ue,`Drag handle element not found for id "${ee}"`);const Re=cke(ae,se);b({dragHandleId:ee,dragHandleRect:ue.getBoundingClientRect(),initialCursorPosition:Re,initialLayout:Se})},[]),ne=x.useCallback(()=>{b(null)},[]),fe=x.useCallback(ee=>{const{panelDataArray:se}=N.current,ae=AL(se,ee);ae>=0&&(se.splice(ae,1),delete L.current[ee.id],N.current.panelDataArrayChanged=!0,y())},[y]),Z=x.useMemo(()=>({collapsePanel:I,direction:i,dragState:m,expandPanel:M,getPanelSize:P,getPanelStyle:H,groupId:h,isPanelCollapsed:j,isPanelExpanded:V,reevaluatePanelConstraints:K,registerPanel:W,registerResizeHandle:U,resizePanel:B,startDragging:X,stopDragging:ne,unregisterPanel:fe,panelGroupElement:g.current}),[I,m,i,M,P,H,h,j,V,K,W,U,B,X,ne,fe]),Y={display:"flex",flexDirection:i==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return x.createElement(lB.Provider,{value:Z},x.createElement(d,{...u,children:e,className:t,id:r,ref:g,style:{...Y,...c},[Eo.group]:"",[Eo.groupDirection]:i,[Eo.groupId]:h}))}const gke=x.forwardRef((n,e)=>x.createElement(fke,{...n,forwardedRef:e}));fke.displayName="PanelGroup";gke.displayName="forwardRef(PanelGroup)";function AL(n,e){return n.findIndex(t=>t===e||t.id===e.id)}function JC(n,e,t){const i=AL(n,e),r=i===n.length-1?[i-1,i]:[i,i+1],o=t[i];return{...e.constraints,panelSize:o,pivotIndices:r}}function lgt({disabled:n,handleId:e,resizeHandler:t,panelGroupElement:i}){x.useEffect(()=>{if(n||t==null||i==null)return;const s=hB(e,i);if(s==null)return;const r=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),t(o);break}case"F6":{o.preventDefault();const a=s.getAttribute(Eo.groupId);bn(a,`No group element found for id "${a}"`);const l=_2(a,i),c=oke(a,e,i);bn(c!==null,`No resize element found for id "${e}"`);const d=o.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[d].focus();break}}};return s.addEventListener("keydown",r),()=>{s.removeEventListener("keydown",r)}},[i,n,e,t])}function pke({children:n=null,className:e="",disabled:t=!1,hitAreaMargins:i,id:s,onBlur:r,onClick:o,onDragging:a,onFocus:l,onPointerDown:c,onPointerUp:d,style:u={},tabIndex:h=0,tagName:g="div",...m}){var b,v;const C=x.useRef(null),y=x.useRef({onClick:o,onDragging:a,onPointerDown:c,onPointerUp:d});x.useEffect(()=>{y.current.onClick=o,y.current.onDragging=a,y.current.onPointerDown=c,y.current.onPointerUp=d});const L=x.useContext(lB);if(L===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:E,groupId:R,registerResizeHandle:T,startDragging:N,stopDragging:I,panelGroupElement:M}=L,P=noe(s),[H,j]=x.useState("inactive"),[V,W]=x.useState(!1),[U,B]=x.useState(null),K=x.useRef({state:H});Dy(()=>{K.current.state=H}),x.useEffect(()=>{if(t)B(null);else{const Z=T(P);B(()=>Z)}},[t,P,T]);const X=(b=i==null?void 0:i.coarse)!==null&&b!==void 0?b:15,ne=(v=i==null?void 0:i.fine)!==null&&v!==void 0?v:5;x.useEffect(()=>{if(t||U==null)return;const Z=C.current;bn(Z,"Element ref not attached");let Y=!1;return Gft(P,Z,E,{coarse:X,fine:ne},(se,ae,Se)=>{if(!ae){j("inactive");return}switch(se){case"down":{j("drag"),Y=!1,bn(Se,'Expected event to be defined for "down" action'),N(P,Se);const{onDragging:ue,onPointerDown:Re}=y.current;ue==null||ue(!0),Re==null||Re();break}case"move":{const{state:ue}=K.current;Y=!0,ue!=="drag"&&j("hover"),bn(Se,'Expected event to be defined for "move" action'),U(Se);break}case"up":{j("hover"),I();const{onClick:ue,onDragging:Re,onPointerUp:Ve}=y.current;Re==null||Re(!1),Ve==null||Ve(),Y||ue==null||ue();break}}})},[X,E,t,ne,T,P,U,N,I]),lgt({disabled:t,handleId:P,resizeHandler:U,panelGroupElement:M});const fe={touchAction:"none",userSelect:"none"};return x.createElement(g,{...m,children:n,className:e,id:s,onBlur:()=>{W(!1),r==null||r()},onFocus:()=>{W(!0),l==null||l()},ref:C,role:"separator",style:{...fe,...u},tabIndex:h,[Eo.groupDirection]:E,[Eo.groupId]:R,[Eo.resizeHandle]:"",[Eo.resizeHandleActive]:H==="drag"?"pointer":V?"keyboard":void 0,[Eo.resizeHandleEnabled]:!t,[Eo.resizeHandleId]:P,[Eo.resizeHandleState]:H})}pke.displayName="PanelResizeHandle";function cgt({className:n,...e}){return f.jsx(gke,{"data-slot":"resizable-panel-group",className:Le("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),...e})}function w_e({...n}){return f.jsx(YIe,{"data-slot":"resizable-panel",...n})}function dgt({withHandle:n,className:e,...t}){return f.jsx(pke,{"data-slot":"resizable-handle",className:Le("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",e),...t,children:n&&f.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:f.jsx(JSe,{className:"size-2.5"})})})}function ugt({storageKey:n,left:e,right:t,initialRatio:i=.5,minWidth:s=240,className:r}){const o=x.useMemo(()=>{const h=np.get(n);if(h!==null){const g=Number(h);if(!Number.isNaN(g))return v$(g,.1,.9)}return v$(i,.1,.9)},[n,i]),a=Math.round(o*100),l=100-a,d=Math.min(45,Math.max(5,Math.round(s/1200*100)));function u(h){const g=h[0],m=v$(g/100,.1,.9);np.set(n,m)}return f.jsxs(cgt,{direction:"horizontal",onLayout:u,className:Le("relative flex h-full w-full items-stretch overflow-hidden",r),children:[f.jsx(w_e,{defaultSize:a,minSize:d,className:"overflow-auto",children:e}),f.jsx(dgt,{withHandle:!0}),f.jsx(w_e,{defaultSize:l,minSize:d,className:"overflow-auto",children:t})]})}function v$(n,e,t){return Math.max(e,Math.min(t,n))}const hgt="modulepreload",fgt=function(n){return"/"+n},y_e={},pt=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(t.map(c=>{if(c=fgt(c),c in y_e)return;y_e[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":hgt,d||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),d)return new Promise((g,m)=>{h.addEventListener("load",g),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};function mke(){return globalThis._VSCODE_NLS_MESSAGES}function roe(){return globalThis._VSCODE_NLS_LANGUAGE}const ggt=roe()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function qF(n,e){let t;return e.length===0?t=n:t=n.replace(/\{(\d+)\}/g,(i,s)=>{const r=s[0],o=e[r];let a=i;return typeof o=="string"?a=o:(typeof o=="number"||typeof o=="boolean"||o===void 0||o===null)&&(a=String(o)),a}),ggt&&(t="["+t.replace(/[aouei]/g,"$&$&")+"]"),t}function S(n,e,...t){return qF(typeof n=="number"?_ke(n,e):e,t)}function _ke(n,e){var i;const t=(i=mke())==null?void 0:i[n];if(typeof t!="string"){if(typeof e=="string")return e;throw new Error(`!!! NLS MISSING: ${n} !!!`)}return t}function ce(n,e,...t){let i;typeof n=="number"?i=_ke(n,e):i=e;const s=qF(i,t);return{value:s,original:e===i?s:qF(e,t)}}function pgt(n,e){const t=n;typeof t.vscodeWindowId!="number"&&Object.defineProperty(t,"vscodeWindowId",{get:()=>e})}const dn=window,f7=class f7{constructor(){this.mapWindowIdToZoomFactor=new Map}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}getWindowId(e){return e.vscodeWindowId}};f7.INSTANCE=new f7;let aZ=f7;function bke(n,e,t){typeof e=="string"&&(e=n.matchMedia(e)),e.addEventListener("change",t)}function lZ(n){return aZ.INSTANCE.getZoomFactor(n)}const qR=navigator.userAgent,lc=qR.indexOf("Firefox")>=0,fB=qR.indexOf("AppleWebKit")>=0,GM=qR.indexOf("Chrome")>=0,J0=!GM&&qR.indexOf("Safari")>=0,vke=!GM&&!J0&&fB;qR.indexOf("Electron/")>=0;const S_e=qR.indexOf("Android")>=0;let C$=!1;if(typeof dn.matchMedia=="function"){const n=dn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=dn.matchMedia("(display-mode: fullscreen)");C$=n.matches,bke(dn,n,({matches:t})=>{C$&&e.matches||(C$=t)})}function ooe(){return globalThis.MonacoEnvironment}class mgt{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?VD.isErrorNoTelemetry(e)?new VD(e.message+`
|
|
747
747
|
|
|
748
748
|
`+e.stack):new Error(e.message+`
|
|
749
749
|
|
|
@@ -1645,7 +1645,7 @@ ${e.toString()}`}}class l7{constructor(e=new dN,t=!1,i,s=uWt){this._services=e,t
|
|
|
1645
1645
|
`:`\r
|
|
1646
1646
|
`}};rne=Kp([Er(0,Ut)],rne);class SWt{publicLog2(){}}const Xk=class Xk{constructor(){const e=ut.from({scheme:Xk.SCHEME,authority:"model",path:"/"});this.workspace={id:DPe,folders:[new Hkt({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}getWorkspaceFolder(e){return e&&e.scheme===Xk.SCHEME?this.workspace.folders[0]:null}};Xk.SCHEME="inmemory";let one=Xk;function d7(n,e,t){if(!e||!(n instanceof c7))return;const i=[];Object.keys(e).forEach(s=>{n2t(s)&&i.push([`editor.${s}`,e[s]]),t&&s2t(s)&&i.push([`diffEditor.${s}`,e[s]])}),i.length>0&&n.updateValues(i)}let ane=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}async apply(e,t){const i=Array.isArray(e)?e:vle.convert(e),s=new Map;for(const a of i){if(!(a instanceof m1))throw new Error("bad edit - only text edits are supported");const l=this._modelService.getModel(a.resource);if(!l)throw new Error("bad edit - model not found");if(typeof a.versionId=="number"&&l.getVersionId()!==a.versionId)throw new Error("bad state - model changed in the meantime");let c=s.get(l);c||(c=[],s.set(l,c)),c.push(Ws.replaceMove(F.lift(a.textEdit.range),a.textEdit.text))}let r=0,o=0;for(const[a,l]of s)a.pushStackElement(),a.pushEditOperations([],l,()=>[]),a.pushStackElement(),o+=1,r+=l.length;return{ariaSummary:sS(Jee.bulkEditServiceSummary,r,o),isApplied:r>0}}};ane=Kp([Er(0,xs)],ane);class xWt{getUriLabel(e,t){return e.scheme==="file"?e.fsPath:e.path}getUriBasenameLabel(e){return $u(e)}}let lne=class extends BBt{constructor(e,t){super(e),this._codeEditorService=t}showContextView(e,t,i){if(!t){const s=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();s&&(t=s.getContainerDomNode())}return super.showContextView(e,t,i)}};lne=Kp([Er(0,$p),Er(1,Ni)],lne);class LWt{constructor(){this._neverEmitter=new te,this.onDidChangeTrust=this._neverEmitter.event}isWorkspaceTrusted(){return!0}}class EWt extends Sie{constructor(){super()}}class DWt extends mWt{constructor(){super(new A_t)}}let cne=class extends Eie{constructor(e,t,i,s,r,o){super(e,t,i,s,r,o),this.configure({blockMouse:!1})}};cne=Kp([Er(0,Ba),Er(1,qs),Er(2,Cb),Er(3,Mi),Er(4,Yu),Er(5,Dt)],cne);const RWt={esmModuleLocation:void 0,label:"editorWorkerService"};let dne=class extends uie{constructor(e,t,i,s,r){super(RWt,e,t,i,s,r)}};dne=Kp([Er(0,xs),Er(1,VV),Er(2,qn),Er(3,Ls),Er(4,Xe)],dne);class NWt{async playSignal(e,t){}}hi(qn,DWt,0);hi(Ut,c7,0);hi(VV,sne,0);hi(w5e,rne,0);hi(ib,one,0);hi(NS,xWt,0);hi(Ba,SWt,0);hi(MO,wWt,0);hi(Nle,CWt,0);hi(qs,ine,0);hi(Gp,Gw,0);hi(Gs,EWt,0);hi(Xd,kHt,0);hi(xs,kie,0);hi(Joe,Iie,0);hi(Dt,Jie,0);hi(eOe,vWt,0);hi(eb,tne,0);hi(ll,yIt,0);hi(mc,dne,0);hi(yO,ane,0);hi(A5e,LWt,0);hi(al,ene,0);hi($o,Zie,0);hi(eh,TOt,0);hi(Kn,nne,0);hi(Mi,LR,0);hi(Fa,qie,0);hi(Cb,lne,0);hi(wb,Tie,0);hi(ed,Xie,0);hi(Yd,cne,0);hi(Yu,AX,0);hi(bb,NWt,0);hi(jae,_Wt,0);hi(R2e,F_t,0);hi(bce,G3t,0);var kt;(function(n){const e=new dN;for(const[l,c]of pbe())e.set(l,c);const t=new l7(e,!0);e.set(st,t);function i(l){s||o({});const c=e.get(l);if(!c)throw new Error("Missing service "+l);return c instanceof Wg?t.invokeFunction(d=>d.get(l)):c}n.get=i;let s=!1;const r=new te;function o(l){if(s)return t;s=!0;for(const[d,u]of pbe())e.get(d)||e.set(d,u);for(const d in l)if(l.hasOwnProperty(d)){const u=ei(d);e.get(u)instanceof Wg&&e.set(u,l[d])}const c=H2t();for(const d of c)try{t.createInstance(d)}catch(u){It(u)}return r.fire(),t}n.initialize=o;function a(l){if(s)return l();const c=new ge,d=c.add(r.event(()=>{d.dispose(),c.add(l())}));return c}n.withServices=a})(kt||(kt={}));var TWt=function(n,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(e,t,r):o(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r},$0e=function(n,e){return function(t,i){e(t,i,n)}},J5,V0;let une=(V0=class{constructor(e,t){this._configurationService=e,this._languageService=t}async renderCodeBlock(e,t,i){var d;const s=Qf(i.context)?i.context:void 0;let r;e?r=this._languageService.getLanguageIdByLanguageName(e):s&&(r=(d=s.getModel())==null?void 0:d.getLanguageId()),r||(r=Hd);const o=await jEt(this._languageService,t,r),a=J5._ttpTokenizer?J5._ttpTokenizer.createHTML(o)??o:o,l=document.createElement("span");l.innerHTML=a;const c=l.querySelector(".monaco-tokenized-source");return $s(c)?(Io(c,this.getFontInfo(s)),l):document.createElement("span")}getFontInfo(e){return e?e.getOption(59):m1t({fontFamily:this._configurationService.getValue("editor").fontFamily},1)}},J5=V0,V0._ttpTokenizer=zp("tokenizeToString",{createHTML(e){return e}}),V0);une=J5=TWt([$0e(0,Ut),$0e(1,Gs)],une);var Yce=function(n,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(e,t,r):o(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r},Fn=function(n,e){return function(t,i){e(t,i,n)}};let IWt=0,G0e=!1;function kWt(n){if(!n){if(G0e)return;G0e=!0}Qmt(n||dn.document.body)}let u7=class extends fS{constructor(e,t,i,s,r,o,a,l,c,d,u,h,g,m){const b={...t};b.ariaLabel=b.ariaLabel||Xee.editorViewAccessibleLabel,super(e,b,{},i,s,r,o,c,d,u,h,g),l instanceof LR?this._standaloneKeybindingService=l:this._standaloneKeybindingService=null,kWt(b.ariaContainerElement),xDt((v,C)=>i.createInstance(lR,v,{instantHover:C},{})),MNt(a),m.setDefaultCodeBlockRenderer(i.createInstance(une))}addCommand(e,t,i){if(!this._standaloneKeybindingService)return console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService"),null;const s="DYNAMIC_"+ ++IWt,r=ve.deserialize(i);return this._standaloneKeybindingService.addDynamicKeybinding(s,e,t,r),s}createContextKey(e,t){return this._contextKeyService.createKey(e,t)}addAction(e){if(typeof e.id!="string"||typeof e.label!="string"||typeof e.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");if(!this._standaloneKeybindingService)return console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),ie.None;const t=e.id,i=e.label,s=ve.and(ve.equals("editorId",this.getId()),ve.deserialize(e.precondition)),r=e.keybindings,o=ve.and(s,ve.deserialize(e.keybindingContext)),a=e.contextMenuGroupId||null,l=e.contextMenuOrder||0,c=(g,...m)=>Promise.resolve(e.run(this,...m)),d=new ge,u=this.getId()+":"+t;if(d.add(wi.registerCommand(u,c)),a){const g={command:{id:u,title:i},when:s,group:a,order:l};d.add(No.appendMenuItem(Je.EditorContext,g))}if(Array.isArray(r))for(const g of r)d.add(this._standaloneKeybindingService.addDynamicKeybinding(u,g,c,o));const h=new xMe(u,i,i,void 0,s,(...g)=>Promise.resolve(e.run(this,...g)),this._contextKeyService);return this._actions.set(t,h),d.add(et(()=>{this._actions.delete(t)})),d}_triggerCommand(e,t){if(this._codeEditorService instanceof Q6)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};u7=Yce([Fn(2,st),Fn(3,Ni),Fn(4,Kn),Fn(5,Dt),Fn(6,Hl),Fn(7,Mi),Fn(8,Os),Fn(9,qs),Fn(10,$o),Fn(11,Ls),Fn(12,Xe),Fn(13,qh)],u7);let hne=class extends u7{constructor(e,t,i,s,r,o,a,l,c,d,u,h,g,m,b,v,C){const y={...t};d7(u,y,!1);const L=c.registerEditorContainer(e);typeof y.theme=="string"&&c.setTheme(y.theme),typeof y.autoDetectHighContrast<"u"&&c.setAutoDetectHighContrast(!!y.autoDetectHighContrast);const E=y.model;delete y.model,super(e,y,i,s,r,o,a,l,c,d,h,b,v,C),this._configurationService=u,this._standaloneThemeService=c,this._register(L);let R;if(typeof E>"u"){const T=m.getLanguageIdByMimeType(y.language)||y.language||Hd;R=LFe(g,m,y.value||"",T,void 0),this._ownsModel=!0}else R=E,this._ownsModel=!1;if(this._attachModel(R),R){const T={oldModelUrl:null,newModelUrl:R.uri};this._onDidChangeModel.fire(T)}}dispose(){super.dispose()}updateOptions(e){d7(this._configurationService,e,!1),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};hne=Yce([Fn(2,st),Fn(3,Ni),Fn(4,Kn),Fn(5,Dt),Fn(6,Hl),Fn(7,Mi),Fn(8,Xd),Fn(9,qs),Fn(10,Ut),Fn(11,$o),Fn(12,xs),Fn(13,Gs),Fn(14,Ls),Fn(15,Xe),Fn(16,qh)],hne);let fne=class extends Tp{constructor(e,t,i,s,r,o,a,l,c,d,u,h){const g={...t};d7(l,g,!0);const m=o.registerEditorContainer(e);typeof g.theme=="string"&&o.setTheme(g.theme),typeof g.autoDetectHighContrast<"u"&&o.setAutoDetectHighContrast(!!g.autoDetectHighContrast),super(e,g,{},s,i,r,h,d),this._configurationService=l,this._standaloneThemeService=o,this._register(m)}dispose(){super.dispose()}updateOptions(e){d7(this._configurationService,e,!0),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_createInnerEditor(e,t,i){return e.createInstance(u7,t,i)}getOriginalEditor(){return super.getOriginalEditor()}getModifiedEditor(){return super.getModifiedEditor()}addCommand(e,t,i){return this.getModifiedEditor().addCommand(e,t,i)}createContextKey(e,t){return this.getModifiedEditor().createContextKey(e,t)}addAction(e){return this.getModifiedEditor().addAction(e)}};fne=Yce([Fn(2,st),Fn(3,Dt),Fn(4,Ni),Fn(5,Xd),Fn(6,qs),Fn(7,Ut),Fn(8,Yd),Fn(9,eb),Fn(10,ed),Fn(11,bb)],fne);function LFe(n,e,t,i,s){if(t=t||"",!i){const r=t.indexOf(`
|
|
1647
1647
|
`);let o=t;return r!==-1&&(o=t.substring(0,r)),q0e(n,t,e.createByFilepathOrFirstLine(s||null,o),s)}return q0e(n,t,e.createById(i),s)}function q0e(n,e,t,i){return n.createModel(e,t,i)}G("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},S(142,"The background color of the diff editor's header"));G("multiDiffEditor.background",pr,S(143,"The background color of the multi file diff editor"));G("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},S(144,"The border color of the multi file diff editor"));var AWt=function(n,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(e,t,r):o(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r},K0e=function(n,e){return function(t,i){e(t,i,n)}};class MWt{constructor(e,t){this.viewModel=e,this.deltaScrollVertical=t}getId(){return this.viewModel}}let gne=class extends ie{constructor(e,t,i,s,r){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=i,this._instantiationService=s,this._viewModel=Et(this,void 0),this._collapsed=me(this,l=>{var c;return(c=this._viewModel.read(l))==null?void 0:c.collapsed.read(l)}),this._editorContentHeight=Et(this,500),this.contentHeight=me(this,l=>(this._collapsed.read(l)?0:this._editorContentHeight.read(l))+this._outerEditorHeight),this._modifiedContentWidth=Et(this,0),this._modifiedWidth=Et(this,0),this._originalContentWidth=Et(this,0),this._originalWidth=Et(this,0),this.maxScroll=me(this,l=>{const c=this._modifiedContentWidth.read(l)-this._modifiedWidth.read(l),d=this._originalContentWidth.read(l)-this._originalWidth.read(l);return c>d?{maxScroll:c,width:this._modifiedWidth.read(l)}:{maxScroll:d,width:this._originalWidth.read(l)}}),this._elements=Di("div.multiDiffEntry",[Di("div.header@header",[Di("div.header-content",[Di("div.collapse-button@collapseButton"),Di("div.file-path",[Di("div.title.modified.show-file-icons@primaryPath",[]),Di("div.status.deleted@status",["R"]),Di("div.title.original.show-file-icons@secondaryPath",[])]),Di("div.actions@actions")])]),Di("div.editorParent",[Di("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(Tp,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode,fixedOverflowWidgets:!0},{})),this.isModifedFocused=Ss(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=Ss(this.editor.getOriginalEditor()).isFocused,this.isFocused=me(this,l=>this.isModifedFocused.read(l)||this.isOriginalFocused.read(l)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new ge),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;const o=new L9(this._elements.collapseButton,{});this._register(Ct(l=>{o.element.className="",o.icon=this._collapsed.read(l)?ye.chevronRight:ye.chevronDown})),this._register(o.onDidClick(()=>{var l;(l=this._viewModel.get())==null||l.collapsed.set(!this._collapsed.get(),void 0)})),this._register(Ct(l=>{this._elements.editor.style.display=this._collapsed.read(l)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(l=>{const c=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(c,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(l=>{const c=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(c,void 0)})),this._register(this.editor.onDidContentSizeChange(l=>{hI(c=>{this._editorContentHeight.set(l.contentHeight,c),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),c),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),c)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(l=>{if(this._isSettingScrollTop||!l.scrollTopChanged||!this._data)return;const c=l.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(c)})),this._register(Ct(l=>{var d;const c=(d=this._viewModel.read(l))==null?void 0:d.isActive.read(l);this._elements.root.classList.toggle("active",c)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(r.createScoped(this._elements.actions));const a=this._register(this._instantiationService.createChild(new dN([Dt,this._contextKeyService])));this._register(a.createInstance(pA,this._elements.actions,Je.MultiDiffEditorFileToolbar,{actionRunner:this._register(new fPe(()=>{var l,c;return((l=this._viewModel.get())==null?void 0:l.modifiedUri)??((c=this._viewModel.get())==null?void 0:c.originalUri)})),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:l=>l.startsWith("navigation")},actionViewItemProvider:(l,c)=>_le(a,l,c)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(s){return{...s,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(!e){hI(s=>{this._viewModel.set(void 0,s),this.editor.setDiffModel(null,s),this._dataStore.clear()});return}const i=e.viewModel.documentDiffItem;if(hI(s=>{var c,d;(c=this._resourceLabel)==null||c.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let r=!1,o=!1,a=!1,l="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(l="R",r=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(l="A",a=!0):(l="D",o=!0),this._elements.status.classList.toggle("renamed",r),this._elements.status.classList.toggle("deleted",o),this._elements.status.classList.toggle("added",a),this._elements.status.innerText=l,(d=this._resourceLabel2)==null||d.setUri(r?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,s),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,s),this.editor.updateOptions(t(i.options??{}))}),i.onOptionsDidChange&&this._dataStore.add(i.onOptionsDidChange(()=>{this.editor.updateOptions(t(i.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,s=>{s||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(const[s,r]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(s,r)}render(e,t,i,s){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";const r=e.length-this._headerHeight,o=Math.max(0,Math.min(s.start-e.start,r));this._elements.header.style.transform=`translateY(${o}px)`,hI(a=>{this.editor.layout({width:t-16-2,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=i,this.editor.getOriginalEditor().setScrollTop(i)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",o>0||i>0),this._elements.header.classList.toggle("collapsed",o===r)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};gne=AWt([K0e(3,st),K0e(4,Dt)],gne);class OWt{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){let t;if(this._unused.size===0)t=this._create(e),this._itemData.set(t,e);else{const i=[...this._unused.values()];t=i.find(s=>this._itemData.get(s).getId()===e.getId())??i[0],this._unused.delete(t),this._itemData.set(t,e),t.setData(e)}return this._used.add(t),{object:t,dispose:()=>{this._used.delete(t),this._unused.size>5?t.dispose():this._unused.add(t)}}}dispose(){for(const e of this._used)e.dispose();for(const e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}}var PWt=function(n,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(e,t,r):o(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r},Z0e=function(n,e){return function(t,i){e(t,i,n)}};let pne=class extends ie{constructor(e,t,i,s,r,o){super(),this._element=e,this._dimension=t,this._viewModel=i,this._workbenchUIElementFactory=s,this._parentContextKeyService=r,this._parentInstantiationService=o,this._scrollableElements=Di("div.scrollContent",[Di("div@content",{style:{overflow:"hidden"}}),Di("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new lN({forceIntegerValues:!1,scheduleAtNextAnimationFrame:c=>dc(ot(this._element),c),smoothScrollDuration:100})),this._scrollableElement=this._register(new QB(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=Di("div.monaco-component.multiDiffEditor",{},[Di("div",{},[this._scrollableElement.getDomNode()]),Di("div.placeholder@placeholder",{},[Di("div")])]),this._sizeObserver=this._register(new qOe(this._element,void 0)),this._objectPool=this._register(new OWt(c=>{const d=this._instantiationService.createInstance(gne,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return d.setData(c),d})),this.scrollTop=Wi(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=Wi(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=me(this,c=>{const d=this._viewModel.read(c);if(!d)return{items:[],getItem:m=>{throw new ft}};const u=d.items.read(c),h=new Map;return{items:u.map(m=>{var C;const b=c.store.add(new jWt(m,this._objectPool,this.scrollLeft,y=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+y})})),v=(C=this._lastDocStates)==null?void 0:C[b.getKey()];return v&&jn(y=>{b.setViewState(v,y)}),h.set(m,b),b}),getItem:m=>h.get(m)}}),this._viewItems=this._viewItemsInfo.map(this,c=>c.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(c,d)=>c.reduce((u,h)=>u+h.contentHeight.read(d)+this._spaceBetweenPx,0)),this.activeControl=me(this,c=>{var h,g;const d=(h=this._viewModel.read(c))==null?void 0:h.activeDiffItem.read(c);return d?(g=this._viewItemsInfo.read(c).getItem(d).template.read(c))==null?void 0:g.editor:void 0}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new dN([Dt,this._contextKeyService]))),this._contextKeyService.createKey(q.inMultiDiffEditor.key,!0),this._lastDocStates={},this._register(Aa((c,d)=>{const u=this._viewModel.read(c);if(u&&u.contextKeys)for(const[h,g]of Object.entries(u.contextKeys)){const m=this._contextKeyService.createKey(h,void 0);m.set(g),d.add(et(()=>m.reset()))}}));const a=this._parentContextKeyService.createKey(q.multiDiffEditorAllCollapsed.key,!1);this._register(Ct(c=>{const d=this._viewModel.read(c);if(d){const u=d.items.read(c).every(h=>h.collapsed.read(c));a.set(u)}})),this._register(Ct(c=>{const d=this._dimension.read(c);this._sizeObserver.observe(d)}));const l=me(c=>{if(this._viewItems.read(c).length>0)return;const u=this._viewModel.read(c);return!u||u.isLoading.read(c)?S(145,"Loading..."):S(146,"No Changed Files")});this._register(Ct(c=>{const d=l.read(c);this._elements.placeholder.innerText=d??"",this._elements.placeholder.classList.toggle("visible",!!d)})),this._scrollableElements.content.style.position="relative",this._register(Ct(c=>{const d=this._sizeObserver.height.read(c);this._scrollableElements.root.style.height=`${d}px`;const u=this._totalHeight.read(c);this._scrollableElements.content.style.height=`${u}px`;const h=this._sizeObserver.width.read(c);let g=h;const m=this._viewItems.read(c),b=bae(m,fa(v=>v.maxScroll.read(c).maxScroll,Fc));if(b){const v=b.maxScroll.read(c);g=h+v.maxScroll}this._scrollableElement.setScrollDimensions({width:h,height:d,scrollHeight:u,scrollWidth:g})})),e.replaceChildren(this._elements.root),this._register(et(()=>{e.replaceChildren()})),this._register(Ct(c=>{const d=this._viewModel.read(c);if(d&&!d.isLoading.read(c)){if(d.items.read(c).length===0||d.activeDiffItem.read(c))return;this.goToNextChange()}})),this._register(this._register(Ct(c=>{hI(d=>{this.render(c)})})))}reveal(e,t){var c;const i=this._viewItems.get(),s=i.findIndex(d=>{var u,h,g,m;return((u=d.viewModel.originalUri)==null?void 0:u.toString())===((h=e.original)==null?void 0:h.toString())&&((g=d.viewModel.modifiedUri)==null?void 0:g.toString())===((m=e.modified)==null?void 0:m.toString())});if(s===-1)throw new ft("Resource not found in diff editor");const r=i[s];this._viewModel.get().activeDiffItem.setCache(r.viewModel,void 0);let o=0;for(let d=0;d<s;d++)o+=i[d].contentHeight.get()+this._spaceBetweenPx;this._scrollableElement.setScrollPosition({scrollTop:o});const a=(c=r.template.get())==null?void 0:c.editor,l="original"in e?a==null?void 0:a.getOriginalEditor():a==null?void 0:a.getModifiedEditor();l&&(t!=null&&t.range)&&(l.revealRangeInCenter(t.range),FWt(l,t.range))}goToNextChange(){this._navigateToChange("next")}_navigateToChange(e){var l,c,d,u,h;const t=this._viewItems.get();if(t.length===0)return;const i=(l=this._viewModel.get())==null?void 0:l.activeDiffItem.get(),s=i?t.findIndex(g=>g.viewModel===i):-1;if(s===-1){this._goToFile(0,"first");return}const r=t[s];r.viewModel.collapsed.get()&&r.viewModel.collapsed.set(!1,void 0);const o=(c=r.template.get())==null?void 0:c.editor;if((u=(d=o==null?void 0:o.getDiffComputationResult())==null?void 0:d.changes2)!=null&&u.length){const g=((h=o.getModifiedEditor().getPosition())==null?void 0:h.lineNumber)||1,m=o.getDiffComputationResult().changes2;if(e==="next"?m.some(v=>v.modified.startLineNumber>g):m.some(v=>v.modified.endLineNumberExclusive<=g)){o.goToDiff(e);return}}const a=(s+(e==="next"?1:-1)+t.length)%t.length;this._goToFile(a,e==="next"?"first":"last")}_goToFile(e,t){var r,o,a;const i=this._viewItems.get()[e];i.viewModel.collapsed.get()&&i.viewModel.collapsed.set(!1,void 0),this.reveal({original:i.viewModel.originalUri,modified:i.viewModel.modifiedUri});const s=(r=i.template.get())==null?void 0:r.editor;if((a=(o=s==null?void 0:s.getDiffComputationResult())==null?void 0:o.changes2)!=null&&a.length)if(t==="first")s.revealFirstDiff();else{const l=s.getDiffComputationResult().changes2.at(-1),c=s.getModifiedEditor();c.setPosition({lineNumber:l.modified.startLineNumber,column:1}),c.revealLineInCenter(l.modified.startLineNumber)}s==null||s.focus()}render(e){const t=this.scrollTop.read(e);let i=0,s=0,r=0;const o=this._sizeObserver.height.read(e),a=it.ofStartAndLength(t,o),l=this._sizeObserver.width.read(e);for(const c of this._viewItems.read(e)){const d=c.contentHeight.read(e),u=Math.min(d,o),h=it.ofStartAndLength(s,u),g=it.ofStartAndLength(r,d);if(g.isBefore(a))i-=d-u,c.hide();else if(g.isAfter(a))c.hide();else{const m=Math.max(0,Math.min(a.start-g.start,d-u));i-=m;const b=it.ofStartAndLength(t+i,o);c.render(h,m,l,b)}s+=u+this._spaceBetweenPx,r+=d+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+i)}px)`}};pne=PWt([Z0e(4,Dt),Z0e(5,st)],pne);function FWt(n,e){const t=n.getModel(),i=n.createDecorationsCollection([{range:e,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{n.getModel()===t&&i.clear()},350)}class jWt extends ie{constructor(e,t,i,s){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=i,this._deltaScrollVertical=s,this._templateRef=this._register(Moe(this,void 0)),this.contentHeight=me(this,r=>{var o,a;return((a=(o=this._templateRef.read(r))==null?void 0:o.object.contentHeight)==null?void 0:a.read(r))??this.viewModel.lastTemplateData.read(r).contentHeight}),this.maxScroll=me(this,r=>{var o;return((o=this._templateRef.read(r))==null?void 0:o.object.maxScroll.read(r))??{maxScroll:0,scrollWidth:0}}),this.template=me(this,r=>{var o;return(o=this._templateRef.read(r))==null?void 0:o.object}),this._isHidden=Et(this,!1),this._isFocused=me(this,r=>{var o;return((o=this.template.read(r))==null?void 0:o.isFocused.read(r))??!1}),this.viewModel.setIsFocused(this._isFocused,void 0),this._register(Ct(r=>{var a;const o=this._scrollLeft.read(r);(a=this._templateRef.read(r))==null||a.object.setScrollLeft(o)})),this._register(Ct(r=>{const o=this._templateRef.read(r);!o||!this._isHidden.read(r)||o.object.isFocused.read(r)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){var e;return`VirtualViewItem(${(e=this.viewModel.documentDiffItem.modified)==null?void 0:e.uri.toString()})`}getKey(){return this.viewModel.getKey()}setViewState(e,t){var o;this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);const i=this.viewModel.lastTemplateData.get(),s=(o=e.selections)==null?void 0:o.map(qe.liftSelection);this.viewModel.lastTemplateData.set({...i,selections:s},t);const r=this._templateRef.get();r&&s&&r.object.editor.setSelections(s)}_updateTemplateData(e){const t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){const e=this._templateRef.get();e&&jn(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,i,s){this._isHidden.set(!1,void 0);let r=this._templateRef.get();if(!r){r=this._objectPool.getUnusedObj(new MWt(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(r,void 0);const o=this.viewModel.lastTemplateData.get().selections;o&&r.object.editor.setSelections(o)}r.object.render(e,i,t,s)}}var HWt=function(n,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(e,t,r):o(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r},BWt=function(n,e){return function(t,i){e(t,i,n)}};let mne=class extends ie{constructor(e,t,i){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=i,this._dimension=Et(this,void 0),this._viewModel=Et(this,void 0),this._widgetImpl=me(this,s=>s.store.add(this._instantiationService.createInstance(km(pne),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))),this._register($D(this._widgetImpl))}};mne=HWt([BWt(2,st)],mne);function VWt(n,e,t){return kt.initialize(t||{}).createInstance(hne,n,e)}function WWt(n){return kt.get(Ni).onCodeEditorAdd(t=>{n(t)})}function zWt(n){return kt.get(Ni).onDiffEditorAdd(t=>{n(t)})}function UWt(){return kt.get(Ni).listCodeEditors()}function $Wt(){return kt.get(Ni).listDiffEditors()}function GWt(n,e,t){return kt.initialize(t||{}).createInstance(fne,n,e)}function qWt(n,e){const t=kt.initialize(e||{});return new mne(n,{},t)}function KWt(n){if(typeof n.id!="string"||typeof n.run!="function")throw new Error("Invalid command descriptor, `id` and `run` are required properties!");return wi.registerCommand(n.id,n.run)}function ZWt(n){if(typeof n.id!="string"||typeof n.label!="string"||typeof n.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");const e=ve.deserialize(n.precondition),t=(s,...r)=>so.runEditorCommand(s,r,e,(o,a,l)=>Promise.resolve(n.run(a,...l))),i=new ge;if(i.add(wi.registerCommand(n.id,t)),n.contextMenuGroupId){const s={command:{id:n.id,title:n.label},when:e,group:n.contextMenuGroupId,order:n.contextMenuOrder||0};i.add(No.appendMenuItem(Je.EditorContext,s))}if(Array.isArray(n.keybindings)){const s=kt.get(Mi);if(!(s instanceof LR))console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");else{const r=ve.and(e,ve.deserialize(n.keybindingContext));i.add(s.addDynamicKeybindings(n.keybindings.map(o=>({keybinding:o,command:n.id,when:r}))))}}return i}function YWt(n){return EFe([n])}function EFe(n){const e=kt.get(Mi);return e instanceof LR?e.addDynamicKeybindings(n.map(t=>({keybinding:t.keybinding,command:t.command,commandArgs:t.commandArgs,when:ve.deserialize(t.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),ie.None)}function XWt(n,e,t){const i=kt.get(Gs),s=i.getLanguageIdByMimeType(e)||e;return LFe(kt.get(xs),i,n,s,t)}function QWt(n,e){const t=kt.get(Gs),i=t.getLanguageIdByMimeType(e)||e||Hd;n.setLanguage(t.createById(i))}function JWt(n,e,t){n&&kt.get(Gp).changeOne(e,n.uri,t)}function ezt(n){kt.get(Gp).changeAll(n,[])}function tzt(n){return kt.get(Gp).read(n)}function izt(n){return kt.get(Gp).onMarkerChanged(n)}function nzt(n){return kt.get(xs).getModel(n)}function szt(){return kt.get(xs).getModels()}function rzt(n){return kt.get(xs).onModelAdded(n)}function ozt(n){return kt.get(xs).onModelRemoved(n)}function azt(n){return kt.get(xs).onModelLanguageChanged(t=>{n({model:t.model,oldLanguage:t.oldLanguageId})})}function lzt(n){return gBt(kt.get(xs),n)}function czt(n,e){const t=kt.get(Gs),i=kt.get(Xd);return $ce.colorizeElement(i,t,n,e).then(()=>{i.registerEditorContainer(n)})}function dzt(n,e,t){const i=kt.get(Gs);return kt.get(Xd).registerEditorContainer(dn.document.body),$ce.colorize(i,n,e,t)}function uzt(n,e,t=4){return kt.get(Xd).registerEditorContainer(dn.document.body),$ce.colorizeModelLine(n,e,t)}function hzt(n){const e=Vs.get(n);return e||{getInitialState:()=>rR,tokenize:(t,i,s)=>Fae(n,s)}}function fzt(n,e){Vs.getOrCreate(e);const t=hzt(e),i=Xc(n),s=[];let r=t.getInitialState();for(let o=0,a=i.length;o<a;o++){const l=i[o],c=t.tokenize(l,!0,r);s[o]=c.tokens,r=c.endState}return s}function gzt(n,e){kt.get(Xd).defineTheme(n,e)}function pzt(n){kt.get(Xd).setTheme(n)}function mzt(){JZ.clearAllFontInfos()}function _zt(n,e){return wi.registerCommand({id:n,handler:e})}function bzt(n){return kt.get(wb).registerOpener({async open(t){return typeof t=="string"&&(t=ut.parse(t)),n.open(t)}})}function vzt(n){return kt.get(Ni).registerCodeEditorOpenHandler(async(t,i,s)=>{var a;if(!i)return null;const r=(a=t.options)==null?void 0:a.selection;let o;return r&&typeof r.endLineNumber=="number"&&typeof r.endColumn=="number"?o=r:r&&(o={lineNumber:r.startLineNumber,column:r.startColumn}),await n.openCodeEditor(i,t.resource,o)?i:null})}function Czt(){return{create:VWt,getEditors:UWt,getDiffEditors:$Wt,onDidCreateEditor:WWt,onDidCreateDiffEditor:zWt,createDiffEditor:GWt,addCommand:KWt,addEditorAction:ZWt,addKeybindingRule:YWt,addKeybindingRules:EFe,createModel:XWt,setModelLanguage:QWt,setModelMarkers:JWt,getModelMarkers:tzt,removeAllMarkers:ezt,onDidChangeMarkers:izt,getModels:szt,getModel:nzt,onDidCreateModel:rzt,onWillDisposeModel:ozt,onDidChangeModelLanguage:azt,createWebWorker:lzt,colorizeElement:czt,colorize:dzt,colorizeModelLine:uzt,tokenize:fzt,defineTheme:gzt,setTheme:pzt,remeasureFonts:mzt,registerCommand:_zt,registerLinkOpener:bzt,registerEditorOpener:vzt,AccessibilitySupport:hte,ContentWidgetPositionPreference:bte,CursorChangeReason:vte,DefaultEndOfLine:Cte,EditorAutoIndentStrategy:yte,EditorOption:Ste,EndOfLinePreference:xte,EndOfLineSequence:Lte,MinimapPosition:Fte,MinimapSectionHeaderStyle:jte,MouseTargetType:Hte,OverlayWidgetPositionPreference:Wte,OverviewRulerLane:zte,GlyphMarginLane:Ete,RenderLineNumbersType:Gte,RenderMinimap:qte,ScrollbarVisibility:Zte,ScrollType:Kte,TextEditorCursorBlinkingStyle:iie,TextEditorCursorStyle:nie,TrackedRangeStickiness:sie,WrappingIndent:rie,InjectedTextCursorStops:Nte,PositionAffinity:$te,ShowLightbulbIconMode:Xte,TextDirection:tie,ConfigurationChangedEvent:rAe,BareFontInfo:aS,FontInfo:y8,TextModelResolvedOptions:S5,FindMatch:k2,ApplyUpdateResult:zI,EditorZoom:Du,createMultiFileDiffEditor:qWt,EditorType:hO,EditorOptions:Qa}}function wzt(n,e){if(!e||!Array.isArray(e))return!1;for(const t of e)if(!n(t))return!1;return!0}function $3(n,e){return typeof n=="boolean"?n:e}function Y0e(n,e){return typeof n=="string"?n:e}function yzt(n){const e={};for(const t of n)e[t]=!0;return e}function X0e(n,e=!1){e&&(n=n.map(function(i){return i.toLowerCase()}));const t=yzt(n);return e?function(i){return t[i.toLowerCase()]!==void 0&&t.hasOwnProperty(i.toLowerCase())}:function(i){return t[i]!==void 0&&t.hasOwnProperty(i)}}function _ne(n,e,t){e=e.replace(/@@/g,"");let i=0,s;do s=!1,e=e.replace(/@(\w+)/g,function(o,a){s=!0;let l="";if(typeof n[a]=="string")l=n[a];else if(n[a]&&n[a]instanceof RegExp)l=n[a].source;else throw n[a]===void 0?os(n,"language definition does not contain attribute '"+a+"', used at: "+e):os(n,"attribute reference '"+a+"' must be a string, used at: "+e);return Uw(l)?"":"(?:"+l+")"}),i++;while(s&&i<5);e=e.replace(/\x01/g,"@");const r=(n.ignoreCase?"i":"")+(n.unicode?"u":"");if(t&&e.match(/\$[sS](\d\d?)/g)){let a=null,l=null;return c=>(l&&a===c||(a=c,l=new RegExp(vBt(n,e,c),r)),l)}return new RegExp(e,r)}function Szt(n,e,t,i){if(i<0)return n;if(i<e.length)return e[i];if(i>=100){i=i-100;const s=t.split(".");if(s.unshift(t),i<s.length)return s[i]}return null}function xzt(n,e,t,i){let s=-1,r=t,o=t.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);o&&(o[3]&&(s=parseInt(o[3]),o[2]&&(s=s+100)),r=o[4]);let a="~",l=r;!r||r.length===0?(a="!=",l=""):/^\w*$/.test(l)?a="==":(o=r.match(/^(@|!@|~|!~|==|!=)(.*)$/),o&&(a=o[1],l=o[2]));let c;if((a==="~"||a==="!~")&&/^(\w|\|)*$/.test(l)){const d=X0e(l.split("|"),n.ignoreCase);c=function(u){return a==="~"?d(u):!d(u)}}else if(a==="@"||a==="!@"){const d=n[l];if(!d)throw os(n,"the @ match target '"+l+"' is not defined, in rule: "+e);if(!wzt(function(h){return typeof h=="string"},d))throw os(n,"the @ match target '"+l+"' must be an array of strings, in rule: "+e);const u=X0e(d,n.ignoreCase);c=function(h){return a==="@"?u(h):!u(h)}}else if(a==="~"||a==="!~")if(l.indexOf("$")<0){const d=_ne(n,"^"+l+"$",!1);c=function(u){return a==="~"?d.test(u):!d.test(u)}}else c=function(d,u,h,g){return _ne(n,"^"+kv(n,l,u,h,g)+"$",!1).test(d)};else if(l.indexOf("$")<0){const d=P_(n,l);c=function(u){return a==="=="?u===d:u!==d}}else{const d=P_(n,l);c=function(u,h,g,m,b){const v=kv(n,d,h,g,m);return a==="=="?u===v:u!==v}}return s===-1?{name:t,value:i,test:function(d,u,h,g){return c(d,d,u,h,g)}}:{name:t,value:i,test:function(d,u,h,g){const m=Szt(d,u,h,s);return c(m||"",d,u,h,g)}}}function bne(n,e,t){if(t){if(typeof t=="string")return t;if(t.token||t.token===""){if(typeof t.token!="string")throw os(n,"a 'token' attribute must be of type string, in rule: "+e);{const i={token:t.token};if(t.token.indexOf("$")>=0&&(i.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")i.bracket=1;else if(t.bracket==="@close")i.bracket=-1;else throw os(n,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw os(n,"the next state must be a string value in rule: "+e);{let s=t.next;if(!/^(@pop|@push|@popall)$/.test(s)&&(s[0]==="@"&&(s=s.substr(1)),s.indexOf("$")<0&&!CBt(n,kv(n,s,"",[],""))))throw os(n,"the next state '"+t.next+"' is not defined in rule: "+e);i.next=s}}return typeof t.goBack=="number"&&(i.goBack=t.goBack),typeof t.switchTo=="string"&&(i.switchTo=t.switchTo),typeof t.log=="string"&&(i.log=t.log),typeof t.nextEmbedded=="string"&&(i.nextEmbedded=t.nextEmbedded,n.usesEmbedded=!0),i}}else if(Array.isArray(t)){const i=[];for(let s=0,r=t.length;s<r;s++)i[s]=bne(n,e,t[s]);return{group:i}}else if(t.cases){const i=[];let s=!1;for(const o in t.cases)if(t.cases.hasOwnProperty(o)){const a=bne(n,e,t.cases[o]);o==="@default"||o==="@"||o===""?i.push({test:void 0,value:a,name:o}):o==="@eos"?i.push({test:function(l,c,d,u){return u},value:a,name:o}):i.push(xzt(n,e,o,a)),s||(s=!po(a)&&(a.hasEmbeddedEndInCases||["@pop","@popall"].includes(a.nextEmbedded||"")))}const r=n.defaultToken;return{hasEmbeddedEndInCases:s,test:function(o,a,l,c){for(const d of i)if(!d.test||d.test(o,a,l,c))return d.value;return r}}}else throw os(n,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+e)}else return{token:""}}class Lzt{constructor(e){this.regex=new RegExp(""),this.action={token:""},this.matchOnlyAtLineStart=!1,this.name="",this.name=e}setRegex(e,t){let i;if(typeof t=="string")i=t;else if(t instanceof RegExp)i=t.source;else throw os(e,"rules must start with a match string or regular expression: "+this.name);this.matchOnlyAtLineStart=i.length>0&&i[0]==="^",this.name=this.name+": "+i,this.regex=_ne(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")",!0)}setAction(e,t){this.action=bne(e,this.name,t)}resolveRegex(e){return this.regex instanceof RegExp?this.regex:this.regex(e)}}function DFe(n,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");const t={languageId:n,includeLF:$3(e.includeLF,!1),noThrow:!1,maxStack:100,start:typeof e.start=="string"?e.start:null,ignoreCase:$3(e.ignoreCase,!1),unicode:$3(e.unicode,!1),tokenPostfix:Y0e(e.tokenPostfix,"."+n),defaultToken:Y0e(e.defaultToken,"source"),usesEmbedded:!1,stateNames:{},tokenizer:{},brackets:[]},i=e;i.languageId=n,i.includeLF=t.includeLF,i.ignoreCase=t.ignoreCase,i.unicode=t.unicode,i.noThrow=t.noThrow,i.usesEmbedded=t.usesEmbedded,i.stateNames=e.tokenizer,i.defaultToken=t.defaultToken;function s(o,a,l){for(const c of l){let d=c.include;if(d){if(typeof d!="string")throw os(t,"an 'include' attribute must be a string at: "+o);if(d[0]==="@"&&(d=d.substr(1)),!e.tokenizer[d])throw os(t,"include target '"+d+"' is not defined at: "+o);s(o+"."+d,a,e.tokenizer[d])}else{const u=new Lzt(o);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(u.setRegex(i,c[0]),c.length>=3)if(typeof c[1]=="string")u.setAction(i,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){const h=c[1];h.next=c[2],u.setAction(i,h)}else throw os(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+o);else u.setAction(i,c[1]);else{if(!c.regex)throw os(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+o);c.name&&typeof c.name=="string"&&(u.name=c.name),c.matchOnlyAtStart&&(u.matchOnlyAtLineStart=$3(c.matchOnlyAtLineStart,!1)),u.setRegex(i,c.regex),u.setAction(i,c.action)}a.push(u)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw os(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(const o in e.tokenizer)if(e.tokenizer.hasOwnProperty(o)){t.start||(t.start=o);const a=e.tokenizer[o];t.tokenizer[o]=new Array,s("tokenizer."+o,t.tokenizer[o],a)}if(t.usesEmbedded=i.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw os(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];const r=[];for(const o of e.brackets){let a=o;if(a&&Array.isArray(a)&&a.length===3&&(a={token:a[2],open:a[0],close:a[1]}),a.open===a.close)throw os(t,"open and close brackets in a 'brackets' attribute must be different: "+a.open+`
|
|
1648
|
-
hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")r.push({token:a.token+t.tokenPostfix,open:P_(t,a.open),close:P_(t,a.close)});else throw os(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=r,t.noThrow=!0,t}function Ezt(n){qD.registerLanguage(n)}function Dzt(){let n=[];return n=n.concat(qD.getLanguages()),n}function Rzt(n){return kt.get(Gs).languageIdCodec.encodeLanguageId(n)}function Nzt(n,e){return kt.withServices(()=>{const i=kt.get(Gs).onDidRequestRichLanguageFeatures(s=>{s===n&&(i.dispose(),e())});return i})}function Tzt(n,e){return kt.withServices(()=>{const i=kt.get(Gs).onDidRequestBasicLanguageFeatures(s=>{s===n&&(i.dispose(),e())});return i})}function Izt(n,e){if(!kt.get(Gs).isRegisteredLanguageId(n))throw new Error(`Cannot set configuration for unknown language ${n}`);return kt.get(Ls).register(n,e,100)}class kzt{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if(typeof this._actual.tokenize=="function")return lM.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){const s=this._actual.tokenizeEncoded(e,i);return new iV(s.tokens,s.endState)}}class lM{constructor(e,t,i,s){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=s}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const i=[];let s=0;for(let r=0,o=e.length;r<o;r++){const a=e[r];let l=a.startIndex;r===0?l=0:l<s&&(l=s),i[r]=new G2(l,a.scopes,t),s=l}return i}static adaptTokenize(e,t,i,s){const r=t.tokenize(i,s),o=lM._toClassicTokens(r.tokens,e);let a;return r.endState.equals(s)?a=s:a=r.endState,new vae(o,a)}tokenize(e,t,i){return lM.adaptTokenize(this._languageId,this._actual,e,i)}_toBinaryTokens(e,t){const i=e.encodeLanguageId(this._languageId),s=this._standaloneThemeService.getColorTheme().tokenTheme,r=[];let o=0,a=0;for(let c=0,d=t.length;c<d;c++){const u=t[c],h=s.match(i,u.scopes)|1024;if(o>0&&r[o-1]===h)continue;let g=u.startIndex;c===0?g=0:g<a&&(g=a),r[o++]=g,r[o++]=h,a=g}const l=new Uint32Array(o);for(let c=0;c<o;c++)l[c]=r[c];return l}tokenizeEncoded(e,t,i){const s=this._actual.tokenize(e,i),r=this._toBinaryTokens(this._languageService.languageIdCodec,s.tokens);let o;return s.endState.equals(i)?o=i:o=s.endState,new iV(r,o)}}function Azt(n){return typeof n.getInitialState=="function"}function Mzt(n){return"tokenizeEncoded"in n}function RFe(n){return n&&typeof n.then=="function"}function Ozt(n){const e=kt.get(Xd);if(n){const t=[null];for(let i=1,s=n.length;i<s;i++)t[i]=pe.fromHex(n[i]);e.setColorMapOverride(t)}else e.setColorMapOverride(null)}function NFe(n,e){return Mzt(e)?new kzt(n,e):new lM(n,e,kt.get(Gs),kt.get(Xd))}function Xce(n,e){const t=new k0t(async()=>{const i=await Promise.resolve(e.create());return i?Azt(i)?NFe(n,i):new tM(kt.get(Gs),kt.get(Xd),n,DFe(n,i),kt.get(Ut)):null});return Vs.registerFactory(n,t)}function Pzt(n,e){if(!kt.get(Gs).isRegisteredLanguageId(n))throw new Error(`Cannot set tokens provider for unknown language ${n}`);return RFe(e)?Xce(n,{create:()=>e}):Vs.register(n,NFe(n,e))}function Fzt(n,e){const t=i=>new tM(kt.get(Gs),kt.get(Xd),n,DFe(n,i),kt.get(Ut));return RFe(e)?Xce(n,{create:()=>e}):Vs.register(n,t(e))}function jzt(n,e){return kt.get(Xe).referenceProvider.register(n,e)}function Hzt(n,e){return kt.get(Xe).renameProvider.register(n,e)}function Bzt(n,e){return kt.get(Xe).newSymbolNamesProvider.register(n,e)}function Vzt(n,e){return kt.get(Xe).signatureHelpProvider.register(n,e)}function Wzt(n,e){return kt.get(Xe).hoverProvider.register(n,{provideHover:async(i,s,r,o)=>{const a=i.getWordAtPosition(s);return Promise.resolve(e.provideHover(i,s,r,o)).then(l=>{if(l)return!l.range&&a&&(l.range=new F(s.lineNumber,a.startColumn,s.lineNumber,a.endColumn)),l.range||(l.range=new F(s.lineNumber,s.column,s.lineNumber,s.column)),l})}})}function zzt(n,e){return kt.get(Xe).documentSymbolProvider.register(n,e)}function Uzt(n,e){return kt.get(Xe).documentHighlightProvider.register(n,e)}function $zt(n,e){return kt.get(Xe).linkedEditingRangeProvider.register(n,e)}function Gzt(n,e){return kt.get(Xe).definitionProvider.register(n,e)}function qzt(n,e){return kt.get(Xe).implementationProvider.register(n,e)}function Kzt(n,e){return kt.get(Xe).typeDefinitionProvider.register(n,e)}function Zzt(n,e){return kt.get(Xe).codeLensProvider.register(n,e)}function Yzt(n,e,t){return kt.get(Xe).codeActionProvider.register(n,{providedCodeActionKinds:t==null?void 0:t.providedCodeActionKinds,documentation:t==null?void 0:t.documentation,provideCodeActions:(s,r,o,a)=>{const c=kt.get(Gp).read({resource:s.uri}).filter(d=>F.areIntersectingOrTouching(d,r));return e.provideCodeActions(s,r,{markers:c,only:o.only,trigger:o.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function Xzt(n,e){return kt.get(Xe).documentFormattingEditProvider.register(n,e)}function Qzt(n,e){return kt.get(Xe).documentRangeFormattingEditProvider.register(n,e)}function Jzt(n,e){return kt.get(Xe).onTypeFormattingEditProvider.register(n,e)}function eUt(n,e){return kt.get(Xe).linkProvider.register(n,e)}function tUt(n,e){return kt.get(Xe).completionProvider.register(n,e)}function iUt(n,e){return kt.get(Xe).colorProvider.register(n,e)}function nUt(n,e){return kt.get(Xe).foldingRangeProvider.register(n,e)}function sUt(n,e){return kt.get(Xe).declarationProvider.register(n,e)}function rUt(n,e){return kt.get(Xe).selectionRangeProvider.register(n,e)}function oUt(n,e){return kt.get(Xe).documentSemanticTokensProvider.register(n,e)}function aUt(n,e){return kt.get(Xe).documentRangeSemanticTokensProvider.register(n,e)}function lUt(n,e){return kt.get(Xe).inlineCompletionsProvider.register(n,e)}function cUt(n,e){return kt.get(Xe).inlayHintsProvider.register(n,e)}function dUt(){return{register:Ezt,getLanguages:Dzt,onLanguage:Nzt,onLanguageEncountered:Tzt,getEncodedLanguageId:Rzt,setLanguageConfiguration:Izt,setColorMap:Ozt,registerTokensProviderFactory:Xce,setTokensProvider:Pzt,setMonarchTokensProvider:Fzt,registerReferenceProvider:jzt,registerRenameProvider:Hzt,registerNewSymbolNameProvider:Bzt,registerCompletionItemProvider:tUt,registerSignatureHelpProvider:Vzt,registerHoverProvider:Wzt,registerDocumentSymbolProvider:zzt,registerDocumentHighlightProvider:Uzt,registerLinkedEditingRangeProvider:$zt,registerDefinitionProvider:Gzt,registerImplementationProvider:qzt,registerTypeDefinitionProvider:Kzt,registerCodeLensProvider:Zzt,registerCodeActionProvider:Yzt,registerDocumentFormattingEditProvider:Xzt,registerDocumentRangeFormattingEditProvider:Qzt,registerOnTypeFormattingEditProvider:Jzt,registerLinkProvider:eUt,registerColorProvider:iUt,registerFoldingRangeProvider:nUt,registerDeclarationProvider:sUt,registerSelectionRangeProvider:rUt,registerDocumentSemanticTokensProvider:oUt,registerDocumentRangeSemanticTokensProvider:aUt,registerInlineCompletionsProvider:lUt,registerInlayHintsProvider:cUt,DocumentHighlightKind:wte,CompletionItemKind:pte,CompletionItemTag:mte,CompletionItemInsertTextRule:gte,SymbolKind:Jte,SymbolTag:eie,IndentAction:Rte,CompletionTriggerKind:_te,SignatureHelpTriggerKind:Qte,InlayHintKind:Tte,InlineCompletionTriggerKind:Ate,CodeActionTriggerType:fte,NewSymbolNameTag:Bte,NewSymbolNameTriggerKind:Vte,PartialAcceptTriggerKind:Ute,HoverVerbosityAction:Dte,InlineCompletionEndOfLifeReasonKind:Ite,InlineCompletionHintStyle:kte,FoldingRangeKind:ex,SelectedSuggestionInfo:cMe,EditDeltaInfo:sA}}Qa.wrappingIndent.defaultValue=0;Qa.glyphMargin.defaultValue=!1;Qa.autoIndent.defaultValue=3;Qa.overviewRulerLanes.defaultValue=2;AA.setFormatterSelector((n,e,t)=>Promise.resolve(n[0]));const Vl=iFe();Vl.editor=Czt();Vl.languages=dUt();const uUt=Vl.CancellationTokenSource,ER=Vl.Emitter,hUt=Vl.KeyCode,fUt=Vl.KeyMod,gUt=Vl.Position,pUt=Vl.Range,mUt=Vl.Selection,_Ut=Vl.SelectionDirection,m_=Vl.MarkerSeverity,vne=Vl.MarkerTag,bUt=Vl.Uri,vUt=Vl.Token,TFe=Vl.editor,Nt=Vl.languages,Wq=ooe(),gD=globalThis;(Wq!=null&&Wq.globalAPI||typeof gD.define=="function"&&gD.define.amd)&&(gD.monaco=Vl);typeof gD.require<"u"&&typeof gD.require.config=="function"&&gD.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});const CUt=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:uUt,Emitter:ER,KeyCode:hUt,KeyMod:fUt,MarkerSeverity:m_,MarkerTag:vne,Position:gUt,Range:pUt,Selection:mUt,SelectionDirection:_Ut,Token:vUt,Uri:bUt,editor:TFe,languages:Nt},Symbol.toStringTag,{value:"Module"}));let Qce=class{constructor(e,t,i){this._onDidChange=new ER,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const Jce={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},ede={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},IFe=new Qce("css",Jce,ede),kFe=new Qce("scss",Jce,ede),AFe=new Qce("less",Jce,ede);function tde(){return pt(()=>import("./cssMode-D9TF1LHV.js"),__vite__mapDeps([0,1]))}Nt.onLanguage("less",()=>{tde().then(n=>n.setupMode(AFe))});Nt.onLanguage("scss",()=>{tde().then(n=>n.setupMode(kFe))});Nt.onLanguage("css",()=>{tde().then(n=>n.setupMode(IFe))});const wUt=Object.freeze(Object.defineProperty({__proto__:null,cssDefaults:IFe,lessDefaults:AFe,scssDefaults:kFe},Symbol.toStringTag,{value:"Module"}));let yUt=class{constructor(e,t,i){this._onDidChange=new ER,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const SUt={tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},YV={format:SUt,suggest:{},data:{useDefaultDataProvider:!0}};function XV(n){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:n===kk,documentFormattingEdits:n===kk,documentRangeFormattingEdits:n===kk}}const kk="html",Q0e="handlebars",J0e="razor",MFe=QV(kk,YV,XV(kk)),xUt=MFe.defaults,OFe=QV(Q0e,YV,XV(Q0e)),LUt=OFe.defaults,PFe=QV(J0e,YV,XV(J0e)),EUt=PFe.defaults;function DUt(){return pt(()=>import("./htmlMode-BonALoV1.js"),__vite__mapDeps([2,1]))}function QV(n,e=YV,t=XV(n)){const i=new yUt(n,e,t);let s;const r=Nt.onLanguage(n,async()=>{s=(await DUt()).setupMode(i)});return{defaults:i,dispose(){r.dispose(),s==null||s.dispose(),s=void 0}}}const RUt=Object.freeze(Object.defineProperty({__proto__:null,handlebarDefaults:LUt,handlebarLanguageService:OFe,htmlDefaults:xUt,htmlLanguageService:MFe,razorDefaults:EUt,razorLanguageService:PFe,registerHTMLLanguageService:QV},Symbol.toStringTag,{value:"Module"}));let NUt=class{constructor(e,t,i){this._onDidChange=new ER,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const TUt={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},IUt={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},FFe=new NUt("json",TUt,IUt),kUt=()=>jFe().then(n=>n.getWorker());function jFe(){return pt(()=>import("./jsonMode-CtEgBKrb.js"),__vite__mapDeps([3,1]))}Nt.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});Nt.onLanguage("json",()=>{jFe().then(n=>n.setupMode(FFe))});const AUt=Object.freeze(Object.defineProperty({__proto__:null,getWorker:kUt,jsonDefaults:FFe},Symbol.toStringTag,{value:"Module"})),MUt="5.9.3";var HFe=(n=>(n[n.None=0]="None",n[n.CommonJS=1]="CommonJS",n[n.AMD=2]="AMD",n[n.UMD=3]="UMD",n[n.System=4]="System",n[n.ES2015=5]="ES2015",n[n.ESNext=99]="ESNext",n))(HFe||{}),BFe=(n=>(n[n.None=0]="None",n[n.Preserve=1]="Preserve",n[n.React=2]="React",n[n.ReactNative=3]="ReactNative",n[n.ReactJSX=4]="ReactJSX",n[n.ReactJSXDev=5]="ReactJSXDev",n))(BFe||{}),VFe=(n=>(n[n.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",n[n.LineFeed=1]="LineFeed",n))(VFe||{}),WFe=(n=>(n[n.ES3=0]="ES3",n[n.ES5=1]="ES5",n[n.ES2015=2]="ES2015",n[n.ES2016=3]="ES2016",n[n.ES2017=4]="ES2017",n[n.ES2018=5]="ES2018",n[n.ES2019=6]="ES2019",n[n.ES2020=7]="ES2020",n[n.ESNext=99]="ESNext",n[n.JSON=100]="JSON",n[n.Latest=99]="Latest",n))(WFe||{}),zFe=(n=>(n[n.Classic=1]="Classic",n[n.NodeJs=2]="NodeJs",n))(zFe||{});class UFe{constructor(e,t,i,s,r){this._onDidChange=new ER,this._onDidExtraLibsChange=new ER,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(e),this.setDiagnosticsOptions(t),this.setWorkerOptions(i),this.setInlayHintsOptions(s),this.setModeConfiguration(r),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(e,t){let i;if(typeof t>"u"?i=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:i=t,this._extraLibs[i]&&this._extraLibs[i].content===e)return{dispose:()=>{}};let s=1;return this._removedExtraLibs[i]&&(s=this._removedExtraLibs[i]+1),this._extraLibs[i]&&(s=this._extraLibs[i].version+1),this._extraLibs[i]={content:e,version:s},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let r=this._extraLibs[i];r&&r.version===s&&(delete this._extraLibs[i],this._removedExtraLibs[i]=s,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(e){for(const t in this._extraLibs)this._removedExtraLibs[t]=this._extraLibs[t].version;if(this._extraLibs=Object.create(null),e&&e.length>0)for(const t of e){const i=t.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,s=t.content;let r=1;this._removedExtraLibs[i]&&(r=this._removedExtraLibs[i]+1),this._extraLibs[i]={content:s,version:r}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(e){this._compilerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(e){this._workerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(e){this._inlayHintsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(e){}setEagerModelSync(e){this._eagerModelSync=e}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(void 0)}}const OUt=MUt,$Fe={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},GFe=new UFe({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},$Fe),qFe=new UFe({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},$Fe),PUt=()=>JV().then(n=>n.getTypeScriptWorker()),FUt=()=>JV().then(n=>n.getJavaScriptWorker());function JV(){return pt(()=>import("./tsMode-DSW0uCYz.js"),[])}Nt.onLanguage("typescript",()=>JV().then(n=>n.setupTypeScript(GFe)));Nt.onLanguage("javascript",()=>JV().then(n=>n.setupJavaScript(qFe)));const jUt=Object.freeze(Object.defineProperty({__proto__:null,JsxEmit:BFe,ModuleKind:HFe,ModuleResolutionKind:zFe,NewLineKind:VFe,ScriptTarget:WFe,getJavaScriptWorker:FUt,getTypeScriptWorker:PUt,javascriptDefaults:qFe,typescriptDefaults:GFe,typescriptVersion:OUt},Symbol.toStringTag,{value:"Module"})),KFe={},zq={};class ide{static getOrCreate(e){return zq[e]||(zq[e]=new ide(e)),zq[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,i)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=i})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,KFe[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}}function vt(n){const e=n.id;KFe[e]=n,Nt.register(n);const t=ide.getOrCreate(e);Nt.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),Nt.onLanguageEncountered(e,async()=>{const i=await t.load();Nt.setLanguageConfiguration(e,i.conf)})}vt({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>pt(()=>import("./abap-DLDM7-KI.js"),[])});vt({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>pt(()=>import("./apex-DNDY2TF8.js"),[])});vt({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>pt(()=>import("./azcli-Y6nb8tq_.js"),[])});vt({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>pt(()=>import("./bat-BwHxbl9M.js"),[])});vt({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>pt(()=>import("./bicep-CFznDFnq.js"),[])});vt({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>pt(()=>import("./cameligo-Bf6VGUru.js"),[])});vt({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>pt(()=>import("./clojure-Dnu-v4kV.js"),[])});vt({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>pt(()=>import("./coffee-Bd8akH9Z.js"),[])});vt({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>pt(()=>import("./cpp-BbWJElDN.js"),[])});vt({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>pt(()=>import("./cpp-BbWJElDN.js"),[])});vt({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>pt(()=>import("./csharp-Co3qMtFm.js"),[])});vt({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>pt(()=>import("./csp-D-4FJmMZ.js"),[])});vt({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>pt(()=>import("./css-DdJfP1eB.js"),[])});vt({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>pt(()=>import("./cypher-cTPe9QuQ.js"),[])});vt({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>pt(()=>import("./dart-BOtBlQCF.js"),[])});vt({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>pt(()=>import("./dockerfile-BG73LgW2.js"),[])});vt({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>pt(()=>import("./ecl-BEgZUVRK.js"),[])});vt({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>pt(()=>import("./elixir-BkW5O-1t.js"),[])});vt({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>pt(()=>import("./flow9-BeJ5waoc.js"),[])});vt({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>pt(()=>import("./fsharp-PahG7c26.js"),[])});vt({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>pt(()=>import("./freemarker2-DqUk05MV.js"),[]).then(n=>n.TagAutoInterpolationDollar)});vt({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>pt(()=>import("./freemarker2-DqUk05MV.js"),[]).then(n=>n.TagAngleInterpolationDollar)});vt({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>pt(()=>import("./freemarker2-DqUk05MV.js"),[]).then(n=>n.TagBracketInterpolationDollar)});vt({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>pt(()=>import("./freemarker2-DqUk05MV.js"),[]).then(n=>n.TagAngleInterpolationBracket)});vt({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>pt(()=>import("./freemarker2-DqUk05MV.js"),[]).then(n=>n.TagBracketInterpolationBracket)});vt({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>pt(()=>import("./freemarker2-DqUk05MV.js"),[]).then(n=>n.TagAutoInterpolationDollar)});vt({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>pt(()=>import("./freemarker2-DqUk05MV.js"),[]).then(n=>n.TagAutoInterpolationBracket)});vt({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>pt(()=>import("./go-acbASCJo.js"),[])});vt({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>pt(()=>import("./graphql-BxJiqAUM.js"),[])});vt({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>pt(()=>import("./handlebars-DkSDsDsd.js"),[])});vt({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>pt(()=>import("./hcl-DtV1sZF8.js"),[])});vt({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>pt(()=>import("./html-CX1Ba-zG.js"),[])});vt({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>pt(()=>import("./ini-Kd9XrMLS.js"),[])});vt({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>pt(()=>import("./java-CXBNlu9o.js"),[])});vt({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>pt(()=>import("./javascript-D6mAVD7m.js"),__vite__mapDeps([4,5]))});vt({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>pt(()=>import("./julia-cl7-CwDS.js"),[])});vt({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>pt(()=>import("./kotlin-s7OhZKlX.js"),[])});vt({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>pt(()=>import("./less-9HpZscsL.js"),[])});vt({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>pt(()=>import("./lexon-OrD6JF1K.js"),[])});vt({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>pt(()=>import("./lua-Cyyb5UIc.js"),[])});vt({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>pt(()=>import("./liquid-drE2VSI9.js"),[])});vt({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>pt(()=>import("./m3-B8OfTtLu.js"),[])});vt({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>pt(()=>import("./markdown-BFxVWTOG.js"),[])});vt({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>pt(()=>import("./mdx-C67NloL7.js"),[])});vt({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>pt(()=>import("./mips-CiqrrVzr.js"),[])});vt({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>pt(()=>import("./msdax-DmeGPVcC.js"),[])});vt({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>pt(()=>import("./mysql-C_tMU-Nz.js"),[])});vt({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>pt(()=>import("./objective-c-BDtDVThU.js"),[])});vt({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>pt(()=>import("./pascal-vHIfCaH5.js"),[])});vt({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>pt(()=>import("./pascaligo-DtZ0uQbO.js"),[])});vt({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>pt(()=>import("./perl-Ub6l9XKa.js"),[])});vt({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>pt(()=>import("./pgsql-BlNEE0v7.js"),[])});vt({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>pt(()=>import("./php-BBUBE1dy.js"),[])});vt({id:"pla",extensions:[".pla"],loader:()=>pt(()=>import("./pla-DSh2-awV.js"),[])});vt({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>pt(()=>import("./postiats-CocnycG-.js"),[])});vt({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>pt(()=>import("./powerquery-tScXyioY.js"),[])});vt({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>pt(()=>import("./powershell-COWaemsV.js"),[])});vt({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>pt(()=>import("./protobuf-Brw8urJB.js"),[])});vt({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>pt(()=>import("./pug-8SOpv6rk.js"),[])});vt({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>pt(()=>import("./python-BBVOusE5.js"),[])});vt({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>pt(()=>import("./qsharp-Bw9ernYp.js"),[])});vt({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>pt(()=>import("./r-j7ic8hl3.js"),[])});vt({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>pt(()=>import("./razor-coQ55R0C.js"),[])});vt({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>pt(()=>import("./redis-Bu5POkcn.js"),[])});vt({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>pt(()=>import("./redshift-Bs9aos_-.js"),[])});vt({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>pt(()=>import("./restructuredtext-CqXO7rUv.js"),[])});vt({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>pt(()=>import("./ruby-zBfavPgS.js"),[])});vt({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>pt(()=>import("./rust-BzKRNQWT.js"),[])});vt({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>pt(()=>import("./sb-BBc9UKZt.js"),[])});vt({id:"scala",extensions:[".scala",".sc",".sbt"],aliases:["Scala","scala","SBT","Sbt","sbt","Dotty","dotty"],mimetypes:["text/x-scala-source","text/x-scala","text/x-sbt","text/x-dotty"],loader:()=>pt(()=>import("./scala-D9hQfWCl.js"),[])});vt({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>pt(()=>import("./scheme-BPhDTwHR.js"),[])});vt({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>pt(()=>import("./scss-CBJaRo0y.js"),[])});vt({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>pt(()=>import("./shell-DiJ1NA_G.js"),[])});vt({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>pt(()=>import("./solidity-Db0IVjzk.js"),[])});vt({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>pt(()=>import("./sophia-CnS9iZB_.js"),[])});vt({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>pt(()=>import("./sparql-CJmd_6j2.js"),[])});vt({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>pt(()=>import("./sql-ClhHkBeG.js"),[])});vt({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>pt(()=>import("./st-CHwy0fLd.js"),[])});vt({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>pt(()=>import("./swift-Bqt4WxQ4.js"),[])});vt({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>pt(()=>import("./systemverilog-Bs9z6M-B.js"),[])});vt({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>pt(()=>import("./systemverilog-Bs9z6M-B.js"),[])});vt({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>pt(()=>import("./tcl-Dm6ycUr_.js"),[])});vt({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>pt(()=>import("./twig-Csy3S7wG.js"),[])});vt({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>pt(()=>import("./typescript-DIAAd4bI.js"),[])});vt({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>pt(()=>import("./typespec-Btyra-wh.js"),[])});vt({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>pt(()=>import("./vb-Db0cS2oM.js"),[])});vt({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>pt(()=>import("./wgsl-BTesnYfV.js"),[])});vt({id:"xml",extensions:[".xml",".xsd",".dtd",".ascx",".csproj",".config",".props",".targets",".wxi",".wxl",".wxs",".xaml",".svg",".svgz",".opf",".xslt",".xsl"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],mimetypes:["text/xml","application/xml","application/xaml+xml","application/xml-dtd"],loader:()=>pt(()=>import("./xml-BP9oj1kg.js"),[])});vt({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>pt(()=>import("./yaml-DPr6VzpH.js"),[])});var HUt=Object.defineProperty,BUt=(n,e,t)=>e in n?HUt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,pi=(n,e,t)=>BUt(n,typeof e!="symbol"?e+"":e,t),G3,eSe,q3,Uq,K3;function VUt(n){return n.method!==void 0}var tSe;(function(n){function e(t){return t}n.create=e})(tSe||(tSe={}));var Rh;(function(n){n.parseError=-32700,n.invalidRequest=-32600,n.methodNotFound=-32601,n.invalidParams=-32602,n.internalError=-32603;function e(r){return-32099<=r&&r<=-32e3}n.isServerError=e;function t(r){if(!e(r))throw new Error("Invalid range for a server error.");return r}n.serverError=t,n.unexpectedServerError=-32e3;function i(r){return!0}n.isApplicationError=i;function s(r){return r}n.applicationError=s,n.genericApplicationError=-320100})(Rh||(Rh={}));var ZFe=class{constructor(){pi(this,"listeners",new Set),pi(this,"event",n=>(this.listeners.add(n),{dispose:()=>{this.listeners.delete(n)}}))}fire(n){this.listeners.forEach(e=>e(n))}},WUt=class{constructor(n){pi(this,"_value"),pi(this,"eventEmitter"),this._value=n,this.eventEmitter=new ZFe}get value(){return this._value}set value(n){this._value!==n&&(this._value=n,this.eventEmitter.fire(n))}get onChange(){return this.eventEmitter.event}};function zUt(n,e){const t=setTimeout(e,n);return{dispose:()=>clearTimeout(t)}}function $q(n,e,t){return n instanceof Set?(n.add(e),{dispose:()=>n.delete(e)}):(n.set(e,t),{dispose:()=>n.delete(e)})}var UUt=class{constructor(){pi(this,"_state","none"),pi(this,"promise"),pi(this,"resolve",()=>{}),pi(this,"reject",()=>{}),this.promise=new Promise((n,e)=>{this.resolve=n,this.reject=e})}get state(){return this._state}};G3=class{constructor(){pi(this,"_unprocessedMessages",[]),pi(this,"_messageListener"),pi(this,"id",G3.id++),pi(this,"_state",new WUt({state:"open"})),pi(this,"state",this._state)}setListener(n){if(this._messageListener=n,!!n)for(;this._unprocessedMessages.length>0&&this._messageListener!==void 0;){const e=this._unprocessedMessages.shift();this._messageListener(e)}}send(n){return this._sendImpl(n)}_dispatchReceivedMessage(n){this._unprocessedMessages.length===0&&this._messageListener?this._messageListener(n):this._unprocessedMessages.push(n)}_onConnectionClosed(){this._state.value={state:"closed",error:void 0}}log(n){return new $Ut(this,n??new GUt)}},pi(G3,"id",0);var $Ut=class{constructor(n,e){pi(this,"baseStream"),pi(this,"logger"),this.baseStream=n,this.logger=e}get state(){return this.baseStream.state}setListener(n){if(n===void 0){this.baseStream.setListener(void 0);return}this.baseStream.setListener(e=>{this.logger.log(this.baseStream,"incoming",e),n(e)})}send(n){return this.logger.log(this.baseStream,"outgoing",n),this.baseStream.send(n)}toString(){return`StreamLogger/${this.baseStream.toString()}`}},GUt=class{log(n,e,t){console.log(`${e==="incoming"?"<-":"->"} [${n.toString()}] ${JSON.stringify(t)}`)}},qUt=class YFe{constructor(e){pi(this,"connect"),this.connect=e}mapContext(e){return new YFe(t=>this.connect(t?KUt(t,e):void 0))}};function KUt(n,e){return{handleNotification:(t,i)=>n.handleNotification(t,e(i)),handleRequest:(t,i,s)=>n.handleRequest(t,i,e(s))}}var ZUt=class XFe{constructor(e,t,i){pi(this,"_stream"),pi(this,"_listener"),pi(this,"_logger"),pi(this,"_unprocessedResponses",new Map),pi(this,"_lastUsedRequestId",0),this._stream=e,this._listener=t,this._logger=i,this._stream.setListener(s=>{VUt(s)?s.id===void 0?this._processNotification(s):this._processRequest(s):this._processResponse(s)})}static createChannel(e,t){let i=!1;return new qUt(s=>{if(i)throw new Error(`A channel to the stream ${e} was already constructed!`);return i=!0,new XFe(e,s,t)})}get state(){return this._stream.state}async _processNotification(e){if(e.id!==void 0)throw new Error;if(!this._listener){this._logger&&this._logger.debug({text:"Notification ignored",message:e});return}try{await this._listener.handleNotification({method:e.method,params:e.params||null})}catch(t){this._logger&&this._logger.warn({text:`Exception was thrown while handling notification: ${t}`,exception:t,message:e})}}async _processRequest(e){if(e.id===void 0)throw new Error;let t;if(this._listener)try{t=await this._listener.handleRequest({method:e.method,params:e.params||null},e.id)}catch(s){this._logger&&this._logger.warn({text:`Exception was thrown while handling request: ${s}`,message:e,exception:s}),t={error:{code:Rh.internalError,message:"An unexpected exception was thrown.",data:void 0}}}else this._logger&&this._logger.debug({text:"Received request even though not listening for requests",message:e}),t={error:{code:Rh.methodNotFound,message:"This endpoint does not listen for requests or notifications.",data:void 0}};let i;"result"in t?i={jsonrpc:"2.0",id:e.id,result:t.result}:i={jsonrpc:"2.0",id:e.id,error:t.error},await this._stream.send(i)}_processResponse(e){const t=""+e.id,i=this._unprocessedResponses.get(t);if(!i){this._logger&&this._logger.debug({text:"Got an unexpected response message",message:e});return}this._unprocessedResponses.delete(t),i(e)}_newRequestId(){return this._lastUsedRequestId++}sendRequest(e,t,i){const s={jsonrpc:"2.0",id:this._newRequestId(),method:e.method,params:e.params||void 0};return i&&i(s.id),new Promise((r,o)=>{const a=""+s.id;this._unprocessedResponses.set(a,l=>{"result"in l?r({result:l.result}):(l.error||o(new Error("Response had neither 'result' nor 'error' field set.")),r({error:l.error}))}),this._stream.send(s).then(void 0,l=>{this._unprocessedResponses.delete(a),o(l)})})}sendNotification(e,t){const i={jsonrpc:"2.0",id:void 0,method:e.method,params:e.params||void 0};return this._stream.send(i)}toString(){return"StreamChannel/"+this._stream.toString()}},pD;(function(n){function e(){return{deserializeFromJson:s=>({hasErrors:!1,value:s}),serializeToJson:s=>s}}n.sAny=e;function t(){return{deserializeFromJson:s=>({hasErrors:!1,value:{}}),serializeToJson:s=>({})}}n.sEmptyObject=t;function i(){return{deserializeFromJson:s=>({hasErrors:!1,value:void 0}),serializeToJson:s=>null}}n.sVoidFromNull=i})(pD||(pD={}));const QFe=Symbol("OptionalMethodNotFound");var JFe=class{contextualize(n){return new YUt(this,n)}},YUt=class extends JFe{constructor(n,e){super(),pi(this,"underylingTypedChannel"),pi(this,"converters"),this.underylingTypedChannel=n,this.converters=e}async request(n,e,t){const i=await this.converters.getSendContext(t);return this.underylingTypedChannel.request(n,e,i)}async notify(n,e,t){const i=await this.converters.getSendContext(t);return this.underylingTypedChannel.notify(n,e,i)}registerNotificationHandler(n,e){return this.underylingTypedChannel.registerNotificationHandler(n,async(t,i)=>await e(t,await this.converters.getNewContext(i)))}registerRequestHandler(n,e){return this.underylingTypedChannel.registerRequestHandler(n,async(t,i,s)=>await e(t,i,await this.converters.getNewContext(s)))}},iSe=class e8e extends JFe{constructor(e,t={}){super(),pi(this,"channelCtor"),pi(this,"_requestSender"),pi(this,"_handler",new Map),pi(this,"_unknownNotificationHandler",new Set),pi(this,"_timeout"),pi(this,"sendExceptionDetails",!1),pi(this,"_logger"),pi(this,"listeningDeferred",new UUt),pi(this,"onListening",this.listeningDeferred.promise),pi(this,"_requestDidErrorEventEmitter",new ZFe),pi(this,"onRequestDidError",this._requestDidErrorEventEmitter.event),this.channelCtor=e,this._logger=t.logger,this.sendExceptionDetails=!!t.sendExceptionDetails,this._timeout=zUt(1e3,()=>{this._requestSender||console.warn(`"${this.startListen.name}" has not been called within 1 second after construction of this channel. Did you forget to call it?`,this)})}static fromTransport(e,t={}){return new e8e(ZUt.createChannel(e,t.logger),t)}startListen(){if(this._requestSender)throw new Error(`"${this.startListen.name}" can be called only once, but it already has been called.`);this._timeout&&(this._timeout.dispose(),this._timeout=void 0),this._requestSender=this.channelCtor.connect({handleRequest:(e,t,i)=>this.handleRequest(e,t,i),handleNotification:(e,t)=>this.handleNotification(e,t)}),this.listeningDeferred.resolve()}checkChannel(e){if(!e)throw new Error(`"${this.startListen.name}" must be called before any messages can be sent or received.`);return!0}async handleRequest(e,t,i){const s=this._handler.get(e.method);if(!s)return this._logger&&this._logger.debug({text:`No request handler for "${e.method}".`,data:{requestObject:e}}),{error:{code:Rh.methodNotFound,message:`No request handler for "${e.method}".`,data:{method:e.method}}};if(s.kind!="request"){const o=`"${e.method}" is registered as notification, but was sent as request.`;return this._logger&&this._logger.debug({text:o,data:{requestObject:e}}),{error:{code:Rh.invalidRequest,message:o,data:{method:e.method}}}}const r=s.requestType.paramsSerializer.deserializeFromJson(e.params);if(r.hasErrors){const o=`Got invalid params: ${r.errorMessage}`;return this._logger&&this._logger.debug({text:o,data:{requestObject:e,errorMessage:r.errorMessage}}),{error:{code:Rh.invalidParams,message:o,data:{errors:r.errorMessage}}}}else{const o=r.value;let a;try{const l=await s.handler(o,t,i);if("error"in l||"errorMessage"in l){const c=l.error?s.requestType.errorSerializer.serializeToJson(l.error):void 0;a={error:{code:l.errorCode||Rh.genericApplicationError,message:l.errorMessage||"An error was returned",data:c}}}else a={result:s.requestType.resultSerializer.serializeToJson(l.ok)}}catch(l){l instanceof sSe?a={error:{code:l.code,message:l.message}}:(this._logger&&this._logger.warn({text:`An exception was thrown while handling a request: ${l}.`,exception:l,data:{requestObject:e}}),a={error:{code:Rh.unexpectedServerError,message:this.sendExceptionDetails?`An exception was thrown while handling a request: ${l}.`:"Server has thrown an unexpected exception"}})}return a}}async handleNotification(e,t){const i=this._handler.get(e.method);if(!i){for(const o of this._unknownNotificationHandler)o(e);this._unknownNotificationHandler.size===0&&this._logger&&this._logger.debug({text:`Unhandled notification "${e.method}"`,data:{requestObject:e}});return}if(i.kind!="notification"){this._logger&&this._logger.debug({text:`"${e.method}" is registered as request, but was sent as notification.`,data:{requestObject:e}});return}const s=i.notificationType.paramsSerializer.deserializeFromJson(e.params);if(s.hasErrors){this._logger&&this._logger.debug({text:`Got invalid params: ${s}`,data:{requestObject:e,errorMessage:s.errorMessage}});return}const r=s.value;for(const o of i.handlers)try{o(r,t)}catch(a){this._logger&&this._logger.warn({text:`An exception was thrown while handling a notification: ${a}.`,exception:a,data:{requestObject:e}})}}registerUnknownNotificationHandler(e){return $q(this._unknownNotificationHandler,e)}registerRequestHandler(e,t){if(this._handler.get(e.method))throw new Error(`Handler with method "${e.method}" already registered.`);return $q(this._handler,e.method,{kind:"request",requestType:e,handler:t})}registerNotificationHandler(e,t){let i=this._handler.get(e.method);if(!i)i={kind:"notification",notificationType:e,handlers:new Set},this._handler.set(e.method,i);else{if(i.kind!=="notification")throw new Error(`Method "${e.method}" was already registered as request handler.`);if(i.notificationType!==e)throw new Error(`Method "${e.method}" was registered for a different type.`)}return $q(i.handlers,t)}getRegisteredTypes(){const e=[];for(const t of this._handler.values())t.kind==="notification"?e.push(t.notificationType):t.kind==="request"&&e.push(t.requestType);return e}async request(e,t,i){if(!this.checkChannel(this._requestSender))throw new Error("Impossible");const s=e.paramsSerializer.serializeToJson(t);nSe(s);const r=await this._requestSender.sendRequest({method:e.method,params:s},i);if("error"in r){if(e.isOptional&&r.error.code===Rh.methodNotFound)return QFe;let o;if(r.error.data!==void 0){const l=e.errorSerializer.deserializeFromJson(r.error.data);if(l.hasErrors)throw new Error(l.errorMessage);o=l.value}else o=void 0;const a=new sSe(r.error.message,o,r.error.code);throw this._requestDidErrorEventEmitter.fire({error:a}),a}else{const o=e.resultSerializer.deserializeFromJson(r.result);if(o.hasErrors)throw new Error("Could not deserialize response: "+o.errorMessage+`
|
|
1648
|
+
hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")r.push({token:a.token+t.tokenPostfix,open:P_(t,a.open),close:P_(t,a.close)});else throw os(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=r,t.noThrow=!0,t}function Ezt(n){qD.registerLanguage(n)}function Dzt(){let n=[];return n=n.concat(qD.getLanguages()),n}function Rzt(n){return kt.get(Gs).languageIdCodec.encodeLanguageId(n)}function Nzt(n,e){return kt.withServices(()=>{const i=kt.get(Gs).onDidRequestRichLanguageFeatures(s=>{s===n&&(i.dispose(),e())});return i})}function Tzt(n,e){return kt.withServices(()=>{const i=kt.get(Gs).onDidRequestBasicLanguageFeatures(s=>{s===n&&(i.dispose(),e())});return i})}function Izt(n,e){if(!kt.get(Gs).isRegisteredLanguageId(n))throw new Error(`Cannot set configuration for unknown language ${n}`);return kt.get(Ls).register(n,e,100)}class kzt{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if(typeof this._actual.tokenize=="function")return lM.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){const s=this._actual.tokenizeEncoded(e,i);return new iV(s.tokens,s.endState)}}class lM{constructor(e,t,i,s){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=s}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const i=[];let s=0;for(let r=0,o=e.length;r<o;r++){const a=e[r];let l=a.startIndex;r===0?l=0:l<s&&(l=s),i[r]=new G2(l,a.scopes,t),s=l}return i}static adaptTokenize(e,t,i,s){const r=t.tokenize(i,s),o=lM._toClassicTokens(r.tokens,e);let a;return r.endState.equals(s)?a=s:a=r.endState,new vae(o,a)}tokenize(e,t,i){return lM.adaptTokenize(this._languageId,this._actual,e,i)}_toBinaryTokens(e,t){const i=e.encodeLanguageId(this._languageId),s=this._standaloneThemeService.getColorTheme().tokenTheme,r=[];let o=0,a=0;for(let c=0,d=t.length;c<d;c++){const u=t[c],h=s.match(i,u.scopes)|1024;if(o>0&&r[o-1]===h)continue;let g=u.startIndex;c===0?g=0:g<a&&(g=a),r[o++]=g,r[o++]=h,a=g}const l=new Uint32Array(o);for(let c=0;c<o;c++)l[c]=r[c];return l}tokenizeEncoded(e,t,i){const s=this._actual.tokenize(e,i),r=this._toBinaryTokens(this._languageService.languageIdCodec,s.tokens);let o;return s.endState.equals(i)?o=i:o=s.endState,new iV(r,o)}}function Azt(n){return typeof n.getInitialState=="function"}function Mzt(n){return"tokenizeEncoded"in n}function RFe(n){return n&&typeof n.then=="function"}function Ozt(n){const e=kt.get(Xd);if(n){const t=[null];for(let i=1,s=n.length;i<s;i++)t[i]=pe.fromHex(n[i]);e.setColorMapOverride(t)}else e.setColorMapOverride(null)}function NFe(n,e){return Mzt(e)?new kzt(n,e):new lM(n,e,kt.get(Gs),kt.get(Xd))}function Xce(n,e){const t=new k0t(async()=>{const i=await Promise.resolve(e.create());return i?Azt(i)?NFe(n,i):new tM(kt.get(Gs),kt.get(Xd),n,DFe(n,i),kt.get(Ut)):null});return Vs.registerFactory(n,t)}function Pzt(n,e){if(!kt.get(Gs).isRegisteredLanguageId(n))throw new Error(`Cannot set tokens provider for unknown language ${n}`);return RFe(e)?Xce(n,{create:()=>e}):Vs.register(n,NFe(n,e))}function Fzt(n,e){const t=i=>new tM(kt.get(Gs),kt.get(Xd),n,DFe(n,i),kt.get(Ut));return RFe(e)?Xce(n,{create:()=>e}):Vs.register(n,t(e))}function jzt(n,e){return kt.get(Xe).referenceProvider.register(n,e)}function Hzt(n,e){return kt.get(Xe).renameProvider.register(n,e)}function Bzt(n,e){return kt.get(Xe).newSymbolNamesProvider.register(n,e)}function Vzt(n,e){return kt.get(Xe).signatureHelpProvider.register(n,e)}function Wzt(n,e){return kt.get(Xe).hoverProvider.register(n,{provideHover:async(i,s,r,o)=>{const a=i.getWordAtPosition(s);return Promise.resolve(e.provideHover(i,s,r,o)).then(l=>{if(l)return!l.range&&a&&(l.range=new F(s.lineNumber,a.startColumn,s.lineNumber,a.endColumn)),l.range||(l.range=new F(s.lineNumber,s.column,s.lineNumber,s.column)),l})}})}function zzt(n,e){return kt.get(Xe).documentSymbolProvider.register(n,e)}function Uzt(n,e){return kt.get(Xe).documentHighlightProvider.register(n,e)}function $zt(n,e){return kt.get(Xe).linkedEditingRangeProvider.register(n,e)}function Gzt(n,e){return kt.get(Xe).definitionProvider.register(n,e)}function qzt(n,e){return kt.get(Xe).implementationProvider.register(n,e)}function Kzt(n,e){return kt.get(Xe).typeDefinitionProvider.register(n,e)}function Zzt(n,e){return kt.get(Xe).codeLensProvider.register(n,e)}function Yzt(n,e,t){return kt.get(Xe).codeActionProvider.register(n,{providedCodeActionKinds:t==null?void 0:t.providedCodeActionKinds,documentation:t==null?void 0:t.documentation,provideCodeActions:(s,r,o,a)=>{const c=kt.get(Gp).read({resource:s.uri}).filter(d=>F.areIntersectingOrTouching(d,r));return e.provideCodeActions(s,r,{markers:c,only:o.only,trigger:o.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function Xzt(n,e){return kt.get(Xe).documentFormattingEditProvider.register(n,e)}function Qzt(n,e){return kt.get(Xe).documentRangeFormattingEditProvider.register(n,e)}function Jzt(n,e){return kt.get(Xe).onTypeFormattingEditProvider.register(n,e)}function eUt(n,e){return kt.get(Xe).linkProvider.register(n,e)}function tUt(n,e){return kt.get(Xe).completionProvider.register(n,e)}function iUt(n,e){return kt.get(Xe).colorProvider.register(n,e)}function nUt(n,e){return kt.get(Xe).foldingRangeProvider.register(n,e)}function sUt(n,e){return kt.get(Xe).declarationProvider.register(n,e)}function rUt(n,e){return kt.get(Xe).selectionRangeProvider.register(n,e)}function oUt(n,e){return kt.get(Xe).documentSemanticTokensProvider.register(n,e)}function aUt(n,e){return kt.get(Xe).documentRangeSemanticTokensProvider.register(n,e)}function lUt(n,e){return kt.get(Xe).inlineCompletionsProvider.register(n,e)}function cUt(n,e){return kt.get(Xe).inlayHintsProvider.register(n,e)}function dUt(){return{register:Ezt,getLanguages:Dzt,onLanguage:Nzt,onLanguageEncountered:Tzt,getEncodedLanguageId:Rzt,setLanguageConfiguration:Izt,setColorMap:Ozt,registerTokensProviderFactory:Xce,setTokensProvider:Pzt,setMonarchTokensProvider:Fzt,registerReferenceProvider:jzt,registerRenameProvider:Hzt,registerNewSymbolNameProvider:Bzt,registerCompletionItemProvider:tUt,registerSignatureHelpProvider:Vzt,registerHoverProvider:Wzt,registerDocumentSymbolProvider:zzt,registerDocumentHighlightProvider:Uzt,registerLinkedEditingRangeProvider:$zt,registerDefinitionProvider:Gzt,registerImplementationProvider:qzt,registerTypeDefinitionProvider:Kzt,registerCodeLensProvider:Zzt,registerCodeActionProvider:Yzt,registerDocumentFormattingEditProvider:Xzt,registerDocumentRangeFormattingEditProvider:Qzt,registerOnTypeFormattingEditProvider:Jzt,registerLinkProvider:eUt,registerColorProvider:iUt,registerFoldingRangeProvider:nUt,registerDeclarationProvider:sUt,registerSelectionRangeProvider:rUt,registerDocumentSemanticTokensProvider:oUt,registerDocumentRangeSemanticTokensProvider:aUt,registerInlineCompletionsProvider:lUt,registerInlayHintsProvider:cUt,DocumentHighlightKind:wte,CompletionItemKind:pte,CompletionItemTag:mte,CompletionItemInsertTextRule:gte,SymbolKind:Jte,SymbolTag:eie,IndentAction:Rte,CompletionTriggerKind:_te,SignatureHelpTriggerKind:Qte,InlayHintKind:Tte,InlineCompletionTriggerKind:Ate,CodeActionTriggerType:fte,NewSymbolNameTag:Bte,NewSymbolNameTriggerKind:Vte,PartialAcceptTriggerKind:Ute,HoverVerbosityAction:Dte,InlineCompletionEndOfLifeReasonKind:Ite,InlineCompletionHintStyle:kte,FoldingRangeKind:ex,SelectedSuggestionInfo:cMe,EditDeltaInfo:sA}}Qa.wrappingIndent.defaultValue=0;Qa.glyphMargin.defaultValue=!1;Qa.autoIndent.defaultValue=3;Qa.overviewRulerLanes.defaultValue=2;AA.setFormatterSelector((n,e,t)=>Promise.resolve(n[0]));const Vl=iFe();Vl.editor=Czt();Vl.languages=dUt();const uUt=Vl.CancellationTokenSource,ER=Vl.Emitter,hUt=Vl.KeyCode,fUt=Vl.KeyMod,gUt=Vl.Position,pUt=Vl.Range,mUt=Vl.Selection,_Ut=Vl.SelectionDirection,m_=Vl.MarkerSeverity,vne=Vl.MarkerTag,bUt=Vl.Uri,vUt=Vl.Token,TFe=Vl.editor,Nt=Vl.languages,Wq=ooe(),gD=globalThis;(Wq!=null&&Wq.globalAPI||typeof gD.define=="function"&&gD.define.amd)&&(gD.monaco=Vl);typeof gD.require<"u"&&typeof gD.require.config=="function"&&gD.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});const CUt=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:uUt,Emitter:ER,KeyCode:hUt,KeyMod:fUt,MarkerSeverity:m_,MarkerTag:vne,Position:gUt,Range:pUt,Selection:mUt,SelectionDirection:_Ut,Token:vUt,Uri:bUt,editor:TFe,languages:Nt},Symbol.toStringTag,{value:"Module"}));let Qce=class{constructor(e,t,i){this._onDidChange=new ER,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const Jce={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},ede={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},IFe=new Qce("css",Jce,ede),kFe=new Qce("scss",Jce,ede),AFe=new Qce("less",Jce,ede);function tde(){return pt(()=>import("./cssMode-SV3LkZxl.js"),__vite__mapDeps([0,1]))}Nt.onLanguage("less",()=>{tde().then(n=>n.setupMode(AFe))});Nt.onLanguage("scss",()=>{tde().then(n=>n.setupMode(kFe))});Nt.onLanguage("css",()=>{tde().then(n=>n.setupMode(IFe))});const wUt=Object.freeze(Object.defineProperty({__proto__:null,cssDefaults:IFe,lessDefaults:AFe,scssDefaults:kFe},Symbol.toStringTag,{value:"Module"}));let yUt=class{constructor(e,t,i){this._onDidChange=new ER,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const SUt={tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},YV={format:SUt,suggest:{},data:{useDefaultDataProvider:!0}};function XV(n){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:n===kk,documentFormattingEdits:n===kk,documentRangeFormattingEdits:n===kk}}const kk="html",Q0e="handlebars",J0e="razor",MFe=QV(kk,YV,XV(kk)),xUt=MFe.defaults,OFe=QV(Q0e,YV,XV(Q0e)),LUt=OFe.defaults,PFe=QV(J0e,YV,XV(J0e)),EUt=PFe.defaults;function DUt(){return pt(()=>import("./htmlMode-Dg66JQT7.js"),__vite__mapDeps([2,1]))}function QV(n,e=YV,t=XV(n)){const i=new yUt(n,e,t);let s;const r=Nt.onLanguage(n,async()=>{s=(await DUt()).setupMode(i)});return{defaults:i,dispose(){r.dispose(),s==null||s.dispose(),s=void 0}}}const RUt=Object.freeze(Object.defineProperty({__proto__:null,handlebarDefaults:LUt,handlebarLanguageService:OFe,htmlDefaults:xUt,htmlLanguageService:MFe,razorDefaults:EUt,razorLanguageService:PFe,registerHTMLLanguageService:QV},Symbol.toStringTag,{value:"Module"}));let NUt=class{constructor(e,t,i){this._onDidChange=new ER,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const TUt={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},IUt={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},FFe=new NUt("json",TUt,IUt),kUt=()=>jFe().then(n=>n.getWorker());function jFe(){return pt(()=>import("./jsonMode-BYOLXHGD.js"),__vite__mapDeps([3,1]))}Nt.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});Nt.onLanguage("json",()=>{jFe().then(n=>n.setupMode(FFe))});const AUt=Object.freeze(Object.defineProperty({__proto__:null,getWorker:kUt,jsonDefaults:FFe},Symbol.toStringTag,{value:"Module"})),MUt="5.9.3";var HFe=(n=>(n[n.None=0]="None",n[n.CommonJS=1]="CommonJS",n[n.AMD=2]="AMD",n[n.UMD=3]="UMD",n[n.System=4]="System",n[n.ES2015=5]="ES2015",n[n.ESNext=99]="ESNext",n))(HFe||{}),BFe=(n=>(n[n.None=0]="None",n[n.Preserve=1]="Preserve",n[n.React=2]="React",n[n.ReactNative=3]="ReactNative",n[n.ReactJSX=4]="ReactJSX",n[n.ReactJSXDev=5]="ReactJSXDev",n))(BFe||{}),VFe=(n=>(n[n.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",n[n.LineFeed=1]="LineFeed",n))(VFe||{}),WFe=(n=>(n[n.ES3=0]="ES3",n[n.ES5=1]="ES5",n[n.ES2015=2]="ES2015",n[n.ES2016=3]="ES2016",n[n.ES2017=4]="ES2017",n[n.ES2018=5]="ES2018",n[n.ES2019=6]="ES2019",n[n.ES2020=7]="ES2020",n[n.ESNext=99]="ESNext",n[n.JSON=100]="JSON",n[n.Latest=99]="Latest",n))(WFe||{}),zFe=(n=>(n[n.Classic=1]="Classic",n[n.NodeJs=2]="NodeJs",n))(zFe||{});class UFe{constructor(e,t,i,s,r){this._onDidChange=new ER,this._onDidExtraLibsChange=new ER,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(e),this.setDiagnosticsOptions(t),this.setWorkerOptions(i),this.setInlayHintsOptions(s),this.setModeConfiguration(r),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(e,t){let i;if(typeof t>"u"?i=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:i=t,this._extraLibs[i]&&this._extraLibs[i].content===e)return{dispose:()=>{}};let s=1;return this._removedExtraLibs[i]&&(s=this._removedExtraLibs[i]+1),this._extraLibs[i]&&(s=this._extraLibs[i].version+1),this._extraLibs[i]={content:e,version:s},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let r=this._extraLibs[i];r&&r.version===s&&(delete this._extraLibs[i],this._removedExtraLibs[i]=s,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(e){for(const t in this._extraLibs)this._removedExtraLibs[t]=this._extraLibs[t].version;if(this._extraLibs=Object.create(null),e&&e.length>0)for(const t of e){const i=t.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,s=t.content;let r=1;this._removedExtraLibs[i]&&(r=this._removedExtraLibs[i]+1),this._extraLibs[i]={content:s,version:r}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(e){this._compilerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(e){this._workerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(e){this._inlayHintsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(e){}setEagerModelSync(e){this._eagerModelSync=e}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(void 0)}}const OUt=MUt,$Fe={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},GFe=new UFe({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},$Fe),qFe=new UFe({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},$Fe),PUt=()=>JV().then(n=>n.getTypeScriptWorker()),FUt=()=>JV().then(n=>n.getJavaScriptWorker());function JV(){return pt(()=>import("./tsMode-BH2YA4LN.js"),[])}Nt.onLanguage("typescript",()=>JV().then(n=>n.setupTypeScript(GFe)));Nt.onLanguage("javascript",()=>JV().then(n=>n.setupJavaScript(qFe)));const jUt=Object.freeze(Object.defineProperty({__proto__:null,JsxEmit:BFe,ModuleKind:HFe,ModuleResolutionKind:zFe,NewLineKind:VFe,ScriptTarget:WFe,getJavaScriptWorker:FUt,getTypeScriptWorker:PUt,javascriptDefaults:qFe,typescriptDefaults:GFe,typescriptVersion:OUt},Symbol.toStringTag,{value:"Module"})),KFe={},zq={};class ide{static getOrCreate(e){return zq[e]||(zq[e]=new ide(e)),zq[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,i)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=i})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,KFe[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}}function vt(n){const e=n.id;KFe[e]=n,Nt.register(n);const t=ide.getOrCreate(e);Nt.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),Nt.onLanguageEncountered(e,async()=>{const i=await t.load();Nt.setLanguageConfiguration(e,i.conf)})}vt({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>pt(()=>import("./abap-DLDM7-KI.js"),[])});vt({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>pt(()=>import("./apex-DNDY2TF8.js"),[])});vt({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>pt(()=>import("./azcli-Y6nb8tq_.js"),[])});vt({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>pt(()=>import("./bat-BwHxbl9M.js"),[])});vt({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>pt(()=>import("./bicep-CFznDFnq.js"),[])});vt({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>pt(()=>import("./cameligo-Bf6VGUru.js"),[])});vt({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>pt(()=>import("./clojure-Dnu-v4kV.js"),[])});vt({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>pt(()=>import("./coffee-Bd8akH9Z.js"),[])});vt({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>pt(()=>import("./cpp-BbWJElDN.js"),[])});vt({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>pt(()=>import("./cpp-BbWJElDN.js"),[])});vt({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>pt(()=>import("./csharp-Co3qMtFm.js"),[])});vt({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>pt(()=>import("./csp-D-4FJmMZ.js"),[])});vt({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>pt(()=>import("./css-DdJfP1eB.js"),[])});vt({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>pt(()=>import("./cypher-cTPe9QuQ.js"),[])});vt({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>pt(()=>import("./dart-BOtBlQCF.js"),[])});vt({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>pt(()=>import("./dockerfile-BG73LgW2.js"),[])});vt({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>pt(()=>import("./ecl-BEgZUVRK.js"),[])});vt({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>pt(()=>import("./elixir-BkW5O-1t.js"),[])});vt({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>pt(()=>import("./flow9-BeJ5waoc.js"),[])});vt({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>pt(()=>import("./fsharp-PahG7c26.js"),[])});vt({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>pt(()=>import("./freemarker2-CxFgQ1qv.js"),[]).then(n=>n.TagAutoInterpolationDollar)});vt({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>pt(()=>import("./freemarker2-CxFgQ1qv.js"),[]).then(n=>n.TagAngleInterpolationDollar)});vt({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>pt(()=>import("./freemarker2-CxFgQ1qv.js"),[]).then(n=>n.TagBracketInterpolationDollar)});vt({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>pt(()=>import("./freemarker2-CxFgQ1qv.js"),[]).then(n=>n.TagAngleInterpolationBracket)});vt({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>pt(()=>import("./freemarker2-CxFgQ1qv.js"),[]).then(n=>n.TagBracketInterpolationBracket)});vt({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>pt(()=>import("./freemarker2-CxFgQ1qv.js"),[]).then(n=>n.TagAutoInterpolationDollar)});vt({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>pt(()=>import("./freemarker2-CxFgQ1qv.js"),[]).then(n=>n.TagAutoInterpolationBracket)});vt({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>pt(()=>import("./go-acbASCJo.js"),[])});vt({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>pt(()=>import("./graphql-BxJiqAUM.js"),[])});vt({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>pt(()=>import("./handlebars-BGKxT387.js"),[])});vt({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>pt(()=>import("./hcl-DtV1sZF8.js"),[])});vt({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>pt(()=>import("./html-Dy2rlxNJ.js"),[])});vt({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>pt(()=>import("./ini-Kd9XrMLS.js"),[])});vt({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>pt(()=>import("./java-CXBNlu9o.js"),[])});vt({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>pt(()=>import("./javascript-CJzMD2IB.js"),__vite__mapDeps([4,5]))});vt({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>pt(()=>import("./julia-cl7-CwDS.js"),[])});vt({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>pt(()=>import("./kotlin-s7OhZKlX.js"),[])});vt({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>pt(()=>import("./less-9HpZscsL.js"),[])});vt({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>pt(()=>import("./lexon-OrD6JF1K.js"),[])});vt({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>pt(()=>import("./lua-Cyyb5UIc.js"),[])});vt({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>pt(()=>import("./liquid-B6hlZhnN.js"),[])});vt({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>pt(()=>import("./m3-B8OfTtLu.js"),[])});vt({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>pt(()=>import("./markdown-BFxVWTOG.js"),[])});vt({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>pt(()=>import("./mdx-Ct4CZHnS.js"),[])});vt({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>pt(()=>import("./mips-CiqrrVzr.js"),[])});vt({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>pt(()=>import("./msdax-DmeGPVcC.js"),[])});vt({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>pt(()=>import("./mysql-C_tMU-Nz.js"),[])});vt({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>pt(()=>import("./objective-c-BDtDVThU.js"),[])});vt({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>pt(()=>import("./pascal-vHIfCaH5.js"),[])});vt({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>pt(()=>import("./pascaligo-DtZ0uQbO.js"),[])});vt({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>pt(()=>import("./perl-Ub6l9XKa.js"),[])});vt({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>pt(()=>import("./pgsql-BlNEE0v7.js"),[])});vt({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>pt(()=>import("./php-BBUBE1dy.js"),[])});vt({id:"pla",extensions:[".pla"],loader:()=>pt(()=>import("./pla-DSh2-awV.js"),[])});vt({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>pt(()=>import("./postiats-CocnycG-.js"),[])});vt({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>pt(()=>import("./powerquery-tScXyioY.js"),[])});vt({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>pt(()=>import("./powershell-COWaemsV.js"),[])});vt({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>pt(()=>import("./protobuf-Brw8urJB.js"),[])});vt({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>pt(()=>import("./pug-8SOpv6rk.js"),[])});vt({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>pt(()=>import("./python-Dv7zLVcI.js"),[])});vt({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>pt(()=>import("./qsharp-Bw9ernYp.js"),[])});vt({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>pt(()=>import("./r-j7ic8hl3.js"),[])});vt({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>pt(()=>import("./razor-VFna7_Vy.js"),[])});vt({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>pt(()=>import("./redis-Bu5POkcn.js"),[])});vt({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>pt(()=>import("./redshift-Bs9aos_-.js"),[])});vt({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>pt(()=>import("./restructuredtext-CqXO7rUv.js"),[])});vt({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>pt(()=>import("./ruby-zBfavPgS.js"),[])});vt({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>pt(()=>import("./rust-BzKRNQWT.js"),[])});vt({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>pt(()=>import("./sb-BBc9UKZt.js"),[])});vt({id:"scala",extensions:[".scala",".sc",".sbt"],aliases:["Scala","scala","SBT","Sbt","sbt","Dotty","dotty"],mimetypes:["text/x-scala-source","text/x-scala","text/x-sbt","text/x-dotty"],loader:()=>pt(()=>import("./scala-D9hQfWCl.js"),[])});vt({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>pt(()=>import("./scheme-BPhDTwHR.js"),[])});vt({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>pt(()=>import("./scss-CBJaRo0y.js"),[])});vt({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>pt(()=>import("./shell-DiJ1NA_G.js"),[])});vt({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>pt(()=>import("./solidity-Db0IVjzk.js"),[])});vt({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>pt(()=>import("./sophia-CnS9iZB_.js"),[])});vt({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>pt(()=>import("./sparql-CJmd_6j2.js"),[])});vt({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>pt(()=>import("./sql-ClhHkBeG.js"),[])});vt({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>pt(()=>import("./st-CHwy0fLd.js"),[])});vt({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>pt(()=>import("./swift-Bqt4WxQ4.js"),[])});vt({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>pt(()=>import("./systemverilog-Bs9z6M-B.js"),[])});vt({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>pt(()=>import("./systemverilog-Bs9z6M-B.js"),[])});vt({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>pt(()=>import("./tcl-Dm6ycUr_.js"),[])});vt({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>pt(()=>import("./twig-Csy3S7wG.js"),[])});vt({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>pt(()=>import("./typescript-x36q2fbo.js"),[])});vt({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>pt(()=>import("./typespec-Btyra-wh.js"),[])});vt({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>pt(()=>import("./vb-Db0cS2oM.js"),[])});vt({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>pt(()=>import("./wgsl-BTesnYfV.js"),[])});vt({id:"xml",extensions:[".xml",".xsd",".dtd",".ascx",".csproj",".config",".props",".targets",".wxi",".wxl",".wxs",".xaml",".svg",".svgz",".opf",".xslt",".xsl"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],mimetypes:["text/xml","application/xml","application/xaml+xml","application/xml-dtd"],loader:()=>pt(()=>import("./xml-Dx8dIreF.js"),[])});vt({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>pt(()=>import("./yaml-CqG7IK-x.js"),[])});var HUt=Object.defineProperty,BUt=(n,e,t)=>e in n?HUt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,pi=(n,e,t)=>BUt(n,typeof e!="symbol"?e+"":e,t),G3,eSe,q3,Uq,K3;function VUt(n){return n.method!==void 0}var tSe;(function(n){function e(t){return t}n.create=e})(tSe||(tSe={}));var Rh;(function(n){n.parseError=-32700,n.invalidRequest=-32600,n.methodNotFound=-32601,n.invalidParams=-32602,n.internalError=-32603;function e(r){return-32099<=r&&r<=-32e3}n.isServerError=e;function t(r){if(!e(r))throw new Error("Invalid range for a server error.");return r}n.serverError=t,n.unexpectedServerError=-32e3;function i(r){return!0}n.isApplicationError=i;function s(r){return r}n.applicationError=s,n.genericApplicationError=-320100})(Rh||(Rh={}));var ZFe=class{constructor(){pi(this,"listeners",new Set),pi(this,"event",n=>(this.listeners.add(n),{dispose:()=>{this.listeners.delete(n)}}))}fire(n){this.listeners.forEach(e=>e(n))}},WUt=class{constructor(n){pi(this,"_value"),pi(this,"eventEmitter"),this._value=n,this.eventEmitter=new ZFe}get value(){return this._value}set value(n){this._value!==n&&(this._value=n,this.eventEmitter.fire(n))}get onChange(){return this.eventEmitter.event}};function zUt(n,e){const t=setTimeout(e,n);return{dispose:()=>clearTimeout(t)}}function $q(n,e,t){return n instanceof Set?(n.add(e),{dispose:()=>n.delete(e)}):(n.set(e,t),{dispose:()=>n.delete(e)})}var UUt=class{constructor(){pi(this,"_state","none"),pi(this,"promise"),pi(this,"resolve",()=>{}),pi(this,"reject",()=>{}),this.promise=new Promise((n,e)=>{this.resolve=n,this.reject=e})}get state(){return this._state}};G3=class{constructor(){pi(this,"_unprocessedMessages",[]),pi(this,"_messageListener"),pi(this,"id",G3.id++),pi(this,"_state",new WUt({state:"open"})),pi(this,"state",this._state)}setListener(n){if(this._messageListener=n,!!n)for(;this._unprocessedMessages.length>0&&this._messageListener!==void 0;){const e=this._unprocessedMessages.shift();this._messageListener(e)}}send(n){return this._sendImpl(n)}_dispatchReceivedMessage(n){this._unprocessedMessages.length===0&&this._messageListener?this._messageListener(n):this._unprocessedMessages.push(n)}_onConnectionClosed(){this._state.value={state:"closed",error:void 0}}log(n){return new $Ut(this,n??new GUt)}},pi(G3,"id",0);var $Ut=class{constructor(n,e){pi(this,"baseStream"),pi(this,"logger"),this.baseStream=n,this.logger=e}get state(){return this.baseStream.state}setListener(n){if(n===void 0){this.baseStream.setListener(void 0);return}this.baseStream.setListener(e=>{this.logger.log(this.baseStream,"incoming",e),n(e)})}send(n){return this.logger.log(this.baseStream,"outgoing",n),this.baseStream.send(n)}toString(){return`StreamLogger/${this.baseStream.toString()}`}},GUt=class{log(n,e,t){console.log(`${e==="incoming"?"<-":"->"} [${n.toString()}] ${JSON.stringify(t)}`)}},qUt=class YFe{constructor(e){pi(this,"connect"),this.connect=e}mapContext(e){return new YFe(t=>this.connect(t?KUt(t,e):void 0))}};function KUt(n,e){return{handleNotification:(t,i)=>n.handleNotification(t,e(i)),handleRequest:(t,i,s)=>n.handleRequest(t,i,e(s))}}var ZUt=class XFe{constructor(e,t,i){pi(this,"_stream"),pi(this,"_listener"),pi(this,"_logger"),pi(this,"_unprocessedResponses",new Map),pi(this,"_lastUsedRequestId",0),this._stream=e,this._listener=t,this._logger=i,this._stream.setListener(s=>{VUt(s)?s.id===void 0?this._processNotification(s):this._processRequest(s):this._processResponse(s)})}static createChannel(e,t){let i=!1;return new qUt(s=>{if(i)throw new Error(`A channel to the stream ${e} was already constructed!`);return i=!0,new XFe(e,s,t)})}get state(){return this._stream.state}async _processNotification(e){if(e.id!==void 0)throw new Error;if(!this._listener){this._logger&&this._logger.debug({text:"Notification ignored",message:e});return}try{await this._listener.handleNotification({method:e.method,params:e.params||null})}catch(t){this._logger&&this._logger.warn({text:`Exception was thrown while handling notification: ${t}`,exception:t,message:e})}}async _processRequest(e){if(e.id===void 0)throw new Error;let t;if(this._listener)try{t=await this._listener.handleRequest({method:e.method,params:e.params||null},e.id)}catch(s){this._logger&&this._logger.warn({text:`Exception was thrown while handling request: ${s}`,message:e,exception:s}),t={error:{code:Rh.internalError,message:"An unexpected exception was thrown.",data:void 0}}}else this._logger&&this._logger.debug({text:"Received request even though not listening for requests",message:e}),t={error:{code:Rh.methodNotFound,message:"This endpoint does not listen for requests or notifications.",data:void 0}};let i;"result"in t?i={jsonrpc:"2.0",id:e.id,result:t.result}:i={jsonrpc:"2.0",id:e.id,error:t.error},await this._stream.send(i)}_processResponse(e){const t=""+e.id,i=this._unprocessedResponses.get(t);if(!i){this._logger&&this._logger.debug({text:"Got an unexpected response message",message:e});return}this._unprocessedResponses.delete(t),i(e)}_newRequestId(){return this._lastUsedRequestId++}sendRequest(e,t,i){const s={jsonrpc:"2.0",id:this._newRequestId(),method:e.method,params:e.params||void 0};return i&&i(s.id),new Promise((r,o)=>{const a=""+s.id;this._unprocessedResponses.set(a,l=>{"result"in l?r({result:l.result}):(l.error||o(new Error("Response had neither 'result' nor 'error' field set.")),r({error:l.error}))}),this._stream.send(s).then(void 0,l=>{this._unprocessedResponses.delete(a),o(l)})})}sendNotification(e,t){const i={jsonrpc:"2.0",id:void 0,method:e.method,params:e.params||void 0};return this._stream.send(i)}toString(){return"StreamChannel/"+this._stream.toString()}},pD;(function(n){function e(){return{deserializeFromJson:s=>({hasErrors:!1,value:s}),serializeToJson:s=>s}}n.sAny=e;function t(){return{deserializeFromJson:s=>({hasErrors:!1,value:{}}),serializeToJson:s=>({})}}n.sEmptyObject=t;function i(){return{deserializeFromJson:s=>({hasErrors:!1,value:void 0}),serializeToJson:s=>null}}n.sVoidFromNull=i})(pD||(pD={}));const QFe=Symbol("OptionalMethodNotFound");var JFe=class{contextualize(n){return new YUt(this,n)}},YUt=class extends JFe{constructor(n,e){super(),pi(this,"underylingTypedChannel"),pi(this,"converters"),this.underylingTypedChannel=n,this.converters=e}async request(n,e,t){const i=await this.converters.getSendContext(t);return this.underylingTypedChannel.request(n,e,i)}async notify(n,e,t){const i=await this.converters.getSendContext(t);return this.underylingTypedChannel.notify(n,e,i)}registerNotificationHandler(n,e){return this.underylingTypedChannel.registerNotificationHandler(n,async(t,i)=>await e(t,await this.converters.getNewContext(i)))}registerRequestHandler(n,e){return this.underylingTypedChannel.registerRequestHandler(n,async(t,i,s)=>await e(t,i,await this.converters.getNewContext(s)))}},iSe=class e8e extends JFe{constructor(e,t={}){super(),pi(this,"channelCtor"),pi(this,"_requestSender"),pi(this,"_handler",new Map),pi(this,"_unknownNotificationHandler",new Set),pi(this,"_timeout"),pi(this,"sendExceptionDetails",!1),pi(this,"_logger"),pi(this,"listeningDeferred",new UUt),pi(this,"onListening",this.listeningDeferred.promise),pi(this,"_requestDidErrorEventEmitter",new ZFe),pi(this,"onRequestDidError",this._requestDidErrorEventEmitter.event),this.channelCtor=e,this._logger=t.logger,this.sendExceptionDetails=!!t.sendExceptionDetails,this._timeout=zUt(1e3,()=>{this._requestSender||console.warn(`"${this.startListen.name}" has not been called within 1 second after construction of this channel. Did you forget to call it?`,this)})}static fromTransport(e,t={}){return new e8e(ZUt.createChannel(e,t.logger),t)}startListen(){if(this._requestSender)throw new Error(`"${this.startListen.name}" can be called only once, but it already has been called.`);this._timeout&&(this._timeout.dispose(),this._timeout=void 0),this._requestSender=this.channelCtor.connect({handleRequest:(e,t,i)=>this.handleRequest(e,t,i),handleNotification:(e,t)=>this.handleNotification(e,t)}),this.listeningDeferred.resolve()}checkChannel(e){if(!e)throw new Error(`"${this.startListen.name}" must be called before any messages can be sent or received.`);return!0}async handleRequest(e,t,i){const s=this._handler.get(e.method);if(!s)return this._logger&&this._logger.debug({text:`No request handler for "${e.method}".`,data:{requestObject:e}}),{error:{code:Rh.methodNotFound,message:`No request handler for "${e.method}".`,data:{method:e.method}}};if(s.kind!="request"){const o=`"${e.method}" is registered as notification, but was sent as request.`;return this._logger&&this._logger.debug({text:o,data:{requestObject:e}}),{error:{code:Rh.invalidRequest,message:o,data:{method:e.method}}}}const r=s.requestType.paramsSerializer.deserializeFromJson(e.params);if(r.hasErrors){const o=`Got invalid params: ${r.errorMessage}`;return this._logger&&this._logger.debug({text:o,data:{requestObject:e,errorMessage:r.errorMessage}}),{error:{code:Rh.invalidParams,message:o,data:{errors:r.errorMessage}}}}else{const o=r.value;let a;try{const l=await s.handler(o,t,i);if("error"in l||"errorMessage"in l){const c=l.error?s.requestType.errorSerializer.serializeToJson(l.error):void 0;a={error:{code:l.errorCode||Rh.genericApplicationError,message:l.errorMessage||"An error was returned",data:c}}}else a={result:s.requestType.resultSerializer.serializeToJson(l.ok)}}catch(l){l instanceof sSe?a={error:{code:l.code,message:l.message}}:(this._logger&&this._logger.warn({text:`An exception was thrown while handling a request: ${l}.`,exception:l,data:{requestObject:e}}),a={error:{code:Rh.unexpectedServerError,message:this.sendExceptionDetails?`An exception was thrown while handling a request: ${l}.`:"Server has thrown an unexpected exception"}})}return a}}async handleNotification(e,t){const i=this._handler.get(e.method);if(!i){for(const o of this._unknownNotificationHandler)o(e);this._unknownNotificationHandler.size===0&&this._logger&&this._logger.debug({text:`Unhandled notification "${e.method}"`,data:{requestObject:e}});return}if(i.kind!="notification"){this._logger&&this._logger.debug({text:`"${e.method}" is registered as request, but was sent as notification.`,data:{requestObject:e}});return}const s=i.notificationType.paramsSerializer.deserializeFromJson(e.params);if(s.hasErrors){this._logger&&this._logger.debug({text:`Got invalid params: ${s}`,data:{requestObject:e,errorMessage:s.errorMessage}});return}const r=s.value;for(const o of i.handlers)try{o(r,t)}catch(a){this._logger&&this._logger.warn({text:`An exception was thrown while handling a notification: ${a}.`,exception:a,data:{requestObject:e}})}}registerUnknownNotificationHandler(e){return $q(this._unknownNotificationHandler,e)}registerRequestHandler(e,t){if(this._handler.get(e.method))throw new Error(`Handler with method "${e.method}" already registered.`);return $q(this._handler,e.method,{kind:"request",requestType:e,handler:t})}registerNotificationHandler(e,t){let i=this._handler.get(e.method);if(!i)i={kind:"notification",notificationType:e,handlers:new Set},this._handler.set(e.method,i);else{if(i.kind!=="notification")throw new Error(`Method "${e.method}" was already registered as request handler.`);if(i.notificationType!==e)throw new Error(`Method "${e.method}" was registered for a different type.`)}return $q(i.handlers,t)}getRegisteredTypes(){const e=[];for(const t of this._handler.values())t.kind==="notification"?e.push(t.notificationType):t.kind==="request"&&e.push(t.requestType);return e}async request(e,t,i){if(!this.checkChannel(this._requestSender))throw new Error("Impossible");const s=e.paramsSerializer.serializeToJson(t);nSe(s);const r=await this._requestSender.sendRequest({method:e.method,params:s},i);if("error"in r){if(e.isOptional&&r.error.code===Rh.methodNotFound)return QFe;let o;if(r.error.data!==void 0){const l=e.errorSerializer.deserializeFromJson(r.error.data);if(l.hasErrors)throw new Error(l.errorMessage);o=l.value}else o=void 0;const a=new sSe(r.error.message,o,r.error.code);throw this._requestDidErrorEventEmitter.fire({error:a}),a}else{const o=e.resultSerializer.deserializeFromJson(r.result);if(o.hasErrors)throw new Error("Could not deserialize response: "+o.errorMessage+`
|
|
1649
1649
|
|
|
1650
1650
|
${JSON.stringify(r,null,2)}`);return o.value}}async notify(e,t,i){if(!this.checkChannel(this._requestSender))throw new Error;const s=e.paramsSerializer.serializeToJson(t);nSe(s),this._requestSender.sendNotification({method:e.method,params:s},i)}};function nSe(n){if(n!==null&&Array.isArray(n)&&typeof n!="object")throw new Error("Invalid value! Only null, array and object is allowed.")}var sSe=class t8e extends Error{constructor(e,t,i=Rh.genericApplicationError){super(e),pi(this,"data"),pi(this,"code"),this.data=t,this.code=i,Object.setPrototypeOf(this,t8e.prototype)}},XUt=class Cne{constructor(e,t,i,s,r=!1){pi(this,"method"),pi(this,"paramsSerializer"),pi(this,"resultSerializer"),pi(this,"errorSerializer"),pi(this,"isOptional"),pi(this,"kind","request"),this.method=e,this.paramsSerializer=t,this.resultSerializer=i,this.errorSerializer=s,this.isOptional=r}withMethod(e){return new Cne(e,this.paramsSerializer,this.resultSerializer,this.errorSerializer)}optional(){return new Cne(this.method,this.paramsSerializer,this.resultSerializer,this.errorSerializer,!0)}},QUt=class i8e{constructor(e,t){pi(this,"method"),pi(this,"paramsSerializer"),pi(this,"kind","notification"),this.method=e,this.paramsSerializer=t}withMethod(e){return new i8e(e,this.paramsSerializer)}};function Kt(n){return new XUt((n||{}).method,pD.sAny(),pD.sAny(),pD.sAny())}function dr(n){return new QUt((n||{}).method,pD.sAny())}const JUt=Symbol();var rSe=(eSe=JUt,q3=class{constructor(n){pi(this,"error"),pi(this,eSe),this.error=n}},pi(q3,"factory",n=>new q3(n)),q3);function e$t(n){const e=oSe(n.server),t=oSe(n.client);return new t$t(n.tags||[],e,t)}function oSe(n){const e={};for(const[t,i]of Object.entries(n)){const s=i.method?i.method:t;e[t]=i.withMethod(s)}return e}var t$t=class n8e{constructor(e=[],t,i){pi(this,"tags"),pi(this,"server"),pi(this,"client"),this.tags=e,this.server=t,this.client=i}_onlyDesignTime(){return new Error("This property is not meant to be accessed at runtime")}get TContractObject(){throw this._onlyDesignTime()}get TClientInterface(){throw this._onlyDesignTime()}get TServerInterface(){throw this._onlyDesignTime()}get TClientHandler(){throw this._onlyDesignTime()}get TServerHandler(){throw this._onlyDesignTime()}get TTags(){throw this._onlyDesignTime()}getInterface(e,t,i,s){const r=this.buildCounterpart(e,i),o=this.registerHandlers(e,t,s,r);return{counterpart:r,dispose:()=>o.dispose()}}buildCounterpart(e,t){const i={};for(const[s,r]of Object.entries(t)){let o;r.kind==="request"?r.isOptional?o=async(a,l)=>{a===void 0&&(a={});try{return await e.request(r,a,l)}catch(c){if(c&&c.code===Rh.methodNotFound)return QFe;throw c}}:o=(a,l)=>(a===void 0&&(a={}),e.request(r,a,l)):o=(a,l)=>(a===void 0&&(a={}),e.notify(r,a,l)),i[s]=o}return i}registerHandlers(e,t,i,s){const r=[];for(const[o,a]of Object.entries(t))if(a.kind==="request"){let l=i[o];if(!l)continue;const c=this.createRequestHandler(s,l);r.push(e.registerRequestHandler(a,c))}else{const l=i[o];l&&r.push(e.registerNotificationHandler(a,(c,d)=>{l(c,{context:d,counterpart:s})}))}return{dispose:()=>r.forEach(o=>o.dispose())}}createRequestHandler(e,t){return async(i,s,r)=>{const o=await t(i,{context:r,counterpart:e,newErr:rSe.factory,requestId:s});return o instanceof rSe?o.error:{ok:o}}}static getServerFromStream(e,t,i,s){const r=iSe.fromTransport(t,i),{server:o}=e.getServer(r,s);return r.startListen(),{channel:r,server:o}}static registerServerToStream(e,t,i,s){const r=iSe.fromTransport(t,i),{client:o}=e.registerServer(r,s);return r.startListen(),{channel:r,client:o}}getServer(e,t){const{counterpart:i,dispose:s}=this.getInterface(e,this.client,this.server,t);return{server:i,dispose:s}}registerServer(e,t){const{counterpart:i,dispose:s}=this.getInterface(e,this.server,this.client,t);return{client:i,dispose:s}}withContext(){return new n8e(this.tags,this.server,this.client)}};let Gq=(function(n){return n.Comment="comment",n.Imports="imports",n.Region="region",n})({}),Or=(function(n){return n[n.File=1]="File",n[n.Module=2]="Module",n[n.Namespace=3]="Namespace",n[n.Package=4]="Package",n[n.Class=5]="Class",n[n.Method=6]="Method",n[n.Property=7]="Property",n[n.Field=8]="Field",n[n.Constructor=9]="Constructor",n[n.Enum=10]="Enum",n[n.Interface=11]="Interface",n[n.Function=12]="Function",n[n.Variable=13]="Variable",n[n.Constant=14]="Constant",n[n.String=15]="String",n[n.Number=16]="Number",n[n.Boolean=17]="Boolean",n[n.Array=18]="Array",n[n.Object=19]="Object",n[n.Key=20]="Key",n[n.Null=21]="Null",n[n.EnumMember=22]="EnumMember",n[n.Struct=23]="Struct",n[n.Event=24]="Event",n[n.Operator=25]="Operator",n[n.TypeParameter=26]="TypeParameter",n})({}),i$t=(function(n){return n[n.Deprecated=1]="Deprecated",n})({}),aSe=(function(n){return n[n.Type=1]="Type",n[n.Parameter=2]="Parameter",n})({}),Wr=(function(n){return n[n.Text=1]="Text",n[n.Method=2]="Method",n[n.Function=3]="Function",n[n.Constructor=4]="Constructor",n[n.Field=5]="Field",n[n.Variable=6]="Variable",n[n.Class=7]="Class",n[n.Interface=8]="Interface",n[n.Module=9]="Module",n[n.Property=10]="Property",n[n.Unit=11]="Unit",n[n.Value=12]="Value",n[n.Enum=13]="Enum",n[n.Keyword=14]="Keyword",n[n.Snippet=15]="Snippet",n[n.Color=16]="Color",n[n.File=17]="File",n[n.Reference=18]="Reference",n[n.Folder=19]="Folder",n[n.EnumMember=20]="EnumMember",n[n.Constant=21]="Constant",n[n.Struct=22]="Struct",n[n.Event=23]="Event",n[n.Operator=24]="Operator",n[n.TypeParameter=25]="TypeParameter",n})({}),n$t=(function(n){return n[n.Deprecated=1]="Deprecated",n})({}),s$t=(function(n){return n[n.PlainText=1]="PlainText",n[n.Snippet=2]="Snippet",n})({}),qq=(function(n){return n[n.Text=1]="Text",n[n.Read=2]="Read",n[n.Write=3]="Write",n})({}),o1=(function(n){return n[n.Error=1]="Error",n[n.Warning=2]="Warning",n[n.Information=3]="Information",n[n.Hint=4]="Hint",n})({}),lSe=(function(n){return n[n.Unnecessary=1]="Unnecessary",n[n.Deprecated=2]="Deprecated",n})({}),Kq=(function(n){return n[n.Invoked=1]="Invoked",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.TriggerForIncompleteCompletions=3]="TriggerForIncompleteCompletions",n})({}),Zq=(function(n){return n[n.Invoked=1]="Invoked",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange",n})({}),cSe=(function(n){return n[n.Invoked=1]="Invoked",n[n.Automatic=2]="Automatic",n})({});var Oi=class{constructor(n){this.method=n}};const r$t={textDocumentImplementation:new Oi("textDocument/implementation"),textDocumentTypeDefinition:new Oi("textDocument/typeDefinition"),textDocumentDocumentColor:new Oi("textDocument/documentColor"),textDocumentColorPresentation:new Oi("textDocument/colorPresentation"),textDocumentFoldingRange:new Oi("textDocument/foldingRange"),textDocumentDeclaration:new Oi("textDocument/declaration"),textDocumentSelectionRange:new Oi("textDocument/selectionRange"),textDocumentPrepareCallHierarchy:new Oi("textDocument/prepareCallHierarchy"),textDocumentSemanticTokensFull:new Oi("textDocument/semanticTokens/full"),textDocumentSemanticTokensFullDelta:new Oi("textDocument/semanticTokens/full/delta"),textDocumentLinkedEditingRange:new Oi("textDocument/linkedEditingRange"),workspaceWillCreateFiles:new Oi("workspace/willCreateFiles"),workspaceWillRenameFiles:new Oi("workspace/willRenameFiles"),workspaceWillDeleteFiles:new Oi("workspace/willDeleteFiles"),textDocumentMoniker:new Oi("textDocument/moniker"),textDocumentPrepareTypeHierarchy:new Oi("textDocument/prepareTypeHierarchy"),textDocumentInlineValue:new Oi("textDocument/inlineValue"),textDocumentInlayHint:new Oi("textDocument/inlayHint"),textDocumentDiagnostic:new Oi("textDocument/diagnostic"),textDocumentInlineCompletion:new Oi("textDocument/inlineCompletion"),textDocumentWillSaveWaitUntil:new Oi("textDocument/willSaveWaitUntil"),textDocumentCompletion:new Oi("textDocument/completion"),textDocumentHover:new Oi("textDocument/hover"),textDocumentSignatureHelp:new Oi("textDocument/signatureHelp"),textDocumentDefinition:new Oi("textDocument/definition"),textDocumentReferences:new Oi("textDocument/references"),textDocumentDocumentHighlight:new Oi("textDocument/documentHighlight"),textDocumentDocumentSymbol:new Oi("textDocument/documentSymbol"),textDocumentCodeAction:new Oi("textDocument/codeAction"),workspaceSymbol:new Oi("workspace/symbol"),textDocumentCodeLens:new Oi("textDocument/codeLens"),textDocumentDocumentLink:new Oi("textDocument/documentLink"),textDocumentFormatting:new Oi("textDocument/formatting"),textDocumentRangeFormatting:new Oi("textDocument/rangeFormatting"),textDocumentRangesFormatting:new Oi("textDocument/rangesFormatting"),textDocumentOnTypeFormatting:new Oi("textDocument/onTypeFormatting"),textDocumentRename:new Oi("textDocument/rename"),workspaceExecuteCommand:new Oi("workspace/executeCommand"),workspaceDidCreateFiles:new Oi("workspace/didCreateFiles"),workspaceDidRenameFiles:new Oi("workspace/didRenameFiles"),workspaceDidDeleteFiles:new Oi("workspace/didDeleteFiles"),workspaceDidChangeConfiguration:new Oi("workspace/didChangeConfiguration"),textDocumentDidOpen:new Oi("textDocument/didOpen"),textDocumentDidChange:new Oi("textDocument/didChange"),textDocumentDidClose:new Oi("textDocument/didClose"),textDocumentDidSave:new Oi("textDocument/didSave"),textDocumentWillSave:new Oi("textDocument/willSave"),workspaceDidChangeWatchedFiles:new Oi("workspace/didChangeWatchedFiles")};e$t({server:{textDocumentImplementation:Kt({method:"textDocument/implementation"}),textDocumentTypeDefinition:Kt({method:"textDocument/typeDefinition"}),textDocumentDocumentColor:Kt({method:"textDocument/documentColor"}),textDocumentColorPresentation:Kt({method:"textDocument/colorPresentation"}),textDocumentFoldingRange:Kt({method:"textDocument/foldingRange"}),textDocumentDeclaration:Kt({method:"textDocument/declaration"}),textDocumentSelectionRange:Kt({method:"textDocument/selectionRange"}),textDocumentPrepareCallHierarchy:Kt({method:"textDocument/prepareCallHierarchy"}),callHierarchyIncomingCalls:Kt({method:"callHierarchy/incomingCalls"}),callHierarchyOutgoingCalls:Kt({method:"callHierarchy/outgoingCalls"}),textDocumentSemanticTokensFull:Kt({method:"textDocument/semanticTokens/full"}),textDocumentSemanticTokensFullDelta:Kt({method:"textDocument/semanticTokens/full/delta"}),textDocumentSemanticTokensRange:Kt({method:"textDocument/semanticTokens/range"}),textDocumentLinkedEditingRange:Kt({method:"textDocument/linkedEditingRange"}),workspaceWillCreateFiles:Kt({method:"workspace/willCreateFiles"}),workspaceWillRenameFiles:Kt({method:"workspace/willRenameFiles"}),workspaceWillDeleteFiles:Kt({method:"workspace/willDeleteFiles"}),textDocumentMoniker:Kt({method:"textDocument/moniker"}),textDocumentPrepareTypeHierarchy:Kt({method:"textDocument/prepareTypeHierarchy"}),typeHierarchySupertypes:Kt({method:"typeHierarchy/supertypes"}),typeHierarchySubtypes:Kt({method:"typeHierarchy/subtypes"}),textDocumentInlineValue:Kt({method:"textDocument/inlineValue"}),textDocumentInlayHint:Kt({method:"textDocument/inlayHint"}),inlayHintResolve:Kt({method:"inlayHint/resolve"}),textDocumentDiagnostic:Kt({method:"textDocument/diagnostic"}),workspaceDiagnostic:Kt({method:"workspace/diagnostic"}),textDocumentInlineCompletion:Kt({method:"textDocument/inlineCompletion"}),initialize:Kt({method:"initialize"}),shutdown:Kt({method:"shutdown"}),textDocumentWillSaveWaitUntil:Kt({method:"textDocument/willSaveWaitUntil"}),textDocumentCompletion:Kt({method:"textDocument/completion"}),completionItemResolve:Kt({method:"completionItem/resolve"}),textDocumentHover:Kt({method:"textDocument/hover"}),textDocumentSignatureHelp:Kt({method:"textDocument/signatureHelp"}),textDocumentDefinition:Kt({method:"textDocument/definition"}),textDocumentReferences:Kt({method:"textDocument/references"}),textDocumentDocumentHighlight:Kt({method:"textDocument/documentHighlight"}),textDocumentDocumentSymbol:Kt({method:"textDocument/documentSymbol"}),textDocumentCodeAction:Kt({method:"textDocument/codeAction"}),codeActionResolve:Kt({method:"codeAction/resolve"}),workspaceSymbol:Kt({method:"workspace/symbol"}),workspaceSymbolResolve:Kt({method:"workspaceSymbol/resolve"}),textDocumentCodeLens:Kt({method:"textDocument/codeLens"}),codeLensResolve:Kt({method:"codeLens/resolve"}),textDocumentDocumentLink:Kt({method:"textDocument/documentLink"}),documentLinkResolve:Kt({method:"documentLink/resolve"}),textDocumentFormatting:Kt({method:"textDocument/formatting"}),textDocumentRangeFormatting:Kt({method:"textDocument/rangeFormatting"}),textDocumentRangesFormatting:Kt({method:"textDocument/rangesFormatting"}),textDocumentOnTypeFormatting:Kt({method:"textDocument/onTypeFormatting"}),textDocumentRename:Kt({method:"textDocument/rename"}),textDocumentPrepareRename:Kt({method:"textDocument/prepareRename"}),workspaceExecuteCommand:Kt({method:"workspace/executeCommand"}),workspaceDidChangeWorkspaceFolders:dr({method:"workspace/didChangeWorkspaceFolders"}),windowWorkDoneProgressCancel:dr({method:"window/workDoneProgress/cancel"}),workspaceDidCreateFiles:dr({method:"workspace/didCreateFiles"}),workspaceDidRenameFiles:dr({method:"workspace/didRenameFiles"}),workspaceDidDeleteFiles:dr({method:"workspace/didDeleteFiles"}),notebookDocumentDidOpen:dr({method:"notebookDocument/didOpen"}),notebookDocumentDidChange:dr({method:"notebookDocument/didChange"}),notebookDocumentDidSave:dr({method:"notebookDocument/didSave"}),notebookDocumentDidClose:dr({method:"notebookDocument/didClose"}),initialized:dr({method:"initialized"}),exit:dr({method:"exit"}),workspaceDidChangeConfiguration:dr({method:"workspace/didChangeConfiguration"}),textDocumentDidOpen:dr({method:"textDocument/didOpen"}),textDocumentDidChange:dr({method:"textDocument/didChange"}),textDocumentDidClose:dr({method:"textDocument/didClose"}),textDocumentDidSave:dr({method:"textDocument/didSave"}),textDocumentWillSave:dr({method:"textDocument/willSave"}),workspaceDidChangeWatchedFiles:dr({method:"workspace/didChangeWatchedFiles"}),setTrace:dr({method:"$/setTrace"}),cancelRequest:dr({method:"$/cancelRequest"}),progress:dr({method:"$/progress"})},client:{workspaceWorkspaceFolders:Kt({method:"workspace/workspaceFolders"}).optional(),workspaceConfiguration:Kt({method:"workspace/configuration"}).optional(),workspaceFoldingRangeRefresh:Kt({method:"workspace/foldingRange/refresh"}).optional(),windowWorkDoneProgressCreate:Kt({method:"window/workDoneProgress/create"}).optional(),workspaceSemanticTokensRefresh:Kt({method:"workspace/semanticTokens/refresh"}).optional(),windowShowDocument:Kt({method:"window/showDocument"}).optional(),workspaceInlineValueRefresh:Kt({method:"workspace/inlineValue/refresh"}).optional(),workspaceInlayHintRefresh:Kt({method:"workspace/inlayHint/refresh"}).optional(),workspaceDiagnosticRefresh:Kt({method:"workspace/diagnostic/refresh"}).optional(),clientRegisterCapability:Kt({method:"client/registerCapability"}).optional(),clientUnregisterCapability:Kt({method:"client/unregisterCapability"}).optional(),windowShowMessageRequest:Kt({method:"window/showMessageRequest"}).optional(),workspaceCodeLensRefresh:Kt({method:"workspace/codeLens/refresh"}).optional(),workspaceApplyEdit:Kt({method:"workspace/applyEdit"}).optional(),windowShowMessage:dr({method:"window/showMessage"}),windowLogMessage:dr({method:"window/logMessage"}),telemetryEvent:dr({method:"telemetry/event"}),textDocumentPublishDiagnostics:dr({method:"textDocument/publishDiagnostics"}),logTrace:dr({method:"$/logTrace"}),cancelRequest:dr({method:"$/cancelRequest"}),progress:dr({method:"$/progress"})}});Uq=class{constructor(){pi(this,"_store",new o$t)}dispose(){this._store.dispose()}_register(n){if(n===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(n)}},pi(Uq,"None",Object.freeze({dispose(){}}));var o$t=(K3=class{constructor(){pi(this,"_toDispose",new Set),pi(this,"_isDisposed",!1)}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}clear(){if(this._toDispose.size!==0)try{for(const n of this._toDispose)n.dispose()}finally{this._toDispose.clear()}}add(n){if(!n)return n;if(n===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?K3.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(n),n}},pi(K3,"DISABLE_DISPOSED_WARNING",!1),K3);Nt.CodeActionTriggerType.Invoke,cSe.Invoked,Nt.CodeActionTriggerType.Auto,cSe.Automatic;Wr.Text,Nt.CompletionItemKind.Text,Wr.Method,Nt.CompletionItemKind.Method,Wr.Function,Nt.CompletionItemKind.Function,Wr.Constructor,Nt.CompletionItemKind.Constructor,Wr.Field,Nt.CompletionItemKind.Field,Wr.Variable,Nt.CompletionItemKind.Variable,Wr.Class,Nt.CompletionItemKind.Class,Wr.Interface,Nt.CompletionItemKind.Interface,Wr.Module,Nt.CompletionItemKind.Module,Wr.Property,Nt.CompletionItemKind.Property,Wr.Unit,Nt.CompletionItemKind.Unit,Wr.Value,Nt.CompletionItemKind.Value,Wr.Enum,Nt.CompletionItemKind.Enum,Wr.Keyword,Nt.CompletionItemKind.Keyword,Wr.Snippet,Nt.CompletionItemKind.Snippet,Wr.Color,Nt.CompletionItemKind.Color,Wr.File,Nt.CompletionItemKind.File,Wr.Reference,Nt.CompletionItemKind.Reference,Wr.Folder,Nt.CompletionItemKind.Folder,Wr.EnumMember,Nt.CompletionItemKind.EnumMember,Wr.Constant,Nt.CompletionItemKind.Constant,Wr.Struct,Nt.CompletionItemKind.Struct,Wr.Event,Nt.CompletionItemKind.Event,Wr.Operator,Nt.CompletionItemKind.Operator,Wr.TypeParameter,Nt.CompletionItemKind.TypeParameter;n$t.Deprecated,Nt.CompletionItemTag.Deprecated;Nt.CompletionTriggerKind.Invoke,Kq.Invoked,Nt.CompletionTriggerKind.TriggerCharacter,Kq.TriggerCharacter,Nt.CompletionTriggerKind.TriggerForIncompleteCompletions,Kq.TriggerForIncompleteCompletions;s$t.Snippet,Nt.CompletionItemInsertTextRule.InsertAsSnippet;Or.File,Nt.SymbolKind.File,Or.Module,Nt.SymbolKind.Module,Or.Namespace,Nt.SymbolKind.Namespace,Or.Package,Nt.SymbolKind.Package,Or.Class,Nt.SymbolKind.Class,Or.Method,Nt.SymbolKind.Method,Or.Property,Nt.SymbolKind.Property,Or.Field,Nt.SymbolKind.Field,Or.Constructor,Nt.SymbolKind.Constructor,Or.Enum,Nt.SymbolKind.Enum,Or.Interface,Nt.SymbolKind.Interface,Or.Function,Nt.SymbolKind.Function,Or.Variable,Nt.SymbolKind.Variable,Or.Constant,Nt.SymbolKind.Constant,Or.String,Nt.SymbolKind.String,Or.Number,Nt.SymbolKind.Number,Or.Boolean,Nt.SymbolKind.Boolean,Or.Array,Nt.SymbolKind.Array,Or.Object,Nt.SymbolKind.Object,Or.Key,Nt.SymbolKind.Key,Or.Null,Nt.SymbolKind.Null,Or.EnumMember,Nt.SymbolKind.EnumMember,Or.Struct,Nt.SymbolKind.Struct,Or.Event,Nt.SymbolKind.Event,Or.Operator,Nt.SymbolKind.Operator,Or.TypeParameter,Nt.SymbolKind.TypeParameter;i$t.Deprecated,Nt.SymbolTag.Deprecated;qq.Text,Nt.DocumentHighlightKind.Text,qq.Read,Nt.DocumentHighlightKind.Read,qq.Write,Nt.DocumentHighlightKind.Write;Gq.Comment,Nt.FoldingRangeKind.Comment,Gq.Imports,Nt.FoldingRangeKind.Imports,Gq.Region,Nt.FoldingRangeKind.Region;m_.Error,o1.Error,m_.Warning,o1.Warning,m_.Info,o1.Information,m_.Hint,o1.Hint;o1.Error,m_.Error,o1.Warning,m_.Warning,o1.Information,m_.Info,o1.Hint,m_.Hint;lSe.Unnecessary,vne.Unnecessary,lSe.Deprecated,vne.Deprecated;Nt.SignatureHelpTriggerKind.Invoke,Zq.Invoked,Nt.SignatureHelpTriggerKind.TriggerCharacter,Zq.TriggerCharacter,Nt.SignatureHelpTriggerKind.ContentChange,Zq.ContentChange;aSe.Type,Nt.InlayHintKind.Type,aSe.Parameter,Nt.InlayHintKind.Parameter;new Map([...Object.values(r$t)].map(n=>[n.method,n]));function a$t(n,e){var i;const t=globalThis.MonacoEnvironment;if(t!=null&&t.createTrustedTypesPolicy)try{return t.createTrustedTypesPolicy(n,e)}catch(s){console.error(s);return}try{return(i=globalThis.trustedTypes)==null?void 0:i.createPolicy(n,e)}catch(s){console.error(s);return}}let h7;typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope"&&globalThis.workerttPolicy!==void 0?h7=globalThis.workerttPolicy:h7=a$t("defaultWorkerFactory",{createScriptURL:n=>n});function l$t(n){const e=n.label,t=globalThis.MonacoEnvironment;if(t){if(typeof t.getWorker=="function")return t.getWorker("workerMain.js",e);if(typeof t.getWorkerUrl=="function"){const i=t.getWorkerUrl("workerMain.js",e);return new Worker(h7?h7.createScriptURL(i):i,{name:e,type:"module"})}}if(n.createWorker)return n.createWorker();throw new Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker")}function LYt(n){const e=Promise.resolve(l$t({label:n.label??"monaco-editor-worker",moduleId:n.moduleId,createWorker:n.createWorker})).then(t=>(t.postMessage("ignore"),t.postMessage(n.createData),t));return TFe.createWebWorker({worker:e,host:n.host,keepIdleModels:n.keepIdleModels})}function s8e(){return CUt}const Yq=globalThis.MonacoEnvironment;Yq!=null&&Yq.globalAPI&&(globalThis.monaco=s8e());const eW=s8e();eW.languages.css=wUt;eW.languages.html=RUt;eW.languages.typescript=jUt;eW.languages.json=AUt;const c$t=[{label:"prompt",insertText:`{{#prompt}}
|
|
1651
1651
|
$0
|