beads-enhanced-ui 0.1.0
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/LICENSE +22 -0
- package/README.md +95 -0
- package/app/index.html +49 -0
- package/app/main.bundle.js +999 -0
- package/app/main.bundle.js.map +7 -0
- package/app/protocol.js +216 -0
- package/app/styles.css +2342 -0
- package/bin/bdui.js +19 -0
- package/package.json +90 -0
- package/server/app.js +110 -0
- package/server/bd.js +227 -0
- package/server/cli/commands.js +203 -0
- package/server/cli/daemon.js +271 -0
- package/server/cli/index.js +135 -0
- package/server/cli/open.js +139 -0
- package/server/cli/usage.js +27 -0
- package/server/config.js +36 -0
- package/server/db.js +154 -0
- package/server/index.js +76 -0
- package/server/list-adapters.js +264 -0
- package/server/logging.js +23 -0
- package/server/registry-watcher.js +200 -0
- package/server/subscriptions.js +299 -0
- package/server/validators.js +113 -0
- package/server/watcher.js +139 -0
- package/server/ws.js +1363 -0
|
@@ -0,0 +1,999 @@
|
|
|
1
|
+
var Rn=Object.create;var vs=Object.defineProperty;var In=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames;var Dn=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty;var Mn=(s,e,t)=>e in s?vs(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var xs=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var On=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ln(e))!Nn.call(s,r)&&r!==t&&vs(s,r,{get:()=>e[r],enumerable:!(n=In(e,r))||n.enumerable});return s};var Pn=(s,e,t)=>(t=s!=null?Rn(Dn(s)):{},On(e||!s||!s.__esModule?vs(t,"default",{value:s,enumerable:!0}):t,s));var ce=(s,e,t)=>Mn(s,typeof e!="symbol"?e+"":e,t);var xr=xs((ma,vr)=>{var xt=1e3,$t=xt*60,At=$t*60,ft=At*24,Hn=ft*7,qn=ft*365.25;vr.exports=function(s,e){e=e||{};var t=typeof s;if(t==="string"&&s.length>0)return jn(s);if(t==="number"&&isFinite(s))return e.long?Wn(s):Gn(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))};function jn(s){if(s=String(s),!(s.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*qn;case"weeks":case"week":case"w":return t*Hn;case"days":case"day":case"d":return t*ft;case"hours":case"hour":case"hrs":case"hr":case"h":return t*At;case"minutes":case"minute":case"mins":case"min":case"m":return t*$t;case"seconds":case"second":case"secs":case"sec":case"s":return t*xt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Gn(s){var e=Math.abs(s);return e>=ft?Math.round(s/ft)+"d":e>=At?Math.round(s/At)+"h":e>=$t?Math.round(s/$t)+"m":e>=xt?Math.round(s/xt)+"s":s+"ms"}function Wn(s){var e=Math.abs(s);return e>=ft?es(s,e,ft,"day"):e>=At?es(s,e,At,"hour"):e>=$t?es(s,e,$t,"minute"):e>=xt?es(s,e,xt,"second"):s+" ms"}function es(s,e,t,n){var r=e>=t*1.5;return Math.round(s/t)+" "+n+(r?"s":"")}});var Ar=xs((ba,$r)=>{function Kn(s){t.debug=t,t.default=t,t.coerce=o,t.disable=a,t.enable=r,t.enabled=l,t.humanize=xr(),t.destroy=f,Object.keys(s).forEach(u=>{t[u]=s[u]}),t.names=[],t.skips=[],t.formatters={};function e(u){let h=0;for(let d=0;d<u.length;d++)h=(h<<5)-h+u.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(u){let h,d=null,m,y;function S(...E){if(!S.enabled)return;let M=S,F=Number(new Date),Z=F-(h||F);M.diff=Z,M.prev=h,M.curr=F,h=F,E[0]=t.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let N=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(H,ee)=>{if(H==="%%")return"%";N++;let D=t.formatters[ee];if(typeof D=="function"){let X=E[N];H=D.call(M,X),E.splice(N,1),N--}return H}),t.formatArgs.call(M,E),(M.log||t.log).apply(M,E)}return S.namespace=u,S.useColors=t.useColors(),S.color=t.selectColor(u),S.extend=n,S.destroy=t.destroy,Object.defineProperty(S,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==t.namespaces&&(m=t.namespaces,y=t.enabled(u)),y),set:E=>{d=E}}),typeof t.init=="function"&&t.init(S),S}function n(u,h){let d=t(this.namespace+(typeof h>"u"?":":h)+u);return d.log=this.log,d}function r(u){t.save(u),t.namespaces=u,t.names=[],t.skips=[];let h=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of h)d[0]==="-"?t.skips.push(d.slice(1)):t.names.push(d)}function i(u,h){let d=0,m=0,y=-1,S=0;for(;d<u.length;)if(m<h.length&&(h[m]===u[d]||h[m]==="*"))h[m]==="*"?(y=m,S=d,m++):(d++,m++);else if(y!==-1)m=y+1,S++,d=S;else return!1;for(;m<h.length&&h[m]==="*";)m++;return m===h.length}function a(){let u=[...t.names,...t.skips.map(h=>"-"+h)].join(",");return t.enable(""),u}function l(u){for(let h of t.skips)if(i(u,h))return!1;for(let h of t.names)if(i(u,h))return!0;return!1}function o(u){return u instanceof Error?u.stack||u.message:u}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}$r.exports=Kn});var Sr=xs((Ne,ts)=>{Ne.formatArgs=Yn;Ne.save=Zn;Ne.load=Xn;Ne.useColors=Vn;Ne.storage=Qn();Ne.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ne.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Vn(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let s;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(s=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(s[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Yn(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+ts.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;s.splice(1,0,e,"color: inherit");let t=0,n=0;s[0].replace(/%[a-zA-Z%]/g,r=>{r!=="%%"&&(t++,r==="%c"&&(n=t))}),s.splice(n,0,e)}Ne.log=console.debug||console.log||(()=>{});function Zn(s){try{s?Ne.storage.setItem("debug",s):Ne.storage.removeItem("debug")}catch{}}function Xn(){let s;try{s=Ne.storage.getItem("debug")||Ne.storage.getItem("DEBUG")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function Qn(){try{return localStorage}catch{}}ts.exports=Ar()(Ne);var{formatters:Jn}=ts.exports;Jn.j=function(s){try{return JSON.stringify(s)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Rt=globalThis,Jt=Rt.trustedTypes,pr=Jt?Jt.createPolicy("lit-html",{createHTML:s=>s}):void 0,yr="$lit$",tt=`lit$${Math.random().toFixed(9).slice(2)}$`,wr="?"+tt,Fn=`<${wr}>`,ut=document,It=()=>ut.createComment(""),Lt=s=>s===null||typeof s!="object"&&typeof s!="function",Rs=Array.isArray,zn=s=>Rs(s)||typeof s?.[Symbol.iterator]=="function",$s=`[
|
|
2
|
+
\f\r]`,Ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,fr=/-->/g,hr=/>/g,ct=RegExp(`>|${$s}(?:([^\\s"'>=/]+)(${$s}*=${$s}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),gr=/'/g,mr=/"/g,kr=/^(?:script|style|textarea|title)$/i,Is=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),T=Is(1),da=Is(2),ua=Is(3),pt=Symbol.for("lit-noChange"),be=Symbol.for("lit-nothing"),br=new WeakMap,dt=ut.createTreeWalker(ut,129);function _r(s,e){if(!Rs(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return pr!==void 0?pr.createHTML(e):e}var Bn=(s,e)=>{let t=s.length-1,n=[],r,i=e===2?"<svg>":e===3?"<math>":"",a=Ct;for(let l=0;l<t;l++){let o=s[l],f,u,h=-1,d=0;for(;d<o.length&&(a.lastIndex=d,u=a.exec(o),u!==null);)d=a.lastIndex,a===Ct?u[1]==="!--"?a=fr:u[1]!==void 0?a=hr:u[2]!==void 0?(kr.test(u[2])&&(r=RegExp("</"+u[2],"g")),a=ct):u[3]!==void 0&&(a=ct):a===ct?u[0]===">"?(a=r??Ct,h=-1):u[1]===void 0?h=-2:(h=a.lastIndex-u[2].length,f=u[1],a=u[3]===void 0?ct:u[3]==='"'?mr:gr):a===mr||a===gr?a=ct:a===fr||a===hr?a=Ct:(a=ct,r=void 0);let m=a===ct&&s[l+1].startsWith("/>")?" ":"";i+=a===Ct?o+Fn:h>=0?(n.push(f),o.slice(0,h)+yr+o.slice(h)+tt+m):o+tt+(h===-2?l:m)}return[_r(s,i+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Dt=class s{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let i=0,a=0,l=e.length-1,o=this.parts,[f,u]=Bn(e,t);if(this.el=s.createElement(f,n),dt.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=dt.nextNode())!==null&&o.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(yr)){let d=u[a++],m=r.getAttribute(h).split(tt),y=/([.?@])?(.*)/.exec(d);o.push({type:1,index:i,name:y[2],strings:m,ctor:y[1]==="."?Ss:y[1]==="?"?Ts:y[1]==="@"?Es:_t}),r.removeAttribute(h)}else h.startsWith(tt)&&(o.push({type:6,index:i}),r.removeAttribute(h));if(kr.test(r.tagName)){let h=r.textContent.split(tt),d=h.length-1;if(d>0){r.textContent=Jt?Jt.emptyScript:"";for(let m=0;m<d;m++)r.append(h[m],It()),dt.nextNode(),o.push({type:2,index:++i});r.append(h[d],It())}}}else if(r.nodeType===8)if(r.data===wr)o.push({type:2,index:i});else{let h=-1;for(;(h=r.data.indexOf(tt,h+1))!==-1;)o.push({type:7,index:i}),h+=tt.length-1}i++}}static createElement(e,t){let n=ut.createElement("template");return n.innerHTML=e,n}};function kt(s,e,t=s,n){if(e===pt)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,i=Lt(e)?void 0:e._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),i===void 0?r=void 0:(r=new i(s),r._$AT(s,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=r:t._$Cl=r),r!==void 0&&(e=kt(s,r._$AS(s,e.values),r,n)),e}var As=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??ut).importNode(t,!0);dt.currentNode=r;let i=dt.nextNode(),a=0,l=0,o=n[0];for(;o!==void 0;){if(a===o.index){let f;o.type===2?f=new Nt(i,i.nextSibling,this,e):o.type===1?f=new o.ctor(i,o.name,o.strings,this,e):o.type===6&&(f=new Cs(i,this,e)),this._$AV.push(f),o=n[++l]}a!==o?.index&&(i=dt.nextNode(),a++)}return dt.currentNode=ut,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Nt=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=be,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=kt(this,e,t),Lt(e)?e===be||e==null||e===""?(this._$AH!==be&&this._$AR(),this._$AH=be):e!==this._$AH&&e!==pt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):zn(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==be&&Lt(this._$AH)?this._$AA.nextSibling.data=e:this.T(ut.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Dt.createElement(_r(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let i=new As(r,this),a=i.u(this.options);i.p(t),this.T(a),this._$AH=i}}_$AC(e){let t=br.get(e.strings);return t===void 0&&br.set(e.strings,t=new Dt(e)),t}k(e){Rs(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let i of e)r===t.length?t.push(n=new s(this.O(It()),this.O(It()),this,this.options)):n=t[r],n._$AI(i),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},_t=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=be,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=be}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=kt(this,e,t,0),a=!Lt(e)||e!==this._$AH&&e!==pt,a&&(this._$AH=e);else{let l=e,o,f;for(e=i[0],o=0;o<i.length-1;o++)f=kt(this,l[n+o],t,o),f===pt&&(f=this._$AH[o]),a||(a=!Lt(f)||f!==this._$AH[o]),f===be?e=be:e!==be&&(e+=(f??"")+i[o+1]),this._$AH[o]=f}a&&!r&&this.j(e)}j(e){e===be?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Ss=class extends _t{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===be?void 0:e}},Ts=class extends _t{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==be)}},Es=class extends _t{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=kt(this,e,t,0)??be)===pt)return;let n=this._$AH,r=e===be&&n!==be||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==be&&(n===be||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Cs=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){kt(this,e)}};var Un=Rt.litHtmlPolyfillSupport;Un?.(Dt,Nt),(Rt.litHtmlVersions??(Rt.litHtmlVersions=[])).push("3.3.1");var Te=(s,e,t)=>{let n=t?.renderBefore??e,r=n._$litPart$;if(r===void 0){let i=t?.renderBefore??null;n._$litPart$=r=new Nt(e.insertBefore(It(),i),i,void 0,t??{})}return r._$AI(s),r};function Ue(s,e){let t=s.priority??2,n=e.priority??2;if(t!==n)return t-n;let r=s.created_at??0,i=e.created_at??0;if(r!==i)return r<i?-1:1;let a=s.id,l=e.id;return a<l?-1:a>l?1:0}function vt(s,e){let t=s.closed_at??0,n=e.closed_at??0;if(t!==n)return t<n?1:-1;let r=s?.id,i=e?.id;return r<i?-1:r>i?1:0}function st(s=void 0){function e(i){return!s||typeof s.snapshotFor!="function"?[]:s.snapshotFor(i).slice().sort(Ue)}function t(i,a){let l=s&&s.snapshotFor?s.snapshotFor(i).slice():[];return a==="in_progress"?l.sort(Ue):a==="closed"?l.sort(vt):l.sort(Ue),l}function n(i){if(!s||typeof s.snapshotFor!="function")return[];let l=(s.snapshotFor(`detail:${i}`)||[]).find(f=>String(f?.id||"")===String(i));return(Array.isArray(l?.dependents)?l.dependents:[]).slice().sort(Ue)}function r(i){return s&&typeof s.subscribe=="function"?s.subscribe(i):()=>{}}return{selectIssuesFor:e,selectBoardColumn:t,selectEpicChildren:n,subscribe:r}}var Tr=Pn(Sr(),1);function de(s){return(0,Tr.default)(`beads-ui:${s}`)}function Er(s){let e=de("data");async function t(n){let{id:r}=n;e("updateIssue %s %o",r,Object.keys(n));let i=null;return typeof n.title=="string"&&(i=await s("edit-text",{id:r,field:"title",value:n.title})),typeof n.acceptance=="string"&&(i=await s("edit-text",{id:r,field:"acceptance",value:n.acceptance})),typeof n.notes=="string"&&(i=await s("edit-text",{id:r,field:"notes",value:n.notes})),typeof n.design=="string"&&(i=await s("edit-text",{id:r,field:"design",value:n.design})),typeof n.status=="string"&&(i=await s("update-status",{id:r,status:n.status})),typeof n.priority=="number"&&(i=await s("update-priority",{id:r,priority:n.priority})),typeof n.assignee=="string"&&(i=await s("update-assignee",{id:r,assignee:n.assignee})),e("updateIssue done %s",r),i}return{updateIssue:t}}function Ls(s,e={}){let t=de(`issue-store:${s}`),n=new Map,r=[],i=0,a=new Set,l=!1,o=e.sort||Ue;function f(){for(let d of Array.from(a))try{d()}catch{}}function u(){r=Array.from(n.values()).sort(o)}function h(d){if(l||!d||d.id!==s)return;let m=Number(d.revision)||0;if(t("apply %s rev=%d",d.type,m),!(m<=i&&d.type!=="snapshot")){if(d.type==="snapshot"){if(m<=i)return;n.clear();let y=Array.isArray(d.issues)?d.issues:[];for(let S of y)S&&typeof S.id=="string"&&S.id.length>0&&n.set(S.id,S);u(),i=m,f();return}if(d.type==="upsert"){let y=d.issue;if(y&&typeof y.id=="string"&&y.id.length>0){let S=n.get(y.id);if(!S)n.set(y.id,y);else{let E=Number.isFinite(S.updated_at)?S.updated_at:0,M=Number.isFinite(y.updated_at)?y.updated_at:0;if(E<=M){for(let F of Object.keys(S))F in y||delete S[F];for(let[F,Z]of Object.entries(y))S[F]=Z}}u()}i=m,f()}else if(d.type==="delete"){let y=String(d.issue_id||"");y&&(n.delete(y),u()),i=m,f()}}}return{id:s,subscribe(d){return a.add(d),()=>{a.delete(d)}},applyPush:h,snapshot(){return r},size(){return n.size},getById(d){return n.get(d)},dispose(){l=!0,n.clear(),r=[],a.clear(),i=0}}}function ss(s){let e=String(s.type||"").trim(),t={};if(s.params&&typeof s.params=="object"){let r=Object.keys(s.params).sort();for(let i of r){let a=s.params[i];t[i]=String(a)}}let n=new URLSearchParams(t).toString();return n.length>0?`${e}?${n}`:e}function Cr(s){let e=de("subs"),t=new Map,n=new Map;function r(l,o){e("applyDelta %s +%d ~%d -%d",l,(o.added||[]).length,(o.updated||[]).length,(o.removed||[]).length);let f=n.get(l);if(!f||f.size===0)return;let u=Array.isArray(o.added)?o.added:[],h=Array.isArray(o.updated)?o.updated:[],d=Array.isArray(o.removed)?o.removed:[];for(let m of Array.from(f)){let y=t.get(m);if(!y)continue;let S=y.itemsById;for(let E of u)typeof E=="string"&&E.length>0&&S.set(E,!0);for(let E of h)typeof E=="string"&&E.length>0&&S.set(E,!0);for(let E of d)typeof E=="string"&&E.length>0&&S.delete(E)}}async function i(l,o){let f=ss(o);if(e("subscribe %s key=%s",l,f),!t.has(l))t.set(l,{key:f,itemsById:new Map});else{let h=t.get(l);if(h&&h.key!==f){let d=n.get(h.key);d&&(d.delete(l),d.size===0&&n.delete(h.key)),t.set(l,{key:f,itemsById:new Map})}}n.has(f)||n.set(f,new Set);let u=n.get(f);u&&u.add(l);try{await s("subscribe-list",{id:l,type:o.type,params:o.params})}catch(h){let d=t.get(l)||null;if(d){let m=n.get(d.key);m&&(m.delete(l),m.size===0&&n.delete(d.key))}throw t.delete(l),h}return async()=>{e("unsubscribe %s key=%s",l,f);try{await s("unsubscribe-list",{id:l})}catch{}let h=t.get(l)||null;if(h){let d=n.get(h.key);d&&(d.delete(l),d.size===0&&n.delete(h.key))}t.delete(l)}}return{subscribeList:i,_applyDelta:r,_subKeyOf:ss,selectors:{getIds(l){let o=t.get(l);return o?Array.from(o.itemsById.keys()):[]},has(l,o){let f=t.get(l);return f?f.itemsById.has(o):!1},count(l){let o=t.get(l);return o?o.itemsById.size:0},getItemsById(l){let o=t.get(l),f={};if(!o)return f;for(let u of o.itemsById.keys())f[u]=!0;return f}}}}function Rr(){let s=de("issue-stores"),e=new Map,t=new Map,n=new Set,r=new Map;function i(){for(let o of Array.from(n))try{o()}catch{}}function a(o,f,u){let h=f?ss(f):"",d=t.get(o)||"",m=e.has(o);if(s("register %s key=%s (prev=%s)",o,h,d),m&&d&&h&&d!==h){let y=e.get(o);if(y)try{y.dispose()}catch{}let S=r.get(o);if(S){try{S()}catch{}r.delete(o)}let E=Ls(o,u);e.set(o,E);let M=E.subscribe(()=>i());r.set(o,M)}else if(!m){let y=Ls(o,u);e.set(o,y);let S=y.subscribe(()=>i());r.set(o,S)}return t.set(o,h),()=>l(o)}function l(o){s("unregister %s",o),t.delete(o);let f=e.get(o);f&&(f.dispose(),e.delete(o));let u=r.get(o);if(u){try{u()}catch{}r.delete(o)}}return{register:a,unregister:l,getStore(o){return e.get(o)||null},snapshotFor(o){let f=e.get(o);return f?f.snapshot().slice():[]},subscribe(o){return n.add(o),()=>n.delete(o)}}}function rt(s,e){return`#/${s==="epics"||s==="board"?s:"issues"}?issue=${encodeURIComponent(e)}`}function rs(s){let e=String(s||""),t=e.startsWith("#")?e.slice(1):e,n=t.indexOf("?"),r=n>=0?t.slice(n+1):"";if(r){let l=new URLSearchParams(r).get("issue");if(l)return decodeURIComponent(l)}let i=/^\/issue\/([^\s?#]+)/.exec(t);return i&&i[1]?decodeURIComponent(i[1]):null}function St(s){let e=String(s||"");return/^#\/epics(\b|\/|$)/.test(e)?"epics":/^#\/board(\b|\/|$)/.test(e)?"board":"issues"}function Ir(s){let e=de("router"),t=()=>{let n=window.location.hash||"",r=/^#\/issue\/([^\s?#]+)/.exec(n);if(r&&r[1]){let l=decodeURIComponent(r[1]);s.setState({selected_id:l,view:"issues"});let o=`#/issues?issue=${encodeURIComponent(l)}`;if(window.location.hash!==o){window.location.hash=o;return}}let i=rs(n),a=St(n);e("hash change \u2192 view=%s id=%s",a,i),s.setState({selected_id:i,view:a})};return{start(){window.addEventListener("hashchange",t),t()},stop(){window.removeEventListener("hashchange",t)},gotoIssue(n){let i=(s.getState?s.getState():{view:"issues"}).view||"issues",a=rt(i,n);e("goto issue %s (view=%s)",n,i),window.location.hash!==a?window.location.hash=a:s.setState({selected_id:n,view:i})},gotoView(n){let i=(s.getState?s.getState():{selected_id:null}).selected_id,a=i?rt(n,i):`#/${n}`;e("goto view %s (id=%s)",n,i||""),window.location.hash!==a?window.location.hash=a:s.setState({view:n,selected_id:null})}}}function Lr(s={}){let e=de("state"),t={selected_id:s.selected_id??null,view:s.view??"issues",filters:{status:s.filters?.status??"all",search:s.filters?.search??"",type:typeof s.filters?.type=="string"?s.filters?.type:""},board:{closed_filter:s.board?.closed_filter==="3"||s.board?.closed_filter==="7"||s.board?.closed_filter==="today"?s.board?.closed_filter:"today"},workspace:{current:s.workspace?.current??null,available:s.workspace?.available??[]}},n=new Set;function r(){for(let i of Array.from(n))try{i(t)}catch{}}return{getState(){return t},setState(i){let a={...t,...i,filters:{...t.filters,...i.filters||{}},board:{...t.board,...i.board||{}},workspace:{current:i.workspace?.current!==void 0?i.workspace.current:t.workspace.current,available:i.workspace?.available!==void 0?i.workspace.available:t.workspace.available}},l=a.workspace.current?.path!==t.workspace.current?.path||a.workspace.available.length!==t.workspace.available.length;a.selected_id===t.selected_id&&a.view===t.view&&a.filters.status===t.filters.status&&a.filters.search===t.filters.search&&a.filters.type===t.filters.type&&a.board.closed_filter===t.board.closed_filter&&!l||(t=a,e("state change %o",{selected_id:t.selected_id,view:t.view,filters:t.filters,board:t.board,workspace:t.workspace.current?.path}),r())},subscribe(i){return n.add(i),()=>n.delete(i)}}}function Dr(s){let e=de("activity"),t=0,n=new Map,r=1;function i(){if(!s)return;let f=t>0;s.toggleAttribute("hidden",!f),s.setAttribute("aria-busy",f?"true":"false")}function a(){t+=1,e("start count=%d",t),i()}function l(){let f=t;t=Math.max(0,t-1),f<=0?e("done called but count was already %d",f):e("done count=%d\u2192%d",f,t),i()}function o(f){return async(h,d)=>{let m=r++,y=Date.now();n.set(m,{type:h,start_ts:y}),e("request start id=%d type=%s count=%d",m,h,t+1),a();let S=!1,E=()=>{S||(S=!0,n.delete(m),l())},M=setTimeout(()=>{S||(e("request TIMEOUT id=%d type=%s elapsed=%dms",m,h,Date.now()-y),E())},3e4);try{let F=await f(h,d),Z=Date.now()-y;return e("request done id=%d type=%s elapsed=%dms",m,h,Z),F}catch(F){let Z=Date.now()-y;throw e("request error id=%d type=%s elapsed=%dms err=%o",m,h,Z,F),F}finally{clearTimeout(M),E()}}}return i(),{wrapSend:o,start:a,done:l,getCount:()=>t,getActiveRequests:()=>{let f=Date.now();return Array.from(n.entries()).map(([u,h])=>({id:u,type:h.type,elapsed_ms:f-h.start_ts}))}}}function ge(s,e="info",t=2800){let n=document.createElement("div");n.className="toast",n.textContent=s,n.style.position="fixed",n.style.right="12px",n.style.bottom="12px",n.style.zIndex="1000",n.style.color="#fff",n.style.padding="8px 10px",n.style.borderRadius="4px",n.style.fontSize="12px",e==="success"?n.style.background="#156d36":e==="error"?n.style.background="#9f2011":n.style.background="rgba(0,0,0,0.85)",(document.body||document.documentElement).appendChild(n),setTimeout(()=>{try{n.remove()}catch{}},t)}function Nr(s){return String(s||"")}function nt(s,e){let t=typeof e?.duration_ms=="number"?e.duration_ms:1200,n=document.createElement("button"),r=Nr(s);n.className=(e?.class_name?e.class_name+" ":"")+"mono id-copy",n.type="button",n.setAttribute("aria-live","polite"),n.setAttribute("title",`Copy issue ID ${s}`),n.setAttribute("aria-label",`Copy issue ID ${s}`),n.textContent=r;async function i(){try{let a=!1;if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")await navigator.clipboard.writeText(String(s)),a=!0;else{let l=document.createElement("textarea");l.value=String(s),l.style.position="fixed",l.style.left="-9999px",l.style.opacity="0";let o=n.closest("dialog[open]")||document.body;o.appendChild(l),l.focus(),l.select();try{a=document.execCommand("copy")}finally{o.removeChild(l)}}if(a){n.textContent="Copied";let l=n.getAttribute("aria-label")||"";n.setAttribute("aria-label","Copied"),setTimeout(()=>{n.textContent=r,n.setAttribute("aria-label",l)},Math.max(80,t))}}catch{}}return n.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),i()}),n.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),a.stopPropagation(),i())}),n}var it=["Critical","High","Medium","Low","Backlog"];function Mr(s){let e=typeof s=="number"?s:2,t=document.createElement("span");t.className="priority-badge",t.classList.add(`is-p${Math.max(0,Math.min(4,e))}`),t.setAttribute("role","img");let n=ei(e);return t.setAttribute("title",n),t.setAttribute("aria-label",`Priority: ${n}`),t.textContent=Mt(e)+" "+n,t}function ei(s){let e=Math.max(0,Math.min(4,s));return it[e]||"Medium"}function Mt(s){switch(s){case 0:return"\u{1F525}";case 1:return"\u26A1\uFE0F";case 2:return"\u{1F527}";case 3:return"\u{1FAB6}";case 4:return"\u{1F4A4}";default:return"\u{1F527}"}}function ht(s){let e=document.createElement("span");e.className="type-badge";let t=(s||"").toString().toLowerCase(),n=new Set(["bug","feature","task","epic","chore"]),r=n.has(t)?t:"neutral";e.classList.add(`type-badge--${r}`),e.setAttribute("role","img");let i=n.has(t)?t==="bug"?"Bug":t==="feature"?"Feature":t==="task"?"Task":t==="epic"?"Epic":"Chore":"\u2014";return e.setAttribute("aria-label",n.has(t)?`Issue type: ${i}`:"Issue type: unknown"),e.setAttribute("title",n.has(t)?`Type: ${i}`:"Type: unknown"),e.textContent=i,e}var ti={"blocked-col":"open","ready-col":"open","in-progress-col":"in_progress","closed-col":"closed"};function Or(s,e,t,n,r=void 0,i=void 0,a=void 0){let l=de("views:board"),o=[],f=[],u=[],h=[],d=[],m=i?st(i):null,y="today";if(n)try{let b=n.getState(),v=b&&b.board?String(b.board.closed_filter||"today"):"today";(v==="today"||v==="3"||v==="7")&&(y=v)}catch{}function S(){return T`
|
|
4
|
+
<div class="panel__body board-root" data-testid="board-view">
|
|
5
|
+
${E("Blocked","blocked-col",f)}
|
|
6
|
+
${E("Ready","ready-col",o)}
|
|
7
|
+
${E("In Progress","in-progress-col",u)}
|
|
8
|
+
${E("Closed","closed-col",h)}
|
|
9
|
+
</div>
|
|
10
|
+
`}function E(b,v,O){let L=Array.isArray(O)?O.length:0,q=L===1?"1 issue":`${L} issues`,G=v.replace("-col","");return T`
|
|
11
|
+
<section
|
|
12
|
+
class="board-column"
|
|
13
|
+
id=${v}
|
|
14
|
+
data-testid=${`board-column-${G}`}
|
|
15
|
+
>
|
|
16
|
+
<header
|
|
17
|
+
class="board-column__header"
|
|
18
|
+
id=${v+"-header"}
|
|
19
|
+
role="heading"
|
|
20
|
+
aria-level="2"
|
|
21
|
+
data-testid=${`board-column-header-${G}`}
|
|
22
|
+
>
|
|
23
|
+
<div class="board-column__title">
|
|
24
|
+
<span
|
|
25
|
+
class="board-column__title-text"
|
|
26
|
+
data-testid=${`board-column-title-${G}`}
|
|
27
|
+
>
|
|
28
|
+
${b}
|
|
29
|
+
</span>
|
|
30
|
+
<span
|
|
31
|
+
class="badge board-column__count"
|
|
32
|
+
aria-label=${q}
|
|
33
|
+
data-testid=${`board-column-count-${G}`}
|
|
34
|
+
>
|
|
35
|
+
${L}
|
|
36
|
+
</span>
|
|
37
|
+
</div>
|
|
38
|
+
${v==="closed-col"?T`<label class="board-closed-filter">
|
|
39
|
+
<span class="visually-hidden">Filter closed issues</span>
|
|
40
|
+
<select
|
|
41
|
+
id="closed-filter"
|
|
42
|
+
aria-label="Filter closed issues"
|
|
43
|
+
@change=${ye}
|
|
44
|
+
data-testid="board-closed-filter"
|
|
45
|
+
>
|
|
46
|
+
<option
|
|
47
|
+
value="today"
|
|
48
|
+
?selected=${y==="today"}
|
|
49
|
+
>
|
|
50
|
+
Today
|
|
51
|
+
</option>
|
|
52
|
+
<option value="3" ?selected=${y==="3"}>
|
|
53
|
+
Last 3 days
|
|
54
|
+
</option>
|
|
55
|
+
<option value="7" ?selected=${y==="7"}>
|
|
56
|
+
Last 7 days
|
|
57
|
+
</option>
|
|
58
|
+
</select>
|
|
59
|
+
</label>`:""}
|
|
60
|
+
</header>
|
|
61
|
+
<div
|
|
62
|
+
class="board-column__body"
|
|
63
|
+
role="list"
|
|
64
|
+
aria-labelledby=${v+"-header"}
|
|
65
|
+
data-testid=${`board-column-body-${G}`}
|
|
66
|
+
>
|
|
67
|
+
${O.map(B=>M(B))}
|
|
68
|
+
</div>
|
|
69
|
+
</section>
|
|
70
|
+
`}function M(b){return T`
|
|
71
|
+
<article
|
|
72
|
+
class="board-card"
|
|
73
|
+
data-issue-id=${b.id}
|
|
74
|
+
data-testid=${`board-card-${b.id}`}
|
|
75
|
+
role="listitem"
|
|
76
|
+
tabindex="-1"
|
|
77
|
+
draggable="true"
|
|
78
|
+
@click=${v=>Z(v,b.id)}
|
|
79
|
+
@dragstart=${v=>N(v,b.id)}
|
|
80
|
+
@dragend=${z}
|
|
81
|
+
>
|
|
82
|
+
<div
|
|
83
|
+
class="board-card__title text-truncate"
|
|
84
|
+
data-testid=${`board-card-title-${b.id}`}
|
|
85
|
+
>
|
|
86
|
+
${b.title||"(no title)"}
|
|
87
|
+
</div>
|
|
88
|
+
<div class="board-card__meta" data-testid=${`board-card-meta-${b.id}`}>
|
|
89
|
+
${ht(b.issue_type)} ${Mr(b.priority)}
|
|
90
|
+
${nt(b.id,{class_name:"mono"})}
|
|
91
|
+
</div>
|
|
92
|
+
</article>
|
|
93
|
+
`}let F=null;function Z(b,v){F||t(v)}function N(b,v){F=v,b.dataTransfer&&(b.dataTransfer.setData("text/plain",v),b.dataTransfer.effectAllowed="move"),b.target.classList.add("board-card--dragging"),l("dragstart %s",v)}function z(b){b.target.classList.remove("board-card--dragging"),H(),setTimeout(()=>{F=null},0),l("dragend")}function H(){let b=Array.from(s.querySelectorAll(".board-column--drag-over"));for(let v of b)v.classList.remove("board-column--drag-over")}async function ee(b,v){if(!a){l("no transport available, status update skipped"),ge("Cannot update status: not connected","error");return}try{l("update-status %s \u2192 %s",b,v),await a("update-status",{id:b,status:v}),ge("Status updated","success",1500)}catch(O){l("update-status failed: %o",O),ge("Failed to update status","error")}}function D(){Te(S(),s),X()}function X(){try{let b=Array.from(s.querySelectorAll(".board-column"));for(let v of b){let O=v.querySelector(".board-column__body");if(!O)continue;let L=Array.from(O.querySelectorAll(".board-card")),q=v.querySelector(".board-column__header"),G=q&&q.textContent?.trim()||"";for(let B of L){let k=B.querySelector(".board-card__title"),x=k&&k.textContent?.trim()||"";B.setAttribute("aria-label",`Issue ${x||"(no title)"} \u2014 Column ${G}`),B.tabIndex=-1}L.length>0&&(L[0].tabIndex=0)}}catch{}}s.addEventListener("keydown",b=>{let v=b.target;if(!v||!(v instanceof HTMLElement))return;let O=String(v.tagName||"").toLowerCase();if(O==="input"||O==="textarea"||O==="select"||v.isContentEditable===!0)return;let L=v.closest(".board-card");if(!L)return;let q=String(b.key||"");if(q==="Enter"||q===" "){b.preventDefault();let $=L.getAttribute("data-issue-id");$&&t($);return}if(q!=="ArrowUp"&&q!=="ArrowDown"&&q!=="ArrowLeft"&&q!=="ArrowRight")return;b.preventDefault();let G=L.closest(".board-column");if(!G)return;let B=G.querySelector(".board-column__body");if(!B)return;let k=Array.from(B.querySelectorAll(".board-card")),x=k.indexOf(L);if(x!==-1){if(q==="ArrowDown"&&x<k.length-1){re(k[x],k[x+1]);return}if(q==="ArrowUp"&&x>0){re(k[x],k[x-1]);return}if(q==="ArrowRight"||q==="ArrowLeft"){let $=Array.from(s.querySelectorAll(".board-column")),K=$.indexOf(G);if(K===-1)return;let fe=q==="ArrowRight"?1:-1,ue=K+fe,se=null;for(;ue>=0&&ue<$.length;){let V=$[ue],pe=V.querySelector(".board-column__body");if((pe?Array.from(pe.querySelectorAll(".board-card")):[]).length>0){se=V;break}ue+=fe}if(se){let V=se.querySelector(".board-column__body .board-card");V&&re(L,V)}return}}});let W=null;s.addEventListener("dragover",b=>{b.preventDefault(),b.dataTransfer&&(b.dataTransfer.dropEffect="move");let O=b.target.closest(".board-column");O&&O!==W&&(W&&W.classList.remove("board-column--drag-over"),O.classList.add("board-column--drag-over"),W=O)}),s.addEventListener("dragleave",b=>{let v=b.relatedTarget;(!v||!s.contains(v))&&W&&(W.classList.remove("board-column--drag-over"),W=null)}),s.addEventListener("drop",b=>{b.preventDefault(),W&&(W.classList.remove("board-column--drag-over"),W=null);let O=b.target.closest(".board-column");if(!O)return;let L=O.id,q=ti[L];if(!q){l("drop on unknown column: %s",L);return}let G=b.dataTransfer?.getData("text/plain");if(!G){l("drop without issue id");return}l("drop %s on %s \u2192 %s",G,L,q),ee(G,q)});function re(b,v){try{b.tabIndex=-1,v.tabIndex=0,v.focus()}catch{}}function le(){l("applyClosedFilter %s",y);let b=Array.isArray(d)?[...d]:[],v=new Date,O=0;y==="today"?O=new Date(v.getFullYear(),v.getMonth(),v.getDate(),0,0,0,0).getTime():y==="3"?O=v.getTime()-4320*60*1e3:y==="7"&&(O=v.getTime()-10080*60*1e3),b=b.filter(L=>{let q=Number.isFinite(L.closed_at)?L.closed_at:NaN;return Number.isFinite(q)?q>=O:!1}),b.sort(vt),h=b}function ye(b){try{let v=b.target,O=String(v.value||"today");if(y=O==="3"||O==="7"?O:"today",l("closed filter %s",y),n)try{n.setState({board:{closed_filter:y}})}catch{}le(),D()}catch{}}function w(){try{if(m){let b=m.selectBoardColumn("tab:board:in-progress","in_progress"),v=m.selectBoardColumn("tab:board:blocked","blocked"),O=m.selectBoardColumn("tab:board:ready","ready"),L=m.selectBoardColumn("tab:board:closed","closed"),q=new Set(b.map(B=>B.id));o=O.filter(B=>!q.has(B.id)),f=v,u=b,d=L}le(),D()}catch{o=[],f=[],u=[],h=[],D()}}return m&&m.subscribe(()=>{try{w()}catch{}}),{async load(){l("load"),w();try{let b=!!(r&&r.selectors),v=G=>{if(!b||!r)return 0;let B=r.selectors;if(typeof B.count=="function")return Number(B.count(G)||0);try{let k=B.getIds(G);return Array.isArray(k)?k.length:0}catch{return 0}},O=v("tab:board:ready")+v("tab:board:blocked")+v("tab:board:in-progress")+v("tab:board:closed"),L=e,q=L&&typeof L.getReady=="function"&&typeof L.getBlocked=="function"&&typeof L.getInProgress=="function"&&typeof L.getClosed=="function";if(O===0&&q){l("fallback fetch");let[G,B,k,x]=await Promise.all([L.getReady().catch(()=>[]),L.getBlocked().catch(()=>[]),L.getInProgress().catch(()=>[]),L.getClosed().catch(()=>[])]),$=Array.isArray(G)?G.map(V=>V):[],K=Array.isArray(B)?B.map(V=>V):[],fe=Array.isArray(k)?k.map(V=>V):[],ue=Array.isArray(x)?x.map(V=>V):[],se=new Set(fe.map(V=>V.id));$=$.filter(V=>!se.has(V.id)),$.sort(Ue),K.sort(Ue),fe.sort(Ue),o=$,f=K,u=fe,d=ue,le(),D()}}catch{}},clear(){s.replaceChildren(),o=[],f=[],u=[],h=[]}}}var{entries:Gr,setPrototypeOf:Pr,isFrozen:si,getPrototypeOf:ri,getOwnPropertyDescriptor:ni}=Object,{freeze:Re,seal:ze,create:as}=Object,{apply:zs,construct:Bs}=typeof Reflect<"u"&&Reflect;Re||(Re=function(e){return e});ze||(ze=function(e){return e});zs||(zs=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)});Bs||(Bs=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});var ns=Ie(Array.prototype.forEach),ii=Ie(Array.prototype.lastIndexOf),Fr=Ie(Array.prototype.pop),Ot=Ie(Array.prototype.push),ai=Ie(Array.prototype.splice),os=Ie(String.prototype.toLowerCase),Ds=Ie(String.prototype.toString),Ns=Ie(String.prototype.match),Pt=Ie(String.prototype.replace),oi=Ie(String.prototype.indexOf),li=Ie(String.prototype.trim),Pe=Ie(Object.prototype.hasOwnProperty),Ce=Ie(RegExp.prototype.test),Ft=ci(TypeError);function Ie(s){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return zs(s,e,n)}}function ci(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Bs(s,t)}}function te(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:os;Pr&&Pr(s,null);let n=e.length;for(;n--;){let r=e[n];if(typeof r=="string"){let i=t(r);i!==r&&(si(e)||(e[n]=i),r=i)}s[r]=!0}return s}function di(s){for(let e=0;e<s.length;e++)Pe(s,e)||(s[e]=null);return s}function We(s){let e=as(null);for(let[t,n]of Gr(s))Pe(s,t)&&(Array.isArray(n)?e[t]=di(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=We(n):e[t]=n);return e}function zt(s,e){for(;s!==null;){let n=ni(s,e);if(n){if(n.get)return Ie(n.get);if(typeof n.value=="function")return Ie(n.value)}s=ri(s)}function t(){return null}return t}var zr=Re(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ms=Re(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Os=Re(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ui=Re(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ps=Re(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),pi=Re(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Br=Re(["#text"]),Ur=Re(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Fs=Re(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Hr=Re(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),is=Re(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fi=ze(/\{\{[\w\W]*|[\w\W]*\}\}/gm),hi=ze(/<%[\w\W]*|[\w\W]*%>/gm),gi=ze(/\$\{[\w\W]*/gm),mi=ze(/^data-[\-\w.\u00B7-\uFFFF]+$/),bi=ze(/^aria-[\-\w]+$/),Wr=ze(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yi=ze(/^(?:\w+script|data):/i),wi=ze(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Kr=ze(/^html$/i),ki=ze(/^[a-z][.\w]*(-[.\w]+)+$/i),qr=Object.freeze({__proto__:null,ARIA_ATTR:bi,ATTR_WHITESPACE:wi,CUSTOM_ELEMENT:ki,DATA_ATTR:mi,DOCTYPE_NAME:Kr,ERB_EXPR:hi,IS_ALLOWED_URI:Wr,IS_SCRIPT_OR_DATA:yi,MUSTACHE_EXPR:fi,TMPLIT_EXPR:gi}),Bt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},_i=function(){return typeof window>"u"?null:window},vi=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null,r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},jr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Vr(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_i(),e=U=>Vr(U);if(e.version="3.3.3",e.removed=[],!s||!s.document||s.document.nodeType!==Bt.document||!s.Element)return e.isSupported=!1,e;let{document:t}=s,n=t,r=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:l,Element:o,NodeFilter:f,NamedNodeMap:u=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:h,DOMParser:d,trustedTypes:m}=s,y=o.prototype,S=zt(y,"cloneNode"),E=zt(y,"remove"),M=zt(y,"nextSibling"),F=zt(y,"childNodes"),Z=zt(y,"parentNode");if(typeof a=="function"){let U=t.createElement("template");U.content&&U.content.ownerDocument&&(t=U.content.ownerDocument)}let N,z="",{implementation:H,createNodeIterator:ee,createDocumentFragment:D,getElementsByTagName:X}=t,{importNode:W}=n,re=jr();e.isSupported=typeof Gr=="function"&&typeof Z=="function"&&H&&H.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:le,ERB_EXPR:ye,TMPLIT_EXPR:w,DATA_ATTR:b,ARIA_ATTR:v,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:q}=qr,{IS_ALLOWED_URI:G}=qr,B=null,k=te({},[...zr,...Ms,...Os,...Ps,...Br]),x=null,$=te({},[...Ur,...Fs,...Hr,...is]),K=Object.seal(as(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fe=null,ue=null,se=Object.seal(as(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),V=!0,pe=!0,we=!1,Me=!0,$e=!1,he=!0,Oe=!1,je=!1,Ke=!1,Be=!1,_=!1,g=!1,j=!0,Q=!1,ae="user-content-",R=!0,at=!1,et={},Fe=null,Tt=te({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Yt=null,Zt=te({},["audio","video","img","source","image","track"]),Et=null,p=te({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),I="http://www.w3.org/1998/Math/MathML",Y="http://www.w3.org/2000/svg",C="http://www.w3.org/1999/xhtml",ie=C,ke=!1,Ve=null,Ae=te({},[I,Y,C],Ds),bt=te({},["mi","mo","mn","ms","mtext"]),yt=te({},["annotation-xml"]),ys=te({},["title","style","font","a","script"]),Ye=null,ws=["application/xhtml+xml","text/html"],Xt="text/html",_e=null,J=null,ve=t.createElement("form"),ot=function(c){return c instanceof RegExp||c instanceof Function},Qt=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(J&&J===c)){if((!c||typeof c!="object")&&(c={}),c=We(c),Ye=ws.indexOf(c.PARSER_MEDIA_TYPE)===-1?Xt:c.PARSER_MEDIA_TYPE,_e=Ye==="application/xhtml+xml"?Ds:os,B=Pe(c,"ALLOWED_TAGS")?te({},c.ALLOWED_TAGS,_e):k,x=Pe(c,"ALLOWED_ATTR")?te({},c.ALLOWED_ATTR,_e):$,Ve=Pe(c,"ALLOWED_NAMESPACES")?te({},c.ALLOWED_NAMESPACES,Ds):Ae,Et=Pe(c,"ADD_URI_SAFE_ATTR")?te(We(p),c.ADD_URI_SAFE_ATTR,_e):p,Yt=Pe(c,"ADD_DATA_URI_TAGS")?te(We(Zt),c.ADD_DATA_URI_TAGS,_e):Zt,Fe=Pe(c,"FORBID_CONTENTS")?te({},c.FORBID_CONTENTS,_e):Tt,fe=Pe(c,"FORBID_TAGS")?te({},c.FORBID_TAGS,_e):We({}),ue=Pe(c,"FORBID_ATTR")?te({},c.FORBID_ATTR,_e):We({}),et=Pe(c,"USE_PROFILES")?c.USE_PROFILES:!1,V=c.ALLOW_ARIA_ATTR!==!1,pe=c.ALLOW_DATA_ATTR!==!1,we=c.ALLOW_UNKNOWN_PROTOCOLS||!1,Me=c.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$e=c.SAFE_FOR_TEMPLATES||!1,he=c.SAFE_FOR_XML!==!1,Oe=c.WHOLE_DOCUMENT||!1,Be=c.RETURN_DOM||!1,_=c.RETURN_DOM_FRAGMENT||!1,g=c.RETURN_TRUSTED_TYPE||!1,Ke=c.FORCE_BODY||!1,j=c.SANITIZE_DOM!==!1,Q=c.SANITIZE_NAMED_PROPS||!1,R=c.KEEP_CONTENT!==!1,at=c.IN_PLACE||!1,G=c.ALLOWED_URI_REGEXP||Wr,ie=c.NAMESPACE||C,bt=c.MATHML_TEXT_INTEGRATION_POINTS||bt,yt=c.HTML_INTEGRATION_POINTS||yt,K=c.CUSTOM_ELEMENT_HANDLING||{},c.CUSTOM_ELEMENT_HANDLING&&ot(c.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(K.tagNameCheck=c.CUSTOM_ELEMENT_HANDLING.tagNameCheck),c.CUSTOM_ELEMENT_HANDLING&&ot(c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(K.attributeNameCheck=c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),c.CUSTOM_ELEMENT_HANDLING&&typeof c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(K.allowCustomizedBuiltInElements=c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$e&&(pe=!1),_&&(Be=!0),et&&(B=te({},Br),x=as(null),et.html===!0&&(te(B,zr),te(x,Ur)),et.svg===!0&&(te(B,Ms),te(x,Fs),te(x,is)),et.svgFilters===!0&&(te(B,Os),te(x,Fs),te(x,is)),et.mathMl===!0&&(te(B,Ps),te(x,Hr),te(x,is))),Pe(c,"ADD_TAGS")||(se.tagCheck=null),Pe(c,"ADD_ATTR")||(se.attributeCheck=null),c.ADD_TAGS&&(typeof c.ADD_TAGS=="function"?se.tagCheck=c.ADD_TAGS:(B===k&&(B=We(B)),te(B,c.ADD_TAGS,_e))),c.ADD_ATTR&&(typeof c.ADD_ATTR=="function"?se.attributeCheck=c.ADD_ATTR:(x===$&&(x=We(x)),te(x,c.ADD_ATTR,_e))),c.ADD_URI_SAFE_ATTR&&te(Et,c.ADD_URI_SAFE_ATTR,_e),c.FORBID_CONTENTS&&(Fe===Tt&&(Fe=We(Fe)),te(Fe,c.FORBID_CONTENTS,_e)),c.ADD_FORBID_CONTENTS&&(Fe===Tt&&(Fe=We(Fe)),te(Fe,c.ADD_FORBID_CONTENTS,_e)),R&&(B["#text"]=!0),Oe&&te(B,["html","head","body"]),B.table&&(te(B,["tbody"]),delete fe.tbody),c.TRUSTED_TYPES_POLICY){if(typeof c.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ft('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof c.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ft('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=c.TRUSTED_TYPES_POLICY,z=N.createHTML("")}else N===void 0&&(N=vi(m,r)),N!==null&&typeof z=="string"&&(z=N.createHTML(""));Re&&Re(c),J=c}},tr=te({},[...Ms,...Os,...ui]),sr=te({},[...Ps,...pi]),En=function(c){let A=Z(c);(!A||!A.tagName)&&(A={namespaceURI:ie,tagName:"template"});let P=os(c.tagName),me=os(A.tagName);return Ve[c.namespaceURI]?c.namespaceURI===Y?A.namespaceURI===C?P==="svg":A.namespaceURI===I?P==="svg"&&(me==="annotation-xml"||bt[me]):!!tr[P]:c.namespaceURI===I?A.namespaceURI===C?P==="math":A.namespaceURI===Y?P==="math"&&yt[me]:!!sr[P]:c.namespaceURI===C?A.namespaceURI===Y&&!yt[me]||A.namespaceURI===I&&!bt[me]?!1:!sr[P]&&(ys[P]||!tr[P]):!!(Ye==="application/xhtml+xml"&&Ve[c.namespaceURI]):!1},Ge=function(c){Ot(e.removed,{element:c});try{Z(c).removeChild(c)}catch{E(c)}},lt=function(c,A){try{Ot(e.removed,{attribute:A.getAttributeNode(c),from:A})}catch{Ot(e.removed,{attribute:null,from:A})}if(A.removeAttribute(c),c==="is")if(Be||_)try{Ge(A)}catch{}else try{A.setAttribute(c,"")}catch{}},rr=function(c){let A=null,P=null;if(Ke)c="<remove></remove>"+c;else{let xe=Ns(c,/^[\r\n\t ]+/);P=xe&&xe[0]}Ye==="application/xhtml+xml"&&ie===C&&(c='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+c+"</body></html>");let me=N?N.createHTML(c):c;if(ie===C)try{A=new d().parseFromString(me,Ye)}catch{}if(!A||!A.documentElement){A=H.createDocument(ie,"template",null);try{A.documentElement.innerHTML=ke?z:me}catch{}}let Ee=A.body||A.documentElement;return c&&P&&Ee.insertBefore(t.createTextNode(P),Ee.childNodes[0]||null),ie===C?X.call(A,Oe?"html":"body")[0]:Oe?A.documentElement:Ee},nr=function(c){return ee.call(c.ownerDocument||c,c,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},ks=function(c){return c instanceof h&&(typeof c.nodeName!="string"||typeof c.textContent!="string"||typeof c.removeChild!="function"||!(c.attributes instanceof u)||typeof c.removeAttribute!="function"||typeof c.setAttribute!="function"||typeof c.namespaceURI!="string"||typeof c.insertBefore!="function"||typeof c.hasChildNodes!="function")},ir=function(c){return typeof l=="function"&&c instanceof l};function Ze(U,c,A){ns(U,P=>{P.call(e,c,A,J)})}let ar=function(c){let A=null;if(Ze(re.beforeSanitizeElements,c,null),ks(c))return Ge(c),!0;let P=_e(c.nodeName);if(Ze(re.uponSanitizeElement,c,{tagName:P,allowedTags:B}),he&&c.hasChildNodes()&&!ir(c.firstElementChild)&&Ce(/<[/\w!]/g,c.innerHTML)&&Ce(/<[/\w!]/g,c.textContent)||c.nodeType===Bt.progressingInstruction||he&&c.nodeType===Bt.comment&&Ce(/<[/\w]/g,c.data))return Ge(c),!0;if(!(se.tagCheck instanceof Function&&se.tagCheck(P))&&(!B[P]||fe[P])){if(!fe[P]&&lr(P)&&(K.tagNameCheck instanceof RegExp&&Ce(K.tagNameCheck,P)||K.tagNameCheck instanceof Function&&K.tagNameCheck(P)))return!1;if(R&&!Fe[P]){let me=Z(c)||c.parentNode,Ee=F(c)||c.childNodes;if(Ee&&me){let xe=Ee.length;for(let De=xe-1;De>=0;--De){let Xe=S(Ee[De],!0);Xe.__removalCount=(c.__removalCount||0)+1,me.insertBefore(Xe,M(c))}}}return Ge(c),!0}return c instanceof o&&!En(c)||(P==="noscript"||P==="noembed"||P==="noframes")&&Ce(/<\/no(script|embed|frames)/i,c.innerHTML)?(Ge(c),!0):($e&&c.nodeType===Bt.text&&(A=c.textContent,ns([le,ye,w],me=>{A=Pt(A,me," ")}),c.textContent!==A&&(Ot(e.removed,{element:c.cloneNode()}),c.textContent=A)),Ze(re.afterSanitizeElements,c,null),!1)},or=function(c,A,P){if(ue[A]||j&&(A==="id"||A==="name")&&(P in t||P in ve))return!1;if(!(pe&&!ue[A]&&Ce(b,A))){if(!(V&&Ce(v,A))){if(!(se.attributeCheck instanceof Function&&se.attributeCheck(A,c))){if(!x[A]||ue[A]){if(!(lr(c)&&(K.tagNameCheck instanceof RegExp&&Ce(K.tagNameCheck,c)||K.tagNameCheck instanceof Function&&K.tagNameCheck(c))&&(K.attributeNameCheck instanceof RegExp&&Ce(K.attributeNameCheck,A)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(A,c))||A==="is"&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&Ce(K.tagNameCheck,P)||K.tagNameCheck instanceof Function&&K.tagNameCheck(P))))return!1}else if(!Et[A]){if(!Ce(G,Pt(P,L,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&c!=="script"&&oi(P,"data:")===0&&Yt[c])){if(!(we&&!Ce(O,Pt(P,L,"")))){if(P)return!1}}}}}}}return!0},lr=function(c){return c!=="annotation-xml"&&Ns(c,q)},cr=function(c){Ze(re.beforeSanitizeAttributes,c,null);let{attributes:A}=c;if(!A||ks(c))return;let P={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:x,forceKeepAttr:void 0},me=A.length;for(;me--;){let Ee=A[me],{name:xe,namespaceURI:De,value:Xe}=Ee,wt=_e(xe),_s=Xe,Se=xe==="value"?_s:li(_s);if(P.attrName=wt,P.attrValue=Se,P.keepAttr=!0,P.forceKeepAttr=void 0,Ze(re.uponSanitizeAttribute,c,P),Se=P.attrValue,Q&&(wt==="id"||wt==="name")&&(lt(xe,c),Se=ae+Se),he&&Ce(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Se)){lt(xe,c);continue}if(wt==="attributename"&&Ns(Se,"href")){lt(xe,c);continue}if(P.forceKeepAttr)continue;if(!P.keepAttr){lt(xe,c);continue}if(!Me&&Ce(/\/>/i,Se)){lt(xe,c);continue}$e&&ns([le,ye,w],ur=>{Se=Pt(Se,ur," ")});let dr=_e(c.nodeName);if(!or(dr,wt,Se)){lt(xe,c);continue}if(N&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!De)switch(m.getAttributeType(dr,wt)){case"TrustedHTML":{Se=N.createHTML(Se);break}case"TrustedScriptURL":{Se=N.createScriptURL(Se);break}}if(Se!==_s)try{De?c.setAttributeNS(De,xe,Se):c.setAttribute(xe,Se),ks(c)?Ge(c):Fr(e.removed)}catch{lt(xe,c)}}Ze(re.afterSanitizeAttributes,c,null)},Cn=function U(c){let A=null,P=nr(c);for(Ze(re.beforeSanitizeShadowDOM,c,null);A=P.nextNode();)Ze(re.uponSanitizeShadowNode,A,null),ar(A),cr(A),A.content instanceof i&&U(A.content);Ze(re.afterSanitizeShadowDOM,c,null)};return e.sanitize=function(U){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,P=null,me=null,Ee=null;if(ke=!U,ke&&(U="<!-->"),typeof U!="string"&&!ir(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Ft("dirty is not a string, aborting")}else throw Ft("toString is not a function");if(!e.isSupported)return U;if(je||Qt(c),e.removed=[],typeof U=="string"&&(at=!1),at){if(U.nodeName){let Xe=_e(U.nodeName);if(!B[Xe]||fe[Xe])throw Ft("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)A=rr("<!---->"),P=A.ownerDocument.importNode(U,!0),P.nodeType===Bt.element&&P.nodeName==="BODY"||P.nodeName==="HTML"?A=P:A.appendChild(P);else{if(!Be&&!$e&&!Oe&&U.indexOf("<")===-1)return N&&g?N.createHTML(U):U;if(A=rr(U),!A)return Be?null:g?z:""}A&&Ke&&Ge(A.firstChild);let xe=nr(at?U:A);for(;me=xe.nextNode();)ar(me),cr(me),me.content instanceof i&&Cn(me.content);if(at)return U;if(Be){if(_)for(Ee=D.call(A.ownerDocument);A.firstChild;)Ee.appendChild(A.firstChild);else Ee=A;return(x.shadowroot||x.shadowrootmode)&&(Ee=W.call(n,Ee,!0)),Ee}let De=Oe?A.outerHTML:A.innerHTML;return Oe&&B["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Ce(Kr,A.ownerDocument.doctype.name)&&(De="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
|
94
|
+
`+De),$e&&ns([le,ye,w],Xe=>{De=Pt(De,Xe," ")}),N&&g?N.createHTML(De):De},e.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qt(U),je=!0},e.clearConfig=function(){J=null,je=!1},e.isValidAttribute=function(U,c,A){J||Qt({});let P=_e(U),me=_e(c);return or(P,me,A)},e.addHook=function(U,c){typeof c=="function"&&Ot(re[U],c)},e.removeHook=function(U,c){if(c!==void 0){let A=ii(re[U],c);return A===-1?void 0:ai(re[U],A,1)[0]}return Fr(re[U])},e.removeHooks=function(U){re[U]=[]},e.removeAllHooks=function(){re=jr()},e}var Yr=Vr();var Zr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Xr=s=>(...e)=>({_$litDirective$:s,values:e}),ls=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Ut=class extends ls{constructor(e){if(super(e),this.it=be,e.type!==Zr.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===be||e==null)return this._t=void 0,this.it=e;if(e===pt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Ut.directiveName="unsafeHTML",Ut.resultType=1;var Qr=Xr(Ut);function js(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var mt=js();function an(s){mt=s}var Gt={exec:()=>null};function ne(s,e=""){let t=typeof s=="string"?s:s.source,n={replace:(r,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(Le.caret,"$1"),t=t.replace(r,a),n},getRegex:()=>new RegExp(t,e)};return n}var xi=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Le={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}#`),htmlBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}<(?:[a-z].*>|!--)`,"i")},$i=/^(?:[ \t]*(?:\n|$))+/,Ai=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Si=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Wt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ti=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Gs=/(?:[*+-]|\d{1,9}[.)])/,on=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ln=ne(on).replace(/bull/g,Gs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ei=ne(on).replace(/bull/g,Gs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ws=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ci=/^[^\n]+/,Ks=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ri=ne(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ks).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ii=ne(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Gs).getRegex(),hs="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Vs=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Li=ne("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Vs).replace("tag",hs).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),cn=ne(Ws).replace("hr",Wt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",hs).getRegex(),Di=ne(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",cn).getRegex(),Ys={blockquote:Di,code:Ai,def:Ri,fences:Si,heading:Ti,hr:Wt,html:Li,lheading:ln,list:Ii,newline:$i,paragraph:cn,table:Gt,text:Ci},Jr=ne("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Wt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",hs).getRegex(),Ni={...Ys,lheading:Ei,table:Jr,paragraph:ne(Ws).replace("hr",Wt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jr).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",hs).getRegex()},Mi={...Ys,html:ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Vs).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Gt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ne(Ws).replace("hr",Wt).replace("heading",` *#{1,6} *[^
|
|
95
|
+
]`).replace("lheading",ln).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Oi=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Pi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,dn=/^( {2,}|\\)\n(?!\s*$)/,Fi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,gs=/[\p{P}\p{S}]/u,Zs=/[\s\p{P}\p{S}]/u,un=/[^\s\p{P}\p{S}]/u,zi=ne(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Zs).getRegex(),pn=/(?!~)[\p{P}\p{S}]/u,Bi=/(?!~)[\s\p{P}\p{S}]/u,Ui=/(?:[^\s\p{P}\p{S}]|~)/u,Hi=ne(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",xi?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),fn=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qi=ne(fn,"u").replace(/punct/g,gs).getRegex(),ji=ne(fn,"u").replace(/punct/g,pn).getRegex(),hn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Gi=ne(hn,"gu").replace(/notPunctSpace/g,un).replace(/punctSpace/g,Zs).replace(/punct/g,gs).getRegex(),Wi=ne(hn,"gu").replace(/notPunctSpace/g,Ui).replace(/punctSpace/g,Bi).replace(/punct/g,pn).getRegex(),Ki=ne("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,un).replace(/punctSpace/g,Zs).replace(/punct/g,gs).getRegex(),Vi=ne(/\\(punct)/,"gu").replace(/punct/g,gs).getRegex(),Yi=ne(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Zi=ne(Vs).replace("(?:-->|$)","-->").getRegex(),Xi=ne("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Zi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),us=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Qi=ne(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",us).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gn=ne(/^!?\[(label)\]\[(ref)\]/).replace("label",us).replace("ref",Ks).getRegex(),mn=ne(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ks).getRegex(),Ji=ne("reflink|nolink(?!\\()","g").replace("reflink",gn).replace("nolink",mn).getRegex(),en=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Xs={_backpedal:Gt,anyPunctuation:Vi,autolink:Yi,blockSkip:Hi,br:dn,code:Pi,del:Gt,emStrongLDelim:qi,emStrongRDelimAst:Gi,emStrongRDelimUnd:Ki,escape:Oi,link:Qi,nolink:mn,punctuation:zi,reflink:gn,reflinkSearch:Ji,tag:Xi,text:Fi,url:Gt},ea={...Xs,link:ne(/^!?\[(label)\]\((.*?)\)/).replace("label",us).getRegex(),reflink:ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",us).getRegex()},Us={...Xs,emStrongRDelimAst:Wi,emStrongLDelim:ji,url:ne(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",en).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ne(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",en).getRegex()},ta={...Us,br:ne(dn).replace("{2,}","*").getRegex(),text:ne(Us.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},cs={normal:Ys,gfm:Ni,pedantic:Mi},Ht={normal:Xs,gfm:Us,breaks:ta,pedantic:ea},sa={"&":"&","<":"<",">":">",'"':""","'":"'"},tn=s=>sa[s];function Qe(s,e){if(e){if(Le.escapeTest.test(s))return s.replace(Le.escapeReplace,tn)}else if(Le.escapeTestNoEncode.test(s))return s.replace(Le.escapeReplaceNoEncode,tn);return s}function sn(s){try{s=encodeURI(s).replace(Le.percentDecode,"%")}catch{return null}return s}function rn(s,e){let t=s.replace(Le.findPipe,(i,a,l)=>{let o=!1,f=a;for(;--f>=0&&l[f]==="\\";)o=!o;return o?"|":" |"}),n=t.split(Le.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(Le.slashPipe,"|");return n}function qt(s,e,t){let n=s.length;if(n===0)return"";let r=0;for(;r<n;){let i=s.charAt(n-r-1);if(i===e&&!t)r++;else if(i!==e&&t)r++;else break}return s.slice(0,n-r)}function ra(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function nn(s,e,t,n,r){let i=e.href,a=e.title||null,l=s[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let o={type:s[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:a,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,o}function na(s,e,t){let n=s.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
|
|
96
|
+
`).map(i=>{let a=i.match(t.other.beginningSpace);if(a===null)return i;let[l]=a;return l.length>=r.length?i.slice(r.length):i}).join(`
|
|
97
|
+
`)}var ps=class{constructor(s){ce(this,"options");ce(this,"rules");ce(this,"lexer");this.options=s||mt}space(s){let e=this.rules.block.newline.exec(s);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(s){let e=this.rules.block.code.exec(s);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:qt(t,`
|
|
98
|
+
`)}}}fences(s){let e=this.rules.block.fences.exec(s);if(e){let t=e[0],n=na(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(s){let e=this.rules.block.heading.exec(s);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=qt(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(s){let e=this.rules.block.hr.exec(s);if(e)return{type:"hr",raw:qt(e[0],`
|
|
99
|
+
`)}}blockquote(s){let e=this.rules.block.blockquote.exec(s);if(e){let t=qt(e[0],`
|
|
100
|
+
`).split(`
|
|
101
|
+
`),n="",r="",i=[];for(;t.length>0;){let a=!1,l=[],o;for(o=0;o<t.length;o++)if(this.rules.other.blockquoteStart.test(t[o]))l.push(t[o]),a=!0;else if(!a)l.push(t[o]);else break;t=t.slice(o);let f=l.join(`
|
|
102
|
+
`),u=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
103
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
104
|
+
${f}`:f,r=r?`${r}
|
|
105
|
+
${u}`:u;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=h,t.length===0)break;let d=i.at(-1);if(d?.type==="code")break;if(d?.type==="blockquote"){let m=d,y=m.raw+`
|
|
106
|
+
`+t.join(`
|
|
107
|
+
`),S=this.blockquote(y);i[i.length-1]=S,n=n.substring(0,n.length-m.raw.length)+S.raw,r=r.substring(0,r.length-m.text.length)+S.text;break}else if(d?.type==="list"){let m=d,y=m.raw+`
|
|
108
|
+
`+t.join(`
|
|
109
|
+
`),S=this.list(y);i[i.length-1]=S,n=n.substring(0,n.length-d.raw.length)+S.raw,r=r.substring(0,r.length-m.raw.length)+S.raw,t=y.substring(i.at(-1).raw.length).split(`
|
|
110
|
+
`);continue}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(s){let e=this.rules.block.list.exec(s);if(e){let t=e[1].trim(),n=t.length>1,r={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let i=this.rules.other.listItemRegex(t),a=!1;for(;s;){let o=!1,f="",u="";if(!(e=i.exec(s))||this.rules.block.hr.test(s))break;f=e[0],s=s.substring(f.length);let h=e[2].split(`
|
|
111
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,S=>" ".repeat(3*S.length)),d=s.split(`
|
|
112
|
+
`,1)[0],m=!h.trim(),y=0;if(this.options.pedantic?(y=2,u=h.trimStart()):m?y=e[1].length+1:(y=e[2].search(this.rules.other.nonSpaceChar),y=y>4?1:y,u=h.slice(y),y+=e[1].length),m&&this.rules.other.blankLine.test(d)&&(f+=d+`
|
|
113
|
+
`,s=s.substring(d.length+1),o=!0),!o){let S=this.rules.other.nextBulletRegex(y),E=this.rules.other.hrRegex(y),M=this.rules.other.fencesBeginRegex(y),F=this.rules.other.headingBeginRegex(y),Z=this.rules.other.htmlBeginRegex(y);for(;s;){let N=s.split(`
|
|
114
|
+
`,1)[0],z;if(d=N,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),z=d):z=d.replace(this.rules.other.tabCharGlobal," "),M.test(d)||F.test(d)||Z.test(d)||S.test(d)||E.test(d))break;if(z.search(this.rules.other.nonSpaceChar)>=y||!d.trim())u+=`
|
|
115
|
+
`+z.slice(y);else{if(m||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||M.test(h)||F.test(h)||E.test(h))break;u+=`
|
|
116
|
+
`+d}!m&&!d.trim()&&(m=!0),f+=N+`
|
|
117
|
+
`,s=s.substring(N.length+1),h=z.slice(y)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(a=!0)),r.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),r.raw+=f}let l=r.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let o of r.items){if(this.lexer.state.top=!1,o.tokens=this.lexer.blockTokens(o.text,[]),o.task){if(o.text=o.text.replace(this.rules.other.listReplaceTask,""),o.tokens[0]?.type==="text"||o.tokens[0]?.type==="paragraph"){o.tokens[0].raw=o.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),o.tokens[0].text=o.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(o.raw);if(f){let u={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};o.checked=u.checked,r.loose?o.tokens[0]&&["paragraph","text"].includes(o.tokens[0].type)&&"tokens"in o.tokens[0]&&o.tokens[0].tokens?(o.tokens[0].raw=u.raw+o.tokens[0].raw,o.tokens[0].text=u.raw+o.tokens[0].text,o.tokens[0].tokens.unshift(u)):o.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):o.tokens.unshift(u)}}if(!r.loose){let f=o.tokens.filter(h=>h.type==="space"),u=f.length>0&&f.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=u}}if(r.loose)for(let o of r.items){o.loose=!0;for(let f of o.tokens)f.type==="text"&&(f.type="paragraph")}return r}}html(s){let e=this.rules.block.html.exec(s);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(s){let e=this.rules.block.def.exec(s);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:r}}}table(s){let e=this.rules.block.table.exec(s);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=rn(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
118
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(let a of n)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<t.length;a++)i.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:i.align[a]});for(let a of r)i.rows.push(rn(a,i.header.length).map((l,o)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[o]})));return i}}lheading(s){let e=this.rules.block.lheading.exec(s);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(s){let e=this.rules.block.paragraph.exec(s);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
119
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(s){let e=this.rules.block.text.exec(s);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(s){let e=this.rules.inline.escape.exec(s);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(s){let e=this.rules.inline.tag.exec(s);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(s){let e=this.rules.inline.link.exec(s);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=qt(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=ra(e[2],"()");if(i===-2)return;if(i>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let n=e[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(n);i&&(n=i[1],r=i[3])}else r=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),nn(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(s,e){let t;if((t=this.rules.inline.reflink.exec(s))||(t=this.rules.inline.nolink.exec(s))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[n.toLowerCase()];if(!r){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return nn(t,r,t[0],this.lexer,this.rules)}}emStrong(s,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(s);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let r=[...n[0]].length-1,i,a,l=r,o=0,f=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,e=e.slice(-1*s.length+r);(n=f.exec(e))!=null;){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i)continue;if(a=[...i].length,n[3]||n[4]){l+=a;continue}else if((n[5]||n[6])&&r%3&&!((r+a)%3)){o+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+o);let u=[...n[0]][0].length,h=s.slice(0,r+n.index+u+a);if(Math.min(r,a)%2){let m=h.slice(1,-1);return{type:"em",raw:h,text:m,tokens:this.lexer.inlineTokens(m)}}let d=h.slice(2,-2);return{type:"strong",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(s){let e=this.rules.inline.code.exec(s);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(s){let e=this.rules.inline.br.exec(s);if(e)return{type:"br",raw:e[0]}}del(s){let e=this.rules.inline.del.exec(s);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(s){let e=this.rules.inline.autolink.exec(s);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(s){let e;if(e=this.rules.inline.url.exec(s)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(s){let e=this.rules.inline.text.exec(s);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},He=class Hs{constructor(e){ce(this,"tokens");ce(this,"options");ce(this,"state");ce(this,"inlineQueue");ce(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||mt,this.options.tokenizer=this.options.tokenizer||new ps,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Le,block:cs.normal,inline:Ht.normal};this.options.pedantic?(t.block=cs.pedantic,t.inline=Ht.pedantic):this.options.gfm&&(t.block=cs.gfm,this.options.breaks?t.inline=Ht.breaks:t.inline=Ht.gfm),this.tokenizer.rules=t}static get rules(){return{block:cs,inline:Ht}}static lex(e,t){return new Hs(t).lex(e)}static lexInline(e,t){return new Hs(t).inlineTokens(e)}lex(e){e=e.replace(Le.carriageReturn,`
|
|
120
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Le.tabCharGlobal," ").replace(Le.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
|
|
121
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
122
|
+
`)?"":`
|
|
123
|
+
`)+r.raw,a.text+=`
|
|
124
|
+
`+r.text,this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
125
|
+
`)?"":`
|
|
126
|
+
`)+r.raw,a.text+=`
|
|
127
|
+
`+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let a=1/0,l=e.slice(1),o;this.options.extensions.startBlock.forEach(f=>{o=f.call({lexer:this},l),typeof o=="number"&&o>=0&&(a=Math.min(a,o))}),a<1/0&&a>=0&&(i=e.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
|
|
128
|
+
`)?"":`
|
|
129
|
+
`)+r.raw,a.text+=`
|
|
130
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
131
|
+
`)?"":`
|
|
132
|
+
`)+r.raw,a.text+=`
|
|
133
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){let a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+"["+"a".repeat(r[0].length-i-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,l="";for(;e;){a||(l=""),a=!1;let o;if(this.options.extensions?.inline?.some(u=>(o=u.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let u=t.at(-1);o.type==="text"&&u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,l)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let f=e;if(this.options.extensions?.startInline){let u=1/0,h=e.slice(1),d;this.options.extensions.startInline.forEach(m=>{d=m.call({lexer:this},h),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(f=e.substring(0,u+1))}if(o=this.tokenizer.inlineText(f)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(l=o.raw.slice(-1)),a=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}},fs=class{constructor(s){ce(this,"options");ce(this,"parser");this.options=s||mt}space(s){return""}code({text:s,lang:e,escaped:t}){let n=(e||"").match(Le.notSpaceStart)?.[0],r=s.replace(Le.endingNewline,"")+`
|
|
134
|
+
`;return n?'<pre><code class="language-'+Qe(n)+'">'+(t?r:Qe(r,!0))+`</code></pre>
|
|
135
|
+
`:"<pre><code>"+(t?r:Qe(r,!0))+`</code></pre>
|
|
136
|
+
`}blockquote({tokens:s}){return`<blockquote>
|
|
137
|
+
${this.parser.parse(s)}</blockquote>
|
|
138
|
+
`}html({text:s}){return s}def(s){return""}heading({tokens:s,depth:e}){return`<h${e}>${this.parser.parseInline(s)}</h${e}>
|
|
139
|
+
`}hr(s){return`<hr>
|
|
140
|
+
`}list(s){let e=s.ordered,t=s.start,n="";for(let a=0;a<s.items.length;a++){let l=s.items[a];n+=this.listitem(l)}let r=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+r+i+`>
|
|
141
|
+
`+n+"</"+r+`>
|
|
142
|
+
`}listitem(s){return`<li>${this.parser.parse(s.tokens)}</li>
|
|
143
|
+
`}checkbox({checked:s}){return"<input "+(s?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:s}){return`<p>${this.parser.parseInline(s)}</p>
|
|
144
|
+
`}table(s){let e="",t="";for(let r=0;r<s.header.length;r++)t+=this.tablecell(s.header[r]);e+=this.tablerow({text:t});let n="";for(let r=0;r<s.rows.length;r++){let i=s.rows[r];t="";for(let a=0;a<i.length;a++)t+=this.tablecell(i[a]);n+=this.tablerow({text:t})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
|
|
145
|
+
<thead>
|
|
146
|
+
`+e+`</thead>
|
|
147
|
+
`+n+`</table>
|
|
148
|
+
`}tablerow({text:s}){return`<tr>
|
|
149
|
+
${s}</tr>
|
|
150
|
+
`}tablecell(s){let e=this.parser.parseInline(s.tokens),t=s.header?"th":"td";return(s.align?`<${t} align="${s.align}">`:`<${t}>`)+e+`</${t}>
|
|
151
|
+
`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${Qe(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:e,tokens:t}){let n=this.parser.parseInline(t),r=sn(s);if(r===null)return n;s=r;let i='<a href="'+s+'"';return e&&(i+=' title="'+Qe(e)+'"'),i+=">"+n+"</a>",i}image({href:s,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let r=sn(s);if(r===null)return Qe(t);s=r;let i=`<img src="${s}" alt="${t}"`;return e&&(i+=` title="${Qe(e)}"`),i+=">",i}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:Qe(s.text)}},Qs=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}checkbox({raw:s}){return s}},qe=class qs{constructor(e){ce(this,"options");ce(this,"renderer");ce(this,"textRenderer");this.options=e||mt,this.options.renderer=this.options.renderer||new fs,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qs}static parse(e,t){return new qs(t).parse(e)}static parseInline(e,t){return new qs(t).parseInline(e)}parse(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let a=r,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){t+=l||"";continue}}let i=r;switch(i.type){case"space":{t+=this.renderer.space(i);break}case"hr":{t+=this.renderer.hr(i);break}case"heading":{t+=this.renderer.heading(i);break}case"code":{t+=this.renderer.code(i);break}case"table":{t+=this.renderer.table(i);break}case"blockquote":{t+=this.renderer.blockquote(i);break}case"list":{t+=this.renderer.list(i);break}case"checkbox":{t+=this.renderer.checkbox(i);break}case"html":{t+=this.renderer.html(i);break}case"def":{t+=this.renderer.def(i);break}case"paragraph":{t+=this.renderer.paragraph(i);break}case"text":{t+=this.renderer.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return t}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=l||"";continue}}let a=i;switch(a.type){case"escape":{n+=t.text(a);break}case"html":{n+=t.html(a);break}case"link":{n+=t.link(a);break}case"image":{n+=t.image(a);break}case"checkbox":{n+=t.checkbox(a);break}case"strong":{n+=t.strong(a);break}case"em":{n+=t.em(a);break}case"codespan":{n+=t.codespan(a);break}case"br":{n+=t.br(a);break}case"del":{n+=t.del(a);break}case"text":{n+=t.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}},ds,jt=(ds=class{constructor(s){ce(this,"options");ce(this,"block");this.options=s||mt}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}emStrongMask(s){return s}provideLexer(){return this.block?He.lex:He.lexInline}provideParser(){return this.block?qe.parse:qe.parseInline}},ce(ds,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ce(ds,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ds),ia=class{constructor(...s){ce(this,"defaults",js());ce(this,"options",this.setOptions);ce(this,"parse",this.parseMarkdown(!0));ce(this,"parseInline",this.parseMarkdown(!1));ce(this,"Parser",qe);ce(this,"Renderer",fs);ce(this,"TextRenderer",Qs);ce(this,"Lexer",He);ce(this,"Tokenizer",ps);ce(this,"Hooks",jt);this.use(...s)}walkTokens(s,e){let t=[];for(let n of s)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let r=n;for(let i of r.header)t=t.concat(this.walkTokens(i.tokens,e));for(let i of r.rows)for(let a of i)t=t.concat(this.walkTokens(a.tokens,e));break}case"list":{let r=n;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=n;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(i=>{let a=r[i].flat(1/0);t=t.concat(this.walkTokens(a,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...s){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=e.renderers[r.name];i?e.renderers[r.name]=function(...a){let l=r.renderer.apply(this,a);return l===!1&&(l=i.apply(this,a)),l}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),n.extensions=e),t.renderer){let r=this.defaults.renderer||new fs(this.defaults);for(let i in t.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,l=t.renderer[a],o=r[a];r[a]=(...f)=>{let u=l.apply(r,f);return u===!1&&(u=o.apply(r,f)),u||""}}n.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new ps(this.defaults);for(let i in t.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,l=t.tokenizer[a],o=r[a];r[a]=(...f)=>{let u=l.apply(r,f);return u===!1&&(u=o.apply(r,f)),u}}n.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new jt;for(let i in t.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,l=t.hooks[a],o=r[a];jt.passThroughHooks.has(i)?r[a]=f=>{if(this.defaults.async&&jt.passThroughHooksRespectAsync.has(i))return(async()=>{let h=await l.call(r,f);return o.call(r,h)})();let u=l.call(r,f);return o.call(r,u)}:r[a]=(...f)=>{if(this.defaults.async)return(async()=>{let h=await l.apply(r,f);return h===!1&&(h=await o.apply(r,f)),h})();let u=l.apply(r,f);return u===!1&&(u=o.apply(r,f)),u}}n.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,i=t.walkTokens;n.walkTokens=function(a){let l=[];return l.push(i.call(this,a)),r&&(l=l.concat(r.call(this,a))),l}}this.defaults={...this.defaults,...n}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,e){return He.lex(s,e??this.defaults)}parser(s,e){return qe.parse(s,e??this.defaults)}parseMarkdown(s){return(e,t)=>{let n={...t},r={...this.defaults,...n},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=s),r.async)return(async()=>{let a=r.hooks?await r.hooks.preprocess(e):e,l=await(r.hooks?await r.hooks.provideLexer():s?He.lex:He.lexInline)(a,r),o=r.hooks?await r.hooks.processAllTokens(l):l;r.walkTokens&&await Promise.all(this.walkTokens(o,r.walkTokens));let f=await(r.hooks?await r.hooks.provideParser():s?qe.parse:qe.parseInline)(o,r);return r.hooks?await r.hooks.postprocess(f):f})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let a=(r.hooks?r.hooks.provideLexer():s?He.lex:He.lexInline)(e,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let l=(r.hooks?r.hooks.provideParser():s?qe.parse:qe.parseInline)(a,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(a){return i(a)}}}onError(s,e){return t=>{if(t.message+=`
|
|
152
|
+
Please report this to https://github.com/markedjs/marked.`,s){let n="<p>An error occurred:</p><pre>"+Qe(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},gt=new ia;function oe(s,e){return gt.parse(s,e)}oe.options=oe.setOptions=function(s){return gt.setOptions(s),oe.defaults=gt.defaults,an(oe.defaults),oe};oe.getDefaults=js;oe.defaults=mt;oe.use=function(...s){return gt.use(...s),oe.defaults=gt.defaults,an(oe.defaults),oe};oe.walkTokens=function(s,e){return gt.walkTokens(s,e)};oe.parseInline=gt.parseInline;oe.Parser=qe;oe.parser=qe.parse;oe.Renderer=fs;oe.TextRenderer=Qs;oe.Lexer=He;oe.lexer=He.lex;oe.Tokenizer=ps;oe.Hooks=jt;oe.parse=oe;var ao=oe.options,oo=oe.setOptions,lo=oe.use,co=oe.walkTokens,uo=oe.parseInline;var po=qe.parse,fo=He.lex;function Kt(s){let e=oe.parse(s),t=Yr.sanitize(e);return Qr(t)}function Je(s){switch((s||"").toString()){case"open":return"Open";case"in_progress":return"In progress";case"closed":return"Closed";default:return(s||"").toString()||"Open"}}function aa(s){if(!s)return"";try{return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return s}}function oa(s){window.location.hash=s}function bn(s,e,t=oa,n=void 0){let r=de("views:detail"),i=null,a=null,l=!1,o=!1,f=!1,u=!1,h=!1,d=!1,m=!1,y="",S="",E=!1,M=null;function F(){return M||(M=document.createElement("dialog"),M.id="delete-confirm-dialog",M.setAttribute("role","alertdialog"),M.setAttribute("aria-modal","true"),document.body.appendChild(M),M)}function Z(){if(!i)return;let p=F(),I=i.id,Y=i.title||"(no title)";p.innerHTML=`
|
|
153
|
+
<div class="delete-confirm">
|
|
154
|
+
<h2 class="delete-confirm__title">Delete Issue</h2>
|
|
155
|
+
<p class="delete-confirm__message">
|
|
156
|
+
Are you sure you want to delete issue <strong>${I}</strong> \u2014 <strong>${Y}</strong>? This action cannot be undone.
|
|
157
|
+
</p>
|
|
158
|
+
<div class="delete-confirm__actions">
|
|
159
|
+
<button type="button" class="btn" id="delete-cancel-btn">Cancel</button>
|
|
160
|
+
<button type="button" class="btn danger" id="delete-confirm-btn">Delete</button>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
`;let C=p.querySelector("#delete-cancel-btn"),ie=p.querySelector("#delete-confirm-btn");if(C?.addEventListener("click",()=>{typeof p.close=="function"&&p.close(),p.removeAttribute("open")}),ie?.addEventListener("click",async()=>{typeof p.close=="function"&&p.close(),p.removeAttribute("open"),await N()}),p.addEventListener("cancel",ke=>{ke.preventDefault(),typeof p.close=="function"&&p.close(),p.removeAttribute("open")}),typeof p.showModal=="function")try{p.showModal(),p.setAttribute("open","")}catch{p.setAttribute("open","")}else p.setAttribute("open","")}async function N(){if(!i)return;let p=i.id;try{await e("delete-issue",{id:p}),i=null,a=null,R();let I=St(window.location.hash||"");t(`#/${I}`)}catch(I){r("delete failed: %o",I),ge("Failed to delete issue","error")}}function z(p){p.stopPropagation(),p.preventDefault(),Z()}function H(p){let I=St(window.location.hash||"");return rt(I,p)}function ee(p){Te(T`
|
|
164
|
+
<div class="panel__body" id="detail-root">
|
|
165
|
+
<p class="muted">${p}</p>
|
|
166
|
+
</div>
|
|
167
|
+
`,s)}function D(){if(!a||!n||typeof n.snapshotFor!="function")return;let p=n.snapshotFor(`detail:${a}`);Array.isArray(p)&&p.length>0&&(i=p.find(Y=>String(Y.id)===String(a))||p[0])}n&&typeof n.subscribe=="function"&&n.subscribe(()=>{try{D(),R()}catch(p){r("issue stores listener error %o",p)}});let X=()=>{o=!0,R()},W=p=>{p.key==="Enter"?(o=!0,R()):p.key==="Escape"&&(o=!1,R())},re=async()=>{if(!i||l)return;let p=s.querySelector("h2 input"),I=i.title||"",Y=p?p.value:"";if(Y===I){o=!1,R();return}l=!0,p&&(p.disabled=!0);try{r("save title %s \u2192 %s",String(i.id),Y);let C=await e("edit-text",{id:i.id,field:"title",value:Y});C&&typeof C=="object"&&(i=C,o=!1,R())}catch(C){r("save title failed %s %o",String(i.id),C),i.title=I,o=!1,R(),ge("Failed to save title","error")}finally{l=!1}},le=()=>{o=!1,R()},ye=()=>{m=!0,R()},w=p=>{p.key==="Enter"?(p.preventDefault(),m=!0,R()):p.key==="Escape"&&(p.preventDefault(),m=!1,R())},b=async()=>{if(!i||l)return;let p=s.querySelector("#detail-root .prop.assignee input"),I=i?.assignee??"",Y=p?.value??"";if(Y===I){m=!1,R();return}l=!0,p&&(p.disabled=!0);try{r("save assignee %s \u2192 %s",String(i.id),Y);let C=await e("update-assignee",{id:i.id,assignee:Y});C&&typeof C=="object"&&(i=C,m=!1,R())}catch(C){r("save assignee failed %s %o",String(i.id),C),i.assignee=I,m=!1,R(),ge("Failed to update assignee","error")}finally{l=!1}},v=()=>{m=!1,R()},O=p=>{y=p.currentTarget.value||""};function L(p){p.key==="Enter"&&(p.preventDefault(),q())}async function q(){if(!i||l)return;let p=y.trim();if(p){l=!0;try{r("add label %s \u2192 %s",String(i.id),p);let I=await e("label-add",{id:i.id,label:p});I&&typeof I=="object"&&(i=I,y="",R())}catch(I){r("add label failed %s %o",String(i.id),I),ge("Failed to add label","error")}finally{l=!1}}}async function G(p){if(!(!i||l)){l=!0;try{r("remove label %s \u2192 %s",String(i?.id||""),p);let I=await e("label-remove",{id:i.id,label:p});I&&typeof I=="object"&&(i=I,R())}catch(I){r("remove label failed %s %o",String(i?.id||""),I),ge("Failed to remove label","error")}finally{l=!1}}}let B=async p=>{if(!i||l){R();return}let I=p.currentTarget,Y=i.status||"open",C=I.value;if(C!==Y){l=!0,i.status=C,R();try{r("update status %s \u2192 %s",String(i.id),C);let ie=await e("update-status",{id:i.id,status:C});ie&&typeof ie=="object"&&(i=ie,R())}catch(ie){r("update status failed %s %o",String(i.id),ie),i.status=Y,R(),ge("Failed to update status","error")}finally{l=!1}}},k=async p=>{if(!i||l){R();return}let I=p.currentTarget,Y=typeof i.priority=="number"?i.priority:2,C=Number(I.value);if(C!==Y){l=!0,i.priority=C,R();try{r("update priority %s \u2192 %d",String(i.id),C);let ie=await e("update-priority",{id:i.id,priority:C});ie&&typeof ie=="object"&&(i=ie,R())}catch(ie){r("update priority failed %s %o",String(i.id),ie),i.priority=Y,R(),ge("Failed to update priority","error")}finally{l=!1}}},x=()=>{f=!0,R()},$=p=>{if(p.key==="Escape")f=!1,R();else if(p.key==="Enter"&&p.ctrlKey){let I=s.querySelector("#detail-root .editable-actions button");I&&I.click()}},K=async()=>{if(!i||l)return;let p=s.querySelector("#detail-root textarea"),I=i.description||"",Y=p?p.value:"";if(Y===I){f=!1,R();return}l=!0,p&&(p.disabled=!0);try{r("save description %s",String(i?.id||""));let C=await e("edit-text",{id:i.id,field:"description",value:Y});C&&typeof C=="object"&&(i=C,f=!1,R())}catch(C){r("save description failed %s %o",String(i?.id||""),C),i.description=I,f=!1,R(),ge("Failed to save description","error")}finally{l=!1}},fe=()=>{f=!1,R()},ue=()=>{u=!0,R();try{let p=s.querySelector("#detail-root .design textarea");p&&p.focus()}catch(p){r("focus design textarea failed %o",p)}},se=p=>{if(p.key==="Escape")u=!1,R();else if(p.key==="Enter"&&(p.ctrlKey||p.metaKey)){let I=s.querySelector("#detail-root .design .editable-actions button");I&&I.click()}},V=async()=>{if(!i||l)return;let p=s.querySelector("#detail-root .design textarea"),I=i.design||"",Y=p?p.value:"";if(Y===I){u=!1,R();return}l=!0,p&&(p.disabled=!0);try{r("save design %s",String(i?.id||""));let C=await e("edit-text",{id:i.id,field:"design",value:Y});C&&typeof C=="object"&&(i=C,u=!1,R())}catch(C){r("save design failed %s %o",String(i?.id||""),C),i.design=I,u=!1,R(),ge("Failed to save design","error")}finally{l=!1}},pe=()=>{u=!1,R()},we=()=>{h=!0,R()},Me=p=>{if(p.key==="Escape")h=!1,R();else if(p.key==="Enter"&&(p.ctrlKey||p.metaKey)){let I=s.querySelector("#detail-root .notes .editable-actions button");I&&I.click()}},$e=async()=>{if(!i||l)return;let p=s.querySelector("#detail-root .notes textarea"),I=i.notes||"",Y=p?p.value:"";if(Y===I){h=!1,R();return}l=!0,p&&(p.disabled=!0);try{r("save notes %s",String(i?.id||""));let C=await e("edit-text",{id:i.id,field:"notes",value:Y});C&&typeof C=="object"&&(i=C,h=!1,R())}catch(C){r("save notes failed %s %o",String(i?.id||""),C),i.notes=I,h=!1,R(),ge("Failed to save notes","error")}finally{l=!1}},he=()=>{h=!1,R()},Oe=()=>{d=!0,R()},je=p=>{if(p.key==="Escape")d=!1,R();else if(p.key==="Enter"&&(p.ctrlKey||p.metaKey)){let I=s.querySelector("#detail-root .acceptance .editable-actions button");I&&I.click()}},Ke=async()=>{if(!i||l)return;let p=s.querySelector("#detail-root .acceptance textarea"),I=i.acceptance||"",Y=p?p.value:"";if(Y===I){d=!1,R();return}l=!0,p&&(p.disabled=!0);try{r("save acceptance %s",String(i?.id||""));let C=await e("edit-text",{id:i.id,field:"acceptance",value:Y});C&&typeof C=="object"&&(i=C,d=!1,R())}catch(C){r("save acceptance failed %s %o",String(i?.id||""),C),i.acceptance=I,d=!1,R(),ge("Failed to save acceptance","error")}finally{l=!1}},Be=()=>{d=!1,R()},_=p=>{let I=p.currentTarget,Y=S.trim().length>0;S=I.value||"";let C=S.trim().length>0;Y!==C&&R()},g=async()=>{if(!(!i||E||!S.trim())){E=!0,R();try{r("add comment to %s",String(i.id));let p=await e("add-comment",{id:i.id,text:S.trim()});Array.isArray(p)&&(i.comments=p,S="",R())}catch(p){r("add comment failed %s %o",String(i.id),p),ge("Failed to add comment","error")}finally{E=!1,R()}}},j=p=>{p.key==="Enter"&&(p.ctrlKey||p.metaKey)&&(p.preventDefault(),g())};function Q(p,I){let Y=p==="Dependencies"?"add-dependency":"add-dependent",C=p==="Dependencies"?"detail-dependencies-section":"detail-dependents-section";return T`
|
|
168
|
+
<div class="props-card" data-testid=${C}>
|
|
169
|
+
<div>
|
|
170
|
+
<div
|
|
171
|
+
class="props-card__title"
|
|
172
|
+
data-testid=${`${C}-title`}
|
|
173
|
+
>
|
|
174
|
+
${p}
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
<ul data-testid=${`${C}-list`}>
|
|
178
|
+
${!I||I.length===0?null:I.map(ie=>{let ke=ie.id,Ve=H(ke);return T`<li
|
|
179
|
+
data-testid=${`${C}-item-${ke}`}
|
|
180
|
+
data-href=${Ve}
|
|
181
|
+
@click=${()=>t(Ve)}
|
|
182
|
+
>
|
|
183
|
+
${ht(ie.issue_type||"")}
|
|
184
|
+
<span class="text-truncate">${ie.title||""}</span>
|
|
185
|
+
<button
|
|
186
|
+
aria-label=${`Remove dependency ${ke}`}
|
|
187
|
+
data-testid=${`${C}-remove-${ke}`}
|
|
188
|
+
@click=${at(ke,p)}
|
|
189
|
+
>
|
|
190
|
+
×
|
|
191
|
+
</button>
|
|
192
|
+
</li>`})}
|
|
193
|
+
</ul>
|
|
194
|
+
<div
|
|
195
|
+
class="props-card__footer"
|
|
196
|
+
data-testid=${`${C}-footer`}
|
|
197
|
+
>
|
|
198
|
+
<input type="text" placeholder="Issue ID" data-testid=${Y} />
|
|
199
|
+
<button
|
|
200
|
+
@click=${et(I,p)}
|
|
201
|
+
data-testid=${`${C}-add-button`}
|
|
202
|
+
>
|
|
203
|
+
Add
|
|
204
|
+
</button>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
`}function ae(p){let I=o?T`<div class="detail-title" data-testid="detail-title">
|
|
208
|
+
<h2>
|
|
209
|
+
<input
|
|
210
|
+
type="text"
|
|
211
|
+
aria-label="Edit title"
|
|
212
|
+
data-testid="detail-title-input"
|
|
213
|
+
.value=${p.title||""}
|
|
214
|
+
@keydown=${Fe}
|
|
215
|
+
/>
|
|
216
|
+
<button @click=${re} data-testid="detail-title-save">
|
|
217
|
+
Save
|
|
218
|
+
</button>
|
|
219
|
+
<button @click=${le} data-testid="detail-title-cancel">
|
|
220
|
+
Cancel
|
|
221
|
+
</button>
|
|
222
|
+
</h2>
|
|
223
|
+
</div>`:T`<div class="detail-title" data-testid="detail-title">
|
|
224
|
+
<h2>
|
|
225
|
+
<span
|
|
226
|
+
class="editable"
|
|
227
|
+
tabindex="0"
|
|
228
|
+
role="button"
|
|
229
|
+
aria-label="Edit title"
|
|
230
|
+
data-testid="detail-title-display"
|
|
231
|
+
@click=${X}
|
|
232
|
+
@keydown=${W}
|
|
233
|
+
>${p.title||""}</span
|
|
234
|
+
>
|
|
235
|
+
</h2>
|
|
236
|
+
</div>`,Y=T`<select
|
|
237
|
+
class=${`badge-select badge--status is-${p.status||"open"}`}
|
|
238
|
+
data-testid="detail-status-select"
|
|
239
|
+
@change=${B}
|
|
240
|
+
.value=${p.status||"open"}
|
|
241
|
+
?disabled=${l}
|
|
242
|
+
>
|
|
243
|
+
${(()=>{let J=String(p.status||"open");return["open","in_progress","closed"].map(ve=>T`<option value=${ve} ?selected=${J===ve}>
|
|
244
|
+
${Je(ve)}
|
|
245
|
+
</option>`)})()}
|
|
246
|
+
</select>`,C=T`<select
|
|
247
|
+
class=${`badge-select badge--priority is-p${String(typeof p.priority=="number"?p.priority:2)}`}
|
|
248
|
+
data-testid="detail-priority-select"
|
|
249
|
+
@change=${k}
|
|
250
|
+
.value=${String(typeof p.priority=="number"?p.priority:2)}
|
|
251
|
+
?disabled=${l}
|
|
252
|
+
>
|
|
253
|
+
${(()=>{let J=String(typeof p.priority=="number"?p.priority:2);return it.map((ve,ot)=>T`<option value=${String(ot)} ?selected=${J===String(ot)}>
|
|
254
|
+
${Mt(ot)} ${ve}
|
|
255
|
+
</option>`)})()}
|
|
256
|
+
</select>`,ie=f?T`<div class="description">
|
|
257
|
+
<textarea
|
|
258
|
+
@keydown=${$}
|
|
259
|
+
.value=${p.description||""}
|
|
260
|
+
rows="8"
|
|
261
|
+
style="width:100%"
|
|
262
|
+
></textarea>
|
|
263
|
+
<div class="editable-actions">
|
|
264
|
+
<button @click=${K}>Save</button>
|
|
265
|
+
<button @click=${fe}>Cancel</button>
|
|
266
|
+
</div>
|
|
267
|
+
</div>`:T`<div
|
|
268
|
+
class="md editable"
|
|
269
|
+
tabindex="0"
|
|
270
|
+
role="button"
|
|
271
|
+
aria-label="Edit description"
|
|
272
|
+
@click=${x}
|
|
273
|
+
@keydown=${Tt}
|
|
274
|
+
>
|
|
275
|
+
${(()=>{let J=p.description||"";return J.trim()===""?T`<div class="muted">Description</div>`:Kt(J)})()}
|
|
276
|
+
</div>`,ke=(()=>{let J=p;return String(p.acceptance||J.acceptance_criteria||"")})(),Ve=d?T`<div class="acceptance">
|
|
277
|
+
${ke.trim().length>0?T`<div class="props-card__title">Acceptance Criteria</div>`:""}
|
|
278
|
+
<textarea
|
|
279
|
+
@keydown=${je}
|
|
280
|
+
.value=${ke}
|
|
281
|
+
rows="6"
|
|
282
|
+
style="width:100%"
|
|
283
|
+
></textarea>
|
|
284
|
+
<div class="editable-actions">
|
|
285
|
+
<button @click=${Ke}>Save</button>
|
|
286
|
+
<button @click=${Be}>Cancel</button>
|
|
287
|
+
</div>
|
|
288
|
+
</div>`:T`<div class="acceptance">
|
|
289
|
+
${(()=>{let J=ke,ve=J.trim().length>0;return T`${ve?T`<div class="props-card__title">Acceptance Criteria</div>`:""}
|
|
290
|
+
<div
|
|
291
|
+
class="md editable"
|
|
292
|
+
tabindex="0"
|
|
293
|
+
role="button"
|
|
294
|
+
aria-label="Edit acceptance criteria"
|
|
295
|
+
@click=${Oe}
|
|
296
|
+
@keydown=${Yt}
|
|
297
|
+
>
|
|
298
|
+
${ve?Kt(J):T`<div class="muted">Add acceptance criteria…</div>`}
|
|
299
|
+
</div>`})()}
|
|
300
|
+
</div>`,Ae=String(p.notes||""),bt=h?T`<div class="notes">
|
|
301
|
+
${Ae.trim().length>0?T`<div class="props-card__title">Notes</div>`:""}
|
|
302
|
+
<textarea
|
|
303
|
+
@keydown=${Me}
|
|
304
|
+
.value=${Ae}
|
|
305
|
+
rows="6"
|
|
306
|
+
style="width:100%"
|
|
307
|
+
></textarea>
|
|
308
|
+
<div class="editable-actions">
|
|
309
|
+
<button @click=${$e}>Save</button>
|
|
310
|
+
<button @click=${he}>Cancel</button>
|
|
311
|
+
</div>
|
|
312
|
+
</div>`:T`<div class="notes">
|
|
313
|
+
${(()=>{let J=Ae,ve=J.trim().length>0;return T`${ve?T`<div class="props-card__title">Notes</div>`:""}
|
|
314
|
+
<div
|
|
315
|
+
class="md editable"
|
|
316
|
+
tabindex="0"
|
|
317
|
+
role="button"
|
|
318
|
+
aria-label="Edit notes"
|
|
319
|
+
@click=${we}
|
|
320
|
+
@keydown=${Zt}
|
|
321
|
+
>
|
|
322
|
+
${ve?Kt(J):T`<div class="muted">Add notes…</div>`}
|
|
323
|
+
</div>`})()}
|
|
324
|
+
</div>`,yt=Array.isArray(p.labels)?p.labels:[],ys=T`<div
|
|
325
|
+
class="props-card labels"
|
|
326
|
+
data-testid="detail-labels-section"
|
|
327
|
+
>
|
|
328
|
+
<div>
|
|
329
|
+
<div class="props-card__title">Labels</div>
|
|
330
|
+
</div>
|
|
331
|
+
<ul>
|
|
332
|
+
${yt.map(J=>T`<li>
|
|
333
|
+
<span class="badge" title=${J}
|
|
334
|
+
>${J}
|
|
335
|
+
<button
|
|
336
|
+
class="icon-button"
|
|
337
|
+
title="Remove label"
|
|
338
|
+
aria-label=${"Remove label "+J}
|
|
339
|
+
@click=${()=>G(J)}
|
|
340
|
+
style="margin-left:6px"
|
|
341
|
+
>
|
|
342
|
+
×
|
|
343
|
+
</button></span
|
|
344
|
+
>
|
|
345
|
+
</li>`)}
|
|
346
|
+
</ul>
|
|
347
|
+
<div class="props-card__footer">
|
|
348
|
+
<input
|
|
349
|
+
type="text"
|
|
350
|
+
placeholder="Label"
|
|
351
|
+
size="12"
|
|
352
|
+
.value=${y}
|
|
353
|
+
@input=${O}
|
|
354
|
+
@keydown=${L}
|
|
355
|
+
/>
|
|
356
|
+
<button @click=${q}>Add</button>
|
|
357
|
+
</div>
|
|
358
|
+
</div>`,Ye=String(p.design||""),ws=u?T`<div class="design">
|
|
359
|
+
${Ye.trim().length>0?T`<div class="props-card__title">Design</div>`:""}
|
|
360
|
+
<textarea
|
|
361
|
+
@keydown=${se}
|
|
362
|
+
.value=${Ye}
|
|
363
|
+
rows="6"
|
|
364
|
+
style="width:100%"
|
|
365
|
+
></textarea>
|
|
366
|
+
<div class="editable-actions">
|
|
367
|
+
<button @click=${V}>Save</button>
|
|
368
|
+
<button @click=${pe}>Cancel</button>
|
|
369
|
+
</div>
|
|
370
|
+
</div>`:T`<div class="design">
|
|
371
|
+
${(()=>{let J=Ye,ve=J.trim().length>0;return T`${ve?T`<div class="props-card__title">Design</div>`:""}
|
|
372
|
+
<div
|
|
373
|
+
class="md editable"
|
|
374
|
+
tabindex="0"
|
|
375
|
+
role="button"
|
|
376
|
+
aria-label="Edit design"
|
|
377
|
+
@click=${ue}
|
|
378
|
+
@keydown=${Et}
|
|
379
|
+
>
|
|
380
|
+
${ve?Kt(J):T`<div class="muted">Add design…</div>`}
|
|
381
|
+
</div>`})()}
|
|
382
|
+
</div>`,Xt=Array.isArray(p.comments)?p.comments:[],_e=T`<div
|
|
383
|
+
class="comments"
|
|
384
|
+
data-testid="detail-comments-section"
|
|
385
|
+
>
|
|
386
|
+
<div class="props-card__title">Comments</div>
|
|
387
|
+
${Xt.length===0?T`<div class="muted">No comments yet</div>`:Xt.map(J=>T`
|
|
388
|
+
<div class="comment-item">
|
|
389
|
+
<div class="comment-header">
|
|
390
|
+
<span class="comment-author">${J.author||"Unknown"}</span>
|
|
391
|
+
<span class="comment-date"
|
|
392
|
+
>${aa(J.created_at)}</span
|
|
393
|
+
>
|
|
394
|
+
</div>
|
|
395
|
+
<div class="comment-text">${J.text}</div>
|
|
396
|
+
</div>
|
|
397
|
+
`)}
|
|
398
|
+
<div class="comment-input" data-testid="detail-comment-form">
|
|
399
|
+
<textarea
|
|
400
|
+
placeholder="Add a comment... (Ctrl+Enter to submit)"
|
|
401
|
+
rows="3"
|
|
402
|
+
.value=${S}
|
|
403
|
+
@input=${_}
|
|
404
|
+
@keydown=${j}
|
|
405
|
+
?disabled=${E}
|
|
406
|
+
data-testid="detail-comment-input"
|
|
407
|
+
></textarea>
|
|
408
|
+
<button
|
|
409
|
+
@click=${g}
|
|
410
|
+
?disabled=${E||!S.trim()}
|
|
411
|
+
data-testid="detail-comment-submit"
|
|
412
|
+
>
|
|
413
|
+
${E?"Adding...":"Add Comment"}
|
|
414
|
+
</button>
|
|
415
|
+
</div>
|
|
416
|
+
</div>`;return T`
|
|
417
|
+
<div class="panel__body" id="detail-root" data-testid="detail-view">
|
|
418
|
+
<div class="detail-layout" data-testid="detail-layout">
|
|
419
|
+
<div class="detail-main" data-testid="detail-main">
|
|
420
|
+
${I} ${ie} ${ws} ${bt}
|
|
421
|
+
${Ve} ${_e}
|
|
422
|
+
</div>
|
|
423
|
+
<div class="detail-side" data-testid="detail-sidebar">
|
|
424
|
+
<div class="props-card" data-testid="detail-properties">
|
|
425
|
+
<div class="props-card__header">
|
|
426
|
+
<div class="props-card__title">Properties</div>
|
|
427
|
+
<button
|
|
428
|
+
class="delete-issue-btn"
|
|
429
|
+
title="Delete issue"
|
|
430
|
+
aria-label="Delete issue"
|
|
431
|
+
data-testid="detail-delete-button"
|
|
432
|
+
@click=${z}
|
|
433
|
+
>
|
|
434
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
435
|
+
<polyline points="3 6 5 6 21 6"></polyline>
|
|
436
|
+
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
|
|
437
|
+
<line x1="10" y1="11" x2="10" y2="17"></line>
|
|
438
|
+
<line x1="14" y1="11" x2="14" y2="17"></line>
|
|
439
|
+
</svg>
|
|
440
|
+
<span class="tooltip">Delete issue</span>
|
|
441
|
+
</button>
|
|
442
|
+
</div>
|
|
443
|
+
<div class="prop">
|
|
444
|
+
<div class="label">Type</div>
|
|
445
|
+
<div class="value">
|
|
446
|
+
${ht(p.issue_type)}
|
|
447
|
+
</div>
|
|
448
|
+
</div>
|
|
449
|
+
<div class="prop">
|
|
450
|
+
<div class="label">Status</div>
|
|
451
|
+
<div class="value">${Y}</div>
|
|
452
|
+
</div>
|
|
453
|
+
${p.close_reason?T`<div class="prop">
|
|
454
|
+
<div class="label">Close Reason</div>
|
|
455
|
+
<div class="value">${p.close_reason}</div>
|
|
456
|
+
</div>`:""}
|
|
457
|
+
<div class="prop">
|
|
458
|
+
<div class="label">Priority</div>
|
|
459
|
+
<div class="value">${C}</div>
|
|
460
|
+
</div>
|
|
461
|
+
<div class="prop assignee">
|
|
462
|
+
<div class="label">Assignee</div>
|
|
463
|
+
<div class="value">
|
|
464
|
+
${m?T`<input
|
|
465
|
+
type="text"
|
|
466
|
+
aria-label="Edit assignee"
|
|
467
|
+
.value=${p.assignee||""}
|
|
468
|
+
size=${Math.min(40,Math.max(12,(p.assignee||"").length+3))}
|
|
469
|
+
@keydown=${J=>{J.key==="Escape"?(J.preventDefault(),v()):J.key==="Enter"&&(J.preventDefault(),b())}}
|
|
470
|
+
/>
|
|
471
|
+
<button
|
|
472
|
+
class="btn"
|
|
473
|
+
style="margin-left:6px"
|
|
474
|
+
@click=${b}
|
|
475
|
+
>
|
|
476
|
+
Save
|
|
477
|
+
</button>
|
|
478
|
+
<button
|
|
479
|
+
class="btn"
|
|
480
|
+
style="margin-left:6px"
|
|
481
|
+
@click=${v}
|
|
482
|
+
>
|
|
483
|
+
Cancel
|
|
484
|
+
</button>`:T`${(()=>{let J=p.assignee||"",ve=J.trim().length>0;return T`<span
|
|
485
|
+
class=${ve?"editable":"editable muted"}
|
|
486
|
+
tabindex="0"
|
|
487
|
+
role="button"
|
|
488
|
+
aria-label="Edit assignee"
|
|
489
|
+
@click=${ye}
|
|
490
|
+
@keydown=${w}
|
|
491
|
+
>${ve?J:"Unassigned"}</span
|
|
492
|
+
>`})()}`}
|
|
493
|
+
</div>
|
|
494
|
+
</div>
|
|
495
|
+
</div>
|
|
496
|
+
${ys}
|
|
497
|
+
${Q("Dependencies",p.dependencies||[])}
|
|
498
|
+
${Q("Dependents",p.dependents||[])}
|
|
499
|
+
</div>
|
|
500
|
+
</div>
|
|
501
|
+
</div>
|
|
502
|
+
</div>
|
|
503
|
+
`}function R(){if(!i){ee(a?"Loading\u2026":"No issue selected");return}Te(ae(i),s)}function at(p,I){return async Y=>{if(Y.stopPropagation(),!(!i||l)){l=!0;try{if(I==="Dependencies"){let C=await e("dep-remove",{a:i.id,b:p,view_id:i.id});C&&typeof C=="object"&&(i=C,R())}else{let C=await e("dep-remove",{a:p,b:i.id,view_id:i.id});C&&typeof C=="object"&&(i=C,R())}}catch(C){r("dep-remove failed %o",C)}finally{l=!1}}}}function et(p,I){return async Y=>{if(!i||l)return;let C=Y.currentTarget,ie=C.previousElementSibling,ke=ie?ie.value.trim():"";if(!ke||ke===i.id){ge("Enter a different issue id");return}if(new Set((p||[]).map(Ae=>Ae.id)).has(ke)){ge("Link already exists");return}l=!0,C&&(C.disabled=!0),ie&&(ie.disabled=!0);try{if(I==="Dependencies"){let Ae=await e("dep-add",{a:i.id,b:ke,view_id:i.id});Ae&&typeof Ae=="object"&&(i=Ae,R())}else{let Ae=await e("dep-add",{a:ke,b:i.id,view_id:i.id});Ae&&typeof Ae=="object"&&(i=Ae,R())}}catch(Ae){r("dep-add failed %o",Ae),ge("Failed to add dependency","error")}finally{l=!1}}}function Fe(p){p.key==="Escape"?(o=!1,R()):p.key==="Enter"&&(p.preventDefault(),re())}function Tt(p){p.key==="Enter"&&x()}function Yt(p){p.key==="Enter"&&Oe()}function Zt(p){p.key==="Enter"&&we()}function Et(p){p.key==="Enter"&&ue()}return{async load(p){if(!p){ee("No issue selected");return}if(a=String(p),i=null,D(),i||ee("Loading\u2026"),l=!1,S="",E=!1,R(),i&&!i.comments)try{let I=await e("get-comments",{id:a});Array.isArray(I)&&i&&a===p&&(i.comments=I,R())}catch(I){r("fetch comments failed %s %o",p,I)}},clear(){ee("Select an issue to view details")},destroy(){s.replaceChildren(),M&&M.parentNode&&(M.parentNode.removeChild(M),M=null)}}}function ms(s){let e=s.navigate,t=s.onUpdate,n=s.requestRender,r=s.getSelectedId||(()=>null),i=s.row_class||"issue-row",a=s.show_dependencies!==!1,l=new Set;function o(d,m,y,S=""){let E=`${d}:${m}`;return l.has(E)?T`<span>
|
|
504
|
+
<input
|
|
505
|
+
type="text"
|
|
506
|
+
.value=${y}
|
|
507
|
+
class="inline-edit"
|
|
508
|
+
data-testid=${`issue-row-${d}-${m}-input`}
|
|
509
|
+
@keydown=${async F=>{if(F.key==="Escape")l.delete(E),n();else if(F.key==="Enter"){let N=F.currentTarget.value||"";N!==y&&await t(d,{[m]:N}),l.delete(E),n()}}}
|
|
510
|
+
@blur=${async F=>{let N=F.currentTarget.value||"";N!==y&&await t(d,{[m]:N}),l.delete(E),n()}}
|
|
511
|
+
autofocus
|
|
512
|
+
/>
|
|
513
|
+
</span>`:T`<span
|
|
514
|
+
class="editable text-truncate ${y?"":"muted"}"
|
|
515
|
+
tabindex="0"
|
|
516
|
+
role="button"
|
|
517
|
+
data-testid=${`issue-row-${d}-${m}-display`}
|
|
518
|
+
@click=${F=>{F.stopPropagation(),F.preventDefault(),l.add(E),n()}}
|
|
519
|
+
@keydown=${F=>{F.key==="Enter"&&(F.preventDefault(),F.stopPropagation(),l.add(E),n())}}
|
|
520
|
+
>${y||S}</span
|
|
521
|
+
>`}function f(d,m){return async y=>{let E=y.currentTarget.value||"",M={};M[m]=m==="priority"?Number(E):E,await t(d,M)}}function u(d){return m=>{let y=m.target;y&&(y.tagName==="INPUT"||y.tagName==="SELECT")||e(d)}}function h(d){let m=String(d.status||"open"),y=String(d.priority??2),S=r()===d.id,E=(d.dependency_count||0)>0||(d.dependent_count||0)>0?T`<span class="deps-indicator"
|
|
522
|
+
>${(d.dependency_count||0)>0?T`<span
|
|
523
|
+
class="dep-count"
|
|
524
|
+
title="${d.dependency_count} ${(d.dependency_count||0)===1?"dependency":"dependencies"}"
|
|
525
|
+
>${"\u2192"}${d.dependency_count}</span
|
|
526
|
+
>`:""}${(d.dependent_count||0)>0?T`<span
|
|
527
|
+
class="dependent-count"
|
|
528
|
+
title="${d.dependent_count} ${(d.dependent_count||0)===1?"dependent":"dependents"}"
|
|
529
|
+
>${"\u2190"}${d.dependent_count}</span
|
|
530
|
+
>`:""}</span
|
|
531
|
+
>`:"";return T`<tr
|
|
532
|
+
role="row"
|
|
533
|
+
class="${i} ${S?"selected":""}"
|
|
534
|
+
data-issue-id=${d.id}
|
|
535
|
+
data-testid=${`issue-row-${d.id}`}
|
|
536
|
+
@click=${u(d.id)}
|
|
537
|
+
>
|
|
538
|
+
<td
|
|
539
|
+
role="gridcell"
|
|
540
|
+
class="mono issue-row__id-cell"
|
|
541
|
+
data-testid=${`issue-row-${d.id}-id`}
|
|
542
|
+
>
|
|
543
|
+
${nt(d.id)}
|
|
544
|
+
</td>
|
|
545
|
+
<td role="gridcell" data-testid=${`issue-row-${d.id}-type`}>
|
|
546
|
+
${ht(d.issue_type)}
|
|
547
|
+
</td>
|
|
548
|
+
<td role="gridcell" data-testid=${`issue-row-${d.id}-title`}>
|
|
549
|
+
${o(d.id,"title",d.title||"")}
|
|
550
|
+
</td>
|
|
551
|
+
<td role="gridcell" data-testid=${`issue-row-${d.id}-status`}>
|
|
552
|
+
<span class="badge-select-wrap badge-select-wrap--status">
|
|
553
|
+
<select
|
|
554
|
+
class="badge-select badge--status is-${m}"
|
|
555
|
+
.value=${m}
|
|
556
|
+
data-testid=${`issue-row-${d.id}-status-select`}
|
|
557
|
+
@change=${f(d.id,"status")}
|
|
558
|
+
>
|
|
559
|
+
${["open","in_progress","closed"].map(M=>T`<option value=${M} ?selected=${m===M}>
|
|
560
|
+
${Je(M)}
|
|
561
|
+
</option>`)}
|
|
562
|
+
</select>
|
|
563
|
+
<span
|
|
564
|
+
class="badge-select__caret"
|
|
565
|
+
aria-hidden="true"
|
|
566
|
+
data-testid=${`issue-row-${d.id}-status-caret`}
|
|
567
|
+
>
|
|
568
|
+
<svg viewBox="0 0 12 12" focusable="false">
|
|
569
|
+
<path d="M3 4.5 6 7.5 9 4.5" />
|
|
570
|
+
</svg>
|
|
571
|
+
</span>
|
|
572
|
+
</span>
|
|
573
|
+
</td>
|
|
574
|
+
<td role="gridcell" data-testid=${`issue-row-${d.id}-assignee`}>
|
|
575
|
+
${o(d.id,"assignee",d.assignee||"","Unassigned")}
|
|
576
|
+
</td>
|
|
577
|
+
<td role="gridcell" data-testid=${`issue-row-${d.id}-priority`}>
|
|
578
|
+
<span class="badge-select-wrap badge-select-wrap--priority">
|
|
579
|
+
<select
|
|
580
|
+
class="badge-select badge--priority ${"is-p"+y}"
|
|
581
|
+
.value=${y}
|
|
582
|
+
data-testid=${`issue-row-${d.id}-priority-select`}
|
|
583
|
+
@change=${f(d.id,"priority")}
|
|
584
|
+
>
|
|
585
|
+
${it.map((M,F)=>T`<option
|
|
586
|
+
value=${String(F)}
|
|
587
|
+
?selected=${y===String(F)}
|
|
588
|
+
>
|
|
589
|
+
${Mt(F)} ${M}
|
|
590
|
+
</option>`)}
|
|
591
|
+
</select>
|
|
592
|
+
<span
|
|
593
|
+
class="badge-select__caret"
|
|
594
|
+
aria-hidden="true"
|
|
595
|
+
data-testid=${`issue-row-${d.id}-priority-caret`}
|
|
596
|
+
>
|
|
597
|
+
<svg viewBox="0 0 12 12" focusable="false">
|
|
598
|
+
<path d="M3 4.5 6 7.5 9 4.5" />
|
|
599
|
+
</svg>
|
|
600
|
+
</span>
|
|
601
|
+
</span>
|
|
602
|
+
</td>
|
|
603
|
+
${a?T`<td
|
|
604
|
+
role="gridcell"
|
|
605
|
+
class="deps-col"
|
|
606
|
+
data-testid=${`issue-row-${d.id}-deps`}
|
|
607
|
+
>
|
|
608
|
+
${E}
|
|
609
|
+
</td>`:""}
|
|
610
|
+
</tr>`}return h}function yn(s,e,t,n=void 0,r=void 0){let i=[],a="id",l="asc",o="priority",f="asc",u=new Set,h=new Set,d=new Map,m=r?st(r):null;m&&m.subscribe(()=>{let k=i.length===0;if(i=B(),S(),k&&i.length>0){let x=String(D(i)[0]?.epic?.id||"");x&&!u.has(x)&&G(x)}});let y=ms({navigate:k=>t(k),onUpdate:q,requestRender:S,getSelectedId:()=>null,row_class:"epic-row",show_dependencies:!1});function S(){Te(E(),s)}function E(){if(!i.length)return T`<div
|
|
611
|
+
class="panel__header muted"
|
|
612
|
+
data-testid="epics-empty"
|
|
613
|
+
>
|
|
614
|
+
No epics found.
|
|
615
|
+
</div>`;let k=D(i);return T`
|
|
616
|
+
<div class="epics-table-wrap" data-testid="epics-view">
|
|
617
|
+
<table class="epics-table" data-testid="epics-table">
|
|
618
|
+
<colgroup>
|
|
619
|
+
<col class="epics-table__col epics-table__col--id" />
|
|
620
|
+
<col class="epics-table__col epics-table__col--type" />
|
|
621
|
+
<col class="epics-table__col epics-table__col--title" />
|
|
622
|
+
<col class="epics-table__col epics-table__col--status" />
|
|
623
|
+
<col class="epics-table__col epics-table__col--assignee" />
|
|
624
|
+
<col class="epics-table__col epics-table__col--priority" />
|
|
625
|
+
</colgroup>
|
|
626
|
+
<thead class="epics-list-header" data-testid="epics-header">
|
|
627
|
+
<tr>
|
|
628
|
+
<th scope="col" data-testid="epics-header-id">${M("id","Id")}</th>
|
|
629
|
+
<th scope="col" colspan="2" data-testid="epics-header-name">${M("name","Name")}</th>
|
|
630
|
+
<th scope="col" data-testid="epics-header-status">${M("status","Status")}</th>
|
|
631
|
+
<th scope="col" colspan="2" class="epics-list-header__meta" data-testid="epics-header-progress">Progress</th>
|
|
632
|
+
</tr>
|
|
633
|
+
</thead>
|
|
634
|
+
${k.map(x=>N(x))}
|
|
635
|
+
</table>
|
|
636
|
+
</div>
|
|
637
|
+
`}function M(k,x){return Z({column:k,label:x,active_column:a,active_direction:l,data_attribute_name:"data-sort-column",onToggle:()=>H(k)})}function F(k,x){return Z({column:k,label:x,active_column:o,active_direction:f,data_attribute_name:"data-child-sort-column",onToggle:()=>ee(k)})}function Z(k){let{column:x,label:$,active_column:K,active_direction:fe,data_attribute_name:ue,onToggle:se}=k,V=K===x,pe=V&&fe==="asc"?"desc":"asc",we=V?fe==="asc"?T`<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 19V5"/><path d="M5 12l7-7 7 7"/></svg>`:T`<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14"/><path d="M19 12l-7 7-7-7"/></svg>`:T`<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 15l5 5 5-5"/><path d="M7 9l5-5 5 5"/></svg>`;return T`
|
|
638
|
+
<button
|
|
639
|
+
type="button"
|
|
640
|
+
class="epics-sort-button ${V?"is-active":""}"
|
|
641
|
+
data-sort-column=${ue==="data-sort-column"?x:be}
|
|
642
|
+
data-child-sort-column=${ue==="data-child-sort-column"?x:be}
|
|
643
|
+
data-testid=${ue==="data-sort-column"?`epics-sort-${x}`:`epic-child-sort-${x}`}
|
|
644
|
+
aria-label=${`Sort by ${$} ${pe}`}
|
|
645
|
+
aria-pressed=${V}
|
|
646
|
+
@click=${se}
|
|
647
|
+
>
|
|
648
|
+
<span>${$}</span>
|
|
649
|
+
${we}
|
|
650
|
+
</button>
|
|
651
|
+
`}function N(k){let x=k.epic||{},$=String(x.id||""),K=u.has($),fe=String(x.status||"open"),ue=Je(fe),se=m?m.selectEpicChildren($):[],V=X(se),pe=h.has($);return T`
|
|
652
|
+
<tbody
|
|
653
|
+
class="epic-group ${K?"is-open":""}"
|
|
654
|
+
data-epic-id=${$}
|
|
655
|
+
data-testid=${`epic-group-${$}`}
|
|
656
|
+
>
|
|
657
|
+
<tr
|
|
658
|
+
class="epic-header-row"
|
|
659
|
+
data-testid=${`epic-header-${$}`}
|
|
660
|
+
@click=${()=>G($)}
|
|
661
|
+
@keydown=${we=>z(we,$)}
|
|
662
|
+
tabindex="0"
|
|
663
|
+
aria-expanded=${K}
|
|
664
|
+
>
|
|
665
|
+
<td
|
|
666
|
+
class="epic-header-row__cell epic-header-row__cell--id"
|
|
667
|
+
data-testid=${`epic-header-id-${$}`}
|
|
668
|
+
>
|
|
669
|
+
${nt($,{class_name:"mono"})}
|
|
670
|
+
</td>
|
|
671
|
+
<td
|
|
672
|
+
class="epic-header-row__cell epic-header-row__cell--name"
|
|
673
|
+
colspan="2"
|
|
674
|
+
data-testid=${`epic-header-name-${$}`}
|
|
675
|
+
>
|
|
676
|
+
<span class="epic-header-name">
|
|
677
|
+
${K?T`<svg class="epic-chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-testid=${`epic-header-chevron-${$}`}><polyline points="6 9 12 15 18 9"></polyline></svg>`:T`<svg class="epic-chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-testid=${`epic-header-chevron-${$}`}><polyline points="9 18 15 12 9 6"></polyline></svg>`}
|
|
678
|
+
<span
|
|
679
|
+
class="text-truncate"
|
|
680
|
+
data-testid=${`epic-header-title-${$}`}
|
|
681
|
+
>${x.title||"(no title)"}</span
|
|
682
|
+
>
|
|
683
|
+
</span>
|
|
684
|
+
</td>
|
|
685
|
+
<td
|
|
686
|
+
class="epic-header-row__cell epic-header-row__cell--status"
|
|
687
|
+
data-testid=${`epic-header-status-${$}`}
|
|
688
|
+
>
|
|
689
|
+
<span
|
|
690
|
+
class="status-badge is-${fe}"
|
|
691
|
+
data-testid=${`epic-header-status-badge-${$}`}
|
|
692
|
+
>${ue}</span
|
|
693
|
+
>
|
|
694
|
+
</td>
|
|
695
|
+
<td
|
|
696
|
+
class="epic-header-row__cell epic-header-row__cell--progress"
|
|
697
|
+
colspan="2"
|
|
698
|
+
data-testid=${`epic-header-progress-${$}`}
|
|
699
|
+
>
|
|
700
|
+
<span
|
|
701
|
+
class="epic-progress"
|
|
702
|
+
data-testid=${`epic-progress-${$}`}
|
|
703
|
+
>
|
|
704
|
+
<progress
|
|
705
|
+
value=${Number(k.closed_children||0)}
|
|
706
|
+
max=${Math.max(1,Number(k.total_children||0))}
|
|
707
|
+
data-testid=${`epic-progress-bar-${$}`}
|
|
708
|
+
></progress>
|
|
709
|
+
<span
|
|
710
|
+
class="muted mono"
|
|
711
|
+
data-testid=${`epic-progress-count-${$}`}
|
|
712
|
+
>${k.closed_children}/${k.total_children}</span
|
|
713
|
+
>
|
|
714
|
+
</span>
|
|
715
|
+
</td>
|
|
716
|
+
</tr>
|
|
717
|
+
${K?T`<tr
|
|
718
|
+
class="epic-children-row"
|
|
719
|
+
data-testid=${`epic-children-row-${$}`}
|
|
720
|
+
>
|
|
721
|
+
<td
|
|
722
|
+
class="epic-children"
|
|
723
|
+
colspan="6"
|
|
724
|
+
data-testid=${`epic-children-${$}`}
|
|
725
|
+
>
|
|
726
|
+
${pe?T`<div class="muted">Loading…</div>`:se.length===0?T`<div class="muted">No issues found</div>`:T`<table
|
|
727
|
+
class="table"
|
|
728
|
+
data-testid=${`epic-children-table-${$}`}
|
|
729
|
+
>
|
|
730
|
+
<colgroup>
|
|
731
|
+
<col class="epics-table__col epics-table__col--id" />
|
|
732
|
+
<col class="epics-table__col epics-table__col--type" />
|
|
733
|
+
<col class="epics-table__col epics-table__col--title" />
|
|
734
|
+
<col class="epics-table__col epics-table__col--status" />
|
|
735
|
+
<col class="epics-table__col epics-table__col--assignee" />
|
|
736
|
+
<col class="epics-table__col epics-table__col--priority" />
|
|
737
|
+
</colgroup>
|
|
738
|
+
<thead data-testid=${`epic-children-header-${$}`}>
|
|
739
|
+
<tr>
|
|
740
|
+
<th data-testid=${`epic-children-header-id-${$}`}>${F("id","ID")}</th>
|
|
741
|
+
<th data-testid=${`epic-children-header-type-${$}`}>${F("type","Type")}</th>
|
|
742
|
+
<th data-testid=${`epic-children-header-title-${$}`}>${F("title","Title")}</th>
|
|
743
|
+
<th data-testid=${`epic-children-header-status-${$}`}>${F("status","Status")}</th>
|
|
744
|
+
<th data-testid=${`epic-children-header-assignee-${$}`}>${F("assignee","Assignee")}</th>
|
|
745
|
+
<th data-testid=${`epic-children-header-priority-${$}`}>${F("priority","Priority")}</th>
|
|
746
|
+
</tr>
|
|
747
|
+
</thead>
|
|
748
|
+
<tbody data-testid=${`epic-children-rows-${$}`}>
|
|
749
|
+
${V.map(we=>y(we))}
|
|
750
|
+
</tbody>
|
|
751
|
+
</table>`}
|
|
752
|
+
</td>
|
|
753
|
+
</tr>`:null}
|
|
754
|
+
</tbody>
|
|
755
|
+
`}function z(k,x){(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),G(x))}function H(k){a===k?l=l==="asc"?"desc":"asc":(a=k,l="asc"),S()}function ee(k){o===k?f=f==="asc"?"desc":"asc":(o=k,f="asc"),S()}function D(k){return k.slice().sort(W)}function X(k){return k.slice().sort(re)}function W(k,x){let $=0;return a==="id"?$=le(k?.epic?.id,x?.epic?.id):a==="name"?$=le(k?.epic?.title,x?.epic?.title):$=ye(k?.epic?.status,x?.epic?.status),$===0&&($=le(k?.epic?.id,x?.epic?.id)),l==="asc"?$:$*-1}function re(k,x){let $=0;switch(o){case"id":$=le(k?.id,x?.id);break;case"type":$=le(k?.issue_type,x?.issue_type);break;case"title":$=le(k?.title,x?.title);break;case"status":$=ye(k?.status,x?.status);break;case"assignee":$=le(k?.assignee,x?.assignee);break;case"priority":default:$=w(k?.priority,x?.priority);break}return $===0&&o!=="priority"&&($=w(k?.priority,x?.priority)),$===0&&($=b(k?.created_at,x?.created_at)),$===0&&($=le(k?.id,x?.id)),f==="asc"?$:$*-1}function le(k,x){return String(k||"").localeCompare(String(x||""),void 0,{numeric:!0,sensitivity:"base"})}function ye(k,x){return v(k)-v(x)}function w(k,x){return O(k)-O(x)}function b(k,x){return L(k)-L(x)}function v(k){switch(String(k||"open")){case"open":return 0;case"in_progress":return 1;case"closed":return 2;default:return 3}}function O(k){return Number.isFinite(k)?Number(k):Number.MAX_SAFE_INTEGER}function L(k){let x=typeof k=="number"?k:Date.parse(String(k||""));return Number.isFinite(x)?x:Number.MAX_SAFE_INTEGER}async function q(k,x){try{await e.updateIssue({id:k,...x}),S()}catch{}}async function G(k){if(u.has(k)){if(u.delete(k),d.has(k)){try{let x=d.get(k);x&&await x()}catch{}d.delete(k);try{r&&r.unregister&&r.unregister(`detail:${k}`)}catch{}}}else{if(u.add(k),h.add(k),S(),n&&typeof n.subscribeList=="function")try{try{r&&r.register&&r.register(`detail:${k}`,{type:"issue-detail",params:{id:k}})}catch{}let x=await n.subscribeList(`detail:${k}`,{type:"issue-detail",params:{id:k}});d.set(k,x)}catch{}h.delete(k)}S()}function B(){let k=r&&r.snapshotFor?r.snapshotFor("tab:epics")||[]:[],x=[];for(let $ of k){let K=Array.isArray($.dependents)?$.dependents:[],fe=Number.isFinite($.total_children),ue=Number.isFinite($.closed_children),se=fe?Number($.total_children)||0:K.length,V=ue&&Number($.closed_children)||0;if(!ue)for(let pe of K)String(pe.status||"")==="closed"&&V++;x.push({epic:$,total_children:se,closed_children:V})}return x}return{async load(){i=B(),S();try{if(i.length>0){let k=String(D(i)[0]?.epic?.id||"");k&&!u.has(k)&&await G(k)}}catch{}}}}function wn(s){let e=document.createElement("dialog");e.id="fatal-error-dialog",e.setAttribute("role","alertdialog"),e.setAttribute("aria-modal","true"),e.innerHTML=`
|
|
756
|
+
<div class="fatal-error">
|
|
757
|
+
<div class="fatal-error__icon" aria-hidden="true">!</div>
|
|
758
|
+
<div class="fatal-error__body">
|
|
759
|
+
<p class="fatal-error__eyebrow">Critical</p>
|
|
760
|
+
<h2 class="fatal-error__title" id="fatal-error-title">Command failed</h2>
|
|
761
|
+
<p class="fatal-error__message" id="fatal-error-message"></p>
|
|
762
|
+
<pre class="fatal-error__detail" id="fatal-error-detail"></pre>
|
|
763
|
+
<div class="fatal-error__actions">
|
|
764
|
+
<button type="button" class="btn primary" id="fatal-error-reload">Reload</button>
|
|
765
|
+
<button type="button" class="btn" id="fatal-error-close">Dismiss</button>
|
|
766
|
+
</div>
|
|
767
|
+
</div>
|
|
768
|
+
</div>`,s.appendChild(e);let t=e.querySelector("#fatal-error-title"),n=e.querySelector("#fatal-error-message"),r=e.querySelector("#fatal-error-detail"),i=e.querySelector("#fatal-error-reload"),a=e.querySelector("#fatal-error-close"),l=()=>{if(typeof e.close=="function")try{e.close()}catch{}e.removeAttribute("open")},o=(f,u,h="")=>{t&&(t.textContent=f||"Unexpected Error"),n&&(n.textContent=u||"An unrecoverable error occurred.");let d=typeof h=="string"?h.trim():"";if(r&&(d.length>0?(r.textContent=d,r.removeAttribute("hidden")):(r.textContent="No additional diagnostics available.",r.setAttribute("hidden",""))),typeof e.showModal=="function")try{e.showModal(),e.setAttribute("open","")}catch{e.setAttribute("open","")}else e.setAttribute("open","")};return i&&i.addEventListener("click",()=>{window.location.reload()}),a&&a.addEventListener("click",()=>l()),e.addEventListener("cancel",f=>{f.preventDefault(),l()}),{open:o,close:l,getElement(){return e}}}function kn(s,e,t){let n=document.createElement("dialog");n.id="issue-dialog",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("data-testid","issue-dialog"),n.innerHTML=`
|
|
769
|
+
<div class="issue-dialog__container" part="container" data-testid="issue-dialog-container">
|
|
770
|
+
<header class="issue-dialog__header" data-testid="issue-dialog-header">
|
|
771
|
+
<div class="issue-dialog__title" data-testid="issue-dialog-title-wrap">
|
|
772
|
+
<span class="mono" id="issue-dialog-title"></span>
|
|
773
|
+
</div>
|
|
774
|
+
<button type="button" class="issue-dialog__close" aria-label="Close">\xD7</button>
|
|
775
|
+
</header>
|
|
776
|
+
<div class="issue-dialog__body" id="issue-dialog-body" data-testid="issue-dialog-body"></div>
|
|
777
|
+
</div>
|
|
778
|
+
`,s.appendChild(n);let r=n.querySelector("#issue-dialog-body"),i=n.querySelector("#issue-dialog-title"),a=n.querySelector(".issue-dialog__close");a?.setAttribute("data-testid","issue-dialog-close"),i?.setAttribute("data-testid","issue-dialog-title");function l(m){i.replaceChildren(),i.appendChild(nt(m))}n.addEventListener("mousedown",m=>{m.target===n&&(m.preventDefault(),f())}),n.addEventListener("cancel",m=>{m.preventDefault(),f()}),a.addEventListener("click",()=>f());let o=null;function f(){try{typeof n.close=="function"?n.close():n.removeAttribute("open")}catch{n.removeAttribute("open")}try{t()}catch{}d()}function u(m){try{let y=document.activeElement;y&&y instanceof HTMLElement?o=y:o=null}catch{o=null}l(m);try{"showModal"in n&&typeof n.showModal=="function"?n.showModal():n.setAttribute("open",""),setTimeout(()=>{try{a.focus()}catch{}},0)}catch{n.setAttribute("open","")}}function h(){try{typeof n.close=="function"?n.close():n.removeAttribute("open")}catch{n.removeAttribute("open")}d()}function d(){try{o&&document.contains(o)&&o.focus()}catch{}finally{o=null}}return{open:u,close:h,getMount(){return r}}}var bs=["bug","feature","task","epic","chore"];function Vt(s){switch((s||"").toString().toLowerCase()){case"bug":return"Bug";case"feature":return"Feature";case"task":return"Task";case"epic":return"Epic";case"chore":return"Chore";default:return""}}function _n(s,e,t,n,r=void 0,i=void 0){let a=de("views:list"),l=[],o="",f=[],u=[],h=n?n.getState().selected_id:null,d=null,m=!1,y=!1;function S(w){return Array.isArray(w)?w:typeof w=="string"&&w!==""&&w!=="all"?[w]:[]}function E(w){return Array.isArray(w)?w:typeof w=="string"&&w!==""?[w]:[]}let M=ms({navigate:w=>{let b=t||(O=>window.location.hash=O),v=n?n.getState().view:"issues";b(rt(v,w))},onUpdate:re,requestRender:W,getSelectedId:()=>h,row_class:"issue-row"}),F=async w=>{l.includes(w)?l=l.filter(b=>b!==w):l=[...l,w],a("status toggle %s -> %o",w,l),n&&n.setState({filters:{status:l}}),await le()},Z=w=>{o=w.currentTarget.value,a("search input %s",o),n&&n.setState({filters:{search:o}}),W()},N=w=>{u.includes(w)?u=u.filter(b=>b!==w):u=[...u,w],a("type toggle %s -> %o",w,u),n&&n.setState({filters:{type:u}}),W()},z=w=>{w.stopPropagation(),m=!m,y=!1,W()},H=w=>{w.stopPropagation(),y=!y,m=!1,W()};function ee(w,b,v){return w.length===0?`${b}: Any`:w.length===1?`${b}: ${v(w[0])}`:`${b} (${w.length})`}if(n){let w=n.getState();w&&w.filters&&typeof w.filters=="object"&&(l=S(w.filters.status),o=w.filters.search||"",u=E(w.filters.type))}let D=i?st(i):null;function X(){let w=f;if(l.length>0&&!l.includes("ready")&&(w=w.filter(b=>l.includes(String(b.status||"")))),o){let b=o.toLowerCase();w=w.filter(v=>{let O=String(v.id).toLowerCase(),L=String(v.title||"").toLowerCase();return O.includes(b)||L.includes(b)})}return u.length>0&&(w=w.filter(b=>u.includes(String(b.issue_type||"")))),l.length===1&&l[0]==="closed"&&(w=w.slice().sort(vt)),T`
|
|
779
|
+
<div class="panel__header" data-testid="list-view">
|
|
780
|
+
<div class="list-filters" data-testid="list-filters">
|
|
781
|
+
<div
|
|
782
|
+
class="filter-dropdown ${m?"is-open":""}"
|
|
783
|
+
data-testid="list-filter-status"
|
|
784
|
+
>
|
|
785
|
+
<button
|
|
786
|
+
class="filter-dropdown__trigger"
|
|
787
|
+
@click=${z}
|
|
788
|
+
data-testid="list-filter-status-trigger"
|
|
789
|
+
>
|
|
790
|
+
${ee(l,"Status",Je)}
|
|
791
|
+
<span class="filter-dropdown__arrow">▾</span>
|
|
792
|
+
</button>
|
|
793
|
+
<div class="filter-dropdown__menu" data-testid="list-filter-status-menu">
|
|
794
|
+
${["ready","open","in_progress","closed"].map(b=>T`
|
|
795
|
+
<label
|
|
796
|
+
class="filter-dropdown__option"
|
|
797
|
+
data-testid=${`list-filter-status-option-${b}`}
|
|
798
|
+
>
|
|
799
|
+
<input
|
|
800
|
+
type="checkbox"
|
|
801
|
+
.checked=${l.includes(b)}
|
|
802
|
+
@change=${()=>F(b)}
|
|
803
|
+
data-testid=${`list-filter-status-checkbox-${b}`}
|
|
804
|
+
/>
|
|
805
|
+
${b==="ready"?"Ready":Je(b)}
|
|
806
|
+
</label>
|
|
807
|
+
`)}
|
|
808
|
+
</div>
|
|
809
|
+
</div>
|
|
810
|
+
<div
|
|
811
|
+
class="filter-dropdown ${y?"is-open":""}"
|
|
812
|
+
data-testid="list-filter-type"
|
|
813
|
+
>
|
|
814
|
+
<button
|
|
815
|
+
class="filter-dropdown__trigger"
|
|
816
|
+
@click=${H}
|
|
817
|
+
data-testid="list-filter-type-trigger"
|
|
818
|
+
>
|
|
819
|
+
${ee(u,"Types",Vt)}
|
|
820
|
+
<span class="filter-dropdown__arrow">▾</span>
|
|
821
|
+
</button>
|
|
822
|
+
<div class="filter-dropdown__menu" data-testid="list-filter-type-menu">
|
|
823
|
+
${bs.map(b=>T`
|
|
824
|
+
<label
|
|
825
|
+
class="filter-dropdown__option"
|
|
826
|
+
data-testid=${`list-filter-type-option-${b}`}
|
|
827
|
+
>
|
|
828
|
+
<input
|
|
829
|
+
type="checkbox"
|
|
830
|
+
.checked=${u.includes(b)}
|
|
831
|
+
@change=${()=>N(b)}
|
|
832
|
+
data-testid=${`list-filter-type-checkbox-${b}`}
|
|
833
|
+
/>
|
|
834
|
+
${Vt(b)}
|
|
835
|
+
</label>
|
|
836
|
+
`)}
|
|
837
|
+
</div>
|
|
838
|
+
</div>
|
|
839
|
+
<input
|
|
840
|
+
type="search"
|
|
841
|
+
placeholder="Search…"
|
|
842
|
+
@input=${Z}
|
|
843
|
+
.value=${o}
|
|
844
|
+
data-testid="list-search-input"
|
|
845
|
+
/>
|
|
846
|
+
</div>
|
|
847
|
+
</div>
|
|
848
|
+
<div class="panel__body" id="list-root" data-testid="list-body">
|
|
849
|
+
${w.length===0?T`<div class="issues-block">
|
|
850
|
+
<div
|
|
851
|
+
class="muted"
|
|
852
|
+
style="padding:10px 12px;"
|
|
853
|
+
data-testid="list-empty"
|
|
854
|
+
>
|
|
855
|
+
No issues
|
|
856
|
+
</div>
|
|
857
|
+
</div>`:T`<div class="issues-block">
|
|
858
|
+
<table
|
|
859
|
+
class="table"
|
|
860
|
+
role="grid"
|
|
861
|
+
aria-rowcount=${String(w.length)}
|
|
862
|
+
aria-colcount="6"
|
|
863
|
+
data-testid="list-table"
|
|
864
|
+
>
|
|
865
|
+
<colgroup>
|
|
866
|
+
<col
|
|
867
|
+
style="width: clamp(100px, 18vw, 200px)"
|
|
868
|
+
data-testid="list-col-id"
|
|
869
|
+
/>
|
|
870
|
+
<col style="width: 120px" />
|
|
871
|
+
<col />
|
|
872
|
+
<col style="width: 120px" />
|
|
873
|
+
<col style="width: 160px" />
|
|
874
|
+
<col style="width: 130px" />
|
|
875
|
+
<col style="width: 80px" />
|
|
876
|
+
</colgroup>
|
|
877
|
+
<thead data-testid="list-header">
|
|
878
|
+
<tr role="row">
|
|
879
|
+
<th role="columnheader" data-testid="list-header-id">ID</th>
|
|
880
|
+
<th role="columnheader" data-testid="list-header-type">Type</th>
|
|
881
|
+
<th role="columnheader" data-testid="list-header-title">Title</th>
|
|
882
|
+
<th role="columnheader" data-testid="list-header-status">Status</th>
|
|
883
|
+
<th role="columnheader" data-testid="list-header-assignee">Assignee</th>
|
|
884
|
+
<th role="columnheader" data-testid="list-header-priority">Priority</th>
|
|
885
|
+
<th role="columnheader" data-testid="list-header-deps">Deps</th>
|
|
886
|
+
</tr>
|
|
887
|
+
</thead>
|
|
888
|
+
<tbody role="rowgroup" data-testid="list-rows">
|
|
889
|
+
${w.map(b=>M(b))}
|
|
890
|
+
</tbody>
|
|
891
|
+
</table>
|
|
892
|
+
</div>`}
|
|
893
|
+
</div>
|
|
894
|
+
`}function W(){Te(X(),s)}W();async function re(w,b){try{a("updateInline %s %o",w,Object.keys(b)),typeof b.title=="string"&&await e("edit-text",{id:w,field:"title",value:b.title}),typeof b.assignee=="string"&&await e("update-assignee",{id:w,assignee:b.assignee}),typeof b.status=="string"&&await e("update-status",{id:w,status:b.status}),typeof b.priority=="number"&&await e("update-priority",{id:w,priority:b.priority})}catch{}}async function le(){a("load");let w=s.querySelector("#list-root"),b=w?w.scrollTop:0;try{D?f=D.selectIssuesFor("tab:issues"):f=[]}catch(v){a("load failed: %o",v),f=[]}W();try{let v=s.querySelector("#list-root");v&&b>0&&(v.scrollTop=b)}catch{}}s.tabIndex=0,s.addEventListener("keydown",w=>{if(w.key==="ArrowDown"||w.key==="ArrowUp"){let L=w.target;if((L&&typeof L.closest=="function"?L.closest("#list-root table.table"):null)&&!!!(L&&typeof L.closest=="function"&&(L.closest("input")||L.closest("textarea")||L.closest("select")))){let B=L&&typeof L.closest=="function"?L.closest("td"):null;if(B&&B.parentElement){let k=B.parentElement,x=k.parentElement;if(x&&x.querySelectorAll){let $=Array.from(x.querySelectorAll("tr")),K=Math.max(0,$.indexOf(k)),fe=B.cellIndex||0,ue=w.key==="ArrowDown"?Math.min(K+1,$.length-1):Math.max(K-1,0),se=$[ue],V=se&&se.cells?se.cells[fe]:null;if(V){let pe=V.querySelector('button:not([disabled]), [tabindex]:not([tabindex="-1"]), a[href], select:not([disabled]), input:not([disabled]):not([type="hidden"]), textarea:not([disabled])');if(pe&&typeof pe.focus=="function"){w.preventDefault(),pe.focus();return}}}}}}let b=s.querySelector("#list-root tbody"),v=b?b.querySelectorAll("tr"):[];if(v.length===0)return;let O=0;if(h&&(O=Array.from(v).findIndex(q=>(q.getAttribute("data-issue-id")||"")===h),O<0&&(O=0)),w.key==="ArrowDown"){w.preventDefault();let L=v[Math.min(O+1,v.length-1)],q=L?L.getAttribute("data-issue-id"):"",G=q||null;n&&G&&n.setState({selected_id:G}),h=G,W()}else if(w.key==="ArrowUp"){w.preventDefault();let L=v[Math.max(O-1,0)],q=L?L.getAttribute("data-issue-id"):"",G=q||null;n&&G&&n.setState({selected_id:G}),h=G,W()}else if(w.key==="Enter"){w.preventDefault();let L=v[O],q=L?L.getAttribute("data-issue-id"):"";if(q){let G=t||(k=>window.location.hash=k),B=n?n.getState().view:"issues";G(rt(B,q))}}});let ye=w=>{let b=w.target;b&&!b.closest(".filter-dropdown")&&(m||y)&&(m=!1,y=!1,W())};return document.addEventListener("click",ye),n&&(d=n.subscribe(w=>{if(w.selected_id!==h&&(h=w.selected_id,a("selected %s",h||"(none)"),W()),w.filters&&typeof w.filters=="object"){let b=S(w.filters.status),v=w.filters.search||"",O=!1;if(JSON.stringify(b)!==JSON.stringify(l)){l=b,le();return}v!==o&&(o=v,O=!0);let q=E(w.filters.type);JSON.stringify(q)!==JSON.stringify(u)&&(u=q,O=!0),O&&W()}})),D&&D.subscribe(()=>{try{f=D.selectIssuesFor("tab:issues"),W()}catch{}}),{load:le,destroy(){s.replaceChildren(),document.removeEventListener("click",ye),d&&(d(),d=null)}}}function vn(s,e,t){let n=de("views:nav"),r=null;function i(o){return f=>{f.preventDefault(),n("click tab %s",o),t.gotoView(o)}}function a(){let f=e.getState().view||"issues";return T`
|
|
895
|
+
<nav
|
|
896
|
+
class="header-nav"
|
|
897
|
+
aria-label="Primary"
|
|
898
|
+
data-testid="top-nav"
|
|
899
|
+
>
|
|
900
|
+
<a
|
|
901
|
+
href="#/issues"
|
|
902
|
+
class="tab ${f==="issues"?"active":""}"
|
|
903
|
+
data-testid="nav-tab-issues"
|
|
904
|
+
@click=${i("issues")}
|
|
905
|
+
>Issues</a
|
|
906
|
+
>
|
|
907
|
+
<a
|
|
908
|
+
href="#/epics"
|
|
909
|
+
class="tab ${f==="epics"?"active":""}"
|
|
910
|
+
data-testid="nav-tab-epics"
|
|
911
|
+
@click=${i("epics")}
|
|
912
|
+
>Epics</a
|
|
913
|
+
>
|
|
914
|
+
<a
|
|
915
|
+
href="#/board"
|
|
916
|
+
class="tab ${f==="board"?"active":""}"
|
|
917
|
+
data-testid="nav-tab-board"
|
|
918
|
+
@click=${i("board")}
|
|
919
|
+
>Board</a
|
|
920
|
+
>
|
|
921
|
+
</nav>
|
|
922
|
+
`}function l(){Te(a(),s)}return l(),r=e.subscribe(()=>l()),{destroy(){r&&(r(),r=null),Te(T``,s)}}}function xn(s,e,t,n){let r=document.createElement("dialog");r.id="new-issue-dialog",r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("data-testid","new-issue-dialog"),r.innerHTML=`
|
|
923
|
+
<div class="new-issue__container" part="container" data-testid="new-issue-container">
|
|
924
|
+
<header class="new-issue__header" data-testid="new-issue-header">
|
|
925
|
+
<div class="new-issue__title" data-testid="new-issue-title">New Issue</div>
|
|
926
|
+
<button type="button" class="new-issue__close" aria-label="Close">\xD7</button>
|
|
927
|
+
</header>
|
|
928
|
+
<div class="new-issue__body" data-testid="new-issue-body">
|
|
929
|
+
<form id="new-issue-form" class="new-issue__form" data-testid="new-issue-form">
|
|
930
|
+
<label for="new-title">Title</label>
|
|
931
|
+
<input id="new-title" name="title" type="text" required placeholder="Short summary" data-testid="new-issue-title-input" />
|
|
932
|
+
|
|
933
|
+
<label for="new-type">Type</label>
|
|
934
|
+
<select id="new-type" name="type" aria-label="Issue type" data-testid="new-issue-type-select"></select>
|
|
935
|
+
|
|
936
|
+
<label for="new-priority">Priority</label>
|
|
937
|
+
<select id="new-priority" name="priority" aria-label="Priority" data-testid="new-issue-priority-select"></select>
|
|
938
|
+
|
|
939
|
+
<label for="new-labels">Labels</label>
|
|
940
|
+
<input id="new-labels" name="labels" type="text" placeholder="comma,separated" data-testid="new-issue-labels-input" />
|
|
941
|
+
|
|
942
|
+
<label for="new-description">Description</label>
|
|
943
|
+
<textarea id="new-description" name="description" rows="6" placeholder="Optional markdown description" data-testid="new-issue-description-input"></textarea>
|
|
944
|
+
|
|
945
|
+
<div aria-live="polite" role="status" class="new-issue__error" id="new-issue-error" data-testid="new-issue-error"></div>
|
|
946
|
+
|
|
947
|
+
<div class="new-issue__actions" style="grid-column: 1 / -1" data-testid="new-issue-actions">
|
|
948
|
+
<button type="button" id="btn-cancel" data-testid="new-issue-cancel">Cancel (Esc)</button>
|
|
949
|
+
<button type="submit" id="btn-create" data-testid="new-issue-create">Create</button>
|
|
950
|
+
</div>
|
|
951
|
+
</form>
|
|
952
|
+
</div>
|
|
953
|
+
</div>
|
|
954
|
+
`,s.appendChild(r);let i=r.querySelector("#new-issue-form"),a=r.querySelector("#new-title"),l=r.querySelector("#new-type"),o=r.querySelector("#new-priority"),f=r.querySelector("#new-labels"),u=r.querySelector("#new-description"),h=r.querySelector("#new-issue-error"),d=r.querySelector("#btn-cancel"),m=r.querySelector("#btn-create"),y=r.querySelector(".new-issue__close");y?.setAttribute("data-testid","new-issue-close");function S(){l.replaceChildren();let D=document.createElement("option");D.value="",D.textContent="\u2014 Select \u2014",l.appendChild(D);for(let X of bs){let W=document.createElement("option");W.value=X,W.textContent=Vt(X),l.appendChild(W)}o.replaceChildren();for(let X=0;X<=4;X+=1){let W=document.createElement("option");W.value=String(X);let re=it[X]||"Medium";W.textContent=`${X} \u2013 ${re}`,o.appendChild(W)}}S();function E(){try{typeof r.close=="function"?r.close():r.removeAttribute("open")}catch{r.removeAttribute("open")}}function M(D){a.disabled=D,l.disabled=D,o.disabled=D,f.disabled=D,u.disabled=D,d.disabled=D,m.disabled=D,m.textContent=D?"Creating\u2026":"Create"}function F(){h.textContent=""}function Z(D){h.textContent=D}function N(){try{let D=window.localStorage.getItem("beads-ui.new.type");D?l.value=D:l.value="";let X=window.localStorage.getItem("beads-ui.new.priority");X&&/^\d$/.test(X)?o.value=X:o.value="2"}catch{l.value="",o.value="2"}}function z(){let D=l.value||"",X=o.value||"";D.length>0&&window.localStorage.setItem("beads-ui.new.type",D),X.length>0&&window.localStorage.setItem("beads-ui.new.priority",X)}function H(D){let X=/-(\d+)$/.exec(String(D||""));return X&&X[1]?Number(X[1]):-1}async function ee(){F();let D=String(a.value||"").trim();if(D.length===0){Z("Title is required"),a.focus();return}let X=Number(o.value||"2");if(!(X>=0&&X<=4)){Z("Priority must be 0..4"),o.focus();return}let W=String(l.value||""),re=String(u.value||""),le=String(f.value||"").split(",").map(v=>v.trim()).filter(v=>v.length>0),ye={title:D};W.length>0&&(ye.type=W),String(X).length>0&&(ye.priority=X),re.length>0&&(ye.description=re),M(!0);try{await e("create-issue",ye)}catch{M(!1),Z("Failed to create issue");return}z();let w=null;try{w=await e("list-issues",{filters:{status:"open",limit:50}})}catch{w=null}let b="";if(Array.isArray(w)){let v=w.filter(O=>String(O.title||"")===D);if(v.length>0){let O=v[0];for(let L of v){let q=H(O.id||"");H(L.id||"")>q&&(O=L)}b=String(O.id||"")}}if(b&&le.length>0)for(let v of le)try{await e("label-add",{id:b,label:v})}catch{}if(b){try{t.gotoIssue(b)}catch{}try{n&&n.setState({selected_id:b})}catch{}}M(!1),E()}return r.addEventListener("cancel",D=>{D.preventDefault(),E()}),y.addEventListener("click",()=>E()),d.addEventListener("click",()=>E()),r.addEventListener("keydown",D=>{D.key==="Enter"&&(D.ctrlKey||D.metaKey)&&(D.preventDefault(),ee())}),i.addEventListener("submit",D=>{D.preventDefault(),ee()}),{open(){i.reset(),F(),N();try{"showModal"in r&&typeof r.showModal=="function"?r.showModal():r.setAttribute("open","")}catch{r.setAttribute("open","")}setTimeout(()=>{try{a.focus()}catch{}},0)},close(){E()}}}function Js(s){if(!s)return"Unknown";let e=s.split("/").filter(Boolean);return e.length>0?e[e.length-1]:"Unknown"}function $n(s,e,t){let n=de("views:workspace-picker"),r=null,i=!1;async function a(f){let h=f.target.value,m=e.getState().workspace?.current?.path||"";if(h&&h!==m){n("switching workspace to %s",h),i=!0,o();try{await t(h)}catch(y){n("workspace switch failed: %o",y)}finally{i=!1,o()}}}function l(){let f=e.getState(),u=f.workspace?.current,h=f.workspace?.available||[];if(h.length===0)return T``;if(h.length===1){let m=Js(h[0].path);return T`
|
|
955
|
+
<div
|
|
956
|
+
class="workspace-picker workspace-picker--single"
|
|
957
|
+
data-testid="workspace-picker"
|
|
958
|
+
>
|
|
959
|
+
<span
|
|
960
|
+
class="workspace-picker__label"
|
|
961
|
+
title="${h[0].path}"
|
|
962
|
+
data-testid="workspace-picker-label"
|
|
963
|
+
>${m}</span>
|
|
964
|
+
</div>
|
|
965
|
+
`}let d=u?.path||"";return T`
|
|
966
|
+
<div class="workspace-picker" data-testid="workspace-picker">
|
|
967
|
+
<select
|
|
968
|
+
class="workspace-picker__select"
|
|
969
|
+
@change=${a}
|
|
970
|
+
?disabled=${i}
|
|
971
|
+
aria-label="Select project workspace"
|
|
972
|
+
data-testid="workspace-picker-select"
|
|
973
|
+
>
|
|
974
|
+
${h.map(m=>T`
|
|
975
|
+
<option
|
|
976
|
+
value="${m.path}"
|
|
977
|
+
?selected=${m.path===d}
|
|
978
|
+
title="${m.path}"
|
|
979
|
+
data-testid=${`workspace-picker-option-${Js(m.path)}`}
|
|
980
|
+
>
|
|
981
|
+
${Js(m.path)}
|
|
982
|
+
</option>
|
|
983
|
+
`)}
|
|
984
|
+
</select>
|
|
985
|
+
${i?T`<span
|
|
986
|
+
class="workspace-picker__loading"
|
|
987
|
+
aria-hidden="true"
|
|
988
|
+
data-testid="workspace-picker-loading"
|
|
989
|
+
></span>`:""}
|
|
990
|
+
</div>
|
|
991
|
+
`}function o(){Te(l(),s)}return o(),r=e.subscribe(()=>o()),{destroy(){r&&(r(),r=null),Te(T``,s)}}}var An=["list-issues","update-status","edit-text","update-priority","create-issue","list-ready","dep-add","dep-remove","epic-status","update-assignee","label-add","label-remove","subscribe-list","unsubscribe-list","snapshot","upsert","delete","get-comments","add-comment","delete-issue","list-workspaces","set-workspace","get-workspace","workspace-changed"];function er(){let s=Date.now().toString(36),e=Math.random().toString(36).slice(2,8);return`${s}-${e}`}function Sn(s,e,t=er()){return{id:t,type:s,payload:e}}function Tn(s={}){let e=de("ws"),t={initialMs:s.backoff?.initialMs??1e3,maxMs:s.backoff?.maxMs??3e4,factor:s.backoff?.factor??2,jitterRatio:s.backoff?.jitterRatio??.2},n=()=>s.url&&s.url.length>0?s.url:typeof location<"u"?(location.protocol==="https:"?"wss://":"ws://")+location.host+"/ws":"ws://localhost/ws",r=null,i="closed",a=0,l=null,o=!0,f=new Map,u=[],h=new Map,d=new Set;function m(z){for(let H of Array.from(d))try{H(z)}catch{}}function y(){if(!o||l)return;i="reconnecting",e("ws reconnecting\u2026"),m(i);let z=Math.min(t.maxMs||0,(t.initialMs||0)*Math.pow(t.factor||1,a)),H=(t.jitterRatio||0)*z,ee=Math.max(0,Math.round(z+(Math.random()*2-1)*H));e("ws retry in %d ms (attempt %d)",ee,a+1),l=setTimeout(()=>{l=null,N()},ee)}function S(z,H){let ee=f.get(z);ee&&(f.delete(z),ee.reject(H))}function E(z){try{return r?.send(JSON.stringify(z)),!0}catch(H){return e("ws send failed",H),S(z.id,new Error("ws send failed")),!1}}function M(){for(i="open",e("ws open"),m(i),a=0;u.length;){let z=u.shift();z&&E(z)}}function F(z){let H;try{H=JSON.parse(String(z.data))}catch{e("ws received non-JSON message");return}if(!H||typeof H.id!="string"||typeof H.type!="string"){e("ws received invalid envelope");return}if(f.has(H.id)){let D=f.get(H.id);f.delete(H.id),H.ok?D?.resolve(H.payload):D?.reject(H.error||new Error("ws error"));return}let ee=h.get(H.type);if(ee&&ee.size>0)for(let D of Array.from(ee))try{D(H.payload)}catch(X){e("ws event handler error",X)}else e("ws received unhandled message type: %s",H.type)}function Z(){i="closed",e("ws closed"),m(i);for(let[z,H]of f.entries())H.reject(new Error("ws disconnected")),f.delete(z);a+=1,y()}function N(){if(!o)return;let z=n();try{r=new WebSocket(z),e("ws connecting %s",z),i="connecting",m(i),r.addEventListener("open",M),r.addEventListener("message",F),r.addEventListener("error",()=>{}),r.addEventListener("close",Z)}catch(H){e("ws connect failed %o",H),y()}}return N(),{send(z,H){if(!An.includes(z))return Promise.reject(new Error(`unknown message type: ${z}`));let ee=er(),D=Sn(z,H,ee);return e("send %s id=%s",z,ee),new Promise((X,W)=>{f.set(ee,{resolve:X,reject:W,type:z}),r&&r.readyState===r.OPEN?E(D):(e("queue %s id=%s (state=%s)",z,ee,i),u.push(D))})},on(z,H){h.has(z)||h.set(z,new Set);let ee=h.get(z);return ee?.add(H),()=>{ee?.delete(H)}},onConnection(z){return d.add(z),()=>{d.delete(z)}},close(){o=!1,l&&(clearTimeout(l),l=null);try{r?.close()}catch{}},getState(){return i}}}function la(s){let e=de("main");e("bootstrap start");let t=T`
|
|
992
|
+
<section id="issues-root" class="route issues">
|
|
993
|
+
<aside id="list-panel" class="panel"></aside>
|
|
994
|
+
</section>
|
|
995
|
+
<section id="epics-root" class="route epics" hidden></section>
|
|
996
|
+
<section id="board-root" class="route board" hidden></section>
|
|
997
|
+
<section id="detail-panel" class="route detail" hidden></section>
|
|
998
|
+
`;Te(t,s);let n=document.getElementById("top-nav"),r=document.getElementById("issues-root"),i=document.getElementById("epics-root"),a=document.getElementById("board-root"),l=document.getElementById("list-panel"),o=document.getElementById("detail-panel");if(l&&r&&i&&a&&o){let E=function(_,g){let j="Request failed",Q="";if(_&&typeof _=="object"){let R=_;if(typeof R.message=="string"&&R.message.length>0&&(j=R.message),typeof R.details=="string")Q=R.details;else if(R.details&&typeof R.details=="object")try{Q=JSON.stringify(R.details,null,2)}catch{Q=""}}else typeof _=="string"&&_.length>0&&(j=_);let ae=g&&g.length>0?`Failed to load ${g}`:"Request failed";S.open(ae,j,Q)},D=function(_){if(!_)return"Unknown";let g=_.split("/").filter(Boolean);return g.length>0?g[g.length-1]:"Unknown"},Oe=function(_){let g=String(_?.status||"all");return g==="ready"?{type:"ready-issues"}:g==="in_progress"?{type:"in-progress-issues"}:g==="closed"?{type:"closed-issues"}:{type:"all-issues"}},Ke=function(_){if(_.view==="issues"){let g=Oe(_.filters||{}),j=JSON.stringify(g);try{N.register("tab:issues",g)}catch(ae){e("register issues store failed: %o",ae)}let Q=`tab:issues:${j}`;(!se||j!==je)&&!he.has(Q)&&(he.add(Q),Z.subscribeList("tab:issues",g).then(ae=>{se=ae,je=j}).catch(ae=>{e("subscribe issues failed: %o",ae),E(ae,"issues list")}).finally(()=>{he.delete(Q)}))}else if(se){se().catch(()=>{}),se=null,je=null;try{N.unregister("tab:issues")}catch(g){e("unregister issues store failed: %o",g)}}if(_.view==="epics"){try{N.register("tab:epics",{type:"epics"})}catch(g){e("register epics store failed: %o",g)}!V&&!he.has("tab:epics")&&(he.add("tab:epics"),Z.subscribeList("tab:epics",{type:"epics"}).then(g=>{V=g}).catch(g=>{e("subscribe epics failed: %o",g),E(g,"epics")}).finally(()=>{he.delete("tab:epics")}))}else if(V){V().catch(()=>{}),V=null;try{N.unregister("tab:epics")}catch(g){e("unregister epics store failed: %o",g)}}if(_.view==="board"){if(!pe&&!he.has("tab:board:ready")){try{N.register("tab:board:ready",{type:"ready-issues"})}catch(g){e("register board:ready store failed: %o",g)}he.add("tab:board:ready"),Z.subscribeList("tab:board:ready",{type:"ready-issues"}).then(g=>pe=g).catch(g=>{e("subscribe board ready failed: %o",g),E(g,"board (Ready)")}).finally(()=>{he.delete("tab:board:ready")})}if(!we&&!he.has("tab:board:in-progress")){try{N.register("tab:board:in-progress",{type:"in-progress-issues"})}catch(g){e("register board:in-progress store failed: %o",g)}he.add("tab:board:in-progress"),Z.subscribeList("tab:board:in-progress",{type:"in-progress-issues"}).then(g=>we=g).catch(g=>{e("subscribe board in-progress failed: %o",g),E(g,"board (In Progress)")}).finally(()=>{he.delete("tab:board:in-progress")})}if(!Me&&!he.has("tab:board:closed")){try{N.register("tab:board:closed",{type:"closed-issues"})}catch(g){e("register board:closed store failed: %o",g)}he.add("tab:board:closed"),Z.subscribeList("tab:board:closed",{type:"closed-issues"}).then(g=>Me=g).catch(g=>{e("subscribe board closed failed: %o",g),E(g,"board (Closed)")}).finally(()=>{he.delete("tab:board:closed")})}if(!$e&&!he.has("tab:board:blocked")){try{N.register("tab:board:blocked",{type:"blocked-issues"})}catch(g){e("register board:blocked store failed: %o",g)}he.add("tab:board:blocked"),Z.subscribeList("tab:board:blocked",{type:"blocked-issues"}).then(g=>$e=g).catch(g=>{e("subscribe board blocked failed: %o",g),E(g,"board (Blocked)")}).finally(()=>{he.delete("tab:board:blocked")})}}else{if(pe){pe().catch(()=>{}),pe=null;try{N.unregister("tab:board:ready")}catch(g){e("unregister board:ready failed: %o",g)}}if(we){we().catch(()=>{}),we=null;try{N.unregister("tab:board:in-progress")}catch(g){e("unregister board:in-progress failed: %o",g)}}if(Me){Me().catch(()=>{}),Me=null;try{N.unregister("tab:board:closed")}catch(g){e("unregister board:closed failed: %o",g)}}if($e){$e().catch(()=>{}),$e=null;try{N.unregister("tab:board:blocked")}catch(g){e("unregister board:blocked failed: %o",g)}}}};var f=E,u=D,h=Oe,d=Ke;let m=document.getElementById("header-loading"),y=Dr(m),S=wn(s),M=Tn(),F=y.wrapSend((_,g)=>M.send(_,g)),Z=Cr(F),N=Rr();M.on("snapshot",_=>{let g=_,j=g&&typeof g.id=="string"?g.id:"",Q=j?N.getStore(j):null;if(Q&&g&&g.type==="snapshot")try{Q.applyPush(g)}catch{}}),M.on("upsert",_=>{let g=_,j=g&&typeof g.id=="string"?g.id:"",Q=j?N.getStore(j):null;if(Q&&g&&g.type==="upsert")try{Q.applyPush(g)}catch{}}),M.on("delete",_=>{let g=_,j=g&&typeof g.id=="string"?g.id:"",Q=j?N.getStore(j):null;if(Q&&g&&g.type==="delete")try{Q.applyPush(g)}catch{}});let z=st(N);async function H(){e("clearing all subscriptions for workspace switch"),se&&(se().catch(()=>{}),se=null),V&&(V().catch(()=>{}),V=null),pe&&(pe().catch(()=>{}),pe=null),we&&(we().catch(()=>{}),we=null),Me&&(Me().catch(()=>{}),Me=null),$e&&($e().catch(()=>{}),$e=null);let _=["tab:issues","tab:epics","tab:board:ready","tab:board:in-progress","tab:board:closed","tab:board:blocked"];for(let j of _)try{N.unregister(j)}catch{}let g=w.getState();if(g.selected_id)try{N.unregister(`detail:${g.selected_id}`)}catch{}je=null,Ke(w.getState())}async function ee(_){e("requesting workspace switch to %s",_);try{let g=await M.send("set-workspace",{path:_});e("workspace switch result: %o",g),g&&g.workspace&&(w.setState({workspace:{current:{path:g.workspace.root_dir,database:g.workspace.db_path}}}),window.localStorage.setItem("beads-ui.workspace",_),g.changed&&(await H(),ge("Switched to "+D(_),"success",2e3)))}catch(g){throw e("workspace switch failed: %o",g),ge("Failed to switch workspace","error",3e3),g}}async function X(){try{let _=await M.send("list-workspaces",{});if(e("workspaces loaded: %o",_),_&&Array.isArray(_.workspaces)){let g=_.workspaces.map(ae=>({path:ae.path,database:ae.database,pid:ae.pid,version:ae.version})),j=_.current?{path:_.current.root_dir,database:_.current.db_path}:null;w.setState({workspace:{current:j,available:g}});let Q=window.localStorage.getItem("beads-ui.workspace");Q&&j&&Q!==j.path&&g.some(R=>R.path===Q)&&(e("restoring saved workspace preference: %s",Q),await ee(Q))}}catch(_){e("failed to load workspaces: %o",_)}}M.on("workspace-changed",_=>{e("workspace-changed event: %o",_),_&&_.root_dir&&(w.setState({workspace:{current:{path:_.root_dir,database:_.db_path}}}),X(),H())});let W=!1;if(typeof M.onConnection=="function"){let _=g=>{e("ws state %s",g),g==="reconnecting"||g==="closed"?(W=!0,ge("Connection lost. Reconnecting\u2026","error",4e3)):g==="open"&&W&&(W=!1,ge("Reconnected","success",2200))};M.onConnection(_)}let re={status:"all",search:"",type:""};try{let _=window.localStorage.getItem("beads-ui.filters");if(_){let g=JSON.parse(_);if(g&&typeof g=="object"){let j=["bug","feature","task","epic","chore"],Q="";if(typeof g.type=="string"&&j.includes(g.type))Q=g.type;else if(Array.isArray(g.types)){let ae="";for(let R of g.types)if(j.includes(String(R))){ae=R;break}Q=ae}re={status:["all","open","in_progress","closed","ready"].includes(g.status)?g.status:"all",search:typeof g.search=="string"?g.search:"",type:Q}}}}catch(_){e("filters parse error: %o",_)}let le="issues";try{let _=window.localStorage.getItem("beads-ui.view");(_==="issues"||_==="epics"||_==="board")&&(le=_)}catch(_){e("view parse error: %o",_)}let ye={closed_filter:"today"};try{let _=window.localStorage.getItem("beads-ui.board");if(_){let g=JSON.parse(_);if(g&&typeof g=="object"){let j=String(g.closed_filter||"today");(j==="today"||j==="3"||j==="7")&&(ye.closed_filter=j)}}}catch(_){e("board prefs parse error: %o",_)}let w=Lr({filters:re,view:le,board:ye}),b=Ir(w);b.start();let v=async(_,g)=>{try{return await F(_,g)}catch{return[]}};n&&vn(n,w,b);let O=document.getElementById("workspace-picker");O&&$n(O,w,ee),X();let L=xn(s,(_,g)=>F(_,g),b,w);try{let _=document.getElementById("new-issue-btn");_&&_.addEventListener("click",()=>L.open())}catch{}let G=_n(l,async(_,g)=>{if(_==="list-issues")try{return z.selectIssuesFor("tab:issues")}catch(j){return e("list selectors failed: %o",j),[]}return v(_,g)},_=>{let g=rs(_);g&&b.gotoIssue(g)},w,Z,N);w.subscribe(_=>{let g={status:_.filters.status,search:_.filters.search,type:typeof _.filters.type=="string"?_.filters.type:""};window.localStorage.setItem("beads-ui.filters",JSON.stringify(g))}),w.subscribe(_=>{window.localStorage.setItem("beads-ui.board",JSON.stringify({closed_filter:_.board.closed_filter}))}),G.load();let B=kn(o,w,()=>{let _=w.getState();w.setState({selected_id:null});try{let g=_.view||"issues";b.gotoView(g)}catch{}}),k=null;k=bn(B.getMount(),v,_=>{let g=rs(_);if(g)b.gotoIssue(g);else{let j=St(_);b.gotoView(j)}},N);let x=w.getState().selected_id;if(x){o.hidden=!1,B.open(x),k&&k.load(x);let _=`detail:${x}`,g={type:"issue-detail",params:{id:x}};try{N.register(_,g)}catch(j){e("register detail store failed: %o",j)}Z.subscribeList(_,g).catch(j=>{e("detail subscribe failed: %o",j),E(j,"issue details")})}let $=null;w.subscribe(_=>{let g=_.selected_id;if(g){o.hidden=!1,B.open(g),k&&k.load(g);let j=`detail:${g}`,Q={type:"issue-detail",params:{id:g}};try{N.register(j,Q)}catch{}Z.subscribeList(j,Q).then(ae=>{$&&$().catch(()=>{}),$=ae}).catch(ae=>{e("detail subscribe failed: %o",ae),E(ae,"issue details")})}else{try{B.close()}catch{}k&&k.clear(),o.hidden=!0,$&&($().catch(()=>{}),$=null)}});let K=Er(v),fe=yn(i,K,_=>b.gotoIssue(_),Z,N),ue=Or(a,K,_=>b.gotoIssue(_),w,Z,N,v),se=null,V=null,pe=null,we=null,Me=null,$e=null,he=new Set;window.__bdui_debug={getPendingSubscriptions:()=>Array.from(he),getActivityCount:()=>y.getCount(),getActiveRequests:()=>y.getActiveRequests()};let je=null,Be=_=>{r&&i&&a&&o&&(r.hidden=_.view!=="issues",i.hidden=_.view!=="epics",a.hidden=_.view!=="board"),Ke(_),!_.selected_id&&_.view==="epics"&&fe.load(),!_.selected_id&&_.view==="board"&&ue.load(),window.localStorage.setItem("beads-ui.view",_.view)};w.subscribe(Be),Be(w.getState()),window.addEventListener("keydown",_=>{let g=_.ctrlKey||_.metaKey,j=String(_.key||"").toLowerCase(),Q=_.target,ae=Q&&Q.tagName?String(Q.tagName).toLowerCase():"",R=ae==="input"||ae==="textarea"||ae==="select"||Q&&typeof Q.isContentEditable=="boolean"&&Q.isContentEditable;g&&j==="n"&&(R||(_.preventDefault(),L.open()))})}}typeof window<"u"&&typeof document<"u"&&window.addEventListener("DOMContentLoaded",()=>{try{let t=window.localStorage.getItem("beads-ui.theme"),n=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,r=t==="dark"||t==="light"?t:n?"dark":"light";document.documentElement.setAttribute("data-theme",r);let i=document.getElementById("theme-switch");i&&(i.checked=r==="dark")}catch{}let s=document.getElementById("theme-switch");s&&s.addEventListener("change",()=>{let t=s.checked?"dark":"light";document.documentElement.setAttribute("data-theme",t),window.localStorage.setItem("beads-ui.theme",t)});let e=document.getElementById("app");e&&la(e)});export{la as bootstrap};
|
|
999
|
+
//# sourceMappingURL=main.bundle.js.map
|