@cartanova/qgrid-cli 2.6.4 → 2.6.6
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/README.ko.md +2 -0
- package/README.md +2 -0
- package/bundle/dist/application/qgrid/expired-token-reminder.js +61 -0
- package/bundle/dist/application/qgrid/qgrid.frame.js +1 -1
- package/bundle/dist/application/qgrid/slack-user-map.js +49 -0
- package/bundle/dist/application/qgrid/token-death.js +21 -5
- package/bundle/dist/application/token/token.model.js +21 -1
- package/bundle/dist/sonamu.config.js +4 -1
- package/bundle/dist/utils/slack-notify.js +2 -2
- package/bundle/src/application/qgrid/expired-token-reminder.test.ts +53 -0
- package/bundle/src/application/qgrid/expired-token-reminder.ts +74 -0
- package/bundle/src/application/qgrid/slack-user-map.ts +51 -0
- package/bundle/src/application/qgrid/token-death.ts +12 -3
- package/bundle/src/application/token/token.model.ts +19 -0
- package/bundle/src/sonamu.config.ts +7 -0
- package/bundle/src/utils/slack-notify.test.ts +6 -4
- package/bundle/src/utils/slack-notify.ts +10 -3
- package/bundle/web-dist/client/assets/index-B4GlN1IX.css +1 -0
- package/bundle/web-dist/client/assets/{index-CnNT0mdq.js → index-qs8K8bOv.js} +3 -3
- package/bundle/web-dist/client/assets/{logs-DCY81UWb.js → logs-CvmI4KuC.js} +1 -1
- package/bundle/web-dist/client/assets/{monit-D5OoAday.js → monit-CUueNzoL.js} +1 -1
- package/bundle/web-dist/client/assets/routes-CAfjRsMY.js +5 -0
- package/bundle/web-dist/client/assets/{show-BSX8ii7Z.js → show-C5vKpp5z.js} +1 -1
- package/bundle/web-dist/client/assets/tokens-C9KKP2Yq.js +1 -0
- package/bundle/web-dist/client/assets/use-oauth-login-flow-B3o4CXDW.js +1 -0
- package/bundle/web-dist/client/index.html +2 -2
- package/bundle/web-dist/server/assets/{routes-Sv_4FjtH.js → routes-BfoQmYud.js} +52 -3
- package/bundle/web-dist/server/assets/{tokens-h-2A3wfD.js → tokens-Dkd_uXEk.js} +1 -151
- package/bundle/web-dist/server/assets/use-oauth-login-flow-YM1nsd-H.js +161 -0
- package/bundle/web-dist/server/entry-server.generated.js +3 -3
- package/package.json +1 -1
- package/skills/qgrid/references/token-auth-quota-lifecycle.md +2 -0
- package/bundle/web-dist/client/assets/index-BGQSGMcK.css +0 -1
- package/bundle/web-dist/client/assets/routes-B4D9C86u.js +0 -5
- package/bundle/web-dist/client/assets/tokens-Gapk41cz.js +0 -1
- package/bundle/web-dist/client/assets/use-update-token-mutation-DqEpK7It.js +0 -1
- package/bundle/web-dist/server/assets/use-update-token-mutation-DHCaa7Ku.js +0 -7
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,n as r,r as i}from"./vendor-react-DH4kUfK2.js";import{i as a}from"./index-CnNT0mdq.js";import{r as o}from"./cost-CpjVoAqp.js";import{a as s,n as c}from"./services.generated-BsAvotjG.js";import{t as l}from"./use-update-token-mutation-DqEpK7It.js";var u=e(r()),d=e(n());function f(){var e=[...arguments];return(0,d.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var p=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function m(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function h(e){return`nodeType`in e}function g(e){return e?m(e)?e:h(e)?e.ownerDocument?.defaultView??window:window:window}function _(e){let{Document:t}=g(e);return e instanceof t}function v(e){return m(e)?!1:e instanceof g(e).HTMLElement}function y(e){return e instanceof g(e).SVGElement}function b(e){return e?m(e)?e.document:h(e)?_(e)?e:v(e)||y(e)?e.ownerDocument:document:document:document}var x=p?d.useLayoutEffect:d.useEffect;function S(e){let t=(0,d.useRef)(e);return x(()=>{t.current=e}),(0,d.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function C(){let e=(0,d.useRef)(null);return[(0,d.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,d.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function w(e,t){let n=(0,d.useRef)();return(0,d.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function T(e){let t=S(e),n=(0,d.useRef)(null);return[n,(0,d.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}var E={};function D(e,t){return(0,d.useMemo)(()=>{if(t)return t;let n=E[e]==null?0:E[e]+1;return E[e]=n,e+`-`+n},[e,t])}function ee(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var O=ee(1),k=ee(-1);function A(e){return`clientX`in e&&`clientY`in e}function te(e){if(!e)return!1;let{KeyboardEvent:t}=g(e.target);return t&&e instanceof t}function j(e){if(!e)return!1;let{TouchEvent:t}=g(e.target);return t&&e instanceof t}function M(e){if(j(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return A(e)?{x:e.clientX,y:e.clientY}:null}var N=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[N.Translate.toString(e),N.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ne={display:`none`};function P(e){let{id:t,value:n}=e;return d.createElement(`div`,{id:t,style:ne},n)}function re(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return d.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function F(){let[e,t]=(0,d.useState)(``);return{announce:(0,d.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ie={draggable:`
|
|
2
|
-
To pick up a draggable item, press the space bar.
|
|
3
|
-
While dragging, use the arrow keys to move the item.
|
|
4
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
-
`},I={onDragStart(e){return`Picked up draggable item ${e}.`},onDragOver(e,t){return t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`},onDragEnd(e,t){return t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`},onDragCancel(e){return`Dragging was cancelled. Draggable item ${e} was dropped.`}},L;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(L||={});function R(...e){}var z=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:e})=>!e)}getNodeFor(e){return this.get(e)?.node.current??void 0}},B=(0,d.createContext)({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:``},containerNodeRect:null,dispatch:R,draggableNodes:{},droppableRects:new Map,droppableContainers:new z,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:R},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:R,windowRect:null,willRecomputeLayouts:!1});function ae(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new z}}}function oe(e,t){switch(t.type){case L.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case L.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case L.DragEnd:case L.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case L.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new z(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case L.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new z(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case L.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new z(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}var se=(0,d.createContext)({type:null,event:null});function ce({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:r,onDragCancel:i}){let a=(0,d.useContext)(se),o=(0,d.useRef)(a);(0,d.useEffect)(()=>{if(a!==o.current){let{type:s,event:c}=a;switch(s){case L.DragStart:e?.(c);break;case L.DragMove:t?.(c);break;case L.DragOver:n?.(c);break;case L.DragCancel:i?.(c);break;case L.DragEnd:r?.(c);break}o.current=a}},[a,e,t,n,r,i])}function le({announcements:e=I,hiddenTextDescribedById:t,screenReaderInstructions:n}){let{announce:r,announcement:i}=F(),a=D(`DndLiveRegion`),[o,s]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{s(!0)},[]),ce((0,d.useMemo)(()=>({onDragStart({active:t}){r(e.onDragStart(t.id))},onDragMove({active:t,over:n}){e.onDragMove&&r(e.onDragMove(t.id,n?.id))},onDragOver({active:t,over:n}){r(e.onDragOver(t.id,n?.id))},onDragEnd({active:t,over:n}){r(e.onDragEnd(t.id,n?.id))},onDragCancel({active:t}){r(e.onDragCancel(t.id))}}),[r,e])),o?(0,u.createPortal)(d.createElement(d.Fragment,null,d.createElement(P,{id:t,value:n.draggable}),d.createElement(re,{id:a,announcement:i})),document.body):null}var V=Object.freeze({x:0,y:0});function ue(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function de(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}var H=({collisionRect:e,droppableContainers:t})=>{let n=de(e,e.left,e.top),r=1/0,i=null;for(let e of t){let{rect:{current:t}}=e;if(t){let a=ue(de(t),n);a<r&&(r=a,i=e.id)}}return i};function fe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function pe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:V}function me(e){return function(t,...n){return n.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x,offsetLeft:t.offsetLeft+e*n.x,offsetTop:t.offsetTop+e*n.y}),{...t})}}var he=me(1);function ge(e,t=window.getComputedStyle(e)){return t.position===`fixed`}function _e(e,t=window.getComputedStyle(e)){let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].find(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})!=null}function U(e){let t=[];function n(e){if(!e)return t;if(_(e)&&e.scrollingElement!=null&&!t.includes(e.scrollingElement))return t.push(e.scrollingElement),t;if(!v(e)||y(e)||t.includes(e))return t;let r=window.getComputedStyle(e);return _e(e,r)&&t.push(e),ge(e,r)?t:n(e.parentNode)}return e?n(e.parentNode):t}function W(e){return!p||!e?null:m(e)?e:h(e)?_(e)||e===b(e).scrollingElement?window:v(e)?e:null:null}function G(e){return m(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var K;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(K||={});function ve(e){let t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}function ye(e){return!p||!e?!1:e===document.scrollingElement}var be={x:.2,y:.2};function xe(e,t,{top:n,left:r,right:i,bottom:a},o=10,s=be){let{clientHeight:c,clientWidth:l}=e,u=ye(e)?{top:0,left:0,right:l,bottom:c,width:l,height:c}:t,{isTop:d,isBottom:f,isLeft:p,isRight:m}=ve(e),h={x:0,y:0},g={x:0,y:0},_={height:u.height*s.y,width:u.width*s.x};return!d&&n<=u.top+_.height?(h.y=K.Backward,g.y=o*Math.abs((u.top+_.height-n)/_.height)):!f&&a>=u.bottom-_.height&&(h.y=K.Forward,g.y=o*Math.abs((u.bottom-_.height-a)/_.height)),!m&&i>=u.right-_.width?(h.x=K.Forward,g.x=o*Math.abs((u.right-_.width-i)/_.width)):!p&&r<=u.left+_.width&&(h.x=K.Backward,g.x=o*Math.abs((u.left+_.width-r)/_.width)),{direction:h,speed:g}}function q(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function J(e){return e.reduce((e,t)=>O(e,G(t)),V)}function Y(e,t,n=V){if(!e||!v(e))return n;let r={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?r:Y(e.offsetParent,t,r)}function Se(e){let{offsetWidth:t,offsetHeight:n}=e,{x:r,y:i}=Y(e,null);return{width:t,height:n,offsetTop:i,offsetLeft:r}}function X(e){if(m(e)){let e=window.innerWidth,t=window.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t,offsetTop:0,offsetLeft:0}}let{offsetTop:t,offsetLeft:n}=Se(e),{width:r,height:i,top:a,bottom:o,left:s,right:c}=e.getBoundingClientRect();return{width:r,height:i,top:a,bottom:o,right:c,left:s,offsetTop:t,offsetLeft:n}}function Ce(e){let{width:t,height:n,offsetTop:r,offsetLeft:i}=Se(e),a=J(U(e)),o=r-a.y,s=i-a.x;return{width:t,height:n,top:o,bottom:o+n,right:s+t,left:s,offsetTop:r,offsetLeft:i}}function we(e,t){let n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),i=Math.min(t.left+t.width,e.offsetLeft+e.width),a=Math.min(t.top+t.height,e.offsetTop+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Te=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(let i of t){let{rect:{current:t}}=i;if(t){let a=we(t,e);a>n&&(n=a,r=i.id)}}return r},Ee;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Ee||={});var De;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(De||={});function Oe({acceleration:e,activator:t=Ee.Pointer,canScroll:n,draggingRect:r,enabled:i,interval:a=5,order:o=De.TreeOrder,pointerCoordinates:s,scrollableAncestors:c,scrollableAncestorRects:l,threshold:u}){let[f,p]=C(),m=(0,d.useRef)({x:1,y:1}),h=(0,d.useMemo)(()=>{switch(t){case Ee.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case Ee.DraggableRect:return r}return null},[t,r,s]),g=(0,d.useRef)(V),_=(0,d.useRef)(null),v=(0,d.useCallback)(()=>{let e=_.current;if(!e)return;let t=m.current.x*g.current.x,n=m.current.y*g.current.y;e.scrollBy(t,n)},[]),y=(0,d.useMemo)(()=>o===De.TreeOrder?[...c].reverse():c,[o,c]);(0,d.useEffect)(()=>{if(!i||!c.length||!h){p();return}for(let t of y){if(n?.(t)===!1)continue;let r=l[c.indexOf(t)];if(!r)continue;let{direction:i,speed:o}=xe(t,r,h,e,u);if(o.x>0||o.y>0){p(),_.current=t,f(v,a),m.current=o,g.current=i;return}}m.current={x:0,y:0},g.current={x:0,y:0},p()},[e,v,n,p,i,a,JSON.stringify(h),f,c,y,l,JSON.stringify(u)])}function ke(e,t){let n=t===null?void 0:e[t],r=n?n.node.current:null;return w(e=>t===null?null:r??e??null,[r,t])}function Ae(e,t){return(0,d.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}function je(e){let t=(0,d.useRef)(e);return x(()=>{t.current!==e&&(t.current=e)},[e]),t}var Me;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Me||={});var Ne;(function(e){e.Optimized=`optimized`})(Ne||={});var Pe=new Map,Fe={measure:Se,strategy:Me.WhileDragging,frequency:Ne.Optimized};function Ie(e,{dragging:t,dependencies:n,config:r}){let[i,a]=(0,d.useState)(!1),{frequency:o,measure:s,strategy:c}={...Fe,...r},l=(0,d.useRef)(e),u=(0,d.useCallback)(()=>a(!0),[]),f=(0,d.useRef)(null),p=h(),m=w(n=>{if(p&&!t)return Pe;if(!n||n===Pe||l.current!==e||i){for(let t of e)t&&(t.rect.current=t.node.current?s(t.node.current):null);return Le(e)}return n},[e,t,p,s,i]);return(0,d.useEffect)(()=>{l.current=e},[e]),(0,d.useEffect)(()=>{i&&a(!1)},[i]),(0,d.useEffect)(function(){p||requestAnimationFrame(u)},[t,p]),(0,d.useEffect)(function(){p||typeof o!=`number`||f.current!==null||(f.current=setTimeout(()=>{u(),f.current=null},o))},[o,p,u,...n]),{layoutRectMap:m,recomputeLayouts:u,willRecomputeLayouts:i};function h(){switch(c){case Me.Always:return!1;case Me.BeforeDragging:return t;default:return!t}}}function Le(e){let t=new Map;if(e)for(let n of e){if(!n)continue;let{id:e,rect:r}=n;r.current!=null&&t.set(e,r.current)}return t}function Re(e){let[t,n]=(0,d.useState)(null),r=(0,d.useRef)(e),i=(0,d.useCallback)(e=>{let t=W(e.target);t&&n(e=>e?(e.set(t,G(t)),new Map(e)):null)},[]);return(0,d.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=W(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,G(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{W(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,d.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>O(e,t),V):J(e):V,[e,t])}var ze=[];function Be(e){let t=(0,d.useRef)(e),n=w(n=>e?n&&e&&t.current&&e.parentNode===t.current.parentNode?n:U(e):ze,[e]);return(0,d.useEffect)(()=>{t.current=e},[e]),n}function Ve(e){(0,d.useEffect)(()=>{if(!p)return;let t=e.map(({sensor:e})=>e.setup==null?void 0:e.setup());return()=>{for(let e of t)e?.()}},e.map(({sensor:e})=>e))}function He(e,t){return(0,d.useMemo)(()=>e.reduce((e,{eventName:n,handler:r})=>(e[n]=e=>{r(e,t)},e),{}),[e,t])}var Ue=Ke(X),We=qe(X);function Ge(e,t,n){let r=(0,d.useRef)(e);return w(i=>e?n||!i&&e||e!==r.current?v(e)&&e.parentNode==null?null:t(e):i??null:null,[e,n,t])}function Ke(e){return(t,n)=>Ge(t,e,n)}function qe(e){let t=[];return function(n,r){let i=(0,d.useRef)(n);return w(a=>n.length?r||!a&&n.length||n!==i.current?n.map(t=>e(t)):a??t:t,[n,r])}}function Je(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return v(t)?t:e}function Ye(e){let{width:t,height:n,offsetLeft:r,offsetTop:i}=Se(e);return{top:i,bottom:i+n,left:r,right:r+t,width:t,height:n,offsetTop:i,offsetLeft:r}}var Xe=Ke(Ye);function Ze({disabled:e,forceRecompute:t}){let[n,r]=T(),i=Xe(e?null:Je(n.current),t);return(0,d.useMemo)(()=>({nodeRef:n,rect:i,setRef:r}),[i,n,r])}function Qe(e,t){return(0,d.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function $e(...e){return(0,d.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var et=class{constructor(e){this.target=e,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))}}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function tt(e){let{EventTarget:t}=g(e);return e instanceof t?e:b(e)}function nt(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Z;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Z||={});function rt(e){e.preventDefault()}function it(e){e.stopPropagation()}var Q;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`})(Q||={});var at={start:[Q.Space,Q.Enter],cancel:[Q.Esc],end:[Q.Space,Q.Enter]},ot=(e,{currentCoordinates:t})=>{switch(e.code){case Q.Right:return{...t,x:t.x+25};case Q.Left:return{...t,x:t.x-25};case Q.Down:return{...t,y:t.y+25};case Q.Up:return{...t,y:t.y-25}}},st=class{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=V;let{event:{target:t}}=e;this.props=e,this.listeners=new et(b(t)),this.windowListeners=new et(g(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Z.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw Error(`Active draggable node is undefined`);let n=X(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(te(e)){let{coordinates:t}=this,{active:n,context:r,options:i}=this.props,{keyboardCodes:a=at,coordinateGetter:o=ot,scrollBehavior:s=`smooth`}=i,{code:c}=e;if(a.end.includes(c)){this.handleEnd(e);return}if(a.cancel.includes(c)){this.handleCancel(e);return}let l=o(e,{active:n,context:r.current,currentCoordinates:t});if(l){let n={x:0,y:0},{scrollableAncestors:i}=r.current;for(let r of i){let i=e.code,a=k(l,t),{isTop:o,isRight:c,isLeft:u,isBottom:d,maxScroll:f,minScroll:p}=ve(r),m=q(r),h={x:Math.min(i===Q.Right?m.right-m.width/2:m.right,Math.max(i===Q.Right?m.left:m.left+m.width/2,l.x)),y:Math.min(i===Q.Down?m.bottom-m.height/2:m.bottom,Math.max(i===Q.Down?m.top:m.top+m.height/2,l.y))},g=i===Q.Right&&!c||i===Q.Left&&!u,_=i===Q.Down&&!d||i===Q.Up&&!o;if(g&&h.x!==l.x){if(i===Q.Right&&r.scrollLeft+a.x<=f.x||i===Q.Left&&r.scrollLeft+a.x>=p.x){r.scrollBy({left:a.x,behavior:s});return}n.x=i===Q.Right?r.scrollLeft-f.x:r.scrollLeft-p.x,r.scrollBy({left:-n.x,behavior:s});break}else if(_&&h.y!==l.y){if(i===Q.Down&&r.scrollTop+a.y<=f.y||i===Q.Up&&r.scrollTop+a.y>=p.y){r.scrollBy({top:a.y,behavior:s});return}n.y=i===Q.Down?r.scrollTop-f.y:r.scrollTop-p.y,r.scrollBy({top:-n.y,behavior:s});break}}this.handleMove(e,O(l,n))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t),this.coordinates=t}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};st.activators=[{eventName:`onKeyDown`,handler:(e,{keyboardCodes:t=at,onActivation:n})=>{let{code:r}=e.nativeEvent;return t.start.includes(r)?(e.preventDefault(),n?.({event:e.nativeEvent}),!0):!1}}];function ct(e){return!!(e&&`distance`in e)}function lt(e){return!!(e&&`delay`in e)}var ut=class{constructor(e,t,n=tt(e.event.target)){this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=b(i),this.documentListeners=new et(this.document),this.listeners=new et(n),this.windowListeners=new et(g(i)),this.initialCoordinates=M(r),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(){let{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.DragStart,rt),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),this.windowListeners.add(Z.ContextMenu,rt),this.documentListeners.add(Z.Keydown,this.handleKeydown),t){if(ct(t))return;if(lt(t)){this.timeoutId=setTimeout(this.handleStart,t.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Z.Click,it,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Z.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=M(e),s=k(n,o);if(!t&&a){if(lt(a))return nt(s,a.tolerance)?this.handleCancel():void 0;if(ct(a))return a.tolerance!=null&&nt(s,a.tolerance)?this.handleCancel():nt(s,a.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onEnd:e}=this.props;this.detach(),e()}handleCancel(){let{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===Q.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},dt={move:{name:`pointermove`},end:{name:`pointerup`}},ft=class extends ut{constructor(e){let{event:t}=e,n=b(t.target);super(e,dt,n)}};ft.activators=[{eventName:`onPointerDown`,handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t?.({event:e}),!0)}];var pt={move:{name:`mousemove`},end:{name:`mouseup`}},mt;(function(e){e[e.RightClick=2]=`RightClick`})(mt||={});var ht=class extends ut{constructor(e){super(e,pt,b(e.event.target))}};ht.activators=[{eventName:`onMouseDown`,handler:({nativeEvent:e},{onActivation:t})=>e.button===mt.RightClick?!1:(t?.({event:e}),!0)}];var gt={move:{name:`touchmove`},end:{name:`touchend`}},_t=class extends ut{constructor(e){super(e,gt)}static setup(){return window.addEventListener(gt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(gt.move.name,e)};function e(){}}};_t.activators=[{eventName:`onTouchStart`,handler:({nativeEvent:e},{onActivation:t})=>{let{touches:n}=e;return n.length>1?!1:(t?.({event:e}),!0)}}];function vt(e,{transform:t,...n}){return e?.length?e.reduce((e,t)=>t({transform:e,...n}),t):t}var yt=[{sensor:ft,options:{}},{sensor:st,options:{}}],bt={current:{}},xt=(0,d.createContext)({...V,scaleX:1,scaleY:1}),St=(0,d.memo)(function({id:e,autoScroll:t=!0,announcements:n,children:r,sensors:i=yt,collisionDetection:a=Te,measuring:o,modifiers:s,screenReaderInstructions:c=ie,...l}){let[f,p]=(0,d.useReducer)(oe,void 0,ae),[m,h]=(0,d.useState)(()=>({type:null,event:null})),[g,_]=(0,d.useState)(!1),{draggable:{active:v,nodes:y,translate:b},droppable:{containers:S}}=f,C=v?y[v]:null,w=(0,d.useRef)({initial:null,translated:null}),T=(0,d.useMemo)(()=>v==null?null:{id:v,data:C?.data??bt,rect:w},[v,C]),E=(0,d.useRef)(null),[ee,k]=(0,d.useState)(null),[A,te]=(0,d.useState)(null),j=(0,d.useRef)(l),N=D(`DndDescribedBy`,e),ne=(0,d.useMemo)(()=>S.getEnabled(),[S]),{layoutRectMap:P,recomputeLayouts:re,willRecomputeLayouts:F}=Ie(ne,{dragging:g,dependencies:[b.x,b.y],config:o?.droppable}),I=ke(y,v),R=A?M(A):null,z=Ge(I,o?.draggable?.measure??Ce),ce=Ue(I),ue=(0,d.useRef)(null),de=ue.current,H=(0,d.useRef)({active:null,activeNode:I,collisionRect:null,droppableRects:P,draggableNodes:y,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),me=S.getNodeFor(H.current.over?.id),ge=Ue(I?I.ownerDocument.defaultView:null),_e=Ue(I?I.parentElement:null),U=Be(v?me??I:null),W=We(U),G=Ze({disabled:v==null,forceRecompute:F}),K=G.rect??z,ve=K===z?pe(z,de):V,ye=vt(s,{transform:{x:b.x-ve.x,y:b.y-ve.y,scaleX:1,scaleY:1},activatorEvent:A,active:T,activeNodeRect:ce,containerNodeRect:_e,draggingNodeRect:K,over:H.current.over,overlayNodeRect:G.rect,scrollableAncestors:U,scrollableAncestorRects:W,windowRect:ge}),be=R?O(R,b):null,xe=Re(U),q=O(ye,xe),J=K?he(K,ye):null,Y=J?he(J,xe):null,Se=T&&Y?a({active:T,collisionRect:Y,droppableContainers:ne}):null,[X,we]=(0,d.useState)(null),Ee=fe(ye,X?.rect??null,z),De=(0,d.useCallback)((e,{sensor:t,options:n})=>{if(!E.current)return;let r=y[E.current];if(!r)return;let i=new t({active:E.current,activeNode:r,event:e.nativeEvent,options:n,context:H,onStart(e){let t=E.current;if(!t)return;let n=y[t];if(!n)return;let{onDragStart:r}=j.current,i={active:{id:t,data:n.data,rect:w}};(0,u.unstable_batchedUpdates)(()=>{p({type:L.DragStart,initialCoordinates:e,active:t}),h({type:L.DragStart,event:i})}),r?.(i)},onMove(e){p({type:L.DragMove,coordinates:e})},onEnd:a(L.DragEnd),onCancel:a(L.DragCancel)});(0,u.unstable_batchedUpdates)(()=>{k(i),te(e.nativeEvent)});function a(e){return async function(){let{active:t,over:n,scrollAdjustedTranslate:r}=H.current,i=null;if(t&&r){let{cancelDrop:a}=j.current;i={active:t,delta:r,over:n},e===L.DragEnd&&typeof a==`function`&&await Promise.resolve(a(i))&&(e=L.DragCancel)}if(E.current=null,(0,u.unstable_batchedUpdates)(()=>{p({type:e}),we(null),_(!1),k(null),te(null),i&&h({type:e,event:i})}),i){let{onDragCancel:t,onDragEnd:n}=j.current;(e===L.DragEnd?n:t)?.(i)}}}},[p,y]),je=Ae(i,(0,d.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent;E.current!==null||i.dndKit||i.defaultPrevented||e(n,t.options)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,De(n,t))},[De]));Ve(i),x(()=>{j.current=l},Object.values(l)),(0,d.useEffect)(()=>{v!=null&&_(!0)},[v]),(0,d.useEffect)(()=>{T||(ue.current=null),T&&z&&!ue.current&&(ue.current=z)},[z,T]),(0,d.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,over:n}=H.current;if(!t)return;let r={active:t,delta:{x:q.x,y:q.y},over:n};h({type:L.DragMove,event:r}),e?.(r)},[q.x,q.y]),(0,d.useEffect)(()=>{let{active:e,droppableContainers:t,scrollAdjustedTranslate:n}=H.current;if(!e||!E.current||!n)return;let{onDragOver:r}=j.current,i=t.get(Se),a=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,o={active:e,delta:{x:n.x,y:n.y},over:a};(0,u.unstable_batchedUpdates)(()=>{we(a),h({type:L.DragOver,event:o}),r?.(o)})},[Se]),x(()=>{H.current={active:T,activeNode:I,collisionRect:Y,droppableRects:P,draggableNodes:y,draggingNodeRect:K,droppableContainers:S,over:X,scrollableAncestors:U,scrollAdjustedTranslate:q,translatedRect:J},w.current={initial:K,translated:J}},[T,I,Y,y,K,P,S,X,U,q,J]),Oe({...Ne(),draggingRect:J,pointerCoordinates:be,scrollableAncestors:U,scrollableAncestorRects:W});let Me=(0,d.useMemo)(()=>({active:T,activeNode:I,activeNodeRect:z,activeNodeClientRect:ce,activatorEvent:A,activators:je,ariaDescribedById:{draggable:N},containerNodeRect:_e,dispatch:p,dragOverlay:G,draggableNodes:y,droppableContainers:S,droppableRects:P,over:X,recomputeLayouts:re,scrollableAncestors:U,scrollableAncestorRects:W,willRecomputeLayouts:F,windowRect:ge}),[T,I,ce,z,A,je,_e,G,p,y,N,S,P,X,re,U,W,F,ge]);return d.createElement(se.Provider,{value:m},d.createElement(B.Provider,{value:Me},d.createElement(xt.Provider,{value:Ee},r)),d.createElement(le,{announcements:n,hiddenTextDescribedById:N,screenReaderInstructions:c}));function Ne(){let e=ee?.autoScrollEnabled===!1,n=typeof t==`object`?t.enabled===!1:t===!1,r=!e&&!n;return typeof t==`object`?{...t,enabled:r}:{enabled:r}}}),Ct=(0,d.createContext)(null),wt=`button`,Tt=`Droppable`;function Et({id:e,data:t,disabled:n=!1,attributes:r}){let i=D(Tt),{active:a,activeNodeRect:o,activatorEvent:s,ariaDescribedById:c,draggableNodes:l,droppableRects:u,activators:f,over:p}=(0,d.useContext)(B),{role:m=wt,roleDescription:h=`draggable`,tabIndex:g=0}=r??{},_=a?.id===e,v=(0,d.useContext)(_?xt:Ct),[y,b]=T(),x=He(f,e),S=je(t);return(0,d.useEffect)(()=>(l[e]={id:e,key:i,node:y,data:S},()=>{let t=l[e];t&&t.key===i&&delete l[e]}),[l,e]),{active:a,activeNodeRect:o,activatorEvent:s,attributes:(0,d.useMemo)(()=>({role:m,tabIndex:g,"aria-pressed":_&&m===wt?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[m,g,_,h,c.draggable]),droppableRects:u,isDragging:_,listeners:n?void 0:x,node:y,over:p,setNodeRef:b,transform:v}}function Dt(){return(0,d.useContext)(B)}var Ot=`Droppable`;function kt({data:e,disabled:t=!1,id:n}){let r=D(Ot),{active:i,dispatch:a,over:o}=(0,d.useContext)(B),s=(0,d.useRef)(null),[c,l]=T(),u=je(e);return x(()=>(a({type:L.RegisterDroppable,element:{id:n,key:r,disabled:t,node:c,rect:s,data:u}}),()=>a({type:L.UnregisterDroppable,key:r,id:n})),[n]),(0,d.useEffect)(()=>{a({type:L.SetDroppableDisabled,id:n,key:r,disabled:t})},[t]),{active:i,rect:s,isOver:o?.id===n,node:c,over:o,setNodeRef:l}}function At(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function jt(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Mt(e){return e!==null&&e>=0}var Nt=({layoutRects:e,activeIndex:t,overIndex:n,index:r})=>{let i=At(e,n,t),a=e[r],o=i[r];return!o||!a?null:{x:o.offsetLeft-a.offsetLeft,y:o.offsetTop-a.offsetTop,scaleX:o.width/a.width,scaleY:o.height/a.height}},Pt=`Sortable`,Ft=d.createContext({activeIndex:-1,containerId:Pt,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Nt,wasDragging:{current:!1}});function It({children:e,id:t,items:n,strategy:r=Nt}){let{active:i,dragOverlay:a,droppableRects:o,over:s,recomputeLayouts:c,willRecomputeLayouts:l}=Dt(),u=D(Pt,t),f=a.rect!==null,p=(0,d.useMemo)(()=>n.map(e=>typeof e==`string`?e:e.id),[n]),m=i!=null,h=(0,d.useRef)(!1),g=i?p.indexOf(i.id):-1,_=g!==-1,v=s?p.indexOf(s.id):-1,y=(0,d.useRef)(p),b=jt(p,o),S=!Lt(p,y.current),C=v!==-1&&g===-1||S;x(()=>{S&&_&&!l&&c()},[S,_,c,l]),(0,d.useEffect)(()=>{y.current=p},[p]),(0,d.useEffect)(()=>{let e=setTimeout(()=>{h.current=m},100);return()=>clearTimeout(e)},[m]);let w=(0,d.useMemo)(()=>({activeIndex:g,containerId:u,disableTransforms:C,items:p,overIndex:v,useDragOverlay:f,sortedRects:b,strategy:r,wasDragging:h}),[g,u,C,p,v,b,f,r,h]);return d.createElement(Ft.Provider,{value:w},e)}function Lt(e,t){return e.join()===t.join()}var Rt=({id:e,items:t,activeIndex:n,overIndex:r})=>At(t,n,r).indexOf(e),zt=({containerId:e,isSorting:t,wasDragging:n,index:r,items:i,newIndex:a,previousItems:o,previousContainerId:s,transition:c})=>!c||!n||o!==i&&r===a?!1:t?!0:a!==r&&e===s,Bt={duration:200,easing:`ease`},Vt=`transform`,Ht=N.Transition.toString({property:Vt,duration:0,easing:`linear`}),Ut={roleDescription:`sortable`};function Wt({disabled:e,index:t,node:n,rect:r}){let[i,a]=(0,d.useState)(null),o=(0,d.useRef)(t);return x(()=>{if(!e&&t!==o.current&&n.current){let e=r.current;if(e){let t=X(n.current),r={x:e.offsetLeft-t.offsetLeft,y:e.offsetTop-t.offsetTop,scaleX:e.width/t.width,scaleY:e.height/t.height};(r.x||r.y)&&a(r)}}t!==o.current&&(o.current=t)},[e,t,n,r]),(0,d.useEffect)(()=>{i&&requestAnimationFrame(()=>{a(null)})},[i]),i}function Gt({animateLayoutChanges:e=zt,attributes:t,disabled:n,data:r,getNewIndex:i=Rt,id:a,strategy:o,transition:s=Bt}){let{items:c,containerId:l,activeIndex:u,disableTransforms:p,sortedRects:m,overIndex:h,useDragOverlay:g,strategy:_,wasDragging:v}=(0,d.useContext)(Ft),y=c.indexOf(a),b=(0,d.useMemo)(()=>({sortable:{containerId:l,index:y,items:c},...r}),[l,r,y,c]),{rect:x,node:S,setNodeRef:C}=kt({id:a,data:b}),{active:w,activeNodeRect:T,activatorEvent:E,attributes:D,setNodeRef:ee,listeners:O,isDragging:k,over:A,transform:te}=Et({id:a,data:b,attributes:{...Ut,...t},disabled:n}),j=f(C,ee),M=!!w,ne=M&&v.current&&!p&&Mt(u)&&Mt(h),P=!g&&k,re=ne?(P&&ne?te:null)??(o??_)({layoutRects:m,activeNodeRect:T,activeIndex:u,overIndex:h,index:y}):null,F=Mt(u)&&Mt(h)?i({id:a,items:c,activeIndex:u,overIndex:h}):y,ie=(0,d.useRef)(c),I=c!==ie.current,L=(0,d.useRef)(F),R=(0,d.useRef)(l),z=e({active:w,containerId:l,isDragging:k,isSorting:M,id:a,index:y,items:c,newIndex:L.current,previousItems:ie.current,previousContainerId:R.current,transition:s,wasDragging:v.current}),B=Wt({disabled:!z,index:y,node:S,rect:x});return(0,d.useEffect)(()=>{M&&L.current!==F&&(L.current=F),l!==R.current&&(R.current=l),c!==ie.current&&(ie.current=c)},[M,F,l,c]),{active:w,attributes:D,activatorEvent:E,rect:x,index:y,isSorting:M,isDragging:k,listeners:O,node:S,overIndex:h,over:A,setNodeRef:j,setDroppableNodeRef:C,setDraggableNodeRef:ee,transform:B??re,transition:ae()};function ae(){if(B||I&&L.current===y)return Ht;if(!(P||!s)&&(M||z))return N.Transition.toString({...s,property:Vt})}}Q.Down,Q.Right,Q.Up,Q.Left;var $=i(),Kt=e=>(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,$.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m12 14l4-4M3.34 19a10 10 0 1 1 17.32 0`})}),qt=e=>(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,$.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,$.jsx)(`circle`,{cx:9,cy:12,r:1}),(0,$.jsx)(`circle`,{cx:9,cy:5,r:1}),(0,$.jsx)(`circle`,{cx:9,cy:19,r:1}),(0,$.jsx)(`circle`,{cx:15,cy:12,r:1}),(0,$.jsx)(`circle`,{cx:15,cy:5,r:1}),(0,$.jsx)(`circle`,{cx:15,cy:19,r:1})]})}),Jt=new Set([`anthropic`,`openai`]);function Yt(e){let t=e.trim();if(t===``)return{ok:!0,value:null};if(!/^\d+$/.test(t))return{ok:!1,error:`정수만 입력하세요 (0–100)`};let n=Number(t);return n>100?{ok:!1,error:`100 이하여야 합니다`}:{ok:!0,value:n===0?null:n}}function Xt(e){let t=e.trim();if(!/^\d+$/.test(t))return{ok:!1,error:`1–100 사이 정수를 입력하세요`};let n=Number(t);return n<1||n>100?{ok:!1,error:`1–100 사이 정수를 입력하세요`}:{ok:!0,value:n}}var Zt={openai:{stripe:`bg-openai-400`,bar:`bg-openai-bar`,badge:`bg-openai-50 text-openai-600`,cost:`text-openai-600`},anthropic:{stripe:`bg-anthropic-400`,bar:`bg-anthropic-400`,badge:`bg-anthropic-50 text-anthropic-600`,cost:`text-anthropic-600`},google:{stripe:`bg-google-400`,bar:`bg-google-400`,badge:`bg-google-50 text-google-600`,cost:`text-google-600`}},Qt={stripe:`bg-sand-400`,bar:`bg-sienna-400`,badge:`bg-sand-200 text-sand-500`,cost:`text-sienna-600`};function $t(e){return Zt[e]??Qt}function en(e,t){return e>=95?`bg-danger-400`:e>=80?`bg-caution-400`:t.bar}function tn(e){if(!e)return``;let t=new Date(e).getTime()-Date.now();if(t<=0)return`resetting...`;let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`resets ${n}h ${r}m`:`resets ${r}m`}function nn(e,t){if(!t||t<=0)return e;let n=t/60;return n>=24?`${Math.round(n/24)}d`:`${Math.round(n)}h`}function rn({label:e,utilization:t,resetsAt:n,windowDurationMins:r,theme:i,threshold:a}){let o=t??0,s=a!=null;return(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs text-sand-600 w-7 shrink-0`,children:nn(e,r)}),(0,$.jsxs)(`div`,{className:`relative flex-1 min-w-0 h-2 bg-sand-200 rounded-full overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`h-full rounded-full transition-all duration-300 ${en(o,i)}`,style:{width:`${Math.min(o,100)}%`}}),s&&(0,$.jsx)(`div`,{className:`absolute top-[-2px] bottom-[-2px] w-0.5 bg-sienna-500 rounded-full`,style:{left:`calc(${Math.min(a,100)}% - 1px)`}})]}),(0,$.jsxs)(`span`,{className:`text-xs tabular-nums text-sand-700 w-9 text-right shrink-0`,children:[o,`%`]}),(0,$.jsx)(`span`,{className:`hidden sm:inline text-[10px] text-sand-400 w-24 text-right shrink-0`,title:tn(n),children:tn(n)})]})}function an({token:e,theme:t}){let{data:n,isLoading:r}=c.useUsage(e.id);if(r)return(0,$.jsxs)(`div`,{className:`animate-pulse space-y-2 py-2`,children:[(0,$.jsx)(`div`,{className:`h-2 w-full bg-sand-200 rounded-full`}),(0,$.jsx)(`div`,{className:`h-2 w-3/4 bg-sand-200 rounded-full`})]});if(n?.error){let e=n.error.includes(`re-login`)||n.error.includes(`token_revoked`)||n.error.includes(`401`);return(0,$.jsxs)(`div`,{className:`py-1`,children:[(0,$.jsx)(`p`,{className:`text-[11px] text-amber-600`,children:e?`Session expired`:`Unavailable`}),(0,$.jsx)(`p`,{className:`text-[10px] text-sand-400 mt-0.5`,children:e?`Please re-login via OAuth`:n.error})]})}if(!n?.fiveHour&&!n?.sevenDay)return(0,$.jsx)(`p`,{className:`text-[11px] text-sand-400 py-1`,children:`No usage data`});let i=Jt.has(e.provider)?e.quota_threshold:null;return(0,$.jsxs)(`div`,{className:`space-y-1.5 py-1`,children:[n.fiveHour&&(0,$.jsx)(rn,{label:`5h`,utilization:n.fiveHour.utilization,resetsAt:n.fiveHour.resetsAt,windowDurationMins:n.fiveHour.windowDurationMins,theme:t,threshold:i}),n.sevenDay&&(0,$.jsx)(rn,{label:`7d`,utilization:n.sevenDay.utilization,resetsAt:n.sevenDay.resetsAt,windowDurationMins:n.sevenDay.windowDurationMins,theme:t})]})}function on({token:e}){let[n,r]=(0,d.useState)(null),[i,o]=(0,d.useState)(``),s=(0,d.useRef)(null),c=t(),u=l(),f=Jt.has(e.provider),p=n!==null,m=Yt(i),h=()=>{let t=s.current?.getBoundingClientRect();if(!t)return;let n=Math.min(Math.max(t.right-240,8),Math.max(window.innerWidth-240-8,8)),i=t.top-6-150,a=t.bottom+6;r({left:n,top:Math.min(Math.max(i>=8?i:a,8),Math.max(window.innerHeight-150-8,8))}),o(String(e.quota_threshold??100))},g=()=>r(null);if(!f)return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md text-[10px] text-sand-300 border border-sand-100`,title:`Quota threshold는 이 provider에서 지원되지 않습니다`,children:[(0,$.jsx)(Kt,{className:`size-3`}),`n/a`]});let _=e=>{let t=/^\d+$/.test(i.trim())?Number(i.trim()):0,n=Math.min(Math.max(t+e,0),100);o(String(n))};return(0,$.jsxs)(`div`,{className:`inline-flex`,children:[(0,$.jsxs)(`button`,{ref:s,type:`button`,title:`사용률 제한 설정`,onClick:p?g:h,className:`flex items-center gap-1 px-1.5 py-0.5 rounded-md text-[10px] border border-sand-200/80 text-sand-400 hover:text-sand-600 hover:border-sand-300 transition-colors duration-150`,children:[(0,$.jsx)(Kt,{className:`size-3`}),`Set limit`]}),p&&n&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-40`,onPointerDown:g}),(0,$.jsxs)(`div`,{className:`fixed z-50 w-60 panel shadow-xl p-3`,style:{top:n.top,left:n.left},children:[(0,$.jsx)(`label`,{htmlFor:`threshold-${e.id}`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`사용률 제한`}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>_(-10),className:`size-9 shrink-0 rounded-md border border-sand-200 text-sand-600 text-base leading-none hover:bg-sand-100 transition-colors duration-150`,children:`−`}),(0,$.jsx)(a,{id:`threshold-${e.id}`,value:i,onChange:e=>o(e.target.value),inputMode:`numeric`,className:`h-9 w-14 border rounded-md text-center text-sm text-sand-900 bg-white tabular-nums focus:outline-none ${m.ok?`border-sand-200 focus:border-sienna-300`:`border-red-300 focus:border-red-400`}`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>_(10),className:`size-9 shrink-0 rounded-md border border-sand-200 text-sand-600 text-base leading-none hover:bg-sand-100 transition-colors duration-150`,children:`+`}),(0,$.jsx)(`span`,{className:`text-sm text-sand-500`,children:`%`})]}),m.ok?(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] text-sand-500 leading-snug`,children:m.value===null?`제한 없음 — 사용률과 무관하게 항상 사용합니다.`:`5h 사용률이 임계치에 달하면 해당 토큰을 건너뜁니다.`}):(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] text-red-500`,children:m.error}),(0,$.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,className:`px-2 py-1 text-[11px] font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:g,children:`Cancel`}),(0,$.jsx)(`button`,{type:`button`,className:`px-2 py-1 text-[11px] font-medium rounded-md bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,disabled:u.isPending||!m.ok,onClick:async()=>{m.ok&&(await u.mutateAsync({id:e.id,quotaThreshold:m.value}),await Promise.all([c.invalidateQueries({queryKey:[`Token`]}),c.invalidateQueries({queryKey:[`Qgrid`]})]),g())},children:u.isPending?`Saving...`:`Save`})]})]})]})]})}function sn({token:e}){let[n,r]=(0,d.useState)(null),[i,o]=(0,d.useState)(``),s=(0,d.useRef)(null),c=t(),u=l(),f=Xt(i),p=()=>{let t=s.current?.getBoundingClientRect();if(!t)return;let n=Math.min(Math.max(t.right-240,8),Math.max(window.innerWidth-240-8,8)),i=t.top-6-150,a=Math.min(Math.max(i>=8?i:t.bottom+6,8),Math.max(window.innerHeight-150-8,8));o(String(e.weight)),r({left:n,top:a})},m=()=>r(null),h=e=>{let t=/^\d+$/.test(i.trim())?Number(i.trim()):1;o(String(Math.min(Math.max(t+e,1),100)))};return(0,$.jsxs)(`div`,{className:`inline-flex`,children:[(0,$.jsxs)(`button`,{ref:s,type:`button`,title:`라우팅 가중치 설정`,onClick:n?m:p,className:`flex items-center gap-1 px-1.5 py-0.5 rounded-md text-[10px] border border-sand-200/80 text-sand-400 hover:text-sand-600 hover:border-sand-300 transition-colors duration-150`,children:[`Weight `,e.weight]}),n&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-40`,onPointerDown:m}),(0,$.jsxs)(`div`,{className:`fixed z-50 w-60 panel shadow-xl p-3`,style:n,children:[(0,$.jsx)(`label`,{htmlFor:`weight-${e.id}`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`라우팅 가중치`}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>h(-1),className:`size-9 shrink-0 rounded-md border border-sand-200 text-sand-600`,children:`−`}),(0,$.jsx)(a,{id:`weight-${e.id}`,value:i,onChange:e=>o(e.target.value),inputMode:`numeric`,className:`h-9 w-16 border rounded-md text-center text-sm tabular-nums ${f.ok?`border-sand-200`:`border-red-300`}`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>h(1),className:`size-9 shrink-0 rounded-md border border-sand-200 text-sand-600`,children:`+`})]}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] ${f.ok?`text-sand-500`:`text-red-500`}`,children:f.ok?`새 요청의 상대 배정 비율입니다.`:f.error}),(0,$.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:m,className:`px-2 py-1 text-[11px]`,children:`Cancel`}),(0,$.jsx)(`button`,{type:`button`,onClick:async()=>{f.ok&&(await u.mutateAsync({id:e.id,weight:f.value}),await Promise.all([c.invalidateQueries({queryKey:[`Token`]}),c.invalidateQueries({queryKey:[`Qgrid`]})]),m())},disabled:u.isPending||!f.ok,className:`px-2 py-1 text-[11px] rounded-md bg-sienna-400 text-white disabled:opacity-50`,children:u.isPending?`Saving...`:`Save`})]})]})]})]})}function cn({token:e}){let{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:s}=Gt({id:String(e.id),transition:{duration:200,easing:`ease`}}),{data:l}=c.useTotalCost({num:0,page:1,...e.name?{token_name:e.name}:{}},{enabled:!!e.name}),u=$t(e.provider);return(0,$.jsxs)(`div`,{ref:r,style:{transform:N.Translate.toString(i),transition:a,opacity:s?.5:1,zIndex:s?10:void 0},className:`relative rounded-lg bg-white border border-sand-200/80 overflow-hidden shadow-sm hover:shadow-md transition-shadow duration-200`,children:[(0,$.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1 ${u.stripe}`}),(0,$.jsxs)(`div`,{className:`pl-4 pr-3 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`순서 변경 핸들`,...t,...n,className:`shrink-0 -m-1 p-1 text-sand-300 hover:text-sand-500 cursor-grab active:cursor-grabbing touch-none`,children:(0,$.jsx)(qt,{className:`size-3.5`})}),(0,$.jsx)(`span`,{className:`text-[13px] font-medium text-sand-800 truncate select-none`,children:e.name??`Unnamed`})]}),(0,$.jsx)(`span`,{className:`text-[11px] tabular-nums font-medium shrink-0 ${u.cost}`,title:`이 토큰의 누적 비용`,children:o(l?.usd??0)})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mb-2`,children:[(0,$.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full uppercase ${u.badge}`,children:e.provider}),(0,$.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full ${e.active?`bg-sage-100 text-sage-600`:`bg-sand-200 text-sand-500`}`,children:e.active?`Active`:`Inactive`}),Jt.has(e.provider)&&e.quota_threshold!==null&&(0,$.jsxs)(`span`,{className:`px-1.5 py-0.5 rounded-full bg-sienna-50 text-[10px] tabular-nums font-medium text-sienna-600`,title:`사용률 ${e.quota_threshold}% 이상이면 이 토큰 제외`,children:[`≤ `,e.quota_threshold,`%`]})]}),(0,$.jsx)(an,{token:e,theme:u}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:[(0,$.jsx)(sn,{token:e}),(0,$.jsx)(on,{token:e})]})]})]})}var ln=[`all`,`openai`,`anthropic`];function un(){let{data:e,isLoading:n}=s.useTokens(`A`,{orderBy:`ord-asc`}),r=t(),i=s.useReorderMutation(),[a,o]=(0,d.useState)([]),[c,l]=(0,d.useState)(`all`);(0,d.useEffect)(()=>{e?.rows&&o(e.rows)},[e?.rows]);let u=$e(Qe(ft,{activationConstraint:{distance:5}})),f=t=>{let{active:n,over:c}=t;if(!c||n.id===c.id)return;let l=Number(n.id),u=Number(c.id),d=a.findIndex(e=>e.id===l),f=a.findIndex(e=>e.id===u);if(d===-1||f===-1)return;let p=At(a,d,f);o(p);let m=s.getTokensQueryOptions(`A`,{orderBy:`ord-asc`}).queryKey,h=r.getQueryData(m);r.setQueryData(m,e=>e&&{...e,rows:p}),i.mutate({ids:p.map(e=>e.id)},{onError:()=>{r.setQueryData(m,h),e?.rows&&o(e.rows)},onSettled:()=>{Promise.all([r.invalidateQueries({queryKey:[`Token`]}),r.invalidateQueries({queryKey:[`Qgrid`]})])}})};if(n)return(0,$.jsx)(`div`,{className:`panel p-5`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Array.from({length:4}).map((e,t)=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-sand-50 px-4 py-3 animate-pulse`,children:[(0,$.jsx)(`div`,{className:`h-3 w-16 bg-sand-200 rounded mb-3`}),(0,$.jsx)(`div`,{className:`h-2 w-full bg-sand-200 rounded-full`})]},`skel-${t}`))})});if(a.length===0)return(0,$.jsx)(`div`,{className:`panel px-5 py-10`,children:(0,$.jsx)(`p`,{className:`text-sand-400 text-[13px] text-center`,children:`No tokens registered`})});let p=c===`all`?a:a.filter(e=>e.provider===c);return(0,$.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-5 py-2.5`,children:[(0,$.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:`Token Usage`}),(0,$.jsx)(`div`,{className:`segmented-control flex gap-0.5`,children:ln.map(e=>(0,$.jsx)(`button`,{type:`button`,"data-active":c===e,className:`px-2.5 py-[3px] text-[11px] font-medium rounded-[6px] transition-all duration-150 ${c===e?`text-sand-800`:`text-sand-500 hover:text-sand-700`}`,onClick:()=>l(e),children:e===`all`?`All`:e===`openai`?`OpenAI`:`Anthropic`},e))})]}),(0,$.jsx)(`div`,{className:`p-4`,children:(0,$.jsx)(St,{sensors:u,collisionDetection:H,onDragEnd:f,children:(0,$.jsx)(It,{items:p.map(e=>String(e.id)),strategy:Nt,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:p.map(e=>(0,$.jsx)(cn,{token:e},e.id))})})})})]})}function dn(){return(0,$.jsx)(`div`,{className:`max-w-6xl mx-auto`,children:(0,$.jsx)(un,{})})}export{dn as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{i,o as a}from"./index-CnNT0mdq.js";import{a as o,n as s}from"./services.generated-BsAvotjG.js";import{t as c}from"./use-update-token-mutation-DqEpK7It.js";var l=e(n()),u=r(),d=e=>(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,u.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 12h14m-7-7v14`})});function f({isPending:e,isError:t,onSubmit:n,onRestart:r}){let[a,o]=(0,l.useState)(``);return(0,u.jsxs)(`div`,{className:`space-y-2`,children:[(0,u.jsx)(`p`,{className:`text-[12px] text-sand-600 leading-relaxed`,children:`새 탭에서 Claude 로그인을 완료하면 코드가 표시됩니다. 코드 전체를 아래에 붙여넣으세요.`}),(0,u.jsx)(i,{value:a,onChange:e=>o(e.target.value),placeholder:`code#state`,className:`w-full border border-sand-200 rounded-md px-3 py-2 text-sm font-mono text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`}),t&&(0,u.jsx)(`p`,{className:`text-[11px] text-red-500`,children:`코드 확인에 실패했습니다 — 표시된 코드 전체를 다시 붙여넣거나 로그인을 다시 시작하세요.`}),(0,u.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md bg-sand-900 text-white hover:bg-sand-800 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!a.trim()||e,onClick:()=>n(a),children:e?(0,u.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,u.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin`}),`Verifying...`]}):`Complete login`}),(0,u.jsx)(`button`,{type:`button`,className:`w-full py-1.5 text-[12px] text-sand-500 hover:text-sand-700 transition-colors duration-150`,onClick:()=>{o(``),r()},children:`처음부터 다시 시작`})]})}var p=3e3,m=3e5;function h(e){let t=0;for(let n of e.getQueryCache().findAll({queryKey:[`Token`]})){let e=n.state.data?.rows;Array.isArray(e)&&(t=Math.max(t,e.length))}return t}function g(){let[e,n]=(0,l.useState)(null),[r,i]=(0,l.useState)(!1),a=t(),o=s.useOauthStartMutation(),c=s.useOauthStartOpenAIMutation(),u=s.useOauthCompleteMutation(),d=(0,l.useRef)({}),f=()=>{d.current.interval!==void 0&&clearInterval(d.current.interval),d.current.timeout!==void 0&&clearTimeout(d.current.timeout),d.current={}};(0,l.useEffect)(()=>f,[]);let g=()=>Promise.all([a.invalidateQueries({queryKey:[`Token`]}),a.invalidateQueries({queryKey:[`Qgrid`]})]);return{loadingProvider:e,codeEntry:r,start:async(e,t)=>{let r=t.trim();if(!r)return;let s=window.open(`about:blank`,`_blank`);n(e);try{if(e===`openai`){let{authUrl:e}=await c.mutateAsync({name:r});s?s.location.href=e:window.open(e,`_blank`);let t=h(a);f(),d.current.interval=window.setInterval(()=>{g().then(()=>{h(a)>t&&(f(),n(null))})},p),d.current.timeout=window.setTimeout(()=>{f(),n(null)},m);return}let{authUrl:t,mode:l}=await o.mutateAsync({name:r});l===`code`?(s?s.location.href=t:window.open(t,`_blank`),i(!0),n(null)):(s?.close(),window.location.href=t)}catch(e){s?.close(),console.error(`OAuth start failed:`,e),n(null)}},submitCode:async e=>{let t=e.trim();if(!t)return!1;try{await u.mutateAsync({pastedCode:t})}catch(e){return console.error(`OAuth complete failed:`,e),!1}return await g(),!0},reset:()=>{f(),n(null),i(!1),u.reset()},completeMutation:u}}function _(){let[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(``),o=g(),s=()=>{t(!1),r(``),o.reset()},c=async e=>{await o.submitCode(e)&&s()};return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(`button`,{type:`button`,className:`px-3.5 py-1.5 text-[12px] font-medium rounded-lg bg-sienna-500 text-white hover:bg-sienna-600 disabled:opacity-50 transition-all duration-150 active:scale-[0.97] flex items-center gap-1.5 shadow-sm`,onClick:()=>t(!0),children:[(0,u.jsx)(d,{className:`size-3.5`}),`Add Token`]}),e&&(0,u.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,u.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:s,onKeyDown:()=>{}}),(0,u.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-md mx-4`,children:[(0,u.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/50`,children:(0,u.jsx)(`h2`,{className:`text-base font-medium text-sand-900`,children:`Add Token`})}),(0,u.jsxs)(`div`,{className:`px-5 py-4 space-y-4`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name *`}),(0,u.jsx)(i,{value:n,onChange:e=>r(e.target.value),placeholder:`e.g. your-token-name`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]}),o.codeEntry?(0,u.jsx)(f,{isPending:o.completeMutation.isPending,isError:o.completeMutation.isError,onSubmit:e=>void c(e),onRestart:o.reset}):(0,u.jsxs)(`div`,{className:`space-y-2`,children:[(0,u.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md bg-sand-900 text-white hover:bg-sand-800 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||o.loadingProvider!==null,onClick:()=>void o.start(`openai`,n),children:o.loadingProvider===`openai`?(0,u.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,u.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a,{className:`size-4`}),`Login with OpenAI`]})}),(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,u.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`}),(0,u.jsx)(`span`,{className:`text-[10px] text-sand-400 uppercase`,children:`or`}),(0,u.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`})]}),(0,u.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md border border-sand-300 text-sand-700 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||o.loadingProvider!==null,onClick:()=>void o.start(`anthropic`,n),children:o.loadingProvider===`anthropic`?(0,u.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,u.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-sand-400 border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a,{className:`size-4`}),`Login with Claude`]})})]})]}),(0,u.jsx)(`div`,{className:`px-5 py-3 border-t border-sand-100/50 flex items-center justify-end gap-2`,children:(0,u.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:s,children:`Cancel`})})]})]})]})}var v=e=>(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,u.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4`})}),y=e=>(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,u.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})});function b(e){let t=e.credentials;return`expiresAt`in t&&typeof t.expiresAt==`number`?t.expiresAt:`accessTokenExpiresAt`in t&&typeof t.accessTokenExpiresAt==`number`?t.accessTokenExpiresAt:null}function x(e){if(!e)return{text:``,color:``};let t=e-Date.now();if(t<=0)return{text:`expired`,color:`text-red-500`};let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),i=n>0?`${n}h ${r}m`:`${r}m`;return t<36e5?{text:i,color:`text-amber-500`}:{text:i,color:`text-sand-400`}}function S(e){let t=e.credentials.accessToken;return t.length<=12?t:`${t.slice(0,8)}...${t.slice(-4)}`}function C({data:e,isLoading:n}){let[r,a]=(0,l.useState)(null),[o,d]=(0,l.useState)(null),[p,m]=(0,l.useState)(``),h=t(),_=s.useRemoveTokenMutation(),C=c(),w=s.useToggleTokenMutation(),T=g(),E=()=>Promise.all([h.invalidateQueries({queryKey:[`Token`]}),h.invalidateQueries({queryKey:[`Qgrid`]})]),D=async e=>{await w.mutateAsync({id:e.id}),await E()},O=async()=>{r&&(await _.mutateAsync({id:r.id}),await E(),a(null))},k=async e=>{await T.submitCode(e)&&T.reset()},A=e=>{d(e),m(e.name??``)},j=async()=>{o&&(await C.mutateAsync({id:o.id,name:p.trim()}),await E(),d(null))};if(n)return(0,u.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:3}).map((e,t)=>(0,u.jsx)(`div`,{className:`h-12 bg-sand-100 rounded-md animate-pulse`},`skeleton-${t}`))});let M=e??[];return M.length===0?(0,u.jsxs)(`div`,{className:`text-sand-400 text-center py-16 text-sm`,children:[`No tokens registered. Click `,(0,u.jsx)(`strong`,{className:`text-sand-600`,children:`Add Token`}),` to get started.`]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`panel overflow-hidden`,children:(0,u.jsx)(`div`,{className:`overflow-x-auto`,children:(0,u.jsxs)(`table`,{className:`w-full min-w-[640px] text-[13px]`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{className:`panel-header`,children:[(0,u.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Provider`}),(0,u.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Name`}),(0,u.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Token`}),(0,u.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Status`}),(0,u.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Expires`}),(0,u.jsx)(`th`,{className:`w-20 px-3 py-2.5`})]})}),(0,u.jsx)(`tbody`,{className:`divide-y divide-sand-100/80`,children:M.map(e=>{let t=x(b(e));return(0,u.jsxs)(`tr`,{className:`transition-colors duration-150 hover:bg-sand-100/60 ${e.active?``:`opacity-50`}`,children:[(0,u.jsx)(`td`,{className:`px-5 py-3`,children:(0,u.jsx)(`span`,{className:`text-xs font-medium text-sand-500 uppercase`,children:e.provider})}),(0,u.jsx)(`td`,{className:`px-5 py-3`,children:e.name?(0,u.jsx)(`span`,{className:`text-sm text-sand-700`,children:e.name}):(0,u.jsx)(`span`,{className:`text-[11px] text-sand-400`,children:`—`})}),(0,u.jsx)(`td`,{className:`px-5 py-3`,children:(0,u.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:S(e)})}),(0,u.jsx)(`td`,{className:`px-5 py-3`,children:(0,u.jsx)(`button`,{type:`button`,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors duration-200 ${e.active?`bg-sage-400`:`bg-sand-300`}`,onClick:()=>D(e),disabled:w.isPending,children:(0,u.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${e.active?`translate-x-4.5`:`translate-x-0.5`}`})})}),(0,u.jsx)(`td`,{className:`px-5 py-3`,children:t.text&&(0,u.jsx)(`span`,{className:`text-xs ${t.color}`,children:t.text})}),(0,u.jsx)(`td`,{className:`px-3 py-3`,children:(0,u.jsxs)(`div`,{className:`flex items-center gap-1`,children:[!e.active&&(0,u.jsx)(`button`,{type:`button`,title:`기존 이름으로 다시 로그인`,className:`px-2 py-0.5 mr-1 text-[11px] font-medium rounded-md border border-sand-300 text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150 inline-flex items-center gap-1`,disabled:T.loadingProvider!==null,onClick:()=>void T.start(e.provider,e.name??``),children:T.loadingProvider===e.provider?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`w-3 h-3 border-2 border-sand-400 border-t-transparent rounded-full animate-spin`}),`로그인 대기`]}):`재로그인`}),(0,u.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sienna-500 transition-colors duration-150`,onClick:()=>A(e),children:(0,u.jsx)(v,{className:`size-4`})}),(0,u.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-red-500 transition-colors duration-150`,onClick:()=>a(e),children:(0,u.jsx)(y,{className:`size-4`})})]})})]},e.id)})})]})})}),T.codeEntry&&(0,u.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,u.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:T.reset,onKeyDown:()=>{}}),(0,u.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-md mx-4`,children:[(0,u.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,u.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`재로그인`})}),(0,u.jsx)(`div`,{className:`px-5 py-4`,children:(0,u.jsx)(f,{isPending:T.completeMutation.isPending,isError:T.completeMutation.isError,onSubmit:e=>void k(e),onRestart:T.reset})})]})]}),o&&(0,u.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,u.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>d(null),onKeyDown:()=>{}}),(0,u.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,u.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,u.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Edit Token`})}),(0,u.jsx)(`div`,{className:`px-5 py-4 space-y-3`,children:(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name`}),(0,u.jsx)(i,{value:p,onChange:e=>m(e.target.value),placeholder:`e.g. prod, dev, team-a`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]})}),(0,u.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,u.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>d(null),children:`Cancel`}),(0,u.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,disabled:C.isPending,onClick:j,children:C.isPending?`Saving...`:`Save`})]})]})]}),r&&(0,u.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,u.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>a(null),onKeyDown:()=>{}}),(0,u.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,u.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,u.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Remove Token`}),(0,u.jsxs)(`p`,{className:`text-sm text-sand-700 mt-2`,children:[`Are you sure you want to remove`,` `,(0,u.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:S(r)}),r.name&&(0,u.jsxs)(`span`,{className:`text-sand-500`,children:[` (`,r.name,`)`]}),`?`]})]}),(0,u.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,u.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>a(null),children:`Cancel`}),(0,u.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 transition-colors duration-150`,disabled:_.isPending,onClick:O,children:_.isPending?`Removing...`:`Remove`})]})]})]})]})}function w(){let{data:e,isLoading:t}=o.useTokens(`A`);return(0,u.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-4`,children:[(0,u.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,u.jsx)(_,{})}),(0,u.jsx)(C,{data:e?.rows,isLoading:t})]})}export{w as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./vendor-tanstack-DJRQAbrY.js";import{n as t}from"./services.generated-BsAvotjG.js";function n(){return e({mutationFn:({id:e,name:n,quotaThreshold:r,weight:i})=>t.updateToken(e,n,r,i)})}export{n as t};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { n as QgridService, o as useMutation } from "./services.generated-DqAKskAS.js";
|
|
2
|
-
//#region src/services/token/use-update-token-mutation.ts
|
|
3
|
-
function useUpdateTokenMutation() {
|
|
4
|
-
return useMutation({ mutationFn: ({ id, name, quotaThreshold, weight }) => QgridService.updateToken(id, name, quotaThreshold, weight) });
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { useUpdateTokenMutation as t };
|