dev-process-kit 0.0.13 → 0.0.14
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/dist/chunks/{shared-DklLt1Sc.js → shared-BESRsbtm.js} +1 -1
- package/dist/chunks/{shared-0MFKKPnB.js → shared-BFTEmZvI.js} +11 -11
- package/dist/chunks/{shared-C1KQ5iU8.js → shared-C2gu-y4m.js} +15 -10
- package/dist/chunks/{shared-DrMSORn-.js → shared-CE1P_7xs.js} +176 -168
- package/dist/chunks/shared-CGPv8MQ7.js +1049 -0
- package/dist/chunks/shared-CTK76mc_.js +2457 -0
- package/dist/chunks/{shared-CQG0dnvb.js → shared-CmBhMY6X.js} +5 -4
- package/dist/chunks/shared-DD-fi15c.js +1104 -0
- package/dist/chunks/shared-DUEkF1z7.js +572 -0
- package/dist/chunks/{shared-CirHYajF.js → shared-Dc_FGuLM.js} +1 -1
- package/dist/chunks/{shared-DjmQsa0n.js → shared-DjOBIYHF.js} +1 -1
- package/dist/chunks/{shared-D7poXZ0z.js → shared-NnvpqsPp.js} +6 -5
- package/dist/chunks/shared-rZQ5j0Kh.js +2683 -0
- package/dist/chunks/{shared-B2YRwZ0P.js → shared-wtt8CCP_.js} +139 -128
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/delegation-poker.js +1 -1
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/grill.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -1
- package/dist/templates/task-board.js +1 -1
- package/dist/templates/usm.js +1 -1
- package/dist/templates/whiteboard.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-B4Mwapvi.js +0 -1043
- package/dist/chunks/shared-BDUe3aT-.js +0 -1
- package/dist/chunks/shared-CSC14I4g.js +0 -2370
- package/dist/chunks/shared-Cd8A5TjZ.js +0 -2428
- package/dist/chunks/shared-DO0pUSjw.js +0 -571
- package/dist/chunks/shared-DxAiavwJ.js +0 -1102
- package/dist/chunks/shared-aDPp8Vry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a0 as w,
|
|
1
|
+
import{a0 as w,ad as v,ae as s,af as o,ag as _,ah as l,aA as j,aj as B,ak as E,V as $,T as k}from"./shared-rZQ5j0Kh.js";const r=w({en:{wholePage:"Whole page",sectionGroup:"Section"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",sectionGroup:"\u30BB\u30AF\u30B7\u30E7\u30F3"}}),x=s({id:j,title:B(l(),E(1))}),c=s({title:o(l(),""),sections:o(_(x),[])}),p=t=>{const e=v(c,t),a=new Set;for(const n of e.sections){if(a.has(n.id))throw new Error(`duplicate section id: ${n.id}`);a.add(n.id)}return{title:e.title,sections:e.sections}},d=()=>({title:"",sections:[]}),i=(t,e)=>t.sections.find(a=>a.id===e),m=t=>t.title===""?"Plain":t.title,u=(t,e,a)=>{switch(a.type){case"section":return i(e,a.id)?.title??a.id;case"page":return t.wholePage;default:return a.id}},g=(t,e,a)=>({title:e.type,targetLabel:u(t,a,e.target),tone:"meta"}),f=t=>`${t.type} ${$(t.target)} ${JSON.stringify(t.payload)}`,h=(t,e)=>e.sections.map(a=>({value:`section:${a.id}`,label:a.title,group:t.sectionGroup})),y=(t,e)=>e,P=(t,e)=>{switch(e.type){case"section":return i(t,e.id)!==void 0;case"page":return!0;default:return!1}},b=t=>{const e=r(t);return{name:"plain",label:"Plain",parseBase:p,emptyBase:d,actions:{},apply:()=>null,hasTarget:P,describe:(a,n)=>g(e,a,n),serialize:f,resolveNavigation:y,commentTargets:a=>h(e,a),title:m}};class T extends k{definitionFor(e){return b(e)}renderRegions(e){return{}}}const S=()=>{customElements.get("dpk-template-plain")||customElements.define("dpk-template-plain",T)},O=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePlain:T,definePlainElement:S,describePlainAction:g,emptyPlainBase:d,findSection:i,parsePlainBase:p,plainBaseSchema:c,plainCommentTargets:h,plainDefinitionFor:b,plainHasTarget:P,plainMessages:r,plainTargetLabel:u,plainTitle:m,resolvePlainNavigation:y,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{S as d,O as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs,J as Ds,a7 as I,a8 as Ye,a9 as Ve,A as We,aa as Ts,ab as As,ac as G,ad as q,ae as f,af as z,ag as u,ah as H,ai as S,aj as M,ak as ae,al as Ke,am as Xe,an as Z,ao as we,ap as Je,aq as Ls,ar as Rs,as as $e,at as Se,au as Os,av as Me,l as Ze,aw as Is,ax as Ps,ay as js,az as ne,q as Fs,r as Ns}from"./shared-CSC14I4g.js";import{i as Qe}from"./shared-DjmQsa0n.js";import{P as et}from"./shared-aDPp8Vry.js";import{p as tt,r as st,c as at}from"./shared-CirHYajF.js";import{c as me}from"./shared-ml5h7U5L.js";const Us='script[type="application/json"]',nt=(a,e)=>{const t=a.querySelector(Us);if(!t)return null;const s=t.textContent??"";if(s.trim()==="")return{ok:!1,error:"JSON block is empty"};try{return{ok:!0,value:e(JSON.parse(s))}}catch(n){return{ok:!1,error:n instanceof Error?n.message:String(n)}}},rt=(a,e,t)=>{const s=nt(a,e);if(s)return t(s),()=>{};const n=new MutationObserver(()=>{const r=nt(a,e);r&&(n.disconnect(),t(r))});return n.observe(a,{childList:!0,subtree:!0}),()=>n.disconnect()},it={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6},ge=a=>{const e=[...a].sort((s,n)=>s-n);if(e.length===0)return 0;const t=Math.floor(e.length/2);return e.length%2===1?e[t]??0:((e[t-1]??0)+(e[t]??0))/2},Hs=(a,e)=>{const t=new Map;for(const i of a)t.set(i.id,[]);for(const i of e)t.get(i.from)?.push(i);const s=new Map,n=new Set,r=i=>{s.set(i,"open");for(const o of t.get(i)??[]){const d=s.get(o.to)??"new";d==="open"?n.add(o.id):d==="new"&&r(o.to)}s.set(i,"done")};for(const i of a)(s.get(i.id)??"new")==="new"&&r(i.id);return{reversed:n,forward:e.filter(i=>!n.has(i.id))}},_s=(a,e)=>{const t=new Map,s=new Map;for(const o of a)t.set(o.id,[]),s.set(o.id,[]);for(const o of e)s.get(o.from)?.push(o),t.get(o.to)?.push(o);const n=new Map(a.map(o=>[o.id,0])),r=new Map(a.map(o=>[o.id,(t.get(o.id)??[]).length])),i=a.filter(o=>(r.get(o.id)??0)===0).map(o=>o.id);for(const o of i)for(const d of s.get(o)??[]){const l=n.get(d.to)??0;n.set(d.to,Math.max(l,(n.get(o)??0)+1));const c=(r.get(d.to)??0)-1;r.set(d.to,c),c===0&&i.push(d.to)}return n},Bs=(a,e,t,s)=>{const n=[...a.keys()].sort((r,i)=>r-i);for(let r=0;r<s;r++){const i=r%2===0;for(const o of i?n:[...n].reverse()){const d=a.get(o)??[],l=new Map(d.map((p,k)=>[p,k])),c=p=>{const k=l.get(p);return k===void 0?null:k},g=d.map(p=>{const k=(e.get(p)??[]).filter(x=>(t.get(x)??o)===o+(i?-1:1)).map(c).filter(x=>x!==null);return{id:p,want:k.length>0?ge(k):l.get(p)??0}});g.sort((p,k)=>p.want-k.want||(l.get(p.id)??0)-(l.get(k.id)??0)),a.set(o,g.map(p=>p.id))}}},ot=(a,e,t,s)=>{const n=a.map((i,o)=>({id:i,want:t.get(i)??o*100,index:o}));n.sort((i,o)=>i.want-o.want||i.index-o.index);let r=0;for(const i of n){const o=e.get(i.id);o&&(o.y=r,r+=o.spec.height+s)}return{height:Math.max(0,r-s)}},Gs=(a,e,t,s,n)=>{const r=[...a.keys()].sort((l,c)=>l-c),i=new Map;for(const l of r)i.set(l,ot(a.get(l)??[],e,new Map,n.nodeSpacing).height);const o=Math.max(0,...i.values());for(const l of r){const c=(o-(i.get(l)??0))/2;for(const g of a.get(l)??[]){const p=e.get(g);p&&(p.y+=c)}}const d=(l,c)=>{const g=(t.get(l)??[]).filter(p=>s.get(p)===c).flatMap(p=>{const k=e.get(p);return k?[k.y+k.spec.height/2]:[]});return g.length>0?ge(g):null};for(let l=0;l<n.coordinatePasses;l++){const c=l%2===0;for(const g of c?r:[...r].reverse()){const p=a.get(g)??[],k=new Map;for(const w of p){const D=d(w,g+(c?-1:1)),L=e.get(w);L!==void 0&&k.set(w,D===null?L.y+L.spec.height/2:D)}const x=p.map(w=>e.get(w)?.y??0);ot(p,e,k,n.nodeSpacing);const v=p.map(w=>e.get(w)?.y??0),y=ge(x)-ge(v);for(const w of p){const D=e.get(w);D&&(D.y+=y)}}}},dt=(a,e,t)=>{const s=e===void 0?void 0:a.spec.ports?.[e];return s?{x:a.x+s.x,y:a.y+s.y}:t==="out"?{x:a.x+a.spec.width,y:a.y+a.spec.height/2}:{x:a.x,y:a.y+a.spec.height/2}},lt=(a,e,t)=>{let s=0;const n=[];for(const r of a){const i=t.byId.get(r.from),o=t.byId.get(r.to);if(!i||!o)continue;const d=dt(i,r.fromPort,"out"),l=dt(o,r.toPort,"in");if(r.from===r.to){const x=i.x+i.spec.width,v=i.y+i.spec.height,y=Math.max(t.padding/2,v+18);n.push({id:r.id,points:[d,{x:x+20,y:d.y},{x:x+20,y},{x:i.x-20,y},{x:i.x-20,y:l.y},l]});continue}if(!e.has(r.id)&&(i.layer<o.layer||i.layer===o.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){n.push({id:r.id,points:[d,l]});continue}const v=i.layer<o.layer?Math.max(d.x+14,o.x-Math.max(12,t.layerSpacing/2)):(d.x+l.x)/2;n.push({id:r.id,points:[d,{x:v,y:d.y},{x:v,y:l.y},l]});continue}const c=r.fromPort===void 0?{x:i.x+i.spec.width/2,y:i.y+i.spec.height}:d,g=r.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,p=Math.max(c.y,g.y)+18+s*14;s+=1;const k=[d,c,{x:c.x,y:p},{x:g.x,y:p},g,l].filter((x,v,y)=>v===0||x.x!==y[v-1]?.x||x.y!==y[v-1]?.y);n.push({id:r.id,points:k})}return n},ct=(a,e,t)=>{const s=e.flatMap(p=>[...p.points]),n=[...a.map(p=>p.x),...a.map(p=>p.x+p.spec.width),...s.map(p=>p.x)],r=[...a.map(p=>p.y),...a.map(p=>p.y+p.spec.height),...s.map(p=>p.y)],i=Math.min(0,...n),o=Math.min(0,...r),d=Math.max(0,...n),l=Math.max(0,...r),c=t-i,g=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:a.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+g,width:p.spec.width,height:p.spec.height,layer:p.layer,order:p.order})),routes:e.map(p=>({id:p.id,points:p.points.map(k=>({x:k.x+c,y:k.y+g}))}))}},pt=(a,e)=>{const t=new Map(a.map(s=>[s.id,[]]));for(const s of e)s.from!==s.to&&(t.get(s.from)?.push(s.to),t.get(s.to)?.push(s.from));return t},ht=(a,e,t,s)=>a.map(n=>({spec:n,layer:e.get(n.id)??0,order:t.get(n.id)??0,...s(n)})),Ys=(a,e)=>{const t=new Map;for(const s of a){const n=e.get(s.id)??0,r=t.get(n);r?r.push(s.id):t.set(n,[s.id])}return t},Vs=(a,e,t={})=>{const s={...it,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(v=>v.id)),r=e.filter(v=>n.has(v.from)&&n.has(v.to)),{forward:i,reversed:o}=Hs(a,r),d=_s(a,i),l=Ys(a,d);Bs(l,pt(a,r),d,s.sweeps);const c=new Map;for(const v of l.values())v.forEach((y,w)=>c.set(y,w));const g=ht(a,d,c,()=>({x:0,y:0})),p=new Map(g.map(v=>[v.spec.id,v]));Gs(l,p,pt(a,r),d,s);const k=[...l.keys()].sort((v,y)=>v-y);let x=0;for(const v of k){const y=Math.max(...(l.get(v)??[]).map(w=>p.get(w)?.spec.width??0));for(const w of l.get(v)??[]){const D=p.get(w);D&&(D.x=x)}x+=y+s.layerSpacing}return ct(g,lt(r,o,{byId:p,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ws=(a,e,t={})=>{const s={...it,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(d=>d.id)),r=e.filter(d=>n.has(d.from)&&n.has(d.to)),i=ht(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return ct(i,lt(r,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ks=_({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:a=>`Comment on ${a}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the diagram data.",nodes:"elements",edges:"relations",change:(a,e)=>`\u201C${a}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u56F3\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(a,e)=>`\u300C${a}\u300D\u2192\u300C${e}\u300D`}}),Xs={active:[],match:"single"},Q=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),Js=(a,e)=>a.active.includes(e)?{...a,active:a.active.filter(t=>t!==e)}:a.match==="single"?{...a,active:[e]}:{...a,active:[...a.active,e]},Zs=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Qs=a=>({...a,active:[]}),ea=a=>{const e=new Map;for(const t of a)for(const s of new Set(t))e.set(s,(e.get(s)??0)+1);return[...e].map(([t,s])=>({tag:t,count:s}))},Y={nodes:new Map,edges:new Set},N=(a,e,t,s)=>{const n=new Map,r=new Set,i=[{id:e,depth:0}],o=new Set([e]);for(const d of i)if(!(!s&&d.depth>=1))for(const l of a){const c=t==="outgoing"?l.from:l.to,g=t==="outgoing"?l.to:l.from;c===d.id&&(r.add(l.id),!o.has(g)&&(o.add(g),n.set(g,d.depth+1),i.push({id:g,depth:d.depth+1})))}return{nodes:n,edges:r}},ta=(a,e)=>{const t=new Map(a.map(r=>[r,N(e,r,"outgoing",!0).nodes])),s=new Set,n=[];for(const r of a){if(s.has(r))continue;const i=a.filter(o=>o===r||t.get(r)?.has(o)===!0&&t.get(o)?.has(r)===!0);for(const o of i)s.add(o);(i.length>1||e.some(o=>o.from===r&&o.to===r))&&n.push(i)}return n},Ce=a=>new Map(a.flatMap((e,t)=>e.map(s=>[s,t]))),ut=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),mt=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},gt=(a,e,t,s)=>{const n=e!==null&&e.kind===t&&e.id===a,r=t==="node"?s.nodes.has(a):s.edges.has(a),i=t==="node"?s.nodes.get(a)??null:null;return{selected:n,related:r&&!n,dimmed:e!==null&&!n&&!r,depth:i}},ee=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),sa=a=>{const e=a[0]??{x:0,y:0},t=a.at(-1)??e;if(a.length<=2)return{x:(e.x+t.x)/2,y:(e.y+t.y)/2};if(a.length===4){const r=a[1]??e,i=a[2]??t;return{x:r.x,y:(r.y+i.y)/2}}const s=a[2]??e,n=a[3]??t;return{x:(s.x+n.x)/2,y:s.y}},aa=(a,e)=>ea(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),na=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,W=[_e,Be,Ge,B`
|
|
1
|
+
import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs,J as Ds,a7 as I,a8 as Ye,a9 as Ve,aa as We,A as Ke,ab as Ts,ac as As,ad as G,ae as q,af as f,ag as z,ah as u,ai as H,aj as S,ak as M,al as ae,am as Xe,an as Je,ao as Z,ap as we,aq as Ze,ar as Ls,as as Rs,at as $e,au as Se,av as Os,aw as Me,l as Qe,ax as Is,ay as Ps,az as js,aA as ne,q as Fs,r as Ns}from"./shared-rZQ5j0Kh.js";import{i as et}from"./shared-DjOBIYHF.js";import{p as tt,r as st,c as at}from"./shared-Dc_FGuLM.js";import{c as me}from"./shared-ml5h7U5L.js";const Us='script[type="application/json"]',nt=(a,e)=>{const t=a.querySelector(Us);if(!t)return null;const s=t.textContent??"";if(s.trim()==="")return{ok:!1,error:"JSON block is empty"};try{return{ok:!0,value:e(JSON.parse(s))}}catch(n){return{ok:!1,error:n instanceof Error?n.message:String(n)}}},rt=(a,e,t)=>{const s=nt(a,e);if(s)return t(s),()=>{};const n=new MutationObserver(()=>{const r=nt(a,e);r&&(n.disconnect(),t(r))});return n.observe(a,{childList:!0,subtree:!0}),()=>n.disconnect()},it={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6},ge=a=>{const e=[...a].sort((s,n)=>s-n);if(e.length===0)return 0;const t=Math.floor(e.length/2);return e.length%2===1?e[t]??0:((e[t-1]??0)+(e[t]??0))/2},Hs=(a,e)=>{const t=new Map;for(const i of a)t.set(i.id,[]);for(const i of e)t.get(i.from)?.push(i);const s=new Map,n=new Set,r=i=>{s.set(i,"open");for(const o of t.get(i)??[]){const d=s.get(o.to)??"new";d==="open"?n.add(o.id):d==="new"&&r(o.to)}s.set(i,"done")};for(const i of a)(s.get(i.id)??"new")==="new"&&r(i.id);return{reversed:n,forward:e.filter(i=>!n.has(i.id))}},_s=(a,e)=>{const t=new Map,s=new Map;for(const o of a)t.set(o.id,[]),s.set(o.id,[]);for(const o of e)s.get(o.from)?.push(o),t.get(o.to)?.push(o);const n=new Map(a.map(o=>[o.id,0])),r=new Map(a.map(o=>[o.id,(t.get(o.id)??[]).length])),i=a.filter(o=>(r.get(o.id)??0)===0).map(o=>o.id);for(const o of i)for(const d of s.get(o)??[]){const l=n.get(d.to)??0;n.set(d.to,Math.max(l,(n.get(o)??0)+1));const c=(r.get(d.to)??0)-1;r.set(d.to,c),c===0&&i.push(d.to)}return n},Bs=(a,e,t,s)=>{const n=[...a.keys()].sort((r,i)=>r-i);for(let r=0;r<s;r++){const i=r%2===0;for(const o of i?n:[...n].reverse()){const d=a.get(o)??[],l=new Map(d.map((p,k)=>[p,k])),c=p=>{const k=l.get(p);return k===void 0?null:k},g=d.map(p=>{const k=(e.get(p)??[]).filter(x=>(t.get(x)??o)===o+(i?-1:1)).map(c).filter(x=>x!==null);return{id:p,want:k.length>0?ge(k):l.get(p)??0}});g.sort((p,k)=>p.want-k.want||(l.get(p.id)??0)-(l.get(k.id)??0)),a.set(o,g.map(p=>p.id))}}},ot=(a,e,t,s)=>{const n=a.map((i,o)=>({id:i,want:t.get(i)??o*100,index:o}));n.sort((i,o)=>i.want-o.want||i.index-o.index);let r=0;for(const i of n){const o=e.get(i.id);o&&(o.y=r,r+=o.spec.height+s)}return{height:Math.max(0,r-s)}},Gs=(a,e,t,s,n)=>{const r=[...a.keys()].sort((l,c)=>l-c),i=new Map;for(const l of r)i.set(l,ot(a.get(l)??[],e,new Map,n.nodeSpacing).height);const o=Math.max(0,...i.values());for(const l of r){const c=(o-(i.get(l)??0))/2;for(const g of a.get(l)??[]){const p=e.get(g);p&&(p.y+=c)}}const d=(l,c)=>{const g=(t.get(l)??[]).filter(p=>s.get(p)===c).flatMap(p=>{const k=e.get(p);return k?[k.y+k.spec.height/2]:[]});return g.length>0?ge(g):null};for(let l=0;l<n.coordinatePasses;l++){const c=l%2===0;for(const g of c?r:[...r].reverse()){const p=a.get(g)??[],k=new Map;for(const w of p){const D=d(w,g+(c?-1:1)),L=e.get(w);L!==void 0&&k.set(w,D===null?L.y+L.spec.height/2:D)}const x=p.map(w=>e.get(w)?.y??0);ot(p,e,k,n.nodeSpacing);const v=p.map(w=>e.get(w)?.y??0),y=ge(x)-ge(v);for(const w of p){const D=e.get(w);D&&(D.y+=y)}}}},dt=(a,e,t)=>{const s=e===void 0?void 0:a.spec.ports?.[e];return s?{x:a.x+s.x,y:a.y+s.y}:t==="out"?{x:a.x+a.spec.width,y:a.y+a.spec.height/2}:{x:a.x,y:a.y+a.spec.height/2}},lt=(a,e,t)=>{let s=0;const n=[];for(const r of a){const i=t.byId.get(r.from),o=t.byId.get(r.to);if(!i||!o)continue;const d=dt(i,r.fromPort,"out"),l=dt(o,r.toPort,"in");if(r.from===r.to){const x=i.x+i.spec.width,v=i.y+i.spec.height,y=Math.max(t.padding/2,v+18);n.push({id:r.id,points:[d,{x:x+20,y:d.y},{x:x+20,y},{x:i.x-20,y},{x:i.x-20,y:l.y},l]});continue}if(!e.has(r.id)&&(i.layer<o.layer||i.layer===o.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){n.push({id:r.id,points:[d,l]});continue}const v=i.layer<o.layer?Math.max(d.x+14,o.x-Math.max(12,t.layerSpacing/2)):(d.x+l.x)/2;n.push({id:r.id,points:[d,{x:v,y:d.y},{x:v,y:l.y},l]});continue}const c=r.fromPort===void 0?{x:i.x+i.spec.width/2,y:i.y+i.spec.height}:d,g=r.toPort===void 0?{x:o.x+o.spec.width/2,y:o.y+o.spec.height}:l,p=Math.max(c.y,g.y)+18+s*14;s+=1;const k=[d,c,{x:c.x,y:p},{x:g.x,y:p},g,l].filter((x,v,y)=>v===0||x.x!==y[v-1]?.x||x.y!==y[v-1]?.y);n.push({id:r.id,points:k})}return n},ct=(a,e,t)=>{const s=e.flatMap(p=>[...p.points]),n=[...a.map(p=>p.x),...a.map(p=>p.x+p.spec.width),...s.map(p=>p.x)],r=[...a.map(p=>p.y),...a.map(p=>p.y+p.spec.height),...s.map(p=>p.y)],i=Math.min(0,...n),o=Math.min(0,...r),d=Math.max(0,...n),l=Math.max(0,...r),c=t-i,g=t-o;return{width:d-i+t*2,height:l-o+t*2,nodes:a.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+g,width:p.spec.width,height:p.spec.height,layer:p.layer,order:p.order})),routes:e.map(p=>({id:p.id,points:p.points.map(k=>({x:k.x+c,y:k.y+g}))}))}},pt=(a,e)=>{const t=new Map(a.map(s=>[s.id,[]]));for(const s of e)s.from!==s.to&&(t.get(s.from)?.push(s.to),t.get(s.to)?.push(s.from));return t},ht=(a,e,t,s)=>a.map(n=>({spec:n,layer:e.get(n.id)??0,order:t.get(n.id)??0,...s(n)})),Ys=(a,e)=>{const t=new Map;for(const s of a){const n=e.get(s.id)??0,r=t.get(n);r?r.push(s.id):t.set(n,[s.id])}return t},Vs=(a,e,t={})=>{const s={...it,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(v=>v.id)),r=e.filter(v=>n.has(v.from)&&n.has(v.to)),{forward:i,reversed:o}=Hs(a,r),d=_s(a,i),l=Ys(a,d);Bs(l,pt(a,r),d,s.sweeps);const c=new Map;for(const v of l.values())v.forEach((y,w)=>c.set(y,w));const g=ht(a,d,c,()=>({x:0,y:0})),p=new Map(g.map(v=>[v.spec.id,v]));Gs(l,p,pt(a,r),d,s);const k=[...l.keys()].sort((v,y)=>v-y);let x=0;for(const v of k){const y=Math.max(...(l.get(v)??[]).map(w=>p.get(w)?.spec.width??0));for(const w of l.get(v)??[]){const D=p.get(w);D&&(D.x=x)}x+=y+s.layerSpacing}return ct(g,lt(r,o,{byId:p,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ws=(a,e,t={})=>{const s={...it,...t};if(a.length===0)return{width:0,height:0,nodes:[],routes:[]};const n=new Set(a.map(d=>d.id)),r=e.filter(d=>n.has(d.from)&&n.has(d.to)),i=ht(a,new Map,new Map,d=>d.position??{x:0,y:0}),o=new Map(i.map(d=>[d.spec.id,d]));return ct(i,lt(r,new Set,{byId:o,layerSpacing:s.layerSpacing,padding:s.padding}),s.padding)},Ks=_({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:a=>`Comment on ${a}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the diagram data.",nodes:"elements",edges:"relations",change:(a,e)=>`\u201C${a}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u56F3\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(a,e)=>`\u300C${a}\u300D\u2192\u300C${e}\u300D`}}),Xs={active:[],match:"single"},Q=(a,e)=>e.active.length===0?!0:e.match==="all"?e.active.every(t=>a.includes(t)):e.active.some(t=>a.includes(t)),Js=(a,e)=>a.active.includes(e)?{...a,active:a.active.filter(t=>t!==e)}:a.match==="single"?{...a,active:[e]}:{...a,active:[...a.active,e]},Zs=(a,e)=>({match:e,active:e==="single"&&a.active.length>1?a.active.slice(-1):a.active}),Qs=a=>({...a,active:[]}),ea=a=>{const e=new Map;for(const t of a)for(const s of new Set(t))e.set(s,(e.get(s)??0)+1);return[...e].map(([t,s])=>({tag:t,count:s}))},Y={nodes:new Map,edges:new Set},N=(a,e,t,s)=>{const n=new Map,r=new Set,i=[{id:e,depth:0}],o=new Set([e]);for(const d of i)if(!(!s&&d.depth>=1))for(const l of a){const c=t==="outgoing"?l.from:l.to,g=t==="outgoing"?l.to:l.from;c===d.id&&(r.add(l.id),!o.has(g)&&(o.add(g),n.set(g,d.depth+1),i.push({id:g,depth:d.depth+1})))}return{nodes:n,edges:r}},ta=(a,e)=>{const t=new Map(a.map(r=>[r,N(e,r,"outgoing",!0).nodes])),s=new Set,n=[];for(const r of a){if(s.has(r))continue;const i=a.filter(o=>o===r||t.get(r)?.has(o)===!0&&t.get(o)?.has(r)===!0);for(const o of i)s.add(o);(i.length>1||e.some(o=>o.from===r&&o.to===r))&&n.push(i)}return n},Ce=a=>new Map(a.flatMap((e,t)=>e.map(s=>[s,t]))),ut=(a,e)=>e.get(a.from)===e.get(a.to)&&e.has(a.from),mt=a=>{try{return a.split("/").map(e=>decodeURIComponent(e))}catch{return null}},gt=(a,e,t,s)=>{const n=e!==null&&e.kind===t&&e.id===a,r=t==="node"?s.nodes.has(a):s.edges.has(a),i=t==="node"?s.nodes.get(a)??null:null;return{selected:n,related:r&&!n,dimmed:e!==null&&!n&&!r,depth:i}},ee=(...a)=>a.filter(e=>typeof e=="string"&&e!=="").join(" "),sa=a=>{const e=a[0]??{x:0,y:0},t=a.at(-1)??e;if(a.length<=2)return{x:(e.x+t.x)/2,y:(e.y+t.y)/2};if(a.length===4){const r=a[1]??e,i=a[2]??t;return{x:r.x,y:(r.y+i.y)/2}}const s=a[2]??e,n=a[3]??t;return{x:(s.x+n.x)/2,y:s.y}},aa=(a,e)=>ea(a).map(t=>({tag:t.tag,count:t.count,selected:e.active.includes(t.tag)})),na=(a,e,t)=>`${a} ${t.node} \xB7 ${e} ${t.edge}`,W=[_e,Be,Ge,B`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
container-type: inline-size;
|
|
@@ -593,7 +593,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs
|
|
|
593
593
|
${Ds()}
|
|
594
594
|
</button>
|
|
595
595
|
</div>
|
|
596
|
-
`,Ee=.08,oa=1.8,da=a=>{if(a.length===0)return{x:0,y:0,width:0,height:0};const e=Math.min(...a.map(r=>r.x)),t=Math.min(...a.map(r=>r.y)),s=Math.max(...a.map(r=>r.x+r.width))-e,n=Math.max(...a.map(r=>r.y+r.height))-t;return{x:e-s*.1,y:t-n*.1,width:s*1.2,height:n*1.2}},qe=(a,e)=>a+e/12,la=(a,e)=>{if(a.length===0)return null;const t=Math.min(...a.map(n=>n.y)),s=a.filter(n=>n.y<t+e);return{x:Math.min(...s.map(n=>n.x)),y:t}},ze=16,bt=(a,e,t,s,n="center")=>{if(e.width===0||e.height===0)return{...a,x:0,y:0};const r=(i,o,d,l)=>{const c=d*a.scale;return c<=l?n==="start"?ze-qe(o,d)*a.scale:(l-c)/2-o*a.scale:Math.min(-o*a.scale,Math.max(l-(o+d)*a.scale,i))};return{...a,x:r(a.x,e.x,e.width,t),y:r(a.y,e.y,e.height,s)}},ca=(a,e,t,s,n,r,i="center")=>{const o=bt({...a,x:a.x-n,y:a.y-r},e,t,s,i);return Math.abs(r)>Math.abs(n)&&o.y===a.y?null:o},kt='button,[role="button"],a,input,textarea,select',pa=a=>{const{canvas:e,world:t,onClearSelection:s,onView:n,align:r="center"}=a;let i={x:0,y:0,width:0,height:0},o={x:0,y:0,scale:1};const d=()=>({width:e.clientWidth||1e3,height:e.clientHeight||560}),l=()=>{const{width:m,height:C}=d();o=bt(o,i,m,C,r),t.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,n?.(o)},c=()=>{const{width:m,height:C}=d(),E=i.width/1.2||1,O=i.height/1.2||1;o={...o,scale:me(Math.min((m-24)/E,(C-40)/O),Ee,1)},o={...o,x:(m-i.width*o.scale)/2-i.x*o.scale,y:(C-i.height*o.scale)/2-i.y*o.scale},l()},g=()=>{const{width:m}=d(),C=i.width/1.2||1,E=me((m-24)/C,Ee,1);o={scale:E,x:(m-i.width*E)/2-i.x*E,y:16},l()},p=m=>{o={scale:1,x:ze-(m?.x??qe(i.x,i.width)),y:ze-(m?.y??qe(i.y,i.height))},l()},k=(m,C=d().width/2,E=d().height/2)=>{const O=o.scale,P=me(O*m,Ee,oa);P!==O&&(o={scale:P,x:C-(C-o.x)*P/O,y:E-(E-o.y)*P/O},l())},x=m=>{if(m.target instanceof Element&&m.target.closest(".diagram-zoom"))return;const C=m.deltaMode===1?16:m.deltaMode===2?d().height:1;if(m.ctrlKey||m.metaKey){m.preventDefault();const X=e.getBoundingClientRect();k(Math.exp(-me(m.deltaY*C,-60,60)*.0012),m.clientX-X.left,m.clientY-X.top);return}const{width:E,height:O}=d(),P=ca(o,i,E,O,m.deltaX*C,m.deltaY*C,r);P!==null&&(m.preventDefault(),o=P,l())},v=new Map;let y=null,w=!1;const D=()=>{const m=[...v.values()],C=m[0];if(!C)return null;const E=m[1];return E?{x:(C.x+E.x)/2,y:(C.y+E.y)/2,distance:Math.hypot(E.x-C.x,E.y-C.y)}:{...C,distance:0}},L=m=>{v.size===0&&(w=!1);const E=(m.target instanceof Element?m.target:null)?.closest(kt)??null;m.button!==0||m.pointerType!=="touch"&&E!==null||(v.set(m.pointerId,{x:m.clientX,y:m.clientY}),y=D(),E===null&&e.setPointerCapture(m.pointerId),m.pointerType!=="touch"&&E===null&&(m.preventDefault(),e.focus({preventScroll:!0})))},T=m=>{if(!v.has(m.pointerId)||y===null)return;v.set(m.pointerId,{x:m.clientX,y:m.clientY});const C=D();if(C===null)return;const E=C.x-y.x,O=C.y-y.y;if((Math.abs(E)+Math.abs(O)>1||Math.abs(C.distance-y.distance)>1)&&(w=!0),C.distance>0&&y.distance>0){const P=e.getBoundingClientRect();k(Math.pow(C.distance/y.distance,.45),y.x-P.left,y.y-P.top)}o={...o,x:o.x+E,y:o.y+O},l(),y=C,e.classList.toggle("is-panning",w)},j=m=>{v.delete(m.pointerId),y=D(),!(v.size>0)&&(e.classList.remove("is-panning"),m.type==="pointercancel"&&(w=!1))},V=m=>{w&&(m.preventDefault(),m.stopPropagation()),j(m)},$=m=>{if(w){m.preventDefault(),m.stopPropagation(),w=!1;return}const C=m.target instanceof Element?m.target:null;C===null||C.closest(kt)!==null||s()},A=m=>{if(m.target!==e)return;const C=30;if(m.key==="+"||m.key==="=")k(1.1);else if(m.key==="-")k(1/1.1);else if(m.key==="0")c();else if(m.key==="Escape")s();else if(m.key==="ArrowLeft"||m.key==="ArrowRight"||m.key==="ArrowUp"||m.key==="ArrowDown")o={...o,x:o.x+(m.key==="ArrowLeft"?C:m.key==="ArrowRight"?-C:0),y:o.y+(m.key==="ArrowUp"?C:m.key==="ArrowDown"?-C:0)},l();else return;m.preventDefault()},R=m=>{const C=m.target instanceof HTMLElement?m.target:null;if(C===null||!t.contains(C))return;const E=C.getBoundingClientRect(),O=e.getBoundingClientRect();let P=0,X=0;E.left<O.left+12?P=O.left+12-E.left:E.right>O.right-12&&(P=O.right-12-E.right),E.top<O.top+12?X=O.top+12-E.top:E.bottom>O.bottom-40&&(X=O.bottom-40-E.bottom),!(P===0&&X===0)&&(o={...o,x:o.x+P,y:o.y+X},l())};e.addEventListener("wheel",x,{passive:!1}),e.addEventListener("pointerdown",L),e.addEventListener("pointermove",T),e.addEventListener("pointerup",V),e.addEventListener("pointercancel",j),e.addEventListener("lostpointercapture",j),e.addEventListener("click",$,!0),e.addEventListener("keydown",A),e.addEventListener("focusin",R);const U=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return U?.observe(e),{setContent(m){i=da(m.width===0&&m.height===0?[]:[m]),t.style.width=`${m.width}px`,t.style.height=`${m.height}px`,l()},apply:l,fit:c,fitWidth:g,reset:p,zoom:k,view:()=>({...o}),destroy(){U?.disconnect(),e.removeEventListener("wheel",x),e.removeEventListener("pointerdown",L),e.removeEventListener("pointermove",T),e.removeEventListener("pointerup",V),e.removeEventListener("pointercancel",j),e.removeEventListener("lostpointercapture",j),e.removeEventListener("click",$,!0),e.removeEventListener("keydown",A),e.removeEventListener("focusin",R)}}};class De extends Ye{static{this.styles=W}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#e=null;#s=null;#a=[];#t=[];#n=null;#r=Xs;#i=null;#o=null;#c=null;#u=null;#l=-1;#p="";#h=null;#f=null;#d=new Map;#m=null;#g=new Map;#b=null;#k=new
|
|
596
|
+
`,Ee=.08,oa=1.8,da=a=>{if(a.length===0)return{x:0,y:0,width:0,height:0};const e=Math.min(...a.map(r=>r.x)),t=Math.min(...a.map(r=>r.y)),s=Math.max(...a.map(r=>r.x+r.width))-e,n=Math.max(...a.map(r=>r.y+r.height))-t;return{x:e-s*.1,y:t-n*.1,width:s*1.2,height:n*1.2}},qe=(a,e)=>a+e/12,la=(a,e)=>{if(a.length===0)return null;const t=Math.min(...a.map(n=>n.y)),s=a.filter(n=>n.y<t+e);return{x:Math.min(...s.map(n=>n.x)),y:t}},ze=16,bt=(a,e,t,s,n="center")=>{if(e.width===0||e.height===0)return{...a,x:0,y:0};const r=(i,o,d,l)=>{const c=d*a.scale;return c<=l?n==="start"?ze-qe(o,d)*a.scale:(l-c)/2-o*a.scale:Math.min(-o*a.scale,Math.max(l-(o+d)*a.scale,i))};return{...a,x:r(a.x,e.x,e.width,t),y:r(a.y,e.y,e.height,s)}},ca=(a,e,t,s,n,r,i="center")=>{const o=bt({...a,x:a.x-n,y:a.y-r},e,t,s,i);return Math.abs(r)>Math.abs(n)&&o.y===a.y?null:o},kt='button,[role="button"],a,input,textarea,select',pa=a=>{const{canvas:e,world:t,onClearSelection:s,onView:n,align:r="center"}=a;let i={x:0,y:0,width:0,height:0},o={x:0,y:0,scale:1};const d=()=>({width:e.clientWidth||1e3,height:e.clientHeight||560}),l=()=>{const{width:m,height:C}=d();o=bt(o,i,m,C,r),t.style.transform=`translate(${o.x}px, ${o.y}px) scale(${o.scale})`,n?.(o)},c=()=>{const{width:m,height:C}=d(),E=i.width/1.2||1,O=i.height/1.2||1;o={...o,scale:me(Math.min((m-24)/E,(C-40)/O),Ee,1)},o={...o,x:(m-i.width*o.scale)/2-i.x*o.scale,y:(C-i.height*o.scale)/2-i.y*o.scale},l()},g=()=>{const{width:m}=d(),C=i.width/1.2||1,E=me((m-24)/C,Ee,1);o={scale:E,x:(m-i.width*E)/2-i.x*E,y:16},l()},p=m=>{o={scale:1,x:ze-(m?.x??qe(i.x,i.width)),y:ze-(m?.y??qe(i.y,i.height))},l()},k=(m,C=d().width/2,E=d().height/2)=>{const O=o.scale,P=me(O*m,Ee,oa);P!==O&&(o={scale:P,x:C-(C-o.x)*P/O,y:E-(E-o.y)*P/O},l())},x=m=>{if(m.target instanceof Element&&m.target.closest(".diagram-zoom"))return;const C=m.deltaMode===1?16:m.deltaMode===2?d().height:1;if(m.ctrlKey||m.metaKey){m.preventDefault();const X=e.getBoundingClientRect();k(Math.exp(-me(m.deltaY*C,-60,60)*.0012),m.clientX-X.left,m.clientY-X.top);return}const{width:E,height:O}=d(),P=ca(o,i,E,O,m.deltaX*C,m.deltaY*C,r);P!==null&&(m.preventDefault(),o=P,l())},v=new Map;let y=null,w=!1;const D=()=>{const m=[...v.values()],C=m[0];if(!C)return null;const E=m[1];return E?{x:(C.x+E.x)/2,y:(C.y+E.y)/2,distance:Math.hypot(E.x-C.x,E.y-C.y)}:{...C,distance:0}},L=m=>{v.size===0&&(w=!1);const E=(m.target instanceof Element?m.target:null)?.closest(kt)??null;m.button!==0||m.pointerType!=="touch"&&E!==null||(v.set(m.pointerId,{x:m.clientX,y:m.clientY}),y=D(),E===null&&e.setPointerCapture(m.pointerId),m.pointerType!=="touch"&&E===null&&(m.preventDefault(),e.focus({preventScroll:!0})))},T=m=>{if(!v.has(m.pointerId)||y===null)return;v.set(m.pointerId,{x:m.clientX,y:m.clientY});const C=D();if(C===null)return;const E=C.x-y.x,O=C.y-y.y;if((Math.abs(E)+Math.abs(O)>1||Math.abs(C.distance-y.distance)>1)&&(w=!0),C.distance>0&&y.distance>0){const P=e.getBoundingClientRect();k(Math.pow(C.distance/y.distance,.45),y.x-P.left,y.y-P.top)}o={...o,x:o.x+E,y:o.y+O},l(),y=C,e.classList.toggle("is-panning",w)},j=m=>{v.delete(m.pointerId),y=D(),!(v.size>0)&&(e.classList.remove("is-panning"),m.type==="pointercancel"&&(w=!1))},V=m=>{w&&(m.preventDefault(),m.stopPropagation()),j(m)},$=m=>{if(w){m.preventDefault(),m.stopPropagation(),w=!1;return}const C=m.target instanceof Element?m.target:null;C===null||C.closest(kt)!==null||s()},A=m=>{if(m.target!==e)return;const C=30;if(m.key==="+"||m.key==="=")k(1.1);else if(m.key==="-")k(1/1.1);else if(m.key==="0")c();else if(m.key==="Escape")s();else if(m.key==="ArrowLeft"||m.key==="ArrowRight"||m.key==="ArrowUp"||m.key==="ArrowDown")o={...o,x:o.x+(m.key==="ArrowLeft"?C:m.key==="ArrowRight"?-C:0),y:o.y+(m.key==="ArrowUp"?C:m.key==="ArrowDown"?-C:0)},l();else return;m.preventDefault()},R=m=>{const C=m.target instanceof HTMLElement?m.target:null;if(C===null||!t.contains(C))return;const E=C.getBoundingClientRect(),O=e.getBoundingClientRect();let P=0,X=0;E.left<O.left+12?P=O.left+12-E.left:E.right>O.right-12&&(P=O.right-12-E.right),E.top<O.top+12?X=O.top+12-E.top:E.bottom>O.bottom-40&&(X=O.bottom-40-E.bottom),!(P===0&&X===0)&&(o={...o,x:o.x+P,y:o.y+X},l())};e.addEventListener("wheel",x,{passive:!1}),e.addEventListener("pointerdown",L),e.addEventListener("pointermove",T),e.addEventListener("pointerup",V),e.addEventListener("pointercancel",j),e.addEventListener("lostpointercapture",j),e.addEventListener("click",$,!0),e.addEventListener("keydown",A),e.addEventListener("focusin",R);const U=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return U?.observe(e),{setContent(m){i=da(m.width===0&&m.height===0?[]:[m]),t.style.width=`${m.width}px`,t.style.height=`${m.height}px`,l()},apply:l,fit:c,fitWidth:g,reset:p,zoom:k,view:()=>({...o}),destroy(){U?.disconnect(),e.removeEventListener("wheel",x),e.removeEventListener("pointerdown",L),e.removeEventListener("pointermove",T),e.removeEventListener("pointerup",V),e.removeEventListener("pointercancel",j),e.removeEventListener("lostpointercapture",j),e.removeEventListener("click",$,!0),e.removeEventListener("keydown",A),e.removeEventListener("focusin",R)}}};class De extends Ye{static{this.styles=W}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#e=null;#s=null;#a=[];#t=[];#n=null;#r=Xs;#i=null;#o=null;#c=null;#u=null;#l=-1;#p="";#h=null;#f=null;#d=new Map;#m=null;#g=new Map;#b=null;#k=new Ve(this);#v=new We(this,()=>{this.#p=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#p="",this.requestUpdate(),this.#u=rt(this,e=>this.parseData(e),e=>{e.ok?this.#x(e.value):this.#R(e.error)})}disconnectedCallback(){super.disconnectedCallback(),this.#u?.(),this.#u=null,this.#o?.destroy(),this.#o=null,this.#c=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#x(this.data)}updated(){this.#M(),this.#$(),this.#A(),this.#C()}#$(){const e=this.renderRoot.querySelector(".diagram");if(!(this.#b===null||!e||typeof e.showPopover!="function")&&!e.matches(":popover-open"))try{e.showPopover()}catch{}}#M(){const e=JSON.stringify([this.commentTargets,this.#t]);e!==this.#p&&(this.#p=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#A(){this.#c=this.renderRoot.querySelector(".diagram-zoom-value");const e=this.renderRoot.querySelector(".diagram-canvas"),t=this.renderRoot.querySelector(".diagram-world");if(!e||!t)return;this.#o??=pa({canvas:e,world:t,align:this.viewAlign(),onClearSelection:()=>this.#y(null),onView:r=>{this.#c&&(this.#c.textContent=`${Math.round(r.scale*100)}%`),this.dispatchEvent(new CustomEvent("dpk-diagram-view",{detail:{view:r},bubbles:!0,composed:!0})),this.onViewChange(r)}});const s=this.contentSize();if(s===null){this.#o.apply();return}this.#o.setContent({x:0,y:0,width:s.width,height:s.height});const n=this.layoutVersion();n!==this.#l&&(this.#l=n,this.initialView())}#C(){const e=this.#f!==this.#h;this.#f=this.#h;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#S();!t||!s||(this.#k.open(t,s,{width:300,height:280},{placement:"right-start",trackTransform:!0}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}get commentTargets(){if(!this.id||this.#n!==null)return[];const e=`${this.subject??this.heading??this.defaultHeading()} \xB7 ${this.id}`;return this.commentItems().map(t=>({...t,group:e}))}commentItems(){return[]}commentRef(e,...t){return`element:${[this.id,e,...t].map(s=>encodeURIComponent(s)).join("/")}`}requestElementComment(e,...t){const s=this.commentRef(e,...t);this.commentTargets.some(n=>n.value===s)&&this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:s},bubbles:!0,composed:!0}))}get elementActions(){return this.#a}set elementActions(e){this.#a=e,this.#w()}get elementActionResults(){return this.#t}reduceElementActions(e,t){return{data:e,results:t.map(s=>({id:s.id,title:s.type,stale:"unsupported-action-type"}))}}dispatchElementAction(e,t,s){const n=new CustomEvent("dpk-element-action",{detail:{type:e,target:this.commentRef(...t),payload:s},bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(n),n.defaultPrevented}get selection(){return this.#i}select(e){this.#y(e)}get tagFilter(){return this.#r}set tagFilter(e){this.#r=e,this.requestUpdate()}get dataError(){return this.#n}resetView(){this.fitViewport()}#E(e){if(e===(this.#b!==null))return;const t=this.renderRoot.querySelector(".diagram");this.#b=e?{height:t?.offsetHeight??0}:null,this.#h=null,this.requestUpdate()}#L={handleEvent:e=>e.preventDefault(),passive:!1};#q={handleEvent:e=>{e.key!=="Escape"||this.#i!==null||(e.preventDefault(),this.#E(!1))},capture:!0};get locale(){return this.#v.locale}get chromeMessages(){return Ks(this.#v.locale)}renderSelection(){const e=this.#h,t=e===null?void 0:this.#g.get(e);if(e===null||t===void 0)return b;const s=tt(this.#d.get(e)??"",[],{label:t,key:e,...this.#m===e?{error:this.chromeMessages.sendFailed}:{}});return h`${et(e,st(at(this.#v.locale),s,n=>this.#z(e,n)))}`}renderCommentTrigger(e,t,s){if(!this.id)return b;const n=this.commentRef(e.kind,e.id);return this.#g.set(n,t),h`<button
|
|
597
597
|
type="button"
|
|
598
598
|
class=${ee("diagram-comment-trigger",s&&"is-placed")}
|
|
599
599
|
style=${s?`left:${s.x}px; top:${s.y}px`:b}
|
|
@@ -605,7 +605,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs
|
|
|
605
605
|
aria-expanded=${this.#h===n?"true":"false"}
|
|
606
606
|
@click=${()=>{this.#y(e),this.#h=n,this.requestUpdate()}}
|
|
607
607
|
>
|
|
608
|
-
${
|
|
608
|
+
${Ke()}
|
|
609
609
|
</button>`}renderEdgeCommentTrigger(e,t,s){const n=Math.floor((s.length-1)/2),r=s[n],i=s[n+1]??r;return!this.id||!r||!i?b:I`<foreignObject
|
|
610
610
|
class="diagram-edge-comment"
|
|
611
611
|
x=${(r.x+i.x)/2-16}
|
|
@@ -869,7 +869,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs
|
|
|
869
869
|
</button>
|
|
870
870
|
${this.renderCommentTrigger({kind:"edge",id:e.id},`${this.#e(e.from)} \u2192 ${this.#e(e.to)} \xB7 ${e.title}`)}
|
|
871
871
|
</span>
|
|
872
|
-
`}}const wt=()=>{customElements.get("dpk-component-state-diagram")||customElements.define("dpk-component-state-diagram",yt)},$t=(a,e)=>e?{request:"Process / guarantee",response:"Response / guarantee",async:"Async / guarantee"}[a]:{request:"\u51E6\u7406 / \u4FDD\u8A3C",response:"\u5FDC\u7B54 / \u4FDD\u8A3C",async:"\u975E\u540C\u671F\u51E6\u7406 / \u4FDD\u8A3C"}[a],oe=_({en:{heading:"Sequence",empty:"No matching messages.",participants:"Participants",stats:(a,e)=>`${a} / ${e} messages`,detailLabel:a=>$t(a,!0),selectMessage:a=>`Select ${a}`,frameHeaderLabel:(a,e,t)=>`${a} \xB7 ${t?`Expand ${e}`:`Collapse ${e}`}`,frameCount:a=>`${a} message${a===1?"":"s"}`},ja:{heading:"\u30B7\u30FC\u30B1\u30F3\u30B9\u56F3",empty:"\u8A72\u5F53\u3059\u308B\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",participants:"\u53C2\u52A0\u8005",stats:(a,e)=>`${a} / ${e} \u30E1\u30C3\u30BB\u30FC\u30B8`,detailLabel:a=>$t(a,!1),selectMessage:a=>`${a}\u3092\u9078\u629E`,frameHeaderLabel:(a,e,t)=>`${a} \xB7 ${e}\u3092${t?"\u5C55\u958B":"\u6298\u308A\u305F\u305F\u3080"}`,frameCount:a=>`${a} \u30E1\u30C3\u30BB\u30FC\u30B8`}}),va=q({kind:Z("message"),id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),title:S(u(),M(1)),style:f(H(["request","response","async"]),"request"),tags:f(z(u()),[]),guard:f(u()),detail:f(u()),questions:f(u())}),ya=q({label:S(u(),M(1)),items:z(
|
|
872
|
+
`}}const wt=()=>{customElements.get("dpk-component-state-diagram")||customElements.define("dpk-component-state-diagram",yt)},$t=(a,e)=>e?{request:"Process / guarantee",response:"Response / guarantee",async:"Async / guarantee"}[a]:{request:"\u51E6\u7406 / \u4FDD\u8A3C",response:"\u5FDC\u7B54 / \u4FDD\u8A3C",async:"\u975E\u540C\u671F\u51E6\u7406 / \u4FDD\u8A3C"}[a],oe=_({en:{heading:"Sequence",empty:"No matching messages.",participants:"Participants",stats:(a,e)=>`${a} / ${e} messages`,detailLabel:a=>$t(a,!0),selectMessage:a=>`Select ${a}`,frameHeaderLabel:(a,e,t)=>`${a} \xB7 ${t?`Expand ${e}`:`Collapse ${e}`}`,frameCount:a=>`${a} message${a===1?"":"s"}`},ja:{heading:"\u30B7\u30FC\u30B1\u30F3\u30B9\u56F3",empty:"\u8A72\u5F53\u3059\u308B\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",participants:"\u53C2\u52A0\u8005",stats:(a,e)=>`${a} / ${e} \u30E1\u30C3\u30BB\u30FC\u30B8`,detailLabel:a=>$t(a,!1),selectMessage:a=>`${a}\u3092\u9078\u629E`,frameHeaderLabel:(a,e,t)=>`${a} \xB7 ${e}\u3092${t?"\u5C55\u958B":"\u6298\u308A\u305F\u305F\u3080"}`,frameCount:a=>`${a} \u30E1\u30C3\u30BB\u30FC\u30B8`}}),va=q({kind:Z("message"),id:S(u(),M(1)),from:S(u(),M(1)),to:S(u(),M(1)),title:S(u(),M(1)),style:f(H(["request","response","async"]),"request"),tags:f(z(u()),[]),guard:f(u()),detail:f(u()),questions:f(u())}),ya=q({label:S(u(),M(1)),items:z(Je())}),wa=q({kind:Z("fragment"),id:S(u(),M(1)),operator:H(["alt","opt","loop","par"]),title:S(u(),M(1)),collapsed:f(we(),!1),branches:S(z(ya),M(1))}),$a=Xe("kind",[va,wa]),Sa=q({id:S(u(),M(1)),name:S(u(),M(1)),role:f(u()),symbol:f(u()),kind:f(H(["internal","external"]),"internal"),description:f(u()),questions:f(u())}),Ma=q({participants:S(z(Sa),M(1)),items:f(z(Je()),[])}),St=240,Te=(a,e,t)=>{if(a.has(e))throw new Error(`duplicate ${t} id: ${e}`);a.add(e)},Mt=(a,e,t)=>a.map(s=>{const n=G($a,s);if(n.kind==="message"){if(Te(t,n.id,"message"),!e.has(n.from))throw new Error(`unknown sender: ${n.from}`);if(!e.has(n.to))throw new Error(`unknown receiver: ${n.to}`);return{kind:"message",id:n.id,from:n.from,to:n.to,title:n.title,style:n.style,tags:n.tags,guard:n.guard??null,detail:n.detail??null,questions:n.questions??null}}return Te(t,n.id,"fragment"),{kind:"fragment",id:n.id,operator:n.operator,title:n.title,collapsed:n.collapsed,branches:n.branches.map(i=>({label:i.label,items:Mt(i.items,e,t)}))}}),Ct=a=>{const e=G(Ma,a),t=new Set;for(const s of e.participants)Te(t,s.id,"participant");return{participants:e.participants.map(s=>({id:s.id,name:s.name,role:s.role??null,symbol:s.symbol??null,external:s.kind==="external",description:s.description??null,questions:s.questions??null})),items:Mt(e.items,t,new Set)}},Ca=()=>({participants:[],items:[]}),Et=(a,e)=>{for(const t of a)if(t.kind==="message")e.push(t);else for(const s of t.branches)Et(s.items,e)},K=a=>{const e=[];return Et(a,e),e},Ea=a=>new Map(K(a.items).map((e,t)=>[e.id,String(t+1).padStart(2,"0")])),qa=a=>K(a).length,qt=(a,e)=>{const t=[];for(const s of a){if(s.kind==="message"){e(s)&&t.push(s);continue}const n=s.branches.map(r=>({label:r.label,items:qt(r.items,e)})).filter(r=>r.items.length>0);n.length>0&&t.push({...s,branches:n})}return t},za=64,Da=86,Ta=31,Aa=32,La=40,Ra=(a,e)=>{const t=qt(a.items,e),s=new Set;for(const x of K(t))s.add(x.from),s.add(x.to);const n=a.participants.filter(x=>s.has(x.id)),r=new Map(n.map((x,v)=>[x.id,120+v*St])),i=Math.max(360,n.length*St),o=[],d=[],l=[],c=[],g=[];let p=25;const k=(x,v)=>{for(const y of x){if(y.kind==="message"){o.push({message:y,y:p+29,depth:v}),p+=y.from===y.to?Da:za;continue}const w=22+v*13,D=p,L=i-44-v*26;p+=Ta,y.collapsed?(g.push({fragment:y,x:w,y:p+6,width:L}),p+=La):y.branches.forEach((T,j)=>{j>0&&(c.push({x:w,y:p,width:L}),p+=8),l.push({label:T.label,x:w+12,y:p,width:L-24}),p+=Aa,k(T.items,v+1),p+=8}),d.push({fragment:y,x:w,y:D,width:L,height:p-D,count:qa([y])}),p+=14}};return k(t,0),{width:i,height:p+24,participants:n,rows:o,frames:d,branches:l,dividers:c,folds:g,x:r}},Oa=B`
|
|
873
873
|
.sequence .diagram-canvas {
|
|
874
874
|
background-image: none;
|
|
875
875
|
}
|
|
@@ -1243,7 +1243,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs
|
|
|
1243
1243
|
aria-label=${i.frameHeaderLabel(e.operator,e.title,o)}
|
|
1244
1244
|
@click=${()=>this.#l(e)}
|
|
1245
1245
|
>
|
|
1246
|
-
<span class="sequence-frame-chevron">${o?
|
|
1246
|
+
<span class="sequence-frame-chevron">${o?Ze():Ls()}</span>
|
|
1247
1247
|
<span class="sequence-operator">${e.operator}</span>
|
|
1248
1248
|
<span class="sequence-text">${e.title}</span>
|
|
1249
1249
|
<span class="sequence-frame-count">${i.frameCount(r)}</span>
|
|
@@ -2511,7 +2511,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs
|
|
|
2511
2511
|
${r.failed?h`<span class="mind-actions-error" role="alert">${e.notRecorded}</span>`:b}
|
|
2512
2512
|
`}
|
|
2513
2513
|
</div>
|
|
2514
|
-
`}#u(e,t){return e.side==="left"?t.x+t.width-220:t.x}#l(e){this.#t={parent:e,label:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(".mind-actions input")?.focus())}#p(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#t=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#t?.label.trim()??"";if(s.length===0)return;const n=
|
|
2514
|
+
`}#u(e,t){return e.side==="left"?t.x+t.width-220:t.x}#l(e){this.#t={parent:e,label:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(".mind-actions input")?.focus())}#p(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#t=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#t?.label.trim()??"";if(s.length===0)return;const n=Qe(`topic ${s}`,this.items().nodes.map(i=>i.id));if(!this.dispatchElementAction(ls,["node",t],{id:n,label:s})){this.#t={parent:t,label:s,failed:!0},this.requestUpdate();return}this.#t=null,this.#e.delete(t),this.select({kind:"node",id:n}),this.requestUpdate()}}const us=()=>{customElements.get("dpk-component-mind-map")||customElements.define("dpk-component-mind-map",hs)},ce=_({en:{heading:"Kanban",empty:"No columns.",cards:"Card",notRecorded:"Could not record it. Place this inside a dpk-template-* element.",wipLimit:a=>`WIP limit ${a}`,addCardButton:"+ Card",addCardAriaLabel:a=>`Card to add to ${a}`,addCardPlaceholder:"Card title (Enter to add)",addCardTitle:"Add card",moveCardTitle:"Move card",addSummary:(a,e)=>`${a} \u203A ${e}`,moveSummarySame:(a,e)=>`${a}: reorder within ${e}`,moveSummaryAcross:(a,e,t)=>`${a}: ${e} \u2192 ${t}`},ja:{heading:"\u30AB\u30F3\u30D0\u30F3",empty:"\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002",cards:"\u30AB\u30FC\u30C9",notRecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",wipLimit:a=>`WIP \u4E0A\u9650 ${a}`,addCardButton:"\uFF0B \u30AB\u30FC\u30C9",addCardAriaLabel:a=>`${a} \u306B\u8FFD\u52A0\u3059\u308B\u30AB\u30FC\u30C9`,addCardPlaceholder:"\u30AB\u30FC\u30C9\u540D\uFF08Enter \u3067\u8FFD\u52A0\uFF09",addCardTitle:"\u30AB\u30FC\u30C9\u3092\u8FFD\u52A0",moveCardTitle:"\u30AB\u30FC\u30C9\u3092\u79FB\u52D5",addSummary:(a,e)=>`${a} \u203A ${e}`,moveSummarySame:(a,e)=>`${a}: ${e} \u5185\u3067\u4E26\u3079\u66FF\u3048`,moveSummaryAcross:(a,e,t)=>`${a}: ${e} \u2192 ${t}`}}),Vn=q({id:S(u(),M(1)),title:S(u(),M(1)),description:f(u()),tags:f(z(u())),assignee:f(u()),questions:f(u())}),Wn=["gray","blue","green","amber","violet","red"],Kn=q({id:S(u(),M(1)),label:S(u(),M(1)),description:f(u()),color:f(H(Wn)),limit:f(S(ae(),Ps(),Is(1))),cards:f(z(Vn))}),Xn=q({columns:z(Kn)}),Jn=()=>({columns:[]}),ms=a=>{const e=G(Xn,a),t=new Set,s=new Set;return{columns:e.columns.map(r=>{if(t.has(r.id))throw new Error(`duplicate column id: ${r.id}`);return t.add(r.id),{id:r.id,label:r.label,description:r.description??null,color:r.color??null,limit:r.limit??null,cards:(r.cards??[]).map(i=>{if(s.has(i.id))throw new Error(`duplicate card id: ${i.id}`);return s.add(i.id),{id:i.id,title:i.title,description:i.description??null,tags:i.tags??[],assignee:i.assignee??null,...i.questions===void 0?{}:{questions:i.questions},column:r.id,change:null}})}})}},xe=(a,e)=>a.columns.flatMap(t=>t.cards).find(t=>t.id===e),pe=a=>a.columns.flatMap(e=>e.cards),Zn=(a,e)=>e===null?a:{columns:a.columns.map(t=>({...t,cards:t.cards.filter(e)}))},Qn=(a,e,t,s)=>{const n=xe(a,e);if(n===void 0||n.column!==t)return!1;if(s===e)return!0;const r=a.columns.find(o=>o.id===t)?.cards??[],i=r.findIndex(o=>o.id===e);return(r[i+1]?.id??null)===s},gs="ADD_CARD",fs="MOVE_CARD",er=Se({id:S(u(),M(1)),title:S(u(),Me(),M(1))}),tr=Se({column:S(u(),M(1)),before:js(S(u(),M(1)))}),bs=(a,e)=>{const t=mt(a);return t?.length===3&&t[1]===e?t[2]??null:null},sr=(a,e)=>({columns:a.columns.map(t=>t.cards.some(s=>s.id===e)?{...t,cards:t.cards.filter(s=>s.id!==e)}:t)}),ks=(a,e,t)=>({columns:a.columns.map(s=>{if(s.id!==t.column)return s;const n={...e,column:s.id},r=t.before===null?-1:s.cards.findIndex(i=>i.id===t.before);return{...s,cards:r<0?[...s.cards,n]:[...s.cards.slice(0,r),n,...s.cards.slice(r)]}})}),ar=(a,e,t)=>{const s=a.addCardTitle,n=bs(t.target.id,"column"),r=e.columns.find(d=>d.id===n);if(r===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=$e(er,t.payload);if(!i.success||xe(e,i.output.id)!==void 0)return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const o={id:i.output.id,title:i.output.title,description:null,tags:[],assignee:null,column:r.id,change:"added"};return{data:ks(e,o,{column:r.id,before:null}),result:{id:t.id,title:s,summary:a.addSummary(r.label,o.title),tone:"create"}}},nr=(a,e,t)=>{const s=a.moveCardTitle,n=bs(t.target.id,"card"),r=n===null?void 0:xe(e,n);if(r===void 0)return{data:e,result:{id:t.id,title:s,stale:"target-missing"}};const i=$e(tr,t.payload),o=e.columns.find(k=>k.id===r.column),d=i.success?e.columns.find(k=>k.id===i.output.column):void 0,l=i.success?i.output.before:null,c=l===null||l!==r.id&&d?.cards.some(k=>k.id===l)===!0;if(!i.success||o===void 0||d===void 0||!c)return{data:e,result:{id:t.id,title:s,stale:"constraint-violated"}};const g={...r,change:r.change??"moved"},p=o.id===d.id?a.moveSummarySame(r.title,d.label):a.moveSummaryAcross(r.title,o.label,d.label);return{data:ks(sr(e,r.id),g,{column:d.id,before:l}),result:{id:t.id,title:s,summary:p,tone:"move"}}},rr=(a,e,t)=>{let s=e;const n=[];for(const r of t){const i=r.type===gs?ar(a,s,r):r.type===fs?nr(a,s,r):{data:s,result:{id:r.id,title:r.type,stale:"unsupported-action-type"}};s=i.data,n.push(i.result)}return{data:s,results:n}},ir=B`
|
|
2515
2515
|
.kanban-board {
|
|
2516
2516
|
display: flex;
|
|
2517
2517
|
align-items: flex-start;
|
|
@@ -2926,7 +2926,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs
|
|
|
2926
2926
|
/>
|
|
2927
2927
|
${s.failed?h`<span class="kanban-error" role="alert">${t.notRecorded}</span>`:b}
|
|
2928
2928
|
`}
|
|
2929
|
-
</div>`}#p(e,t){e.target!==e.currentTarget||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.select({kind:"card",id:t}))}#h(e,t){const s=this.dispatchElementAction(fs,["card",e],{column:t.column,before:t.before});this.#a=s?null:e,this.select({kind:"card",id:e}),this.requestUpdate()}#f(e,t){this.#t=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}#d(e,t){if(this.#t===null)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");const s=this.#k(e,t);this.#n?.column===s.column&&this.#n.before===s.before||(this.#n=s,this.requestUpdate())}#m(e){const t=e.currentTarget;!(t instanceof HTMLElement)||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this.#n=null,this.requestUpdate())}#g(e,t){const s=this.#t;if(s===null)return;e.preventDefault();const n=this.#k(e,t);this.#b(),Qn(this.items(),s,n.column,n.before)||this.#h(s,n)}#b(){this.#t===null&&this.#n===null||(this.#t=null,this.#n=null,this.requestUpdate())}#k(e,t){const s=e.currentTarget,r=(s instanceof HTMLElement?[...s.querySelectorAll("[data-card]")]:[]).find(i=>{if(i.dataset.card===this.#t)return!1;const o=i.getBoundingClientRect();return o.top+o.height/2>e.clientY});return{column:t,before:r?.dataset.card??null}}#v(e){this.#s={column:e,title:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-column="${CSS.escape(e)}"] .kanban-add input`)?.focus({preventScroll:!0}))}#$(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#s=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#s?.title.trim()??"";if(s.length===0)return;const n=[...this.items().columns.map(i=>i.id),...pe(this.items()).map(i=>i.id)],r=Ze(`card ${s}`,n);if(!this.dispatchElementAction(gs,["column",t],{id:r,title:s})){this.#s={column:t,title:s,failed:!0},this.requestUpdate();return}this.#s=null,this.select({kind:"card",id:r}),this.requestUpdate()}}const vs=()=>{customElements.get("dpk-component-kanban")||customElements.define("dpk-component-kanban",xs)},or=_({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:a=>`${a} ${a===1?"claim":"claims"}`,subjects:"For",premises:"Given",conclusions:"Then",noPremises:"None \u2014 holds unconditionally",showDetails:"Show the details of this claim",hideDetails:"Hide the details of this claim",examples:"Examples",notClaimed:"Not claimed",usesTerms:"Terms",source:"Source",proved:"Proved",conditional:"Proved under assumptions",bounded:"Checked within bounds",incomplete:"Incomplete",provedDetail:"Machine-checked to hold in every case.",conditionalDetail:"Holds in every case, provided the assumptions are true.",boundedDetail:"Every case within the bound was checked; nothing outside it was.",incompleteDetail:"The proof is not finished. Nothing here is guaranteed yet.",planned:"Planned",plannedDetail:"Not proved yet: a property proposed to be proved, for agreement before the work starts.",target:"About",noClaims:"No claims yet.",assumptions:"Assumes",bound:"Checked within",gaps:"Unfinished",commentOn:a=>`Comment on ${a}`,sendFailed:"Could not send. Place this inside a dpk-template-* element."},ja:{heading:"\u5F62\u5F0F\u4ED5\u69D8",empty:"\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4ED5\u69D8\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",claims:a=>`${a} \u4EF6\u306E\u4E3B\u5F35`,subjects:"\u5165\u529B\u30FB\u72B6\u6CC1",premises:"\u524D\u63D0",conclusions:"\u7D50\u8AD6",noPremises:"\u306A\u3057 \u2014 \u7121\u6761\u4EF6\u306B\u6210\u308A\u7ACB\u3064",showDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u958B\u304F",hideDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u9589\u3058\u308B",examples:"\u5177\u4F53\u4F8B",notClaimed:"\u4E3B\u5F35\u3057\u3066\u3044\u306A\u3044\u3053\u3068",usesTerms:"\u4F7F\u3046\u7528\u8A9E",source:"\u51FA\u5178",proved:"\u8A3C\u660E\u6E08\u307F",conditional:"\u4EEE\u5B9A\u3064\u304D\u3067\u8A3C\u660E\u6E08\u307F",bounded:"\u7BC4\u56F2\u3092\u9650\u3063\u3066\u78BA\u8A8D",incomplete:"\u672A\u5B8C\u6210",provedDetail:"\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3064\u3053\u3068\u304C\u6A5F\u68B0\u7684\u306B\u78BA\u304B\u3081\u3089\u308C\u3066\u3044\u307E\u3059\u3002",conditionalDetail:"\u4EEE\u5B9A\u304C\u6B63\u3057\u3051\u308C\u3070\u3001\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3061\u307E\u3059\u3002",boundedDetail:"\u7BC4\u56F2\u5185\u306F\u3059\u3079\u3066\u306E\u5834\u5408\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u7BC4\u56F2\u306E\u5916\u306F\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002",incompleteDetail:"\u8A3C\u660E\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u4E3B\u5F35\u306F\u307E\u3060\u4FDD\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",planned:"\u8A3C\u660E\u4E88\u5B9A",plannedDetail:"\u307E\u3060\u8A3C\u660E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u308C\u304B\u3089\u8A3C\u660E\u3059\u308B\u6027\u8CEA\u3068\u3057\u3066\u3001\u5408\u610F\u3092\u3068\u308B\u305F\u3081\u306E\u6848\u3067\u3059\u3002",target:"\u5BFE\u8C61",noClaims:"\u307E\u3060\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",assumptions:"\u4EEE\u5B9A",bound:"\u78BA\u8A8D\u3057\u305F\u7BC4\u56F2",gaps:"\u7D42\u308F\u3063\u3066\u3044\u306A\u3044\u90E8\u5206",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),F=S(u(),Me(),M(1)),he=q({id:ne,text:F}),dr=Ke("kind",[q({kind:Z("proved"),assumptions:f(z(F))}),q({kind:Z("bounded"),bound:F}),q({kind:Z("incomplete"),gaps:f(z(F))}),q({kind:Z("planned")})]),lr=q({id:ne,target:f(ne),statement:F,subjects:f(z(he)),premises:f(z(he)),conclusions:S(z(he),M(1,"a claim needs at least one conclusion")),examples:f(z(he)),notClaimed:f(z(he)),assurance:dr,source:f(q({tool:f(F),ref:F}))}),cr=q({id:ne,name:F,meaning:F}),pr=q({id:ne,name:F,code:f(F),summary:f(F)}),hr=q({targets:f(z(pr)),terms:f(z(cr)),claims:z(lr)}),ur=()=>({targets:[],terms:[],claims:[]}),mr=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,gr=(a,e)=>{const t=[];let s=0;for(const n of a.matchAll(mr)){const r=(n[1]??"").trim(),i=e.get(r);if(i===void 0)throw new Error(`unknown term reference: [[${r}]]`);n.index>s&&t.push({kind:"text",text:a.slice(s,n.index)}),t.push({kind:"term",id:r,label:n[2]?.trim()||i}),s=n.index+n[0].length}return s<a.length&&t.push({kind:"text",text:a.slice(s)}),t},Ue=a=>a.map(e=>e.kind==="text"?e.text:e.label).join(""),fr=a=>[...new Set(a.flatMap(e=>e.flatMap(t=>t.kind==="term"?[t.id]:[])))],ve=(a,e)=>{const t=new Set;for(const s of a){if(t.has(s))throw new Error(`duplicate ${e} id: ${s}`);t.add(s)}},ys=a=>{const e=G(hr,a),t=e.targets??[],s=e.terms??[];ve(t.map(c=>c.id),"target"),ve(s.map(c=>c.id),"term"),ve(e.claims.map(c=>c.id),"claim");const n=new Map(s.map(c=>[c.id,c.name])),r=c=>gr(c,n),i=s.map(c=>({id:c.id,name:c.name,meaning:r(c.meaning)})),o=t.map(c=>({id:c.id,name:c.name,code:c.code??null,summary:c.summary===void 0?null:r(c.summary)})),d=new Set(o.map(c=>c.id)),l=e.claims.map(c=>{if(c.target!==void 0&&!d.has(c.target))throw new Error(`unknown target (in claim ${c.id}): ${c.target}`);const g=T=>(T??[]).map(j=>({id:j.id,text:r(j.text)})),p=g(c.subjects),k=g(c.premises),x=g(c.conclusions),v=g(c.examples),y=g(c.notClaimed),w=[...p,...k,...x,...v,...y];ve(w.map(T=>T.id),`clause (in claim ${c.id})`);const D=br(c.assurance,r),L=r(c.statement);return{id:c.id,target:c.target??null,statement:L,subjects:p,premises:k,conclusions:x,examples:v,notClaimed:y,assurance:D,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:fr([L,...w.map(T=>T.text),...kr(D)])}});return{targets:o,terms:i,claims:l}},br=(a,e)=>{switch(a.kind){case"proved":return{kind:"proved",assumptions:(a.assumptions??[]).map(e)};case"bounded":return{kind:"bounded",bound:e(a.bound)};case"incomplete":return{kind:"incomplete",gaps:(a.gaps??[]).map(e)};case"planned":return{kind:"planned"}}},kr=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},xr=a=>{const e={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const t of a.claims)e[ws(t.assurance)?"conditional":t.assurance.kind]+=1;return e},ws=a=>a.kind==="proved"&&a.assumptions.length>0,$s=a=>{const e=new Map(a.targets.map(s=>[s.id,s])),t=new Map;for(const s of a.claims)t.set(s.target,[...t.get(s.target)??[],s]);for(const s of a.targets)t.has(s.id)||t.set(s.id,[]);return[...t].map(([s,n])=>({target:s===null?null:e.get(s)??null,claims:n}))},ue=(a,e)=>e.length===0?{itemsLabel:null,items:e}:{itemsLabel:a,items:e},He=(a,e)=>{switch(e.kind){case"proved":return ws(e)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...ue(a.assumptions,e.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...ue("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...ue(a.bound,[e.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...ue(a.gaps,e.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...ue("",[])}}},vr=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},yr=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],Ss=32,ye=a=>{const e=Ue(a.statement);return e.length<=Ss?e:`${e.slice(0,Ss).trimEnd()}\u2026`},wr=a=>[{target:{kind:"claim",claim:a.id},label:ye(a)},...yr(a).map(e=>({target:{kind:"clause",claim:a.id,clause:e.id},label:`${ye(a)} \u203A ${Ue(e.text)}`}))],$r=a=>$s(a).flatMap(e=>[...e.target===null?[]:[{target:{kind:"target",target:e.target.id},label:e.target.name}],...e.claims.flatMap(wr)]),Sr=[_e,Be,Ge,B`
|
|
2929
|
+
</div>`}#p(e,t){e.target!==e.currentTarget||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.select({kind:"card",id:t}))}#h(e,t){const s=this.dispatchElementAction(fs,["card",e],{column:t.column,before:t.before});this.#a=s?null:e,this.select({kind:"card",id:e}),this.requestUpdate()}#f(e,t){this.#t=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}#d(e,t){if(this.#t===null)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");const s=this.#k(e,t);this.#n?.column===s.column&&this.#n.before===s.before||(this.#n=s,this.requestUpdate())}#m(e){const t=e.currentTarget;!(t instanceof HTMLElement)||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this.#n=null,this.requestUpdate())}#g(e,t){const s=this.#t;if(s===null)return;e.preventDefault();const n=this.#k(e,t);this.#b(),Qn(this.items(),s,n.column,n.before)||this.#h(s,n)}#b(){this.#t===null&&this.#n===null||(this.#t=null,this.#n=null,this.requestUpdate())}#k(e,t){const s=e.currentTarget,r=(s instanceof HTMLElement?[...s.querySelectorAll("[data-card]")]:[]).find(i=>{if(i.dataset.card===this.#t)return!1;const o=i.getBoundingClientRect();return o.top+o.height/2>e.clientY});return{column:t,before:r?.dataset.card??null}}#v(e){this.#s={column:e,title:"",failed:!1},this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-column="${CSS.escape(e)}"] .kanban-add input`)?.focus({preventScroll:!0}))}#$(e,t){if(e.isComposing)return;if(e.key==="Escape"){e.preventDefault(),this.#s=null,this.requestUpdate();return}if(e.key!=="Enter")return;e.preventDefault();const s=this.#s?.title.trim()??"";if(s.length===0)return;const n=[...this.items().columns.map(i=>i.id),...pe(this.items()).map(i=>i.id)],r=Qe(`card ${s}`,n);if(!this.dispatchElementAction(gs,["column",t],{id:r,title:s})){this.#s={column:t,title:s,failed:!0},this.requestUpdate();return}this.#s=null,this.select({kind:"card",id:r}),this.requestUpdate()}}const vs=()=>{customElements.get("dpk-component-kanban")||customElements.define("dpk-component-kanban",xs)},or=_({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:a=>`${a} ${a===1?"claim":"claims"}`,subjects:"For",premises:"Given",conclusions:"Then",noPremises:"None \u2014 holds unconditionally",showDetails:"Show the details of this claim",hideDetails:"Hide the details of this claim",examples:"Examples",notClaimed:"Not claimed",usesTerms:"Terms",source:"Source",proved:"Proved",conditional:"Proved under assumptions",bounded:"Checked within bounds",incomplete:"Incomplete",provedDetail:"Machine-checked to hold in every case.",conditionalDetail:"Holds in every case, provided the assumptions are true.",boundedDetail:"Every case within the bound was checked; nothing outside it was.",incompleteDetail:"The proof is not finished. Nothing here is guaranteed yet.",planned:"Planned",plannedDetail:"Not proved yet: a property proposed to be proved, for agreement before the work starts.",target:"About",noClaims:"No claims yet.",assumptions:"Assumes",bound:"Checked within",gaps:"Unfinished",commentOn:a=>`Comment on ${a}`,sendFailed:"Could not send. Place this inside a dpk-template-* element."},ja:{heading:"\u5F62\u5F0F\u4ED5\u69D8",empty:"\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4ED5\u69D8\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",claims:a=>`${a} \u4EF6\u306E\u4E3B\u5F35`,subjects:"\u5165\u529B\u30FB\u72B6\u6CC1",premises:"\u524D\u63D0",conclusions:"\u7D50\u8AD6",noPremises:"\u306A\u3057 \u2014 \u7121\u6761\u4EF6\u306B\u6210\u308A\u7ACB\u3064",showDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u958B\u304F",hideDetails:"\u3053\u306E\u4E3B\u5F35\u306E\u8A73\u7D30\u3092\u9589\u3058\u308B",examples:"\u5177\u4F53\u4F8B",notClaimed:"\u4E3B\u5F35\u3057\u3066\u3044\u306A\u3044\u3053\u3068",usesTerms:"\u4F7F\u3046\u7528\u8A9E",source:"\u51FA\u5178",proved:"\u8A3C\u660E\u6E08\u307F",conditional:"\u4EEE\u5B9A\u3064\u304D\u3067\u8A3C\u660E\u6E08\u307F",bounded:"\u7BC4\u56F2\u3092\u9650\u3063\u3066\u78BA\u8A8D",incomplete:"\u672A\u5B8C\u6210",provedDetail:"\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3064\u3053\u3068\u304C\u6A5F\u68B0\u7684\u306B\u78BA\u304B\u3081\u3089\u308C\u3066\u3044\u307E\u3059\u3002",conditionalDetail:"\u4EEE\u5B9A\u304C\u6B63\u3057\u3051\u308C\u3070\u3001\u3059\u3079\u3066\u306E\u5834\u5408\u306B\u6210\u308A\u7ACB\u3061\u307E\u3059\u3002",boundedDetail:"\u7BC4\u56F2\u5185\u306F\u3059\u3079\u3066\u306E\u5834\u5408\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u7BC4\u56F2\u306E\u5916\u306F\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002",incompleteDetail:"\u8A3C\u660E\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u306E\u4E3B\u5F35\u306F\u307E\u3060\u4FDD\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",planned:"\u8A3C\u660E\u4E88\u5B9A",plannedDetail:"\u307E\u3060\u8A3C\u660E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u3053\u308C\u304B\u3089\u8A3C\u660E\u3059\u308B\u6027\u8CEA\u3068\u3057\u3066\u3001\u5408\u610F\u3092\u3068\u308B\u305F\u3081\u306E\u6848\u3067\u3059\u3002",target:"\u5BFE\u8C61",noClaims:"\u307E\u3060\u4E3B\u5F35\u304C\u3042\u308A\u307E\u305B\u3093\u3002",assumptions:"\u4EEE\u5B9A",bound:"\u78BA\u8A8D\u3057\u305F\u7BC4\u56F2",gaps:"\u7D42\u308F\u3063\u3066\u3044\u306A\u3044\u90E8\u5206",commentOn:a=>`${a}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-template-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),F=S(u(),Me(),M(1)),he=q({id:ne,text:F}),dr=Xe("kind",[q({kind:Z("proved"),assumptions:f(z(F))}),q({kind:Z("bounded"),bound:F}),q({kind:Z("incomplete"),gaps:f(z(F))}),q({kind:Z("planned")})]),lr=q({id:ne,target:f(ne),statement:F,subjects:f(z(he)),premises:f(z(he)),conclusions:S(z(he),M(1,"a claim needs at least one conclusion")),examples:f(z(he)),notClaimed:f(z(he)),assurance:dr,source:f(q({tool:f(F),ref:F}))}),cr=q({id:ne,name:F,meaning:F}),pr=q({id:ne,name:F,code:f(F),summary:f(F)}),hr=q({targets:f(z(pr)),terms:f(z(cr)),claims:z(lr)}),ur=()=>({targets:[],terms:[],claims:[]}),mr=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,gr=(a,e)=>{const t=[];let s=0;for(const n of a.matchAll(mr)){const r=(n[1]??"").trim(),i=e.get(r);if(i===void 0)throw new Error(`unknown term reference: [[${r}]]`);n.index>s&&t.push({kind:"text",text:a.slice(s,n.index)}),t.push({kind:"term",id:r,label:n[2]?.trim()||i}),s=n.index+n[0].length}return s<a.length&&t.push({kind:"text",text:a.slice(s)}),t},Ue=a=>a.map(e=>e.kind==="text"?e.text:e.label).join(""),fr=a=>[...new Set(a.flatMap(e=>e.flatMap(t=>t.kind==="term"?[t.id]:[])))],ve=(a,e)=>{const t=new Set;for(const s of a){if(t.has(s))throw new Error(`duplicate ${e} id: ${s}`);t.add(s)}},ys=a=>{const e=G(hr,a),t=e.targets??[],s=e.terms??[];ve(t.map(c=>c.id),"target"),ve(s.map(c=>c.id),"term"),ve(e.claims.map(c=>c.id),"claim");const n=new Map(s.map(c=>[c.id,c.name])),r=c=>gr(c,n),i=s.map(c=>({id:c.id,name:c.name,meaning:r(c.meaning)})),o=t.map(c=>({id:c.id,name:c.name,code:c.code??null,summary:c.summary===void 0?null:r(c.summary)})),d=new Set(o.map(c=>c.id)),l=e.claims.map(c=>{if(c.target!==void 0&&!d.has(c.target))throw new Error(`unknown target (in claim ${c.id}): ${c.target}`);const g=T=>(T??[]).map(j=>({id:j.id,text:r(j.text)})),p=g(c.subjects),k=g(c.premises),x=g(c.conclusions),v=g(c.examples),y=g(c.notClaimed),w=[...p,...k,...x,...v,...y];ve(w.map(T=>T.id),`clause (in claim ${c.id})`);const D=br(c.assurance,r),L=r(c.statement);return{id:c.id,target:c.target??null,statement:L,subjects:p,premises:k,conclusions:x,examples:v,notClaimed:y,assurance:D,source:c.source===void 0?null:{tool:c.source.tool??null,ref:c.source.ref},terms:fr([L,...w.map(T=>T.text),...kr(D)])}});return{targets:o,terms:i,claims:l}},br=(a,e)=>{switch(a.kind){case"proved":return{kind:"proved",assumptions:(a.assumptions??[]).map(e)};case"bounded":return{kind:"bounded",bound:e(a.bound)};case"incomplete":return{kind:"incomplete",gaps:(a.gaps??[]).map(e)};case"planned":return{kind:"planned"}}},kr=a=>{switch(a.kind){case"proved":return a.assumptions;case"bounded":return[a.bound];case"incomplete":return a.gaps;case"planned":return[]}},xr=a=>{const e={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const t of a.claims)e[ws(t.assurance)?"conditional":t.assurance.kind]+=1;return e},ws=a=>a.kind==="proved"&&a.assumptions.length>0,$s=a=>{const e=new Map(a.targets.map(s=>[s.id,s])),t=new Map;for(const s of a.claims)t.set(s.target,[...t.get(s.target)??[],s]);for(const s of a.targets)t.has(s.id)||t.set(s.id,[]);return[...t].map(([s,n])=>({target:s===null?null:e.get(s)??null,claims:n}))},ue=(a,e)=>e.length===0?{itemsLabel:null,items:e}:{itemsLabel:a,items:e},He=(a,e)=>{switch(e.kind){case"proved":return ws(e)?{tone:"caveat",label:a.conditional,detail:a.conditionalDetail,...ue(a.assumptions,e.assumptions)}:{tone:"sound",label:a.proved,detail:a.provedDetail,...ue("",[])};case"bounded":return{tone:"caveat",label:a.bounded,detail:a.boundedDetail,...ue(a.bound,[e.bound])};case"incomplete":return{tone:"unsound",label:a.incomplete,detail:a.incompleteDetail,...ue(a.gaps,e.gaps)};case"planned":return{tone:"planned",label:a.planned,detail:a.plannedDetail,...ue("",[])}}},vr=a=>{switch(a.kind){case"target":return["target",a.target];case"claim":return["claim",a.claim];case"clause":return["clause",a.claim,a.clause]}},yr=a=>[...a.subjects,...a.premises,...a.conclusions,...a.examples,...a.notClaimed],Ss=32,ye=a=>{const e=Ue(a.statement);return e.length<=Ss?e:`${e.slice(0,Ss).trimEnd()}\u2026`},wr=a=>[{target:{kind:"claim",claim:a.id},label:ye(a)},...yr(a).map(e=>({target:{kind:"clause",claim:a.id,clause:e.id},label:`${ye(a)} \u203A ${Ue(e.text)}`}))],$r=a=>$s(a).flatMap(e=>[...e.target===null?[]:[{target:{kind:"target",target:e.target.id},label:e.target.name}],...e.claims.flatMap(wr)]),Sr=[_e,Be,Ge,B`
|
|
2930
2930
|
:host {
|
|
2931
2931
|
display: block;
|
|
2932
2932
|
container-type: inline-size;
|
|
@@ -3469,7 +3469,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs
|
|
|
3469
3469
|
font-size: 11px;
|
|
3470
3470
|
color: var(--dpk-accent);
|
|
3471
3471
|
}
|
|
3472
|
-
`],Ms=a=>`claim-body-${a}`;class Cs extends Ye{static{this.styles=Sr}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#e=null;#s=new Map;#a=null;#t=null;#n="";#r=null;#i=null;#o=new Map;#c=null;#u=new Set;#l=null;#p=null;#h=new
|
|
3472
|
+
`],Ms=a=>`claim-body-${a}`;class Cs extends Ye{static{this.styles=Sr}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#e=null;#s=new Map;#a=null;#t=null;#n="";#r=null;#i=null;#o=new Map;#c=null;#u=new Set;#l=null;#p=null;#h=new Ve(this);#f=new We(this,()=>{this.#n=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#n="",document.addEventListener("keydown",this.#w),document.addEventListener("pointerdown",this.#S),this.#t=rt(this,ys,e=>{e.ok?this.#g(e.value):this.#b(e.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#w),document.removeEventListener("pointerdown",this.#S),this.#t?.(),this.#t=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#g(this.data)}updated(){this.#v(),this.#$(),this.#L()}get commentTargets(){if(!this.id||this.#e===null)return[];const e=`${this.subject??this.heading??this.#d.heading} \xB7 ${this.id}`;return $r(this.#e).map(({target:t,label:s})=>({value:this.#k(t),label:s,group:e}))}get dataError(){return this.#a}get#d(){return or(this.#f.locale)}#m(){return this.#e??ur()}#g(e){this.#e=e,this.#s=new Map(e.terms.map(t=>[t.id,t])),this.#a=null,this.requestUpdate()}#b(e){this.#e=null,this.#s=new Map,this.#a=e,console.error("[dev-process-kit] invalid formal spec data:",e),this.requestUpdate()}#k(e){return`element:${[this.id,...vr(e)].map(t=>encodeURIComponent(t)).join("/")}`}#v(){const e=JSON.stringify(this.commentTargets);e!==this.#n&&(this.#n=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#$(){const e=this.#i!==this.#r;this.#i=this.#r;const t=this.renderRoot.querySelector(".comment-pop"),s=this.#M(this.#r);!t||!s||(this.#h.open(t,s,{width:300,height:280},{placement:"right-start"}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}#M(e){return e===null?null:[...this.renderRoot.querySelectorAll("[data-comment-ref]")].find(t=>t.dataset.commentRef===e)??null}#A(e,t){if(t.kind==="input"){this.#o=new Map(this.#o).set(e,t.body),this.#c=null,this.requestUpdate();return}if(t.kind==="comment"){if(!!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:e,body:t.body},bubbles:!0,composed:!0,cancelable:!0}))){this.#c=e,this.requestUpdate();return}const r=new Map(this.#o);r.delete(e),this.#o=r}this.#c=null;const s=this.#M(e);this.#r=null,this.requestUpdate(),s?.focus({preventScroll:!0})}#C(e){const t=new Set(this.#u);if(t.delete(e)||t.add(e),this.#u=t,!t.has(e)){const s=this.#k({kind:"clause",claim:e,clause:""});this.#r?.startsWith(s)&&(this.#r=null);const n=this.#l?.anchor;n?.closest(".claim-body")?.id===Ms(e)&&this.#x(n)}this.requestUpdate()}#E(e,t){const s=e.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#C(t)}#L(){const e=this.#l?.anchor??null,t=this.#p!==e;t&&(this.#p?.removeAttribute("aria-describedby"),e?.setAttribute("aria-describedby","spec-tip")),this.#p=e;const s=this.renderRoot.querySelector(".spec-tip");!s||!e||!t||this.#h.open(s,e,{width:300,height:240},{placement:"top-start"})}#q(e,t){this.#l?.anchor!==t&&(this.#l={tip:e,anchor:t},this.requestUpdate())}#x(e){this.#l===null||e!==void 0&&this.#l.anchor!==e||(this.#l=null,this.requestUpdate())}#w=e=>{e.key==="Escape"&&this.#x()};#S=e=>{this.#l!==null&&!e.composedPath().includes(this.#l.anchor)&&this.#x()};#z(e){const t=(n,r)=>{n.currentTarget instanceof HTMLElement&&r(n.currentTarget)},s=n=>n.pointerType!=="touch";return{enter:n=>s(n)&&t(n,r=>this.#q(e,r)),leave:n=>s(n)&&t(n,r=>this.#x(r)),show:n=>t(n,r=>this.#q(e,r)),hide:n=>t(n,r=>this.#x(r))}}render(){const e=this.#d,t=this.#m();return h`
|
|
3473
3473
|
<section class="spec">
|
|
3474
3474
|
<header class="spec-toolbar">
|
|
3475
3475
|
<span class="spec-title">${this.heading??e.heading}</span>
|
|
@@ -3506,7 +3506,7 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs
|
|
|
3506
3506
|
aria-label=${n?t.hideDetails:t.showDetails}
|
|
3507
3507
|
@click=${()=>this.#C(e.id)}
|
|
3508
3508
|
>
|
|
3509
|
-
${
|
|
3509
|
+
${Ze()}
|
|
3510
3510
|
</button>
|
|
3511
3511
|
<h4 class="claim-statement">${this.#T(e.statement)}</h4>
|
|
3512
3512
|
<button
|
|
@@ -3594,5 +3594,5 @@ import{a0 as _,Z as _e,j as Be,a1 as Ge,a2 as B,a3 as b,a4 as h,a5 as J,a6 as zs
|
|
|
3594
3594
|
aria-expanded=${this.#r===s?"true":"false"}
|
|
3595
3595
|
@click=${()=>{this.#r=this.#r===s?null:s,this.requestUpdate()}}
|
|
3596
3596
|
>
|
|
3597
|
-
${
|
|
3598
|
-
</button>`}#B(){const e=this.#r,t=e===null?void 0:this.commentTargets.find(n=>n.value===e)?.label;if(e===null||t===void 0)return b;const s=tt(this.#o.get(e)??"",[],{label:t,key:e,...this.#c===e?{error:this.#d.sendFailed}:{}});return h`${
|
|
3597
|
+
${Ke()}
|
|
3598
|
+
</button>`}#B(){const e=this.#r,t=e===null?void 0:this.commentTargets.find(n=>n.value===e)?.label;if(e===null||t===void 0)return b;const s=tt(this.#o.get(e)??"",[],{label:t,key:e,...this.#c===e?{error:this.#d.sendFailed}:{}});return h`${et(e,st(at(this.#f.locale),s,n=>this.#A(e,n)))}`}}const Es=()=>{customElements.get("dpk-component-formal-spec")||customElements.define("dpk-component-formal-spec",Cs)},qs=()=>{wt(),Dt(),Lt(),Kt(),Qt(),us(),vs()},Mr=()=>{Fs(),Ns(),qs(),Es()};export{Zt as D,At as a,Wt as b,Cs as c,xs as d,hs as e,zt as f,yt as g,Qt as h,Lt as i,Kt as j,Es as k,vs as l,us as m,Dt as n,wt as o,ys as p,ms as q,Mr as r,os as s,Ct as t,vt as u,qs as v};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,af as C,ac as xe,R as O,a0 as me,V as we,a4 as s,a5 as F,a3 as p,ap as P,a2 as ye,T as G,aI as $e,aJ as Te}from"./shared-CSC14I4g.js";import{r as Se}from"./shared-BDUe3aT-.js";import{s as Re}from"./shared-D4K7KsfJ.js";import{c as B}from"./shared-ml5h7U5L.js";const Ae=N("kind",[f({kind:T("option"),optionId:v(c(),x(1))}),f({kind:T("free"),text:c()}),f({kind:T("clear")})]),E={ANSWER_QUESTION:ke("ANSWER_QUESTION","question",Ae)},H=(t,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:t},payload:e}),Ce=f({id:v(c(),x(1)),label:v(c(),x(1))}),M=f({id:v(c(),x(1)),ref:k(v(c(),x(1))),title:v(c(),x(1)),description:k(c()),note:k(c()),options:k(C(Ce),[]),freeText:k(ve(),!0)}),Ee=N("kind",[f({kind:T("option"),optionId:v(c(),x(1))}),f({kind:T("free"),text:c()})]),qe=f({...M.entries,answer:k(Ee)}),Ie=f({label:k(v(c(),x(1))),questions:C(qe)}),_=f({title:k(c(),""),questions:C(M),history:k(C(Ie),[])}),U=t=>{const e=new Set;return t.map((r,i)=>{if(e.has(r.id))throw new Error(`duplicate question id: ${r.id}`);e.add(r.id);const n=new Set;for(const a of r.options){if(n.has(a.id))throw new Error(`duplicate option id: ${a.id} in question ${r.id}`);n.add(a.id)}return{...r,ref:r.ref??`Q${i+1}`,description:r.description??null,note:r.note??null}})},W=t=>({id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,options:t.options,freeText:t.freeText}),Qe=t=>{const e=t.answer??null;if(e?.kind==="option"&&!t.options.some(r=>r.id===e.optionId))throw new Error(`unknown option id: ${e.optionId} in question ${t.id}`);return{...W(t),answer:e}},j=t=>{const e=xe(_,t);return{title:e.title,questions:U(e.questions).map(W),answers:{},pastRounds:e.history.map((r,i)=>({label:r.label??`v${i+1}`,questions:U(r.questions).map(Qe)}))}},D=()=>({title:"",questions:[],answers:{},pastRounds:[]}),m=(t,e)=>t.questions.find(r=>r.id===e),ze=(t,e)=>m(t,e)?.ref??e,z=(t,e)=>{const r=m(t,e);return r?`${r.ref} \xB7 ${r.title}`:e},S=(t,e)=>e?e.kind==="option"?t.options.find(r=>r.id===e.optionId)?.label??"":e.text.trim():"",q=(t,e)=>S(t,e)!=="",Y=t=>{let e="";for(let r=t+1;r>0;r=Math.floor((r-1)/26))e=String.fromCharCode(97+(r-1)%26)+e;return e},V=t=>({total:t.questions.length,answered:t.questions.filter(e=>q(e,t.answers[e.id])).length}),I=(t,e,r)=>{const i=t.answers[e];if(r===null){if(i===void 0)return t;const n={...t.answers};return delete n[e],{...t,answers:n}}return i?.kind===r.kind&&(i.kind==="option"&&r.kind==="option"&&i.optionId===r.optionId||i.kind==="free"&&r.kind==="free"&&i.text===r.text)?t:{...t,answers:{...t.answers,[e]:r}}},K=(t,e)=>{if(e.type!=="ANSWER_QUESTION")return null;const r=m(t,e.target.id);if(!r)return null;const i=O(E.ANSWER_QUESTION,e);return i.kind==="clear"?I(t,r.id,null):i.kind==="option"?r.options.some(n=>n.id===i.optionId)?I(t,r.id,{kind:"option",optionId:i.optionId}):null:I(t,r.id,{kind:"free",text:i.text})},R=me({en:{wholePage:"Whole page",questionGroup:"Question",answerCleared:"Clear answer",answered:"Answer",answeredFreely:"Answer in your own words",quoted:t=>`\u2192 \u201C${t}\u201D`,progress:(t,e)=>`${t} of ${e} answered`,openPanel:"Show questions / review",closePanel:"Hide questions / review",toggleLabel:(t,e)=>`${t} (${e})`,tabs:"Questions / review",questionsTab:"Questions",reviewTab:"Review",copied:"Copied",copyFailed:"Could not copy",copyAll:"Copy answers and review",sending:"Sending\u2026",sent:"Sent to Claude",sendFailed:"Could not send",sendAll:"Send answers and review to Claude",copyDone:"Copied",copy:"Copy",noQuestions:"No matching questions.",freeText:"Your own answer",freeTextOf:t=>`Your own answer to ${t}`,freeTextPlaceholder:"Type an answer\u2026 (\u2318/Ctrl+Enter for next)",clearAnswer:"Clear answer",roundSelect:"Question round",currentRound:"Current questions",roundOption:(t,e)=>`${t} (${e})`,pastRound:t=>`${t}: earlier questions, read-only`,unanswered:"Not answered"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",questionGroup:"\u8CEA\u554F",answerCleared:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",answered:"\u56DE\u7B54",answeredFreely:"\u81EA\u7531\u8A18\u8FF0\u3067\u56DE\u7B54",quoted:t=>`\u2192 \u300C${t}\u300D`,progress:(t,e)=>`\u56DE\u7B54\u6E08\u307F ${t} / ${e}`,openPanel:"\u8CEA\u554F / Review \u3092\u3072\u3089\u304F",closePanel:"\u8CEA\u554F / Review \u3092\u305F\u305F\u3080",toggleLabel:(t,e)=>`${t}\uFF08${e}\uFF09`,tabs:"\u8CEA\u554F / Review",questionsTab:"\u8CEA\u554F",reviewTab:"Review",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F",copyAll:"\u56DE\u7B54\u30FBReview \u3092\u307E\u3068\u3081\u3066\u30B3\u30D4\u30FC",sending:"\u9001\u4FE1\u4E2D\u2026",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F",sendFailed:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",sendAll:"\u56DE\u7B54\u30FBReview \u3092 Claude \u306B\u9001\u308B",copyDone:"\u30B3\u30D4\u30FC\u6E08\u307F",copy:"\u30B3\u30D4\u30FC",noQuestions:"\u8A72\u5F53\u3059\u308B\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3002",freeText:"\u81EA\u7531\u8A18\u8FF0",freeTextOf:t=>`${t} \u306E\u81EA\u7531\u8A18\u8FF0`,freeTextPlaceholder:"\u56DE\u7B54\u3092\u5165\u529B\u2026\uFF08\u2318/Ctrl+Enter \u3067\u6B21\u3078\uFF09",clearAnswer:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",roundSelect:"\u8CEA\u554F\u306E\u30E9\u30A6\u30F3\u30C9",currentRound:"\u73FE\u5728\u306E\u8CEA\u554F",roundOption:(t,e)=>`${t}\uFF08${e} \u554F\uFF09`,pastRound:t=>`${t}: \u904E\u53BB\u306E\u8CEA\u554F\uFF08\u95B2\u89A7\u306E\u307F\uFF09`,unanswered:"\u672A\u56DE\u7B54"}}),J=t=>t.title===""?"Visually Grill":t.title,X=(t,e,r)=>{switch(r.type){case"question":return z(e,r.id);case"page":return t.wholePage;default:return r.id}},Le=(t,e,r)=>{const i=O(E.ANSWER_QUESTION,r);if(i.kind==="clear")return{title:t.answerCleared,tone:"delete"};if(i.kind==="option"){const n=m(e,r.target.id)?.options.find(a=>a.id===i.optionId);return{title:t.answered,tone:"update",body:t.quoted(n?.label??i.optionId)}}return{title:t.answeredFreely,tone:"update",body:t.quoted(i.text.slice(0,120))}},Z=(t,e,r,i)=>{let n;try{n=Le(t,i??r,e)}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:X(t,r,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},ee=t=>`${t.type} ${we(t.target)} ${JSON.stringify(t.payload)}`,te=(t,e)=>e.questions.map(r=>({value:`question:${r.id}`,label:z(e,r.id),group:t.questionGroup})),re=(t,e)=>{const r=e.question;if(r!==void 0&&m(t,r))return e;const i=t.questions[0];return i===void 0?e:{...e,question:i.id}},ie=(t,e)=>{const r=e.question;return r!==void 0&&m(t,r)?r:t.questions[0]?.id??null},Ne=(t,e)=>{const r=t.questions,i=r.findIndex(a=>a.id===e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(a=>!q(a,t.answers[a.id]))?.id??null},ne=(t,e)=>t.options.map((r,i)=>({id:r.id,letter:Y(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),Oe=(t,e,r)=>{const i=e.answers[t.id];return{id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,open:t.id===r,answered:S(t,i)!=="",summary:S(t,i),choices:ne(t,i),draft:i?.kind==="free"?i.text:"",freeSelected:i?.kind==="free",allowFreeText:t.freeText}},ae=(t,e)=>{const r=ie(t,e);return{questions:t.questions.map(i=>Oe(i,t,r))}},oe=(t,e)=>{const r=V(e);return{progress:t.progress(r.answered,r.total),answered:r.answered,total:r.total}},se=(t,e)=>e!=="current"&&t.pastRounds[e]!==void 0?e:"current",Fe=(t,e,r)=>{if(e.pastRounds.length===0)return[];const i=se(e,r),n=e.pastRounds.map((a,o)=>({value:String(o),label:t.roundOption(a.label,a.questions.length),selected:i===o}));return[{value:"current",label:t.roundOption(t.currentRound,e.questions.length),selected:i==="current"},...[...n].reverse()]},Pe=(t,e,r)=>{const i=e.pastRounds[r];return i===void 0?null:{label:i.label,questions:i.questions.map(n=>{const a=n.answer??void 0,o=S(n,a);return{id:n.id,ref:n.ref,title:n.title,description:n.description,note:n.note,answered:o!=="",summary:o===""?t.unanswered:o,choices:ne(n,a),freeText:a?.kind==="free"?a.text:null}})}},le=(t,e)=>{switch(e.type){case"question":return m(t,e.id)!==void 0;case"page":return!0;default:return!1}},de=t=>{const e=R(t);return{name:"grill",label:"Visually Grill",parseBase:j,emptyBase:D,actions:E,apply:K,hasTarget:le,describe:(r,i,n)=>Z(e,r,i,n),serialize:ee,resolveNavigation:re,commentTargets:r=>te(e,r),title:J}},Ge=5,L=4,pe=8,Be=(t,e)=>{const r=e.badgeHeight,i=t.target.right+pe,n=t.target.left-pe,a=[];let o=0,l=i;for(let u=t.widths.length-1;u>=0;u-=1){const g=t.widths[u]??0;l!==i&&l-g<n&&(o+=1,l=i),a[u]={x:l-g,y:t.target.top-r/2-o*(r+L)},l-=g+Ge}return a},ce=(t,e)=>{const r=t.map(()=>[]),i=Re(t.map((a,o)=>({group:a,index:o})).filter(({group:a})=>a.gutter),[({group:a})=>a.target.top]);let n=Number.NEGATIVE_INFINITY;for(const{group:a,index:o}of i){let l=Math.max(a.target.top,n);r[o]=a.widths.map(u=>{const g={x:e.width-u,y:l};return l+=e.badgeHeight+L,g}),n=l}return{points:r,bottom:n-L}},He=(t,e)=>Math.max(0,ce(t,e).bottom),Me=(t,e)=>{const r=ce(t,e),i=Math.max(e.height,r.bottom);return t.map((n,a)=>(n.gutter?r.points[a]??[]:Be(n,e)).map((o,l)=>({x:B(o.x,0,Math.max(0,e.width-(n.widths[l]??0))),y:B(o.y,0,Math.max(0,i-e.badgeHeight))})))},A="data-grill-questions",_e=t=>{const e=[t];for(const r of t.querySelectorAll("*"))r.shadowRoot&&e.push(r.shadowRoot);return e},ge=(t,e,r)=>{const i=r.question??e.questions[0]?.id??null,n=new Map(e.questions.map(o=>[o.ref,o])),a=[];for(const o of _e(t))for(const l of o.querySelectorAll(`[${A}]`)){const u=l.getAttribute(A)??"";for(const g of u.split(/\s+/)){if(g==="")continue;const h=n.get(g);h&&a.push({index:a.length,target:l,questionId:h.id,ref:h.ref,title:h.title,answered:q(h,e.answers[h.id]),open:h.id===i})}}return a},ue=(t,e)=>{const r=t.getBoundingClientRect(),i=t.getRootNode(),n=i instanceof ShadowRoot?i.host:null,a=new Map;e.forEach((b,w)=>{const d=t.querySelector(`[data-label="${w}"]`);if(!d)return;const y=a.get(b.target)??[];y.push(d),a.set(b.target,y)});const o=[];for(const[b,w]of a){const d=b.getBoundingClientRect(),y=Ue(b,t),$=(d.width>0||d.height>0)&&d.bottom>r.top&&d.top<r.bottom&&d.right>r.left&&d.left<r.right&&d.bottom>y.top&&d.top<y.bottom;for(const Q of w)Q.dataset.visible=String($);$&&o.push({buttons:w,group:{target:{left:d.left-r.left,top:d.top-r.top,right:d.right-r.left,bottom:d.bottom-r.top},widths:w.map(Q=>Q.offsetWidth),gutter:n?.contains(b)===!0}})}const l=o[0]?.buttons[0]?.offsetHeight??0,u=o.map(({group:b})=>b),g={width:t.clientWidth,height:t.clientHeight,badgeHeight:l},h=He(u,g);t.parentElement&&(t.parentElement.style.minHeight=h>0?`${Math.ceil(h)}px`:"");const fe=Me(u,{...g,height:Math.max(g.height,h)});o.forEach(({buttons:b},w)=>{b.forEach((d,y)=>{const $=fe[w]?.[y];$&&(d.style.transform=`translate(${$.x}px, ${$.y}px)`)})})},Ue=(t,e)=>{const r=t.getRootNode(),i=r instanceof ShadowRoot?r.host:null,n=i?.shadowRoot?.querySelector(".diagram-canvas")??null;return n instanceof Element?n.getBoundingClientRect():i instanceof Element?i.getBoundingClientRect():e.getBoundingClientRect()},We=(t,e,r)=>s`
|
|
1
|
+
import{p as ve,am as N,ae as f,aj as x,ak as m,ah as c,ao as T,af as k,ap as xe,ag as q,ad as me,R as O,a0 as we,V as F,a4 as s,a5 as P,a3 as p,aq as G,a2 as ye,T as B,aL as $e,aM as Te,aN as Se}from"./shared-rZQ5j0Kh.js";import{s as Re}from"./shared-D4K7KsfJ.js";import{c as H}from"./shared-ml5h7U5L.js";const Ae=N("kind",[f({kind:T("option"),optionId:x(c(),m(1))}),f({kind:T("free"),text:c()}),f({kind:T("clear")})]),C={ANSWER_QUESTION:ve("ANSWER_QUESTION","question",Ae)},M=(t,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:t},payload:e}),qe=f({id:x(c(),m(1)),label:x(c(),m(1))}),_=f({id:x(c(),m(1)),ref:k(x(c(),m(1))),title:x(c(),m(1)),description:k(c()),note:k(c()),options:k(q(qe),[]),freeText:k(xe(),!0)}),Ce=N("kind",[f({kind:T("option"),optionId:x(c(),m(1))}),f({kind:T("free"),text:c()})]),Ee=f({..._.entries,answer:k(Ce)}),Ie=f({label:k(x(c(),m(1))),questions:q(Ee)}),U=f({title:k(c(),""),questions:q(_),history:k(q(Ie),[])}),W=t=>{const e=new Set;return t.map((r,i)=>{if(e.has(r.id))throw new Error(`duplicate question id: ${r.id}`);e.add(r.id);const n=new Set;for(const a of r.options){if(n.has(a.id))throw new Error(`duplicate option id: ${a.id} in question ${r.id}`);n.add(a.id)}return{...r,ref:r.ref??`Q${i+1}`,description:r.description??null,note:r.note??null}})},j=t=>({id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,options:t.options,freeText:t.freeText}),Qe=t=>{const e=t.answer??null;if(e?.kind==="option"&&!t.options.some(r=>r.id===e.optionId))throw new Error(`unknown option id: ${e.optionId} in question ${t.id}`);return{...j(t),answer:e}},D=t=>{const e=me(U,t);return{title:e.title,questions:W(e.questions).map(j),answers:{},pastRounds:e.history.map((r,i)=>({label:r.label??`v${i+1}`,questions:W(r.questions).map(Qe)}))}},Y=()=>({title:"",questions:[],answers:{},pastRounds:[]}),v=(t,e)=>t.questions.find(r=>r.id===e),ze=(t,e)=>v(t,e)?.ref??e,z=(t,e)=>{const r=v(t,e);return r?`${r.ref} \xB7 ${r.title}`:e},S=(t,e)=>e?e.kind==="option"?t.options.find(r=>r.id===e.optionId)?.label??"":e.text.trim():"",E=(t,e)=>S(t,e)!=="",V=t=>{let e="";for(let r=t+1;r>0;r=Math.floor((r-1)/26))e=String.fromCharCode(97+(r-1)%26)+e;return e},K=t=>({total:t.questions.length,answered:t.questions.filter(e=>E(e,t.answers[e.id])).length}),I=(t,e,r)=>{const i=t.answers[e];if(r===null){if(i===void 0)return t;const n={...t.answers};return delete n[e],{...t,answers:n}}return i?.kind===r.kind&&(i.kind==="option"&&r.kind==="option"&&i.optionId===r.optionId||i.kind==="free"&&r.kind==="free"&&i.text===r.text)?t:{...t,answers:{...t.answers,[e]:r}}},J=(t,e)=>{if(e.type!=="ANSWER_QUESTION")return null;const r=v(t,e.target.id);if(!r)return null;const i=O(C.ANSWER_QUESTION,e);return i.kind==="clear"?I(t,r.id,null):i.kind==="option"?r.options.some(n=>n.id===i.optionId)?I(t,r.id,{kind:"option",optionId:i.optionId}):null:I(t,r.id,{kind:"free",text:i.text})},R=we({en:{wholePage:"Whole page",questionGroup:"Question",answerCleared:"Clear answer",answered:"Answer",answeredFreely:"Answer in your own words",quoted:t=>`\u2192 \u201C${t}\u201D`,progress:(t,e)=>`${t} of ${e} answered`,openPanel:"Show questions / review",closePanel:"Hide questions / review",toggleLabel:(t,e)=>`${t} (${e})`,tabs:"Questions / review",questionsTab:"Questions",reviewTab:"Review",copied:"Copied",copyFailed:"Could not copy",copyAll:"Copy answers and review",sending:"Sending\u2026",sent:"Sent to Claude",sendFailed:"Could not send",sendAll:"Send answers and review to Claude",copyDone:"Copied",copy:"Copy",noQuestions:"No matching questions.",freeText:"Your own answer",freeTextOf:t=>`Your own answer to ${t}`,freeTextPlaceholder:"Type an answer\u2026 (\u2318/Ctrl+Enter for next)",clearAnswer:"Clear answer",roundSelect:"Question round",currentRound:"Current questions",roundOption:(t,e)=>`${t} (${e})`,pastRound:t=>`${t}: earlier questions, read-only`,unanswered:"Not answered"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",questionGroup:"\u8CEA\u554F",answerCleared:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",answered:"\u56DE\u7B54",answeredFreely:"\u81EA\u7531\u8A18\u8FF0\u3067\u56DE\u7B54",quoted:t=>`\u2192 \u300C${t}\u300D`,progress:(t,e)=>`\u56DE\u7B54\u6E08\u307F ${t} / ${e}`,openPanel:"\u8CEA\u554F / Review \u3092\u3072\u3089\u304F",closePanel:"\u8CEA\u554F / Review \u3092\u305F\u305F\u3080",toggleLabel:(t,e)=>`${t}\uFF08${e}\uFF09`,tabs:"\u8CEA\u554F / Review",questionsTab:"\u8CEA\u554F",reviewTab:"Review",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F",copyAll:"\u56DE\u7B54\u30FBReview \u3092\u307E\u3068\u3081\u3066\u30B3\u30D4\u30FC",sending:"\u9001\u4FE1\u4E2D\u2026",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F",sendFailed:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",sendAll:"\u56DE\u7B54\u30FBReview \u3092 Claude \u306B\u9001\u308B",copyDone:"\u30B3\u30D4\u30FC\u6E08\u307F",copy:"\u30B3\u30D4\u30FC",noQuestions:"\u8A72\u5F53\u3059\u308B\u8CEA\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3002",freeText:"\u81EA\u7531\u8A18\u8FF0",freeTextOf:t=>`${t} \u306E\u81EA\u7531\u8A18\u8FF0`,freeTextPlaceholder:"\u56DE\u7B54\u3092\u5165\u529B\u2026\uFF08\u2318/Ctrl+Enter \u3067\u6B21\u3078\uFF09",clearAnswer:"\u56DE\u7B54\u3092\u30AF\u30EA\u30A2",roundSelect:"\u8CEA\u554F\u306E\u30E9\u30A6\u30F3\u30C9",currentRound:"\u73FE\u5728\u306E\u8CEA\u554F",roundOption:(t,e)=>`${t}\uFF08${e} \u554F\uFF09`,pastRound:t=>`${t}: \u904E\u53BB\u306E\u8CEA\u554F\uFF08\u95B2\u89A7\u306E\u307F\uFF09`,unanswered:"\u672A\u56DE\u7B54"}}),X=t=>t.title===""?"Visually Grill":t.title,Z=(t,e,r)=>{switch(r.type){case"question":return z(e,r.id);case"page":return t.wholePage;default:return r.id}},Le=(t,e,r)=>{const i=O(C.ANSWER_QUESTION,r);if(i.kind==="clear")return{title:t.answerCleared,tone:"delete"};if(i.kind==="option"){const n=v(e,r.target.id)?.options.find(a=>a.id===i.optionId);return{title:t.answered,tone:"update",body:t.quoted(n?.label??i.optionId)}}return{title:t.answeredFreely,tone:"update",body:t.quoted(i.text.slice(0,120))}},ee=(t,e,r,i)=>{let n;try{n=Le(t,i??r,e)}catch{n={title:e.type,tone:"meta"}}return{title:n.title,targetLabel:Z(t,r,e.target),tone:n.tone,...n.body===void 0?{}:{summary:n.body}}},te=t=>`${t.type} ${F(t.target)} ${JSON.stringify(t.payload)}`,re=(t,e)=>e.questions.map(r=>({value:`question:${r.id}`,label:z(e,r.id),group:t.questionGroup})),ie=(t,e)=>{const r=e.question;if(r!==void 0&&v(t,r))return e;const i=t.questions[0];return i===void 0?e:{...e,question:i.id}},ne=(t,e)=>{const r=e.question;return r!==void 0&&v(t,r)?r:t.questions[0]?.id??null},Ne=(t,e)=>{const r=t.questions,i=r.findIndex(a=>a.id===e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(a=>!E(a,t.answers[a.id]))?.id??null},ae=(t,e)=>t.options.map((r,i)=>({id:r.id,letter:V(i),label:r.label,checked:e?.kind==="option"&&e.optionId===r.id})),Oe=(t,e,r)=>{const i=e.answers[t.id];return{id:t.id,ref:t.ref,title:t.title,description:t.description,note:t.note,open:t.id===r,answered:S(t,i)!=="",summary:S(t,i),choices:ae(t,i),draft:i?.kind==="free"?i.text:"",freeSelected:i?.kind==="free",allowFreeText:t.freeText}},oe=(t,e)=>{const r=ne(t,e);return{questions:t.questions.map(i=>Oe(i,t,r))}},se=(t,e)=>{const r=K(e);return{progress:t.progress(r.answered,r.total),answered:r.answered,total:r.total}},le=(t,e)=>e!=="current"&&t.pastRounds[e]!==void 0?e:"current",Fe=(t,e,r)=>{if(e.pastRounds.length===0)return[];const i=le(e,r),n=e.pastRounds.map((a,o)=>({value:String(o),label:t.roundOption(a.label,a.questions.length),selected:i===o}));return[{value:"current",label:t.roundOption(t.currentRound,e.questions.length),selected:i==="current"},...[...n].reverse()]},Pe=(t,e,r)=>{const i=e.pastRounds[r];return i===void 0?null:{label:i.label,questions:i.questions.map(n=>{const a=n.answer??void 0,o=S(n,a);return{id:n.id,ref:n.ref,title:n.title,description:n.description,note:n.note,answered:o!=="",summary:o===""?t.unanswered:o,choices:ae(n,a),freeText:a?.kind==="free"?a.text:null}})}},de=(t,e)=>{switch(e.type){case"question":return v(t,e.id)!==void 0;case"page":return!0;default:return!1}},pe=t=>{const e=R(t);return{name:"grill",label:"Visually Grill",parseBase:D,emptyBase:Y,actions:C,apply:J,hasTarget:de,describe:(r,i,n)=>ee(e,r,i,n),serialize:te,resolveNavigation:ie,navigationFor:(r,i)=>i.type==="question"&&v(r,i.id)?{question:i.id}:null,commentTargets:r=>re(e,r),title:X}},Ge=5,L=4,ce=8,Be=(t,e)=>{const r=e.badgeHeight,i=t.target.right+ce,n=t.target.left-ce,a=[];let o=0,l=i;for(let u=t.widths.length-1;u>=0;u-=1){const g=t.widths[u]??0;l!==i&&l-g<n&&(o+=1,l=i),a[u]={x:l-g,y:t.target.top-r/2-o*(r+L)},l-=g+Ge}return a},ge=(t,e)=>{const r=t.map(()=>[]),i=Re(t.map((a,o)=>({group:a,index:o})).filter(({group:a})=>a.gutter),[({group:a})=>a.target.top]);let n=Number.NEGATIVE_INFINITY;for(const{group:a,index:o}of i){let l=Math.max(a.target.top,n);r[o]=a.widths.map(u=>{const g={x:e.width-u,y:l};return l+=e.badgeHeight+L,g}),n=l}return{points:r,bottom:n-L}},He=(t,e)=>Math.max(0,ge(t,e).bottom),Me=(t,e)=>{const r=ge(t,e),i=Math.max(e.height,r.bottom);return t.map((n,a)=>(n.gutter?r.points[a]??[]:Be(n,e)).map((o,l)=>({x:H(o.x,0,Math.max(0,e.width-(n.widths[l]??0))),y:H(o.y,0,Math.max(0,i-e.badgeHeight))})))},A="data-grill-questions",_e=t=>{const e=[t];for(const r of t.querySelectorAll("*"))r.shadowRoot&&e.push(r.shadowRoot);return e},ue=(t,e,r)=>{const i=r.question??e.questions[0]?.id??null,n=new Map(e.questions.map(o=>[o.ref,o])),a=[];for(const o of _e(t))for(const l of o.querySelectorAll(`[${A}]`)){const u=l.getAttribute(A)??"";for(const g of u.split(/\s+/)){if(g==="")continue;const h=n.get(g);h&&a.push({index:a.length,target:l,questionId:h.id,ref:h.ref,title:h.title,answered:E(h,e.answers[h.id]),open:h.id===i})}}return a},he=(t,e)=>{const r=t.getBoundingClientRect(),i=t.getRootNode(),n=i instanceof ShadowRoot?i.host:null,a=new Map;e.forEach((b,w)=>{const d=t.querySelector(`[data-label="${w}"]`);if(!d)return;const y=a.get(b.target)??[];y.push(d),a.set(b.target,y)});const o=[];for(const[b,w]of a){const d=b.getBoundingClientRect(),y=Ue(b,t),$=(d.width>0||d.height>0)&&d.bottom>r.top&&d.top<r.bottom&&d.right>r.left&&d.left<r.right&&d.bottom>y.top&&d.top<y.bottom;for(const Q of w)Q.dataset.visible=String($);$&&o.push({buttons:w,group:{target:{left:d.left-r.left,top:d.top-r.top,right:d.right-r.left,bottom:d.bottom-r.top},widths:w.map(Q=>Q.offsetWidth),gutter:n?.contains(b)===!0}})}const l=o[0]?.buttons[0]?.offsetHeight??0,u=o.map(({group:b})=>b),g={width:t.clientWidth,height:t.clientHeight,badgeHeight:l},h=He(u,g);t.parentElement&&(t.parentElement.style.minHeight=h>0?`${Math.ceil(h)}px`:"");const ke=Me(u,{...g,height:Math.max(g.height,h)});o.forEach(({buttons:b},w)=>{b.forEach((d,y)=>{const $=ke[w]?.[y];$&&(d.style.transform=`translate(${$.x}px, ${$.y}px)`)})})},Ue=(t,e)=>{const r=t.getRootNode(),i=r instanceof ShadowRoot?r.host:null,n=i?.shadowRoot?.querySelector(".diagram-canvas")??null;return n instanceof Element?n.getBoundingClientRect():i instanceof Element?i.getBoundingClientRect():e.getBoundingClientRect()},We=(t,e,r)=>s`
|
|
2
2
|
<div class="grill-list">
|
|
3
|
-
${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:
|
|
3
|
+
${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:P(e.questions,i=>i.id,i=>je(t,i,r))}
|
|
4
4
|
</div>
|
|
5
5
|
`,je=(t,e,r)=>s`
|
|
6
|
-
<section
|
|
6
|
+
<section
|
|
7
|
+
class="grill-question"
|
|
8
|
+
data-question=${e.id}
|
|
9
|
+
data-answered=${String(e.answered)}
|
|
10
|
+
data-dpk-target=${F({type:"question",id:e.id})}
|
|
11
|
+
>
|
|
7
12
|
<button
|
|
8
13
|
class="grill-heading"
|
|
9
14
|
type="button"
|
|
@@ -16,7 +21,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
16
21
|
<strong>${e.title}</strong>
|
|
17
22
|
${!e.open&&e.answered?s`<span class="grill-summary">${e.summary}</span>`:p}
|
|
18
23
|
</span>
|
|
19
|
-
<span class="grill-chevron" aria-hidden="true">${
|
|
24
|
+
<span class="grill-chevron" aria-hidden="true">${G()}</span>
|
|
20
25
|
</button>
|
|
21
26
|
${e.open?s`<div class="grill-body" id=${`grill-body-${e.id}`}>
|
|
22
27
|
${e.description?s`<p class="grill-description">${e.description}</p>`:p}
|
|
@@ -70,7 +75,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
70
75
|
`,Ye=(t,e)=>s`
|
|
71
76
|
<div class="grill-list">
|
|
72
77
|
<p class="grill-round-note">${t.pastRound(e.label)}</p>
|
|
73
|
-
${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:
|
|
78
|
+
${e.questions.length===0?s`<p class="grill-empty">${t.noQuestions}</p>`:P(e.questions,r=>r.id,r=>Ve(r))}
|
|
74
79
|
</div>
|
|
75
80
|
`,Ve=t=>s`
|
|
76
81
|
<details
|
|
@@ -84,7 +89,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
84
89
|
<strong>${t.title}</strong>
|
|
85
90
|
<span class="grill-summary">${t.summary}</span>
|
|
86
91
|
</span>
|
|
87
|
-
<span class="grill-chevron" aria-hidden="true">${
|
|
92
|
+
<span class="grill-chevron" aria-hidden="true">${G()}</span>
|
|
88
93
|
</summary>
|
|
89
94
|
<div class="grill-body">
|
|
90
95
|
${t.description?s`<p class="grill-description">${t.description}</p>`:p}
|
|
@@ -888,7 +893,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
888
893
|
outline: none;
|
|
889
894
|
box-shadow: var(--dpk-focus);
|
|
890
895
|
}
|
|
891
|
-
`;class
|
|
896
|
+
`;class be extends B{static{this.styles=[B.styles,Ke]}get sidebarLayout(){return{side:"right",defaultWidth:336,collapsible:!1}}definitionFor(e){return pe(e)}static{this.properties={tab:{state:!0},folded:{state:!0},round:{state:!0}}}#o=[];#s=!1;#a=null;#l=null;#r=null;#e="idle";#i=null;#n={kind:"idle"};constructor(){super(),this.tab="questions",this.folded=!1,this.round="current"}connectedCallback(){super.connectedCallback(),document.addEventListener("scroll",this.#t,!0),window.addEventListener("resize",this.#t),this.addEventListener("dpk-diagram-view",this.#t)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("scroll",this.#t,!0),window.removeEventListener("resize",this.#t),this.removeEventListener("dpk-diagram-view",this.#t),this.#r?.disconnect(),this.#r=null,this.#d()}renderRegions(e){return this.#o=ue(this,e.state,e.navigation),{header:this.#b(e),main:this.#m(e,this.#o),sidebar:this.#f(e),sidebarHidden:this.folded}}updated(){super.updated(),this.#T(),this.#t(),this.#S();const e=this.#l;e!==null&&(this.#l=null,this.renderRoot.querySelector(`[data-free-text="${e}"]`)?.focus())}get integratedReview(){return!0}requestComment(e){this.tab="review",this.folded=!1,super.requestComment(e)}showTarget(e){e.type==="question"&&(this.tab="questions",this.folded=!1,this.round="current")}#p(e,r){this.tab="questions",this.folded=!1,this.round="current",this.#a=null,e.navigate({question:r})}#b(e){const r=R(this.locale),i=se(r,e.state),n=r.toggleLabel(this.folded?r.openPanel:r.closePanel,i.progress);return s`
|
|
892
897
|
<button
|
|
893
898
|
type="button"
|
|
894
899
|
class="grill-toggle"
|
|
@@ -900,7 +905,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
900
905
|
<span class="grill-toggle-glyph" aria-hidden="true">?</span>
|
|
901
906
|
<span class="grill-toggle-badge" aria-hidden="true">${i.answered} / ${i.total}</span>
|
|
902
907
|
</button>
|
|
903
|
-
`}#f(e){const r=R(this.locale),i=
|
|
908
|
+
`}#f(e){const r=R(this.locale),i=le(e.state,this.round),n=Fe(r,e.state,i),a=i==="current"?null:Pe(r,e.state,i);return s`
|
|
904
909
|
<div class="grill-panel">
|
|
905
910
|
<div class="grill-tabs" role="tablist" aria-label=${r.tabs}>
|
|
906
911
|
${["questions","review"].map(o=>o==="questions"&&n.length>0?this.#v(r,n):s`
|
|
@@ -928,7 +933,7 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
928
933
|
aria-labelledby="grill-tab-questions"
|
|
929
934
|
?hidden=${this.tab!=="questions"}
|
|
930
935
|
>
|
|
931
|
-
${a===null?We(r,
|
|
936
|
+
${a===null?We(r,oe(e.state,e.navigation),{open:o=>this.#p(e,o),answer:(o,l)=>this.#w(o,l),next:o=>this.#g(o)}):Ye(r,a)}
|
|
932
937
|
</div>
|
|
933
938
|
<div
|
|
934
939
|
class="grill-tab-panel"
|
|
@@ -1030,4 +1035,4 @@ import{p as ke,al as N,ad as f,ai as v,aj as x,ag as c,an as T,ae as k,ao as ve,
|
|
|
1030
1035
|
`)}
|
|
1031
1036
|
</div>
|
|
1032
1037
|
</div>
|
|
1033
|
-
`}#w(e,r){if(this.dispatch(
|
|
1038
|
+
`}#w(e,r){if(this.dispatch(M(e,r)).ok){if(r.kind==="option"){this.#g(e);return}r.kind==="free"&&r.text===""&&(this.#l=e)}}#g(e){const r=Ne(this.derivation.state,e);r!==null&&this.navigate({question:r})}async#u(){const e=this.api.exportBrief(),r=await Te(e);this.#d(),this.#e=r?"copied":"failed",this.#h()}async#y(){this.#d(),this.#n={kind:"pending"},this.requestUpdate();const e=await this.sendToClaude();this.#n=e.ok?{kind:"sent"}:{kind:"failed",reason:e.reason},e.ok?this.#h():this.requestUpdate()}#h(){this.requestUpdate(),this.#i=setTimeout(()=>{this.#i=null,this.#e="idle",this.#n={kind:"idle"},this.requestUpdate()},2400)}#d(){this.#i!==null&&clearTimeout(this.#i),this.#i=null,this.#e="idle",this.#n={kind:"idle"}}#$(){this.requestUpdate()}#T(){this.#r?.disconnect(),this.#r??=new MutationObserver(()=>{this.#$(),this.#t()}),this.#r.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[A]});for(const e of this.querySelectorAll("*"))e===this||!e.shadowRoot||this.#r.observe(e.shadowRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[A]})}#t=()=>{this.#s||(this.#s=!0,requestAnimationFrame(()=>{this.#s=!1;const e=this.renderRoot.querySelector(".grill-labels");e&&he(e,this.#o)}))};#S(){const e=this.navigation.question??null;if(this.tab!=="questions"||this.round!=="current"||this.folded||e===null||e===this.#a)return;this.#a=e;const r=this.renderRoot.querySelector(`[data-question="${e}"]`),i=r?.closest(".grill-list");r&&i&&Se(i,r)}}const fe=()=>{customElements.get("dpk-template-grill")||customElements.define("dpk-template-grill",be)},Je=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplateGrill:be,GRILL_QUESTIONS_ATTRIBUTE:A,answerCounts:K,answerQuestion:M,answerText:S,applyGrillAction:J,collectLabelBindings:ue,defineGrillElement:fe,describeGrillAction:ee,emptyGrillBase:Y,findQuestion:v,grillActions:C,grillBaseSchema:U,grillCommentTargets:re,grillDefinitionFor:pe,grillHasTarget:de,grillMessages:R,grillTargetLabel:Z,grillTitle:X,isAnswered:E,openQuestionId:ne,optionLetter:V,parseGrillBase:D,positionLabels:he,presentGrillHeader:se,presentGrillPanel:oe,questionLabel:z,questionRef:ze,resolveGrillNavigation:ie,serializeGrillAction:te,withAnswer:I},Symbol.toStringTag,{value:"Module"}));export{fe as d,Je as i};
|