@a9n-shoji/rvw 0.4.0 → 0.4.2
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/CHANGELOG.md +26 -0
- package/README.md +4 -0
- package/dist/cli.mjs +660 -155
- package/dist/cli.mjs.map +3 -3
- package/dist/web/assets/DocumentViewer-CWTnSlpG.js +1420 -0
- package/dist/web/assets/{FileIcon-AhP8Ezk9.js → FileIcon-wDKKQgGv.js} +94 -94
- package/dist/web/assets/{MarkdownTable-Clfr8wUw.js → MarkdownTable-IiPLNTUX.js} +1 -1
- package/dist/web/assets/{MermaidExpandedView-BjmXfluL.js → MermaidExpandedView-BT6F4F2R.js} +2 -2
- package/dist/web/assets/{MermaidSurface-B2Z3pJme.js → MermaidSurface-CKiZv7R8.js} +1 -1
- package/dist/web/assets/StructureViewer-u7de1S8C.js +5 -0
- package/dist/web/assets/{CommentThread-dsad9VaW.js → WalkthroughPanel-D2KqSIf9.js} +20 -20
- package/dist/web/assets/WalkthroughViewer-BDb-99Qk.js +43 -0
- package/dist/web/assets/index-B0xRoLW2.css +1 -0
- package/dist/web/assets/index-DUZmOKYW.js +11 -0
- package/dist/web/index.html +5 -5
- package/migrations/017_domain_revisions.sql +14 -0
- package/package.json +1 -1
- package/dist/web/assets/DocumentViewer-CPq2FCqU.js +0 -1414
- package/dist/web/assets/StructureViewer-CyDDQwHl.js +0 -1
- package/dist/web/assets/WalkthroughViewer-c3XUP0RH.js +0 -43
- package/dist/web/assets/index-CWOtOTHG.js +0 -11
- package/dist/web/assets/index-D_e3Zku8.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./MermaidSurface-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./MermaidSurface-CKiZv7R8.js";import{c as n,l as r}from"./FileIcon-wDKKQgGv.js";var i=e(r(),1),a=t(),o=n(),s=new Set([`blockquote`,`details`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`ol`,`p`,`pre`,`table`,`ul`]);function c(e,t){e.properties??={};let n=e.properties.className,r=Array.isArray(n)?n.map(String):typeof n==`string`?n.split(/\s+/u).filter(Boolean):[];r.includes(t)||r.push(t),e.properties.className=r}function l(e){return{dataRvwSourceStartLine:e.start.line,dataRvwSourceEndLine:e.end.line}}function u(e,t){let n=e.value??``,r=e.position??t;if(!r)return[e];let i=n.split(`
|
|
2
2
|
`);if(i.length===1)return[{type:`element`,tagName:`span`,properties:{...l(r),dataRvwSourceLeaf:`true`},children:[{type:`text`,value:n}],position:r}];let a=[];for(let[e,t]of i.entries()){if(e===i.length-1&&t===``&&n.endsWith(`
|
|
3
3
|
`))continue;let o=Math.min(r.start.line+e,r.end.line);t&&a.push({type:`element`,tagName:`span`,properties:{dataRvwSourceStartLine:o,dataRvwSourceEndLine:o,dataRvwSourceLeaf:`true`},children:[{type:`text`,value:t}],position:{start:{line:o},end:{line:o}}}),e<i.length-1&&a.push({type:`text`,value:`
|
|
4
4
|
`})}return a}function d(e,t,n){if(!e||t===void 0)return;let r=Math.max(1,n.split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DCGa16l5.js","assets/rolldown-runtime-hePW80VL.js","assets/preload-helper-Czpn1I53.js","assets/lib-p2IERBh0.js","assets/ccount-DFmD81E1.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,r as n,t as r}from"./MermaidSurface-
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,r as n,t as r}from"./MermaidSurface-CKiZv7R8.js";import{a as i,c as a,i as o,l as s,t as c}from"./FileIcon-wDKKQgGv.js";import{t as l}from"./preload-helper-Czpn1I53.js";var u=e(s(),1),d=t(),f=a(),p=[.5,.75,1,1.25,1.5,2,3],m=4,h=380,g=300,_=640,v=360,y=6;function b(e,t,n){return Math.min(n,Math.max(t,e))}function x(e){return Math.max(g,Math.min(_,e-v-y))}function ee(e){return Array.from(e.querySelectorAll(`button:not([disabled]), a[href], input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hidden&&e.getClientRects().length>0)}function te(e){let t=e.querySelector(`svg`);if(!t)return null;let n=t.viewBox.baseVal;if(n.width>0&&n.height>0)return{width:n.width,height:n.height};let r=t.width.baseVal.value,i=t.height.baseVal.value;return r>0&&i>0?{width:r,height:i}:null}function S(e,t){if(e?.availability!==`available`||e.text===null)return null;let n=e.text.split(`
|
|
3
3
|
`),r=t.startLine??1,i=t.startLine===null?Math.min(n.length,32):t.endLine??t.startLine,a=Math.max(1,r-m),o=Math.min(n.length,i+m);return{start:a,end:o,referencedStart:r,referencedEnd:i,lines:n.slice(a-1,o)}}function ne(){return(0,f.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,children:(0,f.jsx)(`path`,{d:`M3 8h10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`})})}function re(){return(0,f.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,children:(0,f.jsx)(`path`,{d:`M3 8h10M8 3v10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`})})}function ie(){return(0,f.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,children:(0,f.jsx)(`path`,{d:`M2.25 3.5A1.25 1.25 0 0 1 3.5 2.25h9A1.25 1.25 0 0 1 13.75 3.5v6A1.25 1.25 0 0 1 12.5 10.75H7l-3.25 2.5v-2.5H3.5A1.25 1.25 0 0 1 2.25 9.5v-6Z`,fill:`none`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.25`})})}function ae(){return(0,f.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,children:(0,f.jsx)(`path`,{d:`m3.5 3.5 9 9m0-9-9 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`})})}function oe({peek:e,document:t,loading:n,error:r,onBack:i,onOpenInReview:a}){let o=(0,u.useRef)(null),s=(0,u.useMemo)(()=>S(t,e.reference),[t,e.reference]),l=e.reference.startLine===null?null:e.reference.endLine??e.reference.startLine,d=e.reference.startLine===null?`File`:e.reference.startLine===l?`L${e.reference.startLine}`:`L${e.reference.startLine}–L${l}`;return(0,u.useEffect)(()=>{o.current?.focus()},[]),(0,f.jsxs)(`div`,{className:`mermaid-reference-peek`,children:[(0,f.jsxs)(`header`,{children:[(0,f.jsx)(`button`,{ref:o,className:`button--back`,onClick:i,children:`← Comments`}),(0,f.jsxs)(`div`,{className:`mermaid-reference-location`,children:[(0,f.jsx)(c,{path:e.reference.path,kind:`file`}),(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`strong`,{title:e.reference.path,children:e.reference.path}),(0,f.jsx)(`small`,{children:d})]})]})]}),(0,f.jsx)(`div`,{className:`mermaid-reference-source`,children:n?(0,f.jsx)(`p`,{role:`status`,children:`参照先を読み込んでいます…`}):r?(0,f.jsx)(`p`,{className:`form-error`,role:`alert`,children:r.message}):t?.availability===`available`?s?(0,f.jsx)(w,{excerpt:s,path:e.reference.path,lineLabel:d}):null:(0,f.jsx)(`p`,{role:`status`,children:`この参照先はテキストとして表示できません。`})}),(0,f.jsx)(`footer`,{children:(0,f.jsx)(`button`,{title:`Cmd/Ctrl+clickで右ペインに開く`,onClick:e=>a(e.metaKey||e.ctrlKey),children:`Open in review`})})]})}function C({excerpt:e,label:t}){return(0,f.jsx)(`pre`,{"aria-label":t,"data-syntax-highlighted":`false`,children:e.lines.map((t,n)=>{let r=e.start+n,i=r>=e.referencedStart&&r<=e.referencedEnd;return(0,f.jsxs)(`span`,{className:i?`is-referenced`:void 0,"data-line":r,children:[(0,f.jsx)(`span`,{"aria-hidden":`true`,children:r}),(0,f.jsx)(`code`,{children:t||` `})]},r)})})}function w({excerpt:e,path:t,lineLabel:n}){let[r,i]=(0,u.useState)(null),a=`${t} ${n} のソース抜粋`;return(0,u.useEffect)(()=>{let n=!0;return i(null),(async()=>{let{getFiletypeFromFileName:r,getSharedHighlighter:a}=await l(async()=>{let{getFiletypeFromFileName:e,getSharedHighlighter:t}=await import(`./dist-DCGa16l5.js`).then(e=>e.t);return{getFiletypeFromFileName:e,getSharedHighlighter:t}},__vite__mapDeps([0,1,2,3,4])),o=r(t),s=(await a({langs:[o],themes:[`github-light`,`github-dark`]})).codeToHtml(e.lines.join(`
|
|
4
|
-
`),{lang:o,themes:{light:`github-light`,dark:`github-dark`},transformers:[{line(t,n){let r=e.start+n-1;this.addClassToHast(t,`mermaid-reference-code-line`),r>=e.referencedStart&&r<=e.referencedEnd&&this.addClassToHast(t,`is-referenced`),t.properties[`data-line`]=r}}]});n&&i(s)})().catch(e=>{console.error(`Reference peekのsyntax highlightingに失敗しました。`,e)}),()=>{n=!1}},[e,t]),r===null?(0,f.jsx)(C,{excerpt:e,label:a}):(0,f.jsx)(`div`,{className:`mermaid-reference-highlight`,"aria-label":a,"data-syntax-highlighted":`true`,dangerouslySetInnerHTML:{__html:r}})}function T({source:e,themePreference:t,renderIdPrefix:a,review:s,onClose:c}){let l=(0,u.useId)(),m=(0,u.useRef)(null),v=(0,u.useRef)(null),y=(0,u.useRef)(null),S=(0,u.useRef)(null),C=(0,u.useRef)(null),w=(0,u.useRef)(null),T=(0,u.useRef)(null),E=(0,u.useRef)(c),D=(0,u.useRef)(null),O=(0,u.useRef)(s?.diagramReferenceBindings);E.current=c,O.current=s?.diagramReferenceBindings;let[k,A]=(0,u.useState)(!1),[j,M]=(0,u.useState)(h),[N,P]=(0,u.useState)(!1),[F,I]=(0,u.useState)(null),[L,R]=(0,u.useState)(`fit`),[z,se]=(0,u.useState)(null),[B,ce]=(0,u.useState)({width:0,height:0}),[V,le]=(0,u.useState)(0);D.current=F,(0,u.useEffect)(()=>{let e=m.current;T.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let t=document.body.style.overflow,n=Array.from(document.body.children).filter(t=>t instanceof HTMLElement&&t!==e),r=n.map(e=>({element:e,inert:e.inert,ariaHidden:e.getAttribute(`aria-hidden`)}));for(let e of n)e.inert=!0,e.setAttribute(`aria-hidden`,`true`);document.body.style.overflow=`hidden`;let i=window.requestAnimationFrame(()=>y.current?.focus());return()=>{window.cancelAnimationFrame(i),document.body.style.overflow=t;for(let e of r)e.element.inert=e.inert,e.ariaHidden===null?e.element.removeAttribute(`aria-hidden`):e.element.setAttribute(`aria-hidden`,e.ariaHidden);T.current?.isConnected&&T.current.focus()}},[]),(0,u.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>ce({width:e.clientWidth,height:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,u.useEffect)(()=>{let e=w.current;if(!e)return;let t=()=>le(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let H=V>0?x(V):_;(0,u.useEffect)(()=>{M(e=>b(e,g,H))},[H]);let U=z?Math.min(1,Math.max(.05,(B.width-48)/z.width),Math.max(.05,(B.height-48)/z.height)):1,W=L===`fit`?U:L,G=p.filter(e=>e<W-.001).at(-1),K=p.find(e=>e>W+.001),q=L!==`fit`&&G===void 0&&U<W-.001,J=z?z.width*W:void 0,Y=z?z.height*W:void 0,ue=(0,u.useCallback)(e=>{se(te(e)),O.current?.onRendered(e)},[]),X=(0,u.useCallback)(e=>{let t=w.current;if(!t)return;let n=t.getBoundingClientRect(),r=x(n.width);M(b(n.right-e,g,r))},[]),Z=n({queryKey:[`mermaid-reference-peek`,s?.pullRequestId,F?.sourceOid,F?.reference.id,F?.reference.path,F?.reference.startLine,F?.reference.endLine,!!F?.resolveForPeek],queryFn:async()=>{if(!F||!s)throw Error(`参照先がありません。`);if(F.resolveForPeek)return await F.resolveForPeek(F.reference);let
|
|
4
|
+
`),{lang:o,themes:{light:`github-light`,dark:`github-dark`},transformers:[{line(t,n){let r=e.start+n-1;this.addClassToHast(t,`mermaid-reference-code-line`),r>=e.referencedStart&&r<=e.referencedEnd&&this.addClassToHast(t,`is-referenced`),t.properties[`data-line`]=r}}]});n&&i(s)})().catch(e=>{console.error(`Reference peekのsyntax highlightingに失敗しました。`,e)}),()=>{n=!1}},[e,t]),r===null?(0,f.jsx)(C,{excerpt:e,label:a}):(0,f.jsx)(`div`,{className:`mermaid-reference-highlight`,"aria-label":a,"data-syntax-highlighted":`true`,dangerouslySetInnerHTML:{__html:r}})}function T({source:e,themePreference:t,renderIdPrefix:a,review:s,onClose:c}){let l=(0,u.useId)(),m=(0,u.useRef)(null),v=(0,u.useRef)(null),y=(0,u.useRef)(null),S=(0,u.useRef)(null),C=(0,u.useRef)(null),w=(0,u.useRef)(null),T=(0,u.useRef)(null),E=(0,u.useRef)(c),D=(0,u.useRef)(null),O=(0,u.useRef)(s?.diagramReferenceBindings);E.current=c,O.current=s?.diagramReferenceBindings;let[k,A]=(0,u.useState)(!1),[j,M]=(0,u.useState)(h),[N,P]=(0,u.useState)(!1),[F,I]=(0,u.useState)(null),[L,R]=(0,u.useState)(`fit`),[z,se]=(0,u.useState)(null),[B,ce]=(0,u.useState)({width:0,height:0}),[V,le]=(0,u.useState)(0);D.current=F,(0,u.useEffect)(()=>{let e=m.current;T.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let t=document.body.style.overflow,n=Array.from(document.body.children).filter(t=>t instanceof HTMLElement&&t!==e),r=n.map(e=>({element:e,inert:e.inert,ariaHidden:e.getAttribute(`aria-hidden`)}));for(let e of n)e.inert=!0,e.setAttribute(`aria-hidden`,`true`);document.body.style.overflow=`hidden`;let i=window.requestAnimationFrame(()=>y.current?.focus());return()=>{window.cancelAnimationFrame(i),document.body.style.overflow=t;for(let e of r)e.element.inert=e.inert,e.ariaHidden===null?e.element.removeAttribute(`aria-hidden`):e.element.setAttribute(`aria-hidden`,e.ariaHidden);T.current?.isConnected&&T.current.focus()}},[]),(0,u.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>ce({width:e.clientWidth,height:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,u.useEffect)(()=>{let e=w.current;if(!e)return;let t=()=>le(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let H=V>0?x(V):_;(0,u.useEffect)(()=>{M(e=>b(e,g,H))},[H]);let U=z?Math.min(1,Math.max(.05,(B.width-48)/z.width),Math.max(.05,(B.height-48)/z.height)):1,W=L===`fit`?U:L,G=p.filter(e=>e<W-.001).at(-1),K=p.find(e=>e>W+.001),q=L!==`fit`&&G===void 0&&U<W-.001,J=z?z.width*W:void 0,Y=z?z.height*W:void 0,ue=(0,u.useCallback)(e=>{se(te(e)),O.current?.onRendered(e)},[]),X=(0,u.useCallback)(e=>{let t=w.current;if(!t)return;let n=t.getBoundingClientRect(),r=x(n.width);M(b(n.right-e,g,r))},[]),Z=n({queryKey:[`mermaid-reference-peek`,s?.pullRequestId,F?.sourceOid,F?.reference.id,F?.reference.path,F?.reference.startLine,F?.reference.endLine,!!F?.resolveForPeek],queryFn:async({signal:e})=>{if(!F||!s)throw Error(`参照先がありません。`);if(F.resolveForPeek)return await F.resolveForPeek(F.reference,e);let t={kind:`repository-file`,pullRequestId:s.pullRequestId,sourceOid:F.sourceOid,path:F.reference.path},{document:n}=await o(i(t),{signal:e});return{sourceOid:F.sourceOid,reference:F.reference,document:n}},enabled:F!==null&&!!s,staleTime:F?.resolveForPeek?0:1/0}),Q=F&&Z.data?{...F,sourceOid:Z.data.sourceOid,reference:Z.data.reference}:F,de=(0,u.useCallback)((e,t)=>(A(!0),I({sourceOid:e,reference:t}),Promise.resolve(null)),[]),fe=(0,u.useCallback)(e=>{let t=O.current,n=t?.referenceFromTarget(e);return!t||!n?!1:(A(!0),I({sourceOid:t.sourceOid,reference:n,...t.resolveForPeek?{resolveForPeek:t.resolveForPeek}:{},onOpenInReview:t.onOpenInReview}),!0)},[]),$=(0,u.useCallback)(()=>{I(null),window.requestAnimationFrame(()=>S.current?.focus())},[]);return(0,u.useEffect)(()=>{let e=e=>{e.key!==`Escape`||e.isComposing||e.defaultPrevented||v.current?.contains(e.target)||(e.preventDefault(),e.stopPropagation(),D.current?$():E.current())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[$]),(0,d.createPortal)((0,f.jsx)(`div`,{className:`mermaid-expanded-backdrop`,ref:m,children:(0,f.jsxs)(`section`,{className:`mermaid-expanded-view${k&&s?` has-rail`:``}`,ref:v,role:`dialog`,"aria-modal":`true`,"aria-labelledby":l,tabIndex:-1,onKeyDown:e=>{if(e.key===`Tab`){let t=v.current;if(!t)return;let n=ee(t);if(n.length===0){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus());return}if(!(e.key!==`Escape`||e.nativeEvent.isComposing||e.defaultPrevented)){if(e.preventDefault(),e.stopPropagation(),D.current){$();return}E.current()}},children:[(0,f.jsxs)(`header`,{className:`mermaid-expanded-toolbar`,children:[(0,f.jsx)(`strong`,{id:l,children:`Mermaid diagram`}),(0,f.jsxs)(`div`,{className:`mermaid-expanded-actions`,children:[(0,f.jsxs)(`div`,{className:`mermaid-zoom-controls`,"aria-label":`Diagram zoom`,children:[(0,f.jsx)(`button`,{"aria-label":`Zoom out`,title:`Zoom out`,disabled:G===void 0&&!q,onClick:()=>G===void 0?q?R(`fit`):void 0:R(G),children:(0,f.jsx)(ne,{})}),(0,f.jsx)(`button`,{className:L===`fit`?`active`:``,"aria-pressed":L===`fit`,title:`Fit diagram`,onClick:()=>R(`fit`),children:`Fit`}),(0,f.jsx)(`button`,{"aria-label":`Zoom in`,title:`Zoom in`,disabled:K===void 0,onClick:()=>K!==void 0&&R(K),children:(0,f.jsx)(re,{})})]}),s&&(0,f.jsxs)(`button`,{ref:S,className:`mermaid-comments-toggle`,"aria-pressed":k,title:k?`Commentsを閉じる`:`Commentsを開く`,onClick:()=>{A(e=>!e),I(null)},children:[(0,f.jsx)(ie,{}),`Comments`,s.commentCount>0&&(0,f.jsx)(`span`,{children:s.commentCount})]}),(0,f.jsx)(`button`,{ref:y,className:`mermaid-expanded-close`,"aria-label":`Expanded Mermaid viewを閉じる`,title:`Close (Escape)`,onClick:c,children:(0,f.jsx)(ae,{})})]})]}),(0,f.jsxs)(`div`,{className:`mermaid-expanded-workspace${N?` is-resizing`:``}`,ref:w,style:{"--mermaid-review-rail-width":`${j}px`},children:[(0,f.jsx)(`div`,{className:`mermaid-expanded-canvas`,ref:C,role:`region`,"aria-label":`Mermaid diagram canvas`,tabIndex:0,"data-zoom-mode":L===`fit`?`fit`:`manual`,"data-zoom":W.toFixed(3),children:(0,f.jsx)(`div`,{className:`mermaid-expanded-stage`,children:(0,f.jsx)(r,{className:`mermaid-expanded-diagram`,role:s?.diagramReferenceBindings?`group`:`img`,"aria-label":`Expanded Mermaid diagram`,source:e,themePreference:t,renderIdPrefix:`${a}Expanded`,errorClassName:`mermaid-expanded-error`,onRendered:ue,onPointerDown:e=>{e.button!==0||!fe(e.target)||(e.preventDefault(),e.stopPropagation())},onKeyDown:e=>{e.key!==`Enter`&&e.key!==` `||!fe(e.target)||(e.preventDefault(),e.stopPropagation())},style:{...J===void 0?{}:{width:J},...Y===void 0?{}:{height:Y}}})})}),k&&s&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`horizontal-resize-handle mermaid-rail-resize-handle${N?` active`:``}`,role:`separator`,"aria-label":`Comments railの幅を変更`,"aria-orientation":`vertical`,"aria-valuemin":g,"aria-valuemax":Math.round(H),"aria-valuenow":Math.round(j),tabIndex:0,onPointerDown:e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),P(!0),X(e.clientX))},onPointerMove:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&X(e.clientX)},onPointerUp:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),P(!1)},onPointerCancel:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),P(!1)},onLostPointerCapture:()=>P(!1),onDoubleClick:()=>M(b(h,g,H)),onKeyDown:e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),M(t=>b(t+(e.key===`ArrowLeft`?16:-16),g,H)))}}),(0,f.jsx)(`aside`,{className:`mermaid-review-rail`,"aria-label":`Diagram review`,children:F&&Q?(0,f.jsx)(oe,{peek:Q,document:Z.data?.document,loading:Z.isLoading,error:Z.error,onBack:$,onOpenInReview:e=>{let t=F;c(),t.onOpenInReview?t.onOpenInReview(t.reference,e):s.onOpenCodeReference(t.sourceOid,t.reference,e)}}):(0,f.jsxs)(`div`,{className:`mermaid-comments-mode`,children:[(0,f.jsxs)(`header`,{children:[(0,f.jsx)(`strong`,{children:`Comments`}),(0,f.jsx)(`span`,{children:s.commentCount})]}),(0,f.jsx)(`div`,{className:`mermaid-comments-scroll`,children:s.renderComments(de)})]})})]})]})]})}),document.body)}export{T as MermaidExpandedView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BVyLgPb6.js","assets/preload-helper-Czpn1I53.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B6xuSHsQ.js","assets/rolldown-runtime-hePW80VL.js","assets/chunk-I66GZJ75-CEntV2nF.js","assets/chunk-NSK5VX7P-AmYQxFLu.js","assets/dist-v5Q1xZ2K.js","assets/chunk-3NCLNEKW-k0AW8Qyp.js","assets/chunk-4I5QYGJK-q_8xEFmv.js","assets/chunk-WRU74C26-CS8zeNym.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-UBXNYLIW-D4XAD8w6.js","assets/chunk-W5SLKNZC-B8QG_JAG.js","assets/chunk-QR6OTTB3-VIu9ZqqS.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-7Z6QIM7H-B8QX_5g4.js","assets/line-Dah7RomF.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-J7OUQ5F2-XLdTvjUm.js","assets/chunk-ZIRB5QZD-O39ZBUk3.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{c as n,s as r}from"./FileIcon-AhP8Ezk9.js";import{t as i}from"./preload-helper-Czpn1I53.js";var a=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},o=new class extends a{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},s={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},c=new class{#e=s;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function l(e){setTimeout(e,0)}var u=typeof window>`u`||`Deno`in globalThis;function d(){}function f(e,t){return typeof e==`function`?e(t):e}function p(e){return typeof e==`number`&&e>=0&&e!==1/0}function m(e,t){return Math.max(e+(t||0)-Date.now(),0)}function h(e,t){return typeof e==`function`?e(t):e}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==y(o,t.options))return!1}else if(!x(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function v(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(b(t.options.mutationKey)!==b(a))return!1}else if(!x(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function y(e,t){return(t?.queryKeyHashFn||b)(e)}function b(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function x(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!x(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!x(e[r],t[r]))return!1;return!0}return!1}var S=Object.prototype.hasOwnProperty;function C(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ee(e)&&ee(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:S.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=C(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ee(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function te(e){return new Promise(t=>{c.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:C(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var O=Symbol();function k(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===O?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function A(e,t){return typeof e==`function`?e(...t):!!e}function ie(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var j=(()=>{let e=()=>u;return{isServer(){return e()},setIsServer(t){e=t}}})();function M(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ae=l;function oe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ae,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var N=oe(),P=new class extends a{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function se(e){return Math.min(1e3*2**e,3e4)}function F(e){return(e??`online`)!==`online`||P.isOnline()}var I=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function L(e){let t=!1,n=0,r,i=M(),a=()=>i.status!==`pending`,s=t=>{if(!a()){let n=new I(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>o.isFocused()&&(e.networkMode===`always`||P.isOnline())&&e.canRun(),d=()=>F(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(j.isServer()?0:3),o=e.retryDelay??se,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),te(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var R=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),p(this.gcTime)&&(this.#e=c.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(j.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(c.clearTimeout(this.#e),this.#e=void 0)}};function ce(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ie(e,()=>t.signal,()=>n=!0)},u=k(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?re:ne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?le:z,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:z(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function z(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function le(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ue=class extends R{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=H(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=H(this.options);e.data!==void 0&&(this.setState(V(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(d).catch(d):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>g(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>h(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!m(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=k(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ce(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=L({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof I&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof I){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...B(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...V(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),N.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function B(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:F(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function V(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function H(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var U=class extends a{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=M(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),W(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof g(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&K(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||h(this.options.staleTime,this.#t)!==h(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return fe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(d)),t}#g(){this.#b();let e=h(this.options.staleTime,this.#t);if(j.isServer()||this.#r.isStale||!p(e))return;let t=m(this.#r.dataUpdatedAt,e)+1;this.#d=c.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(j.isServer()||g(this.options.enabled,this.#t)===!1||!p(this.#p)||this.#p===0)&&(this.#f=c.setInterval(()=>{(this.options.refetchIntervalInBackground||o.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(c.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(c.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&W(e,t),o=i&&K(e,n,t,r);(a||o)&&(l={...l,...B(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=D(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:q(e,t),refetch:this.refetch,promise:this.#o,isEnabled:g(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=M();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a()}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!w(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){N.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function de(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||g(t.retryOnMount,e)!==!1)}function W(e,t){return de(e,t)||e.state.data!==void 0&&G(e,t,t.refetchOnMount)}function G(e,t,n){if(g(t.enabled,e)!==!1&&h(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&q(e,t)}return!1}function K(e,t,n,r){return(e!==t||g(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&q(e,n)}function q(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(h(t.staleTime,e))}function fe(e,t){return!w(e.getCurrentResult(),t)}var J=e(n(),1),Y=r(),X=J.createContext(void 0),Z=e=>{let t=J.useContext(X);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},pe=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Y.jsx)(X.Provider,{value:e,children:t})),me=J.createContext(!1),he=()=>J.useContext(me);me.Provider;function ge(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var _e=J.createContext(ge()),ve=()=>J.useContext(_e),ye=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?A(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},be=e=>{J.useEffect(()=>{e.clearReset()},[e])},xe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||A(n,[e.error,r])),Se=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ce=(e,t)=>e.isLoading&&e.isFetching&&!t,we=(e,t)=>e?.suspense&&t.isPending,Q=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Te(e,t,n){let r=he(),i=ve(),a=Z(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Se(o),ye(o,i,s),be(i);let l=!a.getQueryCache().get(o.queryHash),[u]=J.useState(()=>new t(a,o)),f=u.getOptimisticResult(o),p=!r&&c;if(J.useSyncExternalStore(J.useCallback(e=>{let t=p?u.subscribe(N.batchCalls(e)):d;return u.updateResult(),t},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),J.useEffect(()=>{u.setOptions(o)},[o,u]),we(o,f))throw Q(o,u,i);if(xe({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!j.isServer()&&Ce(f,r)&&(l?Q(o,u,i):s?.promise)?.catch(d).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?f:u.trackResult(f)}function Ee(e,t){return Te(e,U,t)}var De=t((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.8`})),Oe=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=De()})),ke=Promise.resolve(),$=`(prefers-color-scheme: dark)`;function Ae(){let[e,t]=(0,J.useState)(()=>window.matchMedia($).matches);return(0,J.useEffect)(()=>{let e=window.matchMedia($),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function je({source:e,themePreference:t,renderIdPrefix:n,errorClassName:r,onRendered:a,...o}){let s=(0,J.useId)().replace(/[^A-Za-z0-9]/g,``),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),f=Ae(),p=t===`dark`||t===`system`&&f;return(0,J.useEffect)(()=>d(null),[p,e]),(0,J.useEffect)(()=>{if(!c)return;let t=!1;d(null);let r=`${n}${s}`;return ke=ke.then(async()=>{let{default:n}=await i(async()=>{let{default:e}=await import(`./mermaid.core-BVyLgPb6.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]));n.initialize({startOnLoad:!1,suppressErrorRendering:!0,securityLevel:`strict`,theme:p?`dark`:`base`,flowchart:{htmlLabels:!1,curve:`basis`},themeVariables:p?{primaryColor:`#1f2937`,primaryTextColor:`#f0f6fc`,lineColor:`#8c959f`}:{primaryColor:`#eef5ff`,primaryTextColor:`#24292f`,lineColor:`#57606a`}});let o=await n.render(r,e);t||(c.innerHTML=o.svg,a?.(c))}).catch(e=>{t||d(e instanceof Error?e.message:`diagramを表示できません。`)}).finally(()=>{document.getElementById(`d${r}`)?.remove(),document.getElementById(`i${r}`)?.remove()}),()=>{t=!0}},[c,p,s,a,n,e]),u?(0,Y.jsx)(`div`,{className:r,children:u}):(0,Y.jsx)(`div`,{...o,ref:l})}export{A,v as C,C as D,x as E,o as M,a as N,h as O,y as S,d as T,L as _,Q as a,f as b,xe as c,he as d,pe as f,R as g,ue as h,Se as i,O as j,w as k,be as l,U as m,Oe as n,we as o,Z as p,Ee as r,ye as s,je as t,ve as u,P as v,_ as w,b as x,N as y};
|
|
2
|
+
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{c as n,l as r}from"./FileIcon-wDKKQgGv.js";import{t as i}from"./preload-helper-Czpn1I53.js";var a=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},o=new class extends a{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},s={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},c=new class{#e=s;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function l(e){setTimeout(e,0)}var u=typeof window>`u`||`Deno`in globalThis;function d(){}function f(e,t){return typeof e==`function`?e(t):e}function p(e){return typeof e==`number`&&e>=0&&e!==1/0}function m(e,t){return Math.max(e+(t||0)-Date.now(),0)}function h(e,t){return typeof e==`function`?e(t):e}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==y(o,t.options))return!1}else if(!x(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function v(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(b(t.options.mutationKey)!==b(a))return!1}else if(!x(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function y(e,t){return(t?.queryKeyHashFn||b)(e)}function b(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function x(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!x(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!x(e[r],t[r]))return!1;return!0}return!1}var S=Object.prototype.hasOwnProperty;function C(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ee(e)&&ee(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:S.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=C(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ee(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function te(e){return new Promise(t=>{c.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:C(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var O=Symbol();function k(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===O?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function A(e,t){return typeof e==`function`?e(...t):!!e}function ie(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var j=(()=>{let e=()=>u;return{isServer(){return e()},setIsServer(t){e=t}}})();function M(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ae=l;function oe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ae,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var N=oe(),P=new class extends a{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function se(e){return Math.min(1e3*2**e,3e4)}function F(e){return(e??`online`)!==`online`||P.isOnline()}var I=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function L(e){let t=!1,n=0,r,i=M(),a=()=>i.status!==`pending`,s=t=>{if(!a()){let n=new I(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>o.isFocused()&&(e.networkMode===`always`||P.isOnline())&&e.canRun(),d=()=>F(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(j.isServer()?0:3),o=e.retryDelay??se,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),te(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var R=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),p(this.gcTime)&&(this.#e=c.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(j.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(c.clearTimeout(this.#e),this.#e=void 0)}};function ce(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ie(e,()=>t.signal,()=>n=!0)},u=k(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?re:ne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?le:z,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:z(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function z(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function le(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ue=class extends R{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=H(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=H(this.options);e.data!==void 0&&(this.setState(V(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(d).catch(d):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>g(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>h(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!m(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=k(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ce(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=L({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof I&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof I){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...B(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...V(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),N.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function B(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:F(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function V(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function H(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var U=class extends a{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=M(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),W(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof g(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&K(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||h(this.options.staleTime,this.#t)!==h(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return fe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(d)),t}#g(){this.#b();let e=h(this.options.staleTime,this.#t);if(j.isServer()||this.#r.isStale||!p(e))return;let t=m(this.#r.dataUpdatedAt,e)+1;this.#d=c.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(j.isServer()||g(this.options.enabled,this.#t)===!1||!p(this.#p)||this.#p===0)&&(this.#f=c.setInterval(()=>{(this.options.refetchIntervalInBackground||o.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(c.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(c.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&W(e,t),o=i&&K(e,n,t,r);(a||o)&&(l={...l,...B(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=D(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:q(e,t),refetch:this.refetch,promise:this.#o,isEnabled:g(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=M();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a()}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!w(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){N.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function de(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||g(t.retryOnMount,e)!==!1)}function W(e,t){return de(e,t)||e.state.data!==void 0&&G(e,t,t.refetchOnMount)}function G(e,t,n){if(g(t.enabled,e)!==!1&&h(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&q(e,t)}return!1}function K(e,t,n,r){return(e!==t||g(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&q(e,n)}function q(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(h(t.staleTime,e))}function fe(e,t){return!w(e.getCurrentResult(),t)}var J=e(r(),1),Y=n(),X=J.createContext(void 0),Z=e=>{let t=J.useContext(X);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},pe=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Y.jsx)(X.Provider,{value:e,children:t})),me=J.createContext(!1),he=()=>J.useContext(me);me.Provider;function ge(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var _e=J.createContext(ge()),ve=()=>J.useContext(_e),ye=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?A(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},be=e=>{J.useEffect(()=>{e.clearReset()},[e])},xe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||A(n,[e.error,r])),Se=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ce=(e,t)=>e.isLoading&&e.isFetching&&!t,we=(e,t)=>e?.suspense&&t.isPending,Q=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Te(e,t,n){let r=he(),i=ve(),a=Z(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Se(o),ye(o,i,s),be(i);let l=!a.getQueryCache().get(o.queryHash),[u]=J.useState(()=>new t(a,o)),f=u.getOptimisticResult(o),p=!r&&c;if(J.useSyncExternalStore(J.useCallback(e=>{let t=p?u.subscribe(N.batchCalls(e)):d;return u.updateResult(),t},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),J.useEffect(()=>{u.setOptions(o)},[o,u]),we(o,f))throw Q(o,u,i);if(xe({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!j.isServer()&&Ce(f,r)&&(l?Q(o,u,i):s?.promise)?.catch(d).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?f:u.trackResult(f)}function Ee(e,t){return Te(e,U,t)}var De=t((e=>{var t=r();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(n(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.8`})),Oe=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=De()})),ke=Promise.resolve(),$=`(prefers-color-scheme: dark)`;function Ae(){let[e,t]=(0,J.useState)(()=>window.matchMedia($).matches);return(0,J.useEffect)(()=>{let e=window.matchMedia($),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function je({source:e,themePreference:t,renderIdPrefix:n,errorClassName:r,onRendered:a,...o}){let s=(0,J.useId)().replace(/[^A-Za-z0-9]/g,``),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),f=Ae(),p=t===`dark`||t===`system`&&f;return(0,J.useEffect)(()=>d(null),[p,e]),(0,J.useEffect)(()=>{if(!c)return;let t=!1;d(null);let r=`${n}${s}`;return ke=ke.then(async()=>{let{default:n}=await i(async()=>{let{default:e}=await import(`./mermaid.core-BVyLgPb6.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]));n.initialize({startOnLoad:!1,suppressErrorRendering:!0,securityLevel:`strict`,theme:p?`dark`:`base`,flowchart:{htmlLabels:!1,curve:`basis`},themeVariables:p?{primaryColor:`#1f2937`,primaryTextColor:`#f0f6fc`,lineColor:`#8c959f`}:{primaryColor:`#eef5ff`,primaryTextColor:`#24292f`,lineColor:`#57606a`}});let o=await n.render(r,e);t||(c.innerHTML=o.svg,a?.(c))}).catch(e=>{t||d(e instanceof Error?e.message:`diagramを表示できません。`)}).finally(()=>{document.getElementById(`d${r}`)?.remove(),document.getElementById(`i${r}`)?.remove()}),()=>{t=!0}},[c,p,s,a,n,e]),u?(0,Y.jsx)(`div`,{className:r,children:u}):(0,Y.jsx)(`div`,{...o,ref:l})}export{A,v as C,C as D,x as E,o as M,a as N,h as O,y as S,d as T,L as _,Q as a,f as b,xe as c,he as d,pe as f,R as g,ue as h,Se as i,O as j,w as k,be as l,U as m,Oe as n,we as o,Z as p,Ee as r,ye as s,je as t,ve as u,P as v,_ as w,b as x,N as y};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n,l as r,t as i}from"./FileIcon-wDKKQgGv.js";import{a,c as o,d as s,f as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v}from"./index-DUZmOKYW.js";var y=e(r(),1),b=210,x=64,S=11,C=2;function w(e,t){return e.localeCompare(t,`en`)}function T(e){let t=[...new Set(e)],n=new Map(t.map(e=>[e,e.split(`/`)]));return new Map(t.map(e=>{let r=n.get(e);for(let i=1;i<=r.length;i+=1){let a=r.slice(-i).join(`/`);if(t.every(t=>t===e||n.get(t).slice(-i).join(`/`)!==a))return[e,a]}return[e,e]}))}function E(e,t){let n=e.anchors.flatMap(e=>{let n=t.get(e.path);return n?[n]:[]}),r=[...new Set(n)].sort(w);return{anchorCount:e.anchors.length,changeKind:r.length>1?`mixed`:r.length===1?r[0]:null}}function D(e,t,n=0,r=!1){let i=t[e.from],a=t[e.to];if(!i||!a)return null;let o=i.x+114,s=i.y+56,c=a.x+114,l=a.y+56;if(e.from===e.to){let e=i.x+228,t=i.y,r=n*.3,a=88+Math.abs(n)*.35;return{path:`M ${e+8} ${t+34+r} C ${e+a} ${t-84+r}, ${e+a} ${t+112+84+r}, ${e+8} ${t+112-34+r}`,startX:e+8,startY:t+34+r,control1X:e+a,control1Y:t-84+r,control2X:e+a,control2Y:t+112+84+r,endX:e+8,endY:t+112-34+r,bounds:{left:e+8,top:t-84+r,right:e+a,bottom:t+112+84+r}}}let u=c-o,d=l-s,f=Math.max(1,Math.hypot(u,d)),p=u/f,m=d/f,h=-m,g=p,_=Math.min(114/Math.max(1e-4,Math.abs(p)),56/Math.max(1e-4,Math.abs(m)))+8,v=o+p*_+h*n,y=s+m*_+g*n,b=c-p*_+h*n,x=l-m*_+g*n,S=Math.min(r?168:96,Math.max(r?132:n===0?28:52,f*(r?.18:.1)))+n*.35,C=v+(b-v)*.36+h*S,w=y+(x-y)*.36+g*S,T=v+(b-v)*.64+h*S,E=y+(x-y)*.64+g*S;return{path:`M ${v} ${y} C ${C} ${w}, ${T} ${E}, ${b} ${x}`,startX:v,startY:y,control1X:C,control1Y:w,control2X:T,control2Y:E,endX:b,endY:x,bounds:{left:Math.min(v,C,T,b),top:Math.min(y,w,E,x),right:Math.max(v,C,T,b),bottom:Math.max(y,w,E,x)}}}function O(e){let t=new Set(e.filter(e=>e.directed&&e.from!==e.to).map(e=>JSON.stringify([e.from,e.to])));return new Set(e.filter(e=>e.directed&&e.from!==e.to&&t.has(JSON.stringify([e.to,e.from]))).map(e=>e.id))}function k(e,t,n){let r=1-t,i=r**3*e.startX+3*r**2*t*e.control1X+3*r*t**2*e.control2X+t**3*e.endX,a=r**3*e.startY+3*r**2*t*e.control1Y+3*r*t**2*e.control2Y+t**3*e.endY,o=3*r**2*(e.control1X-e.startX)+6*r*t*(e.control2X-e.control1X)+3*t**2*(e.endX-e.control2X),s=3*r**2*(e.control1Y-e.startY)+6*r*t*(e.control2Y-e.control1Y)+3*t**2*(e.endY-e.control2Y),c=Math.max(1,Math.hypot(o,s));return{x:i+-s/c*n,y:a+o/c*n}}function A(e,t){return!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function j(e,t,n,r,i=0){return{left:e-n/2-i,top:t-r/2-i,right:e+n/2+i,bottom:t+r/2+i}}function ee(e){return e.length===0?null:{left:Math.min(...e.map(e=>e.left)),top:Math.min(...e.map(e=>e.top)),right:Math.max(...e.map(e=>e.right)),bottom:Math.max(...e.map(e=>e.bottom))}}function M(e){return[...e].reduce((e,t)=>e+(/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}/u.test(t)?1:.56),0)}function N(e,t){return/\s/u.test(e)||/[./_-]/u.test(e)||e===`:`&&t===`:`}function P(e,t){let n=[...e.trimEnd()];for(;n.length>0&&M(n.join(``)+`…`)>t;)n.pop();return`${n.join(``).trimEnd()}…`}function te(e,t){let n=e.trim();if(!n)return[``];let r=[];for(;M(n)>t;){let e=[...n],i=0,a=0,o=0;for(let n=0;n<e.length;n+=1){let r=e[n],s=i+M(r);if(s>t&&a>0)break;if(i=s,a=n+1,N(r,e[n+1])){if(r===`:`&&e[n+1]===`:`){if(s+M(e[n+1])<=t)o=n+2;else if(n>0){o=n;break}}else o=n+1}if(i>t)break}let s=Math.min(e.length,o>0?o:Math.max(1,a));if(r.push(e.slice(0,s).join(``).trimEnd()),n=e.slice(s).join(``).trimStart(),!n)break}return n&&r.push(n),r}function F(e){let t=Math.max(.56,e.maxUnits),n=e.text.replaceAll(`\r
|
|
2
|
+
`,`
|
|
3
|
+
`).replaceAll(`\r`,`
|
|
4
|
+
`).split(`
|
|
5
|
+
`).flatMap(e=>te(e,t)),r=e.maxLines??1/0;if(n.length<=r)return n;let i=n.slice(0,Math.max(1,r));return e.ellipsize!==!1&&(i[i.length-1]=P(i[i.length-1],t)),i}function I(e,t,n){let r=Math.ceil(M(e.label)*11.5),i=Math.min(b,Math.max(x,r+S+C)),a=Math.max(1,i-S),o=F({text:e.label,maxUnits:a/11.5,ellipsize:!1}).length,s=Math.max(24,o*14+10),c=E(e,t),l=c.anchorCount>1?4:0,u=n===`source-actions`&&c.anchorCount>0?29+l:0,d=n===`source-actions`?Math.max(s,c.anchorCount>1?34:c.anchorCount===1?26:0):s;return{selectWidth:i,boxWidth:i+u,height:d,source:c}}function L(e,t,n,r,i,a,o){let s=t.flatMap(e=>{let t=n[e.id];return t?[{left:t.x,top:t.y,right:t.x+228,bottom:t.y+112}]:[]}),c=new Map,l=e=>{let t=[],n=Math.floor(e.left/128),r=Math.floor(e.right/128),i=Math.floor(e.top/128),a=Math.floor(e.bottom/128);for(let e=n;e<=r;e+=1)for(let n=i;n<=a;n+=1)t.push(`${e}:${n}`);return t},u=e=>{let t=new Set;for(let n of l(e)){let r=c.get(n);if(r){if(r.saturated)return!0;for(let n of r.boxes)if(!t.has(n)&&(t.add(n),A(e,n)))return!0}}return!1},d=e=>{for(let t of l(e)){let n=c.get(t)??{boxes:[],saturated:!1};n.saturated||(n.boxes.push(e),n.boxes.length>=48&&(n.boxes=[],n.saturated=!0)),c.set(t,n)}},f=[],p=Array.from({length:22},(e,t)=>.08+t*.04).sort((e,t)=>Math.abs(e-.5)-Math.abs(t-.5)),m=[0,12,-12,24,-24,36,-36,48,-48].flatMap(e=>p.map(t=>[t,e])),h=[...e].sort((e,t)=>w(e.id,t.id));for(let[e,t]of h.entries()){let c=D(t,n,i.get(t.id)??0,a.has(t.id));if(!c)continue;let l=I(t,r,o),p=m.map(([e,t])=>k(c,e,t)),h=p.filter(e=>{let t=j(e.x,e.y,l.boxWidth,l.height,4);return!s.some(e=>A(t,e))}),g=h.find(e=>{let t=j(e.x,e.y,l.boxWidth,l.height,5);return!u(t)}),_=h.length>0?h[e%h.length]:void 0,v=g??_??p[e%p.length];d(j(v.x,v.y,l.boxWidth,l.height,4)),f.push({edge:t,source:l.source,x:v.x,y:v.y,selectWidth:l.selectWidth,boxWidth:l.boxWidth,height:l.height,crowded:!g})}return f}function ne(e){let{structure:t,positions:n,sourceChangeKinds:r,selection:i,labelAccessory:a}=e,o=T([...t.nodes.flatMap(e=>e.anchor?[e.anchor.path]:[]),...t.edges.flatMap(e=>e.anchors.map(e=>e.path))]),s=t.nodes.flatMap(e=>{if(!i.nodeIds.has(e.id))return[];let t=n[e.id];return t?[{node:e,point:t,sourceLabel:e.anchor?o.get(e.anchor.path)??e.anchor.path:null,changeKind:e.anchor?r.get(e.anchor.path)??null:null}]:[]}),c=new Set(s.map(({node:e})=>e.id)),l=t.edges.filter(e=>i.edgeIds.has(e.id)&&c.has(e.from)&&c.has(e.to)),u=v(t.edges),d=O(t.edges),f=l.flatMap(e=>{let t=D(e,n,u.get(e.id)??0,d.has(e.id));return t?[{edge:e,geometry:t,source:E(e,r)}]:[]}),p=new Set(f.map(({edge:e})=>e.id)),m=L(l.filter(e=>p.has(e.id)&&i.labelEdgeIds.has(e.id)),s.map(({node:e})=>e),n,r,u,d,a),h=s.map(({point:e})=>({left:e.x,top:e.y,right:e.x+228,bottom:e.y+112}));return h.push(...f.map(({geometry:e})=>e.bounds)),h.push(...m.map(e=>j(e.x,e.y,e.boxWidth,e.height,4))),{nodes:s,edges:f,labels:m,bounds:ee(h)}}function re(e){let{structure:t}=e;return ne({...e,selection:{nodeIds:new Set(t.nodes.map(e=>e.id)),edgeIds:new Set(t.edges.map(e=>e.id)),labelEdgeIds:new Set(t.edges.map(e=>e.id))},labelAccessory:`none`})}var R=class extends Error{code;constructor(e){super(e),this.code=e,this.name=`StructureExportError`}},z=48,B=2,V=16384,ie=32e6,H=.5,U=`ui-monospace, SFMono-Regular, Consolas, Liberation Mono, monospace`,ae=`Arial, Helvetica Neue, sans-serif`,oe=[`default`,`added`,`modified`,`deleted`,`renamed`,`type-changed`,`mixed`],W={background:`--bg`,panel:`--panel`,text:`--text`,muted:`--muted`,line:`--line`,lineStrong:`--line-strong`,accent:`--accent`,success:`--success`,attention:`--attention`,danger:`--danger`,done:`--done`,info:`--info`};function se(e){let t=getComputedStyle(e);return Object.fromEntries(Object.entries(W).map(([e,n])=>{let r=t.getPropertyValue(n).trim();if(!r)throw new R(`INVALID_BOUNDS`);return[e,r]}))}function G(e){let t=``;for(let n of e){let e=n.codePointAt(0);(e===9||e===10||e===13||e>=32&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111)&&(t+=n)}return t}function K(e){return G(e).replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`)}function q(e){if(!Number.isFinite(e))throw new R(`INVALID_BOUNDS`);return Number(e.toFixed(3)).toString()}function J(e,t,n){switch(e){case`added`:return t.success;case`modified`:case`mixed`:return t.attention;case`deleted`:return t.danger;case`renamed`:return t.done;case`type-changed`:return t.info;default:return n}}function Y(e){let t=e.anchor??`start`;return`<text x="${q(e.x)}" y="${q(e.firstY)}" fill="${K(e.fill)}" font-family="${K(e.fontFamily)}" font-size="${q(e.fontSize)}"${e.fontWeight?` font-weight="${e.fontWeight}"`:``} text-anchor="${t}">${e.lines.map((t,n)=>`<tspan x="${q(e.x)}" dy="${n===0?`0`:q(e.lineHeight)}">${K(t)}</tspan>`).join(``)}</text>`}function ce(e){let{node:t,point:n}=e;switch(t.notation){case`database`:return{x:n.x+10,y:n.y+21,width:208,height:84};case`component`:return{x:n.x+22,y:n.y+6,width:198,height:100};case`external`:return{x:n.x+18,y:n.y+6,width:192,height:100};case`concept`:return{x:n.x+24,y:n.y+12,width:180,height:94};default:return{x:n.x+8,y:n.y+6,width:212,height:100}}}function X(e,t,n){let{node:r,point:i}=e,a=i.x,o=i.y,s=`fill="${K(n.panel)}" stroke="${K(t)}" stroke-width="1.4"`;switch(r.notation){case`class`:case`interface`:return`<rect x="${q(a)}" y="${q(o)}" width="228" height="112" rx="2" ${s}${r.notation===`interface`?` stroke-dasharray="5 3"`:``}/>`;case`database`:{let e=a,n=a+228,r=o+10,i=o+112-10;return`<path d="M ${q(e)} ${q(r)} C ${q(e)} ${q(o-3)}, ${q(n)} ${q(o-3)}, ${q(n)} ${q(r)} L ${q(n)} ${q(i)} C ${q(n)} ${q(o+112+3)}, ${q(e)} ${q(o+112+3)}, ${q(e)} ${q(i)} Z" ${s}/><path d="M ${q(e)} ${q(r)} C ${q(e)} ${q(o+23)}, ${q(n)} ${q(o+23)}, ${q(n)} ${q(r)}" fill="none" stroke="${K(t)}" stroke-width="1.2"/>`}case`component`:return`<rect x="${q(a)}" y="${q(o)}" width="228" height="112" rx="3" ${s}/><rect x="${q(a+2)}" y="${q(o+36)}" width="13" height="8" ${s}/><rect x="${q(a+2)}" y="${q(o+52)}" width="13" height="8" ${s}/>`;case`external`:return`<polygon points="${q(a+20)},${q(o)} ${q(a+228-20)},${q(o)} ${q(a+228)},${q(o+56)} ${q(a+228-20)},${q(o+112)} ${q(a+20)},${q(o+112)} ${q(a)},${q(o+56)}" ${s}/>`;case`concept`:return`<rect x="${q(a)}" y="${q(o)}" width="228" height="112" rx="56" ${s}/>`;default:return`<rect x="${q(a)}" y="${q(o)}" width="228" height="112" rx="8" ${s}/>`}}function le(e,t,n){let{node:r,point:i}=e,a=J(e.changeKind,n,n.lineStrong),o=ce(e),s=e.sourceLabel?F({text:e.sourceLabel,maxUnits:o.width/10,maxLines:1,ellipsize:!0}):[],c=s.length>0?17:0,l=s.length>0?3:4,u=F({text:r.label,maxUnits:o.width/11,maxLines:l,ellipsize:!0}),d=14.5,f=Math.max(1,u.length)*d,p=o.y+c+f+3,m=12.6,h=Math.max(0,Math.floor((o.y+o.height-p)/m)),g=h>0?F({text:r.description??`Producerによる説明なし`,maxUnits:o.width/9,maxLines:h,ellipsize:!0}):[],_=r.notation===`class`||r.notation===`interface`?`<line x1="${q(o.x)}" y1="${q(p-2)}" x2="${q(o.x+o.width)}" y2="${q(p-2)}" stroke="${K(a)}" stroke-width="1"/>`:``,v=(()=>{switch(r.notation){case`external`:return{x:i.x+22,top:i.y+16,bottom:i.y+112-16};case`concept`:return{x:i.x+20,top:i.y+24,bottom:i.y+112-24};case`database`:return{x:i.x+5,top:i.y+18,bottom:i.y+112-18};case`component`:return{x:i.x+18,top:i.y+10,bottom:i.y+112-10};default:return{x:i.x+4,top:i.y+10,bottom:i.y+112-10}}})(),y=r.id===t.originNodeId?`<line data-node-origin-mark="true" x1="${q(v.x)}" y1="${q(v.top)}" x2="${q(v.x)}" y2="${q(v.bottom)}" stroke="${K(n.accent)}" stroke-width="4" stroke-linecap="round"/>`:``,b=s.length>0?Y({lines:s,x:o.x,firstY:o.y+10,lineHeight:12,fontSize:10,fontFamily:U,fill:n.muted,fontWeight:600}):``,x=o.y+c+10,S=Y({lines:u,x:o.x,firstY:x,lineHeight:d,fontSize:11,fontFamily:U,fill:n.text,fontWeight:700}),C=g.length>0?Y({lines:g,x:o.x,firstY:p+9,lineHeight:m,fontSize:9,fontFamily:ae,fill:n.muted}):``;return`<g data-node-id="${K(r.id)}" data-node-notation="${K(r.notation)}"${r.id===t.originNodeId?` data-origin-node="true"`:``}${e.changeKind?` data-source-change-kind="${K(e.changeKind)}"`:``}>${X(e,a,n)}${y}<g data-node-content="true">${b}${S}${_}${C}</g><title>${K(r.label)}</title><desc>${K(r.description??``)}</desc></g>`}function ue(e,t){let n=e.nodes.length===t.nodes.length&&e.edges.length===t.edges.length&&e.labels.length===t.edges.length&&e.bounds!==null,r=e.bounds?[e.bounds.left,e.bounds.top,e.bounds.right,e.bounds.bottom].every(Number.isFinite):!1;if(!n||!r)throw new R(`INCOMPLETE_LAYOUT`)}function de(e,t){let n=J(e.source.changeKind,t,t.accent),r=Math.max(1,(e.selectWidth-11)/11.5),i=F({text:e.edge.label,maxUnits:r,ellipsize:!1}),a=-((i.length-1)*14)/2+3.5;return`<g data-edge-label-id="${K(e.edge.id)}" transform="translate(${q(e.x)} ${q(e.y)})"${e.crowded?` data-crowded="true"`:``}><rect x="${q(-e.selectWidth/2)}" y="${q(-e.height/2)}" width="${q(e.selectWidth)}" height="${q(e.height)}" rx="${q(e.height/2)}" fill="${K(t.panel)}" stroke="${K(n)}" stroke-width="1"${e.crowded?` stroke-dasharray="4 3"`:``}/>${Y({lines:i,x:0,firstY:a,lineHeight:14,fontSize:10,fontFamily:ae,fill:n,anchor:`middle`})}<title>${K(e.edge.label)}</title></g>`}function fe(e){return e??`default`}function Z(e){return`rvw-structure-arrow-${e}`}function pe(e,t){return J(e==="default"?null:e,t,t.muted)}function me(e){return oe.map(t=>{let n=pe(t,e);return`<marker id="${Z(t)}" data-edge-marker-kind="${t}" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto" markerUnits="strokeWidth"><path d="M 0 0 L 10 5 L 0 10 z" fill="${K(n)}"/></marker>`}).join(``)}function he(e){let{structure:t,model:n,palette:r}=e;ue(n,t);let i=n.bounds,a=Math.floor(i.left-z),o=Math.floor(i.top-z),s=Math.ceil(i.right+z),c=Math.ceil(i.bottom+z),l=s-a,u=c-o;if(![a,o,l,u].every(Number.isFinite)||l<=0||u<=0)throw new R(`INVALID_BOUNDS`);let d=n.edges.map(({edge:e,geometry:t,source:n})=>{let i=fe(n.changeKind),a=pe(i,r);return`<path data-edge-id="${K(e.id)}" d="${K(t.path)}" fill="none" stroke="${K(a)}" stroke-width="1.4" opacity="${n.changeKind?`0.76`:`0.58`}"${e.directed?` marker-end="url(#${Z(i)})"`:``}/>`}).join(``),f=n.labels.map(e=>de(e,r)).join(``),p=n.nodes.map(e=>le(e,t,r)).join(``);return{source:`<?xml version="1.0" encoding="UTF-8"?>\n<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${u}" viewBox="${a} ${o} ${l} ${u}" role="img" aria-labelledby="rvw-structure-title rvw-structure-description" data-rvw-structure-id="${K(t.id)}" data-rvw-source-oid="${K(t.sourceOid)}"><title id="rvw-structure-title">${K(t.title)}</title><desc id="rvw-structure-description">${K(t.scope)}</desc><defs>${me(r)}</defs><rect x="${a}" y="${o}" width="${l}" height="${u}" fill="${K(r.background)}"/><g data-layer="edges">${d}</g><g data-layer="edge-labels">${f}</g><g data-layer="nodes">${p}</g></svg>`,width:l,height:u,viewBox:{x:a,y:o,width:l,height:u}}}function ge(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)throw new R(`INVALID_BOUNDS`);let n=Math.min(B,V/e,V/t,Math.sqrt(ie/(e*t)));if(!Number.isFinite(n)||n<H)throw new R(`PNG_TOO_LARGE`);return{scale:n,pixelWidth:Math.max(1,Math.floor(e*n)),pixelHeight:Math.max(1,Math.floor(t*n)),downscaled:n<B}}function _e(e,t){return e.source.replace(/(<svg\b[^>]*\bwidth=")[^"]*(")/u,`$1${t.pixelWidth}$2`).replace(/(<svg\b[^>]*\bheight=")[^"]*(")/u,`$1${t.pixelHeight}$2`)}async function ve(e,t){let n=new Blob([_e(e,t)],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n);try{let e=new Image;e.decoding=`async`,await new Promise((t,n)=>{e.onload=()=>t(),e.onerror=()=>n(new R(`PNG_DECODE_FAILED`)),e.src=r});let n=window.document.createElement(`canvas`);n.width=t.pixelWidth,n.height=t.pixelHeight;let i=n.getContext(`2d`);if(!i)throw new R(`PNG_ENCODE_FAILED`);return i.drawImage(e,0,0,t.pixelWidth,t.pixelHeight),await new Promise((e,t)=>{n.toBlob(n=>n?e(n):t(new R(`PNG_ENCODE_FAILED`)),`image/png`)})}finally{URL.revokeObjectURL(r)}}function ye(e,t){return`rvw-structure-${[...G(e.title).replace(/[<>:"\\|?*]+|\//gu,`-`).replace(/\s+/gu,`-`).replace(/-+/gu,`-`).replace(/^[.\s-]+|[.\s-]+$/gu,``)].slice(0,80).join(``)||`structure`}-${e.sourceOid.slice(0,8)}.${t}`}function be(e,t){let n=URL.createObjectURL(e),r=window.document.createElement(`a`);r.href=n,r.download=t,r.style.display=`none`,window.document.body.append(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),0)}function xe(e){if(e instanceof R)switch(e.code){case`INCOMPLETE_LAYOUT`:return`Structure全体の配置を構築できませんでした。レイアウトを戻して再実行してください。`;case`PNG_TOO_LARGE`:return`図がPNGの安全なサイズを超えています。SVGを使用するか、Node配置を近づけてから再実行してください。`;case`PNG_DECODE_FAILED`:return`Structure SVGをPNGへ変換できませんでした。SVG形式で再実行してください。`;case`PNG_ENCODE_FAILED`:return`PNGファイルを生成できませんでした。SVG形式で再実行してください。`;case`INVALID_BOUNDS`:return`Structureの出力範囲を計算できませんでした。`}return e instanceof Error?e.message:`Structureをエクスポートできませんでした。`}var Q=t();function Se({disabled:e,exporting:t,onExport:n}){let r=(0,y.useRef)(null),i=e=>{r.current?.removeAttribute(`open`),n(e)};return(0,Q.jsxs)(`details`,{className:`structure-export-menu`,ref:r,children:[(0,Q.jsxs)(`summary`,{className:`structure-header-action`,"aria-label":`Structureをエクスポート`,"aria-disabled":e,onClick:t=>{e&&t.preventDefault()},children:[t?`${t.toUpperCase()}…`:`Export`,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`▾`})]}),(0,Q.jsxs)(`div`,{className:`structure-export-popover`,children:[(0,Q.jsxs)(`button`,{type:`button`,disabled:e,onClick:()=>i(`svg`),children:[(0,Q.jsx)(`strong`,{children:`SVG`}),(0,Q.jsx)(`span`,{children:`全体・ベクター`})]}),(0,Q.jsxs)(`button`,{type:`button`,disabled:e,onClick:()=>i(`png`),children:[(0,Q.jsx)(`strong`,{children:`PNG`}),(0,Q.jsx)(`span`,{children:`全体・2×`})]}),(0,Q.jsx)(`p`,{children:`現在の配置で、全Node・全Relation・全Edge labelを書き出します。`})]})]})}var Ce=2,we=.005,Te=.002;function $(e){return e.startLine===null?e.path:`${e.path}:${e.startLine}${e.endLine===e.startLine?``:`-${e.endLine}`}`}function Ee({anchor:e,compact:t=!1,onOpen:n}){let r=`${$(e)}を開く`;return(0,Q.jsxs)(`button`,{type:`button`,className:`structure-source${t?` compact`:``}`,title:r,"aria-label":r,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),n(e.metaKey||e.ctrlKey)},children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`</>`}),!t&&(0,Q.jsx)(`span`,{children:$(e)})]})}function De({edge:e,onOpen:t}){return e.anchors.length===0?null:e.anchors.length===1?(0,Q.jsx)(Ee,{compact:!0,anchor:e.anchors[0],onOpen:n=>t({kind:`edge`,edgeId:e.id,anchorIndex:0},e.anchors[0],n)}):(0,Q.jsxs)(`details`,{className:`structure-edge-sources`,children:[(0,Q.jsxs)(`summary`,{className:`structure-source compact`,"aria-label":`${e.label}のsource evidence ${e.anchors.length}件を表示`,title:`source evidence ${e.anchors.length}件`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`</>`}),(0,Q.jsx)(`span`,{className:`structure-edge-source-count`,"aria-hidden":`true`,children:e.anchors.length})]}),(0,Q.jsx)(`div`,{className:`structure-edge-source-menu`,children:e.anchors.map((n,r)=>(0,Q.jsx)(Ee,{anchor:n,onOpen:i=>t({kind:`edge`,edgeId:e.id,anchorIndex:r},n,i)},`${e.id}:${r}`))})]})}function Oe({anchor:e,changeKind:t,sourceLabel:n}){return(0,Q.jsxs)(`span`,{className:`structure-source-identity`,"data-source-path":e.path,"data-source-change-kind":t??void 0,title:e.path,children:[(0,Q.jsx)(i,{path:e.path,kind:`file`}),t&&(0,Q.jsx)(m,{kind:t}),(0,Q.jsx)(`span`,{className:`structure-source-name`,children:n})]})}function ke({label:e}){let t=e.split(/(::|[./_-])/u);return(0,Q.jsx)(Q.Fragment,{children:t.map((e,t)=>(0,Q.jsxs)(y.Fragment,{children:[e,(e===`::`||/^[./_-]$/u.test(e))&&(0,Q.jsx)(`wbr`,{})]},`${t}-${e}`))})}function Ae({structure:e,positions:t,focusedNodeId:n,viewport:r,viewportElement:i}){let a=s(e.nodes.map(e=>e.id),t);if(!a)return null;let o=Math.max(1,a.maxX-a.minX),c=Math.max(1,a.maxY-a.minY),l=Math.min(164/o,98/c),u=i?{x:-r.x/r.scale,y:-r.y/r.scale,width:i.clientWidth/r.scale,height:i.clientHeight/r.scale}:null,d=e=>(e-a.minX)*l,f=e=>(e-a.minY)*l;return(0,Q.jsxs)(`svg`,{className:`structure-minimap`,viewBox:`0 0 164 98`,"aria-label":`Structure minimap`,children:[e.nodes.map(e=>{let r=t[e.id];return r?(0,Q.jsx)(`circle`,{cx:d(r.x+114),cy:f(r.y+56),r:e.id===n?3.2:1.7,className:e.id===n?`focused`:``},e.id):null}),u&&(0,Q.jsx)(`rect`,{className:`structure-minimap-viewport`,x:d(u.x),y:f(u.y),width:Math.max(2,u.width*l),height:Math.max(2,u.height*l)})]})}function je({paneId:e,pullRequestId:t,structure:r,changedFiles:i,navigationTarget:s=null,onNavigationApplied:m,onNavigationFailed:v,onOpenSource:b,onDeleted:x}){let S=`structure-${e}-${r.id}`,C=l(e,r.id),w=C??f(r),[T,E]=(0,y.useState)(w.focusId),[D,O]=(0,y.useState)(w.selectedEdgeId),[k,A]=(0,y.useState)(w.depth),[j,ee]=(0,y.useState)(w.positions),[M,N]=(0,y.useState)(w.viewport),[P,te]=(0,y.useState)({width:0,height:0}),[F,I]=(0,y.useState)(null),[L,R]=(0,y.useState)(null),[z,B]=(0,y.useState)(!1),V=(0,y.useRef)(null),ie=(0,y.useRef)(w.surfaceSize),H=(0,y.useRef)(T),U=(0,y.useRef)(j),ae=(0,y.useRef)({sourceOid:r.sourceOid,updatedAt:r.updatedAt}),oe=(0,y.useRef)(C?null:`initial`),W=(0,y.useRef)(null),G=(0,y.useRef)(null),K=(0,y.useRef)(null);H.current=T,U.current=j,(0,y.useLayoutEffect)(()=>{let e=V.current;if(!e)return;let t=()=>{let t={width:e.clientWidth,height:e.clientHeight};if(t.width===0||t.height===0)return;let n=ie.current;ie.current=t,te(t),n.width!==0&&n.height!==0&&N(e=>{let r={...e,x:e.x+(t.width-n.width)/2,y:e.y+(t.height-n.height)/2},i=H.current?U.current[H.current]:void 0;if(!i)return r;let a=228*r.scale,o=112*r.scale,s=r.x+i.x*r.scale,c=r.y+i.y*r.scale;return a>t.width-24?r.x=t.width/2-(i.x+114)*r.scale:s<12?r.x+=12-s:s+a>t.width-12&&(r.x-=s+a-(t.width-12)),o>t.height-24?r.y=t.height/2-(i.y+56)*r.scale:c<12?r.y+=12-c:c+o>t.height-12&&(r.y-=c+o-(t.height-12)),r})};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,y.useEffect)(()=>{let e=V.current;if(!e)return;let t=t=>{let n=t.ctrlKey||t.metaKey;if(t.target instanceof Element){let e=t.target.closest(`.structure-node-focus`),r=Math.abs(t.deltaY)>=Math.abs(t.deltaX),i=e?t.deltaY<0?e.scrollTop>0:t.deltaY>0&&e.scrollTop+e.clientHeight<e.scrollHeight-1:!1;if(!n&&r&&i)return}t.preventDefault(),t.stopPropagation();let r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?16:t.deltaMode===WheelEvent.DOM_DELTA_PAGE?Math.max(1,e.clientHeight):1;if(!n){N(e=>({...e,x:e.x-t.deltaX*r*Ce,y:e.y-t.deltaY*r*Ce}));return}let i=e.getBoundingClientRect(),o=t.clientX-i.left,s=t.clientY-i.top;N(e=>{let n=t.ctrlKey&&!t.metaKey?we:Te,i=a(e.scale,Math.exp(-t.deltaY*r*n)),c=(o-e.x)/e.scale,l=(s-e.y)/e.scale;return{scale:i,x:o-c*i,y:s-l*i}})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,y.useEffect)(()=>{if(l(e,r.id)?.updatedAt===r.updatedAt)return;let t=ae.current;t.updatedAt!==r.updatedAt&&I(t.sourceOid===r.sourceOid?`Structureが更新されました。閲覧状態を保ったまま最新のclaimへ反映しています。`:`Structureが更新されました。exact source ${t.sourceOid.slice(0,8)} → ${r.sourceOid.slice(0,8)}`),ae.current={sourceOid:r.sourceOid,updatedAt:r.updatedAt},ee(e=>u(r,e));let n=H.current&&r.nodes.some(e=>e.id===H.current)?H.current:null;E(n),n===null&&A(`all`),O(e=>e&&r.edges.some(t=>t.id===e)?e:null)},[e,r,r.updatedAt]),(0,y.useEffect)(()=>{p(e,r.id,{focusId:T,selectedEdgeId:D,depth:k,positions:j,viewport:M,surfaceSize:ie.current,updatedAt:r.updatedAt})},[k,T,j,e,D,r.updatedAt,M]);let q=(0,y.useMemo)(()=>c(r,T,k),[k,T,r]),J=(0,y.useMemo)(()=>new Map(r.nodes.map(e=>[e.id,e])),[r.nodes]),Y=T?J.get(T)??null:null,ce=J.get(r.originNodeId),X=D?r.edges.find(e=>e.id===D)??null:null,le=(0,y.useMemo)(()=>new Set(X?[X.from,X.to]:[]),[X]),ue=(0,y.useMemo)(()=>T?g(r,T):[],[T,r]),de=(0,y.useMemo)(()=>{let e=new Map;for(let t of i){let n=d(t);n&&e.set(n,t.kind),t.oldPath&&e.set(t.oldPath,t.kind),t.newPath&&e.set(t.newPath,t.kind)}return e},[i]),fe=(0,y.useMemo)(()=>new Set(r.edges.filter(e=>q.edgeIds.has(e.id)&&(!T||e.from===T||e.to===T||e.id===D)).map(e=>e.id)),[T,D,r.edges,q.edgeIds]),Z=(0,y.useMemo)(()=>ne({structure:r,positions:j,sourceChangeKinds:de,selection:{nodeIds:q.nodeIds,edgeIds:q.edgeIds,labelEdgeIds:fe},labelAccessory:`source-actions`}),[fe,j,de,r,q.edgeIds,q.nodeIds]),pe=Z.edges.map(({edge:e})=>e),me=Z.nodes.map(({node:e})=>e),_e=Z.labels,$=Z.bounds,je=Math.max(1200,($?.right??1e3)+180),Me=Math.max(800,($?.bottom??600)+180),Ne=()=>{if(!$||P.width===0||P.height===0)return null;let e=Math.min(1.25,Math.max(_,Math.min((P.width-72)/Math.max(1,$.right-$.left),(P.height-72)/Math.max(1,$.bottom-$.top)))),t=($.right-$.left)*e,n=($.bottom-$.top)*e;return{scale:e,x:(P.width-t)/2-$.left*e,y:(P.height-n)/2-$.top*e}},Pe=()=>{let e=Ne();e&&N(e)};(0,y.useLayoutEffect)(()=>{if(!oe.current||!$||P.width===0||P.height===0)return;let e=j[r.originNodeId],t=e?e.x+114:($.left+$.right)/2,n=e?e.y+56:($.top+$.bottom)/2;oe.current=null,N({scale:1,x:P.width*.25-t,y:P.height/2-n})},[$,j,r.originNodeId,P.height,P.width]);let Fe=(0,y.useCallback)((e,t)=>{let n=j[e];n&&N(e=>({scale:t??e.scale,x:P.width/2-(n.x+114)*(t??e.scale),y:P.height/2-(n.y+56)*(t??e.scale)}))},[j,P.height,P.width]);(0,y.useLayoutEffect)(()=>{if(!s||s.structureId!==r.id||s.pane!==e||W.current===s.requestId||r.updatedAt<s.structureUpdatedAt)return;if(r.updatedAt>s.structureUpdatedAt){W.current=s.requestId,I(`Structureが更新されたため、ファイル参照を更新しました。もう一度選択してください。`),v(s.requestId);return}let t=r.nodes.find(e=>e.id===s.nodeId);if(!t){W.current=s.requestId,I(`移動先のNodeはStructureの更新により削除されています。ファイル参照を更新しました。`),v(s.requestId);return}!j[t.id]||P.width===0||P.height===0||(oe.current=null,I(null),O(null),E(t.id),Fe(t.id),W.current=s.requestId,m(s.requestId))},[Fe,s,m,v,e,j,r.id,r.nodes,P.height,P.width]);let Ie=()=>{T&&Fe(T)},Le=()=>{ee(o(r))},Re=(e,t=!1)=>{O(null),E(e),t&&Fe(e)},ze=()=>{O(null),E(null),A(`all`)},Be=e=>{e!==k&&A(e)},Ve=async()=>{try{await navigator.clipboard.writeText(r.ref),I(`Structure参照をコピーしました。`)}catch{I(`Structure参照をコピーできませんでした。`)}},He=async e=>{if(!L){R(e),I(null);try{let t=he({structure:r,model:re({structure:r,positions:j,sourceChangeKinds:de}),palette:se(document.documentElement)});if(e===`svg`){be(new Blob([t.source],{type:`image/svg+xml;charset=utf-8`}),ye(r,`svg`));return}let n=ge(t.width,t.height);be(await ve(t,n),ye(r,`png`)),n.downscaled&&I(`PNGを${Math.round(n.scale*100)}%で出力しました。より高い解像度にはSVGを使用してください。`)}catch(e){I(xe(e))}finally{R(null)}}},Ue=e=>{N(t=>{let n=a(t.scale,e),r=P.width/2,i=P.height/2,o=(r-t.x)/t.scale,s=(i-t.y)/t.scale;return{scale:n,x:r-o*n,y:i-s*n}})},We=async(e,t,n)=>{I(null);try{let t=await b(e,n);I(t)}catch(e){I(e instanceof Error?e.message:`参照先を開けません · ${t.path}`)}},Ge=async()=>{if(z)return;let e=r.nodes.filter(e=>e.anchor!==null).length+r.edges.reduce((e,t)=>e+t.anchors.length,0);if(window.confirm(`Structure「${r.title}」を削除します。\n\nNode ${r.nodes.length}\nEdge ${r.edges.length}\nSource anchor ${e}\n\nこの操作は元に戻せません。`)){B(!0),I(null);try{await n(`/api/pull-requests/${t}/structures/${r.id}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({expectedUpdatedAt:r.updatedAt})}),h(r.id),x()}catch(e){I(e instanceof Error?e.message:`Structureを削除できませんでした。`)}finally{B(!1)}}},Ke=e=>{let t=K.current;if(t?.pointerId===e.pointerId){let n=(e.clientX-t.x)/M.scale,r=(e.clientY-t.y)/M.scale;K.current={...t,x:e.clientX,y:e.clientY,distance:t.distance+Math.hypot(e.clientX-t.x,e.clientY-t.y)},ee(e=>{let i=e[t.nodeId];return i?{...e,[t.nodeId]:{x:i.x+n,y:i.y+r}}:e});return}let n=G.current;if(n?.pointerId!==e.pointerId)return;let r=e.clientX-n.x,i=e.clientY-n.y;G.current={...n,x:e.clientX,y:e.clientY},N(e=>({...e,x:e.x+r,y:e.y+i}))},qe=e=>{if(G.current?.pointerId===e.pointerId&&(G.current=null),K.current?.pointerId===e.pointerId){let e=K.current;K.current=null,e.distance<4&&Re(e.nodeId)}e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)};return(0,Q.jsxs)(`article`,{className:`structure-viewer`,"data-structure-id":r.id,"data-visible-node-count":q.nodeIds.size,"data-total-node-count":r.nodes.length,"data-visible-edge-count":q.edgeIds.size,"data-total-edge-count":r.edges.length,"data-rendered-node-count":me.length,"data-rendered-edge-count":pe.length,"data-viewport-scale":M.scale.toFixed(3),"data-selected-edge-id":D??void 0,children:[(0,Q.jsxs)(`header`,{className:`structure-header`,children:[(0,Q.jsxs)(`div`,{className:`structure-header-main`,children:[(0,Q.jsx)(`span`,{className:`structure-kicker`,children:`Structure`}),(0,Q.jsx)(`h2`,{title:r.title,children:r.title}),(0,Q.jsx)(`span`,{className:`structure-source-oid`,title:`exact source ${r.sourceOid}`,children:r.sourceOid.slice(0,8)}),(0,Q.jsxs)(`details`,{className:`structure-scope-details`,children:[(0,Q.jsx)(`summary`,{"aria-label":`scopeを表示`,children:`scope`}),(0,Q.jsx)(`p`,{children:r.scope})]})]}),(0,Q.jsxs)(`div`,{className:`structure-header-side`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`structure-header-action`,"aria-label":`参照をコピー`,title:`Structure参照をコピー`,onClick:()=>void Ve(),children:`参照`}),(0,Q.jsx)(Se,{disabled:z||L!==null,exporting:L,onExport:e=>void He(e)}),(0,Q.jsx)(`button`,{type:`button`,className:`danger structure-delete`,disabled:z,onClick:()=>void Ge(),children:z?`削除中…`:`削除`})]})]}),(0,Q.jsxs)(`div`,{className:`structure-body`,children:[(0,Q.jsxs)(`div`,{className:`structure-toolbar`,"aria-label":`Structure表示操作`,children:[(0,Q.jsx)(`div`,{className:`structure-toolbar-group`,role:`group`,"aria-label":`近傍の深さ`,children:[1,2,`all`].map(e=>(0,Q.jsx)(`button`,{type:`button`,className:k===e?`active`:``,"aria-pressed":k===e,disabled:!T&&e!==`all`,onClick:()=>Be(e),children:e===`all`?`全体`:`${e}-hop`},e))}),(0,Q.jsxs)(`div`,{className:`structure-toolbar-group`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>Ue(1/1.2),"aria-label":`縮小`,children:`−`}),(0,Q.jsxs)(`span`,{children:[Math.round(M.scale*100),`%`]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>Ue(1.2),"aria-label":`拡大`,children:`+`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`表示中を収める`,title:`表示中を収める`,onClick:Pe,children:`Fit`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`focusを中央へ`,title:`focusを中央へ`,disabled:!T,onClick:Ie,children:`中央`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`focusを解除`,title:`focusを解除`,disabled:!T,onClick:ze,children:`解除`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`レイアウトを戻す`,title:`レイアウトを戻す`,onClick:Le,children:`Reset`})]})]}),F&&(0,Q.jsx)(`div`,{className:`structure-status`,role:`status`,"aria-live":`polite`,children:F}),(0,Q.jsx)(`section`,{className:`structure-canvas-shell`,"aria-label":`${r.title} graph`,children:(0,Q.jsxs)(`div`,{ref:V,className:`structure-canvas`,tabIndex:0,onKeyDown:e=>{e.key!==`Escape`||!D&&!T||(e.preventDefault(),D?O(null):ze())},onPointerDown:e=>{e.button!==0||e.target instanceof Element&&e.target.closest(`.structure-node, .structure-edge-label, button`)||(G.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:Ke,onPointerUp:qe,onPointerCancel:qe,onDoubleClick:e=>{e.target===e.currentTarget&&Pe()},children:[(0,Q.jsxs)(`div`,{className:`structure-world`,style:{width:je,height:Me,transform:`translate(${M.x}px, ${M.y}px) scale(${M.scale})`},children:[(0,Q.jsxs)(`svg`,{className:`structure-edges`,width:je,height:Me,"aria-hidden":`true`,children:[(0,Q.jsx)(`defs`,{children:(0,Q.jsx)(`marker`,{id:`${S}-arrow`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,Q.jsx)(`path`,{d:`M 0 0 L 10 5 L 0 10 z`})})}),Z.edges.map(({edge:e,geometry:t,source:n})=>{let r=e.from===T||e.to===T,i=e.id===D,a=D!==null&&!i,o=n.changeKind;return(0,Q.jsx)(`path`,{className:`structure-edge${r?` focused`:``}${i?` selected`:``}${a?` muted`:``}`,"data-edge-id":e.id,"data-source-change-kind":o??void 0,"data-start-x":t.startX,"data-start-y":t.startY,"data-end-x":t.endX,"data-end-y":t.endY,d:t.path,markerEnd:e.directed?`url(#${S}-arrow)`:void 0},e.id)})]}),_e.map(({edge:e,source:t,x:n,y:r,selectWidth:i,height:a,crowded:o})=>{let s=t.changeKind,c=J.get(e.from),l=J.get(e.to),u=e.directed?`${c?.label??e.from} から ${l?.label??e.to} へ: ${e.label}`:`${c?.label??e.from} と ${l?.label??e.to} の関係: ${e.label}`,d=e.id===D;return(0,Q.jsxs)(`div`,{className:`structure-edge-label${o?` crowded`:``}${D!==null&&!d?` muted`:``}`,"data-edge-id":e.id,"data-source-anchor-count":t.anchorCount,"data-source-change-kind":s??void 0,style:{left:n,top:r,minHeight:a},children:[(0,Q.jsx)(`button`,{type:`button`,className:`structure-edge-select${d?` selected`:``}`,title:e.label,"aria-label":u,"aria-pressed":d,style:{maxWidth:i},onClick:()=>O(t=>t===e.id?null:e.id),children:(0,Q.jsx)(`span`,{className:`structure-edge-label-text`,children:e.label})}),(0,Q.jsx)(De,{edge:e,onOpen:(e,t,n)=>void We(e,t,n)})]},`label:${e.id}`)}),Z.nodes.map(({node:e,point:t,changeKind:n,sourceLabel:i})=>{let a=e.id===T,o=ue.some(t=>t.from===e.id||t.to===e.id);return(0,Q.jsxs)(`div`,{className:`structure-node notation-${e.notation}${e.id===r.originNodeId?` origin`:``}${a?` focused`:``}${o?` neighboring`:``}${le.has(e.id)?` edge-endpoint`:``}`,"data-node-id":e.id,"data-node-notation":e.notation,"data-origin-node":e.id===r.originNodeId?`true`:void 0,"data-source-change-kind":n??void 0,style:{left:t.x,top:t.y},onPointerDown:t=>{t.button===0&&(t.stopPropagation(),K.current={pointerId:t.pointerId,nodeId:e.id,x:t.clientX,y:t.clientY,distance:0},V.current?.setPointerCapture(t.pointerId))},children:[(0,Q.jsxs)(`button`,{type:`button`,className:`structure-node-focus`,"aria-pressed":a,onClick:t=>{t.detail===0&&Re(e.id)},children:[e.anchor&&(0,Q.jsx)(Oe,{anchor:e.anchor,changeKind:n,sourceLabel:i??e.anchor.path}),(0,Q.jsx)(`strong`,{className:`structure-node-title`,children:(0,Q.jsx)(`span`,{className:`structure-node-title-text`,title:e.label,children:(0,Q.jsx)(ke,{label:e.label})})}),(0,Q.jsx)(`span`,{className:`structure-node-description`,children:e.description??`Producerによる説明なし`})]}),e.anchor&&(0,Q.jsx)(Ee,{compact:!0,anchor:e.anchor,onOpen:t=>void We({kind:`node`,nodeId:e.id},e.anchor,t)})]},e.id)})]}),(0,Q.jsxs)(`div`,{className:`structure-canvas-status`,children:[(0,Q.jsx)(`strong`,{children:Y?.label??`focusなし`}),(0,Q.jsxs)(`span`,{children:[`origin · `,ce.label]}),(0,Q.jsxs)(`span`,{children:[q.nodeIds.size,`/`,r.nodes.length,` Node · `,q.edgeIds.size,`/`,r.edges.length,` Relation`]})]}),(0,Q.jsx)(Ae,{structure:r,positions:j,focusedNodeId:T,viewport:M,viewportElement:V.current})]})})]})]})}export{je as StructureViewer};
|