github-issue-tower-defence-management 2.37.1 → 2.37.3
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/bin/adapter/entry-points/console/ui-dist/assets/{index-XIDnTHLI.js → index-kzHm7Yu0.js}
RENAMED
|
@@ -10,7 +10,7 @@ Error generating stack: `+e.message+`
|
|
|
10
10
|
|
|
11
11
|
`),se=`In Tmux by human`,ce=`Awaiting Workspace`,le=[`In Tmux by human`,`Todo by human`,ce],ue=e=>e===`todo-by-human`||e===`todo-by-agent`,de=({statusOptions:e,onOkAndAwaitingWorkspace:t})=>{let n=e.find(e=>e.name.toLowerCase()===ce.toLowerCase());if(n===void 0)return null;let r=ae(n.color);return(0,x.jsx)(`div`,{className:`console-op-group`,children:(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,style:{color:r.fg,borderColor:r.border,backgroundColor:r.bg},onClick:()=>t(n),children:`ok & Awaiting Workspace`})})},L=1e3,fe=60*L,R=60*fe,pe=24*R,me=(e,t)=>{let n=Date.parse(e);if(Number.isNaN(n))return``;let r=t-n;if(r<45*L)return`just now`;if(r<R){let e=Math.round(r/fe);return`${e} minute${e===1?``:`s`} ago`}if(r<pe){let e=Math.round(r/R);return`${e} hour${e===1?``:`s`} ago`}let i=Math.round(r/pe);if(i===1)return`yesterday`;if(i<30)return`${i} days ago`;let a=new Date(n),o=a.getUTCFullYear()===new Date(t).getUTCFullYear();return a.toLocaleDateString(`en-US`,{timeZone:`UTC`,year:o?void 0:`numeric`,month:`short`,day:`numeric`})},he=e=>{let t=Date.parse(e);return Number.isNaN(t)?``:new Date(t).toLocaleString(`ja-JP`,{timeZone:`UTC`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})},ge={issueOpen:{color:`#3fb950`,paths:[`M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z`,`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z`]},issueClosed:{color:`#a371f7`,paths:[`M11.28 6.78a.75.75 0 0 0-1.06-1.06L7.25 8.69 5.78 7.22a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l3.5-3.5Z`,`M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 1 0-13 0 6.5 6.5 0 0 0 13 0Z`]},issueClosedNotPlanned:{color:`#848d97`,paths:[`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm9.78-2.22-5.5 5.5a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l5.5-5.5a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z`]},prOpen:{color:`#3fb950`,paths:[`M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z`]},prMerged:{color:`#a371f7`,paths:[`M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z`]},prClosed:{color:`#f85149`,paths:[`M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75Zm-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z`]},prDraft:{color:`#8b949e`,paths:[`M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 14a2.25 2.25 0 1 1 0-4.5 2.25 2.25 0 0 1 0 4.5ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM14 7.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm0-4.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z`]}},_e=({isPr:e,state:t,merged:n,isDraft:r,stateReason:i})=>e?r?`prDraft`:n?`prMerged`:t===`closed`?`prClosed`:`prOpen`:t===`closed`?i===`not_planned`?`issueClosedNotPlanned`:`issueClosed`:`issueOpen`,ve=({size:e=12,...t})=>{let n=_e(t),r=ge[n];return(0,x.jsx)(`svg`,{className:`console-item-icon`,viewBox:`0 0 16 16`,width:e,height:e,fill:r.color,role:`img`,"aria-label":n,children:r.paths.map(e=>(0,x.jsx)(`path`,{d:e},e))})},ye=({item:e,isActive:t,now:n,statusOptions:r=[],onSelect:i})=>(0,x.jsx)(`button`,{type:`button`,className:`console-item-row`,"aria-current":t?`true`:void 0,"data-active":t?`true`:void 0,onClick:()=>i(e),children:(0,x.jsxs)(`span`,{className:`console-item-meta`,children:[(0,x.jsxs)(`span`,{className:`console-item-title`,children:[(0,x.jsx)(ve,{isPr:e.isPr,state:`open`,merged:!1,isDraft:!1,stateReason:``}),e.title]}),(0,x.jsxs)(`span`,{className:`console-item-sub`,children:[(0,x.jsxs)(`span`,{className:`console-item-pill`,children:[`#`,e.number]}),e.repo!==``&&(0,x.jsx)(`span`,{className:`console-item-pill`,children:e.repo}),(0,x.jsx)(`span`,{className:`console-item-pill`,children:e.isPr?`PR`:`Issue`}),e.createdAt!==``&&(0,x.jsxs)(`span`,{className:`console-item-opened`,children:[` · opened `,(0,x.jsx)(`span`,{className:`console-item-createdat`,title:he(e.createdAt),children:me(e.createdAt,n)})]})]}),(e.story!==``||e.nextActionDate!==null||e.nextActionHour!==null||e.dependedIssueUrls.length>0)&&(0,x.jsxs)(`span`,{className:`console-item-fields`,children:[e.story!==``&&(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Story`}),e.story]}),e.nextActionDate!==null&&(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Next Action Date`}),e.nextActionDate.slice(0,10)]}),e.nextActionHour!==null&&(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Next Action Hour`}),e.nextActionHour]}),e.dependedIssueUrls.length>0&&(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Depended Issue URL`}),e.dependedIssueUrls.join(`, `)]})]}),(e.status!==null&&e.status!==``||e.agent!==null&&e.agent!==``)&&(0,x.jsxs)(`span`,{className:`console-item-status-agent`,children:[e.status!==null&&e.status!==``&&(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Status`}),(0,x.jsx)(`span`,{className:`console-item-status-badge`,style:N(r.find(t=>t.name===e.status)?.color??null),children:e.status})]}),e.agent!==null&&e.agent!==``&&(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Agent`}),e.agent]})]})]})}),be=({story:e,count:t,colorEnum:n})=>{let r=ae(n);return(0,x.jsxs)(`div`,{className:`console-group-header`,children:[(0,x.jsxs)(`span`,{className:`console-storytag`,children:[(0,x.jsx)(`span`,{className:`console-story-dot`,style:{backgroundColor:r.dot}}),e]}),(0,x.jsx)(`span`,{className:`console-group-count`,children:t})]})},xe=({rows:e,storyColors:t,statusOptions:n=[],activeItemId:r,now:i,isLoading:a,error:o,onSelectItem:s,executiveSummaries:c,onOkAndAwaitingWorkspace:l})=>o===null?a?(0,x.jsx)(`p`,{className:`console-list-message`,children:`Loading list...`}):e.length===0?(0,x.jsx)(`p`,{className:`console-list-empty`,children:`No items`}):(0,x.jsx)(`ul`,{className:`console-list`,children:e.map(e=>{if(e.kind===`group-header`)return(0,x.jsx)(`li`,{className:`console-list-group`,children:(0,x.jsx)(be,{story:e.story,count:e.count,colorEnum:A(t,e.story)})},`group:${e.story}`);let a=c?.[e.item.projectItemId]??null;return(0,x.jsxs)(`li`,{className:`console-list-row`,children:[(0,x.jsx)(ye,{item:e.item,isActive:e.item.itemId===r,now:i,statusOptions:n,onSelect:s}),a!==null&&a!==``&&(0,x.jsx)(`span`,{className:`console-item-executive-summary`,children:a}),l!==void 0&&(0,x.jsx)(de,{statusOptions:n,onOkAndAwaitingWorkspace:t=>l(e.item,t)})]},e.item.itemId)})}):(0,x.jsxs)(`p`,{role:`alert`,className:`console-list-message console-list-error`,children:[`Failed to load list: `,o]}),Se=e=>({...N(e),fontSize:`12px`,whiteSpace:`nowrap`,flexShrink:0}),Ce=({item:e,isActive:t,statusOptions:n,agentOptions:r,onSelect:i})=>{let a=n.find(t=>t.name===e.status),o=r.find(t=>t.name===e.agent);return(0,x.jsxs)(`button`,{type:`button`,className:`console-item-row console-queued-item-row`,"aria-current":t?`true`:void 0,"data-active":t?`true`:void 0,onClick:()=>i(e),children:[(0,x.jsx)(ve,{isPr:e.isPr,state:`open`,merged:!1,isDraft:!1,stateReason:``}),(0,x.jsx)(`span`,{className:`console-queued-item-title`,children:e.title}),(0,x.jsxs)(`span`,{className:`console-queued-item-badges`,children:[e.status!==null&&e.status!==``&&(0,x.jsx)(`span`,{className:`console-queued-item-badge`,style:Se(a?.color??null),children:e.status}),e.agent!==null&&e.agent!==``&&(0,x.jsx)(`span`,{className:`console-queued-item-badge`,style:Se(o?.color??null),children:e.agent})]})]})},we=({rows:e,storyColors:t,statusOptions:n,agentOptions:r,activeItemId:i,isLoading:a,error:o,onSelectItem:s})=>o===null?a?(0,x.jsx)(`p`,{className:`console-list-message`,children:`Loading list...`}):e.length===0?(0,x.jsx)(`p`,{className:`console-list-empty`,children:`No items`}):(0,x.jsx)(`ul`,{className:`console-list`,children:e.map(e=>e.kind===`group-header`?(0,x.jsx)(`li`,{className:`console-list-group`,children:(0,x.jsx)(be,{story:e.story,count:e.count,colorEnum:A(t,e.story)})},`group:${e.story}`):(0,x.jsx)(`li`,{className:`console-list-row`,children:(0,x.jsx)(Ce,{item:e.item,isActive:e.item.itemId===i,statusOptions:n,agentOptions:r,onSelect:s})},e.item.itemId))}):(0,x.jsxs)(`p`,{role:`alert`,className:`console-list-message console-list-error`,children:[`Failed to load list: `,o]}),Te=Object.defineProperty,Ee=(e,t)=>Te(e,`name`,{value:t,configurable:!0});function De(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Ee(De,`setRef`);function Oe(...e){return t=>{let n=!1,r=e.map(e=>{let r=De(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():De(e[t],null)}}}}Ee(Oe,`composeRefs`);function ke(...e){return y.useCallback(Oe(...e),e)}Ee(ke,`useComposedRefs`);var Ae=Object.defineProperty,je=(e,t)=>Ae(e,`name`,{value:t,configurable:!0});function Me(e){let t=y.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Ve(r)&&typeof Ge==`function`&&(r=Ge(r._payload)),y.Children.forEach(r,e=>{if(ze(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Ve(n)&&typeof Ge==`function`&&(n=Ge(n._payload)),a=Ie(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=y.cloneElement(a,void 0,s):!o&&y.Children.count(r)===1&&y.isValidElement(r)&&(a=r);let c=a?Re(a):void 0,l=ke(n,c);if(!a){if(r||r===0)throw Error(o?We(e):Ue(e));return r}let u=Le(i,a.props??{});return a.type!==y.Fragment&&(u.ref=n?l:c),y.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}je(Me,`createSlot`);var Ne=Me(`Slot`),Pe=Symbol.for(`radix.slottable`);function Fe(e){let t=je(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Pe,t}je(Fe,`createSlottable`);var Ie=je((e,t)=>{if(`child`in e.props){let t=e.props.child;return y.isValidElement(t)?y.cloneElement(t,void 0,e.props.children(t.props.children)):null}return y.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Le(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}je(Le,`mergeProps`);function Re(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}je(Re,`getElementRef`);function ze(e){return y.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Pe}je(ze,`isSlottable`);var Be=Symbol.for(`react.lazy`);function Ve(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Be&&`_payload`in e&&He(e._payload)}je(Ve,`isLazyComponent`);function He(e){return typeof e==`object`&&!!e&&`then`in e}je(He,`isPromiseLike`);var Ue=je(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),We=je(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Ge=y.use;function Ke(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ke(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function qe(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ke(e))&&(r&&(r+=` `),r+=t);return r}var Je=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Ye=qe,Xe=(e,t)=>n=>{if(t?.variants==null)return Ye(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Je(t)||Je(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Ye(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ze=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Qe=(e,t)=>({classGroupId:e,validator:t}),$e=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),et=`-`,tt=[],nt=`arbitrary..`,rt=e=>{let t=ot(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return at(e);let n=e.split(et);return it(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ze(i,t):t:i||tt}return n[e]||tt}}},it=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=it(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(et):e.slice(t).join(et),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},at=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?nt+r:void 0})(),ot=e=>{let{theme:t,classGroups:n}=e;return st(n,t)},st=(e,t)=>{let n=$e();for(let r in e){let i=e[r];ct(i,n,r,t)}return n},ct=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];lt(i,t,n,r)}},lt=(e,t,n,r)=>{if(typeof e==`string`){ut(e,t,n);return}if(typeof e==`function`){dt(e,t,n,r);return}ft(e,t,n,r)},ut=(e,t,n)=>{let r=e===``?t:pt(t,e);r.classGroupId=n},dt=(e,t,n,r)=>{if(mt(e)){ct(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Qe(n,e))},ft=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];ct(o,pt(t,a),n,r)}},pt=(e,t)=>{let n=e,r=t.split(et),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=$e(),n.nextPart.set(t,i)),n=i}return n},mt=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,ht=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},gt=`!`,_t=`:`,vt=[],yt=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),bt=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===_t){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(gt)?(c=s.slice(0,-1),l=!0):s.startsWith(gt)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return yt(t,l,c,u)};if(t){let e=t+_t,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):yt(vt,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},xt=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},St=e=>({cache:ht(e.cacheSize),parseClassName:bt(e),sortModifiers:xt(e),postfixLookupClassGroupIds:Ct(e),...rt(e)}),Ct=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},wt=/\s+/,Tt=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(wt),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+gt:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Et=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Dt(n))&&(i&&(i+=` `),i+=r);return i},Dt=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Dt(e[r]))&&(n&&(n+=` `),n+=t);return n},Ot=(e,...t)=>{let n,r,i,a,o=o=>(n=St(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Tt(e,n);return i(e,a),a};return a=o,(...e)=>a(Et(...e))},kt=[],z=e=>{let t=t=>t[e]||kt;return t.isThemeGetter=!0,t},At=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,jt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Mt=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Nt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Pt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ft=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,It=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Lt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rt=e=>Mt.test(e),B=e=>!!e&&!Number.isNaN(Number(e)),zt=e=>!!e&&Number.isInteger(Number(e)),Bt=e=>e.endsWith(`%`)&&B(e.slice(0,-1)),Vt=e=>Nt.test(e),Ht=()=>!0,Ut=e=>Pt.test(e)&&!Ft.test(e),Wt=()=>!1,Gt=e=>It.test(e),Kt=e=>Lt.test(e),qt=e=>!V(e)&&!H(e),Jt=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Yt=e=>dn(e,hn,Wt),V=e=>At.test(e),Xt=e=>dn(e,gn,Ut),Zt=e=>dn(e,_n,B),Qt=e=>dn(e,yn,Ht),$t=e=>dn(e,vn,Wt),en=e=>dn(e,pn,Wt),tn=e=>dn(e,mn,Kt),nn=e=>dn(e,bn,Gt),H=e=>jt.test(e),rn=e=>fn(e,gn),an=e=>fn(e,vn),on=e=>fn(e,pn),sn=e=>fn(e,hn),cn=e=>fn(e,mn),ln=e=>fn(e,bn,!0),un=e=>fn(e,yn,!0),dn=(e,t,n)=>{let r=At.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},fn=(e,t,n=!1)=>{let r=jt.exec(e);return r?r[1]?t(r[1]):n:!1},pn=e=>e===`position`||e===`percentage`,mn=e=>e===`image`||e===`url`,hn=e=>e===`length`||e===`size`||e===`bg-size`,gn=e=>e===`length`,_n=e=>e===`number`,vn=e=>e===`family-name`,yn=e=>e===`number`||e===`weight`,bn=e=>e===`shadow`,xn=Ot(()=>{let e=z(`color`),t=z(`font`),n=z(`text`),r=z(`font-weight`),i=z(`tracking`),a=z(`leading`),o=z(`breakpoint`),s=z(`container`),c=z(`spacing`),l=z(`radius`),u=z(`shadow`),d=z(`inset-shadow`),f=z(`text-shadow`),p=z(`drop-shadow`),m=z(`blur`),h=z(`perspective`),g=z(`aspect`),_=z(`ease`),v=z(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),H,V],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[H,V,c],T=()=>[Rt,`full`,`auto`,...w()],E=()=>[zt,`none`,`subgrid`,H,V],D=()=>[`auto`,{span:[`full`,zt,H,V]},zt,H,V],O=()=>[zt,`auto`,H,V],ee=()=>[`auto`,`min`,`max`,`fr`,H,V],te=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ne=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],k=()=>[`auto`,...w()],A=()=>[Rt,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],re=()=>[Rt,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ie=()=>[Rt,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],j=()=>[e,H,V],M=()=>[...b(),on,en,{position:[H,V]}],ae=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],N=()=>[`auto`,`cover`,`contain`,sn,Yt,{size:[H,V]}],oe=()=>[Bt,rn,Xt],P=()=>[``,`none`,`full`,l,H,V],F=()=>[``,B,rn,Xt],I=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ce=()=>[B,Bt,on,en],le=()=>[``,`none`,m,H,V],ue=()=>[`none`,B,H,V],de=()=>[`none`,B,H,V],L=()=>[B,H,V],fe=()=>[Rt,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Vt],breakpoint:[Vt],color:[Ht],container:[Vt],"drop-shadow":[Vt],ease:[`in`,`out`,`in-out`],font:[qt],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Vt],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Vt],shadow:[Vt],spacing:[`px`,B],text:[Vt],"text-shadow":[Vt],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Rt,V,H,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,H,V]}],"container-named":[Jt],columns:[{columns:[B,V,H,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[zt,`auto`,H,V]}],basis:[{basis:[Rt,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[B,Rt,`auto`,`initial`,`none`,V]}],grow:[{grow:[``,B,H,V]}],shrink:[{shrink:[``,B,H,V]}],order:[{order:[zt,`first`,`last`,`none`,H,V]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...te(),`normal`]}],"justify-items":[{"justify-items":[...ne(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ne()]}],"align-content":[{content:[`normal`,...te()]}],"align-items":[{items:[...ne(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ne(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...ne(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ne()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:A()}],"inline-size":[{inline:[`auto`,...re()]}],"min-inline-size":[{"min-inline":[`auto`,...re()]}],"max-inline-size":[{"max-inline":[`none`,...re()]}],"block-size":[{block:[`auto`,...ie()]}],"min-block-size":[{"min-block":[`auto`,...ie()]}],"max-block-size":[{"max-block":[`none`,...ie()]}],w:[{w:[s,`screen`,...A()]}],"min-w":[{"min-w":[s,`screen`,`none`,...A()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...A()]}],h:[{h:[`screen`,`lh`,...A()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...A()]}],"max-h":[{"max-h":[`screen`,`lh`,...A()]}],"font-size":[{text:[`base`,n,rn,Xt]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,un,Qt]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Bt,V]}],"font-family":[{font:[an,$t,t]}],"font-features":[{"font-features":[V]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,H,V]}],"line-clamp":[{"line-clamp":[B,`none`,H,Zt]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,H,V]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,H,V]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...I(),`wavy`]}],"text-decoration-thickness":[{decoration:[B,`from-font`,`auto`,H,Xt]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[B,`auto`,H,V]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[zt,H,V]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,H,V]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,H,V]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:N()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},zt,H,V],radial:[``,H,V],conic:[zt,H,V]},cn,tn]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-bs":[{"border-bs":F()}],"border-w-be":[{"border-be":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":F()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...I(),`hidden`,`none`]}],"divide-style":[{divide:[...I(),`hidden`,`none`]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-bs":[{"border-bs":j()}],"border-color-be":[{"border-be":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...I(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[B,H,V]}],"outline-w":[{outline:[``,B,rn,Xt]}],"outline-color":[{outline:j()}],shadow:[{shadow:[``,`none`,u,ln,nn]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":[`none`,d,ln,nn]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:F()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[B,Xt]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":[`none`,f,ln,nn]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[B,H,V]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[B]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[H,V]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[B]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,H,V]}],filter:[{filter:[``,`none`,H,V]}],blur:[{blur:le()}],brightness:[{brightness:[B,H,V]}],contrast:[{contrast:[B,H,V]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,ln,nn]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:[``,B,H,V]}],"hue-rotate":[{"hue-rotate":[B,H,V]}],invert:[{invert:[``,B,H,V]}],saturate:[{saturate:[B,H,V]}],sepia:[{sepia:[``,B,H,V]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,H,V]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[B,H,V]}],"backdrop-contrast":[{"backdrop-contrast":[B,H,V]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,B,H,V]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[B,H,V]}],"backdrop-invert":[{"backdrop-invert":[``,B,H,V]}],"backdrop-opacity":[{"backdrop-opacity":[B,H,V]}],"backdrop-saturate":[{"backdrop-saturate":[B,H,V]}],"backdrop-sepia":[{"backdrop-sepia":[``,B,H,V]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,H,V]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[B,`initial`,H,V]}],ease:[{ease:[`linear`,`initial`,_,H,V]}],delay:[{delay:[B,H,V]}],animate:[{animate:[`none`,v,H,V]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,H,V]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:L()}],"skew-x":[{"skew-x":L()}],"skew-y":[{"skew-y":L()}],transform:[{transform:[H,V,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":[`translate-none`],zoom:[{zoom:[zt,H,V]}],accent:[{accent:j()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,H,V]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":j()}],"scrollbar-track-color":[{"scrollbar-track":j()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,H,V]}],fill:[{fill:[`none`,...j()]}],"stroke-w":[{stroke:[B,rn,Xt,Zt]}],stroke:[{stroke:[`none`,...j()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}}),Sn=(...e)=>xn(qe(e)),Cn=Xe(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`}},defaultVariants:{variant:`default`,size:`default`}}),wn=y.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,x.jsx)(r?Ne:`button`,{className:Sn(Cn({variant:t,size:n,className:e})),ref:a,...i}));wn.displayName=`Button`;var Tn=`Copying to the clipboard is not available in this browser context.`,En=e=>{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`0`,t.style.left=`0`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),t.setSelectionRange(0,e.length);let n=document.execCommand(`copy`);return t.remove(),n},Dn=async e=>{let t=navigator.clipboard;if(t!==void 0&&typeof t.writeText==`function`)try{await t.writeText(e);return}catch{if(En(e))return;throw Error(Tn)}if(!En(e))throw Error(Tn)},On=1500,kn=`Copy failed`,An=`Copying to the clipboard failed`,jn=({value:e,idleText:t,idleAriaLabel:n,copiedAriaLabel:r,className:i})=>{let[a,o]=(0,y.useState)(`idle`),s=(0,y.useRef)(null);return(0,y.useEffect)(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),(0,x.jsx)(wn,{type:`button`,variant:`ghost`,size:`sm`,className:i,"aria-label":a===`copied`?r:a===`failed`?An:n,onClick:async()=>{try{await Dn(e),o(`copied`)}catch(e){console.error(e),o(`failed`)}s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>{o(`idle`),s.current=null},On)},children:a===`copied`?`Copied`:a===`failed`?kn:t})},Mn=({storyName:e})=>(0,x.jsx)(jn,{value:e,idleText:`Copy name`,idleAriaLabel:`Copy story name`,copiedAriaLabel:`Story name copied to clipboard`,className:`console-copy-story-name-button`}),Nn=Object.keys(M),Pn=({placeholder:e,emptyValueError:t,onSubmit:n,onCancel:r,initialValue:i=``,submitLabel:a=`Create`,selectAllOnFocus:o=!1})=>{let[s,c]=(0,y.useState)(i),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(null),p=(0,y.useRef)(null),m=(0,y.useRef)(o);(0,y.useEffect)(()=>{p.current?.focus(),m.current&&p.current?.select()},[]);let h=async()=>{let e=s.trim();if(e.length===0){f(t);return}u(!0),f(null);try{await n(e)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,x.jsxs)(`form`,{className:`console-inline-input-form`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,x.jsx)(`input`,{ref:p,type:`text`,className:`console-inline-input-form-input`,placeholder:e,value:s,onChange:e=>c(e.target.value),disabled:l}),(0,x.jsx)(`button`,{type:`submit`,className:`console-op-button`,disabled:l,children:l?`${a.replace(/e$/,``)}ing…`:a}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:r,disabled:l,children:`Cancel`}),d!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:d})]})},Fn=({storyOptionId:e,onSubmit:t,onCancel:n})=>(0,x.jsx)(Pn,{placeholder:`Issue title`,emptyValueError:`Title is required`,onSubmit:n=>t(e,n),onCancel:n}),In=({currentName:e,onSubmit:t,onCancel:n})=>(0,x.jsx)(Pn,{placeholder:`Story name`,emptyValueError:`Story name is required`,initialValue:e,submitLabel:`Rename`,selectAllOnFocus:!0,onSubmit:t,onCancel:n}),Ln=({onSelectColor:e,disabled:t})=>(0,x.jsx)(`div`,{className:`console-story-color-palette`,children:Nn.map(n=>{let r=M[n];return(0,x.jsx)(`button`,{type:`button`,className:`console-story-color-swatch`,"aria-label":n===`GRAY`?`${n} (disable)`:n,style:{backgroundColor:r.dot},onClick:()=>e(n),disabled:t,children:n===`GRAY`&&(0,x.jsx)(`span`,{className:`console-story-color-swatch-label`,children:`disable`})},n)})}),Rn=({storyName:e,isDeleting:t,deleteError:n,onConfirm:r,onCancel:i})=>(0,x.jsxs)(`div`,{className:`console-story-delete-confirm`,role:`dialog`,"aria-modal":`true`,"aria-label":`Confirm story deletion`,children:[(0,x.jsxs)(`p`,{className:`console-story-delete-confirm-message`,children:[`Delete story option "`,e,`" from the GitHub custom field? Tasks assigned to this story will not be deleted.`]}),n!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:n}),(0,x.jsxs)(`div`,{className:`console-story-delete-confirm-actions`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,onClick:r,disabled:t,children:t?`Deleting…`:`Delete`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:i,disabled:t,children:`Cancel`})]})]}),zn=({stories:e,isLoading:t,error:n,showGray:r,onCreateIssue:i,onAddStory:a,onSelectColor:o,onToggleGray:s,onReorderStory:c,onDeleteStory:l,onRenameStory:u,optimisticColors:d,colorChangeInFlight:f,colorErrors:p})=>{let[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(!1),[v,b]=(0,y.useState)(null),[S,C]=(0,y.useState)({}),[w,T]=(0,y.useState)(null),[E,D]=(0,y.useState)({}),[O,ee]=(0,y.useState)(null),te=e=>S[e]??{inProgress:!1,error:null},ne=async(e,t)=>{C(t=>({...t,[e]:{inProgress:!0,error:null}}));try{await c(e,t),C(t=>({...t,[e]:{inProgress:!1,error:null}}))}catch(t){C(n=>({...n,[e]:{inProgress:!1,error:t instanceof Error?t.message:String(t)}}))}};if(n!==null)return(0,x.jsxs)(`p`,{role:`alert`,className:`console-list-message console-list-error`,children:[`Failed to load stories: `,n]});if(t)return(0,x.jsx)(`p`,{className:`console-list-message`,children:`Loading stories...`});let k=e=>{h(m===e?null:e)},A=async(e,t)=>{await i(e,t),h(null)},re=e=>{b(v===e?null:e)},ie=(e,t)=>{b(null),o(e,t)},j=e=>{T(e)},M=async e=>{D(t=>({...t,[e]:{isDeleting:!0,error:null}}));try{await l(e),T(null),D(t=>({...t,[e]:{isDeleting:!1,error:null}}))}catch(t){D(n=>({...n,[e]:{isDeleting:!1,error:t instanceof Error?t.message:String(t)}}))}},N=()=>{T(null),D({})},oe=e=>{ee(O===e?null:e)},P=async(e,t)=>{await u(e,t),ee(null)},F=r?e:e.filter(e=>e.color!==`GRAY`),I=e.some(e=>e.color===`GRAY`);return(0,x.jsxs)(`div`,{className:`console-story-list-container`,children:[F.length===0?(0,x.jsx)(`p`,{className:`console-list-empty`,children:`No active stories`}):(0,x.jsx)(`ul`,{className:`console-story-list`,children:F.map((e,t)=>{let n=ae(d[e.storyOptionId]??e.color),r=m===e.storyOptionId,i=v===e.storyOptionId,a=f===e.storyOptionId,o=p[e.storyOptionId]??null,{inProgress:s,error:c}=te(e.storyOptionId),l=t===0,u=t===F.length-1,g=w===e.storyOptionId,_=E[e.storyOptionId]??{isDeleting:!1,error:null},y=O===e.storyOptionId;return(0,x.jsxs)(`li`,{className:`console-story-list-row`,children:[(0,x.jsxs)(`div`,{className:`console-story-list-row-main`,children:[e.storyViewUrl?(0,x.jsxs)(`a`,{href:e.storyViewUrl,target:`_blank`,rel:`noopener noreferrer`,className:`console-storytag`,style:{color:n.fg,borderColor:n.border},children:[(0,x.jsx)(`span`,{className:`console-story-dot`,style:{backgroundColor:n.dot}}),e.storyName]}):(0,x.jsxs)(`span`,{className:`console-storytag`,style:{color:n.fg,borderColor:n.border},children:[(0,x.jsx)(`span`,{className:`console-story-dot`,style:{backgroundColor:n.dot}}),e.storyName]}),(0,x.jsx)(Mn,{storyName:e.storyName}),(0,x.jsx)(`span`,{className:`console-story-count`,children:e.openItemCount}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>k(e.storyOptionId),children:`Add task`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>re(e.storyOptionId),disabled:a,children:`Change color`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Move up`,disabled:l||s,onClick:()=>void ne(e.storyOptionId,`up`),children:`↑`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Move down`,disabled:u||s,onClick:()=>void ne(e.storyOptionId,`down`),children:`↓`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,"aria-label":`Delete story`,onClick:()=>j(e.storyOptionId),children:`Delete`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Rename story`,onClick:()=>oe(e.storyOptionId),children:`Rename`})]}),c!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:c}),i&&(0,x.jsx)(Ln,{onSelectColor:t=>ie(e.storyOptionId,t),disabled:a}),o!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:o}),r&&(0,x.jsx)(Fn,{storyOptionId:e.storyOptionId,onSubmit:A,onCancel:()=>h(null)}),g&&(0,x.jsx)(Rn,{storyName:e.storyName,isDeleting:_.isDeleting,deleteError:_.error,onConfirm:()=>void M(e.storyOptionId),onCancel:N}),y&&(0,x.jsx)(In,{currentName:e.storyName,onSubmit:t=>P(e.storyOptionId,t),onCancel:()=>ee(null)})]},e.storyOptionId)})}),I&&(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:s,children:r?`Hide archived`:`Show archived`}),(0,x.jsxs)(`div`,{className:`console-add-story-section`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>_(!g),children:`Add story`}),g&&(0,x.jsx)(Pn,{placeholder:`Story name`,emptyValueError:`Story name is required`,onSubmit:async e=>{await a(e),_(!1)},onCancel:()=>_(!1)})]})]})},Bn=e=>`${e.isPr?`PR`:`Issue`} #${e.itemNumber}`,Vn=e=>e===null?`loading…`:e,Hn=e=>{let t=[];return t.push(`CI: ${e.isCiStateSuccess?`pass`:`fail`}`),t.push(`Merge: ${e.mergeableStatus.toLowerCase()}`),e.isBranchOutOfDate&&t.push(`branch out of date`),t.join(` · `)},Un=e=>e.fetchError?`${Bn(e)} — failed to load current state`:e.currentTitle===null?`${Bn(e)} — loading current state…`:`${Bn(e)} — ${e.currentTitle} (${Vn(e.currentState)})`,Wn=({actions:e,isOnline:t,isConfirming:n,onConfirm:r,onDiscard:i})=>e.length===0?null:(0,x.jsxs)(`section`,{className:`console-offline-panel`,"aria-label":`Offline actions queue`,children:[(0,x.jsxs)(`div`,{className:`console-offline-panel-header`,children:[e.length,` action`,e.length===1?``:`s`,` held`,t?` — confirm each before sending`:` — awaiting connectivity`]}),e.map(e=>(0,x.jsxs)(`div`,{className:`console-offline-panel-item console-offline-panel-item-${e.color}`,children:[(0,x.jsx)(`div`,{className:`console-offline-panel-item-message`,children:e.message}),(0,x.jsx)(`div`,{className:`console-offline-panel-item-target`,children:Un(e)}),e.fetchError&&(0,x.jsx)(`div`,{className:`console-offline-panel-item-fetch-error`,children:`Failed to load current state — sending will act on the last known state`}),t&&e.isPr&&e.currentPrStatus!==null&&!e.fetchError&&(0,x.jsx)(`div`,{className:`console-offline-panel-item-pr-status`,children:Hn(e.currentPrStatus)}),(0,x.jsxs)(`div`,{className:`console-offline-panel-item-controls`,children:[t&&(0,x.jsx)(`button`,{type:`button`,className:`console-offline-panel-confirm`,disabled:n||e.currentTitle===null&&!e.fetchError,onClick:()=>r(e.id),children:`Send`}),(0,x.jsx)(`button`,{type:`button`,className:`console-offline-panel-discard`,onClick:()=>i(e.id),children:`Discard`})]})]},e.id))]}),Gn=({message:e,color:t,remainingSeconds:n,progress:r,onUndo:i})=>(0,x.jsxs)(`div`,{className:`console-undo-toast console-undo-toast-${t}`,role:`status`,"aria-live":`polite`,children:[(0,x.jsx)(`span`,{className:`console-undo-toast-message`,children:e}),(0,x.jsx)(`button`,{type:`button`,className:`console-undo-toast-undo`,onClick:i,children:`Undo`}),(0,x.jsxs)(`span`,{className:`console-undo-toast-countdown`,"aria-hidden":`true`,children:[n,`s`]}),(0,x.jsx)(`span`,{className:`console-undo-toast-bar`,"aria-hidden":`true`,style:{width:`${Math.max(0,Math.min(100,r*100))}%`}})]}),Kn=({title:e,message:t,onDismiss:n})=>(0,x.jsxs)(`div`,{className:`console-error-toast`,role:`alert`,"aria-live":`assertive`,children:[e!==void 0&&(0,x.jsx)(`span`,{className:`console-error-toast-title`,children:e}),(0,x.jsx)(`span`,{className:`console-error-toast-message`,children:t}),(0,x.jsx)(`button`,{type:`button`,className:`console-error-toast-dismiss`,onClick:n,children:`Dismiss`})]}),qn=`tdpm-airplane-v1`,Jn=`/airplane-snapshot-data`,Yn=`tdpm_airplane_mode_on`,Xn=()=>typeof localStorage>`u`?!1:localStorage.getItem(Yn)===`1`,Zn=e=>{typeof localStorage>`u`||(e?localStorage.setItem(Yn,`1`):localStorage.removeItem(Yn))},Qn=async e=>{if(typeof caches>`u`)throw Error(`Cache API unavailable`);try{await(await caches.open(qn)).put(Jn,new Response(JSON.stringify(e),{headers:{"Content-Type":`application/json`}}))}catch(e){throw e instanceof Error&&e.name===`QuotaExceededError`?Error(`Not enough browser storage to save the offline snapshot. Free up storage and retry.`):e}},$n=async()=>{if(typeof caches>`u`)return null;let e=await(await caches.open(qn)).match(Jn);return e===void 0?null:e.json()},er=async()=>{typeof caches>`u`||await caches.delete(qn)},tr=e=>typeof e==`object`&&!!e&&!Array.isArray(e),nr=e=>typeof e==`string`?e:``,rr=e=>typeof e==`number`?e:0,ir=e=>e===!0,ar=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],or=e=>e===`MERGEABLE`?`MERGEABLE`:e===`CONFLICTING`?`CONFLICTING`:`UNKNOWN`,sr=e=>tr(e)?{number:rr(e.number),title:nr(e.title),url:nr(e.url),repo:nr(e.repo),nameWithOwner:nr(e.nameWithOwner),projectItemId:nr(e.projectItemId),itemId:nr(e.itemId),isPr:ir(e.isPr),story:nr(e.story),status:typeof e.status==`string`?e.status:null,nextActionDate:typeof e.nextActionDate==`string`?e.nextActionDate:null,nextActionHour:typeof e.nextActionHour==`number`?e.nextActionHour:null,dependedIssueUrls:ar(e.dependedIssueUrls),labels:ar(e.labels),createdAt:nr(e.createdAt),relatedOpenPullRequestUrls:ar(e.relatedOpenPullRequestUrls),agent:typeof e.agent==`string`?e.agent:null}:null,cr=e=>{if(!tr(e))return{items:[],generatedAt:``,statusOptions:[],agentOptions:[],storyOptions:[],storyColors:{},stories:[],defaultNameWithOwner:null,fromCache:!1,storyOrder:[],timerEndsAt:null,timerTotalSeconds:null};let t=Array.isArray(e.items)?e.items.map(sr).filter(e=>e!==null):[],n=Array.isArray(e.statusOptions)?e.statusOptions.filter(tr):[],r=Array.isArray(e.agentOptions)?e.agentOptions.filter(tr):[],i=Array.isArray(e.storyOptions)?e.storyOptions.filter(tr):[],a=Array.isArray(e.stories)?e.stories.filter(tr):[],o=Array.isArray(e.storyOrder)?e.storyOrder.filter(e=>typeof e==`string`):[];return{items:t,generatedAt:typeof e.generatedAt==`string`?e.generatedAt:``,statusOptions:n,agentOptions:r,storyOptions:i,storyColors:tr(e.storyColors)?e.storyColors:{},stories:a,defaultNameWithOwner:typeof e.defaultNameWithOwner==`string`?e.defaultNameWithOwner:null,fromCache:!1,storyOrder:o,timerEndsAt:null,timerTotalSeconds:null}},lr=e=>tr(e)?{author:nr(e.author),body:nr(e.body),createdAt:nr(e.createdAt)}:null,ur=e=>tr(e)?{path:nr(e.path),additions:rr(e.additions),deletions:rr(e.deletions),status:nr(e.status),patch:typeof e.patch==`string`?e.patch:null,rawUrl:typeof e.rawUrl==`string`?e.rawUrl:null}:null,dr=e=>tr(e)?{sha:nr(e.sha),message:nr(e.message),author:nr(e.author),authoredAt:nr(e.authoredAt)}:null,fr=e=>tr(e)?{found:ir(e.found),isConflicted:ir(e.isConflicted),mergeableStatus:or(e.mergeableStatus),isPassedAllCiJob:ir(e.isPassedAllCiJob),isCiStateSuccess:ir(e.isCiStateSuccess),isBranchOutOfDate:ir(e.isBranchOutOfDate),missingRequiredCheckNames:ar(e.missingRequiredCheckNames)}:{found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]},pr=e=>{if(!tr(e))return null;let t=tr(e.summary)?{title:nr(e.summary.title),body:nr(e.summary.body),additions:rr(e.summary.additions),deletions:rr(e.summary.deletions),changedFiles:rr(e.summary.changedFiles)}:null;return{url:nr(e.url),branchName:typeof e.branchName==`string`?e.branchName:null,createdAt:nr(e.createdAt),isDraft:ir(e.isDraft),isConflicted:ir(e.isConflicted),mergeableStatus:or(e.mergeableStatus),isPassedAllCiJob:ir(e.isPassedAllCiJob),isCiStateSuccess:ir(e.isCiStateSuccess),isResolvedAllReviewComments:ir(e.isResolvedAllReviewComments),isBranchOutOfDate:ir(e.isBranchOutOfDate),missingRequiredCheckNames:ar(e.missingRequiredCheckNames),summary:t}},mr=e=>{if(!tr(e))return{body:``,comments:[],state:{state:`open`,merged:!1,isPullRequest:!1,title:``},files:null,commits:null,prStatus:null,relatedPrs:null};let t=tr(e.state)?e.state:{},n={state:nr(t.state)||`open`,merged:ir(t.merged),isPullRequest:ir(t.isPullRequest),title:nr(t.title)},r=e.files===null?null:Array.isArray(e.files)?e.files.map(ur).filter(e=>e!==null):null,i=e.commits===null?null:Array.isArray(e.commits)?e.commits.map(dr).filter(e=>e!==null):null,a=e.prStatus===null?null:fr(e.prStatus),o=e.relatedPrs===null?null:Array.isArray(e.relatedPrs)?e.relatedPrs.map(pr).filter(e=>e!==null):null;return{body:nr(e.body),comments:Array.isArray(e.comments)?e.comments.map(lr).filter(e=>e!==null):[],state:n,files:r,commits:i,prStatus:a,relatedPrs:o}},hr=e=>{if(!tr(e))return null;let t=typeof e.capturedAt==`string`?e.capturedAt:``,n=ar(e.failures),r={};if(tr(e.tabs))for(let[t,n]of Object.entries(e.tabs)){if(!tr(n))continue;let e={};for(let[t,r]of Object.entries(n))e[t]=cr(r);r[t]=e}let i={};if(tr(e.items))for(let[t,n]of Object.entries(e.items))i[t]=mr(n);return{capturedAt:t,tabs:r,items:i,failures:n}},gr=`/api/airplanesync`,_r=e=>{try{let t=JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)&&`type`in t&&typeof t.type==`string`?t:null}catch{return null}},vr=()=>{let[e,t]=(0,y.useState)(`off`),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)([]),c=(0,y.useRef)(null);return(0,y.useEffect)(()=>{if(!Xn())return;let e=!1;return $n().then(n=>{e||n===null||(a(n),t(`on`))}).catch(()=>{Zn(!1)}),()=>{e=!0}},[]),{status:e,progress:n,snapshot:i,failures:o,startSync:(0,y.useCallback)(()=>{c.current!==null&&c.current.abort();let e=new AbortController;c.current=e,t(`syncing`),r({fetched:0,total:0}),s([]),fetch(gr,{signal:e.signal}).then(async e=>{if(!e.ok||e.body===null){t(`error`),s([`HTTP ${e.status}`]);return}let n=e.body.pipeThrough(new TextDecoderStream).getReader(),i=``;for(;;){let{done:e,value:o}=await n.read();if(e)break;i+=o;let c=i.split(`
|
|
12
12
|
|
|
13
|
-
`);i=c.pop()??``;for(let e of c){if(!e.startsWith(`data: `))continue;let n=_r(e.slice(6));if(n!==null){if(n.type===`progress`)r({fetched:typeof n.fetched==`number`?n.fetched:0,total:typeof n.total==`number`?n.total:0});else if(n.type===`done`){let e=hr(n.snapshot);if(e===null){t(`error`),s([`Failed to parse snapshot`]);return}if(e.failures.length>0){s(e.failures),t(`error`);return}await Qn(e),Zn(!0),a(e),t(`on`),s([])}}}}}).catch(e=>{e instanceof Error&&e.name===`AbortError`||(t(`error`),s([e instanceof Error?e.message:String(e)]))})},[]),turnOff:(0,y.useCallback)(()=>{c.current!==null&&(c.current.abort(),c.current=null),t(`off`),a(null),r(null),s([]),Zn(!1),er().catch(()=>{})},[])}},yr=e=>typeof e==`object`&&!!e&&!Array.isArray(e),br=e=>typeof e==`string`?e:``,xr=e=>typeof e==`number`?e:0,Sr=e=>e===!0,Cr=`console-api-v1`,wr=async(e,t)=>{let n=`${e}?url=${encodeURIComponent(t)}`;try{let e=await fetch(n);if(!e.ok){let t=`HTTP ${e.status}`;try{let n=await e.json();yr(n)&&typeof n.error==`string`&&n.error.length>0&&(t=n.error)}catch(e){console.warn(`Failed to parse error body from non-ok response:`,e)}throw Error(t)}let t=await e.json();try{`caches`in globalThis&&globalThis.caches.open(Cr).then(e=>e.put(n,new Response(JSON.stringify(t),{headers:{"Content-Type":`application/json`}}))).catch(e=>{console.warn(`Failed to persist API response to cache:`,e)})}catch(e){console.warn(`Failed to access cache storage:`,e)}return t}catch(e){try{if(`caches`in globalThis){let e=await(await globalThis.caches.open(Cr)).match(n);if(e!==void 0)return e.json()}}catch{}throw e}},Tr=e=>!yr(e)||!Array.isArray(e.comments)?[]:e.comments.filter(yr).map(e=>({author:br(e.author),body:br(e.body),createdAt:br(e.createdAt)})),Er=e=>!yr(e)||!Array.isArray(e.files)?[]:e.files.filter(yr).map(e=>({path:br(e.path)||br(e.filename),additions:xr(e.additions),deletions:xr(e.deletions),status:br(e.status),patch:typeof e.patch==`string`?e.patch:null,rawUrl:typeof e.rawUrl==`string`?e.rawUrl:null})),Dr=e=>!yr(e)||!Array.isArray(e.commits)?[]:e.commits.filter(yr).map(e=>({sha:br(e.sha),message:br(e.message),author:br(e.author),authoredAt:br(e.authoredAt)})),Or=e=>yr(e)?{title:br(e.title),body:br(e.body),additions:xr(e.additions),deletions:xr(e.deletions),changedFiles:xr(e.changedFiles)}:null,kr=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Ar=e=>e===`MERGEABLE`?`MERGEABLE`:e===`CONFLICTING`?`CONFLICTING`:`UNKNOWN`,jr=e=>!yr(e)||!Array.isArray(e.relatedPullRequests)?[]:e.relatedPullRequests.filter(yr).map(e=>({url:br(e.url),branchName:typeof e.branchName==`string`?e.branchName:null,createdAt:br(e.createdAt),isDraft:Sr(e.isDraft),isConflicted:Sr(e.isConflicted),mergeableStatus:Ar(e.mergeableStatus),isPassedAllCiJob:Sr(e.isPassedAllCiJob),isCiStateSuccess:Sr(e.isCiStateSuccess),isResolvedAllReviewComments:Sr(e.isResolvedAllReviewComments),isBranchOutOfDate:Sr(e.isBranchOutOfDate),missingRequiredCheckNames:kr(e.missingRequiredCheckNames),summary:Or(e.summary)})),Mr=e=>{if(!yr(e)||!yr(e.status))return{found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]};let t=e.status;return{found:!0,isConflicted:Sr(t.isConflicted),mergeableStatus:Ar(t.mergeableStatus),isPassedAllCiJob:Sr(t.isPassedAllCiJob),isCiStateSuccess:Sr(t.isCiStateSuccess),isBranchOutOfDate:Sr(t.isBranchOutOfDate),missingRequiredCheckNames:kr(t.missingRequiredCheckNames)}},Nr=e=>yr(e)?{state:br(e.state)||`open`,merged:Sr(e.merged),isPullRequest:Sr(e.isPullRequest),title:br(e.title)}:{state:`open`,merged:!1,isPullRequest:!1,title:``},Pr=()=>({fetchItemBody:async e=>{let t=await wr(`/api/itembody`,e);return yr(t)?br(t.body):``},fetchComments:async e=>Tr(await wr(`/api/comments`,e)),fetchPrFiles:async e=>Er(await wr(`/api/prfiles`,e)),fetchPrCommits:async e=>Dr(await wr(`/api/prcommits`,e)),fetchRelatedPrs:async e=>jr(await wr(`/api/relatedprs`,e)),fetchIssueState:async e=>Nr(await wr(`/api/issuetitle`,e)),fetchPullRequestStatus:async e=>Mr(await wr(`/api/pullrequeststatus`,e))}),Fr=async e=>{let t=await e.text().catch(()=>``);if(t.length===0)return`HTTP ${e.status}`;try{let e=JSON.parse(t);if(yr(e)&&typeof e.error==`string`)return e.error}catch{return t}return t},Ir=async(e,t)=>{let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(await Fr(n))},Lr=`/api/comment`,Rr=e=>{if(!yr(e)||!yr(e.comment))throw Error(`comment was not returned`);return{author:br(e.comment.author),body:br(e.comment.body),createdAt:br(e.comment.createdAt)}},zr=async e=>{let t=await fetch(Lr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`HTTP ${t.status}`);return Rr(await t.json())},Br=`/api/upload`,Vr=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)},Hr=async e=>{let t=await fetch(Br,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t));let n=await t.json();if(!yr(n)||typeof n.markdown!=`string`)throw Error(`markdown was not returned`);return n.markdown},Ur=`/api/addstory`,Wr=async e=>{let t=await fetch(Ur,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},Gr=`/api/reviewcomment`,Kr=async e=>{let t=await fetch(Gr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},qr=`/api/createissue`,Jr=`/api/storycolor`,Yr=async e=>{let t=await fetch(Jr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},Xr=async e=>{let t=await fetch(qr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t));let n=await t.json();if(!(e=>typeof e==`object`&&!!e&&!Array.isArray(e))(n)||typeof n.issueUrl!=`string`)throw Error(`issueUrl was not returned`);return n.issueUrl},Zr=`/api/reorderstory`,Qr=async e=>{let t=await fetch(Zr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},$r=`/api/deleteallcomments`,ei=async e=>{let t=await fetch($r,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},ti=`/api/deletestory`,ni=async e=>{let t=await fetch(ti,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},ri=`/api/renamestory`,ii=async e=>{let t=await fetch(ri,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},ai=async()=>{let e=await fetch(`/api/projects`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(typeof t!=`object`||!t||Array.isArray(t))return{pjcodes:[],workflowImprovementIssueUrl:null};let n=t;return{pjcodes:Array.isArray(n.pjcodes)?n.pjcodes.filter(e=>typeof e==`string`):[],workflowImprovementIssueUrl:typeof n.workflowImprovementIssueUrl==`string`?n.workflowImprovementIssueUrl:null}},oi=`/api/projectreadmeconfig`,si=async e=>{let t=`${oi}?pjcode=${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(await Fr(n));let r=await n.json();return{maximumPreparingIssuesCount:yr(r)&&typeof r.maximumPreparingIssuesCount==`number`?r.maximumPreparingIssuesCount:null}},ci=`/api/setdependedissueurl`,li=async e=>{let t=await fetch(ci,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},ui=`/api/projectsettings`,di=async e=>{let t=await fetch(ui,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},fi=5e3,pi=e=>`${e.isPr?`PR #`:`#`}${e.number}`,mi=(e,t)=>{switch(e.type){case`review`:return e.action===`approve_and_merge`?`Approved & Merged`:e.action===`request_changes`?`Rejected`:e.action===`totally_wrong`?`Marked totally wrong`:`Marked unnecessary`;case`next_action_date`:return e.action===`snooze_1hour`?`Next Action Hour +1 hour`:e.action===`snooze_3hours`?`Next Action Hour +3 hours`:e.action===`snooze_1day`?`Next Action Date +1 day`:ue(t)?`Next Action Date +1 week and skip`:`Next Action Date +1 week`;case`set_story`:return`Story → ${e.optionName}`;case`set_status`:return`Status → ${e.optionName}`;case`set_in_tmux_by_human`:return`Added to In Tmux by human`;case`ok_and_awaiting_workspace`:return`ok → Awaiting Workspace`;case`close`:return e.action===`close`?`Closed`:`Closed as not planned`;case`delete_all_comments`:return`Deleted all comments`}},hi=e=>{switch(e.type){case`review`:return e.action===`approve_and_merge`?`green`:e.action===`request_changes`?`amber`:e.action===`totally_wrong`?`red`:`gray`;case`next_action_date`:return`amber`;case`set_story`:case`set_status`:case`set_in_tmux_by_human`:case`ok_and_awaiting_workspace`:return`blue`;case`close`:return`red`;case`delete_all_comments`:return`red`}},gi=(e,t)=>e.type===`next_action_date`?ue(t):e.type!==`delete_all_comments`,_i=(e,t,n)=>`${mi(e,n)} — ${pi(t)}`,vi=`console-offline-action-queue`,yi=e=>{if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&typeof t.message==`string`&&typeof t.color==`string`&&typeof t.enqueuedAt==`number`&&typeof t.itemUrl==`string`&&typeof t.projectItemId==`string`&&typeof t.itemNumber==`number`&&typeof t.repo==`string`&&typeof t.isPr==`boolean`&&typeof t.apiPath==`string`&&typeof t.requestBody==`object`&&t.requestBody!==null},bi=()=>{try{let e=localStorage.getItem(vi);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(yi):[]}catch{return[]}},xi=e=>{localStorage.setItem(vi,JSON.stringify(e))},Si=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`,Ci=e=>e instanceof TypeError,wi=e=>e instanceof Error&&e.message.length>0?e.message:String(e),Ti=100,Ei=e=>Math.max(0,Math.ceil((fi-e)/1e3)),Di=e=>Math.max(0,1-e/fi),Oi=()=>{let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(bi),o=(0,y.useRef)(i);o.current=i;let s=(0,y.useRef)(null),c=(0,y.useRef)(0),l=(0,y.useRef)(null),u=(0,y.useRef)(!1),d=(0,y.useCallback)(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]),f=(0,y.useCallback)(e=>{if(e.offline===void 0)return;let t={id:Si(),message:e.message,color:e.color,enqueuedAt:Date.now(),...e.offline};a(e=>{let n=[...e,t];return xi(n),n})},[]),p=(0,y.useCallback)(e=>{e.commit().catch(t=>{Ci(t)&&e.offline!==void 0?f(e):r({message:e.message,reason:wi(t)})})},[f]),m=(0,y.useCallback)(()=>{let e=s.current;d(),s.current=null,t(null),e!==null&&!u.current&&(u.current=!0,p(e))},[d,p]),h=(0,y.useCallback)(()=>{d(),s.current=null,u.current=!0,t(null)},[d]),g=(0,y.useCallback)(()=>{r(null)},[]),_=(0,y.useCallback)((e,t)=>{r({message:e,reason:t})},[]),v=(0,y.useCallback)(e=>{a(t=>{let n=t.filter(t=>t.id!==e);return xi(n),n})},[]),b=(0,y.useCallback)(async e=>{let t=o.current.find(t=>t.id===e);if(t!==void 0)try{await Ir(t.apiPath,t.requestBody),v(e)}catch(n){Ci(n)?r({message:t.message,reason:`Still offline — action is still held in the queue`}):(r({message:t.message,reason:wi(n)}),v(e))}},[v]),x=(0,y.useCallback)(e=>{if(s.current!==null&&!u.current){let e=s.current;d(),u.current=!0,p(e)}u.current=!1,s.current=e,c.current=Date.now(),t({message:e.message,color:e.color,remainingSeconds:Ei(0),progress:Di(0)}),e.advance(),l.current=setInterval(()=>{let n=Date.now()-c.current;if(n>=5e3){m();return}t({message:e.message,color:e.color,remainingSeconds:Ei(n),progress:Di(n)})},Ti)},[d,m,p]);return(0,y.useEffect)(()=>d,[d]),{pending:e,error:n,offlineActions:i,enqueue:x,showError:_,undo:h,dismissError:g,confirmOfflineAction:b,discardOfflineAction:v}},ki=class{fetcher;cache=new Map;inFlight=new Map;prefetchInFlight=new Set;constructor(e){this.fetcher=e}peek=e=>this.cache.get(e);has=e=>this.cache.has(e);load=(e,t)=>{let n=this.cache.get(e);if(n!==void 0)return Promise.resolve(n);let r=this.inFlight.get(e);if(r!==void 0)return r;let i=this.fetcher(t).then(t=>(this.cache.set(e,t),t)).finally(()=>{this.inFlight.delete(e)});return this.inFlight.set(e,i),i};prefetch=(e,t)=>{this.cache.has(e)||this.inFlight.has(e)||this.prefetchInFlight.has(e)||(this.prefetchInFlight.add(e),this.fetcher(t).then(t=>{this.cache.set(e,t)}).catch(()=>{}).finally(()=>{this.prefetchInFlight.delete(e)}))};seed(e,t){this.cache.set(e,t)}invalidate=e=>{this.cache.delete(e)}},Ai=e=>{try{let t=new URL(e).pathname.split(`/`).filter(Boolean);if(t.length>=4)return`${t[0]}/${t[1]}#${t[3]}`}catch{}return e},U=(e,t)=>{for(let[n,r]of Object.entries(t.items)){let t=Ai(n);e.body.seed(t,r.body),e.comments.seed(t,r.comments),e.state.seed(t,r.state),r.files!==null&&e.files.seed(t,r.files),r.commits!==null&&e.commits.seed(t,r.commits),r.prStatus!==null&&e.prStatus.seed(t,r.prStatus),r.relatedPrs!==null&&e.relatedPrs.seed(t,r.relatedPrs)}},ji=(e=null)=>(0,y.useMemo)(()=>{let t=Pr(),n={client:t,body:new ki(t.fetchItemBody),comments:new ki(t.fetchComments),files:new ki(t.fetchPrFiles),commits:new ki(t.fetchPrCommits),relatedPrs:new ki(t.fetchRelatedPrs),state:new ki(t.fetchIssueState),prStatus:new ki(t.fetchPullRequestStatus)};return e!==null&&U(n,e),n},[e]),Mi=0,Ni=500,Pi=2e3,Fi=e=>{let t=window;if(typeof t.requestIdleCallback==`function`&&typeof t.cancelIdleCallback==`function`){let n=t.requestIdleCallback(e,{timeout:Pi});return{cancel:()=>t.cancelIdleCallback?.(n)}}let n=window.setTimeout(e,0);return{cancel:()=>window.clearTimeout(n)}},Ii=(e,t)=>{let n=`${t.repo}#${t.number}`;e.body.prefetch(n,t.url),e.state.prefetch(n,t.url),e.comments.prefetch(n,t.url),t.isPr?(e.files.prefetch(n,t.url),e.commits.prefetch(n,t.url),e.prStatus.prefetch(n,t.url)):e.relatedPrs.prefetch(n,t.url)},Li=(e,t,n)=>{(0,y.useEffect)(()=>{if(t===null)return;let r=n.findIndex(e=>e.projectItemId===t.projectItemId);if(r===-1)return;let i=n.slice(r+1,r+1+Mi);if(i.length===0)return;let a=null,o=window.setTimeout(()=>{a=Fi(()=>{for(let t of i)Ii(e,t)})},Ni);return()=>{window.clearTimeout(o),a?.cancel()}},[e,t,n])},Ri=`/api/features`,zi=()=>{let[e,t]=(0,y.useState)({airplaneMode:!1});return(0,y.useEffect)(()=>{fetch(Ri).then(async e=>{if(!e.ok)return;let n=await e.json();typeof n==`object`&&n&&!Array.isArray(n)&&`airplaneMode`in n&&typeof n.airplaneMode==`boolean`&&t({airplaneMode:n.airplaneMode})}).catch(e=>{console.warn(`Failed to fetch /api/features`,e)})},[]),e},Bi=(e,t)=>{let n=D.findIndex(t=>t.name===e);if(n===-1)return null;for(let e=n+1;e<D.length;e+=1){let n=D[e].name;if((t[n]??0)>0)return n}return null},Vi=e=>{for(let t of D)if((e[t.name]??0)>0)return t.name;return D[0].name},Hi=new Set(D.map(e=>e.name)),Ui=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<3||t[0]!==`projects`)return null;let n=t[2];return Hi.has(n)?n:null},Wi=e=>{if(!e.startsWith(`#item/`))return null;let t=e.slice(6);return t.length===0?null:decodeURIComponent(t)},Gi=(e,t)=>{let n=(0,y.useCallback)(()=>{let e=Vi(t);return typeof window>`u`?{activeTab:e,selectedItemKey:null}:{activeTab:Ui(window.location.pathname)??e,selectedItemKey:Wi(window.location.hash)}},[t]),[r,i]=(0,y.useState)(n);(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{i(n())};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[n]),(0,y.useEffect)(()=>{if(typeof window>`u`||Ui(window.location.pathname)!==null)return;let e=Vi(t);i(t=>t.activeTab===e?t:{...t,activeTab:e})},[t]);let a=(0,y.useCallback)(t=>e===null?`#${t}`:`/projects/${e}/${t}`,[e]),o=(0,y.useCallback)(e=>{if(typeof window>`u`){i({activeTab:e,selectedItemKey:null});return}window.history.pushState({},``,a(e)),i({activeTab:e,selectedItemKey:null})},[a]),s=(0,y.useCallback)(e=>{typeof window<`u`&&(window.location.hash=`#item/${encodeURIComponent(e)}`),i(t=>({...t,selectedItemKey:e}))},[]),c=(0,y.useCallback)(()=>{if(typeof window<`u`&&window.location.hash!==``){let e=`${window.location.pathname}${window.location.search}`;window.history.pushState({},``,e)}i(e=>({...e,selectedItemKey:null}))},[]);return{activeTab:r.activeTab,selectedItemKey:r.selectedItemKey,tabHref:a,selectTab:o,openItem:s,closeItem:c}},Ki=e=>`pv_overlay_${e}`,qi=e=>e.projectItemId===``?e.itemId:e.projectItemId,Ji=(e,t)=>e!==void 0&&e.done===!0&&e.mode===t,Yi=(e,t,n)=>e.filter(e=>!Ji(t[qi(e)],n)).length,Xi=(e,t,n)=>e.filter(e=>!Ji(t[qi(e)],n)),Zi=(e,t)=>{let n=Date.parse(t);if(Number.isNaN(n))return{};let r={};for(let[t,i]of Object.entries(e))i.ts>=n&&(r[t]=i);return r},Qi=(e,t,n)=>{if(n===null)return null;let r=Date.parse(n);if(Number.isNaN(r))return null;let i=e[qi(t)];return i===void 0||i.ts<r?null:i.status??null},$i=(e,t,n,r,i)=>{let a={...e[t]??{},...n,ts:i,mode:r};return{...e,[t]:a}},ea=`/api/review`,ta=`/api/triage`,na=`/api/intmux`,ra=(e,t,n,r,i)=>{if(r===`approve_and_merge`)return{pjcode:e,action:`approve_and_merge`,prUrl:n,projectItemId:t.projectItemId};if(r===`request_changes`){let r=i[0];return{pjcode:e,action:`request_changes`,prUrl:n,projectItemId:t.projectItemId,commentBody:I(i),...r===void 0?{}:{changedFilePath:r.path,line:r.line,side:r.side}}}return r===`totally_wrong`?{pjcode:e,action:`close`,prUrl:n,issueUrl:t.url,projectItemId:t.projectItemId,commentBody:oe}:{pjcode:e,action:`unnecessary`,prUrl:n,projectItemId:t.projectItemId,issueUrl:t.url,commentBody:P,issueCommentBody:F(n)}},ia=(e,t,n,r)=>({pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId,...r??{}}),aa=(e,t)=>({pjcode:e,action:`set_intmux`,issueUrl:t.url,projectItemId:t.projectItemId}),oa=()=>Error(`No project specified in the URL path.`),sa=(e,t,n,r)=>{let{patchOverlay:i}=n,a=(0,y.useCallback)(e=>{if(r===void 0)return;let t=`${e.repo}#${e.number}`;r.body.invalidate(t),r.comments.invalidate(t)},[r]),o=(0,y.useCallback)(e=>{i(qi(e),{done:!0},t)},[i,t]);return{reviewPullRequest:(0,y.useCallback)(async(t,n,r,i=[])=>{if(e===null)throw oa();o(t),await Ir(ea,ra(e,t,n,r,i)),a(t)},[e,o,a]),setNextActionDate:(0,y.useCallback)(async(t,n)=>{if(e===null)throw oa();let r={pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId};o(t),await Ir(ta,r),a(t)},[e,o,a]),setStory:(0,y.useCallback)(async(n,r)=>{if(e===null)throw oa();let o={pjcode:e,action:`set_story`,issueUrl:n.url,projectItemId:n.projectItemId,storyOptionId:r.id};i(qi(n),{done:!0,story:{name:r.name,color:r.color}},t),await Ir(ta,o),a(n)},[e,a,i,t]),setStatus:(0,y.useCallback)(async(n,r)=>{if(e===null)throw oa();let o={pjcode:e,action:`set_status`,issueUrl:n.url,projectItemId:n.projectItemId,statusName:r.name};i(qi(n),{done:!0,status:{name:r.name,color:r.color}},t),await Ir(ta,o),a(n)},[e,a,i,t]),setInTmuxByHuman:(0,y.useCallback)(async(n,r)=>{if(e===null)throw oa();let o={pjcode:e,action:`set_intmux`,issueUrl:n.url,projectItemId:n.projectItemId};i(qi(n),{done:!0,status:{name:r.name,color:r.color}},t),await Ir(na,o),a(n)},[e,a,i,t]),closeIssue:(0,y.useCallback)(async(t,n)=>{if(e===null)throw oa();let r={pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId};o(t),await Ir(ta,r),a(t)},[e,o,a]),okAndMoveToAwaitingWorkspace:(0,y.useCallback)(async(n,r)=>{if(e===null)throw oa();i(qi(n),{done:!0,status:{name:r.name,color:r.color}},t),await zr({pjcode:e,url:n.url,body:`ok`}),await Ir(ta,{pjcode:e,action:`set_status`,issueUrl:n.url,projectItemId:n.projectItemId,statusName:r.name}),a(n)},[e,a,i,t]),addComment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw oa();let r=await zr({pjcode:e,url:t.url,body:n});return a(t),r},[e,a]),uploadAttachment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`no project in the URL path`);let r=Vr(new Uint8Array(await n.arrayBuffer()));return Hr({pjcode:e,url:t.url,fileName:n.name,contentBase64:r})},[e]),addInlineReviewComment:(0,y.useCallback)(async(t,n,r,i,a)=>{if(e===null)throw oa();await Kr({pjcode:e,url:t,path:n,line:r,side:i,body:a})},[e]),deleteAllComments:(0,y.useCallback)(async e=>{await ei({issueUrl:e.url}),a(e)},[a]),setDependedIssueUrl:(0,y.useCallback)(async(t,n)=>{if(e===null)throw oa();await li({pjcode:e,issueUrl:t.url,dependedIssueUrl:n})},[e])}},ca=e=>typeof e==`object`&&!!e&&typeof e.ts==`number`,la=e=>{if(typeof localStorage>`u`)return{};let t=localStorage.getItem(Ki(e));if(t===null)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{};let r={};for(let[e,t]of Object.entries(n))ca(t)&&(r[e]=t);return r},ua=(e,t)=>{typeof localStorage<`u`&&localStorage.setItem(Ki(e),JSON.stringify(t))},da=e=>{let[t,n]=(0,y.useState)(()=>la(e));return{overlay:t,patchOverlay:(0,y.useCallback)((t,r,i)=>{n(n=>{let a=$i(n,t,r,i,Date.now());return ua(e,a),a})},[e])}},fa=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<2||t[0]!==`projects`)return null;let n=t[1];return n.length===0?null:n},pa=()=>fa(typeof window>`u`?``:window.location.pathname),ma=()=>{let[e,t]=(0,y.useState)([]),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(null);return(0,y.useEffect)(()=>{let e=!1;return a(!0),s(null),ai().then(n=>{e||(t(n.pjcodes),r(n.workflowImprovementIssueUrl),a(!1))}).catch(t=>{e||(s(t instanceof Error?t:Error(String(t))),a(!1))}),()=>{e=!0}},[]),{pjcodes:e,workflowImprovementIssueUrl:n,isLoading:i,error:o}},ha=e=>{let[t,n]=(0,y.useState)(!1),[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(``),d=(0,y.useCallback)(async()=>{if(e!==null){n(!0),i(!0),c(null);try{let t=await si(e);u(t.maximumPreparingIssuesCount===null?``:String(t.maximumPreparingIssuesCount))}catch(e){c(e instanceof Error?e.message:`Failed to load settings`)}finally{i(!1)}}},[e]),f=(0,y.useCallback)(()=>{n(!1),c(null)},[]),p=(0,y.useCallback)(e=>{u(e)},[]),m=(0,y.useCallback)(async t=>{if(e!==null){o(!0),c(null);try{await di({pjcode:e,maximumPreparingIssuesCount:t}),n(!1)}catch(e){c(e instanceof Error?e.message:`Failed to save settings`)}finally{o(!1)}}},[e]);return(0,y.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&f()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t,f]),{isOpen:t,isLoading:r,isSaving:a,error:s,inputValue:l,open:d,close:f,changeInput:p,save:m}},ga=e=>{let t=(0,y.useRef)(e),n=(0,y.useRef)(Date.now());return t.current!==e&&(t.current=e,n.current=Date.now()),{isTimerExpired:(0,y.useCallback)(e=>e<=0?!1:Date.now()-n.current>=e*60*1e3,[])}},_a=/##\s+エグゼクティブサマリ(?:\s*\/\s*Executive\s+Summary)?\s*\n/i,va=/^From:\s+:robot:/m,ya=e=>{let t=_a.exec(e);if(t===null)return null;let n=e.slice(t.index+t[0].length),r=va.exec(n),i=(r===null?n:n.slice(0,r.index)).trim();return i.length>0?i:null},ba=e=>e.length===0?null:ya(e[e.length-1].body),xa=e=>`${e.repo}#${e.number}`,Sa=(e,t,n)=>{let[r,i]=(0,y.useState)({});return(0,y.useEffect)(()=>{if(!n)return;let r=!1;for(let n of e){let e=xa(n),a=t.peek(e);if(a!==void 0){let e=ba(a);r||i(t=>t[n.projectItemId]===e?t:{...t,[n.projectItemId]:e});continue}t.load(e,n.url).then(e=>{if(r)return;let t=ba(e);i(e=>e[n.projectItemId]===t?e:{...e,[n.projectItemId]:t})}).catch(()=>{r||i(e=>e[n.projectItemId]===null?e:{...e,[n.projectItemId]:null})})}return()=>{r=!0}},[e,t,n]),r},Ca=(e,t)=>{let n=Math.abs(e);return n<60||n<=Math.abs(t)*1.5?null:e<0?`next`:`previous`},wa=(e,t)=>{let n=Math.abs(e),r=Math.abs(t);return r>n*1.5&&r>20},Ta=e=>{let t=e instanceof Element?e:null;for(;t!==null&&t!==document.body;){let e=window.getComputedStyle(t).overflowX;if((e===`auto`||e===`scroll`)&&t.scrollWidth>t.clientWidth)return!0;t=t.parentElement}return!1},Ea=e=>{let t=(0,y.useRef)(e);t.current=e;let n=(0,y.useRef)(null),r=(0,y.useCallback)(e=>{let n=0,r=0,i=!1,a=e=>{if(e.touches.length!==1){i=!1;return}if(Ta(e.target)){i=!1;return}let t=e.touches[0];n=t.clientX,r=t.clientY,i=!0},o=e=>{if(!i)return;let t=e.touches[0];wa(t.clientX-n,t.clientY-r)&&(i=!1)},s=e=>{if(!i||(i=!1,e.changedTouches.length!==1))return;let a=e.changedTouches[0],o=Ca(a.clientX-n,a.clientY-r);o!==null&&t.current(o)};return e.addEventListener(`touchstart`,a,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`touchend`,s,{passive:!0}),()=>{e.removeEventListener(`touchstart`,a),e.removeEventListener(`touchmove`,o),e.removeEventListener(`touchend`,s)}},[]),i=(0,y.useCallback)(e=>{n.current!==null&&(n.current(),n.current=null),e!==null&&(n.current=r(e))},[r]);return(0,y.useEffect)(()=>()=>{n.current!==null&&(n.current(),n.current=null)},[]),i},Da=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Oa=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],ka=e=>!Da(e)||!Array.isArray(e.items)?[]:e.items.filter(Da).map(e=>({...e,relatedOpenPullRequestUrls:Oa(e.relatedOpenPullRequestUrls)})),Aa=e=>Array.isArray(e)?e.filter(Da):[],ja=e=>Array.isArray(e)?e.filter(Da):[],Ma=e=>({items:ka(e),generatedAt:Da(e)&&typeof e.generatedAt==`string`?e.generatedAt:``,statusOptions:Da(e)?Aa(e.statusOptions):[],agentOptions:Da(e)?Aa(e.agentOptions):[],storyOptions:Da(e)?Aa(e.storyOptions):[],storyColors:Da(e)&&Da(e.storyColors)?e.storyColors:{},stories:Da(e)?ja(e.stories):[],defaultNameWithOwner:Da(e)&&typeof e.defaultNameWithOwner==`string`?e.defaultNameWithOwner:null,storyOrder:Da(e)?Oa(e.storyOrder):[],timerEndsAt:Da(e)&&typeof e.timerEndsAt==`string`?e.timerEndsAt:null,timerTotalSeconds:Da(e)&&typeof e.timerTotalSeconds==`number`&&e.timerTotalSeconds>0?e.timerTotalSeconds:null}),Na=()=>{let e={};for(let t of D)e[t.name]=null;return e},Pa=(e,t)=>`/projects/${e}/${t}/list.json`,Fa=6e4,Ia=`console-list-v1`,La=(e,t)=>{try{if(!(`caches`in globalThis))return;globalThis.caches.open(Ia).then(n=>n.put(e,new Response(JSON.stringify(t),{headers:{"Content-Type":`application/json`}}))).catch(e=>{console.warn(`Failed to persist tab snapshot to cache:`,e)})}catch(e){console.warn(`Failed to access cache storage:`,e)}},Ra=async e=>{if(!(`caches`in globalThis))return null;try{let t=await(await globalThis.caches.open(Ia)).match(e);return t===void 0?null:{...Ma(await t.json()),fromCache:!0}}catch{return null}},za=async(e,t)=>{let n=Pa(e,t);try{let e=await fetch(n);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();return La(n,t),{snapshot:{...Ma(t),fromCache:!1},error:null}}catch(e){let t=await Ra(n);return t===null?{snapshot:null,error:e instanceof Error?e:Error(String(e))}:{snapshot:t,error:null}}},Ba=async e=>{let t=await Promise.all(D.map(async t=>{let{snapshot:n,error:r}=await za(e,t.name);return{tabName:t.name,snapshot:n,error:r}})),n=Na(),r=null;for(let{tabName:e,snapshot:i,error:a}of t)n[e]=i,a!==null&&r===null&&(r=a);return{snapshots:n,firstError:Object.values(n).every(e=>e===null)?r:null}},Va=(e,t=null)=>{let[n,r]=(0,y.useState)(Na),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(t!==null&&e!==null){let n=t.tabs[e];if(n!==void 0){let e=Na();for(let t of D){let r=n[t.name];r!==void 0&&(e[t.name]={...r})}r(e),a(!1),s(null);return}}let n=!1;if(a(!0),s(null),e===null)return r(Na()),a(!1),s(`No project specified in the URL path.`),()=>{n=!0};let i=()=>{Ba(e).then(({snapshots:e,firstError:t})=>{n||(r(e),s(t===null?null:t.message),a(!1))}).catch(e=>{n||(s(e instanceof Error?e.message:String(e)),a(!1))})};i();let o=setInterval(i,Fa);return()=>{n=!0,clearInterval(o)}},[e,t]),{snapshots:n,isLoading:i,error:o}},Ha=`tdpm-timer-settings`,Ua=()=>({timerMode:!1,projectMinutes:{}}),Wa=()=>{if(typeof localStorage>`u`)return Ua();let e=localStorage.getItem(Ha);if(e===null)return Ua();try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return Ua();let n=t,r=typeof n.timerMode==`boolean`&&n.timerMode,i=n.projectMinutes;return{timerMode:r,projectMinutes:typeof i==`object`&&i&&!Array.isArray(i)?Object.fromEntries(Object.entries(i).filter(([,e])=>typeof e==`number`).map(([e,t])=>[e,t])):{}}}catch{return Ua()}},Ga=e=>{typeof localStorage<`u`&&localStorage.setItem(Ha,JSON.stringify(e))},Ka=(e,t,n)=>{if(e.length===0)return null;let r=t===null?-1:e.indexOf(t),i=r===-1?0:(r+1)%e.length,a=r===-1?e.length:e.length-1;for(let t=0;t<a;t++){let r=e[(i+t)%e.length];if((n[r]??0)>0)return r}return null},qa=()=>{let[e,t]=(0,y.useState)(Wa),[n,r]=(0,y.useState)(!1),[i,a]=(0,y.useState)(e),o=(0,y.useCallback)(()=>{t(e=>(a(e),e)),r(!0)},[]),s=(0,y.useCallback)(()=>{r(!1)},[]),c=(0,y.useCallback)(()=>{a(e=>(Ga(e),t(e),e)),r(!1)},[]),l=(0,y.useCallback)(e=>{a(t=>({...t,timerMode:e}))},[]),u=(0,y.useCallback)((e,t)=>{a(n=>({...n,projectMinutes:{...n.projectMinutes,[e]:t}}))},[]);return{timerMode:e.timerMode,projectMinutes:e.projectMinutes,isOpen:n,draftTimerMode:i.timerMode,draftProjectMinutes:i.projectMinutes,openSettings:o,closeSettings:s,saveSettings:c,toggleDraftTimerMode:l,changeDraftMinutes:u}},Ja=e=>{window.location.replace(e)},Ya=e=>{window.location.assign(e)},Xa=(e,t)=>{let n=e.indexOf(t);if(n<0)return e.length>0?e[0]:null;let r=n+1;return r<e.length?e[r]:null},Za=(e,t)=>{let n=e.indexOf(t);return n<0||n>=e.length-1?null:e[n+1]},Qa=(e,t)=>{let n=e.indexOf(t);return n<=0?null:e[n-1]},$a=(e,t)=>e.length===0?`${t}\n`:e.endsWith(`
|
|
13
|
+
`);i=c.pop()??``;for(let e of c){if(!e.startsWith(`data: `))continue;let n=_r(e.slice(6));if(n!==null){if(n.type===`progress`)r({fetched:typeof n.fetched==`number`?n.fetched:0,total:typeof n.total==`number`?n.total:0});else if(n.type===`done`){let e=hr(n.snapshot);if(e===null){t(`error`),s([`Failed to parse snapshot`]);return}if(e.failures.length>0){s(e.failures),t(`error`);return}await Qn(e),Zn(!0),a(e),t(`on`),s([])}}}}}).catch(e=>{e instanceof Error&&e.name===`AbortError`||(t(`error`),s([e instanceof Error?e.message:String(e)]))})},[]),turnOff:(0,y.useCallback)(()=>{c.current!==null&&(c.current.abort(),c.current=null),t(`off`),a(null),r(null),s([]),Zn(!1),er().catch(()=>{})},[])}},yr=e=>typeof e==`object`&&!!e&&!Array.isArray(e),br=e=>typeof e==`string`?e:``,xr=e=>typeof e==`number`?e:0,Sr=e=>e===!0,Cr=`console-api-v1`,wr=async(e,t)=>{let n=`${e}?url=${encodeURIComponent(t)}`;try{let e=await fetch(n);if(!e.ok){let t=`HTTP ${e.status}`;try{let n=await e.json();yr(n)&&typeof n.error==`string`&&n.error.length>0&&(t=n.error)}catch(e){console.warn(`Failed to parse error body from non-ok response:`,e)}throw Error(t)}let t=await e.json();try{`caches`in globalThis&&globalThis.caches.open(Cr).then(e=>e.put(n,new Response(JSON.stringify(t),{headers:{"Content-Type":`application/json`}}))).catch(e=>{console.warn(`Failed to persist API response to cache:`,e)})}catch(e){console.warn(`Failed to access cache storage:`,e)}return t}catch(e){try{if(`caches`in globalThis){let e=await(await globalThis.caches.open(Cr)).match(n);if(e!==void 0)return e.json()}}catch{}throw e}},Tr=e=>!yr(e)||!Array.isArray(e.comments)?[]:e.comments.filter(yr).map(e=>({author:br(e.author),body:br(e.body),createdAt:br(e.createdAt)})),Er=e=>!yr(e)||!Array.isArray(e.files)?[]:e.files.filter(yr).map(e=>({path:br(e.path)||br(e.filename),additions:xr(e.additions),deletions:xr(e.deletions),status:br(e.status),patch:typeof e.patch==`string`?e.patch:null,rawUrl:typeof e.rawUrl==`string`?e.rawUrl:null})),Dr=e=>!yr(e)||!Array.isArray(e.commits)?[]:e.commits.filter(yr).map(e=>({sha:br(e.sha),message:br(e.message),author:br(e.author),authoredAt:br(e.authoredAt)})),Or=e=>yr(e)?{title:br(e.title),body:br(e.body),additions:xr(e.additions),deletions:xr(e.deletions),changedFiles:xr(e.changedFiles)}:null,kr=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Ar=e=>e===`MERGEABLE`?`MERGEABLE`:e===`CONFLICTING`?`CONFLICTING`:`UNKNOWN`,jr=e=>!yr(e)||!Array.isArray(e.relatedPullRequests)?[]:e.relatedPullRequests.filter(yr).map(e=>({url:br(e.url),branchName:typeof e.branchName==`string`?e.branchName:null,createdAt:br(e.createdAt),isDraft:Sr(e.isDraft),isConflicted:Sr(e.isConflicted),mergeableStatus:Ar(e.mergeableStatus),isPassedAllCiJob:Sr(e.isPassedAllCiJob),isCiStateSuccess:Sr(e.isCiStateSuccess),isResolvedAllReviewComments:Sr(e.isResolvedAllReviewComments),isBranchOutOfDate:Sr(e.isBranchOutOfDate),missingRequiredCheckNames:kr(e.missingRequiredCheckNames),summary:Or(e.summary)})),Mr=e=>{if(!yr(e)||!yr(e.status))return{found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]};let t=e.status;return{found:!0,isConflicted:Sr(t.isConflicted),mergeableStatus:Ar(t.mergeableStatus),isPassedAllCiJob:Sr(t.isPassedAllCiJob),isCiStateSuccess:Sr(t.isCiStateSuccess),isBranchOutOfDate:Sr(t.isBranchOutOfDate),missingRequiredCheckNames:kr(t.missingRequiredCheckNames)}},Nr=e=>yr(e)?{state:br(e.state)||`open`,merged:Sr(e.merged),isPullRequest:Sr(e.isPullRequest),title:br(e.title)}:{state:`open`,merged:!1,isPullRequest:!1,title:``},Pr=()=>({fetchItemBody:async e=>{let t=await wr(`/api/itembody`,e);return yr(t)?br(t.body):``},fetchComments:async e=>Tr(await wr(`/api/comments`,e)),fetchPrFiles:async e=>Er(await wr(`/api/prfiles`,e)),fetchPrCommits:async e=>Dr(await wr(`/api/prcommits`,e)),fetchRelatedPrs:async e=>jr(await wr(`/api/relatedprs`,e)),fetchIssueState:async e=>Nr(await wr(`/api/issuetitle`,e)),fetchPullRequestStatus:async e=>Mr(await wr(`/api/pullrequeststatus`,e))}),Fr=async e=>{let t=await e.text().catch(()=>``);if(t.length===0)return`HTTP ${e.status}`;try{let e=JSON.parse(t);if(yr(e)&&typeof e.error==`string`)return e.error}catch{return t}return t},Ir=async(e,t)=>{let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(await Fr(n))},Lr=`/api/comment`,Rr=e=>{if(!yr(e)||!yr(e.comment))throw Error(`comment was not returned`);return{author:br(e.comment.author),body:br(e.comment.body),createdAt:br(e.comment.createdAt)}},zr=async e=>{let t=await fetch(Lr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`HTTP ${t.status}`);return Rr(await t.json())},Br=`/api/upload`,Vr=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)},Hr=async e=>{let t=await fetch(Br,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t));let n=await t.json();if(!yr(n)||typeof n.markdown!=`string`)throw Error(`markdown was not returned`);return n.markdown},Ur=`/api/addstory`,Wr=async e=>{let t=await fetch(Ur,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},Gr=`/api/reviewcomment`,Kr=async e=>{let t=await fetch(Gr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},qr=`/api/createissue`,Jr=`/api/storycolor`,Yr=async e=>{let t=await fetch(Jr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},Xr=async e=>{let t=await fetch(qr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t));let n=await t.json();if(!(e=>typeof e==`object`&&!!e&&!Array.isArray(e))(n)||typeof n.issueUrl!=`string`)throw Error(`issueUrl was not returned`);return n.issueUrl},Zr=`/api/reorderstory`,Qr=async e=>{let t=await fetch(Zr,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},$r=`/api/deleteallcomments`,ei=async e=>{let t=await fetch($r,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},ti=`/api/deletestory`,ni=async e=>{let t=await fetch(ti,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},ri=`/api/renamestory`,ii=async e=>{let t=await fetch(ri,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},ai=async()=>{let e=await fetch(`/api/projects`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(typeof t!=`object`||!t||Array.isArray(t))return{pjcodes:[],workflowImprovementIssueUrl:null};let n=t;return{pjcodes:Array.isArray(n.pjcodes)?n.pjcodes.filter(e=>typeof e==`string`):[],workflowImprovementIssueUrl:typeof n.workflowImprovementIssueUrl==`string`?n.workflowImprovementIssueUrl:null}},oi=`/api/projectreadmeconfig`,si=async e=>{let t=`${oi}?pjcode=${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(await Fr(n));let r=await n.json();return{maximumPreparingIssuesCount:yr(r)&&typeof r.maximumPreparingIssuesCount==`number`?r.maximumPreparingIssuesCount:null}},ci=`/api/setdependedissueurl`,li=async e=>{let t=await fetch(ci,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},ui=`/api/projectsettings`,di=async e=>{let t=await fetch(ui,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Fr(t))},fi=5e3,pi=e=>`${e.isPr?`PR #`:`#`}${e.number}`,mi=(e,t)=>{switch(e.type){case`review`:return e.action===`approve_and_merge`?`Approved & Merged`:e.action===`request_changes`?`Rejected`:e.action===`totally_wrong`?`Marked totally wrong`:`Marked unnecessary`;case`next_action_date`:return e.action===`snooze_1hour`?`Next Action Hour +1 hour`:e.action===`snooze_3hours`?`Next Action Hour +3 hours`:e.action===`snooze_1day`?`Next Action Date +1 day`:ue(t)?`Next Action Date +1 week and skip`:`Next Action Date +1 week`;case`set_story`:return`Story → ${e.optionName}`;case`set_status`:return`Status → ${e.optionName}`;case`set_in_tmux_by_human`:return`Added to In Tmux by human`;case`ok_and_awaiting_workspace`:return`ok → Awaiting Workspace`;case`close`:return e.action===`close`?`Closed`:`Closed as not planned`;case`delete_all_comments`:return`Deleted all comments`}},hi=e=>{switch(e.type){case`review`:return e.action===`approve_and_merge`?`green`:e.action===`request_changes`?`amber`:e.action===`totally_wrong`?`red`:`gray`;case`next_action_date`:return`amber`;case`set_story`:case`set_status`:case`set_in_tmux_by_human`:case`ok_and_awaiting_workspace`:return`blue`;case`close`:return`red`;case`delete_all_comments`:return`red`}},gi=(e,t)=>e.type===`next_action_date`?ue(t):e.type!==`delete_all_comments`,_i=(e,t,n)=>`${mi(e,n)} — ${pi(t)}`,vi=`console-offline-action-queue`,yi=e=>{if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&typeof t.message==`string`&&typeof t.color==`string`&&typeof t.enqueuedAt==`number`&&typeof t.itemUrl==`string`&&typeof t.projectItemId==`string`&&typeof t.itemNumber==`number`&&typeof t.repo==`string`&&typeof t.isPr==`boolean`&&typeof t.apiPath==`string`&&typeof t.requestBody==`object`&&t.requestBody!==null},bi=()=>{try{let e=localStorage.getItem(vi);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(yi):[]}catch{return[]}},xi=e=>{localStorage.setItem(vi,JSON.stringify(e))},Si=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`,Ci=e=>e instanceof TypeError,wi=e=>e instanceof Error&&e.message.length>0?e.message:String(e),Ti=100,Ei=e=>Math.max(0,Math.ceil((fi-e)/1e3)),Di=e=>Math.max(0,1-e/fi),Oi=()=>{let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(bi),o=(0,y.useRef)(i);o.current=i;let s=(0,y.useRef)(null),c=(0,y.useRef)(0),l=(0,y.useRef)(null),u=(0,y.useRef)(!1),d=(0,y.useCallback)(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]),f=(0,y.useCallback)(e=>{if(e.offline===void 0)return;let t={id:Si(),message:e.message,color:e.color,enqueuedAt:Date.now(),...e.offline};a(e=>{let n=[...e,t];return xi(n),n})},[]),p=(0,y.useCallback)(e=>{e.commit().catch(t=>{Ci(t)&&e.offline!==void 0?f(e):r({message:e.message,reason:wi(t)})})},[f]),m=(0,y.useCallback)(()=>{let e=s.current;d(),s.current=null,t(null),e!==null&&!u.current&&(u.current=!0,p(e))},[d,p]),h=(0,y.useCallback)(()=>{d(),s.current=null,u.current=!0,t(null)},[d]),g=(0,y.useCallback)(()=>{r(null)},[]),_=(0,y.useCallback)((e,t)=>{r({message:e,reason:t})},[]),v=(0,y.useCallback)(e=>{a(t=>{let n=t.filter(t=>t.id!==e);return xi(n),n})},[]),b=(0,y.useCallback)(async e=>{let t=o.current.find(t=>t.id===e);if(t!==void 0)try{await Ir(t.apiPath,t.requestBody),v(e)}catch(n){Ci(n)?r({message:t.message,reason:`Still offline — action is still held in the queue`}):(r({message:t.message,reason:wi(n)}),v(e))}},[v]),x=(0,y.useCallback)(e=>{if(s.current!==null&&!u.current){let e=s.current;d(),u.current=!0,p(e)}u.current=!1,s.current=e,c.current=Date.now(),t({message:e.message,color:e.color,remainingSeconds:Ei(0),progress:Di(0)}),e.advance(),l.current=setInterval(()=>{let n=Date.now()-c.current;if(n>=5e3){m();return}t({message:e.message,color:e.color,remainingSeconds:Ei(n),progress:Di(n)})},Ti)},[d,m,p]);return(0,y.useEffect)(()=>d,[d]),{pending:e,error:n,offlineActions:i,enqueue:x,showError:_,undo:h,dismissError:g,confirmOfflineAction:b,discardOfflineAction:v}},ki=class{fetcher;cache=new Map;inFlight=new Map;prefetchInFlight=new Set;constructor(e){this.fetcher=e}peek=e=>this.cache.get(e);has=e=>this.cache.has(e);load=(e,t)=>{let n=this.cache.get(e);if(n!==void 0)return Promise.resolve(n);let r=this.inFlight.get(e);if(r!==void 0)return r;let i=this.fetcher(t).then(t=>(this.cache.set(e,t),t)).finally(()=>{this.inFlight.delete(e)});return this.inFlight.set(e,i),i};prefetch=(e,t)=>{this.cache.has(e)||this.inFlight.has(e)||this.prefetchInFlight.has(e)||(this.prefetchInFlight.add(e),this.fetcher(t).then(t=>{this.cache.set(e,t)}).catch(()=>{}).finally(()=>{this.prefetchInFlight.delete(e)}))};seed(e,t){this.cache.set(e,t)}invalidate=e=>{this.cache.delete(e)}},Ai=e=>{try{let t=new URL(e).pathname.split(`/`).filter(Boolean);if(t.length>=4)return`${t[0]}/${t[1]}#${t[3]}`}catch{}return e},U=(e,t)=>{for(let[n,r]of Object.entries(t.items)){let t=Ai(n);e.body.seed(t,r.body),e.comments.seed(t,r.comments),e.state.seed(t,r.state),r.files!==null&&e.files.seed(t,r.files),r.commits!==null&&e.commits.seed(t,r.commits),r.prStatus!==null&&e.prStatus.seed(t,r.prStatus),r.relatedPrs!==null&&e.relatedPrs.seed(t,r.relatedPrs)}},ji=(e=null)=>(0,y.useMemo)(()=>{let t=Pr(),n={client:t,body:new ki(t.fetchItemBody),comments:new ki(t.fetchComments),files:new ki(t.fetchPrFiles),commits:new ki(t.fetchPrCommits),relatedPrs:new ki(t.fetchRelatedPrs),state:new ki(t.fetchIssueState),prStatus:new ki(t.fetchPullRequestStatus)};return e!==null&&U(n,e),n},[e]),Mi=0,Ni=500,Pi=2e3,Fi=e=>{let t=window;if(typeof t.requestIdleCallback==`function`&&typeof t.cancelIdleCallback==`function`){let n=t.requestIdleCallback(e,{timeout:Pi});return{cancel:()=>t.cancelIdleCallback?.(n)}}let n=window.setTimeout(e,0);return{cancel:()=>window.clearTimeout(n)}},Ii=(e,t)=>{let n=`${t.repo}#${t.number}`;e.body.prefetch(n,t.url),e.state.prefetch(n,t.url),e.comments.prefetch(n,t.url),t.isPr?(e.files.prefetch(n,t.url),e.commits.prefetch(n,t.url),e.prStatus.prefetch(n,t.url)):e.relatedPrs.prefetch(n,t.url)},Li=(e,t,n)=>{(0,y.useEffect)(()=>{if(t===null)return;let r=n.findIndex(e=>e.projectItemId===t.projectItemId);if(r===-1)return;let i=n.slice(r+1,r+1+Mi);if(i.length===0)return;let a=null,o=window.setTimeout(()=>{a=Fi(()=>{for(let t of i)Ii(e,t)})},Ni);return()=>{window.clearTimeout(o),a?.cancel()}},[e,t,n])},Ri=`/api/features`,zi=()=>{let[e,t]=(0,y.useState)({airplaneMode:!1});return(0,y.useEffect)(()=>{fetch(Ri).then(async e=>{if(!e.ok)return;let n=await e.json();typeof n==`object`&&n&&!Array.isArray(n)&&`airplaneMode`in n&&typeof n.airplaneMode==`boolean`&&t({airplaneMode:n.airplaneMode})}).catch(e=>{console.warn(`Failed to fetch /api/features`,e)})},[]),e},Bi=(e,t)=>{let n=D.findIndex(t=>t.name===e);if(n===-1)return null;for(let e=n+1;e<D.length;e+=1){let n=D[e].name;if((t[n]??0)>0)return n}return null},Vi=e=>{for(let t of D)if((e[t.name]??0)>0)return t.name;return D[0].name},Hi=new Set(D.map(e=>e.name)),Ui=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<3||t[0]!==`projects`)return null;let n=t[2];return Hi.has(n)?n:null},Wi=e=>{if(!e.startsWith(`#item/`))return null;let t=e.slice(6);return t.length===0?null:decodeURIComponent(t)},Gi=(e,t)=>{let n=(0,y.useCallback)(()=>{let e=Vi(t);return typeof window>`u`?{activeTab:e,selectedItemKey:null}:{activeTab:Ui(window.location.pathname)??e,selectedItemKey:Wi(window.location.hash)}},[t]),[r,i]=(0,y.useState)(n);(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{i(n())};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[n]),(0,y.useEffect)(()=>{if(typeof window>`u`||Ui(window.location.pathname)!==null)return;let e=Vi(t);i(t=>t.activeTab===e?t:{...t,activeTab:e})},[t]);let a=(0,y.useCallback)(t=>e===null?`#${t}`:`/projects/${e}/${t}`,[e]),o=(0,y.useCallback)(e=>{if(typeof window>`u`){i({activeTab:e,selectedItemKey:null});return}window.history.pushState({},``,a(e)),i({activeTab:e,selectedItemKey:null})},[a]),s=(0,y.useCallback)(e=>{typeof window<`u`&&(window.location.hash=`#item/${encodeURIComponent(e)}`),i(t=>({...t,selectedItemKey:e}))},[]),c=(0,y.useCallback)(()=>{if(typeof window<`u`&&window.location.hash!==``){let e=`${window.location.pathname}${window.location.search}`;window.history.pushState({},``,e)}i(e=>({...e,selectedItemKey:null}))},[]);return{activeTab:r.activeTab,selectedItemKey:r.selectedItemKey,tabHref:a,selectTab:o,openItem:s,closeItem:c}},Ki=e=>`pv_overlay_${e}`,qi=e=>e.projectItemId===``?e.itemId:e.projectItemId,Ji=(e,t)=>e!==void 0&&e.done===!0&&e.mode===t,Yi=(e,t,n)=>e.filter(e=>!Ji(t[qi(e)],n)).length,Xi=(e,t,n)=>e.filter(e=>!Ji(t[qi(e)],n)),Zi=(e,t)=>{let n=Date.parse(t);if(Number.isNaN(n))return{};let r={};for(let[t,i]of Object.entries(e))i.ts>=n&&(r[t]=i);return r},Qi=(e,t,n)=>{if(n===null)return null;let r=Date.parse(n);if(Number.isNaN(r))return null;let i=e[qi(t)];return i===void 0||i.ts<r?null:i.status??null},$i=(e,t,n,r,i)=>{let a={...e[t]??{},...n,ts:i,mode:r};return{...e,[t]:a}},ea=`/api/review`,ta=`/api/triage`,na=`/api/intmux`,ra=(e,t,n,r,i)=>{if(r===`approve_and_merge`)return{pjcode:e,action:`approve_and_merge`,prUrl:n,projectItemId:t.projectItemId};if(r===`request_changes`){let r=i[0];return{pjcode:e,action:`request_changes`,prUrl:n,projectItemId:t.projectItemId,commentBody:I(i),...r===void 0?{}:{changedFilePath:r.path,line:r.line,side:r.side}}}return r===`totally_wrong`?{pjcode:e,action:`close`,prUrl:n,issueUrl:t.url,projectItemId:t.projectItemId,commentBody:oe}:{pjcode:e,action:`unnecessary`,prUrl:n,projectItemId:t.projectItemId,issueUrl:t.url,commentBody:P,issueCommentBody:F(n)}},ia=(e,t,n,r)=>({pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId,...r??{}}),aa=(e,t)=>({pjcode:e,action:`set_intmux`,issueUrl:t.url,projectItemId:t.projectItemId}),oa=()=>Error(`No project specified in the URL path.`),sa=(e,t,n,r)=>{let{patchOverlay:i}=n,a=(0,y.useCallback)(e=>{if(r===void 0)return;let t=`${e.repo}#${e.number}`;r.body.invalidate(t),r.comments.invalidate(t)},[r]),o=(0,y.useCallback)(e=>{i(qi(e),{done:!0},t)},[i,t]);return{reviewPullRequest:(0,y.useCallback)(async(t,n,r,i=[])=>{if(e===null)throw oa();o(t),await Ir(ea,ra(e,t,n,r,i)),a(t)},[e,o,a]),setNextActionDate:(0,y.useCallback)(async(t,n)=>{if(e===null)throw oa();let r={pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId};o(t),await Ir(ta,r),a(t)},[e,o,a]),setStory:(0,y.useCallback)(async(n,r)=>{if(e===null)throw oa();let o={pjcode:e,action:`set_story`,issueUrl:n.url,projectItemId:n.projectItemId,storyOptionId:r.id};i(qi(n),{done:!0,story:{name:r.name,color:r.color}},t),await Ir(ta,o),a(n)},[e,a,i,t]),setStatus:(0,y.useCallback)(async(n,r)=>{if(e===null)throw oa();let o={pjcode:e,action:`set_status`,issueUrl:n.url,projectItemId:n.projectItemId,statusName:r.name};i(qi(n),{done:!0,status:{name:r.name,color:r.color}},t),await Ir(ta,o),a(n)},[e,a,i,t]),setInTmuxByHuman:(0,y.useCallback)(async(n,r)=>{if(e===null)throw oa();let o={pjcode:e,action:`set_intmux`,issueUrl:n.url,projectItemId:n.projectItemId};i(qi(n),{done:!0,status:{name:r.name,color:r.color}},t),await Ir(na,o),a(n)},[e,a,i,t]),closeIssue:(0,y.useCallback)(async(t,n)=>{if(e===null)throw oa();let r={pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId};o(t),await Ir(ta,r),a(t)},[e,o,a]),okAndMoveToAwaitingWorkspace:(0,y.useCallback)(async(n,r)=>{if(e===null)throw oa();i(qi(n),{done:!0,status:{name:r.name,color:r.color}},t),await zr({pjcode:e,url:n.url,body:`ok`}),await Ir(ta,{pjcode:e,action:`set_status`,issueUrl:n.url,projectItemId:n.projectItemId,statusName:r.name}),a(n)},[e,a,i,t]),addComment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw oa();let r=await zr({pjcode:e,url:t.url,body:n});return a(t),r},[e,a]),uploadAttachment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`no project in the URL path`);let r=Vr(new Uint8Array(await n.arrayBuffer()));return Hr({pjcode:e,url:t.url,fileName:n.name,contentBase64:r})},[e]),addInlineReviewComment:(0,y.useCallback)(async(t,n,r,i,a)=>{if(e===null)throw oa();await Kr({pjcode:e,url:t,path:n,line:r,side:i,body:a})},[e]),deleteAllComments:(0,y.useCallback)(async e=>{await ei({issueUrl:e.url}),a(e)},[a]),setDependedIssueUrl:(0,y.useCallback)(async(t,n)=>{if(e===null)throw oa();await li({pjcode:e,issueUrl:t.url,dependedIssueUrl:n})},[e])}},ca=e=>typeof e==`object`&&!!e&&typeof e.ts==`number`,la=e=>{if(typeof localStorage>`u`)return{};let t=localStorage.getItem(Ki(e));if(t===null)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{};let r={};for(let[e,t]of Object.entries(n))ca(t)&&(r[e]=t);return r},ua=(e,t)=>{typeof localStorage<`u`&&localStorage.setItem(Ki(e),JSON.stringify(t))},da=e=>{let[t,n]=(0,y.useState)(()=>la(e));return{overlay:t,patchOverlay:(0,y.useCallback)((t,r,i)=>{n(n=>{let a=$i(n,t,r,i,Date.now());return ua(e,a),a})},[e])}},fa=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<2||t[0]!==`projects`)return null;let n=t[1];return n.length===0?null:n},pa=()=>fa(typeof window>`u`?``:window.location.pathname),ma=()=>{let[e,t]=(0,y.useState)([]),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(null);return(0,y.useEffect)(()=>{let e=!1;return a(!0),s(null),ai().then(n=>{e||(t(n.pjcodes),r(n.workflowImprovementIssueUrl),a(!1))}).catch(t=>{e||(s(t instanceof Error?t:Error(String(t))),a(!1))}),()=>{e=!0}},[]),{pjcodes:e,workflowImprovementIssueUrl:n,isLoading:i,error:o}},ha=e=>{let[t,n]=(0,y.useState)(!1),[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(``),d=(0,y.useCallback)(async()=>{if(e!==null){n(!0),i(!0),c(null);try{let t=await si(e);u(t.maximumPreparingIssuesCount===null?``:String(t.maximumPreparingIssuesCount))}catch(e){c(e instanceof Error?e.message:`Failed to load settings`)}finally{i(!1)}}},[e]),f=(0,y.useCallback)(()=>{n(!1),c(null)},[]),p=(0,y.useCallback)(e=>{u(e)},[]),m=(0,y.useCallback)(async t=>{if(e!==null){o(!0),c(null);try{await di({pjcode:e,maximumPreparingIssuesCount:t}),n(!1)}catch(e){c(e instanceof Error?e.message:`Failed to save settings`)}finally{o(!1)}}},[e]);return(0,y.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&f()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t,f]),{isOpen:t,isLoading:r,isSaving:a,error:s,inputValue:l,open:d,close:f,changeInput:p,save:m}},ga=e=>{let t=(0,y.useRef)(e),n=(0,y.useRef)(Date.now());return t.current!==e&&(t.current=e,n.current=Date.now()),{isTimerExpired:(0,y.useCallback)(e=>e<=0?!1:Date.now()-n.current>=e*60*1e3,[])}},_a=/##\s+エグゼクティブサマリ(?:\s*\/\s*Executive\s+Summary)?\s*\n/i,va=/^From:\s+:robot:/m,ya=e=>{let t=_a.exec(e);if(t===null)return null;let n=e.slice(t.index+t[0].length),r=va.exec(n),i=(r===null?n:n.slice(0,r.index)).trim();return i.length>0?i:null},ba=e=>{for(let t=e.length-1;t>=0;t--){let n=ya(e[t].body);if(n!==null)return n}return null},xa=e=>`${e.repo}#${e.number}`,Sa=(e,t,n)=>{let[r,i]=(0,y.useState)({});return(0,y.useEffect)(()=>{if(!n)return;let r=!1;for(let n of e){let e=xa(n),a=t.peek(e);if(a!==void 0){let e=ba(a);r||i(t=>t[n.projectItemId]===e?t:{...t,[n.projectItemId]:e});continue}t.load(e,n.url).then(e=>{if(r)return;let t=ba(e);i(e=>e[n.projectItemId]===t?e:{...e,[n.projectItemId]:t})}).catch(()=>{r||i(e=>e[n.projectItemId]===null?e:{...e,[n.projectItemId]:null})})}return()=>{r=!0}},[e,t,n]),r},Ca=(e,t)=>{let n=Math.abs(e);return n<60||n<=Math.abs(t)*1.5?null:e<0?`next`:`previous`},wa=(e,t)=>{let n=Math.abs(e),r=Math.abs(t);return r>n*1.5&&r>20},Ta=e=>{let t=e instanceof Element?e:null;for(;t!==null&&t!==document.body;){let e=window.getComputedStyle(t).overflowX;if((e===`auto`||e===`scroll`)&&t.scrollWidth>t.clientWidth)return!0;t=t.parentElement}return!1},Ea=e=>{let t=(0,y.useRef)(e);t.current=e;let n=(0,y.useRef)(null),r=(0,y.useCallback)(e=>{let n=0,r=0,i=!1,a=e=>{if(e.touches.length!==1){i=!1;return}if(Ta(e.target)){i=!1;return}let t=e.touches[0];n=t.clientX,r=t.clientY,i=!0},o=e=>{if(!i)return;let t=e.touches[0];wa(t.clientX-n,t.clientY-r)&&(i=!1)},s=e=>{if(!i||(i=!1,e.changedTouches.length!==1))return;let a=e.changedTouches[0],o=Ca(a.clientX-n,a.clientY-r);o!==null&&t.current(o)};return e.addEventListener(`touchstart`,a,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`touchend`,s,{passive:!0}),()=>{e.removeEventListener(`touchstart`,a),e.removeEventListener(`touchmove`,o),e.removeEventListener(`touchend`,s)}},[]),i=(0,y.useCallback)(e=>{n.current!==null&&(n.current(),n.current=null),e!==null&&(n.current=r(e))},[r]);return(0,y.useEffect)(()=>()=>{n.current!==null&&(n.current(),n.current=null)},[]),i},Da=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Oa=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],ka=e=>!Da(e)||!Array.isArray(e.items)?[]:e.items.filter(Da).map(e=>({...e,relatedOpenPullRequestUrls:Oa(e.relatedOpenPullRequestUrls)})),Aa=e=>Array.isArray(e)?e.filter(Da):[],ja=e=>Array.isArray(e)?e.filter(Da):[],Ma=e=>({items:ka(e),generatedAt:Da(e)&&typeof e.generatedAt==`string`?e.generatedAt:``,statusOptions:Da(e)?Aa(e.statusOptions):[],agentOptions:Da(e)?Aa(e.agentOptions):[],storyOptions:Da(e)?Aa(e.storyOptions):[],storyColors:Da(e)&&Da(e.storyColors)?e.storyColors:{},stories:Da(e)?ja(e.stories):[],defaultNameWithOwner:Da(e)&&typeof e.defaultNameWithOwner==`string`?e.defaultNameWithOwner:null,storyOrder:Da(e)?Oa(e.storyOrder):[],timerEndsAt:Da(e)&&typeof e.timerEndsAt==`string`?e.timerEndsAt:null,timerTotalSeconds:Da(e)&&typeof e.timerTotalSeconds==`number`&&e.timerTotalSeconds>0?e.timerTotalSeconds:null}),Na=()=>{let e={};for(let t of D)e[t.name]=null;return e},Pa=(e,t)=>`/projects/${e}/${t}/list.json`,Fa=6e4,Ia=`console-list-v1`,La=(e,t)=>{try{if(!(`caches`in globalThis))return;globalThis.caches.open(Ia).then(n=>n.put(e,new Response(JSON.stringify(t),{headers:{"Content-Type":`application/json`}}))).catch(e=>{console.warn(`Failed to persist tab snapshot to cache:`,e)})}catch(e){console.warn(`Failed to access cache storage:`,e)}},Ra=async e=>{if(!(`caches`in globalThis))return null;try{let t=await(await globalThis.caches.open(Ia)).match(e);return t===void 0?null:{...Ma(await t.json()),fromCache:!0}}catch{return null}},za=async(e,t)=>{let n=Pa(e,t);try{let e=await fetch(n);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();return La(n,t),{snapshot:{...Ma(t),fromCache:!1},error:null}}catch(e){let t=await Ra(n);return t===null?{snapshot:null,error:e instanceof Error?e:Error(String(e))}:{snapshot:t,error:null}}},Ba=async e=>{let t=await Promise.all(D.map(async t=>{let{snapshot:n,error:r}=await za(e,t.name);return{tabName:t.name,snapshot:n,error:r}})),n=Na(),r=null;for(let{tabName:e,snapshot:i,error:a}of t)n[e]=i,a!==null&&r===null&&(r=a);return{snapshots:n,firstError:Object.values(n).every(e=>e===null)?r:null}},Va=(e,t=null)=>{let[n,r]=(0,y.useState)(Na),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(t!==null&&e!==null){let n=t.tabs[e];if(n!==void 0){let e=Na();for(let t of D){let r=n[t.name];r!==void 0&&(e[t.name]={...r})}r(e),a(!1),s(null);return}}let n=!1;if(a(!0),s(null),e===null)return r(Na()),a(!1),s(`No project specified in the URL path.`),()=>{n=!0};let i=()=>{Ba(e).then(({snapshots:e,firstError:t})=>{n||(r(e),s(t===null?null:t.message),a(!1))}).catch(e=>{n||(s(e instanceof Error?e.message:String(e)),a(!1))})};i();let o=setInterval(i,Fa);return()=>{n=!0,clearInterval(o)}},[e,t]),{snapshots:n,isLoading:i,error:o}},Ha=`tdpm-timer-settings`,Ua=()=>({timerMode:!1,projectMinutes:{}}),Wa=()=>{if(typeof localStorage>`u`)return Ua();let e=localStorage.getItem(Ha);if(e===null)return Ua();try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return Ua();let n=t,r=typeof n.timerMode==`boolean`&&n.timerMode,i=n.projectMinutes;return{timerMode:r,projectMinutes:typeof i==`object`&&i&&!Array.isArray(i)?Object.fromEntries(Object.entries(i).filter(([,e])=>typeof e==`number`).map(([e,t])=>[e,t])):{}}}catch{return Ua()}},Ga=e=>{typeof localStorage<`u`&&localStorage.setItem(Ha,JSON.stringify(e))},Ka=(e,t,n)=>{if(e.length===0)return null;let r=t===null?-1:e.indexOf(t),i=r===-1?0:(r+1)%e.length,a=r===-1?e.length:e.length-1;for(let t=0;t<a;t++){let r=e[(i+t)%e.length];if((n[r]??0)>0)return r}return null},qa=()=>{let[e,t]=(0,y.useState)(Wa),[n,r]=(0,y.useState)(!1),[i,a]=(0,y.useState)(e),o=(0,y.useCallback)(()=>{t(e=>(a(e),e)),r(!0)},[]),s=(0,y.useCallback)(()=>{r(!1)},[]),c=(0,y.useCallback)(()=>{a(e=>(Ga(e),t(e),e)),r(!1)},[]),l=(0,y.useCallback)(e=>{a(t=>({...t,timerMode:e}))},[]),u=(0,y.useCallback)((e,t)=>{a(n=>({...n,projectMinutes:{...n.projectMinutes,[e]:t}}))},[]);return{timerMode:e.timerMode,projectMinutes:e.projectMinutes,isOpen:n,draftTimerMode:i.timerMode,draftProjectMinutes:i.projectMinutes,openSettings:o,closeSettings:s,saveSettings:c,toggleDraftTimerMode:l,changeDraftMinutes:u}},Ja=e=>{window.location.replace(e)},Ya=e=>{window.location.assign(e)},Xa=(e,t)=>{let n=e.indexOf(t);if(n<0)return e.length>0?e[0]:null;let r=n+1;return r<e.length?e[r]:null},Za=(e,t)=>{let n=e.indexOf(t);return n<0||n>=e.length-1?null:e[n+1]},Qa=(e,t)=>{let n=e.indexOf(t);return n<=0?null:e[n-1]},$a=(e,t)=>e.length===0?`${t}\n`:e.endsWith(`
|
|
14
14
|
`)?`${e}${t}\n`:`${e}\n${t}\n`,eo=(e,t)=>{let n=`![uploading ${t}]()`;return`${e.length===0?``:e.replace(/\n*$/,`
|
|
15
15
|
`)}\n\n\n${n}\n`},to=(e,t,n)=>{let r=`![uploading ${t}]()`,i=e.indexOf(r);return i===-1?$a(e,n):e.slice(0,i)+n+e.slice(i+r.length)},no=(e,t)=>{let n=`![uploading ${t}]()`,r=e.indexOf(n);if(r===-1)return e;let i=r,a=0;for(;a<3&&i>0&&e[i-1]===`
|
|
16
16
|
`;)i--,a++;let o=+(e[r+n.length]===`
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>TDPM Console</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-kzHm7Yu0.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-Wylovsnd.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|