@agent-dock/cli 0.1.3 → 0.2.1-beta.20261108.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/README.md +28 -0
- package/dist/cli.js +3995 -1017
- package/dist/cli.js.map +4 -4
- package/package.json +1 -1
- package/public/assets/ImageLightbox-g9W9xddX.js +1 -0
- package/public/assets/PromptEditor-CDoemeM0.js +18 -0
- package/public/assets/index-DY-CqbRH.css +1 -0
- package/public/assets/index-RVKphYoh.js +41 -0
- package/public/assets/main-BHjClXhJ.js +905 -0
- package/public/assets/main-DssGYdaU.css +32 -0
- package/public/assets/sourcesRouter-BDbBiT0-.css +1 -0
- package/public/assets/sourcesRouter-BlYcFM8d.js +1 -0
- package/public/assets/{syntax-highlighter-fRlPMgFb.js → syntax-highlighter-DOKegME5.js} +1 -1
- package/public/fonts/FiraCode-LICENSE.txt +93 -0
- package/public/fonts/FiraCode-VF.woff2 +0 -0
- package/public/index.html +5 -3
- package/public/sources-router.html +6 -0
- package/public/assets/ImageLightbox-D0mGZhIC.js +0 -1
- package/public/assets/PromptEditor-Cfvua_lI.js +0 -29
- package/public/assets/index-BhkwJfLD.css +0 -32
- package/public/assets/index-CVjQTj1y.js +0 -755
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.ProseMirror{position:relative;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;font-variant-ligatures:none;font-feature-settings:"liga" 0}.ProseMirror pre{white-space:pre-wrap}.ProseMirror li{position:relative}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror [draggable][contenteditable=false]{-webkit-user-select:text;-moz-user-select:text;user-select:text}.ProseMirror-selectednode{outline:2px solid #8cf}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";position:absolute;left:-32px;right:-2px;top:-2px;bottom:-2px;border:2px solid #8cf;pointer-events:none}img.ProseMirror-separator{display:inline!important;border:none!important;margin:0!important}/**
|
|
2
|
+
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
3
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
4
|
+
* https://github.com/chjj/term.js
|
|
5
|
+
* @license MIT
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
* Originally forked from (with the author's permission):
|
|
26
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
27
|
+
* http://bellard.org/jslinux/
|
|
28
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
29
|
+
* The original design remains. The terminal itself
|
|
30
|
+
* has been extended to include xterm CSI codes, among
|
|
31
|
+
* other features.
|
|
32
|
+
*/.xterm{cursor:text;position:relative;-moz-user-select:none;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::-moz-selection{color:transparent}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;-webkit-user-select:text;-moz-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:-moz-fit-content;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:double underline;text-decoration:double underline}.xterm-underline-3{-webkit-text-decoration:wavy underline;text-decoration:wavy underline}.xterm-underline-4{-webkit-text-decoration:dotted underline;text-decoration:dotted underline}.xterm-underline-5{-webkit-text-decoration:dashed underline;text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sr-app{display:grid;grid-template-columns:270px minmax(0,1fr);height:100dvh;overflow:hidden;background:rgb(var(--bg));color:rgb(var(--zinc-900))}.sr-sidebar{display:flex;flex-direction:column;gap:18px;min-height:0;overflow-y:auto;padding:26px 20px;border-right:1px solid rgb(var(--zinc-200));background:rgb(var(--rail))}.sr-brand{display:flex;align-items:center;gap:9px;font-weight:700;letter-spacing:-.02em}.sr-dot{width:10px;height:10px;border-radius:999px;background:rgb(var(--zinc-900));box-shadow:0 0 0 4px rgb(var(--zinc-200))}.sr-sidebar h1{margin:0;font-size:20px;letter-spacing:-.03em}.sr-muted,.sr-sidebar p{color:rgb(var(--zinc-600));font-size:12px;line-height:1.7}.sr-sidebar nav{display:grid;gap:4px}.sr-sidebar nav a{padding:8px 10px;border-radius:8px;color:rgb(var(--zinc-700));text-decoration:none;font-size:13px}.sr-sidebar nav a.active{background:rgb(var(--zinc-200));color:rgb(var(--zinc-900));font-weight:600}.sr-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.sr-summary div{display:grid;gap:4px;padding:10px 8px;border:1px solid rgb(var(--zinc-200));border-radius:10px;background:rgb(var(--surface))}.sr-summary span{color:rgb(var(--zinc-500));font-size:12px}.sr-summary strong{font-size:18px}.sr-router-card{display:grid;gap:8px;margin-top:auto;padding:14px;border:1px solid rgb(var(--zinc-200));border-radius:12px;background:rgb(var(--surface))}.sr-label{color:rgb(var(--zinc-500));font-size:12px}.sr-router-card code,.sr-row code,.sr-case code,.sr-detail code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:rgb(var(--zinc-500));overflow-wrap:anywhere}.sr-router-card small{color:rgb(var(--zinc-600))}.sr-main{min-width:0;min-height:0;overflow-y:auto;padding:22px}.sr-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:start}.sr-panel{min-width:0;border:1px solid rgb(var(--zinc-200));border-radius:14px;background:rgb(var(--surface));overflow:hidden}.sr-panel-header{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid rgb(var(--zinc-200))}.sr-panel-header h2{margin:0;font-size:14px}.sr-panel-header>div{display:flex;flex-wrap:wrap;gap:6px}.sr-panel-body{padding:14px}.sr-app button,.sr-app input,.sr-app select{border:1px solid rgb(var(--zinc-300));border-radius:8px;background:rgb(var(--bg));color:rgb(var(--zinc-900));padding:7px 10px;font-size:12px}.sr-app button:disabled{opacity:.5;cursor:not-allowed}.sr-app button:hover:not(:disabled),.sr-app select:hover{border-color:rgb(var(--zinc-500))}.sr-form{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:8px;margin-bottom:12px}.sr-list{display:grid;gap:8px;max-height:390px;overflow-y:auto}.sr-row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px;border:1px solid rgb(var(--zinc-200));border-radius:10px}.sr-row>div:first-child{display:grid;gap:3px;min-width:0}.sr-row strong,.sr-case strong{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sr-row span{color:rgb(var(--zinc-500));font-size:12px}.sr-row-actions{display:flex;align-items:center;gap:6px;flex:none}.sr-badge{display:inline-flex;align-items:center;padding:3px 7px;border:1px solid rgb(var(--zinc-300));border-radius:999px;color:rgb(var(--zinc-700));font-size:12px;white-space:nowrap}.sr-badge[data-status=closed],.sr-badge[data-status=disabled]{color:rgb(var(--zinc-500))}.sr-badge[data-status=pending],.sr-badge[data-status=waiting]{border-color:rgb(var(--amber-200));background:rgb(var(--amber-50))}.sr-badge[data-status=running],.sr-badge[data-status=open]{border-color:rgb(var(--emerald-200));background:rgb(var(--emerald-50))}.sr-case{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;width:100%;text-align:left;padding:10px;border:1px solid rgb(var(--zinc-200));border-radius:10px;background:rgb(var(--bg))}.sr-case.selected{border-color:rgb(var(--zinc-500))}.sr-case>span{display:grid;gap:3px;min-width:0}.sr-case small{grid-column:1 / -1;color:rgb(var(--zinc-500));font-size:12px}.sr-detail-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.sr-detail h3{margin:16px 0 8px;font-size:12px;color:rgb(var(--zinc-600))}.sr-timeline{display:grid;gap:8px;max-height:320px;overflow-y:auto;list-style:none;padding:0;margin:0}.sr-timeline li{display:grid;grid-template-columns:130px 110px minmax(0,1fr);gap:8px;padding-bottom:8px;border-bottom:1px solid rgb(var(--zinc-100));font-size:12px}.sr-timeline time,.sr-timeline span{color:rgb(var(--zinc-500))}.sr-timeline p{margin:0}.sr-chips{display:flex;gap:6px;flex-wrap:wrap}.sr-chips span{padding:4px 8px;border:1px solid rgb(var(--zinc-200));border-radius:999px;font-size:12px;overflow-wrap:anywhere}.sr-empty{margin:0;padding:18px 0;color:rgb(var(--zinc-500));font-size:12px;text-align:center}.sr-notice{margin-bottom:12px;padding:9px 12px;border:1px solid rgb(var(--emerald-200));border-radius:9px;background:rgb(var(--emerald-50));font-size:12px}.sr-notice.error{border-color:rgb(var(--red-200));background:rgb(var(--red-50))}@media(max-width:900px){.sr-app{display:block;height:100dvh;overflow-y:auto}.sr-sidebar{overflow:visible;border-right:0;border-bottom:1px solid rgb(var(--zinc-200))}.sr-router-card{margin-top:0}.sr-main{overflow:visible}.sr-grid,.sr-form,.sr-timeline li{grid-template-columns:minmax(0,1fr)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as J,j as s}from"./index-RVKphYoh.js";import{r as c}from"./syntax-highlighter-DOKegME5.js";class L extends Error{constructor(n,l){super(l),this.code=n,this.name="ApiError"}}async function i(a,n){var t,v;const l=await fetch(a,{...n,headers:{...n!=null&&n.body?{"content-type":"application/json"}:{},...(n==null?void 0:n.headers)??{}}}),x=await l.json();if(!l.ok)throw new L(((t=x.error)==null?void 0:t.code)??"REQUEST_FAILED",((v=x.error)==null?void 0:v.message)??`请求失败:HTTP ${l.status}`);return x}const d={sources:()=>i("/api/sources"),createSource:a=>i("/api/sources",{method:"POST",body:JSON.stringify(a)}),setEnabled:(a,n)=>i(`/api/sources/${encodeURIComponent(a)}/${n?"enable":"disable"}`,{method:"POST"}),cases:(a={})=>{const n=new URLSearchParams;return a.sourceId&&n.set("sourceId",a.sourceId),a.status&&n.set("status",a.status),i(`/api/source-router/cases${n.size?`?${n}`:""}`)},caseDetail:a=>i(`/api/source-router/cases/${encodeURIComponent(a)}`),closeCase:(a,n)=>i(`/api/source-router/cases/${encodeURIComponent(a)}/close`,{method:"POST",body:JSON.stringify({reason:n})}),routerStatus:()=>i("/api/router/status"),openRouter:()=>i("/api/router/open",{method:"POST"}),setPaused:a=>i("/api/router/pause",{method:"POST",body:JSON.stringify({paused:a})})},b=a=>a?new Date(a).toLocaleString("zh-CN",{hour12:!1}):"—",S=a=>s.jsx("span",{className:"sr-badge","data-status":a,children:a});function N({title:a,actions:n,children:l}){return s.jsxs("section",{className:"sr-panel",children:[s.jsxs("header",{className:"sr-panel-header",children:[s.jsx("h2",{children:a}),s.jsx("div",{children:n})]}),s.jsx("div",{className:"sr-panel-body",children:l})]})}function M(){const[a,n]=c.useState([]),[l,x]=c.useState([]),[t,v]=c.useState(null),[r,y]=c.useState(null),[g,E]=c.useState(""),[C,D]=c.useState(""),[f,F]=c.useState(""),[k,A]=c.useState(""),[w,P]=c.useState(""),[h,T]=c.useState(!1),[$,O]=c.useState(""),[I,j]=c.useState(""),u=c.useCallback(async()=>{try{const[e,o,m]=await Promise.all([d.sources(),d.cases({sourceId:C||void 0,status:f||void 0}),d.routerStatus()]);if(n(e),x(o),v(m),j(""),g)try{y(await d.caseDetail(g))}catch{y(null),E("")}}catch(e){j(e instanceof Error?e.message:String(e))}},[g,C,f]);c.useEffect(()=>{u()},[u]),c.useEffect(()=>{const e=setInterval(()=>void u(),1e4);return()=>clearInterval(e)},[u]);const p=async(e,o)=>{T(!0),j(""),O("");try{await e(),O(o),await u()}catch(m){j(m instanceof Error?m.message:String(m))}finally{T(!1)}},U=()=>p(async()=>d.createSource({name:k.trim()||"新的消息源",kind:"webhook",config:{correlation:{mode:"object"},allowedRepos:[],actions:["comment"]},...w?{secrets:{signingSecret:w}}:{}}),"消息源已创建").then(()=>{A(""),P("")}),R=c.useMemo(()=>(t==null?void 0:t.inbox.filter(e=>e.status==="pending"))??[],[t]);return s.jsxs("div",{className:"sr-app",children:[s.jsxs("aside",{className:"sr-sidebar",children:[s.jsxs("div",{className:"sr-brand",children:[s.jsx("span",{className:"sr-dot"}),"AgentDock"]}),s.jsx("h1",{children:"消息源与 Router"}),s.jsx("p",{className:"sr-muted",children:"外部事件进入 Case,Router 判断并委派 Worker;所有内容按不可信数据处理。"}),s.jsxs("nav",{children:[s.jsx("a",{href:"/",children:"返回主控制台"}),s.jsx("a",{href:"/sources-router.html",className:"active",children:"消息源控制台"})]}),s.jsxs("div",{className:"sr-summary",children:[s.jsxs("div",{children:[s.jsx("span",{children:"消息源"}),s.jsx("strong",{children:a.length})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Case"}),s.jsx("strong",{children:l.length})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Inbox"}),s.jsx("strong",{children:R.length})]})]}),s.jsxs("div",{className:"sr-router-card",children:[s.jsx("span",{className:"sr-label",children:"Router Session"}),s.jsx("code",{children:(t==null?void 0:t.sessionId)??"懒创建"}),s.jsx("small",{children:t!=null&&t.paused?"已暂停":"运行中"}),s.jsx("button",{disabled:h,onClick:()=>void p(()=>d.openRouter(),"Router Session 已就绪"),children:"打开 / 复用 Router"}),s.jsx("button",{disabled:h,onClick:()=>t&&void p(()=>d.setPaused(!t.paused),t.paused?"已恢复 Router 派发":"已开启全部暂停"),children:t!=null&&t.paused?"恢复全部":"全部暂停"})]})]}),s.jsxs("main",{className:"sr-main",children:[($||I)&&s.jsx("div",{className:`sr-notice ${I?"error":""}`,children:I||$}),s.jsxs("div",{className:"sr-grid",children:[s.jsxs(N,{title:"消息源",actions:s.jsx("button",{disabled:h,onClick:()=>void u(),children:"刷新"}),children:[s.jsxs("div",{className:"sr-form",children:[s.jsx("input",{"aria-label":"消息源名称",placeholder:"消息源名称",value:k,onChange:e=>A(e.target.value)}),s.jsx("input",{"aria-label":"签名密钥",type:"password",placeholder:"签名密钥(可选)",value:w,onChange:e=>P(e.target.value)}),s.jsx("button",{disabled:h,onClick:()=>void U(),children:"创建"})]}),s.jsxs("div",{className:"sr-list",children:[a.map(e=>s.jsxs("article",{className:"sr-row",children:[s.jsxs("div",{children:[s.jsx("strong",{children:e.name}),s.jsx("code",{children:e.id}),s.jsxs("span",{children:[e.kind," · 最近事件 ",b(e.lastEventAt)]})]}),s.jsxs("div",{className:"sr-row-actions",children:[S(e.enabled?e.status:"disabled"),s.jsx("button",{disabled:h,onClick:()=>void p(()=>d.setEnabled(e.id,!e.enabled),e.enabled?"消息源已禁用":"消息源已启用"),children:e.enabled?"禁用":"启用"})]})]},e.id)),!a.length&&s.jsx("p",{className:"sr-empty",children:"暂无消息源。"})]})]}),s.jsx(N,{title:"Router Inbox",children:s.jsxs("div",{className:"sr-list",children:[R.map(e=>s.jsxs("article",{className:"sr-row",children:[s.jsxs("div",{children:[s.jsx("strong",{children:e.kind}),s.jsx("code",{children:e.caseId??"-"}),s.jsx("span",{children:b(e.createdAt)})]}),S(e.status)]},e.id)),!R.length&&s.jsx("p",{className:"sr-empty",children:"Inbox 为空。"})]})}),s.jsx(N,{title:"Cases",actions:s.jsxs(s.Fragment,{children:[s.jsxs("select",{"aria-label":"按消息源筛选",value:C,onChange:e=>D(e.target.value),children:[s.jsx("option",{value:"",children:"全部消息源"}),a.map(e=>s.jsx("option",{value:e.id,children:e.name},e.id))]}),s.jsxs("select",{"aria-label":"按状态筛选",value:f,onChange:e=>F(e.target.value),children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"open",children:"open"}),s.jsx("option",{value:"waiting",children:"waiting"}),s.jsx("option",{value:"closed",children:"closed"})]})]}),children:s.jsxs("div",{className:"sr-list",children:[l.map(e=>s.jsxs("button",{className:`sr-case ${g===e.id?"selected":""}`,onClick:()=>void d.caseDetail(e.id).then(o=>{y(o),E(e.id)}).catch(o=>j(String(o))),children:[s.jsxs("span",{children:[s.jsx("strong",{children:e.title}),s.jsx("code",{children:e.id})]}),S(e.status),s.jsx("small",{children:b(e.updatedAt)})]},e.id)),!l.length&&s.jsx("p",{className:"sr-empty",children:"暂无 Case。"})]})}),s.jsx(N,{title:"Case 详情",actions:r&&r.status!=="closed"?s.jsx("button",{disabled:h,onClick:()=>r&&void p(()=>d.closeCase(r.id,"控制台手动关闭"),"Case 已关闭"),children:"关闭 Case"}):null,children:r?s.jsxs("div",{className:"sr-detail",children:[s.jsxs("div",{className:"sr-detail-head",children:[s.jsx("strong",{children:r.title}),S(r.status),s.jsx("code",{children:r.correlationKey})]}),s.jsxs("p",{className:"sr-muted",children:["来源对象:",s.jsx("code",{children:String(r.objectValue.id??"-")})," · 主会话:",s.jsx("code",{children:r.primarySessionId??"-"})]}),s.jsx("h3",{children:"时间线"}),s.jsx("ol",{className:"sr-timeline",children:r.events.map(e=>s.jsxs("li",{children:[s.jsx("time",{children:b(e.createdAt)}),s.jsx("span",{children:e.kind}),s.jsx("p",{children:e.summary})]},e.id))}),s.jsx("h3",{children:"关联会话与动作"}),s.jsxs("div",{className:"sr-chips",children:[r.sessions.map(e=>s.jsxs("span",{children:["委派 · ",e.sessionId]},e.sessionId)),r.watches.map(e=>s.jsxs("span",{children:["Watch · ",e.status]},e.id)),r.actions.map(e=>s.jsxs("span",{children:["Action · ",e.status]},e.id)),!r.sessions.length&&!r.watches.length&&!r.actions.length&&s.jsx("span",{children:"暂无关联对象"})]})]}):s.jsx("p",{className:"sr-empty",children:"选择一个 Case 查看时间线、关联 Session、Watch 和 Action。"})})]})]})]})}J.createRoot(document.getElementById("root")).render(s.jsx(c.StrictMode,{children:s.jsx(M,{})}));
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright (c) 2014, The Fira Code Project Authors (https://github.com/tonsky/FiraCode)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
package/public/index.html
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<!doctype html><html lang="zh-CN"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,viewport-fit=cover,interactive-widget=resizes-content"/><meta name="theme-color" content="#
|
|
2
|
-
<link rel="modulepreload" crossorigin href="/assets/syntax-highlighter-
|
|
3
|
-
<link rel="
|
|
1
|
+
<!doctype html><html lang="zh-CN"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,viewport-fit=cover,interactive-widget=resizes-content"/><meta name="theme-color" content="#ffffff"/><link rel="preload" href="/fonts/FiraCode-VF.woff2" as="font" type="font/woff2" crossorigin/><link rel="icon" type="image/svg+xml" href="/agent-dock.svg?v=2"/><title>AgentDock</title><script>try{var m=localStorage.getItem("agentdock:theme");var d=m==="dark"||(m!=="light"&&matchMedia("(prefers-color-scheme: dark)").matches);document.documentElement.dataset.theme=d?"dark":"light";localStorage.removeItem("agentdock:accent");localStorage.removeItem("agentdock:background")}catch(e){}</script> <script type="module" crossorigin src="/assets/main-BHjClXhJ.js"></script>
|
|
2
|
+
<link rel="modulepreload" crossorigin href="/assets/syntax-highlighter-DOKegME5.js">
|
|
3
|
+
<link rel="modulepreload" crossorigin href="/assets/index-RVKphYoh.js">
|
|
4
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DY-CqbRH.css">
|
|
5
|
+
<link rel="stylesheet" crossorigin href="/assets/main-DssGYdaU.css">
|
|
4
6
|
</head><body><div id="root"></div></body></html>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<!doctype html><html lang="zh-CN"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0,viewport-fit=cover,interactive-widget=resizes-content"/><meta name="theme-color" content="#ffffff"/><title>AgentDock · 消息源与 Router</title><script>try{var m=localStorage.getItem("agentdock:theme");var d=m==="dark"||(m!=="light"&&matchMedia("(prefers-color-scheme: dark)").matches);document.documentElement.dataset.theme=d?"dark":"light"}catch(e){}</script> <script type="module" crossorigin src="/assets/sourcesRouter-BlYcFM8d.js"></script>
|
|
2
|
+
<link rel="modulepreload" crossorigin href="/assets/syntax-highlighter-DOKegME5.js">
|
|
3
|
+
<link rel="modulepreload" crossorigin href="/assets/index-RVKphYoh.js">
|
|
4
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DY-CqbRH.css">
|
|
5
|
+
<link rel="stylesheet" crossorigin href="/assets/sourcesRouter-BDbBiT0-.css">
|
|
6
|
+
</head><body><div id="root"></div></body></html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as pn,j as gn}from"./index-CVjQTj1y.js";import{a as n}from"./syntax-highlighter-fRlPMgFb.js";const Ot="carousel",Nt="controller",vn="navigation",En="no-scroll",Be="portal",xn="root",Rt="toolbar",mt="zoom",Ze="loading",We="error",$e="complete",bn="placeholder",wn=e=>`active-slide-${e}`,Cn="fullsize",Ke="flex_center",_n="no_scroll",Tt="no_scroll_padding",je="slide",kt="slide_wrapper",Pn="slide_wrapper_interactive",ue="prev",de="next",pt="swipe",ge="close",Dt="onPointerDown",At="onPointerMove",Zt="onPointerUp",Wt="onPointerLeave",$t="onPointerCancel",Ge="onKeyDown",Mn="onKeyUp",qe="onWheel",Sn="Escape",yn="ArrowLeft",Ln="ArrowRight",In="button",Xe="icon",Ft="contain",gt="cover",Vt="Unknown action type",Ut="yarl__";function oe(...e){return e.filter(Boolean).join(" ")}function T(e){return`${Ut}${e}`}function K(e){return`--${Ut}${e}`}function we(e,t){return`${e}${t?`_${t}`:""}`}function Qe(e){return t=>we(e,t)}function ve(e,t){var r;return(r=e==null?void 0:e[t])!==null&&r!==void 0?r:t}function On(e,t,r){return ve(e,"{index} of {total}").replace(/\{index}/g,`${ot(r,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function Je(...e){return()=>{e.forEach(t=>{t()})}}function ie(e,t,r){return()=>{const o=n.useContext(r);if(!o)throw new Error(`${e} must be used within a ${t}.Provider`);return o}}function et(){return typeof window<"u"}function tt(e,t=0){const r=10**t;return Math.round((e+Number.EPSILON)*r)/r}function fe(e){return e.type===void 0||e.type==="image"}function nt(e,t){return e.imageFit===gt||e.imageFit!==Ft&&t===gt}function ye(e){return typeof e=="string"?Number.parseInt(e,10):e}function Me(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=ye(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function Nn(e,t){const r=Me(t),o=r.percent!==void 0?e.width/100*r.percent:r.pixel;return{width:Math.max(e.width-2*o,0),height:Math.max(e.height-2*o,0)}}function Rn(){return(et()?window==null?void 0:window.devicePixelRatio:void 0)||1}function ot(e,t){return t>0?(e%t+t)%t:0}function Xt(e){return e.length>0}function Yt(e,t){return e[ot(t,e.length)]}function Ye(e,t){return Xt(e)?Yt(e,t):void 0}function Tn(e){return fe(e)?e.src:void 0}function kn(e,t,r){if(!r)return e;const{buttons:o,...i}=e,c=o.findIndex(l=>l===t),s=n.isValidElement(r)?n.cloneElement(r,{key:t},null):r;if(c>=0){const l=[...o];return l.splice(c,1,s),{buttons:l,...i}}return{buttons:[s,...o],...i}}function Dn(e,t,r=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),r))}const An=Number(n.version.split(".")[0])>=19;function Zn(e){return{inert:An?e:e?"":void 0}}function Wn(e){e.scrollTop}const ze={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[ge]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:Ft,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,closeOnEscape:!0,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function se(e,t){return{name:e,component:t}}function Y(e,t){return{module:e,children:t}}function zt(e,t,r){return e.module.name===t?r(e):e.children?[Y(e.module,e.children.flatMap(o=>{var i;return(i=zt(o,t,r))!==null&&i!==void 0?i:[]}))]:[e]}function pe(e,t,r){return e.flatMap(o=>{var i;return(i=zt(o,t,r))!==null&&i!==void 0?i:[]})}function $n(e,t=[],r=[]){let o=e;const i=h=>{const m=[...o];for(;m.length>0;){const f=m.pop();if((f==null?void 0:f.module.name)===h)return!0;f!=null&&f.children&&m.push(...f.children)}return!1},c=(h,m)=>{if(h===""){o=[Y(m,o)];return}o=pe(o,h,f=>[Y(m,[f])])},s=(h,m)=>{o=pe(o,h,f=>[Y(f.module,[Y(m,f.children)])])},l=(h,m,f)=>{o=pe(o,h,b=>{var _;return[Y(b.module,[...f?[Y(m)]:[],...(_=b.children)!==null&&_!==void 0?_:[],...f?[]:[Y(m)]])]})},a=(h,m,f)=>{o=pe(o,h,b=>[...f?[Y(m)]:[],b,...f?[]:[Y(m)]])},d=h=>{s(Nt,h)},p=(h,m)=>{o=pe(o,h,f=>[Y(m,f.children)])},u=h=>{o=pe(o,h,m=>m.children)},g=h=>{r.push(h)};return t.forEach(h=>{h({contains:i,addParent:c,append:s,addChild:l,addSibling:a,addModule:d,replace:p,remove:u,augment:g})}),{config:o,augmentation:h=>r.reduce((m,f)=>f(m),h)}}const Ht=n.createContext(null),Bt=ie("useA11yContext","A11yContext",Ht);function Fn({children:e}){const[t,r]=n.useState(!1),[o,i]=n.useState(!1),c=n.useMemo(()=>({focusWithin:t,trackFocusWithin:(l,a)=>{const d=p=>u=>{var g;u.currentTarget.contains(u.relatedTarget)||r(p),(g=p?l:a)===null||g===void 0||g(u)};return{onFocus:d(!0),onBlur:d(!1)}},autoPlaying:o,setAutoPlaying:i}),[t,o]);return n.createElement(Ht.Provider,{value:c},e)}const Kt=n.createContext(null),Le=ie("useDocument","DocumentContext",Kt);function Vn({nodeRef:e,children:t}){const r=n.useMemo(()=>{const o=c=>{var s;return((s=c||e.current)===null||s===void 0?void 0:s.ownerDocument)||document};return{getOwnerDocument:o,getOwnerWindow:c=>{var s;return((s=o(c))===null||s===void 0?void 0:s.defaultView)||window}}},[e]);return n.createElement(Kt.Provider,{value:r},t)}const jt=n.createContext(null),Ie=ie("useEvents","EventsContext",jt);function Un({children:e}){const[t]=n.useState({});n.useEffect(()=>()=>{Object.keys(t).forEach(o=>delete t[o])},[t]);const r=n.useMemo(()=>{const o=(s,l)=>{var a;(a=t[s])===null||a===void 0||a.splice(0,t[s].length,...t[s].filter(d=>d!==l))};return{publish:(...[s,l])=>{var a;(a=t[s])===null||a===void 0||a.forEach(d=>d(l))},subscribe:(s,l)=>(t[s]||(t[s]=[]),t[s].push(l),()=>o(s,l)),unsubscribe:o}},[t]);return n.createElement(jt.Provider,{value:r},e)}const Gt=n.createContext(null),G=ie("useLightboxProps","LightboxPropsContext",Gt);function Xn({children:e,...t}){return n.createElement(Gt.Provider,{value:t},e)}const qt=n.createContext(null),le=ie("useLightboxState","LightboxStateContext",qt),Qt=n.createContext(null),Yn=ie("useLightboxDispatch","LightboxDispatchContext",Qt);function zn(e,t){switch(t.type){case"swipe":{const{slides:r}=e,o=(t==null?void 0:t.increment)||0,i=e.globalIndex+o,c=ot(i,r.length),s=Ye(r,c),l=o||t.duration!==void 0?{increment:o,duration:t.duration,easing:t.easing}:void 0;return{slides:r,currentIndex:c,globalIndex:i,currentSlide:s,animation:l}}case"update":return t.slides!==e.slides||t.index!==e.currentIndex?{slides:t.slides,currentIndex:t.index,globalIndex:t.index,currentSlide:Ye(t.slides,t.index)}:e;default:throw new Error(Vt)}}function Hn({slides:e,index:t,children:r}){const[o,i]=n.useReducer(zn,{slides:e,currentIndex:t,globalIndex:t,currentSlide:Ye(e,t)}),[c,s]=n.useState(e),[l,a]=n.useState(t);(e!==c||t!==l)&&(s(e),a(t),i({type:"update",slides:e,index:t}));const d=n.useMemo(()=>({...o,state:o,dispatch:i}),[o,i]);return n.createElement(Qt.Provider,{value:i},n.createElement(qt.Provider,{value:d},r))}const Jt=n.createContext(null),Bn=ie("useRTLContext","RTLContext",Jt);function Kn({isRTL:e,children:t}){const r=n.useMemo(()=>({isRTL:e}),[e]);return n.createElement(Jt.Provider,{value:r},t)}const en=n.createContext(null),Oe=ie("useTimeouts","TimeoutsContext",en);function jn({children:e}){const[t]=n.useState([]);n.useEffect(()=>()=>{t.forEach(o=>window.clearTimeout(o)),t.splice(0,t.length)},[t]);const r=n.useMemo(()=>{const o=s=>{t.splice(0,t.length,...t.filter(l=>l!==s))};return{setTimeout:(s,l)=>{const a=window.setTimeout(()=>{o(a),s()},l);return t.push(a),a},clearTimeout:s=>{s!==void 0&&(o(s),window.clearTimeout(s))}}},[t]);return n.createElement(en.Provider,{value:r},e)}const rt=n.forwardRef(function({label:t,className:r,icon:o,renderIcon:i,onClick:c,style:s,...l},a){const{styles:d,labels:p}=G(),u=ve(p,t);return n.createElement("button",{ref:a,type:"button",title:u,"aria-label":u,className:oe(T(In),r),onClick:c,style:{...s,...d.button},...l},i?i():n.createElement(o,{className:T(Xe),style:d.icon}))});function Gn(e,t){const r=o=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...o},t);return r.displayName=e,r}function he(e,t){return Gn(e,n.createElement("g",{fill:"currentColor"},n.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}const qn=he("Close",n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),Qn=he("Previous",n.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),Jn=he("Next",n.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),eo=he("Loading",n.createElement(n.Fragment,null,Array.from({length:8}).map((e,t,r)=>n.createElement("line",{key:t,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/r.length*(t+1),transform:`rotate(${360/r.length*t}, 12, 12)`})))),to=he("Error",n.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),re=et()?n.useLayoutEffect:n.useEffect;function it(){const[e,t]=n.useState(!1);return n.useEffect(()=>{var r,o;const i=(r=window.matchMedia)===null||r===void 0?void 0:r.call(window,"(prefers-reduced-motion: reduce)");t(i==null?void 0:i.matches);const c=s=>t(s.matches);return(o=i==null?void 0:i.addEventListener)===null||o===void 0||o.call(i,"change",c),()=>{var s;return(s=i==null?void 0:i.removeEventListener)===null||s===void 0?void 0:s.call(i,"change",c)}},[]),e}function no(e){let t=0,r=0,o=0;const c=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(c){const s=c[1].split(",").map(ye);s.length===6?(t=s[4],r=s[5]):s.length===16&&(t=s[12],r=s[13],o=s[14])}return{x:t,y:r,z:o}}function vt(e,t){const r=n.useRef(void 0),o=n.useRef(void 0),i=it();return re(()=>{var c,s,l;if(e.current&&r.current!==void 0&&!i){const{keyframes:a,duration:d,easing:p,onfinish:u}=t(r.current,e.current.getBoundingClientRect(),no(e.current))||{};if(a&&d){(c=o.current)===null||c===void 0||c.cancel(),o.current=void 0;try{o.current=(l=(s=e.current).animate)===null||l===void 0?void 0:l.call(s,a,{duration:d,easing:p})}catch(g){console.error(g)}o.current&&(o.current.onfinish=()=>{o.current=void 0,u==null||u()})}}r.current=void 0}),{prepareAnimation:c=>{r.current=c},isAnimationPlaying:()=>{var c;return((c=o.current)===null||c===void 0?void 0:c.playState)==="running"}}}function tn(){const e=n.useRef(null),t=n.useRef(void 0),[r,o]=n.useState();return{setContainerRef:n.useCallback(c=>{e.current=c,t.current&&(t.current.disconnect(),t.current=void 0);const s=()=>{if(c){const l=window.getComputedStyle(c),a=d=>parseFloat(d)||0;o({width:Math.round(c.clientWidth-a(l.paddingLeft)-a(l.paddingRight)),height:Math.round(c.clientHeight-a(l.paddingTop)-a(l.paddingBottom))})}else o(void 0)};s(),c&&typeof ResizeObserver<"u"&&(t.current=new ResizeObserver(s),t.current.observe(c))},[]),containerRef:e,containerRect:r}}function Pe(){const e=n.useRef(void 0),{setTimeout:t,clearTimeout:r}=Oe();return n.useCallback((o,i)=>{r(e.current),e.current=t(o,i>0?i:0)},[t,r])}function D(e){const t=n.useRef(e);return re(()=>{t.current=e}),n.useCallback((...r)=>{var o;return(o=t.current)===null||o===void 0?void 0:o.call(t,...r)},[])}function Et(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function He(e,t){return n.useMemo(()=>e==null&&t==null?null:r=>{Et(e,r),Et(t,r)},[e,t])}function oo(e,t=!1){const r=n.useRef(!1);re(()=>{t&&r.current&&(r.current=!1,e())},[t,e]);const o=n.useCallback(()=>{r.current=!0},[]),i=n.useCallback(()=>{r.current=!1},[]);return{onFocus:o,onBlur:i}}function ct(){return Bn().isRTL}function ro(){const[e]=n.useState({}),t=n.useCallback((i,c)=>{var s;(s=e[i])===null||s===void 0||s.forEach(l=>{c.isPropagationStopped()||l(c)})},[e]),r=n.useMemo(()=>({onPointerDown:i=>t(Dt,i),onPointerMove:i=>t(At,i),onPointerUp:i=>t(Zt,i),onPointerLeave:i=>t(Wt,i),onPointerCancel:i=>t($t,i),onKeyDown:i=>t(Ge,i),onKeyUp:i=>t(Mn,i),onWheel:i=>t(qe,i)}),[t]),o=n.useCallback((i,c)=>(e[i]||(e[i]=[]),e[i].unshift(c),()=>{const s=e[i];s&&s.splice(0,s.length,...s.filter(l=>l!==c))}),[e]);return{registerSensors:r,subscribeSensors:o}}function xt(e,t){const r=n.useRef(0),o=Pe(),i=D((...c)=>{r.current=Date.now(),e(...c)});return n.useCallback((...c)=>{o(()=>{i(...c)},t-(Date.now()-r.current))},[t,i,o])}const Fe=Qe("slide"),Ve=Qe("slide_image");function Se({slide:e,offset:t,render:r,rect:o,imageFit:i,imageProps:c,onClick:s,onLoad:l,onError:a,style:d}){var p,u,g,h,m,f,b,_;const[P,I]=n.useState(Ze),{publish:L}=Ie(),{setTimeout:M}=Oe(),k=n.useRef(null);n.useEffect(()=>{t===0&&L(wn(P))},[t,P,L]);const E=D(S=>{("decode"in S?S.decode():Promise.resolve()).catch(()=>{}).then(()=>{S.parentNode&&(I($e),M(()=>{l==null||l(S)},0))})}),N=n.useCallback(S=>{k.current=S,S!=null&&S.complete&&E(S)},[E]),w=n.useCallback(S=>{E(S.currentTarget)},[E]),A=D(()=>{I(We),a==null||a()}),W=nt(e,i),X=(S,z)=>Number.isFinite(S)?S:z,C=X(Math.max(...((u=(p=e.srcSet)===null||p===void 0?void 0:p.map(S=>S.width))!==null&&u!==void 0?u:[]).concat(e.width?[e.width]:[]).filter(Boolean)),((g=k.current)===null||g===void 0?void 0:g.naturalWidth)||0),O=X(Math.max(...((m=(h=e.srcSet)===null||h===void 0?void 0:h.map(S=>S.height))!==null&&m!==void 0?m:[]).concat(e.height?[e.height]:[]).filter(Boolean)),((f=k.current)===null||f===void 0?void 0:f.naturalHeight)||0),y=C&&O?{maxWidth:`min(${C}px, 100%)`,maxHeight:`min(${O}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},F=(b=e.srcSet)===null||b===void 0?void 0:b.slice().sort((S,z)=>S.width-z.width).map(S=>`${S.src} ${S.width}w`).join(", "),$=()=>o&&!W&&e.width&&e.height?o.height/e.height*e.width:Number.MAX_VALUE,x=F&&o&&et()?`${Math.round(Math.min($(),o.width))}px`:void 0,{style:R,className:U,...V}=(typeof c=="function"?c(e):c)||{};return n.createElement(n.Fragment,null,n.createElement("img",{ref:N,onLoad:w,onError:A,onClick:s,draggable:!1,className:oe(T(Ve()),W&&T(Ve("cover")),P!==$e&&T(Ve("loading")),U),style:{...y,...d,...R},...V,alt:(_=e.alt)!==null&&_!==void 0?_:"",sizes:x,srcSet:F,src:e.src}),P!==$e&&n.createElement("div",{className:T(Fe(bn))},P===Ze&&(r!=null&&r.iconLoading?r.iconLoading():n.createElement(eo,{className:oe(T(Xe),T(Fe(Ze)))})),P===We&&(r!=null&&r.iconError?r.iconError():n.createElement(to,{className:oe(T(Xe),T(Fe(We)))}))))}const io=n.forwardRef(function({className:t,children:r,onFocus:o,onBlur:i,...c},s){const l=n.useRef(null),[a,d]=n.useState(!1),{trackFocusWithin:p}=Bt(),u=D(()=>{if(l.current){const g=window.getComputedStyle(l.current).direction==="rtl";g!==a&&d(g)}});return n.useEffect(u),n.createElement(Vn,{nodeRef:l},n.createElement(Kn,{isRTL:a},n.createElement("div",{ref:He(s,l),className:oe(T("root"),t),...p(o,i),...c},r)))});var H;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"})(H||(H={}));function nn(e,t,r,o,i){n.useEffect(()=>i?()=>{}:Je(e(Dt,t),e(At,r),e(Zt,o),e(Wt,o),e($t,o)),[e,t,r,o,i])}var Q;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"})(Q||(Q={}));const Ue=30;function co({disableSwipeNavigation:e,closeOnBackdropClick:t},r,o,i,c,s,l,a,d,p,u,g,h,m,f,b){const _=n.useRef(0),P=n.useRef([]),I=n.useRef(void 0),L=n.useRef(0),M=n.useRef(Q.NONE),k=n.useCallback(C=>{I.current===C.pointerId&&(I.current=void 0,M.current=Q.NONE);const O=P.current;O.splice(0,O.length,...O.filter(y=>y.pointerId!==C.pointerId))},[]),E=n.useCallback(C=>{k(C),C.persist(),P.current.push(C)},[k]),N=n.useCallback(C=>P.current.find(({pointerId:O})=>C.pointerId===O),[]),w=D(C=>{E(C)}),A=(C,O)=>u&&C>O||p&&C<-O,W=D(C=>{const O=N(C);if(O)if(I.current===C.pointerId){const y=Date.now()-L.current,F=_.current;M.current===Q.SWIPE?Math.abs(F)>.3*i||Math.abs(F)>5&&y<c?a(F,y):d(F):M.current===Q.PULL&&(A(F,2*Ue)?m(F,y):f(F)),_.current=0,M.current=Q.NONE}else{const{target:y}=C;t&&y instanceof HTMLElement&&y===O.target&&(y.classList.contains(T(je))||y.classList.contains(T(kt)))&&b()}k(C)}),X=D(C=>{const O=N(C);if(O){const y=I.current===C.pointerId;if(C.buttons===0){y&&_.current!==0?W(C):k(O);return}const F=C.clientX-O.clientX,$=C.clientY-O.clientY;if(I.current===void 0){const x=R=>{E(C),I.current=C.pointerId,L.current=Date.now(),M.current=R};Math.abs(F)>Math.abs($)&&Math.abs(F)>Ue&&o(F)?e||(x(Q.SWIPE),s()):Math.abs($)>Math.abs(F)&&A($,Ue)&&(x(Q.PULL),g())}else y&&(M.current===Q.SWIPE?(_.current=F,l(F)):M.current===Q.PULL&&(_.current=$,h($)))}});nn(r,w,X,W)}function so({preventDefaultWheelX:e,preventDefaultWheelY:t}){const r=n.useRef(null),o=D(i=>{const c=Math.abs(i.deltaX)>Math.abs(i.deltaY);(c&&e||!c&&t||i.ctrlKey)&&i.preventDefault()});return n.useCallback(i=>{var c;i?i.addEventListener("wheel",o,{passive:!1}):(c=r.current)===null||c===void 0||c.removeEventListener("wheel",o),r.current=i},[o])}function lo(e,t,r,o,i,c,s,l,a){const d=n.useRef(0),p=n.useRef(0),u=n.useRef(void 0),g=n.useRef(void 0),h=n.useRef(0),m=n.useRef(void 0),f=n.useRef(0),{setTimeout:b,clearTimeout:_}=Oe(),P=n.useCallback(()=>{u.current&&(_(u.current),u.current=void 0)},[_]),I=n.useCallback(()=>{g.current&&(_(g.current),g.current=void 0)},[_]),L=D(()=>{e!==H.SWIPE&&(d.current=0,f.current=0,P(),I())});n.useEffect(L,[e,L]);const M=D(E=>{g.current=void 0,d.current===E&&a(d.current)}),k=D(E=>{if(E.ctrlKey||Math.abs(E.deltaY)>Math.abs(E.deltaX))return;const N=w=>{h.current=w,_(m.current),m.current=w>0?b(()=>{h.current=0,m.current=void 0},300):void 0};if(e===H.NONE){if(Math.abs(E.deltaX)<=1.2*Math.abs(h.current)){N(E.deltaX);return}if(!r(-E.deltaX))return;if(p.current+=E.deltaX,P(),Math.abs(p.current)>30)p.current=0,N(0),f.current=Date.now(),c();else{const w=p.current;u.current=b(()=>{u.current=void 0,w===p.current&&(p.current=0)},i)}}else if(e===H.SWIPE){let w=d.current-E.deltaX;if(w=Math.min(Math.abs(w),o)*Math.sign(w),d.current=w,s(w),I(),Math.abs(w)>.2*o){N(E.deltaX),l(w,Date.now()-f.current);return}g.current=b(()=>M(w),2*i)}else N(E.deltaX)});n.useEffect(()=>t(qe,k),[t,k])}const bt=Qe("container"),on=n.createContext(null),ce=ie("useController","ControllerContext",on);function ao({children:e,...t}){var r;const{carousel:o,animation:i,controller:c,on:s,styles:l,render:a}=t,{closeOnPullUp:d,closeOnPullDown:p,preventDefaultWheelX:u,preventDefaultWheelY:g}=c,[h,m]=n.useState(),f=le(),b=Yn(),[_,P]=n.useState(H.NONE),I=n.useRef(0),L=n.useRef(0),M=n.useRef(1),{registerSensors:k,subscribeSensors:E}=ro(),{subscribe:N,publish:w}=Ie(),A=Pe(),W=Pe(),X=Pe(),{containerRef:C,setContainerRef:O,containerRect:y}=tn(),F=He(so({preventDefaultWheelX:u,preventDefaultWheelY:g}),O),$=n.useRef(null),x=He($,void 0),{getOwnerDocument:R}=Le(),U=ct(),V=v=>(U?-1:1)*(typeof v=="number"?v:1),S=D(()=>{var v;return(v=C.current)===null||v===void 0?void 0:v.focus()}),z=D(()=>t),q=D(()=>f),J=n.useCallback(v=>w(ue,v),[w]),ee=n.useCallback(v=>w(de,v),[w]),me=n.useCallback(()=>w(ge),[w]),Re=v=>!(o.finite&&(V(v)>0&&f.currentIndex===0||V(v)<0&&f.currentIndex===f.slides.length-1)),lt=v=>{var Z;I.current=v,(Z=C.current)===null||Z===void 0||Z.style.setProperty(K("swipe_offset"),`${Math.round(v)}px`)},Te=v=>{var Z,B;L.current=v,M.current=(()=>{const xe=p&&v>0?v:d&&v<0?-v:0;return Math.min(Math.max(tt(1-xe/60*(1-.5),2),.5),1)})(),(Z=C.current)===null||Z===void 0||Z.style.setProperty(K("pull_offset"),`${Math.round(v)}px`),(B=C.current)===null||B===void 0||B.style.setProperty(K("pull_opacity"),`${M.current}`)},{prepareAnimation:un}=vt($,(v,Z,B)=>{if($.current&&y)return{keyframes:[{transform:`translate(0, ${v.rect.y-Z.y+B.y}px)`,opacity:v.opacity},{transform:"translate(0, 0)",opacity:1}],duration:v.duration,easing:i.easing.fade}}),at=(v,Z)=>{if(d||p){Te(v);let B=0;$.current&&(B=i.fade*(Z?2:1),un({rect:$.current.getBoundingClientRect(),opacity:M.current,duration:B})),X(()=>{Te(0),P(H.NONE)},B),P(H.ANIMATION),Z||me()}},{prepareAnimation:dn,isAnimationPlaying:fn}=vt($,(v,Z,B)=>{var te;if($.current&&y&&(!((te=f.animation)===null||te===void 0)&&te.duration)){const j=Me(o.spacing),xe=(j.percent?j.percent*y.width/100:j.pixel)||0;return{keyframes:[{transform:`translate(${V(f.globalIndex-v.index)*(y.width+xe)+v.rect.x-Z.x+B.x}px, 0)`},{transform:"translate(0, 0)"}],duration:f.animation.duration,easing:f.animation.easing}}}),Ee=D(v=>{var Z,B;const te=v.offset||0,j=te?i.swipe:(Z=i.navigation)!==null&&Z!==void 0?Z:i.swipe,xe=!te&&!fn()?i.easing.navigation:i.easing.swipe;let{direction:Ce}=v;const _e=(B=v.count)!==null&&B!==void 0?B:1;let ke=H.ANIMATION,ne=j*_e;if(!Ce){const be=y==null?void 0:y.width,ht=v.duration||0,Ae=be?j/be*Math.abs(te):j;_e!==0?(ht<Ae?ne=ne/Ae*Math.max(ht,Ae/5):be&&(ne=j/be*(be-Math.abs(te))),Ce=V(te)>0?ue:de):ne=j/2}let De=0;Ce===ue?Re(V(1))?De=-_e:(ke=H.NONE,ne=j):Ce===de&&(Re(V(-1))?De=_e:(ke=H.NONE,ne=j)),ne=Math.round(ne),W(()=>{lt(0),P(H.NONE)},ne),$.current&&dn({rect:$.current.getBoundingClientRect(),index:f.globalIndex}),P(ke),w(pt,{type:"swipe",increment:De,duration:ne,easing:xe})});n.useEffect(()=>{var v,Z;!((v=f.animation)===null||v===void 0)&&v.increment&&(!((Z=f.animation)===null||Z===void 0)&&Z.duration)&&A(()=>b({type:"swipe",increment:0}),f.animation.duration)},[f.animation,b,A]);const ut=[E,Re,(y==null?void 0:y.width)||0,i.swipe,()=>P(H.SWIPE),v=>lt(v),(v,Z)=>Ee({offset:v,duration:Z,count:1}),v=>Ee({offset:v,count:0})],hn=[()=>{p&&P(H.PULL)},v=>Te(v),v=>at(v),v=>at(v,!0)];co(c,...ut,d,p,...hn,me),lo(_,...ut);const dt=D(()=>{c.focus&&R().querySelector(`.${T(Be)} .${T(bt())}`)&&S()});n.useEffect(dt,[dt]);const ft=D(()=>{var v;(v=s.view)===null||v===void 0||v.call(s,{index:f.currentIndex})});n.useEffect(ft,[f.globalIndex,ft]),n.useEffect(()=>Je(N(ue,v=>Ee({direction:ue,...v})),N(de,v=>Ee({direction:de,...v})),N(pt,v=>b(v))),[N,Ee,b]);const mn=n.useMemo(()=>({prev:J,next:ee,close:me,focus:S,slideRect:y?Nn(y,o.padding):{width:0,height:0},containerRect:y||{width:0,height:0},subscribeSensors:E,containerRef:C,setCarouselRef:x,toolbarWidth:h,setToolbarWidth:m}),[J,ee,me,S,E,y,C,x,h,m,o.padding]);return n.useImperativeHandle(c.ref,()=>({prev:J,next:ee,close:me,focus:S,getLightboxProps:z,getLightboxState:q}),[J,ee,me,S,z,q]),n.createElement("div",{ref:F,className:oe(T(bt()),T(Ke)),style:{..._===H.SWIPE?{[K("swipe_offset")]:`${Math.round(I.current)}px`}:null,..._===H.PULL?{[K("pull_offset")]:`${Math.round(L.current)}px`,[K("pull_opacity")]:`${M.current}`}:null,...c.touchAction!=="none"?{[K("controller_touch_action")]:c.touchAction}:null,...l.container},tabIndex:-1,...k},y&&n.createElement(on.Provider,{value:mn},e,(r=a.controls)===null||r===void 0?void 0:r.call(a)))}const uo=se(Nt,ao);function ae(e){return we(Ot,e)}function wt(e){return we(je,e)}function fo({slide:e,offset:t}){const r=n.useRef(null),{currentIndex:o,slides:i}=le(),{slideRect:c,focus:s}=ce(),{render:l,carousel:{imageFit:a,imageProps:d},on:{click:p},styles:{slide:u},labels:g}=G(),{getOwnerDocument:h}=Le(),m=t!==0;n.useEffect(()=>{var b;m&&(!((b=r.current)===null||b===void 0)&&b.contains(h().activeElement))&&s()},[m,s,h]);const f=()=>{var b,_,P,I;let L=(b=l.slide)===null||b===void 0?void 0:b.call(l,{slide:e,offset:t,rect:c});return!L&&fe(e)&&(L=n.createElement(Se,{slide:e,offset:t,render:l,rect:c,imageFit:a,imageProps:d,onClick:m?void 0:()=>p==null?void 0:p({index:o})})),L?n.createElement(n.Fragment,null,(_=l.slideHeader)===null||_===void 0?void 0:_.call(l,{slide:e}),((P=l.slideContainer)!==null&&P!==void 0?P:(({children:M})=>M))({slide:e,children:L}),(I=l.slideFooter)===null||I===void 0?void 0:I.call(l,{slide:e})):null};return n.createElement("div",{ref:r,className:oe(T(wt()),!m&&T(wt("current")),T(Ke)),...Zn(m),style:u,role:"group","aria-roledescription":ve(g,"Slide"),"aria-label":On(g,i,o+t)},f())}function ho(){const e=G().styles.slide;return n.createElement("div",{className:T(je),style:e})}function mo({carousel:e,labels:t}){const{slides:r,currentIndex:o,globalIndex:i}=le(),{setCarouselRef:c}=ce(),{autoPlaying:s,focusWithin:l}=Bt(),a=Me(e.spacing),d=Me(e.padding),p=Dn(e,r,1),u=[];if(Xt(r))for(let g=o-p;g<=o+p;g+=1){const h=Yt(r,g),m=i-o+g,f=e.finite&&(g<0||g>r.length-1);u.push(f?{key:m}:{key:[`${m}`,Tn(h)].filter(Boolean).join("|"),offset:g-o,slide:h})}return n.createElement("div",{ref:c,className:oe(T(ae()),u.length>0&&T(ae("with_slides"))),style:{[`${K(ae("slides_count"))}`]:u.length,[`${K(ae("spacing_px"))}`]:a.pixel||0,[`${K(ae("spacing_percent"))}`]:a.percent||0,[`${K(ae("padding_px"))}`]:d.pixel||0,[`${K(ae("padding_percent"))}`]:d.percent||0},role:"region","aria-live":s&&!l?"off":"polite","aria-roledescription":ve(t,"Carousel"),"aria-label":ve(t,"Photo gallery")},u.map(({key:g,slide:h,offset:m})=>h?n.createElement(fo,{key:g,slide:h,offset:m}):n.createElement(ho,{key:g})))}const po=se(Ot,mo);function rn(){const{carousel:e}=G(),{slides:t,currentIndex:r}=le(),o=t.length===0||e.finite&&r===0,i=t.length===0||e.finite&&r===t.length-1;return{prevDisabled:o,nextDisabled:i}}function go(e){var t;const r=ct(),{publish:o}=Ie(),{animation:i,controller:c}=G(),{prevDisabled:s,nextDisabled:l}=rn(),a=((t=i.navigation)!==null&&t!==void 0?t:i.swipe)/2,d=xt(()=>o(ue),a),p=xt(()=>o(de),a),u=D(g=>{switch(g.key){case Sn:if(!c.closeOnEscape)return;o(ge);break;case yn:(r?l:s)||(r?p:d)();break;case Ln:(r?s:l)||(r?d:p)();break;default:return}g.stopPropagation()});n.useEffect(()=>e(Ge,u),[e,u])}function Ct({label:e,icon:t,renderIcon:r,action:o,onClick:i,disabled:c,style:s}){return n.createElement(rt,{label:e,icon:t,renderIcon:r,className:T(`navigation_${o}`),disabled:c,onClick:i,style:s,...oo(ce().focus,c)})}function vo({render:{buttonPrev:e,buttonNext:t,iconPrev:r,iconNext:o},styles:i}){const{prev:c,next:s,subscribeSensors:l}=ce(),{prevDisabled:a,nextDisabled:d}=rn();return go(l),n.createElement(n.Fragment,null,e?e():n.createElement(Ct,{label:"Previous",action:ue,icon:Qn,renderIcon:r,style:i.navigationPrev,disabled:a,onClick:c}),t?t():n.createElement(Ct,{label:"Next",action:de,icon:Jn,renderIcon:o,style:i.navigationNext,disabled:d,onClick:s}))}const Eo=se(vn,vo),_t=T(_n),xo=T(Tt);function bo(e){return"style"in e}function Pt(e,t,r){const o=window.getComputedStyle(e),i=r?"padding-left":"padding-right",c=r?o.paddingLeft:o.paddingRight,s=e.style.getPropertyValue(i);return e.style.setProperty(i,`${(ye(c)||0)+t}px`),()=>{s?e.style.setProperty(i,s):e.style.removeProperty(i)}}function wo({noScroll:{disabled:e},children:t}){const r=ct(),{getOwnerDocument:o,getOwnerWindow:i}=Le();return n.useEffect(()=>{if(e)return()=>{};const c=[],s=i(),{body:l,documentElement:a}=o(),d=Math.round(s.innerWidth-a.clientWidth);if(d>0){c.push(Pt(l,d,r));const p=l.getElementsByTagName("*");for(let u=0;u<p.length;u+=1){const g=p[u];bo(g)&&s.getComputedStyle(g).getPropertyValue("position")==="fixed"&&!g.classList.contains(xo)&&c.push(Pt(g,d,r))}}return l.classList.add(_t),()=>{l.classList.remove(_t),c.forEach(p=>p())}},[r,e,o,i]),n.createElement(n.Fragment,null,t)}const Co=se(En,wo);function Mt(e){return we(Be,e)}function St(e,t,r){const o=e.getAttribute(t);return e.setAttribute(t,r),()=>{o?e.setAttribute(t,o):e.removeAttribute(t)}}function _o({portal:{root:e,container:{className:t,style:r,...o}={}},animation:i,styles:c,className:s,on:l,close:a,labels:d,children:p}){const[u,g]=n.useState(!1),[h,m]=n.useState(!1),f=n.useRef([]),b=n.useRef(null),{setTimeout:_}=Oe(),{subscribe:P}=Ie(),L=it()?0:i.fade;n.useEffect(()=>(g(!0),()=>{g(!1),m(!1)}),[]);const M=D(()=>{f.current.forEach(w=>w()),f.current=[]}),k=D(()=>{var w;m(!1),M(),(w=l.exiting)===null||w===void 0||w.call(l),_(()=>{var A;(A=l.exited)===null||A===void 0||A.call(l),a()},L)});n.useEffect(()=>P(ge,k),[P,k]);const E=D(w=>{var A,W,X;Wn(w),m(!0),(A=l.entering)===null||A===void 0||A.call(l);const C=(X=(W=w.parentNode)===null||W===void 0?void 0:W.children)!==null&&X!==void 0?X:[];for(let O=0;O<C.length;O+=1){const y=C[O];["TEMPLATE","SCRIPT","STYLE"].indexOf(y.tagName)===-1&&y!==w&&(f.current.push(St(y,"inert","")),f.current.push(St(y,"aria-hidden","true")))}f.current.push(()=>{var O,y;(y=(O=b.current)===null||O===void 0?void 0:O.focus)===null||y===void 0||y.call(O)}),_(()=>{var O;(O=l.entered)===null||O===void 0||O.call(l)},L)}),N=n.useCallback(w=>{w?E(w):M()},[E,M]);return u?pn.createPortal(n.createElement(io,{ref:N,className:oe(s,t,T(Mt()),T(Tt),h&&T(Mt("open"))),"aria-modal":!0,role:"dialog","aria-label":ve(d,"Lightbox"),style:{...i.fade!==ze.animation.fade?{[K("fade_animation_duration")]:`${L}ms`}:null,...i.easing.fade!==ze.animation.easing.fade?{[K("fade_animation_timing_function")]:i.easing.fade}:null,...c.root,...r},onFocus:w=>{b.current||(b.current=w.relatedTarget)},...o},p),(typeof e=="function"?e():e)||document.body):null}const Po=se(Be,_o);function Mo({children:e}){return n.createElement(n.Fragment,null,e)}const So=se(xn,Mo);function yo(e){return we(Rt,e)}function Lo({toolbar:{buttons:e},render:{buttonClose:t,iconClose:r},styles:o}){const{close:i,setToolbarWidth:c}=ce(),{setContainerRef:s,containerRect:l}=tn();re(()=>{c(l==null?void 0:l.width)},[c,l==null?void 0:l.width]);const a=()=>t?t():n.createElement(rt,{key:ge,label:"Close",icon:qn,renderIcon:r,onClick:i});return n.createElement("div",{ref:s,style:o.toolbar,className:T(yo())},e==null?void 0:e.map(d=>d===ge?a():d))}const Io=se(Rt,Lo);function cn(e,t){var r;return n.createElement(e.module.component,{key:e.module.name,...t},(r=e.children)===null||r===void 0?void 0:r.map(o=>cn(o,t)))}function Oo(e,t={}){const{easing:r,...o}=e,{easing:i,...c}=t;return{easing:{...r,...i},...o,...c}}function No({carousel:e,animation:t,render:r,toolbar:o,controller:i,noScroll:c,on:s,plugins:l,slides:a,index:d,...p}){const{animation:u,carousel:g,render:h,toolbar:m,controller:f,noScroll:b,on:_,slides:P,index:I,plugins:L,...M}=ze,{config:k,augmentation:E}=$n([Y(Po,[Y(Co,[Y(uo,[Y(po),Y(Io),Y(Eo)])])])],l||L),N=E({animation:Oo(u,t),carousel:{...g,...e},render:{...h,...r},toolbar:{...m,...o},controller:{...f,...i},noScroll:{...b,...c},on:{..._,...s},...M,...p});return N.open?n.createElement(Xn,{...N},n.createElement(Hn,{slides:a||P,index:ye(d||I)},n.createElement(jn,null,n.createElement(Un,null,n.createElement(Fn,null,cn(Y(So,k),N)))))):null}const sn={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1,maxZoom:8};function Ro(e){return Math.min(Math.max(e,Number.EPSILON),1)}function ln(e){const{minZoom:t,...r}={...sn,...e};return{minZoom:Ro(t),...r}}function To(e,t,r,o){const i=n.useRef(void 0),c=n.useRef(void 0),{zoom:s}=G().animation,l=it(),a=D(()=>{var d,p,u;if((d=i.current)===null||d===void 0||d.cancel(),i.current=void 0,c.current&&(o!=null&&o.current)){try{i.current=(u=(p=o.current).animate)===null||u===void 0?void 0:u.call(p,[{transform:c.current},{transform:`scale(${e}) translateX(${t}px) translateY(${r}px)`}],{duration:l?0:s??500,easing:i.current?"ease-out":"ease-in-out"})}catch(g){console.error(g)}c.current=void 0,i.current&&(i.current.onfinish=()=>{i.current=void 0})}});return re(a,[e,t,r,a]),n.useCallback(()=>{c.current=o!=null&&o.current?window.getComputedStyle(o.current).transform:void 0},[o])}function ko(e,t){const{on:r}=G(),o=D(()=>{var i;t||(i=r.zoom)===null||i===void 0||i.call(r,{zoom:e})});n.useEffect(o,[e,o])}function Ne(){const{zoom:e}=G();return ln(e)}function Do(e,t){var r;const o=typeof e=="function"?(r=e(t))!==null&&r!==void 0?r:sn.maxZoom:e;return Math.max(o,1)}function Ao(e,t){var r,o;let i={width:0,height:0},c={width:0,height:0};const{currentSlide:s}=le(),{imageFit:l}=G().carousel,{maxZoomPixelRatio:a,maxZoom:d}=Ne();if(e&&s){const u={...s,...t};if(fe(u)){const g=nt(u,l),h=Math.max(...(((r=u.srcSet)===null||r===void 0?void 0:r.map(f=>f.width))||[]).concat(u.width?[u.width]:[])),m=Math.max(...(((o=u.srcSet)===null||o===void 0?void 0:o.map(f=>f.height))||[]).concat(u.height?[u.height]:[]));h>0&&m>0&&e.width>0&&e.height>0&&(c=g?{width:Math.round(Math.min(h,e.width/e.height*m)),height:Math.round(Math.min(m,e.height/e.width*h))}:{width:h,height:m},c={width:c.width*a,height:c.height*a},i=g?{width:Math.min(e.width,c.width,h),height:Math.min(e.height,c.height,m)}:{width:Math.round(Math.min(e.width,e.height/m*h,h)),height:Math.round(Math.min(e.height,e.width/h*m,m))})}else e.width>0&&e.height>0&&(t&&t.width>0&&t.height>0?i={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}:i={width:e.width,height:e.height})}const p=s&&i.width?fe(s)?Math.max(tt(c.width/i.width,5),1):Do(d,s):1;return{imageRect:i,maxZoom:p}}function yt(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function Lt(e,t,r=100,o=2){return e*Math.min(1+Math.abs(t/r),o)**Math.sign(t)}function Zo(e,t,r,o,i,c,s,l,a){const d=n.useRef([]),p=n.useRef(0),u=n.useRef(void 0),{globalIndex:g}=le(),{getOwnerWindow:h}=Le(),{containerRef:m,subscribeSensors:f}=ce(),{keyboardMoveDistance:b,zoomInMultiplier:_,wheelZoomDistanceFactor:P,scrollToZoom:I,doubleTapDelay:L,doubleClickDelay:M,doubleClickMaxStops:k,pinchZoomDistanceFactor:E,pinchZoomV4:N}=Ne(),w=n.useCallback(x=>{if(m.current){const{pageX:R,pageY:U}=x,{scrollX:V,scrollY:S}=h(),{left:z,top:q,width:J,height:ee}=m.current.getBoundingClientRect();return[R-z-V-J/2,U-q-S-ee/2]}return[]},[m,h]),A=D(x=>{const{key:R,metaKey:U,ctrlKey:V}=x,S=U||V,z=()=>{x.preventDefault(),x.stopPropagation()};if(e>1){const q=(J,ee)=>{z(),l(J,ee)};R==="ArrowDown"?q(0,b):R==="ArrowUp"?q(0,-b):R==="ArrowLeft"?q(-b,0):R==="ArrowRight"&&q(b,0)}R==="+"||S&&R==="="?(z(),i()):R==="-"||S&&R==="_"?(z(),c()):S&&R==="0"&&(z(),s(1))}),W=D(x=>{if((x.ctrlKey||I)&&Math.abs(x.deltaY)>Math.abs(x.deltaX)){x.stopPropagation(),s(Lt(e,-x.deltaY,P),!0,...w(x));return}e>1&&(x.stopPropagation(),I||l(x.deltaX,x.deltaY))}),X=n.useCallback(x=>{const R=d.current;R.splice(0,R.length,...R.filter(U=>U.pointerId!==x.pointerId))},[]),C=n.useCallback(x=>{X(x),x.persist(),d.current.push(x)},[X]),O=D(x=>{var R;const U=d.current;if(x.pointerType==="mouse"&&x.buttons>1||!(!((R=a==null?void 0:a.current)===null||R===void 0)&&R.contains(x.target)))return;e>1&&x.stopPropagation();const{timeStamp:V}=x;if(U.length===0&&V-p.current<(x.pointerType==="touch"?L:M)){p.current=0;const S=e>=1?e!==r?e*Math.max(r**(1/k),_):1:e!==t?e/Math.max(t**(-1/k),_):1;s(S,!1,...w(x))}else p.current=V;if(C(x),U.length===2){const S=yt(U[0],U[1]);u.current={previousDistance:S,initialDistance:Math.max(S,1),initialZoom:e}}}),y=D(x=>{const R=d.current,U=R.find(V=>V.pointerId===x.pointerId);if(R.length===2&&u.current){x.stopPropagation(),C(x);const V=yt(R[0],R[1]),S=N?u.current.initialZoom/u.current.initialDistance*V:Lt(e,V-u.current.previousDistance,E);s(S,!0,...R.map(z=>w(z)).reduce((z,q)=>q.map((J,ee)=>z[ee]+J/2))),u.current.previousDistance=V;return}e>1&&(x.stopPropagation(),U&&(R.length===1&&l((U.clientX-x.clientX)/e,(U.clientY-x.clientY)/e),C(x)))}),F=n.useCallback(x=>{const R=d.current;R.length===2&&R.find(U=>U.pointerId===x.pointerId)&&(u.current=void 0),X(x)},[X]),$=n.useCallback(()=>{const x=d.current;x.splice(0,x.length),p.current=0,u.current=void 0},[]);nn(f,O,y,F,o),n.useEffect($,[g,$]),n.useEffect(()=>o?()=>{}:Je($,f(Ge,A),f(qe,W)),[o,f,$,A,W])}function Wo(e,t,r){const[o,i]=n.useState(1),[c,s]=n.useState(0),[l,a]=n.useState(0),d=To(o,c,l,r),{currentSlide:p,globalIndex:u}=le(),{containerRect:g,slideRect:h}=ce(),{minZoom:m,zoomInMultiplier:f}=Ne(),b=p&&fe(p)?p.src:void 0,_=!(r!=null&&r.current);re(()=>{i(1),s(0),a(0)},[u,b]);const P=n.useCallback((E,N,w)=>{const A=w||o,W=c-(E||0),X=l-(N||0),C=(e.width*A-h.width)/2/A,O=(e.height*A-h.height)/2/A;s(Math.min(Math.abs(W),Math.max(C,0))*Math.sign(W)),a(Math.min(Math.abs(X),Math.max(O,0))*Math.sign(X))},[o,c,l,h,e.width,e.height]),I=n.useCallback((E,N,w,A)=>{const W=tt(E+.01<t?E-.01>m?E:m:t,5);N||d(),P(w?w*(1/o-1/W):0,A?A*(1/o-1/W):0,W),i(W)},[o,m,t,P,d]),L=D(()=>{o>1&&(o>t&&I(t,!0),P())});re(L,[g.width,g.height,L]);const M=n.useCallback(()=>{const E=o*f;I(o<1&&E>1?1:E)},[o,f,I]),k=n.useCallback(()=>{const E=o/f;I(o>1&&E<1?1:E)},[o,f,I]);return{zoom:o,offsetX:c,offsetY:l,disabled:_,changeOffsets:P,changeZoom:I,zoomIn:M,zoomOut:k}}const an=n.createContext(null),st=ie("useZoom","ZoomControllerContext",an);function $o({children:e}){const[t,r]=n.useState(),{slideRect:o}=ce(),{ref:i,minZoom:c}=Ne(),{imageRect:s,maxZoom:l}=Ao(o,t==null?void 0:t.imageDimensions),{zoom:a,offsetX:d,offsetY:p,disabled:u,changeZoom:g,changeOffsets:h,zoomIn:m,zoomOut:f}=Wo(s,l,t==null?void 0:t.zoomWrapperRef);ko(a,u),Zo(a,c,l,u,m,f,g,h,t==null?void 0:t.zoomWrapperRef);const b=n.useMemo(()=>({zoom:a,minZoom:c,maxZoom:l,offsetX:d,offsetY:p,disabled:u,zoomIn:m,zoomOut:f,changeZoom:g}),[a,c,l,d,p,u,m,f,g]);n.useImperativeHandle(i,()=>b,[b]);const _=n.useMemo(()=>({...b,setZoomWrapper:r}),[b,r]);return n.createElement(an.Provider,{value:_},e)}const Fo=he("ZoomIn",n.createElement(n.Fragment,null,n.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),n.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),Vo=he("ZoomOut",n.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})),It=n.forwardRef(function({zoomIn:t,onLoseFocus:r},o){const i=n.useRef(!1),c=n.useRef(!1),{zoom:s,minZoom:l,maxZoom:a,zoomIn:d,zoomOut:p,disabled:u}=st(),{render:g}=G(),h=u||(t?s>=a:s<=l);return n.useEffect(()=>{h&&i.current&&c.current&&r(),h||(i.current=!0)},[h,r]),n.createElement(rt,{ref:o,disabled:h,label:t?"Zoom in":"Zoom out",icon:t?Fo:Vo,renderIcon:t?g.iconZoomIn:g.iconZoomOut,onClick:t?d:p,onFocus:()=>{c.current=!0},onBlur:()=>{c.current=!1}})});function Uo(){const e=n.useRef(null),t=n.useRef(null),{focus:r}=ce(),o=n.useCallback(s=>{var l,a;!((l=s.current)===null||l===void 0)&&l.disabled?r():(a=s.current)===null||a===void 0||a.focus()},[r]),i=n.useCallback(()=>o(e),[o]),c=n.useCallback(()=>o(t),[o]);return n.createElement(n.Fragment,null,n.createElement(It,{zoomIn:!0,ref:e,onLoseFocus:c}),n.createElement(It,{ref:t,onLoseFocus:i}))}function Xo(){const{render:e}=G(),t=st();return e.buttonZoom?n.createElement(n.Fragment,null,e.buttonZoom(t)):n.createElement(Uo,null)}function Yo(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function zo({current:e,preload:t},{type:r,source:o}){switch(r){case"fetch":return e?{current:e,preload:o}:{current:o};case"done":return o===t?{current:o}:{current:e,preload:t};default:throw new Error(Vt)}}function Ho(e){var t,r;const[{current:o,preload:i},c]=n.useReducer(zo,{}),{slide:s,rect:l,imageFit:a,render:d,interactive:p}=e,u=s.srcSet.sort((M,k)=>M.width-k.width),g=(t=s.width)!==null&&t!==void 0?t:u[u.length-1].width,h=(r=s.height)!==null&&r!==void 0?r:u[u.length-1].height,m=nt(s,a),f=Math.max(...u.map(M=>M.width)),b=Math.min((m?Math.max:Math.min)(l.width,g*(l.height/h)),f),_=Rn(),P=D(()=>{var M;const k=(M=u.find(E=>E.width>=b*_))!==null&&M!==void 0?M:u[u.length-1];(!o||u.findIndex(E=>E.src===o)<u.findIndex(E=>E===k))&&c({type:"fetch",source:k.src})});re(P,[l.width,l.height,_,P]);const I=D(M=>c({type:"done",source:M})),L={WebkitTransform:p?"initial":"translateZ(0)"};return m||Object.assign(L,l.width/l.height<g/h?{width:"100%",height:"auto"}:{width:"auto",height:"100%"}),n.createElement(n.Fragment,null,i&&i!==o&&n.createElement(Se,{key:"preload",...e,offset:void 0,slide:{...s,src:i,srcSet:void 0},style:{position:"absolute",visibility:"hidden",...L},onLoad:()=>I(i),render:{...d,iconLoading:()=>null,iconError:()=>null}}),o&&n.createElement(Se,{key:"current",...e,slide:{...s,src:o,srcSet:void 0},style:L}))}function Bo({render:e,slide:t,offset:r,rect:o}){var i;const[c,s]=n.useState(),l=n.useRef(null),a=fe(t),{zoom:d,maxZoom:p,offsetX:u,offsetY:g,setZoomWrapper:h}=st(),m=d>1,{carousel:f,on:b}=G(),{currentIndex:_}=le();re(()=>{if(r!==0||a||!l.current)return()=>{};const I=()=>{const M=l.current;if(!M)return;let k=0,E=0;for(const N of M.children)N instanceof HTMLElement&&(k=Math.max(k,N.offsetWidth),E=Math.max(E,N.offsetHeight));s(N=>N&&N.width===k&&N.height===E?N:{width:k,height:E})};if(I(),typeof ResizeObserver>"u")return()=>{};const L=new ResizeObserver(I);for(const M of l.current.children)L.observe(M);return()=>L.disconnect()},[r,a,o]),re(()=>r===0?(h({zoomWrapperRef:l,imageDimensions:c}),()=>h(void 0)):()=>{},[r,c,h]);let P=(i=e.slide)===null||i===void 0?void 0:i.call(e,{slide:t,offset:r,rect:o,zoom:d,maxZoom:p});if(!P&&a){const I={slide:t,offset:r,rect:o,render:e,imageFit:f.imageFit,imageProps:f.imageProps,onClick:r===0?()=>{var L;return(L=b.click)===null||L===void 0?void 0:L.call(b,{index:_})}:void 0};P=Yo(t)?n.createElement(Ho,{...I,slide:t,interactive:m,rect:r===0?{width:o.width*d,height:o.height*d}:o}):n.createElement(Se,{onLoad:L=>s({width:L.naturalWidth,height:L.naturalHeight}),...I})}return P?n.createElement("div",{ref:l,className:oe(T(Cn),T(Ke),T(kt),m&&T(Pn)),style:r===0?{transform:`scale(${d}) translateX(${u}px) translateY(${g}px)`}:void 0},P):null}const Ko=({augment:e,addModule:t})=>{e(({zoom:r,toolbar:o,render:i,controller:c,...s})=>{const l=ln(r);return{zoom:l,toolbar:kn(o,mt,n.createElement(Xo,null)),render:{...i,slide:a=>{var d,p;return fe(a.slide)||a.slide.type!=null&&(!((d=l.supports)===null||d===void 0)&&d.includes(a.slide.type))?n.createElement(Bo,{render:i,...a}):(p=i.slide)===null||p===void 0?void 0:p.call(i,a)}},controller:{...c,preventDefaultWheelY:l.scrollToZoom},...s}}),t(se(mt,$o))};function qo({src:e,alt:t,open:r,onClose:o}){return gn.jsx(No,{open:r,close:o,slides:[{src:e,alt:t}],plugins:[Ko],zoom:{scrollToZoom:!0,maxZoomPixelRatio:5},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.85)",backdropFilter:"blur(8px)"},toolbar:{background:"transparent",padding:"16px"},button:{backgroundColor:"rgba(255, 255, 255, 0.1)",borderRadius:"9999px",color:"#fff",width:40,height:40},icon:{width:20,height:20}},animation:{fade:200}})}export{qo as default};
|