@gurpreetmahi/easy.ui 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -6
- package/dist/index.js +484 -678
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);let t=require("react"),n=require("react-dom");var r=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),i=e((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===k?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`;case O:return`ViewTransition`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=A.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(j.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function l(){var e=t(this.type);return F[e]||(F[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,"ref",{enumerable:!1,value:null}):Object.defineProperty(e,"ref",{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0){if(o){if(M(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`)}else f(p)}if(j.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,R[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
-
let props = %s;
|
|
3
|
-
<%s {...props} />
|
|
4
|
-
React keys must be passed directly to JSX without using spread:
|
|
5
|
-
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,o,p,m,p),R[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.view_transition`),k=Symbol.for(`react.client.reference`),A=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,M=Array.isArray,N=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var P,F={},I=m.react_stack_bottom_frame.bind(m,o)(),L=N(i(o)),R={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;if(r){var a=Error.stackTraceLimit;Error.stackTraceLimit=10;var o=Error(`react-stack-top-frame`);Error.stackTraceLimit=a}else o=I;return d(e,t,n,!1,o,r?N(i(e)):L)},e.jsxs=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;if(r){var a=Error.stackTraceLimit;Error.stackTraceLimit=10;var o=Error(`react-stack-top-frame`);Error.stackTraceLimit=a}else o=I;return d(e,t,n,!0,o,r?N(i(e)):L)}})()})),a=e(((e,t)=>{t.exports=process.env.NODE_ENV===`production`?r():i()}))();function o({label:e,icon:t,size:n=`regular`,className:r,...i}){return(0,a.jsxs)(`button`,{type:`button`,className:[`ribbon-button`,`ribbon-button--${n}`,r].filter(Boolean).join(` `),...i,children:[t?(0,a.jsx)(`span`,{className:`ribbon-button__icon`,"aria-hidden":`true`,children:t}):null,(0,a.jsx)(`span`,{className:`ribbon-button__label`,children:e})]})}function s({parents:e,activeParentId:n,defaultParentId:r,visibleItems:i=3,onParentChange:s,onItemClick:c}){let l=Math.max(1,Math.floor(i)),u=e.filter(e=>!e.disabled),d=e.find(e=>!e.disabled),f=e.some(e=>e.id===r&&!e.disabled)?r:d?.id,[p,m]=(0,t.useState)(f),[h,g]=(0,t.useState)({parentId:f,index:0}),_=n??p,v=e.find(e=>e.id===_&&!e.disabled)??d,y=u.findIndex(e=>e.id===v?.id),b=u.length>1,x=v?.children??[],S=Math.max(1,Math.ceil(x.length/l)),C=h.parentId===v?.id?Math.min(h.index,S-1):0,w=x.slice(C*l,(C+1)*l);function T(e){n===void 0&&m(e.id),g({parentId:e.id,index:0}),s?.(e.id)}function E(e){if(!b||y<0)return;let t=Math.min(u.length-1,Math.max(0,y+e)),n=u[t];n&&n.id!==v?.id&&T(n)}return e.length===0?(0,a.jsx)(`p`,{className:`ribbon-carousel__empty`,children:`No carousel parents available.`}):(0,a.jsxs)(`div`,{className:`ribbon-carousel`,children:[(0,a.jsxs)(`div`,{className:`ribbon-carousel__parent-nav`,children:[(0,a.jsx)(`button`,{type:`button`,className:`ribbon-carousel__parent-arrow`,disabled:!b||y<=0,"aria-label":`Previous parent group`,onClick:()=>E(-1),children:`‹`}),(0,a.jsx)(`div`,{className:`ribbon-carousel__parents`,role:`tablist`,"aria-label":`Carousel parents`,children:e.map(e=>(0,a.jsxs)(`button`,{type:`button`,role:`tab`,className:[`ribbon-carousel__parent`,e.id===v?.id?`is-active`:``].filter(Boolean).join(` `),disabled:e.disabled,"aria-selected":e.id===v?.id,onClick:()=>T(e),children:[e.icon?(0,a.jsx)(`span`,{"aria-hidden":`true`,children:e.icon}):null,(0,a.jsx)(`span`,{children:e.label})]},e.id))}),(0,a.jsx)(`button`,{type:`button`,className:`ribbon-carousel__parent-arrow`,disabled:!b||y<0||y>=u.length-1,"aria-label":`Next parent group`,onClick:()=>E(1),children:`›`})]}),(0,a.jsxs)(`div`,{className:`ribbon-carousel__items-row`,children:[(0,a.jsx)(`button`,{type:`button`,className:`ribbon-carousel__arrow`,disabled:C===0,"aria-label":`Previous carousel items`,onClick:()=>g({parentId:v?.id,index:Math.max(0,C-1)}),children:`‹`}),(0,a.jsxs)(`div`,{className:`ribbon-carousel__items`,role:`tabpanel`,"aria-live":`polite`,children:[w.map(e=>(0,a.jsx)(o,{className:`ribbon-carousel__item`,label:e.label,icon:e.icon,size:e.size??`compact`,disabled:e.disabled,onClick:()=>{e.onClick?.(e.id),v&&c?.(e,v.id)}},`${v?.id??`parent`}-${e.id}`)),w.length===0?(0,a.jsx)(`span`,{className:`ribbon-carousel__empty`,children:`No items for this parent.`}):null]}),(0,a.jsx)(`button`,{type:`button`,className:`ribbon-carousel__arrow`,disabled:C>=S-1,"aria-label":`Next carousel items`,onClick:()=>g({parentId:v?.id,index:Math.min(S-1,C+1)}),children:`›`})]}),(0,a.jsxs)(`div`,{className:`ribbon-carousel__status`,"aria-hidden":`true`,children:[C+1,` / `,S]})]})}function c({label:e,icon:r,size:i=`regular`,disabled:o,options:s,onSelect:c}){let[l,u]=(0,t.useState)(!1),d=(0,t.useRef)(null),f=(0,t.useRef)(null),p=(0,t.useRef)(null),[m,h]=(0,t.useState)({top:0,left:0,width:170}),g=(0,t.useId)();function _(){if(!f.current)return;let e=f.current.getBoundingClientRect(),t=Math.max(e.width,170),n=Math.max(44,s.length*38+12),r=window.innerHeight-e.bottom<n&&e.top>n?e.top-n-4:e.bottom+4;h({top:Math.max(8,r),left:Math.max(8,Math.min(e.left,window.innerWidth-t-8)),width:t})}return(0,t.useEffect)(()=>{function e(e){if(!d.current)return;let t=e.target,n=d.current.contains(t),r=p.current?.contains(t);!n&&!r&&u(!1)}function t(e){e.key===`Escape`&&u(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[]),(0,t.useEffect)(()=>{if(!l)return;_();function e(){_()}return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[l,s.length]),(0,a.jsxs)(`div`,{ref:d,className:[`ribbon-dropdown`,`ribbon-dropdown--${i}`,l?`is-open`:``].filter(Boolean).join(` `),children:[(0,a.jsxs)(`button`,{ref:f,type:`button`,className:[`ribbon-button`,`ribbon-button--${i}`,`ribbon-dropdown__trigger`].filter(Boolean).join(` `),disabled:o,"aria-haspopup":`menu`,"aria-expanded":l,"aria-controls":g,onClick:()=>u(e=>!e),children:[(0,a.jsxs)(`span`,{className:`ribbon-dropdown__head`,children:[r?(0,a.jsx)(`span`,{className:`ribbon-button__icon`,"aria-hidden":`true`,children:r}):null,(0,a.jsx)(`span`,{className:`ribbon-button__label`,children:e})]}),(0,a.jsx)(`span`,{className:`ribbon-dropdown__caret`,"aria-hidden":`true`,children:`▾`})]}),l?(0,n.createPortal)((0,a.jsx)(`ul`,{id:g,ref:p,role:`menu`,className:`ribbon-dropdown__menu ribbon-dropdown__menu--portal`,"aria-label":`${e} options`,style:{top:`${m.top}px`,left:`${m.left}px`,width:`${m.width}px`},children:s.map(e=>(0,a.jsx)(`li`,{role:`none`,className:`ribbon-dropdown__menu-item`,children:(0,a.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`ribbon-dropdown__option-button`,onClick:()=>{c(e.id),u(!1)},children:[(0,a.jsx)(`span`,{className:`ribbon-dropdown__option-icon`,"aria-hidden":`true`,children:e.icon??`•`}),(0,a.jsx)(`span`,{className:`ribbon-dropdown__option-label`,children:e.label})]})},e.id))}),document.body):null]})}function l({tabs:e,groups:t,activeTabId:n,onTabChange:r,onItemClick:i,className:l,ariaLabel:u=`Application ribbon`}){return(0,a.jsxs)(`section`,{className:[`ribbon`,l].filter(Boolean).join(` `),"aria-label":u,children:[(0,a.jsx)(`nav`,{className:`ribbon__tabbar`,"aria-label":`Ribbon tabs`,children:e.map(e=>(0,a.jsx)(`button`,{type:`button`,className:e.id===n?`ribbon__tab is-active`:`ribbon__tab`,onClick:()=>r(e.id),"aria-selected":e.id===n,role:`tab`,children:e.label},e.id))}),(0,a.jsx)(`div`,{className:`ribbon__surface`,role:`tabpanel`,"aria-label":`${n} commands`,children:t.map(e=>(0,a.jsxs)(`section`,{className:`ribbon__group`,"aria-label":e.title,children:[(0,a.jsx)(`div`,{className:`ribbon__group-items`,children:(e.items??[]).map(e=>e.options&&e.options.length>0?(0,a.jsx)(c,{label:e.label,icon:e.icon,size:e.size,disabled:e.disabled,options:e.options,onSelect:t=>{e.onClick?.(e.id),i?.(e,t)}},e.id):(0,a.jsx)(o,{label:e.label,icon:e.icon,size:e.size,disabled:e.disabled,onClick:()=>{e.onClick?.(e.id),i?.(e)}},e.id))}),e.carousel?(0,a.jsx)(s,{...e.carousel,onItemClick:(e,t)=>i?.(e,void 0,t)}):null,(0,a.jsx)(`h3`,{className:`ribbon__group-title`,children:e.title})]},e.id))})]})}function u({size:e=`regular`,className:t,upperLabel:n,upperIcon:r,upperButtonProps:i,lowerLabel:o,lowerIcon:s,lowerButtonProps:c}){return(0,a.jsxs)(`div`,{className:[`ribbon-split-button`,`ribbon-split-button--${e}`,t].filter(Boolean).join(` `),role:`group`,"aria-label":`${n} and ${o}`,children:[(0,a.jsxs)(`button`,{type:`button`,className:`ribbon-split-button__half ribbon-split-button__half--upper`,...i,children:[r?(0,a.jsx)(`span`,{className:`ribbon-split-button__icon`,"aria-hidden":`true`,children:r}):null,(0,a.jsx)(`span`,{className:`ribbon-split-button__label`,children:n})]}),(0,a.jsxs)(`button`,{type:`button`,className:`ribbon-split-button__half ribbon-split-button__half--lower`,...c,children:[s?(0,a.jsx)(`span`,{className:`ribbon-split-button__icon`,"aria-hidden":`true`,children:s}):null,(0,a.jsx)(`span`,{className:`ribbon-split-button__label`,children:o})]})]})}var d=class{baseUrl;apiKey;constructor(e,t){this.baseUrl=e,this.apiKey=t}async listConnectors(){return this.request(`/api/connectors`)}async getConnector(e){return this.request(`/api/connectors/${encodeURIComponent(e)}`)}async createConnector(e){return this.request(`/api/connectors`,{method:`POST`,body:JSON.stringify(e)})}async updateConnector(e,t){return this.request(`/api/connectors/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(t)})}async deleteConnector(e){await this.request(`/api/connectors/${encodeURIComponent(e)}`,{method:`DELETE`})}async enableConnector(e){await this.request(`/api/connectors/${encodeURIComponent(e)}/enable`,{method:`POST`})}async disableConnector(e){await this.request(`/api/connectors/${encodeURIComponent(e)}/disable`,{method:`POST`})}async runConnector(e){await this.request(`/api/connectors/${encodeURIComponent(e)}/run`,{method:`POST`})}async getRuns(e,t=20){return this.request(`/api/connectors/${encodeURIComponent(e)}/runs?take=${Math.min(100,Math.max(1,t))}`)}async request(e,t){let n=new Headers(t?.headers);n.set(`Accept`,`application/json`),t?.body&&n.set(`Content-Type`,`application/json`),this.apiKey&&n.set(`X-Api-Key`,this.apiKey);let r=await fetch(new URL(e,this.baseUrl),{...t,headers:n});if(!r.ok){let e=`${r.status} ${r.statusText}`;try{let t=await r.json();t.errors&&t.errors.length>0&&(e=t.errors.join(`; `))}catch{}throw Error(e)}if(r.status!==204)return await r.json()}},f=(0,t.createContext)(null);function p({baseUrl:e=`http://localhost:5088`,apiKey:n,client:r,children:i}){let o=(0,t.useMemo)(()=>({client:r??new d(e,n)}),[n,e,r]);return(0,a.jsx)(f.Provider,{value:o,children:i})}function m(){let e=(0,t.useContext)(f);if(!e)throw Error(`useEasyConnectors must be used within EasyConnectorsProvider.`);return e}function h(e){return(0,a.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...e})}function g(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`path`,{d:`M3.5 8.2h6.1l1.5 1.8h9.4`}),(0,a.jsx)(`path`,{d:`M3.5 8.2v8.8a1.5 1.5 0 0 0 1.5 1.5h14a1.5 1.5 0 0 0 1.5-1.5V10a1.8 1.8 0 0 0-1.8-1.8H3.5Z`})]})}function _(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`rect`,{x:`4`,y:`5`,width:`16`,height:`14`,rx:`1.5`}),(0,a.jsx)(`path`,{d:`M4 10h16M9.5 5v14M14.5 5v14`})]})}function v(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`path`,{d:`M9 12h6`}),(0,a.jsx)(`path`,{d:`m13 9 3 3-3 3`})]})}function y(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`rect`,{x:`8`,y:`11`,width:`8`,height:`7`,rx:`1.2`}),(0,a.jsx)(`path`,{d:`M10 11V9a2 2 0 1 1 4 0v2`})]})}function b({kind:e,className:t,...n}){return(0,a.jsxs)(h,{className:[`ec-kind-icon`,t].filter(Boolean).join(` `),...n,children:[e===`FolderToFolder`?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g,{}),(0,a.jsx)(v,{})]}):null,e===`FolderToTable`?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g,{}),(0,a.jsx)(v,{}),(0,a.jsx)(`path`,{d:`M17 6.5h3`}),(0,a.jsx)(`path`,{d:`M18.5 5v3`})]}):null,e===`TableToFolder`?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(_,{}),(0,a.jsx)(`path`,{d:`M7 12h10`}),(0,a.jsx)(`path`,{d:`m11 9-3 3 3 3`}),(0,a.jsx)(g,{})]}):null,e===`FolderToSftp`?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g,{}),(0,a.jsx)(v,{}),(0,a.jsx)(y,{})]}):null,e===`SftpToFolder`?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y,{}),(0,a.jsx)(`path`,{d:`M8 12h6`}),(0,a.jsx)(`path`,{d:`m11 9-3 3 3 3`}),(0,a.jsx)(g,{})]}):null]})}function x(e){return(0,a.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...e})}function S(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`path`,{d:`M3.5 8.2h6.1l1.5 1.8h9.4`}),(0,a.jsx)(`path`,{d:`M3.5 8.2v8.8a1.5 1.5 0 0 0 1.5 1.5h14a1.5 1.5 0 0 0 1.5-1.5V10a1.8 1.8 0 0 0-1.8-1.8H3.5Z`})]})}function C(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`rect`,{x:`4`,y:`5`,width:`16`,height:`14`,rx:`1.5`}),(0,a.jsx)(`path`,{d:`M4 10h16M9.5 5v14M14.5 5v14`})]})}function w(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`rect`,{x:`8`,y:`11`,width:`8`,height:`7`,rx:`1.2`}),(0,a.jsx)(`path`,{d:`M10 11V9a2 2 0 1 1 4 0v2`}),(0,a.jsx)(`path`,{d:`M3 17h3`}),(0,a.jsx)(`path`,{d:`M18 17h3`})]})}function T({endpoint:e,className:t,...n}){return(0,a.jsxs)(x,{className:[`ec-endpoint-icon`,t].filter(Boolean).join(` `),...n,children:[e===`Folder`?(0,a.jsx)(S,{}):null,e===`Table`?(0,a.jsx)(C,{}):null,e===`Sftp`?(0,a.jsx)(w,{}):null]})}function E(e){switch(e){case`FolderToFolder`:return{source:`Folder`,destination:`Folder`};case`FolderToTable`:return{source:`Folder`,destination:`Table`};case`TableToFolder`:return{source:`Table`,destination:`Folder`};case`FolderToSftp`:return{source:`Folder`,destination:`Sftp`};case`SftpToFolder`:return{source:`Sftp`,destination:`Folder`};default:return{source:`Folder`,destination:`Folder`}}}function D({selectedConnectorId:e,refreshToken:n,onSelect:r,onCreate:i}){let{client:o}=m(),[s,c]=(0,t.useState)([]),[l,u]=(0,t.useState)(!1),[d,f]=(0,t.useState)(null),p=(0,t.useCallback)(async()=>{u(!0),f(null);try{c(await o.listConnectors())}catch(e){f(e instanceof Error?e.message:`Failed to load connectors.`)}finally{u(!1)}},[o]);(0,t.useEffect)(()=>{p()},[p,n]);async function h(e){f(null);try{await e(),await p()}catch(e){f(e instanceof Error?e.message:`Action failed.`)}}return(0,a.jsxs)(`section`,{className:`ec-board`,children:[(0,a.jsxs)(`header`,{className:`ec-board__header`,children:[(0,a.jsx)(`h2`,{children:`Connectors`}),(0,a.jsxs)(`div`,{className:`ec-board__header-actions`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:p,children:`Refresh`}),(0,a.jsx)(`button`,{type:`button`,className:`ec-primary`,onClick:i,children:`New`})]})]}),d?(0,a.jsx)(`p`,{className:`ec-error`,children:d}):null,l?(0,a.jsx)(`p`,{className:`ec-muted`,children:`Loading...`}):null,(0,a.jsx)(`ul`,{className:`ec-board__list`,children:s.map(t=>(()=>{let n=E(t.kind);return(0,a.jsxs)(`li`,{className:[`ec-board__item`,e===t.id?`is-selected`:``].filter(Boolean).join(` `),children:[(0,a.jsxs)(`button`,{type:`button`,className:`ec-board__item-main`,onClick:()=>t.id&&r?.(t.id),children:[(0,a.jsxs)(`span`,{className:`ec-board__name-row`,children:[(0,a.jsx)(b,{kind:t.kind}),(0,a.jsx)(`span`,{className:`ec-board__name`,children:t.name})]}),(0,a.jsxs)(`span`,{className:`ec-flow`,"aria-label":`Flow ${n.source} to ${n.destination}`,children:[(0,a.jsxs)(`span`,{className:`ec-flow__node`,children:[(0,a.jsx)(T,{endpoint:n.source}),(0,a.jsx)(`span`,{children:n.source})]}),(0,a.jsx)(`span`,{className:`ec-flow__arrow`,"aria-hidden":`true`,children:`->`}),(0,a.jsxs)(`span`,{className:`ec-flow__connector`,children:[(0,a.jsx)(b,{kind:t.kind,className:`ec-kind-icon--chip`}),(0,a.jsx)(`span`,{children:`Connector`})]}),(0,a.jsx)(`span`,{className:`ec-flow__arrow`,"aria-hidden":`true`,children:`->`}),(0,a.jsxs)(`span`,{className:`ec-flow__node`,children:[(0,a.jsx)(T,{endpoint:n.destination}),(0,a.jsx)(`span`,{children:n.destination})]})]}),(0,a.jsx)(`span`,{className:`ec-status ec-status--${(t.status??`Idle`).toLowerCase()}`,children:t.status??`Idle`})]}),(0,a.jsxs)(`div`,{className:`ec-board__item-actions`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:()=>t.id&&h(()=>o.runConnector(t.id)),children:`Run now`}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>t.id&&h(()=>t.status===`Disabled`?o.enableConnector(t.id):o.disableConnector(t.id)),children:t.status===`Disabled`?`Enable`:`Disable`})]})]},t.id)})())}),s.length===0&&!l?(0,a.jsx)(`p`,{className:`ec-muted`,children:`No connectors yet. Create one to start transferring.`}):null]})}var O=[`FolderToFolder`,`FolderToTable`,`TableToFolder`,`FolderToSftp`,`SftpToFolder`],k=[`Copy`,`Move`],A=[`Manual`,`Interval`,`Daily`,`OnCreated`,`OnUpdated`],j=[`Sqlite`,`SqlServer`];function M(){return{name:`New connector`,kind:`FolderToFolder`,mode:`Copy`,triggers:[`Manual`],sourcePath:``,destinationPath:``,recursive:!0,overwrite:!0,skipEmptyFiles:!0,continueOnError:!0,intervalMinutes:15,provider:`SqlServer`,tableName:``}}function N({connectorId:e,onSaved:n}){let{client:r}=m(),[i,o]=(0,t.useState)(M()),[s,c]=(0,t.useState)(``),[l,u]=(0,t.useState)(!1),[d,f]=(0,t.useState)(!1),[p,h]=(0,t.useState)(null),[g,_]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!e){o(M()),c(``),h(null),_(null);return}let t=!1;return u(!0),h(null),r.getConnector(e).then(e=>{t||(o(e),c((e.keyColumns??[]).join(`, `)))}).catch(e=>{t||h(e instanceof Error?e.message:`Failed to load connector.`)}).finally(()=>{t||u(!1)}),()=>{t=!0}},[r,e]);let v=(0,t.useMemo)(()=>E(i.kind),[i.kind]);function y(e,t){o(n=>({...n,[e]:t}))}function x(e){o(t=>{let n=t.triggers.includes(e)?t.triggers.filter(t=>t!==e):[...t.triggers,e];return{...t,triggers:n}})}async function S(){f(!0),h(null),_(null);let t={...i,keyColumns:s.split(`,`).map(e=>e.trim()).filter(Boolean)};try{let i=e?await r.updateConnector(e,t):await r.createConnector(t);o(i),c((i.keyColumns??[]).join(`, `)),_(`Connector saved.`),n?.(i)}catch(e){h(e instanceof Error?e.message:`Save failed.`)}finally{f(!1)}}function C(e){return e===`source`?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`label`,{children:[`Source path`,(0,a.jsx)(`input`,{value:i.sourcePath??``,onChange:e=>y(`sourcePath`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[`Pattern`,(0,a.jsx)(`input`,{value:i.pattern??``,onChange:e=>y(`pattern`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[(0,a.jsx)(`span`,{children:`Recursive`}),(0,a.jsx)(`input`,{type:`checkbox`,checked:i.recursive??!1,onChange:e=>y(`recursive`,e.target.checked)})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`label`,{children:[`Destination path`,(0,a.jsx)(`input`,{value:i.destinationPath??``,onChange:e=>y(`destinationPath`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[(0,a.jsx)(`span`,{children:`Overwrite`}),(0,a.jsx)(`input`,{type:`checkbox`,checked:i.overwrite??!1,onChange:e=>y(`overwrite`,e.target.checked)})]})]})}function w(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`label`,{children:[`Provider`,(0,a.jsx)(`select`,{value:i.provider??`SqlServer`,onChange:e=>y(`provider`,e.target.value),children:j.map(e=>(0,a.jsx)(`option`,{value:e,children:e},e))})]}),(0,a.jsxs)(`label`,{children:[`Table name`,(0,a.jsx)(`input`,{value:i.tableName??``,onChange:e=>y(`tableName`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[`Schema`,(0,a.jsx)(`input`,{value:i.schema??``,onChange:e=>y(`schema`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[`Key columns (comma separated)`,(0,a.jsx)(`input`,{value:s,onChange:e=>c(e.target.value)})]}),(0,a.jsxs)(`label`,{className:`ec-grid__wide`,children:[`Connection string`,(0,a.jsx)(`input`,{value:i.connectionString??``,onChange:e=>y(`connectionString`,e.target.value)})]}),(0,a.jsxs)(`label`,{className:`ec-grid__wide`,children:[`Where clause`,(0,a.jsx)(`input`,{value:i.whereClause??``,onChange:e=>y(`whereClause`,e.target.value)})]})]})}function D(e){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`label`,{children:[`SFTP host`,(0,a.jsx)(`input`,{value:i.sftpHost??``,onChange:e=>y(`sftpHost`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[`Port`,(0,a.jsx)(`input`,{type:`number`,min:1,value:i.sftpPort??22,onChange:e=>y(`sftpPort`,Number(e.target.value)||22)})]}),(0,a.jsxs)(`label`,{children:[`Remote path`,(0,a.jsx)(`input`,{value:i.remotePath??``,onChange:e=>y(`remotePath`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[`Username`,(0,a.jsx)(`input`,{value:i.sftpUsername??``,onChange:e=>y(`sftpUsername`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[`Password`,(0,a.jsx)(`input`,{type:`password`,value:i.sftpPassword??``,onChange:e=>y(`sftpPassword`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[`Private key path`,(0,a.jsx)(`input`,{value:i.privateKeyPath??``,onChange:e=>y(`privateKeyPath`,e.target.value)})]}),(0,a.jsxs)(`label`,{className:`ec-grid__wide`,children:[`Host key SHA256`,(0,a.jsx)(`input`,{value:i.hostKeySha256??``,onChange:e=>y(`hostKeySha256`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[(0,a.jsx)(`span`,{children:`Accept any host key`}),(0,a.jsx)(`input`,{type:`checkbox`,checked:i.acceptAnyHostKey??!1,onChange:e=>y(`acceptAnyHostKey`,e.target.checked)})]}),e===`destination`?(0,a.jsxs)(`label`,{children:[(0,a.jsx)(`span`,{children:`Overwrite`}),(0,a.jsx)(`input`,{type:`checkbox`,checked:i.overwrite??!1,onChange:e=>y(`overwrite`,e.target.checked)})]}):null]})}function N(e,t){return e===`Folder`?C(t):e===`Table`?w():D(t)}function P(e){return e===`Sftp`?`SFTP`:e}return(0,a.jsxs)(`section`,{className:`ec-form`,children:[(0,a.jsx)(`header`,{className:`ec-form__header`,children:(0,a.jsx)(`h3`,{children:e?`Edit connector`:`Create connector`})}),l?(0,a.jsx)(`p`,{className:`ec-muted`,children:`Loading connector...`}):null,p?(0,a.jsx)(`p`,{className:`ec-error`,children:p}):null,g?(0,a.jsx)(`p`,{className:`ec-success`,children:g}):null,(0,a.jsxs)(`div`,{className:`ec-grid ec-grid--meta`,children:[(0,a.jsxs)(`label`,{children:[`Name`,(0,a.jsx)(`input`,{value:i.name,onChange:e=>y(`name`,e.target.value)})]}),(0,a.jsxs)(`label`,{children:[`Kind`,(0,a.jsx)(`select`,{value:i.kind,onChange:e=>y(`kind`,e.target.value),children:O.map(e=>(0,a.jsx)(`option`,{value:e,children:e},e))}),(0,a.jsxs)(`span`,{className:`ec-kind-preview`,children:[(0,a.jsx)(b,{kind:i.kind}),i.kind]}),(0,a.jsxs)(`span`,{className:`ec-flow ec-flow--compact`,"aria-label":`Flow ${v.source} to ${v.destination}`,children:[(0,a.jsxs)(`span`,{className:`ec-flow__node`,children:[(0,a.jsx)(T,{endpoint:v.source}),(0,a.jsx)(`span`,{children:v.source})]}),(0,a.jsx)(`span`,{className:`ec-flow__arrow`,"aria-hidden":`true`,children:`->`}),(0,a.jsxs)(`span`,{className:`ec-flow__connector`,children:[(0,a.jsx)(b,{kind:i.kind,className:`ec-kind-icon--chip`}),(0,a.jsx)(`span`,{children:`Connector`})]}),(0,a.jsx)(`span`,{className:`ec-flow__arrow`,"aria-hidden":`true`,children:`->`}),(0,a.jsxs)(`span`,{className:`ec-flow__node`,children:[(0,a.jsx)(T,{endpoint:v.destination}),(0,a.jsx)(`span`,{children:v.destination})]})]})]}),(0,a.jsxs)(`label`,{children:[`Mode`,(0,a.jsx)(`select`,{value:i.mode,onChange:e=>y(`mode`,e.target.value),children:k.map(e=>(0,a.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,a.jsxs)(`div`,{className:`ec-endpoint-grid`,children:[(0,a.jsxs)(`section`,{className:`ec-endpoint-panel`,children:[(0,a.jsxs)(`header`,{className:`ec-endpoint-panel__header`,children:[(0,a.jsx)(T,{endpoint:v.source}),(0,a.jsxs)(`h4`,{children:[`Source config (`,P(v.source),`)`]})]}),(0,a.jsx)(`div`,{className:`ec-grid ec-grid--endpoint`,children:N(v.source,`source`)})]}),(0,a.jsxs)(`section`,{className:`ec-endpoint-panel`,children:[(0,a.jsxs)(`header`,{className:`ec-endpoint-panel__header`,children:[(0,a.jsx)(T,{endpoint:v.destination}),(0,a.jsxs)(`h4`,{children:[`Destination config (`,P(v.destination),`)`]})]}),(0,a.jsx)(`div`,{className:`ec-grid ec-grid--endpoint`,children:N(v.destination,`destination`)})]})]}),(0,a.jsxs)(`fieldset`,{className:`ec-form__fieldset`,children:[(0,a.jsx)(`legend`,{children:`Triggers`}),(0,a.jsx)(`div`,{className:`ec-check-row`,children:A.map(e=>(0,a.jsxs)(`label`,{children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:i.triggers.includes(e),onChange:()=>x(e)}),e]},e))})]}),(0,a.jsxs)(`fieldset`,{className:`ec-form__fieldset`,children:[(0,a.jsx)(`legend`,{children:`Options`}),(0,a.jsxs)(`div`,{className:`ec-check-row`,children:[(0,a.jsxs)(`label`,{children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:i.skipEmptyFiles??!1,onChange:e=>y(`skipEmptyFiles`,e.target.checked)}),`Skip empty files`]}),(0,a.jsxs)(`label`,{children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:i.continueOnError??!1,onChange:e=>y(`continueOnError`,e.target.checked)}),`Continue on error`]}),(0,a.jsxs)(`label`,{children:[(0,a.jsx)(`input`,{type:`number`,min:1,value:i.intervalMinutes??15,onChange:e=>y(`intervalMinutes`,Number(e.target.value)||1)}),`Interval minutes`]}),(0,a.jsxs)(`label`,{children:[(0,a.jsx)(`input`,{type:`time`,value:i.dailyTimeLocal??``,onChange:e=>y(`dailyTimeLocal`,e.target.value)}),`Daily time (local)`]})]})]}),(0,a.jsx)(`footer`,{className:`ec-form__footer`,children:(0,a.jsx)(`button`,{type:`button`,className:`ec-primary`,onClick:S,disabled:d,children:d?`Saving...`:`Save connector`})})]})}function P({connectorId:e,take:n=20}){let{client:r}=m(),[i,o]=(0,t.useState)([]),[s,c]=(0,t.useState)(null),[l,u]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{if(!e){o([]);return}let t=!1;return u(!0),c(null),r.getRuns(e,n).then(e=>{t||o(e)}).catch(e=>{t||c(e instanceof Error?e.message:`Failed to load runs.`)}).finally(()=>{t||u(!1)}),()=>{t=!0}},[r,e,n]),(0,a.jsxs)(`section`,{className:`ec-runs`,children:[(0,a.jsx)(`header`,{className:`ec-runs__header`,children:(0,a.jsx)(`h3`,{children:`Recent runs`})}),e?null:(0,a.jsx)(`p`,{className:`ec-muted`,children:`Select a connector to view run history.`}),l?(0,a.jsx)(`p`,{className:`ec-muted`,children:`Loading runs...`}):null,s?(0,a.jsx)(`p`,{className:`ec-error`,children:s}):null,e&&i.length>0?(0,a.jsx)(`div`,{className:`ec-table-wrap`,children:(0,a.jsxs)(`table`,{className:`ec-table`,children:[(0,a.jsx)(`thead`,{children:(0,a.jsxs)(`tr`,{children:[(0,a.jsx)(`th`,{children:`Status`}),(0,a.jsx)(`th`,{children:`Started`}),(0,a.jsx)(`th`,{children:`Transferred`}),(0,a.jsx)(`th`,{children:`Skipped`}),(0,a.jsx)(`th`,{children:`Failed`})]})}),(0,a.jsx)(`tbody`,{children:i.map(e=>(0,a.jsxs)(`tr`,{children:[(0,a.jsx)(`td`,{children:e.status}),(0,a.jsx)(`td`,{children:new Date(e.startedUtc).toLocaleString()}),(0,a.jsx)(`td`,{children:e.transferred}),(0,a.jsx)(`td`,{children:e.skipped}),(0,a.jsx)(`td`,{children:e.failed})]},e.id))})]})}):null]})}function F({className:e}){let[n,r]=(0,t.useState)(void 0),[i,o]=(0,t.useState)(0);return(0,a.jsxs)(`section`,{className:[`ec-app`,e].filter(Boolean).join(` `),children:[(0,a.jsx)(`div`,{className:`ec-app__left`,children:(0,a.jsx)(D,{selectedConnectorId:n,onSelect:r,onCreate:()=>r(void 0),refreshToken:i})}),(0,a.jsxs)(`div`,{className:`ec-app__right`,children:[(0,a.jsx)(N,{connectorId:n,onSaved:e=>{r(e.id),o(e=>e+1)}}),(0,a.jsx)(P,{connectorId:n})]})]})}exports.ConnectorBoard=D,exports.ConnectorForm=N,exports.ConnectorKindIcon=b,exports.ConnectorRuns=P,exports.EasyConnectorsApp=F,exports.EasyConnectorsClient=d,exports.EasyConnectorsProvider=p,exports.EndpointKindIcon=T,exports.Ribbon=l,exports.RibbonButton=o,exports.RibbonCarousel=s,exports.RibbonDropdown=c,exports.RibbonSplitButton=u,exports.getConnectorFlow=E,exports.useEasyConnectors=m;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom");function r({label:t,icon:n,size:r=`regular`,className:i,...a}){return(0,e.jsxs)(`button`,{type:`button`,className:[`ribbon-button`,`ribbon-button--${r}`,i].filter(Boolean).join(` `),...a,children:[n?(0,e.jsx)(`span`,{className:`ribbon-button__icon`,"aria-hidden":`true`,children:n}):null,(0,e.jsx)(`span`,{className:`ribbon-button__label`,children:t})]})}function i({parents:n,activeParentId:i,defaultParentId:a,visibleItems:o=3,onParentChange:s,onItemClick:c}){let l=Math.max(1,Math.floor(o)),u=n.filter(e=>!e.disabled),d=n.find(e=>!e.disabled),f=n.some(e=>e.id===a&&!e.disabled)?a:d?.id,[p,m]=(0,t.useState)(f),[h,g]=(0,t.useState)({parentId:f,index:0}),_=i??p,v=n.find(e=>e.id===_&&!e.disabled)??d,y=u.findIndex(e=>e.id===v?.id),b=u.length>1,x=v?.children??[],S=Math.max(1,Math.ceil(x.length/l)),C=h.parentId===v?.id?Math.min(h.index,S-1):0,w=x.slice(C*l,(C+1)*l);function T(e){i===void 0&&m(e.id),g({parentId:e.id,index:0}),s?.(e.id)}function E(e){if(!b||y<0)return;let t=Math.min(u.length-1,Math.max(0,y+e)),n=u[t];n&&n.id!==v?.id&&T(n)}return n.length===0?(0,e.jsx)(`p`,{className:`ribbon-carousel__empty`,children:`No carousel parents available.`}):(0,e.jsxs)(`div`,{className:`ribbon-carousel`,children:[(0,e.jsxs)(`div`,{className:`ribbon-carousel__parent-nav`,children:[(0,e.jsx)(`button`,{type:`button`,className:`ribbon-carousel__parent-arrow`,disabled:!b||y<=0,"aria-label":`Previous parent group`,onClick:()=>E(-1),children:`‹`}),(0,e.jsx)(`div`,{className:`ribbon-carousel__parents`,role:`tablist`,"aria-label":`Carousel parents`,children:n.map(t=>(0,e.jsxs)(`button`,{type:`button`,role:`tab`,className:[`ribbon-carousel__parent`,t.id===v?.id?`is-active`:``].filter(Boolean).join(` `),disabled:t.disabled,"aria-selected":t.id===v?.id,onClick:()=>T(t),children:[t.icon?(0,e.jsx)(`span`,{"aria-hidden":`true`,children:t.icon}):null,(0,e.jsx)(`span`,{children:t.label})]},t.id))}),(0,e.jsx)(`button`,{type:`button`,className:`ribbon-carousel__parent-arrow`,disabled:!b||y<0||y>=u.length-1,"aria-label":`Next parent group`,onClick:()=>E(1),children:`›`})]}),(0,e.jsxs)(`div`,{className:`ribbon-carousel__items-row`,children:[(0,e.jsx)(`button`,{type:`button`,className:`ribbon-carousel__arrow`,disabled:C===0,"aria-label":`Previous carousel items`,onClick:()=>g({parentId:v?.id,index:Math.max(0,C-1)}),children:`‹`}),(0,e.jsxs)(`div`,{className:`ribbon-carousel__items`,role:`tabpanel`,"aria-live":`polite`,children:[w.map(t=>(0,e.jsx)(r,{className:`ribbon-carousel__item`,label:t.label,icon:t.icon,size:t.size??`compact`,disabled:t.disabled,onClick:()=>{t.onClick?.(t.id),v&&c?.(t,v.id)}},`${v?.id??`parent`}-${t.id}`)),w.length===0?(0,e.jsx)(`span`,{className:`ribbon-carousel__empty`,children:`No items for this parent.`}):null]}),(0,e.jsx)(`button`,{type:`button`,className:`ribbon-carousel__arrow`,disabled:C>=S-1,"aria-label":`Next carousel items`,onClick:()=>g({parentId:v?.id,index:Math.min(S-1,C+1)}),children:`›`})]}),(0,e.jsxs)(`div`,{className:`ribbon-carousel__status`,"aria-hidden":`true`,children:[C+1,` / `,S]})]})}function a({label:r,icon:i,size:a=`regular`,disabled:o,options:s,onSelect:c}){let[l,u]=(0,t.useState)(!1),d=(0,t.useRef)(null),f=(0,t.useRef)(null),p=(0,t.useRef)(null),[m,h]=(0,t.useState)({top:0,left:0,width:170}),g=(0,t.useId)();function _(){if(!f.current)return;let e=f.current.getBoundingClientRect(),t=Math.max(e.width,170),n=Math.max(44,s.length*38+12),r=window.innerHeight-e.bottom<n&&e.top>n?e.top-n-4:e.bottom+4;h({top:Math.max(8,r),left:Math.max(8,Math.min(e.left,window.innerWidth-t-8)),width:t})}return(0,t.useEffect)(()=>{function e(e){if(!d.current)return;let t=e.target,n=d.current.contains(t),r=p.current?.contains(t);!n&&!r&&u(!1)}function t(e){e.key===`Escape`&&u(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[]),(0,t.useEffect)(()=>{if(!l)return;_();function e(){_()}return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[l,s.length]),(0,e.jsxs)(`div`,{ref:d,className:[`ribbon-dropdown`,`ribbon-dropdown--${a}`,l?`is-open`:``].filter(Boolean).join(` `),children:[(0,e.jsxs)(`button`,{ref:f,type:`button`,className:[`ribbon-button`,`ribbon-button--${a}`,`ribbon-dropdown__trigger`].filter(Boolean).join(` `),disabled:o,"aria-haspopup":`menu`,"aria-expanded":l,"aria-controls":g,onClick:()=>u(e=>!e),children:[(0,e.jsxs)(`span`,{className:`ribbon-dropdown__head`,children:[i?(0,e.jsx)(`span`,{className:`ribbon-button__icon`,"aria-hidden":`true`,children:i}):null,(0,e.jsx)(`span`,{className:`ribbon-button__label`,children:r})]}),(0,e.jsx)(`span`,{className:`ribbon-dropdown__caret`,"aria-hidden":`true`,children:`▾`})]}),l?(0,n.createPortal)((0,e.jsx)(`ul`,{id:g,ref:p,role:`menu`,className:`ribbon-dropdown__menu ribbon-dropdown__menu--portal`,"aria-label":`${r} options`,style:{top:`${m.top}px`,left:`${m.left}px`,width:`${m.width}px`},children:s.map(t=>(0,e.jsx)(`li`,{role:`none`,className:`ribbon-dropdown__menu-item`,children:(0,e.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`ribbon-dropdown__option-button`,onClick:()=>{c(t.id),u(!1)},children:[(0,e.jsx)(`span`,{className:`ribbon-dropdown__option-icon`,"aria-hidden":`true`,children:t.icon??`•`}),(0,e.jsx)(`span`,{className:`ribbon-dropdown__option-label`,children:t.label})]})},t.id))}),document.body):null]})}function o({tabs:t,groups:n,activeTabId:o,onTabChange:s,onItemClick:c,className:l,ariaLabel:u=`Application ribbon`}){return(0,e.jsxs)(`section`,{className:[`ribbon`,l].filter(Boolean).join(` `),"aria-label":u,children:[(0,e.jsx)(`nav`,{className:`ribbon__tabbar`,"aria-label":`Ribbon tabs`,children:t.map(t=>(0,e.jsx)(`button`,{type:`button`,className:t.id===o?`ribbon__tab is-active`:`ribbon__tab`,onClick:()=>s(t.id),"aria-selected":t.id===o,role:`tab`,children:t.label},t.id))}),(0,e.jsx)(`div`,{className:`ribbon__surface`,role:`tabpanel`,"aria-label":`${o} commands`,children:n.map(t=>(0,e.jsxs)(`section`,{className:`ribbon__group`,"aria-label":t.title,children:[(0,e.jsx)(`div`,{className:`ribbon__group-items`,children:(t.items??[]).map(t=>t.options&&t.options.length>0?(0,e.jsx)(a,{label:t.label,icon:t.icon,size:t.size,disabled:t.disabled,options:t.options,onSelect:e=>{t.onClick?.(t.id),c?.(t,e)}},t.id):(0,e.jsx)(r,{label:t.label,icon:t.icon,size:t.size,disabled:t.disabled,onClick:()=>{t.onClick?.(t.id),c?.(t)}},t.id))}),t.carousel?(0,e.jsx)(i,{...t.carousel,onItemClick:(e,t)=>c?.(e,void 0,t)}):null,(0,e.jsx)(`h3`,{className:`ribbon__group-title`,children:t.title})]},t.id))})]})}function s({size:t=`regular`,className:n,upperLabel:r,upperIcon:i,upperButtonProps:a,lowerLabel:o,lowerIcon:s,lowerButtonProps:c}){return(0,e.jsxs)(`div`,{className:[`ribbon-split-button`,`ribbon-split-button--${t}`,n].filter(Boolean).join(` `),role:`group`,"aria-label":`${r} and ${o}`,children:[(0,e.jsxs)(`button`,{type:`button`,className:`ribbon-split-button__half ribbon-split-button__half--upper`,...a,children:[i?(0,e.jsx)(`span`,{className:`ribbon-split-button__icon`,"aria-hidden":`true`,children:i}):null,(0,e.jsx)(`span`,{className:`ribbon-split-button__label`,children:r})]}),(0,e.jsxs)(`button`,{type:`button`,className:`ribbon-split-button__half ribbon-split-button__half--lower`,...c,children:[s?(0,e.jsx)(`span`,{className:`ribbon-split-button__icon`,"aria-hidden":`true`,children:s}):null,(0,e.jsx)(`span`,{className:`ribbon-split-button__label`,children:o})]})]})}var c=class{baseUrl;apiKey;constructor(e,t){this.baseUrl=e,this.apiKey=t}async listConnectors(){return this.request(`/api/connectors`)}async getConnector(e){return this.request(`/api/connectors/${encodeURIComponent(e)}`)}async createConnector(e){return this.request(`/api/connectors`,{method:`POST`,body:JSON.stringify(e)})}async updateConnector(e,t){return this.request(`/api/connectors/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(t)})}async deleteConnector(e){await this.request(`/api/connectors/${encodeURIComponent(e)}`,{method:`DELETE`})}async enableConnector(e){await this.request(`/api/connectors/${encodeURIComponent(e)}/enable`,{method:`POST`})}async disableConnector(e){await this.request(`/api/connectors/${encodeURIComponent(e)}/disable`,{method:`POST`})}async runConnector(e){await this.request(`/api/connectors/${encodeURIComponent(e)}/run`,{method:`POST`})}async getRuns(e,t=20){return this.request(`/api/connectors/${encodeURIComponent(e)}/runs?take=${Math.min(100,Math.max(1,t))}`)}async request(e,t){let n=new Headers(t?.headers);n.set(`Accept`,`application/json`),t?.body&&n.set(`Content-Type`,`application/json`),this.apiKey&&n.set(`X-Api-Key`,this.apiKey);let r=await fetch(new URL(e,this.baseUrl),{...t,headers:n});if(!r.ok){let e=`${r.status} ${r.statusText}`;try{let t=await r.json();t.errors&&t.errors.length>0&&(e=t.errors.join(`; `))}catch{}throw Error(e)}if(r.status!==204)return await r.json()}},l=(0,t.createContext)(null);function u({baseUrl:n=`http://localhost:5088`,apiKey:r,client:i,children:a}){let o=(0,t.useMemo)(()=>({client:i??new c(n,r)}),[r,n,i]);return(0,e.jsx)(l.Provider,{value:o,children:a})}function d(){let e=(0,t.useContext)(l);if(!e)throw Error(`useEasyConnectors must be used within EasyConnectorsProvider.`);return e}function f(t){return(0,e.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...t})}function p(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(`path`,{d:`M3.5 8.2h6.1l1.5 1.8h9.4`}),(0,e.jsx)(`path`,{d:`M3.5 8.2v8.8a1.5 1.5 0 0 0 1.5 1.5h14a1.5 1.5 0 0 0 1.5-1.5V10a1.8 1.8 0 0 0-1.8-1.8H3.5Z`})]})}function m(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(`rect`,{x:`4`,y:`5`,width:`16`,height:`14`,rx:`1.5`}),(0,e.jsx)(`path`,{d:`M4 10h16M9.5 5v14M14.5 5v14`})]})}function h(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(`path`,{d:`M9 12h6`}),(0,e.jsx)(`path`,{d:`m13 9 3 3-3 3`})]})}function g(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(`rect`,{x:`8`,y:`11`,width:`8`,height:`7`,rx:`1.2`}),(0,e.jsx)(`path`,{d:`M10 11V9a2 2 0 1 1 4 0v2`})]})}function _({kind:t,className:n,...r}){return(0,e.jsxs)(f,{className:[`ec-kind-icon`,n].filter(Boolean).join(` `),...r,children:[t===`FolderToFolder`?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p,{}),(0,e.jsx)(h,{})]}):null,t===`FolderToTable`?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p,{}),(0,e.jsx)(h,{}),(0,e.jsx)(`path`,{d:`M17 6.5h3`}),(0,e.jsx)(`path`,{d:`M18.5 5v3`})]}):null,t===`TableToFolder`?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(m,{}),(0,e.jsx)(`path`,{d:`M7 12h10`}),(0,e.jsx)(`path`,{d:`m11 9-3 3 3 3`}),(0,e.jsx)(p,{})]}):null,t===`FolderToSftp`?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p,{}),(0,e.jsx)(h,{}),(0,e.jsx)(g,{})]}):null,t===`SftpToFolder`?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(g,{}),(0,e.jsx)(`path`,{d:`M8 12h6`}),(0,e.jsx)(`path`,{d:`m11 9-3 3 3 3`}),(0,e.jsx)(p,{})]}):null]})}function v(t){return(0,e.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...t})}function y(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(`path`,{d:`M3.5 8.2h6.1l1.5 1.8h9.4`}),(0,e.jsx)(`path`,{d:`M3.5 8.2v8.8a1.5 1.5 0 0 0 1.5 1.5h14a1.5 1.5 0 0 0 1.5-1.5V10a1.8 1.8 0 0 0-1.8-1.8H3.5Z`})]})}function b(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(`rect`,{x:`4`,y:`5`,width:`16`,height:`14`,rx:`1.5`}),(0,e.jsx)(`path`,{d:`M4 10h16M9.5 5v14M14.5 5v14`})]})}function x(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(`rect`,{x:`8`,y:`11`,width:`8`,height:`7`,rx:`1.2`}),(0,e.jsx)(`path`,{d:`M10 11V9a2 2 0 1 1 4 0v2`}),(0,e.jsx)(`path`,{d:`M3 17h3`}),(0,e.jsx)(`path`,{d:`M18 17h3`})]})}function S({endpoint:t,className:n,...r}){return(0,e.jsxs)(v,{className:[`ec-endpoint-icon`,n].filter(Boolean).join(` `),...r,children:[t===`Folder`?(0,e.jsx)(y,{}):null,t===`Table`?(0,e.jsx)(b,{}):null,t===`Sftp`?(0,e.jsx)(x,{}):null]})}function C(e){switch(e){case`FolderToFolder`:return{source:`Folder`,destination:`Folder`};case`FolderToTable`:return{source:`Folder`,destination:`Table`};case`TableToFolder`:return{source:`Table`,destination:`Folder`};case`FolderToSftp`:return{source:`Folder`,destination:`Sftp`};case`SftpToFolder`:return{source:`Sftp`,destination:`Folder`};default:return{source:`Folder`,destination:`Folder`}}}function w({selectedConnectorId:n,refreshToken:r,onSelect:i,onCreate:a}){let{client:o}=d(),[s,c]=(0,t.useState)([]),[l,u]=(0,t.useState)(!1),[f,p]=(0,t.useState)(null),m=(0,t.useCallback)(async()=>{u(!0),p(null);try{c(await o.listConnectors())}catch(e){p(e instanceof Error?e.message:`Failed to load connectors.`)}finally{u(!1)}},[o]);(0,t.useEffect)(()=>{m()},[m,r]);async function h(e){p(null);try{await e(),await m()}catch(e){p(e instanceof Error?e.message:`Action failed.`)}}return(0,e.jsxs)(`section`,{className:`ec-board`,children:[(0,e.jsxs)(`header`,{className:`ec-board__header`,children:[(0,e.jsx)(`h2`,{children:`Connectors`}),(0,e.jsxs)(`div`,{className:`ec-board__header-actions`,children:[(0,e.jsx)(`button`,{type:`button`,onClick:m,children:`Refresh`}),(0,e.jsx)(`button`,{type:`button`,className:`ec-primary`,onClick:a,children:`New`})]})]}),f?(0,e.jsx)(`p`,{className:`ec-error`,children:f}):null,l?(0,e.jsx)(`p`,{className:`ec-muted`,children:`Loading...`}):null,(0,e.jsx)(`ul`,{className:`ec-board__list`,children:s.map(t=>(()=>{let r=C(t.kind);return(0,e.jsxs)(`li`,{className:[`ec-board__item`,n===t.id?`is-selected`:``].filter(Boolean).join(` `),children:[(0,e.jsxs)(`button`,{type:`button`,className:`ec-board__item-main`,onClick:()=>t.id&&i?.(t.id),children:[(0,e.jsxs)(`span`,{className:`ec-board__name-row`,children:[(0,e.jsx)(_,{kind:t.kind}),(0,e.jsx)(`span`,{className:`ec-board__name`,children:t.name})]}),(0,e.jsxs)(`span`,{className:`ec-flow`,"aria-label":`Flow ${r.source} to ${r.destination}`,children:[(0,e.jsxs)(`span`,{className:`ec-flow__node`,children:[(0,e.jsx)(S,{endpoint:r.source}),(0,e.jsx)(`span`,{children:r.source})]}),(0,e.jsx)(`span`,{className:`ec-flow__arrow`,"aria-hidden":`true`,children:`->`}),(0,e.jsxs)(`span`,{className:`ec-flow__connector`,children:[(0,e.jsx)(_,{kind:t.kind,className:`ec-kind-icon--chip`}),(0,e.jsx)(`span`,{children:`Connector`})]}),(0,e.jsx)(`span`,{className:`ec-flow__arrow`,"aria-hidden":`true`,children:`->`}),(0,e.jsxs)(`span`,{className:`ec-flow__node`,children:[(0,e.jsx)(S,{endpoint:r.destination}),(0,e.jsx)(`span`,{children:r.destination})]})]}),(0,e.jsx)(`span`,{className:`ec-status ec-status--${(t.status??`Idle`).toLowerCase()}`,children:t.status??`Idle`})]}),(0,e.jsxs)(`div`,{className:`ec-board__item-actions`,children:[(0,e.jsx)(`button`,{type:`button`,onClick:()=>t.id&&h(()=>o.runConnector(t.id)),children:`Run now`}),(0,e.jsx)(`button`,{type:`button`,onClick:()=>t.id&&h(()=>t.status===`Disabled`?o.enableConnector(t.id):o.disableConnector(t.id)),children:t.status===`Disabled`?`Enable`:`Disable`})]})]},t.id)})())}),s.length===0&&!l?(0,e.jsx)(`p`,{className:`ec-muted`,children:`No connectors yet. Create one to start transferring.`}):null]})}var T=[`FolderToFolder`,`FolderToTable`,`TableToFolder`,`FolderToSftp`,`SftpToFolder`],E=[`Copy`,`Move`],D=[`Manual`,`Interval`,`Daily`,`OnCreated`,`OnUpdated`],O=[`Sqlite`,`SqlServer`];function k(){return{name:`New connector`,kind:`FolderToFolder`,mode:`Copy`,triggers:[`Manual`],sourcePath:``,destinationPath:``,recursive:!0,overwrite:!0,skipEmptyFiles:!0,continueOnError:!0,intervalMinutes:15,provider:`SqlServer`,tableName:``}}function A({connectorId:n,onSaved:r}){let{client:i}=d(),[a,o]=(0,t.useState)(k()),[s,c]=(0,t.useState)(``),[l,u]=(0,t.useState)(!1),[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(null),[g,v]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!n){o(k()),c(``),h(null),v(null);return}let e=!1;return u(!0),h(null),i.getConnector(n).then(t=>{e||(o(t),c((t.keyColumns??[]).join(`, `)))}).catch(t=>{e||h(t instanceof Error?t.message:`Failed to load connector.`)}).finally(()=>{e||u(!1)}),()=>{e=!0}},[i,n]);let y=(0,t.useMemo)(()=>C(a.kind),[a.kind]);function b(e,t){o(n=>({...n,[e]:t}))}function x(e){o(t=>{let n=t.triggers.includes(e)?t.triggers.filter(t=>t!==e):[...t.triggers,e];return{...t,triggers:n}})}async function w(){p(!0),h(null),v(null);let e={...a,keyColumns:s.split(`,`).map(e=>e.trim()).filter(Boolean)};try{let t=n?await i.updateConnector(n,e):await i.createConnector(e);o(t),c((t.keyColumns??[]).join(`, `)),v(`Connector saved.`),r?.(t)}catch(e){h(e instanceof Error?e.message:`Save failed.`)}finally{p(!1)}}function A(t){return t===`source`?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(`label`,{children:[`Source path`,(0,e.jsx)(`input`,{value:a.sourcePath??``,onChange:e=>b(`sourcePath`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[`Pattern`,(0,e.jsx)(`input`,{value:a.pattern??``,onChange:e=>b(`pattern`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[(0,e.jsx)(`span`,{children:`Recursive`}),(0,e.jsx)(`input`,{type:`checkbox`,checked:a.recursive??!1,onChange:e=>b(`recursive`,e.target.checked)})]})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(`label`,{children:[`Destination path`,(0,e.jsx)(`input`,{value:a.destinationPath??``,onChange:e=>b(`destinationPath`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[(0,e.jsx)(`span`,{children:`Overwrite`}),(0,e.jsx)(`input`,{type:`checkbox`,checked:a.overwrite??!1,onChange:e=>b(`overwrite`,e.target.checked)})]})]})}function j(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(`label`,{children:[`Provider`,(0,e.jsx)(`select`,{value:a.provider??`SqlServer`,onChange:e=>b(`provider`,e.target.value),children:O.map(t=>(0,e.jsx)(`option`,{value:t,children:t},t))})]}),(0,e.jsxs)(`label`,{children:[`Table name`,(0,e.jsx)(`input`,{value:a.tableName??``,onChange:e=>b(`tableName`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[`Schema`,(0,e.jsx)(`input`,{value:a.schema??``,onChange:e=>b(`schema`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[`Key columns (comma separated)`,(0,e.jsx)(`input`,{value:s,onChange:e=>c(e.target.value)})]}),(0,e.jsxs)(`label`,{className:`ec-grid__wide`,children:[`Connection string`,(0,e.jsx)(`input`,{value:a.connectionString??``,onChange:e=>b(`connectionString`,e.target.value)})]}),(0,e.jsxs)(`label`,{className:`ec-grid__wide`,children:[`Where clause`,(0,e.jsx)(`input`,{value:a.whereClause??``,onChange:e=>b(`whereClause`,e.target.value)})]})]})}function M(t){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(`label`,{children:[`SFTP host`,(0,e.jsx)(`input`,{value:a.sftpHost??``,onChange:e=>b(`sftpHost`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[`Port`,(0,e.jsx)(`input`,{type:`number`,min:1,value:a.sftpPort??22,onChange:e=>b(`sftpPort`,Number(e.target.value)||22)})]}),(0,e.jsxs)(`label`,{children:[`Remote path`,(0,e.jsx)(`input`,{value:a.remotePath??``,onChange:e=>b(`remotePath`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[`Username`,(0,e.jsx)(`input`,{value:a.sftpUsername??``,onChange:e=>b(`sftpUsername`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[`Password`,(0,e.jsx)(`input`,{type:`password`,value:a.sftpPassword??``,onChange:e=>b(`sftpPassword`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[`Private key path`,(0,e.jsx)(`input`,{value:a.privateKeyPath??``,onChange:e=>b(`privateKeyPath`,e.target.value)})]}),(0,e.jsxs)(`label`,{className:`ec-grid__wide`,children:[`Host key SHA256`,(0,e.jsx)(`input`,{value:a.hostKeySha256??``,onChange:e=>b(`hostKeySha256`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[(0,e.jsx)(`span`,{children:`Accept any host key`}),(0,e.jsx)(`input`,{type:`checkbox`,checked:a.acceptAnyHostKey??!1,onChange:e=>b(`acceptAnyHostKey`,e.target.checked)})]}),t===`destination`?(0,e.jsxs)(`label`,{children:[(0,e.jsx)(`span`,{children:`Overwrite`}),(0,e.jsx)(`input`,{type:`checkbox`,checked:a.overwrite??!1,onChange:e=>b(`overwrite`,e.target.checked)})]}):null]})}function N(e,t){return e===`Folder`?A(t):e===`Table`?j():M(t)}function P(e){return e===`Sftp`?`SFTP`:e}return(0,e.jsxs)(`section`,{className:`ec-form`,children:[(0,e.jsx)(`header`,{className:`ec-form__header`,children:(0,e.jsx)(`h3`,{children:n?`Edit connector`:`Create connector`})}),l?(0,e.jsx)(`p`,{className:`ec-muted`,children:`Loading connector...`}):null,m?(0,e.jsx)(`p`,{className:`ec-error`,children:m}):null,g?(0,e.jsx)(`p`,{className:`ec-success`,children:g}):null,(0,e.jsxs)(`div`,{className:`ec-grid ec-grid--meta`,children:[(0,e.jsxs)(`label`,{children:[`Name`,(0,e.jsx)(`input`,{value:a.name,onChange:e=>b(`name`,e.target.value)})]}),(0,e.jsxs)(`label`,{children:[`Kind`,(0,e.jsx)(`select`,{value:a.kind,onChange:e=>b(`kind`,e.target.value),children:T.map(t=>(0,e.jsx)(`option`,{value:t,children:t},t))}),(0,e.jsxs)(`span`,{className:`ec-kind-preview`,children:[(0,e.jsx)(_,{kind:a.kind}),a.kind]}),(0,e.jsxs)(`span`,{className:`ec-flow ec-flow--compact`,"aria-label":`Flow ${y.source} to ${y.destination}`,children:[(0,e.jsxs)(`span`,{className:`ec-flow__node`,children:[(0,e.jsx)(S,{endpoint:y.source}),(0,e.jsx)(`span`,{children:y.source})]}),(0,e.jsx)(`span`,{className:`ec-flow__arrow`,"aria-hidden":`true`,children:`->`}),(0,e.jsxs)(`span`,{className:`ec-flow__connector`,children:[(0,e.jsx)(_,{kind:a.kind,className:`ec-kind-icon--chip`}),(0,e.jsx)(`span`,{children:`Connector`})]}),(0,e.jsx)(`span`,{className:`ec-flow__arrow`,"aria-hidden":`true`,children:`->`}),(0,e.jsxs)(`span`,{className:`ec-flow__node`,children:[(0,e.jsx)(S,{endpoint:y.destination}),(0,e.jsx)(`span`,{children:y.destination})]})]})]}),(0,e.jsxs)(`label`,{children:[`Mode`,(0,e.jsx)(`select`,{value:a.mode,onChange:e=>b(`mode`,e.target.value),children:E.map(t=>(0,e.jsx)(`option`,{value:t,children:t},t))})]})]}),(0,e.jsxs)(`div`,{className:`ec-endpoint-grid`,children:[(0,e.jsxs)(`section`,{className:`ec-endpoint-panel`,children:[(0,e.jsxs)(`header`,{className:`ec-endpoint-panel__header`,children:[(0,e.jsx)(S,{endpoint:y.source}),(0,e.jsxs)(`h4`,{children:[`Source config (`,P(y.source),`)`]})]}),(0,e.jsx)(`div`,{className:`ec-grid ec-grid--endpoint`,children:N(y.source,`source`)})]}),(0,e.jsxs)(`section`,{className:`ec-endpoint-panel`,children:[(0,e.jsxs)(`header`,{className:`ec-endpoint-panel__header`,children:[(0,e.jsx)(S,{endpoint:y.destination}),(0,e.jsxs)(`h4`,{children:[`Destination config (`,P(y.destination),`)`]})]}),(0,e.jsx)(`div`,{className:`ec-grid ec-grid--endpoint`,children:N(y.destination,`destination`)})]})]}),(0,e.jsxs)(`fieldset`,{className:`ec-form__fieldset`,children:[(0,e.jsx)(`legend`,{children:`Triggers`}),(0,e.jsx)(`div`,{className:`ec-check-row`,children:D.map(t=>(0,e.jsxs)(`label`,{children:[(0,e.jsx)(`input`,{type:`checkbox`,checked:a.triggers.includes(t),onChange:()=>x(t)}),t]},t))})]}),(0,e.jsxs)(`fieldset`,{className:`ec-form__fieldset`,children:[(0,e.jsx)(`legend`,{children:`Options`}),(0,e.jsxs)(`div`,{className:`ec-check-row`,children:[(0,e.jsxs)(`label`,{children:[(0,e.jsx)(`input`,{type:`checkbox`,checked:a.skipEmptyFiles??!1,onChange:e=>b(`skipEmptyFiles`,e.target.checked)}),`Skip empty files`]}),(0,e.jsxs)(`label`,{children:[(0,e.jsx)(`input`,{type:`checkbox`,checked:a.continueOnError??!1,onChange:e=>b(`continueOnError`,e.target.checked)}),`Continue on error`]}),(0,e.jsxs)(`label`,{children:[(0,e.jsx)(`input`,{type:`number`,min:1,value:a.intervalMinutes??15,onChange:e=>b(`intervalMinutes`,Number(e.target.value)||1)}),`Interval minutes`]}),(0,e.jsxs)(`label`,{children:[(0,e.jsx)(`input`,{type:`time`,value:a.dailyTimeLocal??``,onChange:e=>b(`dailyTimeLocal`,e.target.value)}),`Daily time (local)`]})]})]}),(0,e.jsx)(`footer`,{className:`ec-form__footer`,children:(0,e.jsx)(`button`,{type:`button`,className:`ec-primary`,onClick:w,disabled:f,children:f?`Saving...`:`Save connector`})})]})}function j({connectorId:n,take:r=20}){let{client:i}=d(),[a,o]=(0,t.useState)([]),[s,c]=(0,t.useState)(null),[l,u]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{if(!n){o([]);return}let e=!1;return u(!0),c(null),i.getRuns(n,r).then(t=>{e||o(t)}).catch(t=>{e||c(t instanceof Error?t.message:`Failed to load runs.`)}).finally(()=>{e||u(!1)}),()=>{e=!0}},[i,n,r]),(0,e.jsxs)(`section`,{className:`ec-runs`,children:[(0,e.jsx)(`header`,{className:`ec-runs__header`,children:(0,e.jsx)(`h3`,{children:`Recent runs`})}),n?null:(0,e.jsx)(`p`,{className:`ec-muted`,children:`Select a connector to view run history.`}),l?(0,e.jsx)(`p`,{className:`ec-muted`,children:`Loading runs...`}):null,s?(0,e.jsx)(`p`,{className:`ec-error`,children:s}):null,n&&a.length>0?(0,e.jsx)(`div`,{className:`ec-table-wrap`,children:(0,e.jsxs)(`table`,{className:`ec-table`,children:[(0,e.jsx)(`thead`,{children:(0,e.jsxs)(`tr`,{children:[(0,e.jsx)(`th`,{children:`Status`}),(0,e.jsx)(`th`,{children:`Started`}),(0,e.jsx)(`th`,{children:`Transferred`}),(0,e.jsx)(`th`,{children:`Skipped`}),(0,e.jsx)(`th`,{children:`Failed`})]})}),(0,e.jsx)(`tbody`,{children:a.map(t=>(0,e.jsxs)(`tr`,{children:[(0,e.jsx)(`td`,{children:t.status}),(0,e.jsx)(`td`,{children:new Date(t.startedUtc).toLocaleString()}),(0,e.jsx)(`td`,{children:t.transferred}),(0,e.jsx)(`td`,{children:t.skipped}),(0,e.jsx)(`td`,{children:t.failed})]},t.id))})]})}):null]})}function M({className:n}){let[r,i]=(0,t.useState)(void 0),[a,o]=(0,t.useState)(0);return(0,e.jsxs)(`section`,{className:[`ec-app`,n].filter(Boolean).join(` `),children:[(0,e.jsx)(`div`,{className:`ec-app__left`,children:(0,e.jsx)(w,{selectedConnectorId:r,onSelect:i,onCreate:()=>i(void 0),refreshToken:a})}),(0,e.jsxs)(`div`,{className:`ec-app__right`,children:[(0,e.jsx)(A,{connectorId:r,onSaved:e=>{i(e.id),o(e=>e+1)}}),(0,e.jsx)(j,{connectorId:r})]})]})}exports.ConnectorBoard=w,exports.ConnectorForm=A,exports.ConnectorKindIcon=_,exports.ConnectorRuns=j,exports.EasyConnectorsApp=M,exports.EasyConnectorsClient=c,exports.EasyConnectorsProvider=u,exports.EndpointKindIcon=S,exports.Ribbon=o,exports.RibbonButton=r,exports.RibbonCarousel=i,exports.RibbonDropdown=a,exports.RibbonSplitButton=s,exports.getConnectorFlow=C,exports.useEasyConnectors=d;
|