dev-process-kit 0.4.3 → 0.4.4

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.
Files changed (38) hide show
  1. package/README.md +1 -0
  2. package/dist/boards.js +1 -1
  3. package/dist/chunks/shared-B3ddPOb7.js +1 -0
  4. package/dist/chunks/shared-BEcs-9nd.js +6077 -0
  5. package/dist/chunks/{shared-BugVP_yn.js → shared-BIODquqM.js} +4 -4
  6. package/dist/chunks/{shared-tq8QsPTt.js → shared-BZ0Y7lDS.js} +41 -41
  7. package/dist/chunks/{shared-DJCdfkg-.js → shared-BncKaYRX.js} +1 -1
  8. package/dist/chunks/{shared-0HXwrPVn.js → shared-BqjrIOYm.js} +1 -1
  9. package/dist/chunks/shared-CaQMHNzp.js +3 -0
  10. package/dist/chunks/shared-Cd0znWBB.js +3545 -0
  11. package/dist/chunks/shared-Cuc_13rI.js +7378 -0
  12. package/dist/chunks/shared-D2yn0bY8.js +1883 -0
  13. package/dist/chunks/{shared-CeNV36-9.js → shared-D5_ZJTgh.js} +53 -53
  14. package/dist/chunks/shared-DDIKBRRU.js +1 -0
  15. package/dist/chunks/{shared-CxTKp5CX.js → shared-DbfVyq_3.js} +1 -1
  16. package/dist/chunks/{shared-D3Xm9wF8.js → shared-Dha4GwGq.js} +2 -2
  17. package/dist/chunks/shared-GVsZCCAa.js +4954 -0
  18. package/dist/chunks/{shared-CyOyXHQO.js → shared-IlpAgOtF.js} +1 -1
  19. package/dist/chunks/{shared-qLSu7C5m.js → shared-M5nBQyzE.js} +11 -11
  20. package/dist/chunks/{shared-BSEt0fN6.js → shared-lNnnWUPH.js} +14 -14
  21. package/dist/components.js +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/sync.js +1 -1
  24. package/dist/views/delegation-poker.js +1 -1
  25. package/dist/views/plain.js +1 -1
  26. package/dist/views/prototype.js +1 -1
  27. package/dist/views/slides.js +1 -1
  28. package/dist/views/task-board.js +1 -1
  29. package/dist/views/usm.js +1 -1
  30. package/package.json +1 -1
  31. package/dist/chunks/shared-B2F5LY6f.js +0 -1883
  32. package/dist/chunks/shared-B7MDu9J_.js +0 -6912
  33. package/dist/chunks/shared-C1sWnXGY.js +0 -1
  34. package/dist/chunks/shared-C2_qMOyi.js +0 -1
  35. package/dist/chunks/shared-CjWMknuE.js +0 -3645
  36. package/dist/chunks/shared-DCnxYUIB.js +0 -3
  37. package/dist/chunks/shared-DE09J93T.js +0 -5625
  38. package/dist/chunks/shared-Dxf3BUk6.js +0 -4192
@@ -1,4192 +0,0 @@
1
- import{ai as qt,a5 as h,ag as d,L as ye,ar as et,_ as D,a7 as A,O as L,i as J,a4 as _,a8 as O,aB as jn,A as we,aC as $e,aD as Fn,aE as Hn,al as U,aF as Ce,a6 as H,a3 as ht,af as Ut,aw as Se,u as $t,g as Wn,z as Bn,aG as Kn,aH as Ee,aI as Vn,aJ as Gn,aK as Jn,aL as Xn,aM as Yn,aN as Zn,t as Te,aO as Qn,aP as ta,aQ as ea,aR as sa,av as Nt,aS as na,aT as Ct,aU as Me,ak as aa,ax as ia,aV as ra,R as oa,S as la}from"./shared-DE09J93T.js";import{o as X,r as da}from"./shared-D4PPk0Dk.js";import{e as ca}from"./shared-CyOyXHQO.js";import{a as Ae,c as pa}from"./shared-0HXwrPVn.js";import{c as ha}from"./shared-CxTKp5CX.js";import{m as B,o as jt,k as g,I as ze,D as _e,x as Z,h as $,u as Ft,s as St,A as Le,j as b,B as P,n as st,q as x,v as y,H as Ht,w as S,C as Q,g as nt,z as Pe,l as at,y as Re,E as De,J as Oe,K as Wt,L as ua,G as Ie}from"./shared-DCnxYUIB.js";import{p as qe,i as ma,r as ga,c as Ue,a as fa,b as ba,d as Ne,e as je,f as ka,g as va,h as xa,j as Fe,k as ya,l as Bt,s as wa,m as $a,n as Ca,o as Sa,q as Ea,t as Ta}from"./shared-CeNV36-9.js";import{B as Ma,t as Aa,v as Kt,i as za,k as _a,j as La}from"./shared-BSEt0fN6.js";import{d as Pa}from"./shared-DJCdfkg-.js";class ut{#a;#t;#e=null;#n=null;#s=null;#i=null;#r=new Map;#o=null;constructor(t){this.#a=t,this.#t=new qt(t),t.addController(this)}get isOpen(){return this.#e!==null}open(t,e,s){this.#e=t,this.#s=e,this.#i=s??null,this.#o=null,this.#a.requestUpdate()}close(){this.#e=null,this.#s=null,this.#i=null,this.#a.requestUpdate()}hostDisconnected(){this.close()}sync(t){const e=this.#n!==this.#e;this.#n=this.#e,!(t===null||this.#s===null||this.#e===null)&&(this.#t.open(t,this.#s,{width:300,height:280},{placement:"right-start",trackTransform:!0}),e&&t.querySelector("textarea")?.focus({preventScroll:!0}))}render(t){const e=this.#e;if(e===null)return h;const s=qe(this.#r.get(e)??"",[],{...this.#i===null?{}:{label:this.#i},key:e,...this.#o===e&&t.errorMessage!==void 0?{error:t.errorMessage}:{}});return d`${ma(e,ga(Ue(t.locale),s,a=>this.#l(e,t.submit,a)))}`}#l(t,e,s){if(s.kind==="input"){this.#r=new Map(this.#r).set(t,s.body),this.#o=null,this.#a.requestUpdate();return}if(s.kind==="comment"){if(!e(t,s.body)){this.#o=t,this.#a.requestUpdate();return}const i=new Map(this.#r);i.delete(t),this.#r=i}this.#o=null,this.close()}}const Et=(n,t,e,s)=>{if(n===null)return null;const a=ye(n),i=t.find(r=>r.value===a);return i===void 0?null:{id:"review-comment",entries:[{kind:"item",id:"review-comment",label:e.reviewComment,run:()=>s(a,i.label)}]}},Tt=.08,He=1.8,We=n=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const t=Math.min(...n.map(i=>i.x)),e=Math.min(...n.map(i=>i.y)),s=Math.max(...n.map(i=>i.x+i.width))-t,a=Math.max(...n.map(i=>i.y+i.height))-e;return{x:t-s*.1,y:e-a*.1,width:s*1.2,height:a*1.2}},Be=(n,t)=>n+t/12,Ra=(n,t)=>{if(n.length===0)return null;const e=Math.min(...n.map(a=>a.y)),s=n.filter(a=>a.y<e+t);return{x:Math.min(...s.map(a=>a.x)),y:e}},Vt=16,Da=.8,Mt=(n,t,e,s,a)=>n==="start"?Vt-Be(t,e)*s:(a-e*s)/2-t*s,Ke=(n,t,e,s,a="center")=>{if(t.width===0||t.height===0)return{...n,x:0,y:0};const i=(r,o,l,c)=>{const p=l*n.scale,m=c*Da;if(p<=c){const f=Mt(a,o,l,n.scale,c);return et(r,f-m,f+m)}return et(r,c-(o+l)*n.scale-m,-o*n.scale+m)};return{...n,x:i(n.x,t.x,t.width,e),y:i(n.y,t.y,t.height,s)}},Oa=(n,t,e,s,a,i,r="center")=>{const o=Math.abs(i)>Math.abs(a);if(o&&t.height*n.scale<=s)return null;const l=Ke({...n,x:n.x-a,y:n.y-i},t,e,s,r);return o&&l.y===n.y?null:l},Ia=n=>Math.exp(-n*.01),Ve='button,[role="button"],a,input,textarea,select',Gt=(n,t,e)=>{for(const s of n.composedPath()){if(s===t)return null;if(s instanceof Element&&s.matches(e))return s}return null},qa=n=>{const{canvas:t,world:e,onClearSelection:s,onView:a,align:i="center",sizeWorld:r=!0}=n;let o={x:0,y:0,width:0,height:0},l={x:0,y:0,scale:1};const c=()=>({width:t.clientWidth||1e3,height:t.clientHeight||560}),p=()=>{const{width:u,height:k}=c();l=Ke(l,o,u,k,i),e.style.transform=`translate(${l.x}px, ${l.y}px) scale(${l.scale})`,e.style.setProperty("--dpk-zoom-inverse",String(1/l.scale)),e.style.setProperty("--dpk-zoom-scale",String(l.scale)),a?.(l)},m=()=>{const{width:u,height:k}=c(),w=o.width/1.2||1,C=o.height/1.2||1,T=et(Math.min((u-24)/w,(k-40)/C),Tt,1);l={scale:T,x:Mt(i,o.x,o.width,T,u),y:Mt(i,o.y,o.height,T,k)},p()},f=u=>{const{width:k,height:w}=c(),C=We([u]),T=C.width/1.2||1,q=C.height/1.2||1;l={...l,scale:et(Math.min((k-24)/T,(w-40)/q),Tt,He)},l={...l,x:(k-C.width*l.scale)/2-C.x*l.scale,y:(w-C.height*l.scale)/2-C.y*l.scale},p()},E=()=>{const{width:u}=c(),k=o.width/1.2||1,w=et((u-24)/k,Tt,1);l={scale:w,x:(u-o.width*w)/2-o.x*w,y:16},p()},R=u=>{const{width:k,height:w}=c(),C=(T,q,ve,xe)=>xe!==void 0?Vt-xe:q<=ve?Mt(i,T,q,1,ve):Vt-Be(T,q);l={scale:1,x:C(o.x,o.width,k,u?.x),y:C(o.y,o.height,w,u?.y)},p()},M=(u,k=c().width/2,w=c().height/2)=>{const C=l.scale,T=et(C*u,Tt,He);T!==C&&(l={scale:T,x:k-(k-l.x)*T/C,y:w-(w-l.y)*T/C},p())},Y=u=>{if(Gt(u,t,".diagram-zoom")!==null)return;const k=u.deltaMode===1?16:u.deltaMode===2?c().height:1;if(u.ctrlKey||u.metaKey){u.preventDefault();const q=t.getBoundingClientRect();M(Ia(u.deltaY),u.clientX-q.left,u.clientY-q.top);return}const{width:w,height:C}=c(),T=Oa(l,o,w,C,u.deltaX*k,u.deltaY*k,i);T!==null&&(u.preventDefault(),l=T,p())},I=new Map;let z=null,F=!1;const W=()=>{const u=[...I.values()],k=u[0];if(!k)return null;const w=u[1];return w?{x:(k.x+w.x)/2,y:(k.y+w.y)/2,distance:Math.hypot(w.x-k.x,w.y-k.y)}:{...k,distance:0}},ct=u=>{I.size===0&&(F=!1);const k=Gt(u,t,Ve);u.button!==0||u.pointerType!=="touch"&&k!==null||(I.set(u.pointerId,{x:u.clientX,y:u.clientY}),z=W(),k===null&&t.setPointerCapture(u.pointerId),u.pointerType!=="touch"&&k===null&&(u.preventDefault(),t.focus({preventScroll:!0})))},ue=u=>{if(!I.has(u.pointerId)||z===null)return;I.set(u.pointerId,{x:u.clientX,y:u.clientY});const k=W();if(k===null)return;const w=k.x-z.x,C=k.y-z.y;if((Math.abs(w)+Math.abs(C)>1||Math.abs(k.distance-z.distance)>1)&&(F=!0),k.distance>0&&z.distance>0){const T=t.getBoundingClientRect();M(Math.pow(k.distance/z.distance,.45),z.x-T.left,z.y-T.top)}l={...l,x:l.x+w,y:l.y+C},p(),z=k,t.classList.toggle("is-panning",F)},pt=u=>{I.delete(u.pointerId),z=W(),!(I.size>0)&&(t.classList.remove("is-panning"),u.type==="pointercancel"&&(F=!1))},me=u=>{F&&(u.preventDefault(),u.stopPropagation()),pt(u)},ge=u=>{if(F){u.preventDefault(),u.stopPropagation(),F=!1;return}!(u.target instanceof Element)||Gt(u,t,Ve)!==null||s()},fe=u=>{if(u.target!==t)return;const k=30;if(u.key==="+"||u.key==="=")M(1.1);else if(u.key==="-")M(1/1.1);else if(u.key==="0")m();else if(u.key==="Escape"){if(s()===!1)return}else if(u.key==="ArrowLeft"||u.key==="ArrowRight"||u.key==="ArrowUp"||u.key==="ArrowDown")l={...l,x:l.x+(u.key==="ArrowLeft"?k:u.key==="ArrowRight"?-k:0),y:l.y+(u.key==="ArrowUp"?k:u.key==="ArrowDown"?-k:0)},p();else return;u.preventDefault()},be=u=>{const k=u.target instanceof HTMLElement?u.target:null;if(k===null||!u.composedPath().includes(e))return;const w=k.getBoundingClientRect(),C=t.getBoundingClientRect();let T=0,q=0;w.left<C.left+12?T=C.left+12-w.left:w.right>C.right-12&&(T=C.right-12-w.right),w.top<C.top+12?q=C.top+12-w.top:w.bottom>C.bottom-40&&(q=C.bottom-40-w.bottom),!(T===0&&q===0)&&(l={...l,x:l.x+T,y:l.y+q},p())};t.addEventListener("wheel",Y,{passive:!1}),t.addEventListener("pointerdown",ct),t.addEventListener("pointermove",ue),t.addEventListener("pointerup",me),t.addEventListener("pointercancel",pt),t.addEventListener("lostpointercapture",pt),t.addEventListener("click",ge,!0),t.addEventListener("keydown",fe),t.addEventListener("focusin",be);const ke=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>p());return ke?.observe(t),{setContent(u){o=We(u.width===0&&u.height===0?[]:[u]),r&&(e.style.width=`${u.width}px`,e.style.height=`${u.height}px`),p()},apply:p,fit:m,fitTo:f,fitWidth:E,reset:R,zoom:M,view:()=>({...l}),destroy(){ke?.disconnect(),t.removeEventListener("wheel",Y),t.removeEventListener("pointerdown",ct),t.removeEventListener("pointermove",ue),t.removeEventListener("pointerup",me),t.removeEventListener("pointercancel",pt),t.removeEventListener("lostpointercapture",pt),t.removeEventListener("click",ge,!0),t.removeEventListener("keydown",fe),t.removeEventListener("focusin",be)}}},Ua=["fit","fit-width","actual","none"];class Na{#a;#t=null;#e=null;#n=!1;constructor(t,e){this.#a=e,t.addController(this)}hostDisconnected(){this.detach()}get attached(){return this.#t!==null}get view(){return this.#t?.view()??{x:0,y:0,scale:1}}attach(){this.detach();const t=this.#a.elements();if(t===null)return;const{canvas:e,world:s}=t;this.#t=qa({canvas:e,world:s,align:this.#a.align(),sizeWorld:!1,onClearSelection:()=>this.#a.onDismiss(),onView:a=>this.#a.onView(a)}),this.#e=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.sync()),this.#e?.observe(s),this.sync()}detach(){this.#t?.destroy(),this.#t=null,this.#e?.disconnect(),this.#e=null}sync(){const t=this.#t,e=this.#a.elements()?.world;if(t===null||e===void 0)return;const s=this.#a.contentSize();e.style.width=s?`${s.width}px`:"",e.style.height=s?`${s.height}px`:"";const a=s?.width??e.offsetWidth,i=s?.height??e.offsetHeight;t.setContent({x:0,y:0,width:a,height:i}),!this.#n&&a>0&&i>0&&this.open()}open(){const t=this.#t;if(t===null)return;this.#n=!0;const e=this.#a.initial(),s=Ua.includes(e)?e:"fit";s==="fit"?t.fit():s==="fit-width"?t.fitWidth():s==="actual"&&t.reset()}fit(){this.#t?.fit()}fitWidth(){this.#t?.fitWidth()}fitTo(t){this.#t?.fitTo(t)}reset(t){this.#t?.reset(t)}zoom(t){this.#t?.zoom(t)}apply(){this.#t?.apply()}}const ja=(n,t,e)=>n.some(s=>Math.abs(t)>Math.abs(e)?s.overflowX!=="auto"&&s.overflowX!=="scroll"||s.scrollWidth<=s.clientWidth?!1:t>0?s.scrollLeft+s.clientWidth<s.scrollWidth-1:t<0&&s.scrollLeft>0:s.overflowY!=="auto"&&s.overflowY!=="scroll"||s.scrollHeight<=s.clientHeight?!1:e>0?s.scrollTop+s.clientHeight<s.scrollHeight-1:e<0&&s.scrollTop>0),Ge=160,Jt=(n,t,e=Ge)=>Math.max(e,Math.round(n+t)),Fa=(n,t,e,s=Ge)=>{const a=e?96:24;return t==="ArrowDown"?Jt(n,a,s):t==="ArrowUp"?Jt(n,-a,s):null},Je={kind:"idle"};class Ha{constructor(t,e){this.#e=null,this.#n=Je,this.handlers={pointerdown:s=>{if(s.button!==0)return;s.preventDefault();const a=s.currentTarget;a instanceof Element&&a.setPointerCapture(s.pointerId),this.#n={kind:"dragging",pointerId:s.pointerId,startY:s.clientY,startHeight:this.#t()},this.#a.requestUpdate()},pointermove:s=>{const a=this.#n;a.kind!=="dragging"||a.pointerId!==s.pointerId||this.#s(Jt(a.startHeight,s.clientY-a.startY))},pointerup:s=>this.#i(s),pointercancel:s=>this.#i(s),keydown:s=>{const a=Fa(this.#e??this.#t(),s.key,s.shiftKey);a!==null&&(s.preventDefault(),this.#s(a))},dblclick:()=>this.#s(null)},this.#a=t,this.#t=e,t.addController(this)}#a;#t;#e;#n;hostConnected(){}get height(){return this.#e}get dragging(){return this.#n.kind==="dragging"}#s(t){t!==this.#e&&(this.#e=t,this.#a.requestUpdate())}#i(t){const e=this.#n;e.kind!=="dragging"||e.pointerId!==t.pointerId||(this.#n=Je,this.#a.requestUpdate())}}const Wa=D({en:{maximize:"Maximize",restore:"Restore size",controls:"View controls",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",canvas:"Canvas. Arrow keys pan, plus and minus zoom, 0 fits the view.",resize:"Resize the panel",resizeHint:"Drag or use the up and down arrows to resize. Double-click restores the height."},ja:{maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",controls:"\u8868\u793A\u306E\u64CD\u4F5C",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",canvas:"\u30AD\u30E3\u30F3\u30D0\u30B9\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",resize:"\u30D1\u30CD\u30EB\u306E\u9AD8\u3055\u3092\u5909\u3048\u308B",resizeHint:"\u30C9\u30E9\u30C3\u30B0\u3001\u307E\u305F\u306F\u4E0A\u4E0B\u306E\u77E2\u5370\u30AD\u30FC\u3067\u9AD8\u3055\u3092\u5909\u3048\u308B\u3002\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3067\u5143\u306E\u9AD8\u3055\u306B\u623B\u3059\u3002"}});class Xe extends A{static{this.styles=[L,J,_`
2
- :host {
3
- display: block;
4
- color: var(--dpk-ink);
5
- /*
6
- * "align" is a reader-state attribute (fit alignment, "center" by
7
- * default), not markup; the UA stylesheet still maps the legacy
8
- * "align" content attribute to text-align through a bare
9
- * [align=center] selector that matches any element, tag name
10
- * aside. With no author rule of our own in the way, that is the
11
- * only declaration text-align gets, so it wins and every slotted
12
- * cell that does not set its own text-align inherits "center".
13
- * Inheriting here instead restores ordinary inheritance from
14
- * whatever this panel sits in.
15
- */
16
- text-align: inherit;
17
- }
18
-
19
- .panel {
20
- display: flex;
21
- flex-direction: column;
22
- /* Auto by default; a canvas inside needs a definite height to fill. */
23
- height: var(--dpk-dialog-panel-height, auto);
24
- min-height: var(--dpk-dialog-panel-min-height, 0);
25
- border: 1px solid var(--dpk-rule);
26
- border-radius: var(--dpk-radius-lg);
27
- background: var(--dpk-paper-raised);
28
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
29
- overflow: hidden;
30
- /*
31
- * The panel arrives as one surface: a short rise and fade over the slow
32
- * step, because it is the largest thing a page draws. It is a
33
- * transform only, so nothing beside it is laid out again.
34
- */
35
- animation: dpk-rise-in var(--dpk-dur-slow) var(--dpk-ease-out);
36
- }
37
-
38
- /*
39
- * Maximized: the panel covers the viewport. It is also a manual popover in
40
- * the top layer, so the UA popover box (fit-content, margin, border,
41
- * padding) is reset here. A resized panel leaves an inline height
42
- * behind, which only !important overrides.
43
- */
44
- .panel.is-maximized {
45
- position: fixed;
46
- /*
47
- * Not inset: 0 — the kit's own header sits above this panel in the
48
- * document, but this panel is a top-layer popover, which paints over
49
- * everything regardless of position in the document or z-index. The
50
- * header's real height (set by the page/template root as
51
- * --dpk-header-height; 0 with no such ancestor) keeps this panel's
52
- * box clear of it instead, so the header and its actions stay put
53
- * and clickable.
54
- */
55
- top: var(--dpk-header-height, 0px);
56
- right: 0;
57
- bottom: 0;
58
- left: 0;
59
- z-index: 2147483000;
60
- width: auto !important;
61
- height: auto !important;
62
- max-width: none;
63
- max-height: none;
64
- margin: 0;
65
- padding: 0;
66
- border: 0;
67
- border-radius: 0;
68
- color: var(--dpk-ink);
69
- background:
70
- radial-gradient(
71
- ellipse 900px 400px at 0% 0%,
72
- color-mix(in srgb, var(--dpk-accent) 4%, transparent),
73
- transparent 70%
74
- ),
75
- var(--dpk-paper-raised);
76
- box-shadow: none;
77
- /* Above the dock in the top layer, so nothing to clear. */
78
- --dpk-dock-overlap: 0px;
79
- /* Nothing behind a maximized panel is visible: no axis should chain past it. */
80
- overscroll-behavior: contain;
81
- /*
82
- * Maximizing is the same panel taking the viewport rather than a new
83
- * surface: it settles out of just-under-full size instead of rising,
84
- * which would read as a bounce. Restoring drops the class, and the
85
- * base '.panel' entrance above plays again — the way back out.
86
- */
87
- animation: dpk-scale-in var(--dpk-dur) var(--dpk-ease-out);
88
- }
89
-
90
- header {
91
- display: flex;
92
- align-items: center;
93
- gap: 10px;
94
- flex-wrap: wrap;
95
- flex-shrink: 0;
96
- min-height: 44px;
97
- padding: 8px 14px;
98
- border-bottom: 1px solid var(--dpk-rule);
99
- background: linear-gradient(180deg, var(--dpk-paper-raised), var(--dpk-paper));
100
- box-shadow: 0 1px 0 var(--dpk-highlight) inset;
101
- }
102
-
103
- .title {
104
- font-family: var(--dpk-display);
105
- font-size: 12.5px;
106
- font-weight: 660;
107
- letter-spacing: -0.015em;
108
- color: var(--dpk-ink);
109
- }
110
-
111
- /* A long heading or subject elides (the full text is its tooltip) instead of pushing the actions off. */
112
- .title,
113
- .subject {
114
- min-width: 0;
115
- max-width: 100%;
116
- overflow: hidden;
117
- text-overflow: ellipsis;
118
- white-space: nowrap;
119
- }
120
-
121
- .subject {
122
- font-size: 11px;
123
- color: var(--dpk-ink-soft);
124
- padding-left: 10px;
125
- border-left: 1px solid var(--dpk-rule-strong);
126
- }
127
-
128
- .actions {
129
- display: flex;
130
- align-items: center;
131
- gap: 6px;
132
- margin-left: auto;
133
- flex-wrap: wrap;
134
- }
135
-
136
- /* The body and the control menu floating over it. */
137
- .frame {
138
- position: relative;
139
- display: flex;
140
- flex-direction: column;
141
- flex: 1 1 auto;
142
- min-height: 0;
143
- }
144
-
145
- .body {
146
- display: flex;
147
- flex-direction: column;
148
- flex: 1;
149
- min-height: 0;
150
- padding: var(--dpk-dialog-panel-padding, 16px);
151
- overflow: auto;
152
- /*
153
- * The -x axis only: an edge swipe must never fall through to the
154
- * browser's back/forward navigation, but the vertical axis still
155
- * chains to the page so it keeps scrolling past an inline
156
- * (non-maximized) panel.
157
- */
158
- overscroll-behavior-x: contain;
159
- }
160
-
161
- :host([flush]) .body {
162
- padding: 0;
163
- overflow: hidden;
164
- }
165
-
166
- /* Scrolled to the end, the last of the body clears the control menu. */
167
- .frame[data-controls] > .body {
168
- padding-bottom: 56px;
169
- }
170
-
171
- /* A canvas: as tall as --dpk-canvas-height, or what is left of a sized panel. */
172
- :host([canvas]) .frame {
173
- flex: 1 1 var(--dpk-canvas-height, 420px);
174
- min-height: 220px;
175
- }
176
-
177
- .canvas {
178
- padding: 0;
179
- position: absolute;
180
- inset: 0;
181
- overflow: hidden;
182
- /* Same reasoning as .body: contain the horizontal edge only. */
183
- overscroll-behavior-x: contain;
184
- touch-action: none;
185
- cursor: grab;
186
- background: var(--dpk-dots), var(--dpk-paper-sunken);
187
- }
188
-
189
- .canvas:focus-visible {
190
- outline: none;
191
- box-shadow: inset var(--dpk-focus);
192
- }
193
-
194
- .canvas.is-panning {
195
- cursor: grabbing;
196
- }
197
-
198
- .world {
199
- position: absolute;
200
- inset: 0 auto auto 0;
201
- /* Content that lays out in flow measures itself; a given content box overrides this inline. */
202
- width: max-content;
203
- transform-origin: 0 0;
204
- }
205
-
206
- /* The control menu: a floating bar at the bottom, in the manner of a whiteboard's. */
207
- .controls {
208
- position: absolute;
209
- right: 12px;
210
- bottom: calc(12px + var(--dpk-dock-overlap, 0px));
211
- z-index: 4;
212
- display: flex;
213
- align-items: center;
214
- gap: 2px;
215
- padding: 3px;
216
- border: 1px solid var(--dpk-rule-strong);
217
- border-radius: var(--dpk-radius);
218
- background: var(--dpk-glass);
219
- backdrop-filter: blur(12px);
220
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
221
- /*
222
- * The menu comes up a step after the panel it floats on, so the eye
223
- * lands on the content first and the tools arrive once it is there.
224
- * Fade only: the panel's own rise already moves it.
225
- */
226
- animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease) backwards;
227
- animation-delay: var(--dpk-stagger);
228
- }
229
-
230
- .controls[hidden] {
231
- display: none;
232
- }
233
-
234
- /*
235
- * A corner twin of the bottom maximize control, shown only while
236
- * maximized: on a tall panel the bottom one can be a long pointer trip
237
- * away, and a top-right "exit full screen" is where readers expect one.
238
- * The bottom control stays too, for continuity with the non-maximized menu.
239
- */
240
- .exit-fullscreen {
241
- position: absolute;
242
- top: 12px;
243
- right: 12px;
244
- z-index: 5;
245
- display: inline-flex;
246
- align-items: center;
247
- justify-content: center;
248
- width: 30px;
249
- height: 30px;
250
- border: 1px solid var(--dpk-rule-strong);
251
- border-radius: var(--dpk-radius);
252
- background: var(--dpk-glass);
253
- backdrop-filter: blur(12px);
254
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
255
- color: var(--dpk-ink-soft);
256
- cursor: pointer;
257
- transition:
258
- background var(--dpk-dur-fast) var(--dpk-ease),
259
- color var(--dpk-dur-fast) var(--dpk-ease);
260
- /* It exists only while maximized, so it fades in with the transition. */
261
- animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease-out) backwards;
262
- animation-delay: calc(var(--dpk-stagger) * 2);
263
- }
264
-
265
- .exit-fullscreen svg {
266
- width: 14px;
267
- height: 14px;
268
- }
269
-
270
- .exit-fullscreen:hover {
271
- background: var(--dpk-paper-inset);
272
- color: var(--dpk-ink);
273
- }
274
-
275
- .exit-fullscreen:focus-visible {
276
- outline: none;
277
- box-shadow: var(--dpk-focus);
278
- }
279
-
280
- /*
281
- * Maximized, or with no maximize button to offer at all (a full-page
282
- * board's frame, which never sets "maximizable" — see the diagrams'
283
- * own "frameControls"), the menu has the whole viewport width to sit
284
- * in, so it moves off the corner and centers at the bottom instead.
285
- */
286
- .panel.is-maximized .controls,
287
- :host(:not([maximizable])) .controls {
288
- right: auto;
289
- left: 50%;
290
- transform: translateX(-50%);
291
- }
292
-
293
- .controls ::slotted(*) {
294
- flex: none;
295
- }
296
-
297
- .controls button,
298
- .grip {
299
- display: inline-flex;
300
- align-items: center;
301
- justify-content: center;
302
- min-width: 28px;
303
- height: 28px;
304
- padding: 0 7px;
305
- border: 0;
306
- border-radius: var(--dpk-radius-sm);
307
- background: transparent;
308
- color: var(--dpk-ink-soft);
309
- font-size: 11px;
310
- cursor: pointer;
311
- transition:
312
- background var(--dpk-dur-fast) var(--dpk-ease),
313
- color var(--dpk-dur-fast) var(--dpk-ease);
314
- }
315
-
316
- .controls button svg,
317
- .grip svg {
318
- width: 13px;
319
- height: 13px;
320
- }
321
-
322
- .controls button:hover,
323
- .grip:hover {
324
- background: var(--dpk-paper-inset);
325
- color: var(--dpk-ink);
326
- }
327
-
328
- .controls button:focus-visible,
329
- .grip:focus-visible {
330
- outline: none;
331
- box-shadow: var(--dpk-focus);
332
- }
333
-
334
- .controls button[aria-pressed='true'] {
335
- color: var(--dpk-accent);
336
- }
337
-
338
- .zoom-value {
339
- min-width: 46px;
340
- font-family: var(--dpk-mono);
341
- font-variant-numeric: tabular-nums;
342
- }
343
-
344
- .separator {
345
- width: 1px;
346
- height: 18px;
347
- margin: 0 3px;
348
- background: var(--dpk-rule);
349
- }
350
-
351
- .grip {
352
- cursor: ns-resize;
353
- touch-action: none;
354
- }
355
-
356
- .panel[data-resizing] {
357
- user-select: none;
358
- cursor: ns-resize;
359
- }
360
-
361
- .panel[data-resizing] .frame {
362
- pointer-events: none;
363
- }
364
-
365
- @media (max-width: 700px) {
366
- .subject {
367
- display: none;
368
- }
369
- }
370
- `]}static{this.properties={heading:{type:String},subject:{type:String},maximizable:{type:Boolean,reflect:!0},maximized:{type:Boolean,reflect:!0},resizable:{type:Boolean,reflect:!0},canvas:{type:Boolean,reflect:!0},contentWidth:{type:Number,attribute:"content-width"},contentHeight:{type:Number,attribute:"content-height"},initial:{type:String},align:{type:String},fitMode:{type:String,attribute:"fit-mode"},label:{type:String}}}#a=new O(this);#t=new Na(this,{elements:()=>{const t=this.renderRoot.querySelector(".canvas"),e=this.renderRoot.querySelector(".world");return this.canvas&&t&&e?{canvas:t,world:e}:null},align:()=>this.align,initial:()=>this.initial,contentSize:()=>this.contentWidth!==null&&this.contentHeight!==null?{width:this.contentWidth,height:this.contentHeight}:null,onDismiss:()=>!this.dispatchEvent(new CustomEvent("dpk-canvas-dismiss",{bubbles:!0,composed:!0,cancelable:!0})),onView:t=>{const e=this.renderRoot.querySelector(".zoom-value");e&&(e.textContent=Ba(t)),this.dispatchEvent(new CustomEvent("dpk-canvas-change",{detail:{view:t},bubbles:!0,composed:!0}))}});#e=new Ha(this,()=>this.renderRoot.querySelector(".panel")?.offsetHeight??0);#n=0;#s=!1;constructor(){super(),this.heading=null,this.subject=null,this.maximizable=!1,this.maximized=!1,this.resizable=!1,this.canvas=!1,this.contentWidth=null,this.contentHeight=null,this.initial="fit",this.align="center",this.fitMode="all",this.label=null,this.addEventListener("keydown",this.#x),this.addEventListener("wheel",this.#b,{passive:!1})}get view(){return this.#t.view}fit(){this.#t.fit()}fitWidth(){this.#t.fitWidth()}fitTo(t){this.#t.fitTo(t)}reset(t){this.#t.reset(t)}zoom(t){this.#t.zoom(t)}apply(){this.#t.apply()}resetView(){this.#t.open()}willUpdate(t){t.has("maximized")&&this.maximized&&(this.#n=this.renderRoot.querySelector(".panel")?.offsetHeight??0)}updated(t){t.has("maximized")&&this.#m(),t.has("canvas")&&this.canvas!==this.#t.attached||t.has("align")&&t.get("align")!==void 0&&this.canvas?this.canvas?this.#t.attach():this.#t.detach():(t.has("contentWidth")||t.has("contentHeight"))&&this.#t.sync()}render(){this.#s=Array.from(this.children).some(s=>s.slot==="controls");const t=this.canvas||this.maximizable||this.resizable||this.#s,e=this.#e.height;return d`
371
- ${this.maximized?d`<div class="placeholder" style="height:${this.#n}px"></div>`:h}
372
- <section
373
- class=${this.maximized?"panel is-maximized":"panel"}
374
- part="panel"
375
- popover=${this.maximized?"manual":h}
376
- style=${e===null||!this.resizable?h:`height: ${e}px`}
377
- ?data-resizing=${this.#e.dragging}
378
- >
379
- <header part="header">
380
- <slot name="heading">
381
- ${this.heading?d`<span class="title" title=${this.heading}>${this.heading}</span>`:h}
382
- ${this.subject?d`<span class="subject" title=${this.subject}>${this.subject}</span>`:h}
383
- </slot>
384
- <div class="actions"><slot name="actions"></slot></div>
385
- </header>
386
- <slot name="toolbar"></slot>
387
- <div class="frame" ?data-controls=${t&&!this.canvas}>
388
- ${this.canvas?this.#r():d`<div class="body" part="body"><slot></slot></div>`}
389
- ${this.#o(t)}
390
- ${this.maximized&&this.maximizable?this.#p():h}
391
- </div>
392
- <slot name="footer"></slot>
393
- </section>
394
- `}get#i(){return Wa(this.#a.locale)}#r(){return d`<div class="body canvas" part="body canvas" tabindex="0" aria-label=${this.label??this.#i.canvas}>
395
- <div class="world" part="world"><slot></slot></div>
396
- <slot name="overlay"></slot>
397
- </div>`}#o(t){const e=this.#i,s=[this.canvas?this.#l():null,this.maximizable?this.#c():null,this.resizable&&!this.maximized?this.#g():null].filter(a=>a!==null);return d`<div class="controls" part="controls" role="toolbar" aria-label=${e.controls} ?hidden=${!t}>
398
- <slot name="controls" @slotchange=${this.#u}></slot>
399
- ${s.map((a,i)=>d`${i>0||this.#s?d`<span class="separator"></span>`:h}${a}`)}
400
- </div>`}#l(){const t=this.#i;return d`<button type="button" aria-label=${t.zoomOut} title=${t.zoomOut} @click=${()=>this.zoom(1/1.1)}>
401
- ${jn()}
402
- </button>
403
- <button
404
- type="button"
405
- class="zoom-value"
406
- title=${t.fit}
407
- aria-label=${t.fit}
408
- @click=${()=>this.fitMode==="width"?this.fitWidth():this.fit()}
409
- >
410
- 100%
411
- </button>
412
- <button type="button" aria-label=${t.zoomIn} title=${t.zoomIn} @click=${()=>this.zoom(1.1)}>
413
- ${we()}
414
- </button>`}#c(){const t=this.maximized?this.#i.restore:this.#i.maximize;return d`<button
415
- type="button"
416
- class="maximize"
417
- aria-label=${t}
418
- title=${t}
419
- aria-pressed=${this.maximized?"true":"false"}
420
- @click=${()=>this.#d(!this.maximized)}
421
- >
422
- ${this.maximized?$e():Fn()}
423
- </button>`}#p(){const t=this.#i.restore;return d`<button
424
- type="button"
425
- class="exit-fullscreen"
426
- aria-label=${t}
427
- title=${t}
428
- @click=${()=>this.#d(!1)}
429
- >
430
- ${$e()}
431
- </button>`}#g(){const t=this.#i,e=this.#e.handlers;return d`<div
432
- class="grip"
433
- part="grip"
434
- role="separator"
435
- tabindex="0"
436
- aria-orientation="horizontal"
437
- aria-label=${t.resize}
438
- title=${t.resizeHint}
439
- @pointerdown=${e.pointerdown}
440
- @pointermove=${e.pointermove}
441
- @pointerup=${e.pointerup}
442
- @pointercancel=${e.pointercancel}
443
- @keydown=${e.keydown}
444
- @dblclick=${e.dblclick}
445
- >
446
- ${Hn()}
447
- </div>`}#u=t=>{if(!(t.target instanceof HTMLSlotElement))return;t.target.assignedElements({flatten:!0}).length>0!==this.#s&&this.requestUpdate()};#d(t){t!==this.maximized&&(this.maximized=t,this.dispatchEvent(new CustomEvent("dpk-maximize-change",{detail:{maximized:t},bubbles:!0,composed:!0})))}#m(){const t=this.renderRoot.querySelector(".panel");if(!(!this.maximized||!t||typeof t.showPopover!="function")&&!t.matches(":popover-open"))try{t.showPopover()}catch{}}#b=t=>{if(!this.maximized||t.defaultPrevented)return;const e=t.composedPath(),s=e.slice(0,Math.max(0,e.indexOf(this))).flatMap(a=>{if(!(a instanceof Element))return[];const{overflowX:i,overflowY:r}=getComputedStyle(a);return[{overflowX:i,scrollLeft:a.scrollLeft,scrollWidth:a.scrollWidth,clientWidth:a.clientWidth,overflowY:r,scrollTop:a.scrollTop,scrollHeight:a.scrollHeight,clientHeight:a.clientHeight}]});ja(s,t.deltaX,t.deltaY)||t.preventDefault()};#x=t=>{!this.maximized||t.key!=="Escape"||t.defaultPrevented||(t.preventDefault(),this.#d(!1))}}const Ba=n=>`${Math.round(n.scale*100)}%`,Ye=()=>{customElements.get("dpk-dialog-panel")||customElements.define("dpk-dialog-panel",Xe)},Ka=(n,t)=>n.active.includes(t)?{...n,active:n.active.filter(e=>e!==t)}:n.match==="single"?{...n,active:[t]}:{...n,active:[...n.active,t]},Va=(n,t)=>({match:t,active:t==="single"&&n.active.length>1?n.active.slice(-1):n.active}),Ga=n=>({...n,active:[]}),Ja=n=>{const t=new Map;for(const e of n)for(const s of new Set(e))t.set(s,(t.get(s)??0)+1);return[...t].map(([e,s])=>({tag:e,count:s}))},Xa={nodes:new Map,edges:new Set},Ze=(n,t,e,s)=>{const a=new Map,i=new Set,r=[{id:t,depth:0}],o=new Set([t]);for(const l of r)if(!(!s&&l.depth>=1))for(const c of n){const p=e==="outgoing"?c.from:c.to,m=e==="outgoing"?c.to:c.from;p===l.id&&(i.add(c.id),!o.has(m)&&(o.add(m),a.set(m,l.depth+1),r.push({id:m,depth:l.depth+1})))}return{nodes:a,edges:i}},Ya=(n,t)=>{const e=new Map(n.map(i=>[i,Ze(t,i,"outgoing",!0).nodes])),s=new Set,a=[];for(const i of n){if(s.has(i))continue;const r=n.filter(o=>o===i||e.get(i)?.has(o)===!0&&e.get(o)?.has(i)===!0);for(const o of r)s.add(o);(r.length>1||t.some(o=>o.from===i&&o.to===i))&&a.push(r)}return a},Za=n=>new Map(n.flatMap((t,e)=>t.map(s=>[s,e]))),Qa=(n,t)=>t.get(n.from)===t.get(n.to)&&t.has(n.from),ti=(n,t,e,s)=>{const a=t!==null&&t.kind===e&&t.id===n,i=e==="node"?s.nodes.has(n):s.edges.has(n),r=e==="node"?s.nodes.get(n)??null:null;return{selected:a,related:i&&!a,dimmed:t!==null&&!a&&!i,depth:r}},ei=(...n)=>n.filter(t=>typeof t=="string"&&t!=="").join(" "),si=n=>{const t=n[0]??{x:0,y:0},e=n.at(-1)??t;if(n.length<=2)return{x:(t.x+e.x)/2,y:(t.y+e.y)/2};if(n.length===4){const o=n[1]??t,l=n[2]??e;return{x:(o.x+l.x)/2,y:(o.y+l.y)/2}}let s=0,a=-1;for(let o=0;o+1<n.length;o++){const l=n[o],c=n[o+1],p=Math.abs(c.x-l.x)+Math.abs(c.y-l.y);p>a&&(a=p,s=o)}const i=n[s]??t,r=n[s+1]??e;return{x:(i.x+r.x)/2,y:(i.y+r.y)/2}},ni=D({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear"},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664"}}),ai=["single","all","any"],Qe=n=>n.startsWith(Ma),ii=n=>{const t=new Set,e=n.flatMap(s=>{const a=typeof s=="string"?{tag:s,count:null}:{tag:s.tag,count:s.count??null};return a.tag===""||t.has(a.tag)?[]:(t.add(a.tag),[a])});return[...e.filter(s=>Qe(s.tag)),...e.filter(s=>!Qe(s.tag))]},ri=Le([b(),jt({tag:b(),count:P(st())})]),oi=jt({tags:$(Ft()),active:g(ze(_e($(Ft())),null)),match:g(ze(_e(Z(ai)),null))}),ts=n=>{const t=B(oi,Array.isArray(n)?{tags:n}:n),e=t.tags.flatMap(a=>{const i=St(ri,a);return i.success?[i.output]:[]}),s=t.active?.filter(a=>typeof a=="string")??null;return{tags:e,active:s,match:t.match??null}},li=[["single","Single"],["all","AND"],["any","OR"]];class es extends A{static{this.styles=[L,_`
448
- :host {
449
- display: block;
450
- flex-shrink: 0;
451
- }
452
-
453
- .diagram-tags {
454
- display: flex;
455
- align-items: center;
456
- gap: 5px;
457
- flex-wrap: wrap;
458
- padding: 7px 12px;
459
- border-bottom: 1px solid var(--dpk-rule);
460
- background: var(--dpk-paper);
461
- }
462
-
463
- :host([bare]) .diagram-tags {
464
- padding: 0;
465
- border-bottom: 0;
466
- background: none;
467
- }
468
-
469
- .diagram-match {
470
- display: flex;
471
- gap: 2px;
472
- padding: 3px;
473
- margin-right: 6px;
474
- border: 1px solid var(--dpk-rule);
475
- border-radius: var(--dpk-radius-sm);
476
- background: var(--dpk-paper-sunken);
477
- box-shadow: inset 0 1px 2px var(--dpk-shade-1);
478
- }
479
-
480
- .diagram-match button {
481
- border: 0;
482
- border-radius: var(--dpk-radius-xs);
483
- padding: 4px 8px;
484
- background: transparent;
485
- color: var(--dpk-ink-soft);
486
- font-size: 11px;
487
- font-weight: 600;
488
- letter-spacing: 0.01em;
489
- cursor: pointer;
490
- transition:
491
- background 160ms var(--dpk-ease),
492
- color 160ms var(--dpk-ease),
493
- box-shadow 160ms var(--dpk-ease);
494
- }
495
-
496
- .diagram-match button:hover[aria-pressed='false'] {
497
- color: var(--dpk-ink);
498
- }
499
-
500
- .diagram-match button[aria-pressed='true'] {
501
- background: var(--dpk-paper-raised);
502
- color: var(--dpk-ink);
503
- font-weight: 650;
504
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
505
- }
506
-
507
- .dpk-tag {
508
- display: inline-flex;
509
- align-items: center;
510
- gap: 5px;
511
- max-width: 100%;
512
- padding: 4px 9px;
513
- border: 1px solid transparent;
514
- border-radius: var(--dpk-radius-xs);
515
- background: var(--dpk-paper-inset);
516
- color: var(--dpk-ink-soft);
517
- font-size: 11px;
518
- cursor: pointer;
519
- transition:
520
- background 140ms var(--dpk-ease),
521
- color 140ms var(--dpk-ease),
522
- border-color 140ms var(--dpk-ease),
523
- box-shadow 140ms var(--dpk-ease);
524
- }
525
-
526
- .dpk-tag:hover {
527
- background: var(--dpk-paper-sunken);
528
- color: var(--dpk-ink);
529
- }
530
-
531
- .dpk-tag[aria-pressed='true'] {
532
- border-color: color-mix(in srgb, var(--dpk-blue) 45%, transparent);
533
- background: var(--dpk-blue-soft);
534
- color: color-mix(in srgb, var(--dpk-blue) 78%, var(--dpk-ink));
535
- font-weight: 600;
536
- box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
537
- }
538
-
539
- .dpk-tag-name {
540
- min-width: 0;
541
- overflow: hidden;
542
- text-overflow: ellipsis;
543
- white-space: nowrap;
544
- }
545
-
546
- .dpk-tag-count {
547
- flex: none;
548
- font-family: var(--dpk-mono);
549
- font-size: 11px;
550
- font-variant-numeric: tabular-nums;
551
- }
552
-
553
- .dpk-tag-clear {
554
- border: 0;
555
- background: none;
556
- padding: 4px 6px;
557
- color: var(--dpk-ink-soft);
558
- font-size: 11px;
559
- cursor: pointer;
560
- }
561
-
562
- button:focus-visible {
563
- outline: none;
564
- box-shadow: var(--dpk-focus);
565
- }
566
- `]}static{this.properties={tags:{attribute:!1},active:{attribute:!1},match:{type:String,reflect:!0}}}#a=new O(this);#t=null;constructor(){super(),this.tags=[],this.active=[],this.match="single"}connectedCallback(){super.connectedCallback(),this.#t=X(this,ts,t=>{if(!t.ok){console.warn(`[dev-process-kit] ${this.localName}: ${t.error}`);return}this.tags=t.value.tags,t.value.active!==null&&(this.active=t.value.active),t.value.match!==null&&(this.match=t.value.match)})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}passes(t){return Aa(t,this.#n)}render(){const t=ii(this.tags);if(t.length===0)return h;const e=this.#e;return d`
567
- <div class="diagram-tags" part="row" role="group" aria-label=${e.tagFilter}>
568
- <div class="diagram-match" role="group" aria-label=${e.tagMatch}>
569
- ${li.map(([s,a])=>d`
570
- <button
571
- type="button"
572
- data-match=${s}
573
- aria-pressed=${this.match===s?"true":"false"}
574
- @click=${()=>this.#s(Va(this.#n,s))}
575
- >
576
- ${a}
577
- </button>
578
- `)}
579
- </div>
580
- ${U(t,s=>s.tag,s=>d`
581
- <button
582
- type="button"
583
- class="dpk-tag"
584
- data-tag=${s.tag}
585
- aria-pressed=${this.active.includes(s.tag)?"true":"false"}
586
- @click=${()=>this.#s(Ka(this.#n,s.tag))}
587
- >
588
- <span class="dpk-tag-name" title=${s.tag}>${s.tag}</span>${s.count===null?h:d`<span class="dpk-tag-count">${s.count}</span>`}
589
- </button>
590
- `)}
591
- ${this.active.length>0?d`<button type="button" class="dpk-tag-clear" @click=${()=>this.#s(Ga(this.#n))}>
592
- ${e.clearTags}
593
- </button>`:h}
594
- </div>
595
- `}get#e(){return ni(this.#a.locale)}get#n(){return{active:this.active,match:this.match}}#s(t){this.active=t.active,this.match=t.match,this.dispatchEvent(new CustomEvent("dpk-tag-filter-change",{detail:{active:t.active,match:t.match},bubbles:!0,composed:!0}))}}const ss=()=>{customElements.get("dpk-tag-filter")||customElements.define("dpk-tag-filter",es)},ns=Symbol.for("dev-process-kit:atom-styles"),as=()=>{if(typeof document>"u"||Reflect.get(document,ns)===!0)return;Reflect.set(document,ns,!0),ca();const n=[Ce,Ae].flatMap(e=>e.styleSheet?[e.styleSheet]:[]);if(n.length===2){document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n];return}const t=document.createElement("style");t.dataset.dpkAtoms="",t.textContent=`${Ce.cssText}
596
- ${Ae.cssText}`,document.head.append(t)},di=D({en:{aria:"Line chart",empty:"No data to plot",invalid:n=>`Invalid chart data: ${n}`},ja:{aria:"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5",empty:"\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",invalid:n=>`\u30B0\u30E9\u30D5\u306E\u30C7\u30FC\u30BF\u304C\u4E0D\u6B63\u3067\u3059: ${n}`}}),Xt=["blue","green","amber","violet","accent","ink-faint"],is=x({x:y(b(),S(1)),y:y(st(),Ht())}),ci=x({id:Q,label:y(b(),S(1)),points:$(is),tone:g(Z(Xt),"blue"),area:g(nt(),!1)}),pi=x({id:Q,label:y(b(),S(1)),points:$(is),tone:g(Z(Xt),"ink-faint"),dashed:g(nt(),!0)}),hi=x({x:y(b(),S(1)),label:y(b(),S(1)),tone:g(Z(Xt),"accent")}),rs=x({label:g(b()),min:g(y(st(),Ht())),max:g(y(st(),Ht()))}),ui=x({title:g(b(),""),caption:g(b(),""),series:g($(ci),[]),guides:g($(pi),[]),marks:g($(hi),[]),xAxis:g(rs,{}),yAxis:g(rs,{})}),Yt=(n,t)=>{const e=new Set;for(const s of n){if(e.has(s))throw new Error(`duplicate ${t}: ${s}`);e.add(s)}},os=(n,t)=>{Yt(n.map(e=>e.x),`x in "${t}"`)},ls=n=>{const t=B(ui,n);Yt(t.series.map(e=>e.id),"series id"),Yt(t.guides.map(e=>e.id),"guide id");for(const e of t.series)os(e.points,e.label);for(const e of t.guides)os(e.points,e.label);if(t.yAxis.min!==void 0&&t.yAxis.max!==void 0&&t.yAxis.min>=t.yAxis.max)throw new Error("yAxis.min must be less than yAxis.max");return t},it={top:22,right:18,bottom:38,left:52},Zt=6,mi=n=>{const t=[],e=new Set;for(const s of[...n.series,...n.guides])for(const a of s.points)e.has(a.x)||(e.add(a.x),t.push(a.x));return t},gi=n=>{const t=[...n.series,...n.guides].flatMap(r=>r.points.map(o=>o.y));if(t.length===0)return null;const e=Math.min(...t),s=Math.max(...t),a=n.yAxis.min??Math.min(0,e);let i=n.yAxis.max??s;if(i<=a&&(i=a+1),n.yAxis.max===void 0){const r=i-a;i+=r*.08}return{min:a,max:i}},Qt=n=>n.length===0?"":n.map((t,e)=>`${e===0?"M":"L"}${rt(t.x)} ${rt(t.y)}`).join(" "),fi=(n,t)=>n.length===0?null:`${Qt(n)} L${rt(n.at(-1)?.x??0)} ${rt(t)} L${rt(n[0]?.x??0)} ${rt(t)} Z`,rt=n=>Math.round(n*100)/100,ds=n=>Number.isInteger(n)?String(n):String(Math.round(n*10)/10),bi=(n,t)=>{const e=n/Math.max(1,t),s=10**Math.floor(Math.log10(e)),a=e/s;return(a<=1?1:a<=2?2:a<=5?5:10)*s},ki=(n,t,e)=>{const s=bi(t-n,4),a=Math.ceil(n/s)*s,i=[];for(let o=a;o<=t+s/1e3;o+=s)i.push({y:e(o),label:ds(o)});const r=e(n);return i.some(o=>Math.abs(o.y-r)<.01)||i.push({y:r,label:ds(n)}),i},vi=(n,t)=>{if(n.length===0)return[];if(n.length<=Zt)return n.map((s,a)=>({x:t(a),label:s}));const e=Array.from({length:Zt},(s,a)=>Math.round(a*(n.length-1)/(Zt-1)));return[...new Set(e)].map(s=>({x:t(s),label:n[s]??""}))},xi=(n,t=720,e=280)=>{const s=mi(n),a=gi(n);if(s.length===0||a===null)return null;const i={left:it.left,top:it.top,width:t-it.left-it.right,height:e-it.top-it.bottom},r=new Map(s.map((m,f)=>[m,f])),o=m=>s.length===1?i.left+i.width/2:i.left+m/(s.length-1)*i.width,l=m=>i.top+(1-(m-a.min)/(a.max-a.min))*i.height,c=m=>m.flatMap(f=>{const E=r.get(f.x);return E===void 0?[]:[{x:o(E),y:l(f.y)}]}).sort((f,E)=>f.x-E.x),p=i.top+i.height;return{width:t,height:e,plot:i,series:n.series.map(m=>{const f=c(m.points);return{...m,nodes:f,path:Qt(f),areaPath:m.area?fi(f,p):null}}),guides:n.guides.map(m=>({...m,path:Qt(c(m.points))})),marks:n.marks.flatMap(m=>{const f=r.get(m.x);return f===void 0?[]:[{...m,x:o(f)}]}),xTicks:vi(s,o),yTicks:ki(a.min,a.max,l)}},yi=_`
597
- :host {
598
- display: block;
599
- min-width: 0;
600
- }
601
-
602
- .guide {
603
- fill: none;
604
- stroke: var(--tone, var(--dpk-ink-faint));
605
- stroke-width: 1.25;
606
- }
607
-
608
- .guide[data-dashed] {
609
- stroke-dasharray: 5 4;
610
- }
611
-
612
- .axis-label {
613
- fill: var(--dpk-ink-faint);
614
- font-family: var(--dpk-mono);
615
- font-size: 10px;
616
- }
617
- `,K=n=>`--tone: var(--dpk-${n})`;class cs extends A{static{this.styles=[pa,yi]}static{this.properties={data:{attribute:!1}}}#a=new O(this);#t=null;#e=null;#n=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#n=X(this,ls,t=>{t.ok?(this.data=t.value,this.#e=null):(this.#t=null,this.#e=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=ls(this.data),this.#e=null}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=di(this.#a.locale),e=this.#t,s=e===null?null:xi(e);if(this.#e!==null)return this.#s(d`<p class="dpk-chart-empty">${t.invalid(this.#e)}</p>`);if(e===null||s===null)return this.#s(d`<p class="dpk-chart-empty">${t.empty}</p>`);const a=e.title===""?t.aria:e.title;return d`<section class="dpk-chart" aria-label=${a}>
618
- ${e.title===""&&e.caption===""?h:d`<header class="dpk-chart-head">
619
- ${e.title===""?h:d`<span class="dpk-chart-title">${e.title}</span>`}
620
- ${e.caption===""?h:d`<span class="dpk-chart-value">${e.caption}</span>`}
621
- </header>`}
622
- <div class="dpk-chart-plot">${this.#i(e,s,a)}</div>
623
- ${this.#c(e)}
624
- </section>`}#s(t){return d`<section class="dpk-chart" role="status">${t}</section>`}#i(t,e,s){const{plot:a,width:i,height:r}=e,o=a.top+a.height;return d`<svg viewBox="0 0 ${i} ${r}" role="img" aria-label=${s}>
625
- <title>${s}</title>
626
- <g class="dpk-chart-grid">
627
- ${e.yTicks.map(l=>H`<line x1=${a.left} x2=${a.left+a.width} y1=${l.y} y2=${l.y}></line>`)}
628
- </g>
629
- <g class="dpk-chart-axis">
630
- <line x1=${a.left} x2=${a.left} y1=${a.top} y2=${o}></line>
631
- <line x1=${a.left} x2=${a.left+a.width} y1=${o} y2=${o}></line>
632
- </g>
633
- ${e.yTicks.map(l=>H`<text class="dpk-chart-tick" x=${a.left-8} y=${l.y+3} text-anchor="end">${l.label}</text>`)}
634
- ${e.xTicks.map(l=>H`<text class="dpk-chart-tick" x=${l.x} y=${o+16} text-anchor="middle">${l.label}</text>`)}
635
- ${t.xAxis.label===void 0?h:H`<text class="axis-label" x=${a.left+a.width/2} y=${r-3} text-anchor="middle">${t.xAxis.label}</text>`}
636
- ${t.yAxis.label===void 0?h:H`<text class="axis-label" x=${12} y=${a.top+a.height/2} text-anchor="middle" transform="rotate(-90 12 ${a.top+a.height/2})">${t.yAxis.label}</text>`}
637
- ${e.guides.map(l=>this.#o(l))}
638
- ${e.series.map(l=>this.#r(l))}
639
- ${e.marks.map(l=>this.#l(l,a.top,o))}
640
- </svg>`}#r(t){return t.path===""?h:H`${t.areaPath===null?h:H`<path class="dpk-chart-area" d=${t.areaPath} style=${K(t.tone)}></path>`}
641
- <path class="dpk-chart-line" d=${t.path} style=${K(t.tone)}></path>
642
- ${t.nodes.map(e=>H`<circle
643
- class="dpk-chart-point"
644
- cx=${e.x}
645
- cy=${e.y}
646
- r="2.5"
647
- style=${K(t.tone)}
648
- ></circle>`)}`}#o(t){return t.path===""?h:H`<path
649
- class="guide"
650
- d=${t.path}
651
- style=${K(t.tone)}
652
- ?data-dashed=${t.dashed}
653
- ></path>`}#l(t,e,s){return H`<line
654
- class="dpk-chart-mark"
655
- x1=${t.x}
656
- x2=${t.x}
657
- y1=${e}
658
- y2=${s}
659
- style=${K(t.tone)}
660
- ></line>
661
- <text class="dpk-chart-mark-label" x=${t.x+4} y=${e+10} style=${K(t.tone)}
662
- >${t.label}</text
663
- >`}#c(t){return t.series.length===0&&t.guides.length===0&&t.marks.length===0?h:d`<div class="dpk-chart-legend">
664
- ${t.series.map(e=>d`<span class="dpk-chart-key" data-variant=${e.area?"area":"line"} style=${K(e.tone)}
665
- >${e.label}</span
666
- >`)}
667
- ${t.guides.map(e=>d`<span class="dpk-chart-key" data-variant="dashed" style=${K(e.tone)}>${e.label}</span>`)}
668
- ${t.marks.map(e=>d`<span class="dpk-chart-key" data-variant="mark" style=${K(e.tone)}>${e.label}</span>`)}
669
- </div>`}}const ps=()=>{customElements.get("dpk-line-chart")||customElements.define("dpk-line-chart",cs)},wi=D({en:{heading:"Formal spec",empty:"No claims.",dataError:"Could not load the specification data.",claims:n=>`${n} ${n===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:n=>`Comment on ${n}`,sendFailed:"Could not send. Place this inside a dpk-view-* 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:n=>`${n} \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:n=>`${n}\u306B\u30B3\u30E1\u30F3\u30C8`,sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),N=y(b(),Re(),S(1)),mt=x({id:Q,text:N}),$i=Pe("kind",[x({kind:at("proved"),assumptions:g($(N))}),x({kind:at("bounded"),bound:N}),x({kind:at("incomplete"),gaps:g($(N))}),x({kind:at("planned")})]),Ci=x({id:Q,target:g(Q),statement:N,subjects:g($(mt)),premises:g($(mt)),conclusions:y($(mt),S(1,"a claim needs at least one conclusion")),examples:g($(mt)),notClaimed:g($(mt)),assurance:$i,source:g(x({tool:g(N),ref:N}))}),Si=x({id:Q,name:N,meaning:N}),Ei=x({id:Q,name:N,code:g(N),summary:g(N)}),Ti=x({targets:g($(Ei)),terms:g($(Si)),claims:$(Ci)}),Mi=()=>({targets:[],terms:[],claims:[]}),Ai=/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,zi=(n,t)=>{const e=[];let s=0;for(const a of n.matchAll(Ai)){const i=(a[1]??"").trim(),r=t.get(i);if(r===void 0)throw new Error(`unknown term reference: [[${i}]]`);a.index>s&&e.push({kind:"text",text:n.slice(s,a.index)}),e.push({kind:"term",id:i,label:a[2]?.trim()||r}),s=a.index+a[0].length}return s<n.length&&e.push({kind:"text",text:n.slice(s)}),e},hs=n=>n.map(t=>t.kind==="text"?t.text:t.label).join(""),_i=n=>[...new Set(n.flatMap(t=>t.flatMap(e=>e.kind==="term"?[e.id]:[])))],At=(n,t)=>{const e=new Set;for(const s of n){if(e.has(s))throw new Error(`duplicate ${t} id: ${s}`);e.add(s)}},us=n=>{const t=B(Ti,n),e=t.targets??[],s=t.terms??[];At(e.map(p=>p.id),"target"),At(s.map(p=>p.id),"term"),At(t.claims.map(p=>p.id),"claim");const a=new Map(s.map(p=>[p.id,p.name])),i=p=>zi(p,a),r=s.map(p=>({id:p.id,name:p.name,meaning:i(p.meaning)})),o=e.map(p=>({id:p.id,name:p.name,code:p.code??null,summary:p.summary===void 0?null:i(p.summary)})),l=new Set(o.map(p=>p.id)),c=t.claims.map(p=>{if(p.target!==void 0&&!l.has(p.target))throw new Error(`unknown target (in claim ${p.id}): ${p.target}`);const m=W=>(W??[]).map(ct=>({id:ct.id,text:i(ct.text)})),f=m(p.subjects),E=m(p.premises),R=m(p.conclusions),M=m(p.examples),Y=m(p.notClaimed),I=[...f,...E,...R,...M,...Y];At(I.map(W=>W.id),`clause (in claim ${p.id})`);const z=Li(p.assurance,i),F=i(p.statement);return{id:p.id,target:p.target??null,statement:F,subjects:f,premises:E,conclusions:R,examples:M,notClaimed:Y,assurance:z,source:p.source===void 0?null:{tool:p.source.tool??null,ref:p.source.ref},terms:_i([F,...I.map(W=>W.text),...Pi(z)])}});return{targets:o,terms:r,claims:c}},Li=(n,t)=>{switch(n.kind){case"proved":return{kind:"proved",assumptions:(n.assumptions??[]).map(t)};case"bounded":return{kind:"bounded",bound:t(n.bound)};case"incomplete":return{kind:"incomplete",gaps:(n.gaps??[]).map(t)};case"planned":return{kind:"planned"}}},Pi=n=>{switch(n.kind){case"proved":return n.assumptions;case"bounded":return[n.bound];case"incomplete":return n.gaps;case"planned":return[]}},Ri=n=>{const t={proved:0,conditional:0,bounded:0,incomplete:0,planned:0};for(const e of n.claims)t[ms(e.assurance)?"conditional":e.assurance.kind]+=1;return t},ms=n=>n.kind==="proved"&&n.assumptions.length>0,gs=n=>{const t=new Map(n.targets.map(s=>[s.id,s])),e=new Map;for(const s of n.claims)e.set(s.target,[...e.get(s.target)??[],s]);for(const s of n.targets)e.has(s.id)||e.set(s.id,[]);return[...e].map(([s,a])=>({target:s===null?null:t.get(s)??null,claims:a}))},gt=(n,t)=>t.length===0?{itemsLabel:null,items:t}:{itemsLabel:n,items:t},te=(n,t)=>{switch(t.kind){case"proved":return ms(t)?{tone:"caveat",label:n.conditional,detail:n.conditionalDetail,...gt(n.assumptions,t.assumptions)}:{tone:"sound",label:n.proved,detail:n.provedDetail,...gt("",[])};case"bounded":return{tone:"caveat",label:n.bounded,detail:n.boundedDetail,...gt(n.bound,[t.bound])};case"incomplete":return{tone:"unsound",label:n.incomplete,detail:n.incompleteDetail,...gt(n.gaps,t.gaps)};case"planned":return{tone:"planned",label:n.planned,detail:n.plannedDetail,...gt("",[])}}},Di=n=>{switch(n.kind){case"target":return["target",n.target];case"claim":return["claim",n.claim];case"clause":return["clause",n.claim,n.clause]}},Oi=n=>[...n.subjects,...n.premises,...n.conclusions,...n.examples,...n.notClaimed],fs=32,bs=n=>{const t=hs(n.statement);return t.length<=fs?t:`${t.slice(0,fs).trimEnd()}\u2026`},Ii=n=>[{target:{kind:"claim",claim:n.id},label:bs(n)},...Oi(n).map(t=>({target:{kind:"clause",claim:n.id,clause:t.id},label:`${bs(n)} \u203A ${hs(t.text)}`}))],qi=n=>gs(n).flatMap(t=>[...t.target===null?[]:[{target:{kind:"target",target:t.target.id},label:t.target.name}],...t.claims.flatMap(Ii)]),Ui=[L,J,ht,_`
670
- :host {
671
- display: block;
672
- container-type: inline-size;
673
- color: var(--dpk-ink);
674
- font-family: var(--dpk-body);
675
- }
676
-
677
- .spec {
678
- display: grid;
679
- gap: 14px;
680
- }
681
-
682
- /* ----------------------------------------------------------- toolbar */
683
-
684
- .spec-toolbar {
685
- display: flex;
686
- flex-wrap: wrap;
687
- align-items: baseline;
688
- gap: 4px 10px;
689
- padding: 0 2px 10px;
690
- border-bottom: 1px solid var(--dpk-rule);
691
- }
692
-
693
- .spec-title {
694
- font-family: var(--dpk-display);
695
- font-size: 14px;
696
- font-weight: 650;
697
- }
698
-
699
- .spec-subject {
700
- color: var(--dpk-ink-soft);
701
- font-size: 12.5px;
702
- }
703
-
704
- .spec-stats {
705
- display: inline-flex;
706
- flex-wrap: wrap;
707
- align-items: center;
708
- gap: 6px;
709
- margin-left: auto;
710
- color: var(--dpk-ink-faint);
711
- font-size: 12px;
712
- }
713
-
714
- .spec-chip {
715
- padding: 1px 8px;
716
- border-radius: 999px;
717
- font-weight: 600;
718
- }
719
-
720
- .spec-notice,
721
- .spec-empty {
722
- margin: 0;
723
- padding: 14px;
724
- border-radius: var(--dpk-radius);
725
- font-size: 12.5px;
726
- }
727
-
728
- .spec-notice {
729
- background: var(--dpk-danger-soft);
730
- color: var(--dpk-danger);
731
- }
732
-
733
- .spec-empty {
734
- color: var(--dpk-ink-faint);
735
- text-align: center;
736
- }
737
-
738
- /* ------------------------------------------------------------ tones */
739
-
740
- [data-tone='sound'] {
741
- --tone: var(--dpk-green);
742
- --tone-soft: var(--dpk-green-soft);
743
- }
744
-
745
- [data-tone='caveat'] {
746
- --tone: var(--dpk-amber);
747
- --tone-soft: var(--dpk-amber-soft);
748
- }
749
-
750
- [data-tone='unsound'] {
751
- --tone: var(--dpk-danger);
752
- --tone-soft: var(--dpk-danger-soft);
753
- }
754
-
755
- [data-tone='planned'] {
756
- --tone: var(--dpk-blue);
757
- --tone-soft: var(--dpk-blue-soft);
758
- }
759
-
760
- .spec-chip,
761
- .assurance-badge {
762
- background: var(--tone-soft);
763
- color: var(--tone);
764
- }
765
-
766
- /* ----------------------------------------------------------- targets */
767
-
768
- .spec-groups {
769
- display: grid;
770
- gap: 28px;
771
- }
772
-
773
- .target-group {
774
- display: grid;
775
- gap: 12px;
776
- }
777
-
778
- .target-head {
779
- display: flex;
780
- flex-wrap: wrap;
781
- align-items: baseline;
782
- gap: 4px 10px;
783
- }
784
-
785
- .target-label {
786
- color: var(--dpk-ink-faint);
787
- font-size: 11.5px;
788
- font-weight: 650;
789
- letter-spacing: 0.04em;
790
- }
791
-
792
- .target-name {
793
- margin: 0;
794
- font-family: var(--dpk-display);
795
- font-size: 17px;
796
- font-weight: 700;
797
- }
798
-
799
- .target-code {
800
- padding: 1px 7px;
801
- border: 1px solid var(--dpk-rule);
802
- border-radius: var(--dpk-radius-sm);
803
- background: var(--dpk-paper-sunken);
804
- color: var(--dpk-ink-soft);
805
- font-family: var(--dpk-mono);
806
- font-size: 12px;
807
- }
808
-
809
- .target-summary {
810
- margin: -4px 0 0;
811
- color: var(--dpk-ink-soft);
812
- font-size: 13.5px;
813
- line-height: 1.7;
814
- }
815
-
816
- /* ------------------------------------------------------------ claims */
817
-
818
- .spec-claims {
819
- display: grid;
820
- gap: 8px;
821
- }
822
-
823
- .claim {
824
- padding: 10px 14px 10px 8px;
825
- border: 1px solid var(--dpk-rule);
826
- border-radius: var(--dpk-radius-lg);
827
- background: var(--dpk-paper-raised);
828
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
829
- }
830
-
831
- /* Folded, the head row is the whole card: the statement and how strongly it holds. */
832
- .claim-head {
833
- display: flex;
834
- align-items: flex-start;
835
- gap: 8px;
836
- cursor: pointer;
837
- }
838
-
839
- /* Base look and sizing come from .dpk-icon-btn (src/core/theme); only the fold behavior is local. */
840
- .claim-toggle {
841
- flex: none;
842
- margin-top: 1px;
843
- }
844
-
845
- .claim-toggle svg {
846
- transition: transform 120ms ease;
847
- }
848
-
849
- .claim-toggle[aria-expanded='true'] svg {
850
- transform: rotate(90deg);
851
- }
852
-
853
- .claim-body {
854
- display: grid;
855
- gap: 14px;
856
- margin: 12px 0 6px 32px;
857
- }
858
-
859
- /* The badge explains itself in a tooltip, so it is a button that hover, focus or a tap opens. */
860
- .assurance-badge {
861
- flex: none;
862
- margin-top: 2px;
863
- padding: 2px 10px;
864
- border: none;
865
- border-radius: 999px;
866
- font: inherit;
867
- font-size: 11.5px;
868
- font-weight: 650;
869
- white-space: nowrap;
870
- cursor: help;
871
- }
872
-
873
- .assurance-badge:focus-visible {
874
- outline: 2px solid var(--tone);
875
- outline-offset: 2px;
876
- }
877
-
878
- .claim-statement {
879
- flex: 1;
880
- margin: 0;
881
- font-size: 14.5px;
882
- line-height: 1.65;
883
- font-weight: 500;
884
- }
885
-
886
- /* Subjects / premises / conclusions: the structure of the claim, one row per part. */
887
- .claim-parts {
888
- display: grid;
889
- grid-template-columns: max-content 1fr;
890
- margin: 0;
891
- border: 1px solid var(--dpk-rule);
892
- border-radius: var(--dpk-radius);
893
- background: var(--dpk-paper-sunken);
894
- overflow: hidden;
895
- }
896
-
897
- .claim-part {
898
- display: contents;
899
- }
900
-
901
- .claim-part > dt,
902
- .claim-part > dd {
903
- margin: 0;
904
- padding: 9px 12px;
905
- border-top: 1px solid var(--dpk-rule);
906
- }
907
-
908
- .claim-part:first-child > dt,
909
- .claim-part:first-child > dd {
910
- border-top: none;
911
- }
912
-
913
- .claim-part > dt {
914
- color: var(--dpk-ink-soft);
915
- font-size: 11.5px;
916
- font-weight: 650;
917
- letter-spacing: 0.04em;
918
- padding-top: 11px;
919
- }
920
-
921
- /* The conclusion is what the claim asserts: its label reads strongest. */
922
- .claim-part[data-part='conclusions'] > dt {
923
- color: var(--dpk-ink);
924
- }
925
-
926
- .claim-none {
927
- margin: 0;
928
- color: var(--dpk-ink-faint);
929
- font-size: 13px;
930
- }
931
-
932
- .clauses {
933
- display: grid;
934
- gap: 2px;
935
- margin: 0;
936
- padding: 0;
937
- list-style: none;
938
- }
939
-
940
- .clause {
941
- position: relative;
942
- display: flex;
943
- align-items: flex-start;
944
- gap: 6px;
945
- min-height: 28px;
946
- padding: 2px 0 2px 14px;
947
- font-size: 13.5px;
948
- line-height: 1.7;
949
- }
950
-
951
- .clause::before {
952
- content: '';
953
- position: absolute;
954
- left: 2px;
955
- top: 0.95em;
956
- width: 5px;
957
- height: 5px;
958
- border-radius: 50%;
959
- background: var(--dpk-ink-faint);
960
- }
961
-
962
- .clause-text {
963
- flex: 1;
964
- min-width: 0;
965
- overflow-wrap: anywhere;
966
- }
967
-
968
- /* ---------------------------------------------------------- assurance */
969
-
970
- .assurance {
971
- padding: 10px 14px;
972
- border-radius: var(--dpk-radius);
973
- background: var(--tone-soft);
974
- font-size: 12.5px;
975
- line-height: 1.6;
976
- }
977
-
978
- .assurance-label {
979
- margin: 0;
980
- color: var(--tone);
981
- font-weight: 650;
982
- }
983
-
984
- .assurance ul {
985
- margin: 4px 0 0;
986
- padding-left: 18px;
987
- color: var(--dpk-ink);
988
- }
989
-
990
- /* ---------------------------------------------------- examples / not */
991
-
992
- .claim-aside h5 {
993
- margin: 0 0 2px;
994
- color: var(--dpk-ink-soft);
995
- font-size: 11.5px;
996
- font-weight: 650;
997
- letter-spacing: 0.04em;
998
- }
999
-
1000
- .claim-aside[data-part='not-claimed'] {
1001
- padding: 10px 14px;
1002
- border: 1px dashed var(--dpk-rule-strong);
1003
- border-radius: var(--dpk-radius);
1004
- }
1005
-
1006
- .claim-aside[data-part='not-claimed'] .clause::before {
1007
- content: '×';
1008
- left: 0;
1009
- top: 0;
1010
- width: auto;
1011
- height: auto;
1012
- border-radius: 0;
1013
- background: none;
1014
- color: var(--dpk-ink-faint);
1015
- font-weight: 700;
1016
- }
1017
-
1018
- .claim-aside[data-part='not-claimed'] .clause-text {
1019
- color: var(--dpk-ink-soft);
1020
- }
1021
-
1022
- /* ------------------------------------------------------------- footer */
1023
-
1024
- .claim-foot {
1025
- display: flex;
1026
- flex-wrap: wrap;
1027
- align-items: center;
1028
- gap: 6px 8px;
1029
- padding-top: 10px;
1030
- border-top: 1px solid var(--dpk-rule);
1031
- color: var(--dpk-ink-faint);
1032
- font-size: 11.5px;
1033
- }
1034
-
1035
- .claim-foot-label {
1036
- font-weight: 650;
1037
- }
1038
-
1039
- .term-chip {
1040
- padding: 1px 9px;
1041
- border: 1px solid var(--dpk-rule-strong);
1042
- border-radius: 999px;
1043
- background: var(--dpk-paper);
1044
- color: var(--dpk-ink-soft);
1045
- font: inherit;
1046
- cursor: help;
1047
- }
1048
-
1049
- .term-chip:is(:hover, :focus-visible) {
1050
- border-color: var(--dpk-violet);
1051
- color: var(--dpk-violet);
1052
- }
1053
-
1054
- .claim-source {
1055
- margin-left: auto;
1056
- }
1057
-
1058
- .claim-source code {
1059
- font-family: var(--dpk-mono);
1060
- font-size: 11px;
1061
- }
1062
-
1063
- /* -------------------------------------------------------------- terms */
1064
-
1065
- .term {
1066
- display: inline;
1067
- padding: 0 1px;
1068
- border: none;
1069
- border-bottom: 1.5px dotted var(--dpk-violet);
1070
- background: none;
1071
- color: inherit;
1072
- font: inherit;
1073
- font-weight: 600;
1074
- cursor: help;
1075
- }
1076
-
1077
- .term:hover,
1078
- .term:focus-visible {
1079
- background: var(--dpk-violet-soft);
1080
- outline: none;
1081
- }
1082
-
1083
- /* ----------------------------------------------------------- tooltip */
1084
-
1085
- /* Sized to its text: the popover helper sets a fixed width, which only !important overrides. */
1086
- .spec-tip {
1087
- box-sizing: border-box;
1088
- position: fixed;
1089
- inset: auto;
1090
- width: max-content !important;
1091
- max-width: min(300px, calc(100vw - 16px));
1092
- margin: 0;
1093
- padding: 8px 11px;
1094
- border: 1px solid var(--dpk-rule-strong);
1095
- border-radius: var(--dpk-radius);
1096
- background: var(--dpk-paper-raised);
1097
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
1098
- color: var(--dpk-ink);
1099
- font-size: 12.5px;
1100
- line-height: 1.6;
1101
- pointer-events: none;
1102
- }
1103
-
1104
- .spec-tip p {
1105
- margin: 0;
1106
- }
1107
-
1108
- .tip-title {
1109
- color: var(--dpk-violet);
1110
- font-weight: 650;
1111
- }
1112
-
1113
- .spec-tip[data-tone] .tip-title {
1114
- color: var(--tone);
1115
- }
1116
-
1117
- .term-static {
1118
- border-bottom: 1.5px dotted var(--dpk-violet);
1119
- font-weight: 600;
1120
- }
1121
-
1122
- @container (max-width: 520px) {
1123
- .claim-parts {
1124
- grid-template-columns: 1fr;
1125
- }
1126
-
1127
- .claim-part > dd {
1128
- border-top: none;
1129
- padding-top: 0;
1130
- }
1131
- }
1132
-
1133
- /* ---------------------------------------------------------- comments */
1134
- /* "Review comment" opens from the right-click menu (src/core/context-menu); the
1135
- popover itself still renders here, anchored at the target's own element. */
1136
-
1137
- .comment-target {
1138
- font-size: 12px;
1139
- overflow-wrap: anywhere;
1140
- }
1141
-
1142
- .comment-error {
1143
- margin: 0;
1144
- font-size: 11px;
1145
- color: var(--dpk-accent);
1146
- }
1147
- `],ks=n=>`claim-body-${n}`;class vs extends A{static{this.styles=Ui}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String}}}#a=null;#t=new Map;#e=null;#n=null;#s="";#i=new Set;#r=null;#o=null;#l=new qt(this);#c=new ut(this);#p=new O(this,()=>{this.#s=""});constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null}connectedCallback(){super.connectedCallback(),this.#s="",document.addEventListener("keydown",this.#z),document.addEventListener("pointerdown",this.#S),this.#n=X(this,us,t=>{t.ok?this.#b(t.value):this.#x(t.error)})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.#z),document.removeEventListener("pointerdown",this.#S),this.#n?.(),this.#n=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#b(this.data)}updated(){this.#k(),this.#c.sync(this.renderRoot.querySelector(".comment-pop")),this.#w()}getContextMenuItems(t){const e=Et(t.target,this.commentTargets,Ut(this.#p.locale),(s,a)=>this.#g(s,a));return e===null?null:[e]}#g(t,e){const s=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#c.open(t,s,e)}#u(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}get commentTargets(){if(!this.id||this.#a===null)return[];const t=`${this.subject??this.heading??this.#d.heading} \xB7 ${this.id}`;return qi(this.#a).map(({target:e,label:s})=>({value:this.#f(e),label:s,group:t}))}get dataError(){return this.#e}get#d(){return wi(this.#p.locale)}#m(){return this.#a??Mi()}#b(t){this.#a=t,this.#t=new Map(t.terms.map(e=>[e.id,e])),this.#e=null,this.requestUpdate()}#x(t){this.#a=null,this.#t=new Map,this.#e=t,console.error("[dev-process-kit] invalid formal spec data:",t),this.requestUpdate()}#f(t){return`element:${[this.id,...Di(t)].map(e=>encodeURIComponent(e)).join("/")}`}#k(){const t=JSON.stringify(this.commentTargets);t!==this.#s&&(this.#s=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#h(t){const e=new Set(this.#i);if(e.delete(t)||e.add(t),this.#i=e,!e.has(t)){const s=this.#r?.anchor;s?.closest(".claim-body")?.id===ks(t)&&this.#v(s)}this.requestUpdate()}#C(t,e){const s=t.composedPath()[0];s instanceof Element&&s.closest("button, a")||(document.getSelection()?.toString()??"")===""&&this.#h(e)}#w(){const t=this.#r?.anchor??null,e=this.#o!==t;e&&(this.#o?.removeAttribute("aria-describedby"),t?.setAttribute("aria-describedby","spec-tip")),this.#o=t;const s=this.renderRoot.querySelector(".spec-tip");!s||!t||!e||this.#l.open(s,t,{width:300,height:240},{placement:"top-start"})}#y(t,e){this.#r?.anchor!==e&&(this.#r={tip:t,anchor:e},this.requestUpdate())}#v(t){this.#r===null||t!==void 0&&this.#r.anchor!==t||(this.#r=null,this.requestUpdate())}#z=t=>{t.key==="Escape"&&this.#v()};#S=t=>{this.#r!==null&&!t.composedPath().includes(this.#r.anchor)&&this.#v()};#E(t){const e=(a,i)=>{a.currentTarget instanceof HTMLElement&&i(a.currentTarget)},s=a=>a.pointerType!=="touch";return{enter:a=>s(a)&&e(a,i=>this.#y(t,i)),leave:a=>s(a)&&e(a,i=>this.#v(i)),show:a=>e(a,i=>this.#y(t,i)),hide:a=>e(a,i=>this.#v(i))}}render(){const t=this.#d,e=this.#m();return d`
1148
- <section class="spec">
1149
- <header class="spec-toolbar">
1150
- <span class="spec-title">${this.heading??t.heading}</span>
1151
- ${this.subject?d`<span class="spec-subject">${this.subject}</span>`:h}
1152
- <span class="spec-stats">${this.#_(e)}</span>
1153
- </header>
1154
- ${this.#e===null?h:d`<p class="spec-notice" role="alert">${t.dataError}<br />${this.#e}</p>`}
1155
- ${this.#e===null&&e.claims.length===0?d`<p class="spec-empty">${t.empty}</p>`:h}
1156
- <div class="spec-groups">
1157
- ${U(gs(e),s=>s.target?.id??"",s=>this.#L(s))}
1158
- </div>
1159
- </section>
1160
- ${this.#q()}
1161
- ${this.#c.render({locale:this.#p.locale,errorMessage:this.#d.sendFailed,submit:(s,a)=>this.#u(s,a)})}
1162
- `}#_(t){const e=this.#d,s=Ri(t),a=[{tone:"unsound",label:e.incomplete,count:s.incomplete},{tone:"caveat",label:e.bounded,count:s.bounded},{tone:"caveat",label:e.conditional,count:s.conditional},{tone:"planned",label:e.planned,count:s.planned}].filter(i=>i.count>0);return d`${e.claims(t.claims.length)}
1163
- ${a.map(i=>d`<span class="spec-chip" data-tone=${i.tone}>${i.label} ${i.count}</span>`)}`}#L(t){const e=d`<div class="spec-claims">
1164
- ${U(t.claims,a=>a.id,a=>this.#T(a))}
1165
- </div>`,s=t.target;return s===null?e:d`<section class="target-group" data-target=${s.id}>
1166
- <header class="target-head" data-dpk-target=${this.#f({kind:"target",target:s.id})}>
1167
- <span class="target-label">${this.#d.target}</span>
1168
- <h3 class="target-name">${s.name}</h3>
1169
- ${s.code===null?h:d`<code class="target-code">${s.code}</code>`}
1170
- </header>
1171
- ${s.summary===null?h:d`<p class="target-summary">${this.#M(s.summary)}</p>`}
1172
- ${t.claims.length===0?d`<p class="spec-empty">${this.#d.noClaims}</p>`:e}
1173
- </section>`}#T(t){const e=this.#d,s=te(e,t.assurance),a=this.#i.has(t.id),i=this.#E({kind:"assurance",claim:t.id}),r=ks(t.id);return d`
1174
- <article class="claim" data-claim=${t.id} data-tone=${s.tone}>
1175
- <div
1176
- class="claim-head"
1177
- data-dpk-target=${this.#f({kind:"claim",claim:t.id})}
1178
- @click=${o=>this.#C(o,t.id)}
1179
- >
1180
- <button
1181
- type="button"
1182
- class="dpk-icon-btn claim-toggle"
1183
- aria-expanded=${a?"true":"false"}
1184
- aria-controls=${a?r:h}
1185
- aria-label=${a?e.hideDetails:e.showDetails}
1186
- @click=${()=>this.#h(t.id)}
1187
- >
1188
- ${Se()}
1189
- </button>
1190
- <h4 class="claim-statement">${this.#M(t.statement)}</h4>
1191
- <button
1192
- type="button"
1193
- class="assurance-badge"
1194
- data-tone=${s.tone}
1195
- @pointerenter=${i.enter}
1196
- @pointerleave=${i.leave}
1197
- @focus=${i.show}
1198
- @blur=${i.hide}
1199
- @click=${i.show}
1200
- >
1201
- ${s.label}
1202
- </button>
1203
- </div>
1204
- ${a?this.#D(t,r):h}
1205
- </article>
1206
- `}#D(t,e){const s=this.#d,a=te(s,t.assurance);return d`<div class="claim-body" id=${e}>
1207
- <dl class="claim-parts">
1208
- ${t.subjects.length===0?h:this.#A("subjects",s.subjects,t,t.subjects)}
1209
- ${t.premises.length===0?d`<div class="claim-part" data-part="premises">
1210
- <dt>${s.premises}</dt>
1211
- <dd><p class="claim-none">${s.noPremises}</p></dd>
1212
- </div>`:this.#A("premises",s.premises,t,t.premises)}
1213
- ${this.#A("conclusions",s.conclusions,t,t.conclusions)}
1214
- </dl>
1215
- ${a.itemsLabel===null?h:d`<div class="assurance" data-tone=${a.tone}>
1216
- <p class="assurance-label">${a.itemsLabel}</p>
1217
- <ul>
1218
- ${a.items.map(i=>d`<li>${this.#M(i)}</li>`)}
1219
- </ul>
1220
- </div>`}
1221
- ${t.examples.length===0?h:d`<section class="claim-aside" data-part="examples">
1222
- <h5>${s.examples}</h5>
1223
- ${this.#P(t,t.examples)}
1224
- </section>`}
1225
- ${t.notClaimed.length===0?h:d`<section class="claim-aside" data-part="not-claimed">
1226
- <h5>${s.notClaimed}</h5>
1227
- ${this.#P(t,t.notClaimed)}
1228
- </section>`}
1229
- ${this.#O(t)}
1230
- </div>`}#A(t,e,s,a){return d`<div class="claim-part" data-part=${t}>
1231
- <dt>${e}</dt>
1232
- <dd>${this.#P(s,a)}</dd>
1233
- </div>`}#P(t,e){return d`<ul class="clauses">
1234
- ${U(e,s=>s.id,s=>d`<li
1235
- class="clause"
1236
- data-clause=${s.id}
1237
- data-dpk-target=${this.#f({kind:"clause",claim:t.id,clause:s.id})}
1238
- >
1239
- <span class="clause-text">${this.#M(s.text)}</span>
1240
- </li>`)}
1241
- </ul>`}#O(t){const e=this.#d,s=t.terms.flatMap(a=>this.#t.get(a)??[]);return s.length===0&&t.source===null?h:d`<footer class="claim-foot">
1242
- ${s.length===0?h:d`<span class="claim-foot-label">${e.usesTerms}</span> ${s.map(a=>this.#$("term-chip",a.id,a.name))}`}
1243
- ${t.source===null?h:d`<span class="claim-source"
1244
- >${e.source}: ${t.source.tool===null?h:d`${t.source.tool} · `}<code
1245
- >${t.source.ref}</code
1246
- ></span
1247
- >`}
1248
- </footer>`}#M(t){return d`${t.map(e=>e.kind==="text"?e.text:this.#$("term",e.id,e.label))}`}#R(t){return d`${t.map(e=>e.kind==="text"?e.text:d`<span class="term-static">${e.label}</span>`)}`}#$(t,e,s){const a=this.#E({kind:"term",term:e});return d`<button
1249
- type="button"
1250
- class=${t}
1251
- data-term=${e}
1252
- @pointerenter=${a.enter}
1253
- @pointerleave=${a.leave}
1254
- @focus=${a.show}
1255
- @blur=${a.hide}
1256
- @click=${a.show}
1257
- >
1258
- ${s}
1259
- </button>`}#q(){const t=this.#r?.tip;if(t===void 0)return h;const e=this.#I(t);return e===null?h:d`<div
1260
- id="spec-tip"
1261
- class="spec-tip"
1262
- role="tooltip"
1263
- popover="manual"
1264
- data-tone=${e.tone??h}
1265
- >
1266
- <p class="tip-title">${e.title}</p>
1267
- <p class="tip-body">${e.body}</p>
1268
- </div>`}#I(t){if(t.kind==="term"){const a=this.#t.get(t.term);return a===void 0?null:{title:a.name,body:this.#R(a.meaning)}}const e=this.#a?.claims.find(a=>a.id===t.claim);if(e===void 0)return null;const s=te(this.#d,e.assurance);return{title:s.label,body:s.detail,tone:s.tone}}}const xs=()=>{customElements.get("dpk-formal-spec")||customElements.define("dpk-formal-spec",vs)},Ni=D({en:{heading:"Diff",empty:"No changes.",dataError:"The diff could not be read:",summary:n=>`${n} ${n===1?"file":"files"} changed`,unified:"Unified",split:"Split",viewLabel:"Layout",added:"Added",deleted:"Deleted",renamed:"Renamed",copied:"Copied",modified:"Modified",binary:"Binary file not shown.",noContentChange:"No content changes.",modeChanged:(n,t)=>`File mode changed from ${n} to ${t}.`,noNewline:"No newline at end of file",collapse:n=>`Collapse ${n}`,expand:n=>`Expand ${n}`,commentOn:n=>`Comment on ${n}`,addOn:n=>`Comment on or suggest a change to ${n}`,composerTabs:"Comment or suggestion",comment:"Comment",addComment:"Add",threadOn:n=>`Comments on ${n}`,reply:"Reply",replyPlaceholder:"Reply\u2026",suggestChange:"Suggest change",suggestion:"Suggested change",suggest:"Suggest",cancel:"Cancel",suggestionLabel:"Suggested text",deleteLine:"Delete this line",unrecorded:"Could not record it. Place this inside a dpk-view-* element.",sendFailed:"Could not send. Place this inside a dpk-view-* element.",lineLabel:(n,t,e)=>`${n}:${t}${e===""?"":` ${e}`}`,suggestTitle:(n,t)=>`Suggested change: ${n}:${t}`,deletedLine:n=>`${n} (deleted)`},ja:{heading:"\u5DEE\u5206",empty:"\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u5DEE\u5206\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F:",summary:n=>`${n} \u30D5\u30A1\u30A4\u30EB\u3092\u5909\u66F4`,unified:"\u7D71\u5408",split:"\u5DE6\u53F3",viewLabel:"\u30EC\u30A4\u30A2\u30A6\u30C8",added:"\u8FFD\u52A0",deleted:"\u524A\u9664",renamed:"\u540D\u524D\u5909\u66F4",copied:"\u30B3\u30D4\u30FC",modified:"\u5909\u66F4",binary:"\u30D0\u30A4\u30CA\u30EA\u30D5\u30A1\u30A4\u30EB\u306F\u8868\u793A\u3057\u307E\u305B\u3093\u3002",noContentChange:"\u5185\u5BB9\u306E\u5909\u66F4\u306F\u3042\u308A\u307E\u305B\u3093\u3002",modeChanged:(n,t)=>`\u30D5\u30A1\u30A4\u30EB\u30E2\u30FC\u30C9\u3092 ${n} \u304B\u3089 ${t} \u306B\u5909\u66F4\u3002`,noNewline:"\u30D5\u30A1\u30A4\u30EB\u672B\u5C3E\u306B\u6539\u884C\u304C\u3042\u308A\u307E\u305B\u3093",collapse:n=>`${n} \u3092\u6298\u308A\u305F\u305F\u3080`,expand:n=>`${n} \u3092\u5C55\u958B`,commentOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8`,addOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8\u30FB\u5909\u66F4\u3092\u63D0\u6848`,composerTabs:"\u30B3\u30E1\u30F3\u30C8\u304B\u5909\u66F4\u306E\u63D0\u6848",comment:"\u30B3\u30E1\u30F3\u30C8",addComment:"\u8FFD\u52A0",threadOn:n=>`${n} \u3078\u306E\u30B3\u30E1\u30F3\u30C8`,reply:"\u8FD4\u4FE1",replyPlaceholder:"\u8FD4\u4FE1\u3059\u308B\u2026",suggestChange:"\u5909\u66F4\u3092\u63D0\u6848",suggestion:"\u5909\u66F4\u306E\u63D0\u6848",suggest:"\u63D0\u6848",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",suggestionLabel:"\u63D0\u6848\u3059\u308B\u30C6\u30AD\u30B9\u30C8",deleteLine:"\u3053\u306E\u884C\u3092\u524A\u9664",unrecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",lineLabel:(n,t,e)=>`${n}:${t}${e===""?"":` ${e}`}`,suggestTitle:(n,t)=>`\u5909\u66F4\u306E\u63D0\u6848: ${n}:${t}`,deletedLine:n=>`${n}\uFF08\u524A\u9664\u884C\uFF09`}}),ys=()=>({files:[]}),ft=n=>n.newLine===null?`L${n.oldLine??0}`:`R${n.newLine}`,ji=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@ ?(.*)$/,Fi=n=>{const t=n.replace(/\r\n?/g,`
1269
- `).replace(/<\\\/script/gi,"<\/script").split(`
1270
- `),e=t.findIndex(r=>r.trim()!=="");if(e===-1)return[];let s=t.length-1;for(;s>e&&(t[s]??"").trim()==="";)s-=1;const a=t.slice(e,s+1),i=/^[ \t]*/.exec(a[0]??"")?.[0]??"";return i===""?a:a.map(r=>r.startsWith(i)?r.slice(i.length):r)},ws=n=>{const t=[],e=new TextEncoder,s={n:`
1271
- `,t:" ",'"':'"',"\\":"\\",a:"\x07",b:"\b"};for(let a=1;a<n.length-1;a+=1){const i=n.charAt(a);if(i!=="\\"){t.push(...e.encode(i));continue}const r=/^[0-7]{3}/.exec(n.slice(a+1))?.[0];if(r!==void 0){t.push(Number.parseInt(r,8)),a+=3;continue}const o=n.charAt(a+1);t.push(...e.encode(s[o]??o)),a+=1}return new TextDecoder().decode(new Uint8Array(t))},bt=n=>{const t=n.trimEnd();if(t.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(t)?.[0];if(s!==void 0)return ws(s)}const e=t.indexOf(" ");return e===-1?t:t.slice(0,e)},kt=(n,t)=>n.startsWith(t)?n.slice(t.length):n,$s=(n,t)=>{const e=bt(n);return e==="/dev/null"?null:kt(e,t)},Hi=n=>{if(n.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(n)?.[0];if(s===void 0)return[null,null];const a=n.slice(s.length).trimStart();return[kt(ws(s),"a/"),kt(bt(a),"b/")]}const t=(n.length-1)/2;if(Number.isInteger(t)&&n.charAt(t)===" "){const s=n.slice(0,t),a=n.slice(t+1);if(s.startsWith("a/")&&a.startsWith("b/")&&s.slice(2)===a.slice(2))return[s.slice(2),a.slice(2)]}const e=n.indexOf(" b/");return e===-1?[null,null]:[kt(n.slice(0,e),"a/"),kt(bt(n.slice(e+1)),"b/")]},Cs=()=>({headerOld:null,headerNew:null,oldPath:void 0,newPath:void 0,status:null,binary:!1,oldMode:null,newMode:null,hunks:[],sawOld:!1,sawNew:!1,skipping:!1}),Wi=n=>{const t=n.oldPath===void 0?n.headerOld:n.oldPath,e=n.newPath===void 0?n.headerNew:n.newPath,s=n.status??(t===null&&e!==null?"added":e===null?"deleted":"modified"),a=(s==="deleted"?t:e)??t??e;if(a===null)throw new Error("a file in the diff has no path");const i=n.hunks.map(o=>({oldStart:o.oldStart,oldCount:o.oldCount,newStart:o.newStart,newCount:o.newCount,section:o.section,lines:o.lines})),r=i.flatMap(o=>o.lines);return{path:a,oldPath:s==="added"?null:t,newPath:s==="deleted"?null:e,status:s,binary:n.binary,oldMode:n.oldMode,newMode:n.newMode,hunks:i,additions:r.filter(o=>o.kind==="add").length,deletions:r.filter(o=>o.kind==="del").length}},Bi=(n,t)=>{const e=ji.exec(n);if(e===null)throw new Error(`line ${t}: unreadable hunk header "${n}"`);const[,s="0",a="1",i="0",r="1",o=""]=e,l={oldCount:Number(a),newCount:Number(r)};return{oldStart:Number(s),newStart:Number(i),...l,section:o.trim(),lines:[],oldLeft:l.oldCount,newLeft:l.newCount}},Ki=(n,t)=>{const e=t.charAt(0),s=e===" "||t===""?"context":e==="+"?"add":e==="-"?"del":null;if(s===null)return!1;const a=s==="add"?null:n.oldStart+(n.oldCount-n.oldLeft),i=s==="del"?null:n.newStart+(n.newCount-n.newLeft);return s!=="add"&&(n.oldLeft-=1),s!=="del"&&(n.newLeft-=1),n.lines.push({kind:s,text:t.slice(1),oldLine:a,newLine:i,noNewline:!1}),!0},Ss=n=>{const t=n?.lines.at(-1);n!==void 0&&t!==void 0&&(n.lines[n.lines.length-1]={...t,noNewline:!0})},Es=n=>{const t=Fi(n),e=[];let s=null,a=null;const i=()=>{s!==null&&e.push(Wi(s)),s=null,a=null};for(const[o,l]of t.entries()){const c=o+1,p=a;if(p!==null){if(p.oldLeft>0||p.newLeft>0){if(l.startsWith("\\")){Ss(p);continue}if(Ki(p,l))continue}else if(l.startsWith("\\")){Ss(p);continue}a=null}if(l.startsWith("diff --git ")){i();const f=Cs();[f.headerOld,f.headerNew]=Hi(l.slice(11)),s=f;continue}if(l.startsWith("diff --cc ")||l.startsWith("diff --combined "))throw new Error(`line ${c}: combined (merge) diffs are not supported`);if(l.startsWith("--- ")&&(t[o+1]??"").startsWith("+++ ")){const f=s;(f===null||f.hunks.length>0||f.sawOld)&&(i(),s=Cs()),s!==null&&(s.oldPath=$s(l.slice(4),"a/"),s.sawOld=!0);continue}const m=s;if(!(m===null||m.skipping)){if(l.startsWith("+++ ")&&m.hunks.length===0&&!m.sawNew){m.newPath=$s(l.slice(4),"b/"),m.sawNew=!0;continue}if(l.startsWith("@@ ")){const f=Bi(l,c);m.hunks.push(f),a=f;continue}m.hunks.length>0||Vi(m,l)}}if(i(),e.length===0&&t.length>0)throw new Error("no file diff found (expected the output of git diff)");const r=new Set;for(const o of e){if(r.has(o.path))throw new Error(`the diff has ${o.path} twice`);r.add(o.path)}return{files:e}},Vi=(n,t)=>{const e=o=>t.startsWith(o)?t.slice(o.length):null,s=e("new file mode ");if(s!==null){n.status="added",n.newMode=s.trim();return}const a=e("deleted file mode ");if(a!==null){n.status="deleted",n.oldMode=a.trim();return}const i=e("old mode ");if(i!==null){n.oldMode=i.trim();return}const r=e("new mode ");if(r!==null){n.newMode=r.trim();return}for(const[o,l,c]of[["rename from ","old","renamed"],["rename to ","new","renamed"],["copy from ","old","copied"],["copy to ","new","copied"]]){const p=e(o);if(p!==null){n.status=c,l==="old"?n.oldPath=bt(p):n.newPath=bt(p);return}}if(t.startsWith("Binary files ")&&t.endsWith(" differ")){n.binary=!0;return}t==="GIT binary patch"&&(n.binary=!0,n.skipping=!0)},v=(n,t,e)=>e===void 0?{kind:n,pattern:t}:{kind:n,pattern:t,next:e},ot=v(null,/\s+/y),ee=v("string",/"(?:\\.|[^\\"\n])*"?|'(?:\\.|[^\\'\n])*'?/y),zt=v("comment",/\/\*[\s\S]*?(?:\*\/|$)/y),Gi=["abstract","as","async","await","break","case","catch","class","const","continue","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","keyof","let","new","null","of","private","protected","public","readonly","return","satisfies","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","yield"],Ji=["action","all","and","any","as","assume","bool","Bool","const","def","else","export","false","from","if","iff","implies","import","int","Int","match","module","Nat","nondet","not","or","pure","run","str","temporal","true","type","val","var"],Xi={js:{start:"code",rules:{code:[ot,v("comment",/\/\/[^\n]*/y),zt,v("string",/`(?:\\[\s\S]|[^\\`])*`?/y),ee,v("number",/(?:0[xob][\da-f_]+|\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?)n?/iy),v("keyword",new RegExp(`(?:${Gi.join("|")})(?![\\w$])`,"y")),v("function",/[A-Za-z_$][\w$]*(?=\s*\()/y),v(null,/[A-Za-z_$][\w$]*/y)]}},html:{start:"text",rules:{text:[v("comment",/<!--[\s\S]*?(?:-->|$)/y),v("keyword",/&#?\w+;/y),v("tag",/<\/?[A-Za-z][\w:.-]*/y,"tag"),v(null,/[^<&]+/y)],tag:[ot,v("tag",/\/?>/y,"text"),v("punct",/=/y),v("string",/"[^"]*"?|'[^']*'?/y),v("attr",/[^\s=>/"']+/y)]}},css:{start:"sheet",rules:{sheet:[ot,zt,ee,v("keyword",/@[\w-]+/y),v("punct",/[{}]/y),v("tag",/[^{};]+(?=\{)/y),v("property",/-{0,2}[A-Za-z][\w-]*(?=\s*:)/y),v("number",/#[\da-f]{3,8}(?![\w-])/iy),v(null,/-?[A-Za-z_][\w-]*/y),v("number",/-?(?:\d*\.)?\d+[a-z%]*/iy)]}},json:{start:"value",rules:{value:[ot,v("comment",/\/\/[^\n]*/y),zt,v("property",/"(?:\\.|[^\\"\n])*"(?=\s*:)/y),v("string",/"(?:\\.|[^\\"\n])*"?/y),v("number",/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/iy),v("keyword",/(?:true|false|null)(?!\w)/y)]}},sh:{start:"line",rules:{line:[ot,v("comment",/(?<!\S)#[^\n]*/y),ee,v("keyword",/\$\{[^}\n]*\}?|\$\w+/y),v("attr",/(?<!\S)--?[\w-]+/y),v(null,/[^\s"'$#]+/y)]}},quint:{start:"code",rules:{code:[ot,v("comment",/\/\/[^\n]*/y),zt,v("string",/"(?:\\.|[^\\"\n])*"?/y),v("number",/0x[\da-f_]+|\d[\d_]*/iy),v("keyword",new RegExp(`(?:${Ji.join("|")})(?!\\w)`,"y")),v("function",/[A-Za-z_]\w*(?=\s*\()/y),v(null,/[A-Za-z_]\w*/y)]}}},Yi={js:"js",javascript:"js",jsx:"js",mjs:"js",cjs:"js",ts:"js",typescript:"js",tsx:"js",mts:"js",html:"html",xml:"html",svg:"html",vue:"html",css:"css",json:"json",jsonc:"json",json5:"json",sh:"sh",bash:"sh",zsh:"sh",shell:"sh",console:"sh",quint:"quint",qnt:"quint"},Zi=n=>n===null?null:Yi[n.trim().toLowerCase()]??null,Ts=(n,t,e)=>{const s=n.at(-1);t===null&&s!==void 0&&s.kind===null?n[n.length-1]={kind:t,text:s.text+e}:n.push({kind:t,text:e})},se=(n,t)=>{const e=Zi(t);if(e===null)return n===""?[]:[{kind:null,text:n}];const{start:s,rules:a}=Xi[e],i=[];let r=s,o=0;for(;o<n.length;){const l=(a[r]??[]).find(c=>(c.pattern.lastIndex=o,c.pattern.test(n)&&c.pattern.lastIndex>o));if(l===void 0){Ts(i,null,n.charAt(o)),o+=1;continue}Ts(i,l.kind,n.slice(o,l.pattern.lastIndex)),o=l.pattern.lastIndex,r=l.next??r}return i},Qi=n=>n.kind==="file"?["file",n.path]:["line",n.path,n.line],Ms=n=>{const t=n.slice(n.lastIndexOf("/")+1),e=t.lastIndexOf(".");return e<=0?null:t.slice(e+1)},_t=/[\p{L}\p{N}_$]/u,tr=(n,t)=>{let e=t;for(;e>0&&_t.test(n.charAt(e-1))&&_t.test(n.charAt(e));)e-=1;return e},er=(n,t)=>{let e=t;for(;e<n.length&&_t.test(n.charAt(e))&&_t.test(n.charAt(e-1));)e+=1;return e},sr=(n,t)=>{if(n===t)return null;const e=Math.min(n.length,t.length);let s=0;for(;s<e&&n.charAt(s)===t.charAt(s);)s+=1;let a=0;for(;a<e-s&&n.charAt(n.length-1-a)===t.charAt(t.length-1-a);)a+=1;if((n.slice(0,s).trim().length+n.slice(n.length-a).trim().length)*4<Math.max(n.trim().length,t.trim().length))return null;const r=o=>{const l=tr(o,s),c=er(o,o.length-a);return[l,Math.max(l,c)]};return{before:r(n),after:r(t)}},nr=(n,t,e)=>{const s=[];let a=0;for(const i of se(n,t)){const r=a+i.text.length,o=e===null?[]:e.filter(c=>c>a&&c<r);let l=a;for(const c of[...o,r]){const p=i.text.slice(l-a,c-a),m=e!==null&&l>=e[0]&&c<=e[1]&&e[0]<e[1];p!==""&&s.push({kind:i.kind,text:p,changed:m}),l=c}a=r}return s},As=n=>{const t=new Map;for(const e of n)if(e.kind!=="context")for(const[s,a]of e.dels.entries()){const i=e.adds[s];if(i===void 0)break;const r=sr(a.text,i.text);r!==null&&(t.set(a,r.before),t.set(i,r.after))}return t},zs=n=>{const t=[];let e=null;for(const s of n.lines){if(s.kind==="context"){e=null,t.push({kind:"context",line:s});continue}(e===null||s.kind==="del"&&e.adds.length>0)&&(e={kind:"change",dels:[],adds:[]},t.push(e)),(s.kind==="del"?e.dels:e.adds).push(s)}return t},vt=(n,t,e,s=!0)=>({line:n,id:ft(n),segments:nr(n.text,t,e.get(n)??null),target:s}),ar=n=>{const t=Ms(n.path);return n.hunks.flatMap(e=>{const s=As(zs(e));return[{kind:"hunk",hunk:e},...e.lines.map(a=>({kind:"line",cell:vt(a,t,s)}))]})},ir=n=>{const t=Ms(n.path);return n.hunks.flatMap(e=>{const s=zs(e),a=As(s),i=[{kind:"hunk",hunk:e}];for(const r of s){if(r.kind==="context"){i.push({kind:"pair",left:vt(r.line,t,a,!1),right:vt(r.line,t,a)});continue}for(let o=0;o<Math.max(r.dels.length,r.adds.length);o+=1){const l=r.dels[o],c=r.adds[o];i.push({kind:"pair",left:l===void 0?null:vt(l,t,a),right:c===void 0?null:vt(c,t,a)})}}return i})},_s=40,rr=n=>{const t=n.trim().replace(/\s+/g," ");return t.length>_s?`${t.slice(0,_s-1)}\u2026`:t},or=(n,t)=>t.startsWith("R")?t.slice(1):n.deletedLine(`-${t.slice(1)}`),Ls=(n,t,e)=>n.lineLabel(t,or(n,ft(e)),rr(e.text)),lr=(n,t)=>t.files.flatMap(e=>[{target:{kind:"file",path:e.path},label:e.path},...e.hunks.flatMap(s=>s.lines.map(a=>({target:{kind:"line",path:e.path,line:ft(a)},label:Ls(n,e.path,a)})))]),dr=n=>({files:n.files.length,additions:n.files.reduce((t,e)=>t+e.additions,0),deletions:n.files.reduce((t,e)=>t+e.deletions,0)}),cr=[L,J,ht,_`
1272
- :host {
1273
- display: block;
1274
- color: var(--dpk-ink);
1275
- font-family: var(--dpk-body);
1276
- --diff-add: color-mix(in srgb, var(--dpk-green) 11%, transparent);
1277
- --diff-add-strong: color-mix(in srgb, var(--dpk-green) 28%, transparent);
1278
- --diff-add-num: color-mix(in srgb, var(--dpk-green) 18%, transparent);
1279
- --diff-del: color-mix(in srgb, var(--dpk-danger) 10%, transparent);
1280
- --diff-del-strong: color-mix(in srgb, var(--dpk-danger) 26%, transparent);
1281
- --diff-del-num: color-mix(in srgb, var(--dpk-danger) 16%, transparent);
1282
- }
1283
-
1284
- .diff {
1285
- display: grid;
1286
- gap: 12px;
1287
- }
1288
-
1289
- /* ----------------------------------------------------------- toolbar */
1290
-
1291
- .toolbar {
1292
- display: flex;
1293
- flex-wrap: wrap;
1294
- align-items: center;
1295
- gap: 6px 12px;
1296
- padding: 0 2px 10px;
1297
- border-bottom: 1px solid var(--dpk-rule);
1298
- }
1299
-
1300
- .title {
1301
- font-family: var(--dpk-display);
1302
- font-size: 14px;
1303
- font-weight: 650;
1304
- }
1305
-
1306
- .summary {
1307
- display: inline-flex;
1308
- gap: 6px;
1309
- color: var(--dpk-ink-soft);
1310
- font-size: 12.5px;
1311
- }
1312
-
1313
- .stat-add {
1314
- color: var(--dpk-green);
1315
- font-weight: 600;
1316
- }
1317
-
1318
- .stat-del {
1319
- color: var(--dpk-danger);
1320
- font-weight: 600;
1321
- }
1322
-
1323
- .views {
1324
- display: inline-flex;
1325
- margin-left: auto;
1326
- padding: 2px;
1327
- border: 1px solid var(--dpk-rule);
1328
- border-radius: var(--dpk-radius-sm);
1329
- background: var(--dpk-paper-sunken);
1330
- }
1331
-
1332
- .views button {
1333
- padding: 2px 10px;
1334
- border: 0;
1335
- border-radius: var(--dpk-radius-xs);
1336
- background: transparent;
1337
- color: var(--dpk-ink-soft);
1338
- font: inherit;
1339
- font-size: 12px;
1340
- cursor: pointer;
1341
- }
1342
-
1343
- .views button[aria-pressed='true'] {
1344
- background: var(--dpk-paper-raised);
1345
- color: var(--dpk-ink);
1346
- font-weight: 600;
1347
- box-shadow: var(--dpk-shadow-xs);
1348
- }
1349
-
1350
- .views button:focus-visible {
1351
- outline: none;
1352
- box-shadow: var(--dpk-focus);
1353
- }
1354
-
1355
- .notice,
1356
- .empty {
1357
- margin: 0;
1358
- padding: 14px;
1359
- border-radius: var(--dpk-radius);
1360
- font-size: 12.5px;
1361
- }
1362
-
1363
- .notice {
1364
- background: var(--dpk-danger-soft);
1365
- color: var(--dpk-danger);
1366
- }
1367
-
1368
- .empty {
1369
- color: var(--dpk-ink-faint);
1370
- }
1371
-
1372
- /* -------------------------------------------------------------- file */
1373
-
1374
- .file {
1375
- overflow: hidden;
1376
- border: 1px solid var(--dpk-rule);
1377
- border-radius: var(--dpk-radius);
1378
- background: var(--dpk-paper-raised);
1379
- }
1380
-
1381
- .file-head {
1382
- display: flex;
1383
- align-items: center;
1384
- gap: 8px;
1385
- padding: 6px 8px;
1386
- background: var(--dpk-paper-sunken);
1387
- font-size: 12.5px;
1388
- }
1389
-
1390
- .file:has(.scroll, .file-note, .file-thread) .file-head {
1391
- border-bottom: 1px solid var(--dpk-rule);
1392
- }
1393
-
1394
- .toggle svg {
1395
- transition: transform var(--dpk-dur-fast) var(--dpk-ease);
1396
- }
1397
-
1398
- .toggle[aria-expanded='true'] svg {
1399
- transform: rotate(90deg);
1400
- }
1401
-
1402
- .status {
1403
- flex: none;
1404
- padding: 1px 7px;
1405
- border-radius: 999px;
1406
- background: var(--dpk-paper-inset);
1407
- color: var(--dpk-ink-soft);
1408
- font-size: 11px;
1409
- font-weight: 600;
1410
- }
1411
-
1412
- .status[data-status='added'] {
1413
- background: var(--dpk-green-soft);
1414
- color: var(--dpk-green);
1415
- }
1416
-
1417
- .status[data-status='deleted'] {
1418
- background: var(--dpk-danger-soft);
1419
- color: var(--dpk-danger);
1420
- }
1421
-
1422
- .status[data-status='renamed'],
1423
- .status[data-status='copied'] {
1424
- background: var(--dpk-blue-soft);
1425
- color: var(--dpk-blue);
1426
- }
1427
-
1428
- .path {
1429
- min-width: 0;
1430
- font-family: var(--dpk-mono);
1431
- font-weight: 600;
1432
- overflow-wrap: anywhere;
1433
- }
1434
-
1435
- .old-path {
1436
- color: var(--dpk-ink-faint);
1437
- font-weight: 400;
1438
- }
1439
-
1440
- .file-stat {
1441
- margin-left: auto;
1442
- font-size: 12px;
1443
- white-space: nowrap;
1444
- }
1445
-
1446
- .file-note {
1447
- margin: 0;
1448
- padding: 12px 14px;
1449
- color: var(--dpk-ink-faint);
1450
- font-size: 12.5px;
1451
- }
1452
-
1453
- /* ------------------------------------------------------------- lines */
1454
-
1455
- .scroll {
1456
- overflow-x: auto;
1457
- }
1458
-
1459
- .lines {
1460
- width: 100%;
1461
- border-collapse: collapse;
1462
- table-layout: fixed;
1463
- font-family: var(--dpk-mono);
1464
- font-size: 12.5px;
1465
- line-height: 1.55;
1466
- tab-size: 4;
1467
- }
1468
-
1469
- .col-num {
1470
- width: 4.5ch;
1471
- }
1472
-
1473
- .col-act {
1474
- width: 26px;
1475
- }
1476
-
1477
- .lines td {
1478
- padding: 0;
1479
- vertical-align: top;
1480
- }
1481
-
1482
- .num {
1483
- padding: 0 6px !important;
1484
- color: var(--dpk-ink-faint);
1485
- text-align: right;
1486
- user-select: none;
1487
- font-variant-numeric: tabular-nums;
1488
- }
1489
-
1490
- .code {
1491
- padding: 0 12px 0 0 !important;
1492
- }
1493
-
1494
- /* Only the line's own text keeps its spaces; the markup around it may be wrapped freely. */
1495
- .code .text,
1496
- .suggestion-line .text {
1497
- white-space: pre-wrap;
1498
- overflow-wrap: anywhere;
1499
- }
1500
-
1501
- .comment {
1502
- color: var(--dpk-code-comment, var(--dpk-ink-faint));
1503
- font-style: italic;
1504
- }
1505
-
1506
- .string {
1507
- color: var(--dpk-code-string, var(--dpk-green));
1508
- }
1509
-
1510
- .number {
1511
- color: var(--dpk-code-number, var(--dpk-amber));
1512
- }
1513
-
1514
- .keyword {
1515
- color: var(--dpk-code-keyword, var(--dpk-violet));
1516
- }
1517
-
1518
- .function {
1519
- color: var(--dpk-code-function, var(--dpk-blue));
1520
- }
1521
-
1522
- .tag {
1523
- color: var(--dpk-code-tag, var(--dpk-accent-strong));
1524
- }
1525
-
1526
- .attr {
1527
- color: var(--dpk-code-attr, var(--dpk-blue));
1528
- }
1529
-
1530
- .property {
1531
- color: var(--dpk-code-property, var(--dpk-blue));
1532
- }
1533
-
1534
- .punct {
1535
- color: var(--dpk-code-punct, var(--dpk-ink-soft));
1536
- }
1537
-
1538
- .sign {
1539
- display: inline-block;
1540
- width: 2ch;
1541
- color: var(--dpk-ink-faint);
1542
- text-align: center;
1543
- user-select: none;
1544
- }
1545
-
1546
- .line[data-kind='add'] td,
1547
- .lines td[data-kind='add'] {
1548
- background: var(--diff-add);
1549
- }
1550
-
1551
- .line[data-kind='add'] .num,
1552
- .lines .num[data-kind='add'],
1553
- .lines .act[data-kind='add'] {
1554
- background: var(--diff-add-num);
1555
- }
1556
-
1557
- .line[data-kind='del'] td,
1558
- .lines td[data-kind='del'] {
1559
- background: var(--diff-del);
1560
- }
1561
-
1562
- .line[data-kind='del'] .num,
1563
- .lines .num[data-kind='del'],
1564
- .lines .act[data-kind='del'] {
1565
- background: var(--diff-del-num);
1566
- }
1567
-
1568
- td[data-kind='add'] .sign,
1569
- .line[data-kind='add'] .sign {
1570
- color: var(--dpk-green);
1571
- }
1572
-
1573
- td[data-kind='del'] .sign,
1574
- .line[data-kind='del'] .sign {
1575
- color: var(--dpk-danger);
1576
- }
1577
-
1578
- td[data-kind='add'] [data-changed] {
1579
- border-radius: 2px;
1580
- background: var(--diff-add-strong);
1581
- }
1582
-
1583
- td[data-kind='del'] [data-changed] {
1584
- border-radius: 2px;
1585
- background: var(--diff-del-strong);
1586
- }
1587
-
1588
- td[data-blank] {
1589
- background: var(--dpk-paper-sunken);
1590
- }
1591
-
1592
- .no-newline {
1593
- margin-left: 4px;
1594
- color: var(--dpk-danger);
1595
- user-select: none;
1596
- }
1597
-
1598
- .hunk td {
1599
- padding: 3px 12px;
1600
- background: var(--dpk-blue-soft);
1601
- color: var(--dpk-ink-soft);
1602
- font-size: 12px;
1603
- }
1604
-
1605
- .hunk-section {
1606
- color: var(--dpk-ink-faint);
1607
- }
1608
-
1609
- /* Comments and suggestions on a line, shown while the row is pointed at or focused. */
1610
- .act {
1611
- white-space: nowrap;
1612
- }
1613
-
1614
- .line-actions {
1615
- display: inline-flex;
1616
- opacity: 0;
1617
- transition: opacity var(--dpk-dur-fast) var(--dpk-ease);
1618
- }
1619
-
1620
- tr:hover .line-actions,
1621
- .line-actions:focus-within,
1622
- .line-actions[data-open] {
1623
- opacity: 1;
1624
- }
1625
-
1626
- @media (hover: none) {
1627
- .line-actions {
1628
- opacity: 1;
1629
- }
1630
- }
1631
-
1632
- .line-btn {
1633
- display: inline-grid;
1634
- place-items: center;
1635
- width: 20px;
1636
- height: 20px;
1637
- padding: 0;
1638
- border: 0;
1639
- border-radius: var(--dpk-radius-xs);
1640
- background: transparent;
1641
- color: var(--dpk-blue);
1642
- cursor: pointer;
1643
- }
1644
-
1645
- .line-btn:hover {
1646
- background: var(--dpk-blue-soft);
1647
- }
1648
-
1649
- .line-btn:focus-visible {
1650
- outline: none;
1651
- box-shadow: var(--dpk-focus);
1652
- }
1653
-
1654
- .line-btn svg {
1655
- width: 13px;
1656
- height: 13px;
1657
- }
1658
-
1659
- /* ------------------------------------------------------- suggestions */
1660
-
1661
- .extra td {
1662
- padding: 6px 12px 8px;
1663
- border-block: 1px solid var(--dpk-rule);
1664
- background: var(--dpk-paper-sunken);
1665
- font-family: var(--dpk-body);
1666
- }
1667
-
1668
- .suggestion,
1669
- .composer {
1670
- display: grid;
1671
- gap: 6px;
1672
- max-width: 760px;
1673
- }
1674
-
1675
- .suggestion {
1676
- overflow: hidden;
1677
- border: 1px solid var(--dpk-rule-strong);
1678
- border-radius: var(--dpk-radius-sm);
1679
- background: var(--dpk-paper-raised);
1680
- gap: 0;
1681
- }
1682
-
1683
- .suggestion-head {
1684
- display: flex;
1685
- align-items: center;
1686
- gap: 6px;
1687
- margin: 0;
1688
- padding: 4px 10px;
1689
- border-bottom: 1px solid var(--dpk-rule);
1690
- color: var(--dpk-ink-soft);
1691
- font-size: 12px;
1692
- font-weight: 600;
1693
- }
1694
-
1695
- .suggestion-head svg {
1696
- width: 13px;
1697
- height: 13px;
1698
- }
1699
-
1700
- .suggestion-line {
1701
- padding: 0 10px 0 0;
1702
- font-family: var(--dpk-mono);
1703
- font-size: 12.5px;
1704
- line-height: 1.55;
1705
- }
1706
-
1707
- .suggestion-line[data-kind='add'] {
1708
- background: var(--diff-add);
1709
- }
1710
-
1711
- .suggestion-line[data-kind='del'] {
1712
- background: var(--diff-del);
1713
- }
1714
-
1715
- .suggestion-line[data-kind='add'] .sign {
1716
- color: var(--dpk-green);
1717
- }
1718
-
1719
- .suggestion-line[data-kind='del'] .sign {
1720
- color: var(--dpk-danger);
1721
- }
1722
-
1723
- .composer-head {
1724
- display: flex;
1725
- flex-wrap: wrap;
1726
- align-items: center;
1727
- gap: 4px 10px;
1728
- }
1729
-
1730
- .composer-tabs {
1731
- display: inline-flex;
1732
- padding: 2px;
1733
- border: 1px solid var(--dpk-rule);
1734
- border-radius: var(--dpk-radius-sm);
1735
- background: var(--dpk-paper-inset);
1736
- }
1737
-
1738
- .composer-tabs button {
1739
- padding: 2px 10px;
1740
- border: 0;
1741
- border-radius: var(--dpk-radius-xs);
1742
- background: transparent;
1743
- color: var(--dpk-ink-soft);
1744
- font: inherit;
1745
- font-size: 12px;
1746
- cursor: pointer;
1747
- }
1748
-
1749
- .composer-tabs button[aria-selected='true'] {
1750
- background: var(--dpk-paper-raised);
1751
- color: var(--dpk-ink);
1752
- font-weight: 600;
1753
- box-shadow: var(--dpk-shadow-xs);
1754
- }
1755
-
1756
- .composer-tabs button:focus-visible {
1757
- outline: none;
1758
- box-shadow: var(--dpk-focus);
1759
- }
1760
-
1761
- .composer-title {
1762
- font-size: 12px;
1763
- }
1764
-
1765
- .composer-target {
1766
- min-width: 0;
1767
- color: var(--dpk-ink-faint);
1768
- font-family: var(--dpk-mono);
1769
- font-size: 11.5px;
1770
- overflow-wrap: anywhere;
1771
- }
1772
-
1773
- .composer[data-tab='suggest'] textarea {
1774
- font-family: var(--dpk-mono);
1775
- font-size: 12.5px;
1776
- }
1777
-
1778
- .composer-error {
1779
- margin: 0;
1780
- color: var(--dpk-danger);
1781
- font-size: 12px;
1782
- }
1783
-
1784
- .composer-actions {
1785
- display: flex;
1786
- gap: 6px;
1787
- }
1788
-
1789
- /* ----------------------------------------------------------- threads */
1790
-
1791
- .file-thread {
1792
- padding: 8px 12px;
1793
- border-bottom: 1px solid var(--dpk-rule);
1794
- background: var(--dpk-paper-sunken);
1795
- }
1796
-
1797
- .thread {
1798
- display: grid;
1799
- max-width: 760px;
1800
- overflow: hidden;
1801
- border: 1px solid var(--dpk-rule-strong);
1802
- border-radius: var(--dpk-radius-sm);
1803
- background: var(--dpk-paper-raised);
1804
- }
1805
-
1806
- .thread-items {
1807
- margin: 0;
1808
- padding: 0;
1809
- list-style: none;
1810
- }
1811
-
1812
- .thread-item {
1813
- padding: 8px 12px;
1814
- }
1815
-
1816
- .thread-item + .thread-item {
1817
- border-top: 1px solid var(--dpk-rule);
1818
- }
1819
-
1820
- .thread-meta {
1821
- display: flex;
1822
- align-items: center;
1823
- gap: 6px;
1824
- margin: 0 0 2px;
1825
- color: var(--dpk-ink-faint);
1826
- font-size: 11.5px;
1827
- }
1828
-
1829
- .thread-meta svg {
1830
- width: 12px;
1831
- height: 12px;
1832
- }
1833
-
1834
- .thread-body {
1835
- margin: 0;
1836
- font-size: 13px;
1837
- line-height: 1.6;
1838
- white-space: pre-wrap;
1839
- overflow-wrap: anywhere;
1840
- }
1841
-
1842
- .thread-reply {
1843
- margin: 0;
1844
- padding: 8px 12px;
1845
- border: 0;
1846
- border-top: 1px solid var(--dpk-rule);
1847
- background: var(--dpk-paper-sunken);
1848
- color: var(--dpk-ink-faint);
1849
- font: inherit;
1850
- font-size: 12.5px;
1851
- text-align: left;
1852
- cursor: text;
1853
- }
1854
-
1855
- .thread-reply:hover {
1856
- color: var(--dpk-ink-soft);
1857
- }
1858
-
1859
- .thread-reply:focus-visible {
1860
- outline: none;
1861
- box-shadow: inset var(--dpk-focus);
1862
- }
1863
-
1864
- .thread-compose {
1865
- display: grid;
1866
- gap: 6px;
1867
- padding: 8px 12px;
1868
- border-top: 1px solid var(--dpk-rule);
1869
- }
1870
- `],ne="SUGGEST_CHANGE",pr=x({text:b()}),ae=(n,t)=>`${n}
1871
- ${t}`,hr=(n,t,e)=>{const s=new Map(t.files.flatMap(r=>r.hunks.flatMap(o=>o.lines.map(l=>[ae(r.path,ft(l)),l])))),a=new Map,i=e.map(r=>{if(r.type!==ne)return{id:r.id,title:r.type,stale:"unsupported-action-type"};const o=Kt(r.target.id),[,l,c,p]=o??[],m=n.suggestTitle(c??r.target.id,p?.startsWith("R")?p.slice(1):p??""),f=St(pr,r.payload);if(l!=="line"||c===void 0||p===void 0||!p.startsWith("R"))return{id:r.id,title:m,stale:"target-missing"};if(!f.success)return{id:r.id,title:m,stale:"constraint-violated"};const E=ae(c,p);return s.has(E)?(a.set(E,[...a.get(E)??[],{action:r.id,text:f.output.text}]),{id:r.id,title:m,summary:f.output.text,tone:"update"}):{id:r.id,title:m,stale:"target-missing"}});return{byLine:a,results:i}},ur='script[type="text/x-diff"], script[type="text/plain"]',Lt=n=>n.newLine!==null,xt=(n,t)=>`${n}#${t}`,Pt=n=>`${n}#reply`,Ps=4,ie=6;class Rs extends A{static{this.styles=cr}static{this.properties={id:{type:String,reflect:!0},heading:{type:String},view:{type:String,reflect:!0},diff:{type:String,attribute:!1}}}#a=new O(this,()=>{this.#o="",this.#y()});#t=new ut(this);#e=new MutationObserver(()=>{this.#w()});#n=null;#s=ys();#i=null;#r=new Map;#o="";#l=new Set;#c=[];#p=[];#g=new Map;#u=null;#d=new Map;#m=null;#b=null;#x=[];#f=new Map;#k=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null,this.view="split",this.diff=""}connectedCallback(){super.connectedCallback(),this.#o="",this.#e.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.#w()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}willUpdate(t){t.has("diff")&&this.#w()}updated(){this.#z(),this.#t.sync(this.renderRoot.querySelector(".comment-pop"));const t=this.#b;this.#b=null;const e=t==="text"?".composer textarea":t==="tab"?'.composer [aria-selected="true"]':t==="reply"?".thread textarea":null;e!==null&&this.renderRoot.querySelector(e)?.focus({preventScroll:!0})}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#h.heading} \xB7 ${this.id}`;return[...this.#r].map(([e,s])=>({value:e,label:s,group:t}))}get elementActions(){return this.#c}set elementActions(t){this.#c=t,this.#y()}get elementComments(){return this.#x}set elementComments(t){this.#x=t;const e=new Map;for(const s of t){const a=`element:${s.target.id}`;e.set(a,[...e.get(a)??[],s])}this.#f=e,this.requestUpdate()}get elementActionResults(){return this.#p}get files(){return this.#s.files}get dataError(){return this.#i}getContextMenuItems(t){const e=[],s=Et(t.target,this.commentTargets,Ut(this.#a.locale),(r,o)=>this.#E(r,o));s!==null&&e.push(s);const a=t.target===null?null:ye(t.target),i=a===null?null:this.#S(a);return i!==null&&Lt(i.line)&&e.push({id:"suggest-change",entries:[{kind:"item",id:"suggest-change",label:this.#h.suggestChange,run:()=>this.#L(i,"suggest")}]}),e.length===0?null:e}get#h(){return Ni(this.#a.locale)}get#C(){const t=this.querySelector(ur);return t===null?this.diff:t.textContent??""}#w(){const t=this.#C;if(t!==this.#n){this.#n=t;try{this.#s=Es(t),this.#i=null}catch(e){this.#s=ys(),this.#i=e instanceof Error?e.message:String(e),console.error("[dev-process-kit] invalid diff:",this.#i)}this.#y()}}#y(){const t=this.#h;this.#r=new Map(lr(t,this.#s).map(({target:s,label:a})=>[this.#v(s),a]));const e=hr(t,this.#s,this.#c);this.#g=e.byLine,this.#p=e.results,this.requestUpdate()}#v(t){return`element:${[this.id,...Qi(t)].map(e=>encodeURIComponent(e)).join("/")}`}#z(){const t=JSON.stringify(this.commentTargets);t!==this.#o&&(this.#o=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#S(t){if(!this.id)return null;for(const e of this.#s.files)for(const s of e.hunks)for(const a of s.lines)if(this.#v({kind:"line",path:e.path,line:ft(a)})===t)return{ref:t,path:e.path,line:a,label:Ls(this.#h,e.path,a)};return null}#E(t,e){const s=this.#S(t);if(s!==null){this.#L(s,"comment");return}const a=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);a!==null&&this.#t.open(t,a,e)}#_(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}#L(t,e){this.#l.has(t.path)&&this.#I(t.path),this.#u={...t,tab:e==="suggest"&&!Lt(t.line)?"comment":e},this.#m=null,this.#b="text",this.requestUpdate()}#T(t,e){const s=this.#u;s===null||s.tab===t||!Lt(s.line)||(this.#u={...s,tab:t},this.#m=null,this.#b=e,this.requestUpdate())}#D(t){this.#k=t,this.#m=null,this.#b="reply",this.requestUpdate()}#A(t){const e=this.#k;if(e!==null){if(t){const s=new Map(this.#d);s.delete(Pt(e)),this.#d=s}this.#k=null,this.#m=null,this.requestUpdate()}}#P(t){const e=(this.#d.get(Pt(t))??"").trim();if(e!==""){if(!this.#_(t,e)){this.#m=Pt(t),this.requestUpdate();return}this.#A(!0)}}#O(t){const e=this.#u;if(e!==null){if(t){const s=new Map(this.#d);s.delete(xt(e.ref,"comment")),s.delete(xt(e.ref,"suggest")),this.#d=s}this.#u=null,this.#m=null,this.requestUpdate()}}#M(t){return this.#d.get(xt(t.ref,t.tab))??(t.tab==="suggest"?t.line.text:"")}#R(t){const e=this.#M(t);return t.tab==="suggest"?e!==t.line.text:e.trim()!==""}#$(){const t=this.#u;if(t===null||!this.#R(t))return;const e=this.#M(t);if(!(t.tab==="comment"?this.#_(t.ref,e.trim()):this.#q(t,e))){this.#m=xt(t.ref,t.tab),this.requestUpdate();return}this.#O(!0)}#q(t,e){return!this.dispatchEvent(new CustomEvent("dpk-element-action",{detail:{type:ne,target:t.ref,payload:{text:e}},bubbles:!0,composed:!0,cancelable:!0}))}#I(t){const e=new Set(this.#l);e.delete(t)||e.add(t),this.#l=e,this.requestUpdate()}#B(t){this.view=t}render(){const t=this.#h,e=dr(this.#s),s=this.view==="split"?"split":"unified";return d`
1872
- <section class="diff" data-view=${s}>
1873
- <header class="toolbar">
1874
- <span class="title">${this.heading??t.heading}</span>
1875
- <span class="summary">
1876
- ${t.summary(e.files)}
1877
- <span class="stat-add">+${e.additions}</span>
1878
- <span class="stat-del">−${e.deletions}</span>
1879
- </span>
1880
- <span class="views" role="group" aria-label=${t.viewLabel}>
1881
- ${["unified","split"].map(a=>d`<button
1882
- type="button"
1883
- aria-pressed=${s===a?"true":"false"}
1884
- @click=${()=>this.#B(a)}
1885
- >
1886
- ${t[a]}
1887
- </button>`)}
1888
- </span>
1889
- </header>
1890
- ${this.#i===null?h:d`<p class="notice" role="alert">${t.dataError}<br />${this.#i}</p>`}
1891
- ${this.#i===null&&e.files===0?d`<p class="empty">${t.empty}</p>`:h}
1892
- ${U(this.#s.files,a=>a.path,a=>this.#N(a,s))}
1893
- </section>
1894
- ${this.#t.render({locale:this.#a.locale,errorMessage:t.sendFailed,submit:(a,i)=>this.#_(a,i)})}
1895
- `}#N(t,e){const s=this.#h,a=!this.#l.has(t.path),i=this.#v({kind:"file",path:t.path}),r=(t.status==="renamed"||t.status==="copied")&&t.oldPath!==null;return d`<section class="file" data-path=${t.path} data-status=${t.status}>
1896
- <header class="file-head" data-dpk-target=${this.id?i:h}>
1897
- <button
1898
- type="button"
1899
- class="dpk-icon-btn toggle"
1900
- data-size="sm"
1901
- aria-expanded=${a?"true":"false"}
1902
- aria-label=${a?s.collapse(t.path):s.expand(t.path)}
1903
- @click=${()=>this.#I(t.path)}
1904
- >
1905
- ${Se()}
1906
- </button>
1907
- <span class="status" data-status=${t.status}>${s[t.status]}</span>
1908
- <span class="path"
1909
- >${r?d`<span class="old-path">${t.oldPath}</span> → `:h}${t.path}</span
1910
- >
1911
- <span class="file-stat"
1912
- ><span class="stat-add">+${t.additions}</span> <span class="stat-del">−${t.deletions}</span></span
1913
- >
1914
- ${this.id?this.#Y(i,t.path):h}
1915
- </header>
1916
- ${a?this.#Z(i):h} ${a?this.#K(t,e):h}
1917
- </section>`}#K(t,e){const s=this.#h;if(t.binary)return d`<p class="file-note">${s.binary}</p>`;if(t.hunks.length===0){const a=t.oldMode!==null&&t.newMode!==null&&t.oldMode!==t.newMode?s.modeChanged(t.oldMode,t.newMode):s.noContentChange;return d`<p class="file-note">${a}</p>`}return d`<div class="scroll" data-dpk-check="off">
1918
- <table class="lines" data-view=${e}>
1919
- ${e==="split"?this.#j(t):this.#V(t)}
1920
- </table>
1921
- </div>`}#V(t){return d`<colgroup>
1922
- <col class="col-num" />
1923
- <col class="col-num" />
1924
- <col class="col-act" />
1925
- <col />
1926
- </colgroup>
1927
- <tbody>
1928
- ${ar(t).map(e=>{if(e.kind==="hunk")return this.#H(e.hunk,Ps);const{cell:s}=e,a=this.#U(t,s);return d`<tr
1929
- class="line"
1930
- data-kind=${s.line.kind}
1931
- data-line=${s.id}
1932
- data-dpk-target=${a??h}
1933
- >
1934
- <td class="num">${s.line.oldLine??""}</td>
1935
- <td class="num">${s.line.newLine??""}</td>
1936
- <td class="act">${this.#J(t,s,a)}</td>
1937
- ${this.#W(s)}
1938
- </tr>
1939
- ${this.#G(t,s,Ps)}`})}
1940
- </tbody>`}#j(t){return d`<colgroup>
1941
- <col class="col-num" />
1942
- <col class="col-act" />
1943
- <col class="col-half" />
1944
- <col class="col-num" />
1945
- <col class="col-act" />
1946
- <col class="col-half" />
1947
- </colgroup>
1948
- <tbody>
1949
- ${ir(t).map(e=>e.kind==="hunk"?this.#H(e.hunk,ie):d`<tr class="pair">
1950
- ${this.#F(t,e.left,"old")} ${this.#F(t,e.right,"new")}
1951
- </tr>
1952
- ${e.left!==null&&e.left.target?this.#G(t,e.left,ie):h}
1953
- ${e.right===null?h:this.#G(t,e.right,ie)}`)}
1954
- </tbody>`}#F(t,e,s){if(e===null)return d`<td class="num" data-blank></td>
1955
- <td class="act" data-blank></td>
1956
- <td class="code" data-blank></td>`;const a=this.#U(t,e),i=s==="old"?e.line.oldLine:e.line.newLine;return d`<td class="num" data-kind=${e.line.kind}>${i??""}</td>
1957
- <td class="act" data-kind=${e.line.kind}>${this.#J(t,e,a)}</td>
1958
- ${this.#W(e,a)}`}#H(t,e){const s=`@@ -${t.oldStart},${t.oldCount} +${t.newStart},${t.newCount} @@`;return d`<tr class="hunk">
1959
- <td colspan=${e}>
1960
- <span class="hunk-range">${s}</span
1961
- >${t.section===""?h:d` <span class="hunk-section">${t.section}</span>`}
1962
- </td>
1963
- </tr>`}#W(t,e){const s=t.line.kind==="add"?"+":t.line.kind==="del"?"-":" ";return d`<td class="code" data-kind=${t.line.kind} data-dpk-target=${e??h}>
1964
- <span class="sign" aria-hidden="true">${s}</span
1965
- ><span class="text"
1966
- >${t.segments.map(a=>a.kind===null&&!a.changed?a.text:d`<span class=${a.kind??h} ?data-changed=${a.changed}>${a.text}</span>`)}</span
1967
- >${t.line.noNewline?d`<span class="no-newline" title=${this.#h.noNewline} aria-label=${this.#h.noNewline}>⊘</span>`:h}
1968
- </td>`}#U(t,e){return!this.id||!e.target?null:this.#v({kind:"line",path:t.path,line:e.id})}#J(t,e,s){if(s===null)return h;const a=this.#r.get(s)??t.path,i=this.#u?.ref===s;return d`<span class="line-actions" ?data-open=${i}
1969
- ><button
1970
- type="button"
1971
- class="line-btn"
1972
- aria-label=${this.#h.addOn(a)}
1973
- aria-expanded=${i?"true":"false"}
1974
- title=${this.#h.addOn(a)}
1975
- @click=${()=>this.#L({ref:s,path:t.path,line:e.line,label:a},"comment")}
1976
- >
1977
- ${we()}
1978
- </button></span
1979
- >`}#Y(t,e){return d`<button
1980
- type="button"
1981
- class="dpk-icon-btn"
1982
- data-size="sm"
1983
- aria-label=${this.#h.commentOn(e)}
1984
- title=${this.#h.commentOn(e)}
1985
- @click=${()=>this.#E(t,e)}
1986
- >
1987
- ${$t()}
1988
- </button>`}#G(t,e,s){const a=e.line.newLine===null?[]:this.#g.get(ae(t.path,e.id))??[],i=this.#U(t,e),r=i===null?[]:this.#f.get(i)??[],o=i!==null&&this.#u?.ref===i?this.#u:null;return r.length===0&&a.length===0&&o===null?h:d`${i===null||r.length===0?h:d`<tr class="extra">
1989
- <td colspan=${s}>${this.#X(i,r)}</td>
1990
- </tr>`}${a.map(l=>d`<tr class="extra">
1991
- <td colspan=${s}>${this.#Q(e.line,l)}</td>
1992
- </tr>`)}${o===null?h:d`<tr class="extra">
1993
- <td colspan=${s}>${this.#tt(o)}</td>
1994
- </tr>`}`}#Z(t){const e=this.#f.get(t)??[];return!this.id||e.length===0?h:d`<div class="file-thread">${this.#X(t,e)}</div>`}#X(t,e){const s=this.#h,a=this.#r.get(t)??"",i=Pt(t),r=this.#d.get(i)??"",o=new Intl.DateTimeFormat(this.#a.locale,{dateStyle:"short",timeStyle:"short"});return d`<section class="thread" data-thread=${t} aria-label=${s.threadOn(a)}>
1995
- <ol class="thread-items">
1996
- ${e.map(l=>{const c=new Date(l.createdAt);return d`<li class="thread-item" data-comment=${l.id}>
1997
- <p class="thread-meta">
1998
- ${$t()}
1999
- ${Number.isNaN(c.getTime())?h:d`<time datetime=${l.createdAt}>${o.format(c)}</time>`}
2000
- </p>
2001
- <p class="thread-body">${Wn(l)}</p>
2002
- </li>`})}
2003
- </ol>
2004
- ${this.#k===t?d`<div
2005
- class="thread-compose"
2006
- @keydown=${l=>{l.isComposing||(l.key==="Escape"?(l.preventDefault(),l.stopPropagation(),this.#A(!1)):l.key==="Enter"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),this.#P(t)))}}
2007
- >
2008
- <textarea
2009
- class="dpk-textarea"
2010
- rows="3"
2011
- aria-label=${s.reply}
2012
- data-dpk-text-key=${i}
2013
- .value=${r}
2014
- @input=${l=>{l.currentTarget instanceof HTMLTextAreaElement&&(this.#d=new Map(this.#d).set(i,l.currentTarget.value),this.#m=null,this.requestUpdate())}}
2015
- ></textarea>
2016
- ${this.#m===i?d`<p class="composer-error" role="alert">${s.sendFailed}</p>`:h}
2017
- <div class="composer-actions">
2018
- <button
2019
- class="dpk-btn dpk-btn--accent"
2020
- type="button"
2021
- ?disabled=${r.trim()===""}
2022
- @click=${()=>this.#P(t)}
2023
- >
2024
- ${s.reply}
2025
- </button>
2026
- <button
2027
- class="dpk-btn dpk-btn--ghost"
2028
- type="button"
2029
- data-dpk-text-discard
2030
- @click=${()=>this.#A(!0)}
2031
- >
2032
- ${s.cancel}
2033
- </button>
2034
- </div>
2035
- </div>`:d`<button type="button" class="thread-reply" @click=${()=>this.#D(t)}>
2036
- ${s.replyPlaceholder}
2037
- </button>`}
2038
- </section>`}#Q(t,e){const s=e.text===""?[]:e.text.split(`
2039
- `);return d`<div class="suggestion" data-action=${e.action}>
2040
- <p class="suggestion-head">${Bn()} ${this.#h.suggestion}</p>
2041
- <div class="suggestion-lines">
2042
- <div class="suggestion-line" data-kind="del">
2043
- <span class="sign">-</span><span class="text">${t.text}</span>
2044
- </div>
2045
- ${s.map(a=>d`<div class="suggestion-line" data-kind="add">
2046
- <span class="sign">+</span><span class="text">${a}</span>
2047
- </div>`)}
2048
- </div>
2049
- </div>`}#tt(t){const e=this.#h,s=this.#M(t),a=Math.min(12,Math.max(3,s.split(`
2050
- `).length+1)),i=xt(t.ref,t.tab),r=Lt(t.line)?d`<div
2051
- class="composer-tabs"
2052
- role="tablist"
2053
- aria-label=${e.composerTabs}
2054
- @keydown=${o=>{o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),this.#T(t.tab==="comment"?"suggest":"comment","tab"))}}
2055
- >
2056
- ${["comment","suggest"].map(o=>d`<button
2057
- type="button"
2058
- role="tab"
2059
- aria-selected=${t.tab===o?"true":"false"}
2060
- tabindex=${t.tab===o?0:-1}
2061
- @click=${()=>this.#T(o,"text")}
2062
- >
2063
- ${o==="comment"?e.comment:e.suggestChange}
2064
- </button>`)}
2065
- </div>`:d`<strong class="composer-title">${e.comment}</strong>`;return d`<div
2066
- class="composer"
2067
- data-tab=${t.tab}
2068
- @keydown=${o=>{o.isComposing||(o.key==="Escape"?(o.preventDefault(),o.stopPropagation(),this.#O(!1)):o.key==="Enter"&&(o.ctrlKey||o.metaKey)&&(o.preventDefault(),this.#$()))}}
2069
- >
2070
- <div class="composer-head">${r}<span class="composer-target">${t.label}</span></div>
2071
- <textarea
2072
- class="dpk-textarea"
2073
- rows=${a}
2074
- spellcheck=${t.tab==="suggest"?"false":"true"}
2075
- aria-label=${t.tab==="suggest"?e.suggestionLabel:e.comment}
2076
- data-dpk-text-key=${i}
2077
- .value=${s}
2078
- @input=${o=>{o.currentTarget instanceof HTMLTextAreaElement&&(this.#d=new Map(this.#d).set(i,o.currentTarget.value),this.#m=null,this.requestUpdate())}}
2079
- ></textarea>
2080
- ${this.#m===i?d`<p class="composer-error" role="alert">${e.unrecorded}</p>`:h}
2081
- <div class="composer-actions">
2082
- <button
2083
- class="dpk-btn dpk-btn--accent"
2084
- type="button"
2085
- ?disabled=${!this.#R(t)}
2086
- @click=${()=>this.#$()}
2087
- >
2088
- ${t.tab==="suggest"?e.suggest:e.addComment}
2089
- </button>
2090
- <button
2091
- class="dpk-btn dpk-btn--ghost"
2092
- type="button"
2093
- data-dpk-text-discard
2094
- @click=${()=>this.#O(!0)}
2095
- >
2096
- ${e.cancel}
2097
- </button>
2098
- </div>
2099
- </div>`}}const Ds=()=>{customElements.get("dpk-diff")||customElements.define("dpk-diff",Rs)},mr=D({en:{heading:"Video",play:"Play (k)",pause:"Pause (k)",mute:"Mute (m)",unmute:"Unmute (m)",volume:"Volume",seek:"Seek",fullscreen:"Full screen (f)",exitFullscreen:"Exit full screen (f)",captions:"Captions (c)",openPanel:"Chapters and comments",closePanel:"Close",chapters:"Chapters",comments:"Comments",noComments:"No comments yet.",commentAt:n=>`Comment at ${n}`,noteAt:n=>`Note at ${n}`,kind:"Kind",reviewComment:"Review comment",note:"Note",commentPlaceholder:"Post a comment",notePlaceholder:"Leave a note",noteTitle:n=>`Note: ${n}`,keepNote:"Keep",submit:"Send",notSaved:"Could not be recorded (place it inside a dpk-view-* element)."},ja:{heading:"\u52D5\u753B",play:"\u518D\u751F (k)",pause:"\u4E00\u6642\u505C\u6B62 (k)",mute:"\u30DF\u30E5\u30FC\u30C8 (m)",unmute:"\u30DF\u30E5\u30FC\u30C8\u89E3\u9664 (m)",volume:"\u97F3\u91CF",seek:"\u518D\u751F\u4F4D\u7F6E",fullscreen:"\u5168\u753B\u9762 (f)",exitFullscreen:"\u5168\u753B\u9762\u3092\u7D42\u4E86 (f)",captions:"\u5B57\u5E55 (c)",openPanel:"\u30C1\u30E3\u30D7\u30BF\u30FC\u3068\u30B3\u30E1\u30F3\u30C8",closePanel:"\u9589\u3058\u308B",chapters:"\u30C1\u30E3\u30D7\u30BF\u30FC",comments:"\u30B3\u30E1\u30F3\u30C8",noComments:"\u30B3\u30E1\u30F3\u30C8\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",commentAt:n=>`${n} \u3078\u306E\u30B3\u30E1\u30F3\u30C8`,noteAt:n=>`${n} \u3078\u306E\u30E1\u30E2`,kind:"\u7A2E\u985E",reviewComment:"\u30EC\u30D3\u30E5\u30FC\u30B3\u30E1\u30F3\u30C8",note:"\u30E1\u30E2",commentPlaceholder:"\u30B3\u30E1\u30F3\u30C8\u3092\u6295\u7A3F",notePlaceholder:"\u30E1\u30E2\u3092\u6B8B\u3059",noteTitle:n=>`\u30E1\u30E2: ${n}`,keepNote:"\u6B8B\u3059",submit:"\u9001\u4FE1",notSaved:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),Os=["white","yellow","green","pink","blue","orange"],yt={lead:0,gap:0,tail:0},Is=.45,gr=.12,fr=1.5,br=new Intl.Segmenter,kr=/^[A-Za-z0-9_-]+$/,Rt=n=>y(b(),Wt(kr,`${n} may only contain letters, digits, "_" and "-"`)),j=y(st(),De(0)),qs=y(st(),De(0),ua(1)),vr=x({id:P(Rt("a cue id")),text:P(y(b(),S(1))),voice:P(y(b(),S(1))),tone:P(Z(Os)),audio:P(y(b(),S(1))),duration:P(j),at:P(j)}),xr=x({id:Rt("a note id"),at:P(j),body:y(b(),S(1))}),yr=x({id:Rt("a scene id"),title:y(b(),S(1)),cues:g($(vr),[]),notes:g($(xr),[]),duration:P(j)}),wr=x({audio:y(b(),S(1)),volume:g(qs,1),duck:P(qs),loop:g(nt(),!1),from:P(b()),to:P(b()),offset:g(j,0),fade:g(j,0)}),$r=x({scenes:y($(yr),S(1)),tracks:g($(wr),[]),pacing:g(x({lead:g(j,yt.lead),gap:g(j,yt.gap),tail:g(j,yt.tail)}),yt),voices:g(Oe(y(b(),S(1)),x({tone:P(Z(Os))})),{}),fade:g(j,Is)}),re=()=>({scenes:[],tracks:[],pacing:yt,voices:{},fade:Is}),Us=n=>{const t=B($r,n),e=new Map,s=new Set;for(const[a,i]of t.scenes.entries()){if(e.has(i.id))throw new Error(`duplicate scene id: ${i.id}`);for(const o of i.notes){if(s.has(o.id))throw new Error(`duplicate note id: ${o.id}`);s.add(o.id)}if(e.set(i.id,a),i.cues.length===0&&i.duration===void 0)throw new Error(`scene ${i.id}: a scene without cues needs a duration`);const r=new Set;for(const[o,l]of i.cues.entries()){const c=l.id??String(o);if(r.has(c))throw new Error(`scene ${i.id}: duplicate cue id "${c}"`);r.add(c)}}for(const a of t.tracks){for(const i of[a.from,a.to])if(i!==void 0&&!e.has(i))throw new Error(`track ${a.audio}: unknown scene "${i}"`);if((e.get(a.from??"")??0)>(e.get(a.to??"")??1/0))throw new Error(`track ${a.audio}: "from" comes after "to"`)}return t},Cr=n=>[...new Set([...n.scenes.flatMap(t=>t.cues.flatMap(e=>e.audio===void 0?[]:[e.audio])),...n.tracks.map(t=>t.audio)])],Sr=(n,t)=>n.duration??(n.audio===void 0?null:t(n.audio))??(n.text===void 0?0:Math.max(fr,[...br.segment(n.text)].length*gr)),Er=(n,t)=>{const{lead:e,gap:s,tail:a}=n.pacing;let i=0;const r=n.scenes.map(p=>{const m=i;let f=null,E=m+(p.duration??0);const R=p.cues.map((M,Y)=>{const I=M.at!==void 0?m+M.at:f===null?m+e:f+s,z={...M,key:M.id??String(Y),captionTone:M.tone??(M.voice===void 0?void 0:n.voices[M.voice]?.tone)??null,start:I,end:I+Sr(M,t)};return f=z.end,E=Math.max(E,z.end+(M.at===void 0?a:0)),z});return i=E,{id:p.id,title:p.title,start:m,end:E,cues:R}}),o=i,l=new Map(r.map(p=>[p.id,p])),c=n.tracks.map(p=>{const m=t(p.audio),f=(p.from===void 0?0:l.get(p.from)?.start??0)+p.offset,E=p.to===void 0?o:l.get(p.to)?.end??o,R=p.loop||m===null?E:Math.min(E,f+m);return{...p,start:f,end:R,length:m}});return{duration:o,scenes:r,tracks:c}},tt=(n,t)=>{let e=0;for(const[s,a]of n.scenes.entries())t>=a.start&&(e=s);return e},Ns=(n,t,e=0)=>{const s=n.scenes[tt(n,t)]?.cues??[];let a=null;for(const i of s)t>=i.start&&t<i.end+e&&(a===null||i.start>=a.start)&&(a=i);return a},Tr=(n,t)=>n.scenes.some(e=>e.cues.some(s=>s.audio!==void 0&&t>=s.start&&t<s.end)),Mr=(n,t)=>{if(t<n.start||t>=n.end)return null;const e=t-n.start;return n.loop===!0&&n.length!==null&&n.length>0?e%n.length:e},Ar=(n,t)=>{const e=n.fade??0;return e<=0?1:Math.min(1,Math.max(0,Math.min(t-n.start,n.end-t)/e))},V=n=>{const t=Math.max(0,Math.floor(n)),e=Math.floor(t/3600),s=Math.floor(t%3600/60),a=String(t%60).padStart(2,"0");return e>0?`${e}:${String(s).padStart(2,"0")}:${a}`:`${s}:${a}`},Dt=n=>`element:${n.map(t=>encodeURIComponent(t)).join("/")}`,js=(n,t)=>Dt([n,"scene",t]),zr=(n,t,e)=>{const s=t.scenes[tt(t,e)];return Dt(s===void 0?[n,"at","0"]:[n,"scene",s.id,"at",String(Math.max(0,Math.round((e-s.start)*1e3)))])},Fs=(n,t,e,{scenes:s=!1}={})=>{const a=`${Dt([n,"scene"])}/`;if(!e.startsWith(a))return null;const i=/^([^/]+)(?:\/at\/(\d+))?$/.exec(e.slice(a.length));if(i===null||i[2]===void 0&&!s)return null;const r=t.scenes.find(o=>o.id===decodeURIComponent(i[1]??""));return r===void 0?null:{scene:r,time:Math.min(r.end,r.start+Number(i[2]??0)/1e3)}},Hs="ADD_NOTE",_r=x({id:Rt("a note id"),at:P(j),body:y(b(),S(1))}),Lr=(n,t,e)=>{const s=new Map(t.scenes.map(r=>[r.id,[...r.notes]])),a=new Set(t.scenes.flatMap(r=>r.notes.map(o=>o.id))),i=e.map(r=>{if(r.type!==Hs)return{id:r.id,title:r.type,stale:"unsupported-action-type"};const o=Kt(r.target.id),l=o?.length===3&&o[1]==="scene"?o[2]:void 0,c=t.scenes.find(E=>E.id===l),p=c===void 0?void 0:s.get(c.id);if(c===void 0||p===void 0)return{id:r.id,title:n.noteTitle(l??r.target.id),stale:"target-missing"};const m=St(_r,r.payload),f=n.noteTitle(c.title);return!m.success||a.has(m.output.id)?{id:r.id,title:f,stale:"constraint-violated"}:(a.add(m.output.id),p.push(m.output),{id:r.id,title:f,summary:m.output.body,tone:"create"})});return{data:{...t,scenes:t.scenes.map(r=>({...r,notes:s.get(r.id)??r.notes}))},results:i}},Pr=.3,Rr=600,Dr=.2,Or=8e3,Ir=1,qr=3,Ur=(n,t,e)=>{const s=Math.abs(t-e);return n.loop&&n.length!==null?Math.min(s,n.length-s):s},Nr=n=>new Promise(t=>{const e=()=>{clearTimeout(s),n.removeEventListener("loadedmetadata",e),n.removeEventListener("error",e),t(Number.isFinite(n.duration)?n.duration:null)};n.addEventListener("loadedmetadata",e),n.addEventListener("error",e);const s=setTimeout(e,Or);n.readyState>=Ir&&e()});class jr{#a=new Map;#t=[];#e=new Map;#n=new Map;#s=0;#i=null;#r=1;#o=!1;#l=!1;async measure(t,e){this.#p();const s=await Promise.all(t.map(async a=>{const i=new Audio;return i.preload="metadata",i.src=e(a),this.#a.set(a,i),[a,await Nr(i)]}));return new Map(s)}load(t){this.stop(),this.#i=t,this.#l=!1,this.#e.clear(),this.#n.clear();const e=new Set,s=i=>{const r=this.#a.get(i);if(r===void 0)return null;if(!e.has(i))return e.add(i),r;const o=new Audio;return o.preload=r.preload,o.src=r.src,o},a=[];for(const i of t.scenes.flatMap(r=>r.cues)){const r=i.audio===void 0?null:s(i.audio);r!==null&&a.push({audio:r,start:i.start,end:i.end,loop:!1,length:null,volume:1,duck:null,fade:0})}for(const i of t.tracks){const r=s(i.audio);r!==null&&(a.push({audio:r,start:i.start,end:i.end,loop:i.loop,length:i.length,volume:i.volume,duck:i.duck??null,fade:i.fade}),r.loop=i.loop)}this.#t=a}setVolume(t,e){this.#r=Math.min(1,Math.max(0,t)),this.#o=e}sync(t,e,s){const a=this.#i;if(a===null)return;if(e&&!this.#l){this.#l=!0;for(const{audio:l}of this.#t)l.preload="auto"}const i=performance.now(),r=1-Math.exp(-(i-this.#s)/1e3/Dr);this.#s=i;const o=Tr(a,t);for(const l of this.#t){const{audio:c}=l,p=e?Mr(l,t):null;if(p===null){c.paused||c.pause();continue}const m=s||c.paused;(m||this.#c(l,i)&&Ur(l,c.currentTime,p)>Pr)&&(c.currentTime=p,this.#n.set(l,i));const f=Number(o&&l.duck!==null),E=m?f:(this.#e.get(l)??f)*(1-r)+f*r;this.#e.set(l,E);const R=l.volume+((l.duck??l.volume)-l.volume)*E;c.muted=this.#o,c.volume=Math.min(1,Math.max(0,R*Ar(l,t)*this.#r)),c.paused&&c.play().catch(()=>{})}}#c(t,e){const{audio:s}=t;return!s.seeking&&s.readyState>=qr&&e-(this.#n.get(t)??-1/0)>=Rr}stop(){for(const{audio:t}of this.#t)t.pause()}#p(){this.stop();for(const t of new Set([...this.#a.values(),...this.#t.map(e=>e.audio)]))t.removeAttribute("src"),t.load();this.#a.clear(),this.#t=[]}}const Fr=_`
2100
- :host {
2101
- --dpk-video-aspect: 16 / 9;
2102
- --dpk-video-progress: var(--dpk-accent);
2103
- --panel-width: 320px;
2104
- --on-video: #fff;
2105
- --on-video-soft: rgb(255 255 255 / 0.78);
2106
- --on-video-faint: rgb(255 255 255 / 0.32);
2107
- --dpk-video-safe-bottom: 0px;
2108
- display: block;
2109
- container-type: inline-size;
2110
- color: var(--dpk-ink);
2111
- font-family: var(--dpk-body);
2112
- }
2113
-
2114
- .frame {
2115
- display: grid;
2116
- grid-template-columns: minmax(0, 1fr);
2117
- gap: 12px;
2118
- }
2119
-
2120
- :host([controls-visible]) {
2121
- --dpk-video-safe-bottom: 64px;
2122
- }
2123
-
2124
- :host([panel-open]) .frame {
2125
- grid-template-columns: minmax(0, 1fr) var(--panel-width);
2126
- }
2127
-
2128
- @container (max-width: 720px) {
2129
- :host([panel-open]) .frame {
2130
- grid-template-columns: minmax(0, 1fr);
2131
- }
2132
-
2133
- .panel {
2134
- height: 360px;
2135
- }
2136
- }
2137
-
2138
- .frame[data-fullscreen] {
2139
- grid-template-rows: minmax(0, 1fr);
2140
- gap: 0;
2141
- height: 100%;
2142
- background: #000;
2143
- }
2144
-
2145
- /* ------------------------------------------------------------ player */
2146
-
2147
- .player {
2148
- position: relative;
2149
- overflow: hidden;
2150
- border-radius: var(--dpk-radius);
2151
- background: #000;
2152
- outline: none;
2153
- box-shadow: var(--dpk-shadow-sm);
2154
- }
2155
-
2156
- .player:focus-visible {
2157
- box-shadow: var(--dpk-focus);
2158
- }
2159
-
2160
- .player[data-idle] {
2161
- cursor: none;
2162
- }
2163
-
2164
- /* The open panel takes its width from the player, not its height: the picture shrinks between black bars. */
2165
- :host([panel-open]) .player,
2166
- .frame[data-fullscreen] .player {
2167
- display: grid;
2168
- place-items: center;
2169
- container-type: size;
2170
- }
2171
-
2172
- :host([panel-open]) .frame:not([data-fullscreen]) .player {
2173
- height: calc(100cqw / (var(--dpk-video-aspect)));
2174
- }
2175
-
2176
- .frame[data-fullscreen] .player {
2177
- height: 100%;
2178
- border-radius: 0;
2179
- box-shadow: none;
2180
- }
2181
-
2182
- .stage {
2183
- position: relative;
2184
- overflow: hidden;
2185
- width: 100%;
2186
- aspect-ratio: var(--dpk-video-aspect);
2187
- container: dpk-stage / size;
2188
- cursor: pointer;
2189
- }
2190
-
2191
- :host([panel-open]) .stage,
2192
- .frame[data-fullscreen] .stage {
2193
- width: min(100cqw, 100cqh * (var(--dpk-video-aspect)));
2194
- }
2195
-
2196
- ::slotted(*) {
2197
- position: absolute;
2198
- inset: 0;
2199
- }
2200
-
2201
- :host(:not([scene])) ::slotted([data-scene]) {
2202
- visibility: hidden;
2203
- }
2204
-
2205
- .subtitle {
2206
- --fill: #fff;
2207
- --edge: #111;
2208
- --rim: #111;
2209
- --rim-line: var(--dpk-video-caption-rim, var(--rim));
2210
- position: absolute;
2211
- left: 50%;
2212
- bottom: calc(2.5cqh + var(--dpk-video-safe-bottom));
2213
- z-index: 2;
2214
- width: max-content;
2215
- max-width: 84%;
2216
- margin: 0;
2217
- color: var(--dpk-video-caption-fill, var(--fill));
2218
- font-size: clamp(14px, 2.6cqw, 36px);
2219
- font-weight: 800;
2220
- letter-spacing: 0.03em;
2221
- line-height: 1.4;
2222
- text-align: center;
2223
- text-wrap: balance;
2224
- word-break: auto-phrase;
2225
- -webkit-text-stroke: 0.22em var(--dpk-video-caption-edge, var(--edge));
2226
- paint-order: stroke fill;
2227
- filter: drop-shadow(0.05em 0 0 var(--rim-line)) drop-shadow(-0.05em 0 0 var(--rim-line))
2228
- drop-shadow(0 0.05em 0 var(--rim-line)) drop-shadow(0 -0.05em 0 var(--rim-line))
2229
- drop-shadow(0 0.08em 0.12em rgb(0 0 0 / 0.5));
2230
- translate: -50% 0;
2231
- transition: bottom var(--dpk-dur) var(--dpk-ease);
2232
- }
2233
-
2234
- .subtitle[data-tone='yellow'] {
2235
- --fill: #ffe14a;
2236
- --edge: #2a1f00;
2237
- --rim: #2a1f00;
2238
- }
2239
-
2240
- .subtitle[data-tone='green'] {
2241
- --fill: #2fb344;
2242
- --edge: #fff;
2243
- --rim: #0f4a1a;
2244
- }
2245
-
2246
- .subtitle[data-tone='pink'] {
2247
- --fill: #f0368c;
2248
- --edge: #fff;
2249
- --rim: #5c0d33;
2250
- }
2251
-
2252
- .subtitle[data-tone='blue'] {
2253
- --fill: #1f86f0;
2254
- --edge: #fff;
2255
- --rim: #0a2f5c;
2256
- }
2257
-
2258
- .subtitle[data-tone='orange'] {
2259
- --fill: #f2730f;
2260
- --edge: #fff;
2261
- --rim: #5c2700;
2262
- }
2263
-
2264
- .voice {
2265
- margin-right: 0.6em;
2266
- }
2267
-
2268
- .sr-only {
2269
- position: absolute;
2270
- width: 1px;
2271
- height: 1px;
2272
- overflow: hidden;
2273
- clip-path: inset(50%);
2274
- white-space: nowrap;
2275
- }
2276
-
2277
- .big-play {
2278
- position: absolute;
2279
- inset: 0;
2280
- z-index: 2;
2281
- display: grid;
2282
- place-items: center;
2283
- margin: auto;
2284
- width: clamp(48px, 9cqw, 88px);
2285
- height: clamp(48px, 9cqw, 88px);
2286
- border-radius: 50%;
2287
- background: rgb(0 0 0 / 0.55);
2288
- color: var(--on-video);
2289
- pointer-events: none;
2290
- box-shadow: 0 0 0 1px var(--on-video-faint);
2291
- }
2292
-
2293
- .big-play svg {
2294
- width: 42%;
2295
- height: 42%;
2296
- translate: 6% 0;
2297
- fill: currentColor;
2298
- }
2299
-
2300
- .error {
2301
- margin: 0;
2302
- padding: 12px 14px;
2303
- border: 1px solid var(--dpk-danger);
2304
- border-radius: var(--dpk-radius-sm);
2305
- color: var(--dpk-danger);
2306
- font-family: var(--dpk-mono);
2307
- font-size: var(--dpk-text-xs);
2308
- }
2309
-
2310
- /* ------------------------------------------------------------ chrome */
2311
-
2312
- .chrome {
2313
- position: absolute;
2314
- right: 0;
2315
- bottom: 0;
2316
- left: 0;
2317
- z-index: 3;
2318
- padding: 28px 12px 6px;
2319
- background: linear-gradient(transparent, rgb(0 0 0 / 0.7));
2320
- color: var(--on-video);
2321
- transition: opacity var(--dpk-dur) var(--dpk-ease);
2322
- }
2323
-
2324
- .frame[data-fullscreen] .chrome {
2325
- position: fixed;
2326
- }
2327
-
2328
- :host([panel-open]) .frame[data-fullscreen] .chrome {
2329
- right: var(--panel-width);
2330
- }
2331
-
2332
- .player[data-idle] .chrome {
2333
- opacity: 0;
2334
- pointer-events: none;
2335
- }
2336
-
2337
- .bar {
2338
- position: relative;
2339
- display: flex;
2340
- align-items: center;
2341
- height: 18px;
2342
- outline: none;
2343
- cursor: pointer;
2344
- touch-action: none;
2345
- }
2346
-
2347
- .segments {
2348
- display: flex;
2349
- gap: 3px;
2350
- width: 100%;
2351
- }
2352
-
2353
- .segment {
2354
- position: relative;
2355
- flex-basis: 0;
2356
- min-width: 2px;
2357
- height: 4px;
2358
- overflow: hidden;
2359
- border-radius: 2px;
2360
- background: var(--on-video-faint);
2361
- transition: transform var(--dpk-dur-fast) var(--dpk-ease);
2362
- }
2363
-
2364
- .segment::before,
2365
- .segment::after {
2366
- content: '';
2367
- position: absolute;
2368
- inset: 0;
2369
- transform-origin: left;
2370
- }
2371
-
2372
- .segment::before {
2373
- background: rgb(255 255 255 / 0.4);
2374
- transform: scaleX(var(--hover));
2375
- }
2376
-
2377
- .segment::after {
2378
- background: var(--dpk-video-progress);
2379
- transform: scaleX(var(--fill));
2380
- }
2381
-
2382
- .segment[data-hovered] {
2383
- transform: scaleY(1.6);
2384
- }
2385
-
2386
- .thumb {
2387
- position: absolute;
2388
- left: calc(var(--progress) * 100%);
2389
- width: 13px;
2390
- height: 13px;
2391
- border-radius: 50%;
2392
- background: var(--dpk-video-progress);
2393
- translate: -50% 0;
2394
- scale: 0;
2395
- transition: scale var(--dpk-dur-fast) var(--dpk-ease-spring);
2396
- pointer-events: none;
2397
- }
2398
-
2399
- .bar:hover .thumb,
2400
- .bar:focus-visible .thumb {
2401
- scale: 1;
2402
- }
2403
-
2404
- .bar:focus-visible .segments {
2405
- border-radius: 3px;
2406
- box-shadow: 0 0 0 3px rgb(255 255 255 / 0.5);
2407
- }
2408
-
2409
- .tooltip {
2410
- position: absolute;
2411
- bottom: 24px;
2412
- left: clamp(72px, calc(var(--at) * 100%), calc(100% - 72px));
2413
- display: grid;
2414
- justify-items: center;
2415
- gap: 1px;
2416
- max-width: 240px;
2417
- padding: 5px 9px;
2418
- border-radius: var(--dpk-radius-sm);
2419
- background: rgb(20 20 20 / 0.92);
2420
- color: var(--on-video);
2421
- font-size: var(--dpk-text-2xs);
2422
- line-height: 1.35;
2423
- white-space: nowrap;
2424
- translate: -50% 0;
2425
- pointer-events: none;
2426
- box-shadow: var(--dpk-shadow-sm);
2427
- }
2428
-
2429
- .tooltip b {
2430
- max-width: 100%;
2431
- overflow: hidden;
2432
- font-weight: 650;
2433
- text-overflow: ellipsis;
2434
- }
2435
-
2436
- .tooltip span {
2437
- color: var(--on-video-soft);
2438
- }
2439
-
2440
- .controls {
2441
- display: flex;
2442
- align-items: center;
2443
- gap: 2px;
2444
- height: 40px;
2445
- }
2446
-
2447
- .ctl {
2448
- display: grid;
2449
- place-items: center;
2450
- width: 36px;
2451
- height: 36px;
2452
- padding: 0;
2453
- border: 0;
2454
- border-radius: var(--dpk-radius-sm);
2455
- background: transparent;
2456
- color: var(--on-video);
2457
- cursor: pointer;
2458
- transition:
2459
- background var(--dpk-dur-fast) var(--dpk-ease),
2460
- transform var(--dpk-dur-fast) var(--dpk-ease);
2461
- }
2462
-
2463
- .ctl:hover:not([disabled]) {
2464
- background: rgb(255 255 255 / 0.14);
2465
- }
2466
-
2467
- .ctl:active:not([disabled]) {
2468
- transform: scale(0.92);
2469
- }
2470
-
2471
- .ctl:focus-visible {
2472
- outline: none;
2473
- box-shadow: 0 0 0 2px rgb(255 255 255 / 0.7);
2474
- }
2475
-
2476
- .ctl[disabled] {
2477
- opacity: 0.4;
2478
- cursor: default;
2479
- }
2480
-
2481
- .ctl[aria-pressed='true'] {
2482
- background: rgb(255 255 255 / 0.2);
2483
- }
2484
-
2485
- .ctl svg {
2486
- width: 20px;
2487
- height: 20px;
2488
- }
2489
-
2490
- .volume {
2491
- display: flex;
2492
- align-items: center;
2493
- }
2494
-
2495
- .volume input {
2496
- width: 0;
2497
- height: 4px;
2498
- margin: 0;
2499
- border-radius: 2px;
2500
- background: linear-gradient(
2501
- to right,
2502
- var(--on-video) calc(var(--level) * 100%),
2503
- var(--on-video-faint) calc(var(--level) * 100%)
2504
- );
2505
- opacity: 0;
2506
- appearance: none;
2507
- cursor: pointer;
2508
- transition:
2509
- width var(--dpk-dur) var(--dpk-ease),
2510
- opacity var(--dpk-dur) var(--dpk-ease),
2511
- margin var(--dpk-dur) var(--dpk-ease);
2512
- }
2513
-
2514
- .volume:hover input,
2515
- .volume:focus-within input {
2516
- width: 72px;
2517
- margin: 0 8px 0 4px;
2518
- opacity: 1;
2519
- }
2520
-
2521
- .volume input::-webkit-slider-thumb {
2522
- width: 12px;
2523
- height: 12px;
2524
- border-radius: 50%;
2525
- background: var(--on-video);
2526
- appearance: none;
2527
- }
2528
-
2529
- .volume input::-moz-range-thumb {
2530
- width: 12px;
2531
- height: 12px;
2532
- border: 0;
2533
- border-radius: 50%;
2534
- background: var(--on-video);
2535
- }
2536
-
2537
- .volume input:focus-visible {
2538
- outline: none;
2539
- box-shadow: 0 0 0 3px rgb(255 255 255 / 0.4);
2540
- }
2541
-
2542
- .time {
2543
- padding: 0 8px;
2544
- color: var(--on-video-soft);
2545
- font-size: var(--dpk-text-xs);
2546
- white-space: nowrap;
2547
- }
2548
-
2549
- .spacer {
2550
- flex: 1;
2551
- }
2552
-
2553
- /* ------------------------------------------------------------- panel */
2554
-
2555
- .panel {
2556
- position: relative;
2557
- min-height: 240px;
2558
- overflow: hidden;
2559
- border: 1px solid var(--dpk-rule);
2560
- border-radius: var(--dpk-radius);
2561
- background: var(--dpk-paper-raised);
2562
- box-shadow: var(--dpk-shadow-xs);
2563
- }
2564
-
2565
- .frame[data-fullscreen] .panel {
2566
- border-width: 0 0 0 1px;
2567
- border-radius: 0;
2568
- }
2569
-
2570
- .panel-body {
2571
- position: absolute;
2572
- inset: 0;
2573
- display: flex;
2574
- flex-direction: column;
2575
- }
2576
-
2577
- .panel-head {
2578
- display: flex;
2579
- align-items: center;
2580
- gap: 8px;
2581
- padding: 10px 10px 10px 12px;
2582
- border-bottom: 1px solid var(--dpk-rule);
2583
- }
2584
-
2585
- .panel-head .comment-kinds {
2586
- flex: 1;
2587
- font-size: var(--dpk-text-xs);
2588
- }
2589
-
2590
- .panel-title {
2591
- flex: 1;
2592
- margin: 0;
2593
- font-size: var(--dpk-text-sm);
2594
- font-weight: 650;
2595
- }
2596
-
2597
- .count {
2598
- display: inline-block;
2599
- min-width: 1.6em;
2600
- margin-left: 2px;
2601
- padding: 0 5px;
2602
- border-radius: 999px;
2603
- background: var(--dpk-paper-inset);
2604
- color: var(--dpk-ink-soft);
2605
- font-size: var(--dpk-text-2xs);
2606
- text-align: center;
2607
- }
2608
-
2609
- .chapters,
2610
- .moments {
2611
- flex: 1;
2612
- display: grid;
2613
- align-content: start;
2614
- gap: 2px;
2615
- margin: 0;
2616
- padding: 6px;
2617
- overflow: auto;
2618
- list-style: none;
2619
- }
2620
-
2621
- .chapter {
2622
- position: relative;
2623
- display: grid;
2624
- grid-template-columns: 3.2em minmax(0, 1fr);
2625
- gap: 10px;
2626
- width: 100%;
2627
- padding: 8px 10px;
2628
- overflow: hidden;
2629
- border: 0;
2630
- border-radius: var(--dpk-radius-sm);
2631
- background: transparent;
2632
- color: var(--dpk-ink-soft);
2633
- font: inherit;
2634
- font-size: var(--dpk-text-sm);
2635
- text-align: left;
2636
- cursor: pointer;
2637
- transition: background var(--dpk-dur-fast) var(--dpk-ease);
2638
- }
2639
-
2640
- .chapter:hover {
2641
- background: var(--dpk-paper-sunken);
2642
- color: var(--dpk-ink);
2643
- }
2644
-
2645
- .chapter:focus-visible {
2646
- outline: none;
2647
- box-shadow: var(--dpk-focus);
2648
- }
2649
-
2650
- .chapter[aria-current='true'] {
2651
- background: var(--dpk-blue-soft);
2652
- color: var(--dpk-ink);
2653
- font-weight: 600;
2654
- }
2655
-
2656
- .chapter[aria-current='true']::after {
2657
- content: '';
2658
- position: absolute;
2659
- bottom: 0;
2660
- left: 0;
2661
- width: calc(var(--progress) * 100%);
2662
- height: 2px;
2663
- background: var(--dpk-blue);
2664
- }
2665
-
2666
- .chapter-time {
2667
- color: var(--dpk-ink-faint);
2668
- font-family: var(--dpk-mono);
2669
- font-size: var(--dpk-text-2xs);
2670
- line-height: 1.7;
2671
- }
2672
-
2673
- .chapter-title {
2674
- overflow-wrap: anywhere;
2675
- }
2676
-
2677
- .empty {
2678
- flex: 1;
2679
- margin: 0;
2680
- padding: 16px 14px;
2681
- color: var(--dpk-ink-faint);
2682
- font-size: var(--dpk-text-sm);
2683
- }
2684
-
2685
- .moment {
2686
- display: grid;
2687
- grid-template-columns: auto minmax(0, 1fr) auto;
2688
- align-items: center;
2689
- gap: 6px 8px;
2690
- padding: 8px 8px 10px;
2691
- border-radius: var(--dpk-radius-sm);
2692
- }
2693
-
2694
- .moment + .moment {
2695
- border-top: 1px solid var(--dpk-rule);
2696
- }
2697
-
2698
- .moment-time {
2699
- padding: 1px 7px;
2700
- border: 1px solid var(--dpk-rule-strong);
2701
- border-radius: var(--dpk-radius-xs);
2702
- background: var(--dpk-paper-raised);
2703
- color: var(--dpk-blue-strong);
2704
- font-family: var(--dpk-mono);
2705
- font-size: var(--dpk-text-2xs);
2706
- cursor: pointer;
2707
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
2708
- }
2709
-
2710
- .moment-time:hover {
2711
- background: var(--dpk-blue-soft);
2712
- }
2713
-
2714
- .moment-time:focus-visible {
2715
- outline: none;
2716
- box-shadow: var(--dpk-focus);
2717
- }
2718
-
2719
- .moment-scene {
2720
- overflow: hidden;
2721
- color: var(--dpk-ink-faint);
2722
- font-size: var(--dpk-text-2xs);
2723
- text-overflow: ellipsis;
2724
- white-space: nowrap;
2725
- }
2726
-
2727
- .moment-kind {
2728
- display: inline-grid;
2729
- color: var(--dpk-ink-faint);
2730
- }
2731
-
2732
- .moment-kind svg {
2733
- width: 13px;
2734
- height: 13px;
2735
- }
2736
-
2737
- .moment-body {
2738
- grid-column: 1 / -1;
2739
- margin: 0;
2740
- font-size: var(--dpk-text-sm);
2741
- line-height: 1.55;
2742
- white-space: pre-wrap;
2743
- overflow-wrap: anywhere;
2744
- }
2745
-
2746
- .composer {
2747
- display: grid;
2748
- gap: 6px;
2749
- padding: 10px 12px 12px;
2750
- border-top: 1px solid var(--dpk-rule);
2751
- background: var(--dpk-paper-sunken);
2752
- }
2753
- `,Hr=':scope > script[type="application/json"]',Wr=1280,Ws=":scope > [data-scene]",Br=":scope > :not([data-scene], script)",Bs=.25,Kr=2500,Ks=5,Vr=()=>`note-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,Vs=({scene:n,time:t})=>`${V(t)} \xB7 ${n.title}`,G=(n,t,e)=>Math.min(e,Math.max(t,n)),Gr=n=>{const t=n.payload;return typeof t=="object"&&t!==null&&"body"in t&&typeof t.body=="string"?t.body:""},Jr=new Set([" ","enter","arrowleft","arrowright","arrowup","arrowdown","home","end"]),Xr=n=>n.composedPath().some(t=>t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&t.type!=="range"||t instanceof HTMLElement&&t.isContentEditable),Yr=n=>{const t=n.composedPath()[0];return t instanceof HTMLInputElement||t instanceof HTMLButtonElement},Zr=n=>{const t=[],e=s=>{s instanceof HTMLElement&&s.localName.startsWith("dpk-")&&!s.inert&&(s.inert=!0);const a=s.shadowRoot;if(a!==null){t.push(a);for(const i of a.querySelectorAll("*"))e(i)}};e(n);for(const s of n.querySelectorAll("*"))e(s);return t};class Qr{#a=new WeakMap;drive(t,e,s){const a=this.#a.get(t)??new Set;this.#a.set(t,a);const i=t.getAnimations({subtree:!0});if(s)for(const r of Zr(t))i.push(...r.getAnimations());for(const r of i)"transitionProperty"in r||a.add(r);for(const r of a){const o=r.effect instanceof KeyframeEffect?r.effect.target:null;if(r.playState==="idle"||o===null||!o.isConnected){a.delete(r);continue}r.pause(),r.currentTime=e}}}class Gs extends A{static{this.styles=[L,J,ht,Kn(),fa,Fr]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String},panelOpen:{type:Boolean,reflect:!0,attribute:"panel-open"},designWidth:{type:Number,attribute:"design-width"},_time:{state:!0},_playing:{state:!0},_timeline:{state:!0},_dataError:{state:!0},_volume:{state:!0},_muted:{state:!0},_captions:{state:!0},_idle:{state:!0},_fullscreen:{state:!0},_tab:{state:!0},_hover:{state:!0},_draft:{state:!0},_kind:{state:!0},_unrecorded:{state:!0}}}#a=new O(this,()=>{this.#k="",this.#S()});#t=new jr;#e=new Qr;#n=new MutationObserver(()=>{this.#E()});#s=new MutationObserver(()=>{this.#E()});#i=new MutationObserver(()=>{this.#E()});#r=null;#o=re();#l=re();#c=[];#p=[];#g=null;#u={time:0,now:0};#d=0;#m=0;#b=0;#x=[];#f=new Set;#k="";#h=!0;#C=!1;#w=0;#y=new ResizeObserver(([t])=>{t!==void 0&&(this.#w=t.contentRect.width,this.#_())});constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null,this.panelOpen=!1,this.designWidth=Wr,this._time=0,this._playing=!1,this._timeline=null,this._dataError=null,this._volume=1,this._muted=!1,this._captions=!0,this._idle=!1,this._fullscreen=!1,this._tab="chapters",this._hover=null,this._draft="",this._kind="comment",this._unrecorded=!1}connectedCallback(){super.connectedCallback(),this.#k="",this.#h=!0,document.addEventListener("fullscreenchange",this.#I),this.toggleAttribute("playing",this._playing),this.#n.observe(this,{childList:!0}),this.#s.observe(this,{attributes:!0,attributeFilter:["data-scene"],subtree:!0}),this.#E(),this.updateComplete.then(()=>{const t=this.renderRoot.querySelector(".stage");t!==null&&this.isConnected&&this.#y.observe(t)})}disconnectedCallback(){super.disconnectedCallback(),this.#y.disconnect(),this.#n.disconnect(),this.#s.disconnect(),this.#i.disconnect(),this.#r=null,document.removeEventListener("fullscreenchange",this.#I),this.pause(),clearTimeout(this.#m)}updated(t){(this.#h||t.has("_timeline")||t.has("id")||t.has("heading"))&&(this.#h=!1,this.#A()),this.toggleAttribute("controls-visible",!this._playing||!this._idle),t.has("_timeline")&&this.#T(),t.has("designWidth")&&this.#_()}get dataError(){return this._dataError}get duration(){return this._timeline?.duration??0}get currentTime(){return this._time}set currentTime(t){this.seek(t)}get paused(){return!this._playing}play(){const t=this._timeline;if(t===null||this._playing)return;this._time>=t.duration-.05&&(this._time=0),this._playing=!0,this.toggleAttribute("playing",!0),this.#u={time:this._time,now:performance.now()},this.#t.sync(this._time,!0,!0),this.#$();const e=()=>{const s=this._timeline;if(!this._playing||s===null)return;const a=this.#u.time+(performance.now()-this.#u.now)/1e3;if(a>=s.duration){this._time=s.duration,this.pause();return}this._time=a,this.#t.sync(a,!0,!1),this.#T(),this.#d=requestAnimationFrame(e)};this.#d=requestAnimationFrame(e)}pause(){cancelAnimationFrame(this.#d),this._playing=!1,this.toggleAttribute("playing",!1),this.#t.stop(),this.#T()}toggle(){this._playing?this.pause():this.play()}seek(t){this._time=G(t,0,this.duration),this.#u={time:this._time,now:performance.now()},this._playing&&this.#t.sync(this._time,!0,!0),this.#T()}get commentTargets(){const t=this._timeline;if(!this.id||t===null)return[];const e=`${this.heading??this.#v.heading} \xB7 ${this.id}`,a=[...new Set([...this.#x.map(i=>`element:${i.target.id}`),...this.#f])].flatMap(i=>{const r=Fs(this.id,t,i);return r===null?[]:[{value:i,label:Vs(r),group:e}]});return[...t.scenes.map(i=>({value:js(this.id,i.id),label:i.title,group:e})),...a]}get elementComments(){return this.#x}set elementComments(t){this.#x=t,this.#h=!0;const e=new Set(t.map(s=>`element:${s.target.id}`));this.#f=new Set([...this.#f].filter(s=>!e.has(s))),this.requestUpdate()}get elementActions(){return this.#c}set elementActions(t){this.#c=t,this.#S()}get elementActionResults(){return this.#p}get#v(){return mr(this.#a.locale)}get#z(){const t=this._timeline;if(t===null)return[];const e=this.#x.flatMap(a=>{const i=Fs(this.id,t,`element:${a.target.id}`,{scenes:!0});return i===null?[]:[{id:a.id,kind:"comment",time:i.time,scene:i.scene.title,body:Gr(a)}]}),s=this.#l.scenes.flatMap(a=>{const i=t.scenes.find(r=>r.id===a.id);return i===void 0?[]:a.notes.map(r=>({id:r.id,kind:"note",time:i.start+G(r.at??0,0,i.end-i.start),scene:i.title,body:r.body}))});return[...e,...s].sort((a,i)=>a.time-i.time)}#S(){const t=Lr(this.#v,this.#o,this.#c);this.#l=t.data,this.#p=t.results,this.#h=!0,this.requestUpdate()}async#E(){const t=this.querySelector(Hr);t!==this.#r&&(this.#i.disconnect(),t!==null&&this.#i.observe(t,{childList:!0,subtree:!0,characterData:!0}),this.#r=t);const e=t?.textContent??"";if(e===this.#g){this.#L(),this.#T();return}this.#g=e;const s=++this.#b;try{this.#o=Us(JSON.parse(e)),this._dataError=null}catch(r){this.pause(),this.#o=re(),this.#S(),this._dataError=r instanceof Error?r.message:String(r),this._timeline=null,console.error("[dev-process-kit] invalid video data:",this._dataError);return}this.#S();const a=await this.#t.measure(Cr(this.#l),r=>new URL(r,document.baseURI).href);if(s!==this.#b)return;const i=Er(this.#l,r=>a.get(r)??null);this.#t.load(i),this.#t.setVolume(this._volume,this._muted),this._time=G(this._time,0,i.duration),this._timeline=i,this.#L()}#_(){this.#w===0||!(this.designWidth>0)||this.style.setProperty("--dpk-video-scale",(this.#w/this.designWidth).toFixed(4))}#L(){const t=this._timeline;if(t!==null){this._dataError=null;for(const e of this.querySelectorAll(Ws)){const s=t.scenes.find(a=>a.id===e.dataset.scene);if(s===void 0){this.pause(),this._dataError=`data-scene="${e.dataset.scene??""}" names no scene of the video`,console.error("[dev-process-kit] invalid video data:",this._dataError);return}for(const a of s.cues)e.style.setProperty(`--dpk-cue-${a.key}`,`${(a.start-s.start).toFixed(3)}s`);e.style.setProperty("--dpk-scene-duration",`${(s.end-s.start).toFixed(3)}s`)}}}#T(){const t=this._timeline;if(t===null)return;const e=this._time,s=t.scenes.length-1,a=tt(t,e),i=t.scenes[a],r=Ns(t,e,Bs);this.#D("scene",i?.id??null),this.#D("cue",r?.key??null),this.#D("voice",r?.voice??null);for(const o of this.querySelectorAll(Ws)){const l=t.scenes.findIndex(M=>M.id===o.dataset.scene),c=t.scenes[l];if(c===void 0)continue;const p=e-c.start,m=this.#l.fade,f=l===0?1:m===0?+(p>=0):p/m+1,E=l===s?1:m===0?+(e<c.end):(c.end-e)/m,R=G(Math.min(f,E),0,1);o.style.opacity=String(R),o.style.visibility=R>0?"visible":"hidden",o.inert=l!==a,this.#e.drive(o,G(p,0,c.end-c.start)*1e3,R>0)}for(const o of this.querySelectorAll(Br))this.#e.drive(o,e*1e3,!0);this.dispatchEvent(new CustomEvent("dpk-video-timeupdate",{detail:{time:e,scene:i?.id??null,sceneTime:e-(i?.start??0),sceneDuration:i===void 0?0:i.end-i.start,cue:r?.key??null,cueTime:r===null?null:e-r.start,playing:this._playing}}))}#D(t,e){e===null?this.removeAttribute(t):this.getAttribute(t)!==e&&this.setAttribute(t,e)}#A(){const t=JSON.stringify([this.commentTargets,this.#p]);t!==this.#k&&(this.#k=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}#P(){this._kind==="note"?this.#O():this.#M()}#O(){const t=this._draft.trim(),e=this._timeline,s=e?.scenes[tt(e,this._time)];if(!t||!this.id||s===void 0)return;const a=Math.round((this._time-s.start)*1e3)/1e3,i=!this.dispatchEvent(new CustomEvent("dpk-element-action",{detail:{type:Hs,target:js(this.id,s.id),payload:{id:Vr(),at:a,body:t}},bubbles:!0,composed:!0,cancelable:!0}));this._unrecorded=!i,i&&(this._draft="")}#M(){const t=this._draft.trim();if(!t||!this.id||this._timeline===null)return;const e=zr(this.id,this._timeline,this._time);this.#f=new Set(this.#f).add(e),this.#h=!0;const s=!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:e,body:t},bubbles:!0,composed:!0,cancelable:!0}));if(!s){const a=new Set(this.#f);a.delete(e),this.#f=a}this._unrecorded=!s,s&&(this._draft="")}#R(t,e){this._volume=t,this._muted=e,this.#t.setVolume(t,e),this._playing&&this.#t.sync(this._time,!0,!1)}#$=()=>{this._idle=!1,clearTimeout(this.#m),this.#m=window.setTimeout(()=>{const t=this.renderRoot.querySelector(".player");this._idle=this._playing&&!this.#C&&!(t?.matches(":focus-within")??!1)},Kr)};#q(){const t=this.renderRoot.querySelector(".frame");document.fullscreenElement!==null?document.exitFullscreen():t instanceof HTMLElement&&t.requestFullscreen()}#I=()=>{this._fullscreen=this.renderRoot instanceof ShadowRoot&&this.renderRoot.fullscreenElement!==null};#B=t=>{if(t.isComposing||t.ctrlKey||t.metaKey||t.altKey||Xr(t))return;const e=t.key.toLowerCase();if(!(Jr.has(e)&&Yr(t))){if(e===" "||e==="k")this.toggle();else if(e==="arrowleft"||e==="j")this.seek(this._time-Ks);else if(e==="arrowright"||e==="l")this.seek(this._time+Ks);else if(e==="home")this.seek(0);else if(e==="end")this.seek(this.duration);else if(e==="m")this.#R(this._volume,!this._muted);else if(e==="f")this.#q();else if(e==="c")this._captions=!this._captions;else return;t.preventDefault(),this.#$()}};#N(t){const e=t.currentTarget;if(!(e instanceof HTMLElement))return 0;const s=e.getBoundingClientRect();return G((t.clientX-s.left)/s.width,0,1)}#K=t=>{t.button!==0||!(t.currentTarget instanceof HTMLElement)||(t.currentTarget.setPointerCapture(t.pointerId),this.#C=!0,this.seek(this.#N(t)*this.duration))};#V=t=>{const e=this.#N(t);this._hover={ratio:e,time:e*this.duration},this.#C&&this.seek(e*this.duration)};#j=()=>{this.#C=!1};render(){const t=this.#v;if(this._dataError!==null)return d`<p class="error" role="alert">${this._dataError}</p>`;const e=this._timeline,s=e===null?null:Ns(e,this._time,Bs),a=!this._playing||!this._idle;return d`<div class="frame" ?data-fullscreen=${this._fullscreen}>
2754
- <div
2755
- class="player"
2756
- role="region"
2757
- aria-label=${this.heading??t.heading}
2758
- tabindex="0"
2759
- ?data-idle=${!a}
2760
- @pointermove=${this.#$}
2761
- @pointerdown=${this.#$}
2762
- @keydown=${this.#B}
2763
- @focusin=${this.#$}
2764
- >
2765
- <div
2766
- class="stage"
2767
- @click=${i=>{i.defaultPrevented||this.toggle()}}
2768
- >
2769
- <slot></slot>
2770
- ${!this._captions||s?.text===void 0?h:d`<p class="subtitle" part="subtitle" data-tone=${s.captionTone??"white"}>
2771
- ${s.voice===void 0?h:d`<span class=${s.captionTone===null?"voice":"voice sr-only"} part="voice"
2772
- >${s.voice}</span
2773
- >`}
2774
- <span>${s.text}</span>
2775
- </p>`}
2776
- ${!this._playing&&this._time===0&&e!==null?d`<span class="big-play" aria-hidden="true">${Ee()}</span>`:h}
2777
- </div>
2778
- ${this.#F(t,e)}
2779
- </div>
2780
- ${this.panelOpen?this.#H(t,e):h}
2781
- </div>`}#F(t,e){const s=e?.duration??0,a=s===0?0:this._time/s,i=this._hover===null||e===null?null:e.scenes[tt(e,this._hover.time)],r=this._muted?0:this._volume,o=r===0?ta:r<.5?ea:sa;return d`<div class="chrome" part="controls">
2782
- <div
2783
- class="bar"
2784
- role="slider"
2785
- tabindex="0"
2786
- aria-label=${t.seek}
2787
- aria-valuemin="0"
2788
- aria-valuemax=${Math.round(s)}
2789
- aria-valuenow=${Math.round(this._time)}
2790
- aria-valuetext=${`${V(this._time)} / ${V(s)}`}
2791
- style=${`--progress:${a}`}
2792
- @pointerdown=${this.#K}
2793
- @pointermove=${this.#V}
2794
- @pointerup=${this.#j}
2795
- @pointercancel=${this.#j}
2796
- @pointerleave=${()=>{this._hover=null}}
2797
- >
2798
- <div class="segments">
2799
- ${(e?.scenes??[]).map(l=>{const c=l.end-l.start,p=c===0?0:G((this._time-l.start)/c,0,1),m=this._hover===null?0:G((this._hover.time-l.start)/(c||1),0,1);return d`<span
2800
- class="segment"
2801
- style=${`flex-grow:${c};--fill:${p};--hover:${m}`}
2802
- ?data-hovered=${i?.id===l.id}
2803
- ></span>`})}
2804
- </div>
2805
- <span class="thumb"></span>
2806
- ${this._hover===null?h:d`<span class="tooltip" style=${`--at:${this._hover.ratio}`}>
2807
- ${i==null?h:d`<b>${i.title}</b>`}
2808
- <span class="dpk-num">${V(this._hover.time)}</span>
2809
- </span>`}
2810
- </div>
2811
- <div class="controls">
2812
- <button
2813
- class="ctl"
2814
- type="button"
2815
- aria-label=${this._playing?t.pause:t.play}
2816
- title=${this._playing?t.pause:t.play}
2817
- ?disabled=${e===null}
2818
- @click=${()=>this.toggle()}
2819
- >
2820
- ${this._playing?Vn():Ee()}
2821
- </button>
2822
- <div class="volume">
2823
- <button
2824
- class="ctl"
2825
- type="button"
2826
- aria-label=${this._muted?t.unmute:t.mute}
2827
- title=${this._muted?t.unmute:t.mute}
2828
- @click=${()=>this.#R(this._volume===0?1:this._volume,!this._muted)}
2829
- >
2830
- ${o()}
2831
- </button>
2832
- <input
2833
- type="range"
2834
- min="0"
2835
- max="1"
2836
- step="0.05"
2837
- aria-label=${t.volume}
2838
- .value=${String(r)}
2839
- style=${`--level:${r}`}
2840
- @input=${l=>{if(l.currentTarget instanceof HTMLInputElement){const c=Number(l.currentTarget.value);this.#R(c,c===0)}}}
2841
- />
2842
- </div>
2843
- <span class="time dpk-num">${V(this._time)} / ${V(s)}</span>
2844
- <span class="spacer"></span>
2845
- ${e?.scenes.some(l=>l.cues.some(c=>c.text!==void 0))?d`<button
2846
- class="ctl"
2847
- type="button"
2848
- aria-label=${t.captions}
2849
- title=${t.captions}
2850
- aria-pressed=${this._captions?"true":"false"}
2851
- @click=${()=>{this._captions=!this._captions}}
2852
- >
2853
- ${this._captions?Gn():Jn()}
2854
- </button>`:h}
2855
- <button
2856
- class="ctl"
2857
- type="button"
2858
- aria-label=${this._fullscreen?t.exitFullscreen:t.fullscreen}
2859
- title=${this._fullscreen?t.exitFullscreen:t.fullscreen}
2860
- @click=${()=>this.#q()}
2861
- >
2862
- ${this._fullscreen?Xn():Yn()}
2863
- </button>
2864
- <button
2865
- class="ctl"
2866
- type="button"
2867
- aria-label=${t.openPanel}
2868
- title=${t.openPanel}
2869
- aria-pressed=${this.panelOpen?"true":"false"}
2870
- @click=${()=>{this.panelOpen=!this.panelOpen}}
2871
- >
2872
- ${Zn()}
2873
- </button>
2874
- </div>
2875
- </div>`}#H(t,e){const s=!!this.id,a=s?this._tab:"chapters",i=this.#z;return d`<aside class="panel" aria-label=${t.openPanel}>
2876
- <div class="panel-body">
2877
- <header class="panel-head">
2878
- ${s?d`<fieldset class="comment-kinds" @keydown=${r=>r.stopPropagation()}>
2879
- <legend>${t.openPanel}</legend>
2880
- ${["chapters","comments"].map(r=>d`<label class="comment-kind">
2881
- <input
2882
- type="radio"
2883
- name="panel-tab"
2884
- .checked=${a===r}
2885
- @change=${()=>{this._tab=r}}
2886
- />
2887
- <span
2888
- >${r==="chapters"?t.chapters:t.comments}${r==="comments"&&i.length>0?d` <span class="count dpk-num">${i.length}</span>`:h}</span
2889
- >
2890
- </label>`)}
2891
- </fieldset>`:d`<h2 class="panel-title">${t.chapters}</h2>`}
2892
- <button
2893
- class="dpk-icon-btn"
2894
- type="button"
2895
- aria-label=${t.closePanel}
2896
- title=${t.closePanel}
2897
- @click=${()=>{this.panelOpen=!1}}
2898
- >
2899
- ${Te()}
2900
- </button>
2901
- </header>
2902
- ${a==="chapters"?this.#W(e):this.#U(t,i)}
2903
- </div>
2904
- </aside>`}#W(t){const e=t===null?-1:tt(t,this._time);return d`<ol class="chapters">
2905
- ${U(t?.scenes??[],s=>s.id,(s,a)=>{const i=s.end-s.start,r=a===e&&i>0?G((this._time-s.start)/i,0,1):0;return d`<li>
2906
- <button
2907
- class="chapter"
2908
- type="button"
2909
- aria-current=${a===e?"true":"false"}
2910
- style=${`--progress:${r}`}
2911
- @click=${()=>this.seek(s.start)}
2912
- >
2913
- <span class="chapter-time dpk-num">${V(s.start)}</span>
2914
- <span class="chapter-title">${s.title}</span>
2915
- </button>
2916
- </li>`})}
2917
- </ol>`}#U(t,e){const s=this._timeline,a=s?.scenes[tt(s,this._time)],i=a===void 0?V(this._time):Vs({scene:a,time:this._time}),r=this._kind==="note",o=qe(this._draft,[],{label:r?t.noteAt(i):t.commentAt(i),placeholder:r?t.notePlaceholder:t.commentPlaceholder,submitLabel:r?t.keepNote:t.submit,choice:{label:t.kind,value:this._kind,options:[{value:"comment",label:t.reviewComment},{value:"note",label:t.note}]},...this._unrecorded?{error:t.notSaved}:{}}),l=c=>{c.kind==="input"?(this._draft=c.body,this._unrecorded=!1):c.kind==="choose"?(this._kind=c.value==="note"?"note":"comment",this._unrecorded=!1):c.kind==="comment"&&this.#P()};return d`${e.length===0?d`<p class="empty">${t.noComments}</p>`:d`<ol class="moments">
2918
- ${U(e,c=>`${c.kind}:${c.id}`,c=>d`<li class="moment" data-kind=${c.kind}>
2919
- <button class="moment-time dpk-num" type="button" @click=${()=>this.seek(c.time)}>
2920
- ${V(c.time)}
2921
- </button>
2922
- <span class="moment-scene">${c.scene}</span>
2923
- <span class="moment-kind" role="img" aria-label=${c.kind==="note"?t.note:t.reviewComment}
2924
- >${c.kind==="note"?Qn():$t()}</span
2925
- >
2926
- <p class="moment-body">${c.body}</p>
2927
- </li>`)}
2928
- </ol>`}
2929
- <div class="composer" @keydown=${c=>c.stopPropagation()}>
2930
- ${ba(Ue(this.#a.locale),o,l)}
2931
- </div>`}}const Js=()=>{customElements.get("dpk-video")||customElements.define("dpk-video",Gs)},to=D({en:{heading:"Content",untitled:"Untitled",sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{heading:"\u672C\u6587",untitled:"\u7121\u984C",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}}),eo=/^([A-Za-z0-9_-]+):([A-Za-z0-9_-]+)$/,so=n=>{const t=eo.exec(n?.trim()??"");if(!t)return null;const[,e="",s=""]=t;return{kind:e,id:s}},Xs=60,no=(n,t,e,s)=>{const a=[n,t,e].map(i=>i?.replace(/\s+/g," ").trim()??"").find(Boolean);return a===void 0?s:a.length>Xs?`${a.slice(0,Xs-1)}\u2026`:a},wt=n=>`${n.kind}:${n.id}`,ao=n=>{const t=new Map;for(const e of n)t.set(wt(e),(t.get(wt(e))??0)+1);return n.filter(e=>t.get(wt(e))===1)},Ys=(n,t)=>`element:${[n,t.kind,t.id].map(e=>encodeURIComponent(e)).join("/")}`,io="[data-dpk-item]",ro="h1, h2, h3, h4, h5, h6, summary, caption, legend";class Zs extends A{static{this.styles=[L,J,ht,_`
2932
- :host {
2933
- position: relative;
2934
- display: block;
2935
- font-size: inherit;
2936
- line-height: inherit;
2937
- color: inherit;
2938
- }
2939
- .comment-error {
2940
- margin: 0;
2941
- font-size: 11px;
2942
- color: var(--dpk-accent);
2943
- }
2944
- `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new O(this);#t=new ut(this);#e=new MutationObserver(()=>{this.#c()});#n=[];#s=new Set;#i="";constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#e.observe(this,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["data-dpk-item","data-dpk-label"]}),this.#c()}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}get commentTargets(){if(!this.id)return[];const t=`${this.heading??this.#l.heading} \xB7 ${this.id}`;return this.#n.map(e=>({value:Ys(this.id,e),label:e.label,group:t}))}willUpdate(t){t.has("id")&&this.#p(),(t.has("id")||t.has("heading"))&&this.#g()}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop"))}getContextMenuItems(t){const e=Et(t.target,this.commentTargets,Ut(this.#a.locale),(s,a)=>this.#r(s,a));return e===null?null:[e]}#r(t,e){const s=this.querySelector(`[data-dpk-target="${CSS.escape(t)}"]`);s!==null&&this.#t.open(t,s,e)}#o(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}render(){return d`<slot></slot>${this.#t.render({locale:this.#a.locale,errorMessage:this.#l.sendFailed,submit:(t,e)=>this.#o(t,e)})}`}get#l(){return to(this.#a.locale)}#c(){const t=[...this.querySelectorAll(io)].flatMap(s=>{if(s.parentElement?.closest(this.localName)!==this)return[];const a=so(s.getAttribute("data-dpk-item"));if(a===null)return[];const i=s.querySelector(ro)?.textContent??null,r=no(s.getAttribute("data-dpk-label"),i,s.textContent,this.#l.untitled);return[{...a,label:r,element:s}]}),e=ao(t);if(e.length<t.length){const s=new Set(e.map(wt)),a=[...new Set(t.map(wt).filter(i=>!s.has(i)))];console.warn(`[dev-process-kit] ${this.localName}#${this.id}: ambiguous data-dpk-item ignored:`,a)}this.#n=e,this.#p(),this.#g()}#p(){const t=new Set(this.#n.map(e=>e.element));for(const e of this.#s)t.has(e)||e.removeAttribute("data-dpk-target");for(const e of this.#n)e.element.setAttribute("data-dpk-target",Ys(this.id,e));this.#s=t}#g(){const t=JSON.stringify(this.commentTargets);t!==this.#i&&(this.#i=t,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}}const Qs=()=>{customElements.get("dpk-commentable")||customElements.define("dpk-commentable",Zs)},oo="dpk-extend-right-click-run",oe=y(b(),S(1)),lt=y(b(),S(1)),lo=x({kind:at("item"),id:oe,label:lt,danger:g(nt()),event:g(lt),detail:g(Oe(b(),Ft())),copy:g(lt)}),co=x({kind:at("submenu"),id:oe,label:lt,entries:$(Ie(()=>tn))}),tn=Ie(()=>Pe("kind",[lo,co])),po=x({id:oe,heading:g(lt),entries:$(tn)}),ho=x({selector:y(b(),Re(),S(1)),label:g(lt),groups:$(po)}),uo=x({targets:$(ho)}),en=(n,t)=>{for(const e of n){if(t.has(e.id))throw new Error(`duplicate id: ${e.id}`);t.add(e.id),e.kind==="submenu"&&en(e.entries,t)}},le=n=>{const t=B(uo,n),e=new Set;for(const s of t.targets)for(const a of s.groups){if(e.has(a.id))throw new Error(`duplicate id: ${a.id}`);e.add(a.id),en(a.entries,e)}return t},sn="dpk-extend-right-click",de=`[dev-process-kit] ${sn}: `,mo="text",go=(n,t)=>{const e=na(n,n),s=e.indexOf(t);return s===-1?null:[n,...e.slice(0,s)]},fo=(n,t)=>{const s=(t===mo?n.textContent:n.getAttribute(t))?.trim()??"";return s===""?null:s},bo=(n,t,e)=>{try{return n.matches(t)}catch{return e.has(t)||(e.add(t),console.warn(`${de}invalid target selector ${JSON.stringify(t)} ignored`)),!1}};class nn extends A{static{this.styles=_`
2945
- :host {
2946
- display: contents;
2947
- }
2948
- `}static{this.properties={config:{attribute:!1}}}#a=null;#t=null;#e=null;#n=null;constructor(){super(),this.config=null}connectedCallback(){super.connectedCallback(),this.#e=X(this,le,t=>{if(t.ok){this.#a=t.value,this.#t=null;return}this.#a=null,this.#t=t.error,console.warn(`${de}JSON child ignored: ${t.error}`)})}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=null}get error(){return this.#t}getContextMenuItems(t){const e=this.#s();if(e===null)return null;const s=t.origin??null;if(!(s instanceof Element))return null;const a=go(s,this);if(a===null||a.some(o=>o.localName===sn))return null;const i=this.#r(a,e);if(i===null)return null;const r=this.#o(i.target,i.element);return r.length===0?null:r}render(){return d`<slot></slot>`}#s(){return this.config===null?this.#a:(this.#n?.raw!==this.config&&(this.#n={raw:this.config,parsed:this.#i(this.config)}),this.#n.parsed)}#i(t){try{return le(t)}catch(e){return console.warn(`${de}config ignored: ${e instanceof Error?e.message:String(e)}`),null}}#r(t,e){const s=new Set;for(const a of t)for(const i of e.targets)if(bo(a,i.selector,s))return{target:i,element:a};return null}#o(t,e){return t.groups.flatMap(s=>{const a=this.#l(s.entries,s,t,e);return a.length===0?[]:[s.heading===void 0?{id:s.id,entries:a}:{id:s.id,heading:s.heading,entries:a}]})}#l(t,e,s,a){return t.flatMap(i=>i.kind==="submenu"?this.#c(i,e,s,a):this.#p(i,e,s,a))}#c(t,e,s,a){const i=this.#l(t.entries,e,s,a);return i.length===0?[]:[{kind:"submenu",id:t.id,label:t.label,items:i}]}#p(t,e,s,a){const i=t.copy===void 0?null:fo(a,t.copy);if(t.copy!==void 0&&i===null)return[];const r=()=>{i!==null&&Nt(i),!(i!==null&&t.event===void 0)&&this.#g(t,e,s,a)};return[t.danger===!0?{kind:"item",id:t.id,label:t.label,run:r,danger:!0}:{kind:"item",id:t.id,label:t.label,run:r}]}#g(t,e,s,a){const i={id:t.id,group:e.id,item:t.id,target:{selector:s.selector,label:s.label??null},element:a,authored:t.detail??{}};this.dispatchEvent(new CustomEvent(t.event??oo,{detail:i,bubbles:!0,composed:!0}))}}const an=()=>{customElements.get("dpk-extend-right-click")||customElements.define("dpk-extend-right-click",nn)},ko=D({en:{sendFailed:"Could not send. Place this inside a dpk-view-* element."},ja:{sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002"}});class rn extends A{static{this.styles=[L,J,ht,_`
2949
- :host {
2950
- position: relative;
2951
- display: inline-block;
2952
- }
2953
- .comment-error {
2954
- margin: 0;
2955
- font-size: 11px;
2956
- color: var(--dpk-accent);
2957
- /* A refusal lands under the composer it belongs to, rather than
2958
- simply being there when the reader looks back. */
2959
- animation: dpk-rise-in var(--dpk-dur-fast) var(--dpk-ease-out);
2960
- }
2961
- `]}static{this.properties={target:{type:String},label:{type:String},open:{type:Boolean,reflect:!0}}}#a=new O(this);#t=new ut(this);constructor(){super(),this.target="",this.label=null,this.open=!1,this.addEventListener("click",this.#e)}#e=()=>{this.open=!0};get commentTargets(){return this.target.length===0?[]:[{value:this.target,label:this.label??this.target}]}willUpdate(t){t.has("target")&&(this.target.length===0?this.removeAttribute("data-dpk-target"):this.setAttribute("data-dpk-target",this.target)),t.has("open")&&(this.open&&!this.#t.isOpen?this.#t.open(this.target,this,this.label??void 0):!this.open&&this.#t.isOpen&&this.#t.close())}updated(){this.#t.sync(this.renderRoot.querySelector(".comment-pop")),this.open!==this.#t.isOpen&&(this.open=this.#t.isOpen)}render(){return d`<slot></slot>${this.#t.render({locale:this.#a.locale,errorMessage:ko(this.#a.locale).sendFailed,submit:(t,e)=>this.#n(t,e)})}`}#n(t,e){return!this.dispatchEvent(new CustomEvent("dpk-comment-submit",{detail:{target:t,body:e},bubbles:!0,composed:!0,cancelable:!0}))}}const on=()=>{customElements.get("dpk-comment-popover")||customElements.define("dpk-comment-popover",rn)},ln=(n,t)=>{const e=t===null?-1:n.indexOf(t);return e===-1?0:e},vo=(n,t,e)=>{if(e===0)return null;switch(n){case"ArrowRight":case"ArrowDown":return(t+1)%e;case"ArrowLeft":case"ArrowUp":return(t-1+e)%e;case"Home":return 0;case"End":return e-1;default:return null}},xo=":scope > [data-name]";let yo=0;class dn extends A{static{this.shadowRootOptions={...A.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[L,_`
2962
- :host {
2963
- display: block;
2964
- font-size: inherit;
2965
- line-height: inherit;
2966
- color: inherit;
2967
- }
2968
-
2969
- [role='tablist'] {
2970
- position: relative;
2971
- display: flex;
2972
- gap: 2px;
2973
- margin-bottom: 12px;
2974
- padding: 3px;
2975
- width: fit-content;
2976
- max-width: 100%;
2977
- overflow-x: auto;
2978
- border-radius: var(--dpk-radius);
2979
- background: var(--dpk-paper-sunken);
2980
- }
2981
-
2982
- /*
2983
- * The raised chip the reader picked, drawn once and slid between the
2984
- * tabs instead of each tab painting its own: the selection is a thing
2985
- * that moves, so the eye follows it. It is placed by the two custom
2986
- * properties 'updated()' measures off the selected tab, and it is
2987
- * absolutely positioned inside the padding box, which is what
2988
- * 'offsetLeft' counts from too.
2989
- */
2990
- .indicator {
2991
- position: absolute;
2992
- top: 3px;
2993
- left: 0;
2994
- z-index: 0;
2995
- width: var(--dpk-tabs-indicator-w, 0px);
2996
- height: calc(100% - 6px);
2997
- border: 1px solid var(--dpk-rule-strong);
2998
- border-radius: var(--dpk-radius-sm);
2999
- background: var(--dpk-paper-raised);
3000
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
3001
- transform: translateX(var(--dpk-tabs-indicator-x, 0px));
3002
- pointer-events: none;
3003
- transition:
3004
- transform var(--dpk-dur) var(--dpk-ease),
3005
- width var(--dpk-dur) var(--dpk-ease);
3006
- }
3007
-
3008
- /* Before the first measurement there is nothing to slide, and nothing to
3009
- slide it from: the indicator is hidden until the tablist says where. */
3010
- [role='tablist']:not([data-ready]) .indicator {
3011
- opacity: 0;
3012
- transition: none;
3013
- }
3014
-
3015
- [role='tab'] {
3016
- position: relative;
3017
- z-index: 1;
3018
- flex: none;
3019
- padding: 5px 12px;
3020
- border: 1px solid transparent;
3021
- border-radius: var(--dpk-radius-sm);
3022
- background: transparent;
3023
- color: var(--dpk-ink-soft);
3024
- font-size: 12.5px;
3025
- font-weight: 550;
3026
- cursor: pointer;
3027
- transition:
3028
- color var(--dpk-dur-fast) var(--dpk-ease),
3029
- border-color var(--dpk-dur-fast) var(--dpk-ease);
3030
- }
3031
-
3032
- [role='tab']:hover {
3033
- color: var(--dpk-ink);
3034
- }
3035
-
3036
- [role='tab'][aria-selected='true'] {
3037
- color: var(--dpk-ink);
3038
- font-weight: 650;
3039
- }
3040
-
3041
- [role='tab']:focus-visible {
3042
- outline: none;
3043
- box-shadow: var(--dpk-focus);
3044
- }
3045
-
3046
- /*
3047
- * The panel the reader just picked fades in under the strip. A slotted
3048
- * panel that is not the current one is not rendered at all, so its
3049
- * animation starts again when it is assigned back to the slot.
3050
- */
3051
- ::slotted([data-name]) {
3052
- animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease) backwards;
3053
- }
3054
- `]}static{this.properties={selected:{type:String,reflect:!0}}}#a=`dpk-tabs-${++yo}`;#t=new MutationObserver(()=>{this.requestUpdate()});#e=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.#s()):null;constructor(){super(),this.selected=null}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,attributes:!0,attributeFilter:["data-name"]}),this.#e?.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.#e?.disconnect()}get#n(){return[...this.querySelectorAll(xo)]}render(){const t=this.#n,e=t.map(a=>a.dataset.name??""),s=ln(e,this.selected);return d`<div role="tablist" @keydown=${this.#r}>
3055
- <span class="indicator" aria-hidden="true"></span>
3056
- ${U(e,(a,i)=>`${i}:${a}`,(a,i)=>d`<button
3057
- type="button"
3058
- role="tab"
3059
- id="${this.#a}-tab-${i}"
3060
- aria-selected=${i===s?"true":"false"}
3061
- aria-controls="${this.#a}-panel"
3062
- tabindex=${i===s?0:-1}
3063
- @click=${()=>{this.#i(a)}}
3064
- >
3065
- ${t[i]?.dataset.label??a}
3066
- </button>`)}
3067
- </div>
3068
- <div role="tabpanel" id="${this.#a}-panel" aria-labelledby="${this.#a}-tab-${s}">
3069
- <slot></slot>
3070
- </div>`}updated(t){const e=this.#n,s=e.map(i=>i.dataset.name??""),a=e[ln(s,this.selected)];this.renderRoot.querySelector("slot")?.assign(...a===void 0?[]:[a]),this.#s()}#s(){const t=this.renderRoot.querySelector('[role="tablist"]'),e=this.renderRoot.querySelector('[role="tab"][aria-selected="true"]');t===null||e===null||(t.style.setProperty("--dpk-tabs-indicator-x",`${e.offsetLeft}px`),t.style.setProperty("--dpk-tabs-indicator-w",`${e.offsetWidth}px`),!(t.hasAttribute("data-ready")||typeof requestAnimationFrame!="function")&&requestAnimationFrame(()=>{t.setAttribute("data-ready","")}))}#i(t){t!==this.selected&&(this.selected=t,this.dispatchEvent(new CustomEvent("dpk-tab-change",{detail:{name:t},bubbles:!0,composed:!0})))}#r=t=>{const e=[...this.renderRoot.querySelectorAll('[role="tab"]')],s=e.findIndex(r=>r.getAttribute("aria-selected")==="true"),a=vo(t.key,s,e.length);if(a===null)return;t.preventDefault();const i=this.#n[a]?.dataset.name;i!==void 0&&this.#i(i),this.updateComplete.then(()=>{e[a]?.focus()})}}const cn=()=>{customElements.get("dpk-tabs")||customElements.define("dpk-tabs",dn)},wo=D({en:{heading:"Checklist",empty:"No items.",progress:(n,t)=>`${n} / ${t} done`,actionTitle:(n,t)=>`${t?"Checked":"Unchecked"}: ${n}`,unrecorded:"Could not record it. Place this inside a dpk-view-* element.",comment:"Comment",commentOn:n=>`Comment on ${n}`},ja:{heading:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",empty:"\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",progress:(n,t)=>`${n} / ${t} \u5B8C\u4E86`,actionTitle:(n,t)=>`${t?"\u30C1\u30A7\u30C3\u30AF":"\u30C1\u30A7\u30C3\u30AF\u89E3\u9664"}: ${n}`,unrecorded:"\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08dpk-view-* \u8981\u7D20\u306E\u4E2D\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002",comment:"\u30B3\u30E1\u30F3\u30C8",commentOn:n=>`${n} \u306B\u30B3\u30E1\u30F3\u30C8`}}),pn="SET_CHECKED",$o=x({id:y(b(),Wt(/^[A-Za-z0-9_-]+$/)),label:y(b(),S(1)),checked:g(nt()),note:g(b())}),Co=x({items:$($o)}),hn=()=>({items:[]}),un=n=>{const t=B(Co,n),e=new Set;return{items:t.items.map(s=>{if(e.has(s.id))throw new Error(`duplicate item id: ${s.id}`);return e.add(s.id),{id:s.id,label:s.label,checked:s.checked??!1,note:s.note??null,changed:!1}})}},So=jt({checked:nt()}),Eo=(n,t,e)=>{const s=new Map(t.items.map(r=>[r.id,r.checked])),a=new Map(s),i=e.map(r=>{if(r.type!==pn)return{id:r.id,title:r.type,stale:"unsupported-action-type"};const o=Kt(r.target.id),l=o?.[1]==="item"?o[2]:void 0,c=St(So,r.payload);if(l===void 0||!a.has(l)||!c.success)return{id:r.id,title:n.actionTitle(l??r.target.id,!0),stale:"target-missing"};a.set(l,c.output.checked);const p=t.items.find(m=>m.id===l)?.label??l;return{id:r.id,title:n.actionTitle(p,c.output.checked),tone:"update"}});return{data:{items:t.items.map(r=>{const o=a.get(r.id)??r.checked;return{...r,checked:o,changed:o!==s.get(r.id)}})},results:i}},To=n=>({done:n.items.filter(t=>t.checked).length,total:n.items.length});class mn extends A{static{this.styles=[L,_`
3071
- :host {
3072
- display: block;
3073
- color: var(--dpk-ink);
3074
- }
3075
-
3076
- .card {
3077
- border: 1px solid var(--dpk-rule);
3078
- border-radius: var(--dpk-radius-lg);
3079
- background: var(--dpk-paper-raised);
3080
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
3081
- padding: 14px 16px 12px;
3082
- }
3083
-
3084
- .head {
3085
- display: flex;
3086
- align-items: baseline;
3087
- justify-content: space-between;
3088
- gap: 12px;
3089
- }
3090
-
3091
- .heading {
3092
- font-family: var(--dpk-display);
3093
- font-size: 15px;
3094
- font-weight: 650;
3095
- letter-spacing: -0.01em;
3096
- }
3097
-
3098
- .count {
3099
- font-family: var(--dpk-mono);
3100
- font-size: 12.5px;
3101
- font-variant-numeric: tabular-nums;
3102
- }
3103
-
3104
- .count-done {
3105
- color: var(--dpk-ink);
3106
- font-weight: 650;
3107
- }
3108
-
3109
- .count-total {
3110
- color: var(--dpk-ink-soft);
3111
- }
3112
-
3113
- .track {
3114
- height: 6px;
3115
- margin: 10px 0 14px;
3116
- border-radius: 999px;
3117
- background: var(--dpk-paper-sunken);
3118
- overflow: hidden;
3119
- }
3120
-
3121
- .fill {
3122
- height: 100%;
3123
- border-radius: 999px;
3124
- background: var(--dpk-accent);
3125
- transition: width 0.3s var(--dpk-ease);
3126
- }
3127
-
3128
- ul {
3129
- display: grid;
3130
- gap: 2px;
3131
- margin: 0;
3132
- padding: 0;
3133
- list-style: none;
3134
- }
3135
-
3136
- li {
3137
- display: grid;
3138
- grid-template-columns: auto 1fr auto;
3139
- align-items: center;
3140
- gap: 10px;
3141
- min-height: 36px;
3142
- padding: 2px 8px;
3143
- border-radius: var(--dpk-radius-sm);
3144
- }
3145
-
3146
- li:hover,
3147
- li:focus-within,
3148
- li:active {
3149
- background: var(--dpk-paper-sunken);
3150
- }
3151
-
3152
- li[data-changed] {
3153
- background: color-mix(in srgb, var(--dpk-blue-soft) 60%, transparent);
3154
- }
3155
-
3156
- .check {
3157
- position: relative;
3158
- display: inline-grid;
3159
- place-items: center;
3160
- width: 20px;
3161
- height: 20px;
3162
- }
3163
-
3164
- .check-input {
3165
- position: absolute;
3166
- inset: 0;
3167
- margin: 0;
3168
- opacity: 0;
3169
- cursor: pointer;
3170
- }
3171
-
3172
- .check-mark {
3173
- display: inline-grid;
3174
- place-items: center;
3175
- width: 20px;
3176
- height: 20px;
3177
- border: 2px solid var(--dpk-rule-strong);
3178
- border-radius: 50%;
3179
- background: transparent;
3180
- color: var(--dpk-accent-ink);
3181
- pointer-events: none;
3182
- transition:
3183
- background 0.15s var(--dpk-ease),
3184
- border-color 0.15s var(--dpk-ease);
3185
- }
3186
-
3187
- .check-mark svg {
3188
- width: 12px;
3189
- height: 12px;
3190
- opacity: 0;
3191
- transform: scale(0.5);
3192
- transition:
3193
- opacity 0.15s var(--dpk-ease),
3194
- transform 0.15s var(--dpk-ease-spring);
3195
- }
3196
-
3197
- .check-input:checked ~ .check-mark {
3198
- border-color: var(--dpk-accent);
3199
- background: var(--dpk-accent);
3200
- }
3201
-
3202
- .check-input:checked ~ .check-mark svg {
3203
- opacity: 1;
3204
- transform: scale(1);
3205
- }
3206
-
3207
- .check-input:focus-visible ~ .check-mark {
3208
- box-shadow: var(--dpk-focus);
3209
- }
3210
-
3211
- label {
3212
- display: grid;
3213
- gap: 2px;
3214
- cursor: pointer;
3215
- }
3216
-
3217
- [data-checked] .label {
3218
- color: var(--dpk-ink-soft);
3219
- text-decoration: line-through;
3220
- }
3221
-
3222
- .note {
3223
- color: var(--dpk-ink-soft);
3224
- font-size: 12px;
3225
- }
3226
-
3227
- .comment {
3228
- display: inline-grid;
3229
- place-items: center;
3230
- width: 24px;
3231
- height: 24px;
3232
- padding: 0;
3233
- border: 0;
3234
- border-radius: var(--dpk-radius-sm);
3235
- background: transparent;
3236
- color: var(--dpk-ink-soft);
3237
- opacity: 0;
3238
- cursor: pointer;
3239
- }
3240
-
3241
- li:hover .comment,
3242
- li:focus-within .comment {
3243
- opacity: 1;
3244
- }
3245
-
3246
- .comment:hover {
3247
- color: var(--dpk-blue);
3248
- }
3249
-
3250
- .comment:focus-visible {
3251
- outline: none;
3252
- box-shadow: var(--dpk-focus);
3253
- }
3254
-
3255
- .comment svg {
3256
- width: 14px;
3257
- height: 14px;
3258
- }
3259
-
3260
- .error,
3261
- .empty {
3262
- color: var(--dpk-ink-soft);
3263
- font-size: 13px;
3264
- }
3265
-
3266
- .error {
3267
- color: var(--dpk-danger);
3268
- }
3269
- `]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new O(this);#t=null;#e=null;#n=null;#s=hn();#i=[];#r=[];#o=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=X(this,un,t=>{t.ok?(this.#e=t.value,this.#n=null):(this.#e=null,this.#n=t.error),this.#m(),this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0}))})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}get commentTargets(){if(!this.id)return[];const t=`${this.#c} \xB7 ${this.id}`;return this.#s.items.map(e=>({value:this.#d(e.id),label:e.label,group:t}))}get elementActions(){return this.#i}set elementActions(t){this.#i=t,this.#m()}get elementActionResults(){return this.#r}render(){const t=this.#l;if(this.#n!==null)return d`<p class="error">${this.#n}</p>`;const e=To(this.#s),s=e.total===0?0:e.done/e.total,a=t.progress(e.done,e.total);return d`<div class="card">
3270
- <div class="head">
3271
- <span class="heading">${this.#c}</span>
3272
- <span class="count" aria-label=${a}
3273
- ><span class="count-done">${e.done}</span><span class="count-total">/${e.total}</span></span
3274
- >
3275
- </div>
3276
- <div
3277
- class="track"
3278
- role="progressbar"
3279
- aria-valuemin="0"
3280
- aria-valuemax=${e.total}
3281
- aria-valuenow=${e.done}
3282
- aria-valuetext=${a}
3283
- >
3284
- <div class="fill" style=${`width: ${s*100}%`}></div>
3285
- </div>
3286
- ${this.#s.items.length===0?d`<p class="empty">${t.empty}</p>`:d`<ul>
3287
- ${U(this.#s.items,i=>i.id,i=>this.#p(t,i))}
3288
- </ul>`}
3289
- </div>`}get#l(){return wo(this.#a.locale)}get#c(){return this.heading??this.#l.heading}#p(t,e){const s=`item-${e.id}`;return d`<li ?data-checked=${e.checked} ?data-changed=${e.changed}>
3290
- <span class="check">
3291
- <input
3292
- id=${s}
3293
- class="check-input"
3294
- type="checkbox"
3295
- .checked=${e.checked}
3296
- @change=${a=>{a.currentTarget instanceof HTMLInputElement&&this.#g(e,a.currentTarget.checked)}}
3297
- />
3298
- <span class="check-mark">${Ct()}</span>
3299
- </span>
3300
- <label for=${s}>
3301
- <span class="label">${e.label}</span>
3302
- ${e.note===null?h:d`<span class="note">${e.note}</span>`}
3303
- ${this.#o===e.id?d`<span class="error">${t.unrecorded}</span>`:h}
3304
- </label>
3305
- ${this.id?d`<button
3306
- class="comment"
3307
- type="button"
3308
- aria-label=${t.commentOn(e.label)}
3309
- title=${t.commentOn(e.label)}
3310
- @click=${()=>{this.#u(e.id)}}
3311
- >
3312
- ${$t()}
3313
- </button>`:h}
3314
- </li>`}#g(t,e){const s=new CustomEvent("dpk-element-action",{detail:{type:pn,target:this.#d(t.id),payload:{checked:e}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),this.#o=s.defaultPrevented?null:t.id,this.requestUpdate()}#u(t){this.dispatchEvent(new CustomEvent("dpk-comment-request",{detail:{target:this.#d(t)},bubbles:!0,composed:!0}))}#d(t){return`element:${encodeURIComponent(this.id)}/item/${encodeURIComponent(t)}`}#m(){if(this.#e===null)this.#s=hn(),this.#r=this.#i.map(t=>({id:t.id,title:t.type,stale:"target-missing"}));else{const t=Eo(this.#l,this.#e,this.#i);this.#s=t.data,this.#r=t.results}this.requestUpdate()}}const gn=()=>{customElements.get("dpk-checklist")||customElements.define("dpk-checklist",mn)},fn=D({en:{copy:"Copy",copied:"Copied",copyFailed:"Copy failed",copyLabel:n=>`Copy ${n}`,code:"code"},ja:{copy:"\u30B3\u30D4\u30FC",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",copyFailed:"\u30B3\u30D4\u30FC\u5931\u6557",copyLabel:n=>`${n} \u3092\u30B3\u30D4\u30FC`,code:"\u30B3\u30FC\u30C9"}}),bn=_`
3315
- :host {
3316
- display: block;
3317
- overflow: hidden;
3318
- border: 1px solid var(--dpk-rule-strong);
3319
- border-radius: var(--dpk-radius);
3320
- background: var(--dpk-paper-sunken);
3321
- }
3322
-
3323
- .bar {
3324
- display: flex;
3325
- align-items: center;
3326
- gap: 8px;
3327
- min-height: 34px;
3328
- padding: 0 6px 0 12px;
3329
- border-bottom: 1px solid var(--dpk-rule);
3330
- color: var(--dpk-ink-soft);
3331
- font-family: var(--dpk-font-mono);
3332
- font-size: 12px;
3333
- }
3334
-
3335
- .name {
3336
- flex: 1;
3337
- overflow: hidden;
3338
- text-overflow: ellipsis;
3339
- white-space: nowrap;
3340
- }
3341
-
3342
- .language {
3343
- color: var(--dpk-ink-faint);
3344
- }
3345
-
3346
- button {
3347
- display: inline-flex;
3348
- align-items: center;
3349
- gap: 5px;
3350
- height: 24px;
3351
- padding: 0 8px;
3352
- border: 0;
3353
- border-radius: var(--dpk-radius-sm);
3354
- background: transparent;
3355
- color: inherit;
3356
- font: inherit;
3357
- cursor: pointer;
3358
- }
3359
-
3360
- button:hover {
3361
- background: var(--dpk-paper-inset);
3362
- color: var(--dpk-ink);
3363
- }
3364
-
3365
- button:focus-visible {
3366
- outline: none;
3367
- box-shadow: var(--dpk-focus);
3368
- }
3369
-
3370
- button[data-state='copied'] {
3371
- color: var(--dpk-green);
3372
- }
3373
-
3374
- button[data-state='failed'] {
3375
- color: var(--dpk-danger);
3376
- }
3377
-
3378
- button svg {
3379
- width: 13px;
3380
- height: 13px;
3381
- }
3382
-
3383
- pre {
3384
- margin: 0;
3385
- padding: 12px 14px;
3386
- overflow: auto;
3387
- max-height: var(--dpk-code-max-height, 480px);
3388
- color: var(--dpk-ink);
3389
- font-family: var(--dpk-font-mono);
3390
- font-size: 12.5px;
3391
- line-height: 1.6;
3392
- tab-size: 2;
3393
- }
3394
-
3395
- .comment {
3396
- color: var(--dpk-code-comment, var(--dpk-ink-faint));
3397
- font-style: italic;
3398
- }
3399
-
3400
- .string {
3401
- color: var(--dpk-code-string, var(--dpk-green));
3402
- }
3403
-
3404
- .number {
3405
- color: var(--dpk-code-number, var(--dpk-amber));
3406
- }
3407
-
3408
- .keyword {
3409
- color: var(--dpk-code-keyword, var(--dpk-violet));
3410
- }
3411
-
3412
- .function {
3413
- color: var(--dpk-code-function, var(--dpk-blue));
3414
- }
3415
-
3416
- .tag {
3417
- color: var(--dpk-code-tag, var(--dpk-accent-strong));
3418
- }
3419
-
3420
- .attr {
3421
- color: var(--dpk-code-attr, var(--dpk-blue));
3422
- }
3423
-
3424
- .property {
3425
- color: var(--dpk-code-property, var(--dpk-blue));
3426
- }
3427
-
3428
- .punct {
3429
- color: var(--dpk-code-punct, var(--dpk-ink-soft));
3430
- }
3431
- `,Mo='script[type="text/plain"]';class kn extends A{static{this.styles=[L,bn]}static{this.properties={filename:{type:String},language:{type:String},code:{type:String}}}#a=new O(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e="idle";#n;constructor(){super(),this.filename=null,this.language=null,this.code=""}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),clearTimeout(this.#n)}get text(){const t=this.querySelector(Mo)?.textContent??this.textContent??"";return ce(t.trim()===""?this.code:t)}render(){const t=this.#i,e=this.filename??t.code,s=this.#e==="copied"?t.copied:this.#e==="failed"?t.copyFailed:t.copy;return d`<div class="bar">
3432
- <span class="name">${e}</span>
3433
- ${this.language?d`<span class="language">${this.language}</span>`:h}
3434
- <button type="button" data-state=${this.#e} aria-label=${t.copyLabel(e)} @click=${this.#r}>
3435
- ${this.#e==="copied"?Ct():Me()}<span aria-live="polite">${s}</span>
3436
- </button>
3437
- </div>
3438
- <pre><code>${this.#s()}</code></pre>`}#s(){return se(this.text,this.language).map(t=>t.kind===null?t.text:d`<span class=${t.kind}>${t.text}</span>`)}get#i(){return fn(this.#a.locale)}#r=async()=>{const t=await Nt(this.text);this.#e=t?"copied":"failed",this.requestUpdate(),clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#e="idle",this.requestUpdate()},1600)}}const ce=n=>{const t=n.replace(/^\s*\n/,"").replace(/\n\s*$/,"").split(`
3439
- `),e=t.filter(a=>a.trim()!=="").map(a=>/^[ \t]*/.exec(a)?.[0].length??0),s=e.length===0?0:Math.min(...e);return t.map(a=>a.slice(s)).join(`
3440
- `)},vn=()=>{customElements.get("dpk-code")||customElements.define("dpk-code",kn)},Ao=D({en:{empty:"No code variants",invalid:n=>`Invalid code group: ${n}`},ja:{empty:"\u30B3\u30FC\u30C9\u306E\u30D0\u30EA\u30A8\u30FC\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093",invalid:n=>`\u30B3\u30FC\u30C9\u30B0\u30EB\u30FC\u30D7\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: ${n}`}}),zo=x({label:y(b(),S(1)),language:g(b(),""),code:y(b(),S(1))}),_o=x({label:g(b(),""),variants:y($(zo),S(1))}),Ot=n=>{const t=B(_o,n),e=new Set;for(const s of t.variants){if(e.has(s.label))throw new Error(`duplicate variant label: ${s.label}`);e.add(s.label)}return t},Lo=_`
3441
- :host {
3442
- min-width: 0;
3443
- }
3444
-
3445
- .bar {
3446
- padding-left: 10px;
3447
- }
3448
-
3449
- .name {
3450
- flex: 0 1 auto;
3451
- max-width: 45%;
3452
- }
3453
-
3454
- .tabs {
3455
- display: flex;
3456
- flex: 1;
3457
- gap: 1px;
3458
- min-width: 0;
3459
- overflow-x: auto;
3460
- scrollbar-width: none;
3461
- }
3462
-
3463
- .tabs::-webkit-scrollbar {
3464
- display: none;
3465
- }
3466
-
3467
- .tabs button {
3468
- height: 26px;
3469
- padding: 0 8px;
3470
- border-radius: 6px 6px 0 0;
3471
- color: var(--dpk-ink-faint);
3472
- font-size: 11.5px;
3473
- font-weight: 600;
3474
- white-space: nowrap;
3475
- }
3476
-
3477
- .tabs button:hover {
3478
- background: var(--dpk-paper-inset);
3479
- color: var(--dpk-ink);
3480
- }
3481
-
3482
- .tabs button[aria-selected='true'] {
3483
- background: var(--dpk-paper-raised);
3484
- box-shadow: inset 0 -2px 0 var(--dpk-accent);
3485
- color: var(--dpk-ink);
3486
- }
3487
-
3488
- .tabs button:focus-visible {
3489
- outline: none;
3490
- box-shadow: var(--dpk-focus);
3491
- }
3492
-
3493
- pre[hidden] {
3494
- display: none;
3495
- }
3496
-
3497
- .empty {
3498
- margin: 0;
3499
- padding: 12px 14px;
3500
- color: var(--dpk-ink-faint);
3501
- font-family: var(--dpk-font-mono);
3502
- font-size: 12px;
3503
- }
3504
-
3505
- @media (max-width: 520px) {
3506
- .name {
3507
- display: none;
3508
- }
3509
- }
3510
- `;class xn extends A{static{this.styles=[L,bn,Lo]}static{this.properties={data:{attribute:!1}}}#a=new O(this);#t=null;#e=null;#n=0;#s="idle";#i;#r=null;constructor(){super(),this.data=null}connectedCallback(){super.connectedCallback(),this.#r=X(this,Ot,t=>{this.#n=0,t.ok?this.data=t.value:(this.#t=null,this.#e=t.error,this.requestUpdate())}),queueMicrotask(()=>{if(this.#t!==null||this.#e!==null)return;const t=da(this,Ot);t!==null&&(this.#r?.(),this.#r=null,this.#n=0,t.ok?this.data=t.value:(this.#t=null,this.#e=t.error,this.requestUpdate()))})}disconnectedCallback(){super.disconnectedCallback(),this.#r?.(),this.#r=null,clearTimeout(this.#i)}willUpdate(t){if(t.has("data")){if(this.data===null){this.#t=null;return}try{this.#t=Ot(this.data),this.#e=null,this.#n=0}catch(e){this.#t=null,this.#e=e instanceof Error?e.message:String(e)}}}render(){const t=fn(this.#a.locale),e=Ao(this.#a.locale),s=this.#t;if(this.#e!==null)return this.#o(t.code,d`<p class="empty">${e.invalid(this.#e)}</p>`);if(s===null||s.variants.length===0)return this.#o(t.code,d`<p class="empty">${e.empty}</p>`);const a=Math.min(this.#n,s.variants.length-1),i=s.label===""?t.code:s.label,r=this.#s==="copied"?t.copied:this.#s==="failed"?t.copyFailed:t.copy;return d`<div class="bar">
3511
- ${s.label===""?h:d`<span class="name">${s.label}</span>`}
3512
- <div class="tabs" role="tablist" aria-label=${i}>
3513
- ${s.variants.map((o,l)=>d`<button
3514
- type="button"
3515
- role="tab"
3516
- id="code-group-tab-${l}"
3517
- aria-controls="code-group-panel-${l}"
3518
- aria-selected=${l===a}
3519
- tabindex=${l===a?0:-1}
3520
- @click=${()=>this.#l(l)}
3521
- @keydown=${c=>this.#c(c,l)}
3522
- >
3523
- ${o.label}
3524
- </button>`)}
3525
- </div>
3526
- <button
3527
- type="button"
3528
- data-state=${this.#s}
3529
- aria-label=${t.copyLabel(i)}
3530
- @click=${()=>this.#g()}
3531
- >
3532
- ${this.#s==="copied"?Ct():Me()}<span aria-live="polite">${r}</span>
3533
- </button>
3534
- </div>
3535
- ${s.variants.map((o,l)=>d`<pre
3536
- role="tabpanel"
3537
- id="code-group-panel-${l}"
3538
- aria-labelledby="code-group-tab-${l}"
3539
- ?hidden=${l!==a}
3540
- ><code>${this.#p(o)}</code></pre>`)}`}#o(t,e){return d`<div class="bar"><span class="name">${t}</span></div>
3541
- ${e}`}#l(t){this.#t!==null&&(this.#n=Math.max(0,Math.min(t,this.#t.variants.length-1)),this.#s="idle",this.requestUpdate())}#c(t,e){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const s=this.#t?.variants.length??0;if(s===0)return;t.preventDefault();const a=(e+(t.key==="ArrowRight"?1:-1)+s)%s;this.#l(a),this.renderRoot.querySelectorAll('[role="tab"]')[a]?.focus()}#p(t){const e=t.language===""?null:t.language;return se(ce(t.code),e).map(s=>s.kind===null?s.text:d`<span class=${s.kind}>${s.text}</span>`)}async#g(){const t=this.#t;if(t===null)return;const e=Math.min(this.#n,t.variants.length-1),s=t.variants[e];if(s===void 0)return;const a=await Nt(ce(s.code));this.#s=a?"copied":"failed",this.requestUpdate(),clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#s="idle",this.requestUpdate()},1600)}}const yn=()=>{customElements.get("dpk-code-group")||customElements.define("dpk-code-group",xn)},Po=D({en:{back:"Back",forward:"Forward",reload:"Reload",address:"Address",tabs:"Tabs",newTab:"New tab",closeTab:"Close tab",profile:n=>`Profile: ${n}`,guest:"Guest",shortcuts:"Pages of this site",unreachableTitle:"This site can\u2019t be reached",unreachableBody:"No page here has this address."},ja:{back:"\u623B\u308B",forward:"\u9032\u3080",reload:"\u518D\u8AAD\u307F\u8FBC\u307F",address:"\u30A2\u30C9\u30EC\u30B9",tabs:"\u30BF\u30D6",newTab:"\u65B0\u3057\u3044\u30BF\u30D6",closeTab:"\u30BF\u30D6\u3092\u9589\u3058\u308B",profile:n=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${n}`,guest:"\u30B2\u30B9\u30C8",shortcuts:"\u3053\u306E\u30B5\u30A4\u30C8\u306E\u30DA\u30FC\u30B8",unreachableTitle:"\u3053\u306E\u30B5\u30A4\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093",unreachableBody:"\u3053\u306E\u30A2\u30C9\u30EC\u30B9\u306E\u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}}),It=(n,t,e)=>{const s=Ne(t,e);if(s===null)return;const a=je(s);return n.find(i=>{const r=Ne(i.url,e);return r!==null&&je(r)===a})},Ro=(n,t,e)=>t===void 0||t.kind==="new-tab"?e:t.kind==="unreachable"?Fe(t.url):It(n,t.page.url,t.page.url)?.title??Fe(t.page.url),wn=n=>n===void 0||n.kind==="new-tab"?"":n.kind==="unreachable"?n.url:n.page.url,Do=(n,t,e,s)=>{const a=ka(t),i=a.history[a.index];return{tabs:t.tabs.map(r=>{const o=r.history[r.index];return{id:r.id,title:Ro(n,o,e),url:wn(o),active:r.id===a.id}}),entry:i,url:wn(i),canBack:xa(t),canForward:va(t),...s===null||s===""?{}:{profile:s}}},Oo=n=>n.map(t=>({title:t.title,url:t.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").replace(/\/$/,""),href:t.url,page:{url:t.url}})),Io=":scope > [data-url]",qo=360,$n="https://page.example.com/";class Cn extends A{static{this.shadowRootOptions={...A.shadowRootOptions,slotAssignment:"manual"}}static{this.styles=[L,ya,_`
3542
- :host {
3543
- display: block;
3544
- height: var(--dpk-browser-height, 460px);
3545
- min-height: 240px;
3546
- color: var(--dpk-ink);
3547
- font-family: var(--dpk-body);
3548
- }
3549
-
3550
- :host([viewport='mobile']) {
3551
- max-width: var(--dpk-browser-phone-width, 390px);
3552
- height: var(--dpk-browser-height, 720px);
3553
- }
3554
-
3555
- .browser {
3556
- box-sizing: border-box;
3557
- height: 100%;
3558
- border: 1px solid var(--dpk-rule);
3559
- border-radius: var(--dpk-radius-lg);
3560
- background: var(--dpk-paper-raised);
3561
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
3562
- overflow: hidden;
3563
- }
3564
-
3565
- /* The page is the product's own light surface, and scrolls under the chrome. */
3566
- .browser-page {
3567
- position: relative;
3568
- display: flex;
3569
- flex: 1 1 auto;
3570
- flex-direction: column;
3571
- min-height: 0;
3572
- overflow: auto;
3573
- color-scheme: light;
3574
- background: #fff;
3575
- color: #1f2430;
3576
- }
3577
-
3578
- ::slotted(*) {
3579
- flex: 1 0 auto;
3580
- }
3581
- `]}static{this.properties={url:{type:String},viewport:{type:String,reflect:!0},profile:{type:String}}}#a=new O(this);#t=new MutationObserver(()=>{this.requestUpdate()});#e=null;#n=!1;#s=null;#i=!1;#r=null;constructor(){super(),this.url=null,this.viewport="desktop",this.profile=null}connectedCallback(){super.connectedCallback(),this.#t.observe(this,{childList:!0,attributes:!0,attributeFilter:["data-url","data-title"]}),this.addEventListener("click",this.#k),this.addEventListener("auxclick",this.#k)}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.removeEventListener("click",this.#k),this.removeEventListener("auxclick",this.#k),this.#s!==null&&clearTimeout(this.#s),this.#s=null}get#o(){return Po(this.#a.locale)}get#l(){return this.viewport==="mobile"}get#c(){return[...this.querySelectorAll(Io)]}get#p(){return this.#c.map(t=>{const e=t.dataset.url??"",s=t.querySelector("h1, h2, h3")?.textContent?.trim();return{url:e,title:t.dataset.title??(s||e)}})}get#g(){const t=this.#e===null?void 0:Bt(this.#e);return t?.kind==="page"?t.page.url:this.#p[0]?.url??$n}#u(t){if(t?.kind!=="page")return;const e=It(this.#p,t.page.url,t.page.url);return e===void 0?void 0:this.#c.find(s=>s.dataset.url===e.url)}willUpdate(t){if(this.#e===null){const e=this.#p,s=(this.url===null?void 0:It(e,this.url,$n))??e[0];s!==void 0&&(this.#e=wa({url:s.url}));return}t.has("url")&&this.url!==null&&this.#b(this.url,!1)}render(){const t=this.#e;if(t===null)return d`<slot hidden></slot>`;const e=this.#o,s=this.#p,a=Do(s,t,e.newTab,this.profile),i={view:a,phone:this.#l,switcher:this.#n,shortcuts:a.entry?.kind==="new-tab"?Oo(s):[],labels:e,send:o=>{this.#m(o)}},r=this.#u(a.entry);return d`<div
3582
- class="browser"
3583
- data-viewport=${this.#l?"mobile":"desktop"}
3584
- ?data-loading=${this.#s!==null}
3585
- >
3586
- ${$a(i)}
3587
- <div class="browser-page">
3588
- ${Ca(i,r===void 0?void 0:d`<slot></slot>`)}
3589
- </div>
3590
- ${Sa(i)}
3591
- </div>`}updated(){const t=this.#e===null?void 0:Bt(this.#e),e=this.#u(t);this.renderRoot.querySelector("slot")?.assign(...e===void 0?[]:[e]),this.#i&&(this.#i=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus());const s=t===void 0||t.kind==="new-tab"?"":t.kind==="page"?t.page.url:t.url;if(s===this.#r)return;const a=this.#r===null;this.#r=s,a||this.dispatchEvent(new CustomEvent("dpk-browser-navigate",{detail:{url:s},bubbles:!0,composed:!0}))}#d(t){if(this.#e===null)return;const e=Ea(this.#e,t);e!==this.#e&&(this.#e=e,this.#f(),this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate())}#m(t){switch(t.kind){case"reload":this.#x();return;case"address":this.#b(t.input,!1);return;case"back":case"forward":case"new-tab":this.#n=!1,this.#d({kind:t.kind}),this.requestUpdate();return;case"switcher":this.#n=t.open,this.requestUpdate();return;case"activate":this.#n=!1,this.#i=t.focus===!0,this.#d({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#d({kind:"close-tab",id:t.id});return;case"visit":this.#d({kind:"visit",page:t.page});return;default:return}}#b(t,e){const s=this.#g,a=It(this.#p,t,s),i=a===void 0?{kind:"unreachable",url:Ta(t,s)}:{kind:"page",page:{url:a.url}};e!==!1?this.#d({kind:"open-tab",entry:i,background:e.background}):i.kind==="page"?this.#d({kind:"visit",page:i.page}):this.#d({kind:"unreachable",url:i.url})}#x(){if(this.#s!==null||this.#e===null)return;const t=this.#u(Bt(this.#e));this.#s=setTimeout(()=>{if(this.#s=null,t!==void 0){for(const e of t.querySelectorAll("form"))e.reset();for(const e of t.querySelectorAll("dialog"))e.close();t.scrollTop=0,t.dispatchEvent(new CustomEvent("dpk-reload",{bubbles:!0}))}this.renderRoot.querySelector(".browser-page")?.scrollTo?.({top:0}),this.requestUpdate()},qo),this.requestUpdate()}#f(){this.#s!==null&&(clearTimeout(this.#s),this.#s=null)}#k=t=>{if(t.defaultPrevented||this.#e===null||t.type==="auxclick"&&t.button!==1)return;const e=t.composedPath().find(o=>o instanceof HTMLAnchorElement&&this.contains(o)),s=e?.getAttribute("href");if(e===void 0||s===null||s===void 0||s.startsWith("#"))return;t.preventDefault();const a=t.metaKey||t.ctrlKey||t.button===1,i=e.target==="_blank",r=new URL(s,this.#g).href;this.#b(r,i||a?{background:a}:!1)}}const Sn=()=>{customElements.get("dpk-browser")||customElements.define("dpk-browser",Cn)},Uo=D({en:{listLabel:"Options",empty:"No matches.",selectedCount:n=>`${n} selected`,moveLabel:"to move",toggleLabel:"to toggle",removeChip:n=>`Remove ${n}`},ja:{listLabel:"\u5019\u88DC",empty:"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093\u3002",selectedCount:n=>`${n} \u4EF6\u9078\u629E`,moveLabel:"\u3067\u79FB\u52D5",toggleLabel:"\u3067\u5207\u308A\u66FF\u3048",removeChip:n=>`${n} \u3092\u524A\u9664`}}),No=x({value:y(b(),S(1)),label:y(b(),S(1)),description:g(b()),group:g(b()),avatar:g(b())}),jo=x({options:$(No),value:g(Le([b(),$(b())]))}),En=n=>typeof n=="string"?n===""?[]:[n]:Array.isArray(n)?n.filter(t=>typeof t=="string"&&t!==""):[],Tn=n=>{const t=B(jo,n),e=new Set;return{options:t.options.map(a=>{if(e.has(a.value))throw new Error(`duplicate option value: ${a.value}`);return e.add(a.value),{value:a.value,label:a.label,description:a.description??null,group:a.group??null,avatar:a.avatar??null}}),value:t.value===void 0?null:En(t.value)}},pe=(n,t)=>{const e=t.trim().toLowerCase();return e===""?n:n.filter(s=>s.label.toLowerCase().includes(e)||(s.description?.toLowerCase().includes(e)??!1))},Fo=n=>{const t=[],e=new Map;for(const s of n){let a=e.get(s.group);a===void 0&&(a=[],e.set(s.group,a),t.push(s.group)),a.push(s)}return t.map(s=>({group:s,options:e.get(s)??[]}))},he=(n,t)=>t===0?-1:Math.min(Math.max(n,0),t-1),Ho=(n,t,e)=>e===0?-1:n<0?t>0?0:e-1:(n+t+e)%e,Wo=(n,t,e)=>e?n.includes(t)?n.filter(s=>s!==t):[...n,t]:[t],Bo=(n,t)=>n.filter(e=>e!==t),Ko=(n,t)=>n.includes(t),Vo=(n,t)=>n.length===t.length&&n.every((e,s)=>e===t[s]),Go=(n,t)=>t.flatMap(e=>{const s=n.find(a=>a.value===e);return s?[s]:[]}),Jo=(n,t)=>{const e=t[0];return e===void 0?null:n.find(s=>s.value===e)?.label??null},Mn=n=>{const t=n.trim().split(/\s+/).filter(Boolean),e=t[0]?.[0]??"",s=t.length>1?t[t.length-1]?.[0]??"":"";return`${e}${s}`.toUpperCase()},An=["blue","green","amber","violet","accent","danger"],zn=n=>{let t=0;for(let e=0;e<n.length;e+=1)t=t*31+n.charCodeAt(e)|0;return An[Math.abs(t)%An.length]??"blue"};let Xo=0;const Yo=".combo-control, .combo-listbox";class _n extends A{static{this.styles=[L,_`
3592
- :host {
3593
- display: block;
3594
- }
3595
-
3596
- .field {
3597
- display: flex;
3598
- flex-direction: column;
3599
- gap: 6px;
3600
- }
3601
-
3602
- .field-label {
3603
- font-size: 11.5px;
3604
- font-weight: 600;
3605
- color: var(--dpk-ink-soft);
3606
- }
3607
-
3608
- .combo-control {
3609
- box-sizing: border-box;
3610
- display: flex;
3611
- flex-wrap: wrap;
3612
- align-items: center;
3613
- gap: 5px;
3614
- min-height: var(--dpk-control-h);
3615
- padding: 4px 6px 4px 10px;
3616
- border: 1px solid var(--dpk-rule-strong);
3617
- border-radius: var(--dpk-radius-sm);
3618
- background: var(--dpk-paper-raised);
3619
- box-shadow: inset 0 1px 2px var(--dpk-shade-1);
3620
- cursor: text;
3621
- transition:
3622
- border-color 160ms var(--dpk-ease),
3623
- box-shadow 160ms var(--dpk-ease);
3624
- }
3625
-
3626
- .combo-control:focus-within {
3627
- border-color: var(--dpk-blue);
3628
- box-shadow: var(--dpk-focus);
3629
- }
3630
-
3631
- .input {
3632
- flex: 1 1 80px;
3633
- min-width: 60px;
3634
- margin: 2px 0;
3635
- border: 0;
3636
- background: transparent;
3637
- color: var(--dpk-ink);
3638
- font: inherit;
3639
- font-size: 12.5px;
3640
- outline: none;
3641
- }
3642
-
3643
- .input::placeholder {
3644
- color: var(--dpk-ink-faint);
3645
- }
3646
-
3647
- .chevron {
3648
- flex: none;
3649
- display: inline-flex;
3650
- align-items: center;
3651
- justify-content: center;
3652
- width: 22px;
3653
- height: 22px;
3654
- border: 0;
3655
- border-radius: var(--dpk-radius-xs);
3656
- background: transparent;
3657
- color: var(--dpk-ink-faint);
3658
- cursor: pointer;
3659
- transition: transform 160ms var(--dpk-ease);
3660
- }
3661
-
3662
- .chevron:hover {
3663
- color: var(--dpk-ink);
3664
- }
3665
-
3666
- .chevron[data-open='true'] {
3667
- transform: rotate(180deg);
3668
- }
3669
-
3670
- .chevron svg {
3671
- display: block;
3672
- width: 14px;
3673
- height: 14px;
3674
- }
3675
-
3676
- .chip {
3677
- display: inline-flex;
3678
- align-items: center;
3679
- gap: 5px;
3680
- padding: 2px 6px 2px 2px;
3681
- border-radius: 999px;
3682
- background: var(--dpk-paper-inset);
3683
- color: var(--dpk-ink);
3684
- font-size: 11.5px;
3685
- line-height: 1.4;
3686
- }
3687
-
3688
- .chip .avatar {
3689
- width: 16px;
3690
- height: 16px;
3691
- font-size: 8px;
3692
- }
3693
-
3694
- .chip-remove {
3695
- display: inline-flex;
3696
- align-items: center;
3697
- justify-content: center;
3698
- width: 14px;
3699
- height: 14px;
3700
- padding: 0;
3701
- border: 0;
3702
- border-radius: 999px;
3703
- background: transparent;
3704
- color: var(--dpk-ink-faint);
3705
- cursor: pointer;
3706
- }
3707
-
3708
- .chip-remove:hover {
3709
- color: var(--dpk-danger);
3710
- }
3711
-
3712
- .chip-remove svg {
3713
- display: block;
3714
- width: 10px;
3715
- height: 10px;
3716
- }
3717
-
3718
- .avatar {
3719
- flex: none;
3720
- display: inline-flex;
3721
- align-items: center;
3722
- justify-content: center;
3723
- width: 22px;
3724
- height: 22px;
3725
- border-radius: 999px;
3726
- font-family: var(--dpk-mono);
3727
- font-size: 9.5px;
3728
- font-weight: 650;
3729
- }
3730
-
3731
- .avatar[data-tone='blue'] {
3732
- background: var(--dpk-blue-soft);
3733
- color: var(--dpk-blue);
3734
- }
3735
-
3736
- .avatar[data-tone='green'] {
3737
- background: var(--dpk-green-soft);
3738
- color: var(--dpk-green);
3739
- }
3740
-
3741
- .avatar[data-tone='amber'] {
3742
- background: var(--dpk-amber-soft);
3743
- color: var(--dpk-amber);
3744
- }
3745
-
3746
- .avatar[data-tone='violet'] {
3747
- background: var(--dpk-violet-soft);
3748
- color: var(--dpk-violet);
3749
- }
3750
-
3751
- .avatar[data-tone='accent'] {
3752
- background: var(--dpk-accent-soft);
3753
- color: var(--dpk-accent);
3754
- }
3755
-
3756
- .avatar[data-tone='danger'] {
3757
- background: var(--dpk-danger-soft);
3758
- color: var(--dpk-danger);
3759
- }
3760
-
3761
- .combo-listbox {
3762
- box-sizing: border-box;
3763
- position: fixed;
3764
- inset: auto;
3765
- margin: 0;
3766
- padding: 0;
3767
- display: flex;
3768
- flex-direction: column;
3769
- overflow: hidden;
3770
- border: 1px solid var(--dpk-rule-strong);
3771
- border-radius: var(--dpk-radius-lg);
3772
- background: var(--dpk-paper-raised);
3773
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
3774
- color: var(--dpk-ink);
3775
- font-size: 12.5px;
3776
- animation: dpk-combobox-pop-in 140ms var(--dpk-ease);
3777
- }
3778
-
3779
- @keyframes dpk-combobox-pop-in {
3780
- from {
3781
- opacity: 0;
3782
- transform: translateY(4px) scale(0.98);
3783
- }
3784
- }
3785
-
3786
- .options {
3787
- flex: 1 1 auto;
3788
- overflow-y: auto;
3789
- padding: 6px 0;
3790
- }
3791
-
3792
- .group-heading {
3793
- padding: 9px 12px 4px;
3794
- font-family: var(--dpk-mono);
3795
- font-size: 10px;
3796
- font-weight: 650;
3797
- letter-spacing: 0.09em;
3798
- text-transform: uppercase;
3799
- color: var(--dpk-ink-faint);
3800
- }
3801
-
3802
- .option {
3803
- display: flex;
3804
- align-items: center;
3805
- gap: 8px;
3806
- padding: 6px 12px;
3807
- cursor: pointer;
3808
- }
3809
-
3810
- .option:hover,
3811
- .option[data-active='true'] {
3812
- background: var(--dpk-paper-sunken);
3813
- }
3814
-
3815
- .option-text {
3816
- display: flex;
3817
- align-items: baseline;
3818
- gap: 6px;
3819
- min-width: 0;
3820
- flex: 1 1 auto;
3821
- }
3822
-
3823
- .option-name {
3824
- flex: none;
3825
- max-width: 60%;
3826
- overflow: hidden;
3827
- text-overflow: ellipsis;
3828
- white-space: nowrap;
3829
- color: var(--dpk-ink);
3830
- }
3831
-
3832
- .option-desc {
3833
- min-width: 0;
3834
- overflow: hidden;
3835
- text-overflow: ellipsis;
3836
- white-space: nowrap;
3837
- color: var(--dpk-ink-soft);
3838
- font-size: 11.5px;
3839
- }
3840
-
3841
- .option-check {
3842
- flex: none;
3843
- display: flex;
3844
- color: var(--dpk-blue);
3845
- }
3846
-
3847
- .option-check svg {
3848
- display: block;
3849
- width: 14px;
3850
- height: 14px;
3851
- }
3852
-
3853
- .empty {
3854
- padding: 18px 12px;
3855
- color: var(--dpk-ink-soft);
3856
- font-size: 12px;
3857
- text-align: center;
3858
- }
3859
-
3860
- .footer {
3861
- flex: none;
3862
- display: flex;
3863
- align-items: center;
3864
- justify-content: space-between;
3865
- gap: 10px;
3866
- padding: 7px 12px;
3867
- border-top: 1px solid var(--dpk-rule);
3868
- }
3869
-
3870
- .count {
3871
- color: var(--dpk-ink-soft);
3872
- font-size: 11px;
3873
- font-variant-numeric: tabular-nums;
3874
- }
3875
-
3876
- .hints {
3877
- display: flex;
3878
- align-items: center;
3879
- gap: 10px;
3880
- color: var(--dpk-ink-faint);
3881
- font-size: 10.5px;
3882
- }
3883
-
3884
- .hint {
3885
- display: inline-flex;
3886
- align-items: center;
3887
- gap: 4px;
3888
- }
3889
-
3890
- .kbd {
3891
- display: inline-flex;
3892
- align-items: center;
3893
- justify-content: center;
3894
- min-width: 1.5em;
3895
- height: 1.5em;
3896
- padding: 0 4px;
3897
- border: 1px solid var(--dpk-rule-strong);
3898
- border-bottom-width: 2px;
3899
- border-radius: var(--dpk-radius-xs);
3900
- background: var(--dpk-paper-raised);
3901
- color: var(--dpk-ink-soft);
3902
- font-family: var(--dpk-mono);
3903
- font-size: 10px;
3904
- }
3905
-
3906
- .error {
3907
- color: var(--dpk-danger);
3908
- font-size: 12px;
3909
- }
3910
- `]}static{this.properties={label:{type:String},placeholder:{type:String},multiple:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}}}#a=`dpk-combobox-${++Xo}`;#t=new O(this);#e=new qt(this);#n=null;#s=[];#i=[];#r=null;#o=!1;#l=null;#c=-1;constructor(){super(),this.label=null,this.placeholder=null,this.multiple=!1,this.name=null,new aa(this,{open:()=>this.#o,closesOn:t=>!t.some(e=>e instanceof Element&&e.matches(Yo)),ownsEscape:()=>this.#o,dismiss:()=>this.#v()})}connectedCallback(){super.connectedCallback(),this.#n=X(this,Tn,t=>{t.ok?(this.#s=t.value.options,this.#r=null,t.value.value!==null&&(this.#i=t.value.value)):(this.#s=[],this.#r=t.error),this.requestUpdate()})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null}get value(){return this.multiple?this.#i:this.#i[0]??""}set value(t){this.#i=En(t),this.requestUpdate()}render(){const t=this.#p;if(this.#r!==null)return d`<p class="error">${this.#r}</p>`;const e=this.#l??"",s=pe(this.#s,e),a=he(this.#c,s.length),i=this.multiple?Go(this.#s,this.#i):[],r=this.multiple?null:Jo(this.#s,this.#i),o=this.multiple?this.#i.length===0:r===null,l=this.#l??(this.multiple?"":r??"");return d`
3911
- <div class="field">
3912
- ${this.label?d`<label class="field-label" id=${this.#g}>${this.label}</label>`:h}
3913
- <div class="combo-control">
3914
- ${this.multiple?U(i,c=>c.value,c=>this.#x(c,t)):h}
3915
- <input
3916
- class="input"
3917
- type="text"
3918
- role="combobox"
3919
- autocomplete="off"
3920
- spellcheck="false"
3921
- aria-expanded=${this.#o?"true":"false"}
3922
- aria-haspopup="listbox"
3923
- aria-autocomplete="list"
3924
- aria-controls=${this.#u}
3925
- aria-labelledby=${this.label?this.#g:h}
3926
- aria-activedescendant=${a>=0?this.#d(s[a]?.value??""):h}
3927
- placeholder=${o?this.placeholder??"":""}
3928
- .value=${l}
3929
- @focus=${this.#f}
3930
- @click=${this.#f}
3931
- @input=${this.#k}
3932
- @keydown=${this.#h}
3933
- />
3934
- <button
3935
- type="button"
3936
- class="chevron"
3937
- tabindex="-1"
3938
- aria-hidden="true"
3939
- data-open=${this.#o?"true":"false"}
3940
- @mousedown=${c=>c.preventDefault()}
3941
- @click=${this.#C}
3942
- >
3943
- ${ia()}
3944
- </button>
3945
- </div>
3946
- </div>
3947
- ${this.#o?this.#m(s,a,t):h}
3948
- `}updated(t){super.updated(t),this.#z()}get#p(){return Uo(this.#t.locale)}get#g(){return`${this.#a}-label`}get#u(){return`${this.#a}-listbox`}#d(t){return`${this.#a}-option-${encodeURIComponent(t)}`}#m(t,e,s){const a=Fo(t);return d`
3949
- <div
3950
- class="combo-listbox"
3951
- popover="manual"
3952
- role="listbox"
3953
- id=${this.#u}
3954
- aria-label=${this.label??s.listLabel}
3955
- aria-multiselectable=${this.multiple?"true":"false"}
3956
- >
3957
- <div class="options">
3958
- ${t.length===0?d`<p class="empty">${s.empty}</p>`:a.map(i=>d`
3959
- ${i.group!==null?d`<div class="group-heading">${i.group}</div>`:h}
3960
- ${U(i.options,r=>r.value,r=>this.#b(r,t.indexOf(r)===e))}
3961
- `)}
3962
- </div>
3963
- <div class="footer">
3964
- <span class="count">${s.selectedCount(this.#i.length)}</span>
3965
- <span class="hints">
3966
- <span class="hint"><kbd class="kbd">↑</kbd><kbd class="kbd">↓</kbd> ${s.moveLabel}</span>
3967
- <span class="hint"><kbd class="kbd">↵</kbd> ${s.toggleLabel}</span>
3968
- </span>
3969
- </div>
3970
- </div>
3971
- `}#b(t,e){const s=Ko(this.#i,t.value);return d`
3972
- <div
3973
- class="option"
3974
- id=${this.#d(t.value)}
3975
- role="option"
3976
- aria-selected=${s?"true":"false"}
3977
- data-active=${e?"true":"false"}
3978
- @mousedown=${a=>a.preventDefault()}
3979
- @click=${()=>this.#w(t.value)}
3980
- >
3981
- <span class="avatar" data-tone=${zn(t.value)}>${t.avatar??Mn(t.label)}</span>
3982
- <span class="option-text">
3983
- <span class="option-name">${t.label}</span>
3984
- ${t.description!==null?d`<span class="option-desc">${t.description}</span>`:h}
3985
- </span>
3986
- ${s?d`<span class="option-check" aria-hidden="true">${Ct()}</span>`:h}
3987
- </div>
3988
- `}#x(t,e){return d`
3989
- <span class="chip">
3990
- <span class="avatar" data-tone=${zn(t.value)}>${t.avatar??Mn(t.label)}</span>
3991
- <span class="chip-label">${t.label}</span>
3992
- <button
3993
- type="button"
3994
- class="chip-remove"
3995
- tabindex="-1"
3996
- aria-label=${e.removeChip(t.label)}
3997
- @mousedown=${s=>s.preventDefault()}
3998
- @click=${s=>{s.stopPropagation(),this.#y(Bo(this.#i,t.value))}}
3999
- >
4000
- ${Te()}
4001
- </button>
4002
- </span>
4003
- `}#f=()=>{this.#o=!0,this.#c=-1,this.requestUpdate()};#k=t=>{t.currentTarget instanceof HTMLInputElement&&(this.#l=t.currentTarget.value,this.#o=!0,this.#c=-1,this.requestUpdate())};#h=t=>{if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault();const e=pe(this.#s,this.#l??""),s=this.#o;this.#o=!0;const a=t.key==="ArrowDown"?1:-1;this.#c=s?Ho(this.#c,a,e.length):-1,s||(this.#c=he(a>0?0:e.length-1,e.length)),this.requestUpdate();return}if(t.key==="Enter"){if(!this.#o)return;t.preventDefault();const e=pe(this.#s,this.#l??""),s=e[he(this.#c,e.length)];s&&this.#w(s.value);return}if(t.key==="Backspace"){if((this.#l??"")!==""||!this.multiple||this.#i.length===0)return;t.preventDefault(),this.#y(this.#i.slice(0,-1))}};#C=()=>{this.#o?this.#v():(this.#o=!0,this.#c=-1,this.requestUpdate()),this.renderRoot.querySelector("input")?.focus()};#w(t){this.#y(Wo(this.#i,t,this.multiple)),this.multiple?(this.#l="",this.#c=-1,this.requestUpdate()):this.#v()}#y(t){Vo(this.#i,t)||(this.#i=t,this.requestUpdate(),this.dispatchEvent(new CustomEvent("dpk-combobox-change",{detail:{value:this.multiple?t:t[0]??""},bubbles:!0,composed:!0})))}#v(){this.#o=!1,this.#l=null,this.#c=-1,this.requestUpdate()}#z(){const t=this.renderRoot.querySelector(".combo-listbox"),e=this.renderRoot.querySelector(".combo-control");!t||!e||this.#e.open(t,e,{width:e.offsetWidth,height:320},{placement:"bottom-start"})}}const Ln=()=>{customElements.get("dpk-combobox")||customElements.define("dpk-combobox",_n)};let dt=null;const Zo=n=>{dt!==null&&dt!==n&&dt.hide(),dt=n},Qo=n=>{dt===n&&(dt=null)};class Pn extends A{static{this.styles=[L,J,_`
4004
- :host {
4005
- display: contents;
4006
- }
4007
-
4008
- /*
4009
- * The one placement core imposes: bottom-center, clear of the hand-off
4010
- * dock. A host that needs a different spot claims the bar from
4011
- * somewhere else on screen instead — the contract is "claim it", not
4012
- * "place it".
4013
- */
4014
- .dpk-floatbar {
4015
- left: 50%;
4016
- bottom: calc(14px + var(--dpk-dock-clearance, 0px));
4017
- transform: translateX(-50%);
4018
- z-index: 45;
4019
- }
4020
- `]}static{this.properties={label:{type:String,reflect:!0}}}#a={hide:()=>this.#e(!1)};#t=!1;constructor(){super(),this.label=null}get open(){return this.#t}connectedCallback(){super.connectedCallback(),this.#e(!0),Zo(this.#a)}disconnectedCallback(){super.disconnectedCallback(),Qo(this.#a)}render(){return d`
4021
- <div
4022
- class="dpk-floatbar"
4023
- popover="manual"
4024
- role="toolbar"
4025
- aria-label=${this.label??h}
4026
- @keydown=${this.#s}
4027
- >
4028
- <slot></slot>
4029
- </div>
4030
- `}updated(t){super.updated(t),this.#n()}#e(t){t!==this.#t&&(this.#t=t,this.requestUpdate())}#n(){const t=this.renderRoot.querySelector(".dpk-floatbar");if(!t||typeof t.showPopover!="function")return;const e=t.matches(":popover-open");if(this.#t&&!e)try{t.showPopover()}catch{}else if(!this.#t&&e)try{t.hidePopover()}catch{}}#s=t=>{t.key==="Escape"&&this.dispatchEvent(new CustomEvent("dpk-selection-clear",{bubbles:!0,composed:!0}))}}const Rn=()=>{customElements.get("dpk-selection-bar")||customElements.define("dpk-selection-bar",Pn)};class Dn extends A{static{this.styles=[L,J]}#a=new ra(this);ask(t){return this.#a.ask(t)}render(){return this.#a.render()}}const On=()=>{customElements.get("dpk-confirm-dialog")||customElements.define("dpk-confirm-dialog",Dn)},tl=D({en:{heading:"Alternatives",empty:"No alternatives to compare.",dataError:"The alternatives could not be read.",reason:"Reason",tradeoffs:"Tradeoffs",adopted:"Adopted",rejected:"Rejected",considered:"Considered"},ja:{heading:"\u4EE3\u66FF\u6848",empty:"\u6BD4\u8F03\u3059\u308B\u4EE3\u66FF\u6848\u304C\u3042\u308A\u307E\u305B\u3093\u3002",dataError:"\u4EE3\u66FF\u6848\u306E\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002",reason:"\u7406\u7531",tradeoffs:"\u30C8\u30EC\u30FC\u30C9\u30AA\u30D5",adopted:"\u63A1\u7528",rejected:"\u5374\u4E0B",considered:"\u691C\u8A0E"}}),el=["adopted","rejected","considered"],sl=x({id:y(b(),Wt(/^[A-Za-z0-9_-]+$/)),status:Z(el),label:g(y(b(),S(1))),summary:g(y(b(),S(1))),reason:g(y(b(),S(1))),tradeoffs:g($(y(b(),S(1))))}),nl=x({options:$(sl)}),al=()=>({options:[]}),In=n=>{const t=B(nl,n),e=new Set;return{options:t.options.map(s=>{if(e.has(s.id))throw new Error(`duplicate option id: ${s.id}`);return e.add(s.id),{id:s.id,status:s.status,label:s.label??s.id,summary:s.summary??null,reason:s.reason??null,tradeoffs:s.tradeoffs??[]}})}},il=(n,t)=>{switch(t){case"adopted":return n.adopted;case"rejected":return n.rejected;case"considered":return n.considered}},rl=(n,t)=>({id:t.id,status:t.status,key:t.label===t.id?null:t.id,title:t.label,statusLabel:il(n,t.status),summary:t.summary,reason:t.reason===null?null:{label:n.reason,text:t.reason},tradeoffs:t.tradeoffs.length===0?null:{label:n.tradeoffs,items:t.tradeoffs}}),ol=(n,t)=>t.options.map(e=>rl(n,e)),ll=[L,ha,_`
4031
- :host {
4032
- display: block;
4033
- color: var(--dpk-ink);
4034
- font-family: var(--dpk-body);
4035
- }
4036
-
4037
- .alternatives {
4038
- display: grid;
4039
- gap: 10px;
4040
- }
4041
-
4042
- /* A concise section label, quiet enough to sit above cards in a document. */
4043
- .alternatives-label {
4044
- margin: 0;
4045
- padding: 0 2px;
4046
- }
4047
-
4048
- /* Cards wrap into columns once the page has room; one option takes the row. */
4049
- .options {
4050
- display: grid;
4051
- grid-template-columns: repeat(auto-fit, minmax(min(216px, 100%), 1fr));
4052
- gap: 8px;
4053
- margin: 0;
4054
- padding: 0;
4055
- list-style: none;
4056
- }
4057
-
4058
- /* A grid item that stretches, so the cards in a row share their height. */
4059
- .option {
4060
- display: grid;
4061
- min-width: 0;
4062
- }
4063
-
4064
- /*
4065
- * The taken option: the card's own tone (a green hairline edge and a barely
4066
- * green face), plus a ring outside the edge so the eye finds it in a row of
4067
- * neutral cards. Weight and hue, not a bar down one side.
4068
- */
4069
- .option[data-status='adopted'] .dpk-card {
4070
- --dpk-card-tone: var(--dpk-green);
4071
- box-shadow:
4072
- 0 0 0 2px color-mix(in oklab, var(--dpk-green) 26%, transparent),
4073
- var(--dpk-bevel),
4074
- 0 10px 22px -14px color-mix(in oklab, var(--dpk-green) 60%, var(--dpk-shade-3));
4075
- }
4076
-
4077
- /* ------------------------------------------------------------ status */
4078
-
4079
- [data-tone='adopted'] {
4080
- --tone: var(--dpk-green);
4081
- --tone-soft: var(--dpk-green-soft);
4082
- }
4083
-
4084
- [data-tone='rejected'] {
4085
- --tone: var(--dpk-amber);
4086
- --tone-soft: var(--dpk-amber-soft);
4087
- }
4088
-
4089
- [data-tone='considered'] {
4090
- --tone: var(--dpk-blue);
4091
- --tone-soft: var(--dpk-blue-soft);
4092
- }
4093
-
4094
- /* The chip's box comes from the card atom; only its tone is set here. */
4095
- .status {
4096
- background: var(--tone-soft);
4097
- color: var(--tone);
4098
- font-weight: 650;
4099
- }
4100
-
4101
- /* -------------------------------------------------------------- body */
4102
-
4103
- .option-summary {
4104
- margin: 0;
4105
- color: var(--dpk-ink-soft);
4106
- font-size: 12.5px;
4107
- line-height: 1.6;
4108
- overflow-wrap: anywhere;
4109
- }
4110
-
4111
- .option-facts {
4112
- display: grid;
4113
- gap: 8px;
4114
- margin: 0;
4115
- }
4116
-
4117
- .option-fact {
4118
- display: grid;
4119
- gap: 1px;
4120
- }
4121
-
4122
- .option-fact > dd {
4123
- margin: 0;
4124
- color: var(--dpk-ink-soft);
4125
- font-size: 12.5px;
4126
- line-height: 1.6;
4127
- overflow-wrap: anywhere;
4128
- }
4129
-
4130
- .option-tradeoffs {
4131
- display: grid;
4132
- gap: 2px;
4133
- margin: 0;
4134
- padding-left: 16px;
4135
- }
4136
-
4137
- .option-tradeoffs > li::marker {
4138
- color: var(--dpk-ink-faint);
4139
- }
4140
-
4141
- /* ------------------------------------------------------- notice/empty */
4142
-
4143
- .alternatives-notice,
4144
- .alternatives-empty {
4145
- margin: 0;
4146
- padding: 12px 14px;
4147
- border-radius: var(--dpk-radius);
4148
- font-size: 12.5px;
4149
- line-height: 1.6;
4150
- }
4151
-
4152
- .alternatives-notice {
4153
- background: var(--dpk-danger-soft);
4154
- color: var(--dpk-danger);
4155
- }
4156
-
4157
- .alternatives-empty {
4158
- color: var(--dpk-ink-faint);
4159
- text-align: center;
4160
- }
4161
- `];class qn extends A{static{this.styles=ll}static{this.properties={data:{attribute:!1},heading:{type:String}}}#a=new O(this);#t=null;#e=null;#n=null;constructor(){super(),this.data=null,this.heading=null}connectedCallback(){super.connectedCallback(),this.#t=X(this,In,t=>{this.data===null&&(t.ok?this.#i(t.value):this.#r(t.error))})}disconnectedCallback(){super.disconnectedCallback(),this.#t?.(),this.#t=null}willUpdate(t){t.has("data")&&this.data!==null&&this.#i(this.data)}get dataError(){return this.#n}get#s(){return tl(this.#a.locale)}#i(t){this.#e=t,this.#n=null,this.requestUpdate()}#r(t){this.#e=null,this.#n=t,console.error("[dev-process-kit] invalid alternatives data:",t),this.requestUpdate()}render(){const t=this.#s,e=this.heading??t.heading,s=ol(t,this.#e??al());return d`<section class="alternatives">
4162
- ${e===""?h:d`<p class="alternatives-label dpk-label">${e}</p>`}
4163
- ${this.#n===null?h:d`<p class="alternatives-notice" role="alert">${t.dataError}<br />${this.#n}</p>`}
4164
- ${this.#n===null&&s.length===0?d`<p class="alternatives-empty">${t.empty}</p>`:h}
4165
- ${s.length===0?h:d`<ul class="options">
4166
- ${U(s,a=>a.id,a=>this.#o(a))}
4167
- </ul>`}
4168
- </section>`}#o(t){const e=t.reason===null&&t.tradeoffs===null?h:d`<dl class="option-facts">
4169
- ${t.reason===null?h:d`<div class="option-fact">
4170
- <dt class="dpk-label">${t.reason.label}</dt>
4171
- <dd>${t.reason.text}</dd>
4172
- </div>`}
4173
- ${t.tradeoffs===null?h:d`<div class="option-fact">
4174
- <dt class="dpk-label">${t.tradeoffs.label}</dt>
4175
- <dd>
4176
- <ul class="option-tradeoffs">
4177
- ${t.tradeoffs.items.map(s=>d`<li>${s}</li>`)}
4178
- </ul>
4179
- </dd>
4180
- </div>`}
4181
- </dl>`;return d`<li class="option" data-status=${t.status} data-option=${t.id}>
4182
- <article class="dpk-card">
4183
- <div class="dpk-card-head">
4184
- ${t.key===null?h:d`<span class="dpk-card-key">${t.key}</span>`}
4185
- <span class="dpk-card-title">${t.title}</span>
4186
- <span class="dpk-card-meta">
4187
- <span class="dpk-card-chip status" data-tone=${t.status}>${t.statusLabel}</span>
4188
- </span>
4189
- </div>
4190
- ${t.summary===null?h:d`<p class="option-summary">${t.summary}</p>`} ${e}
4191
- </article>
4192
- </li>`}}const Un=()=>{customElements.get("dpk-alternatives")||customElements.define("dpk-alternatives",qn)},dl=()=>{oa(),la(),ps(),xs(),Ds(),Js(),Nn()},Nn=()=>{as(),Qs(),on(),za(),cn(),gn(),_a(),La(),vn(),yn(),Ln(),Pa(),Ye(),ss(),Sn(),Rn(),On(),an(),Un()};export{Xa as $,Qs as A,On as B,Ye as C,qn as D,Ds as E,an as F,xs as G,ps as H,Rn as I,cn as J,ss as K,Js as L,In as M,un as N,Ot as O,Tn as P,le as Q,us as R,ne as S,ts as T,Es as U,Us as V,Nn as W,ut as X,Et as Y,Ja as Z,ei as _,Cn as a,ti as a0,Ra as a1,Ze as a2,Ya as a3,Za as a4,Qa as a5,si as a6,mn as b,kn as c,xn as d,_n as e,rn as f,Zs as g,Dn as h,Xe as i,Rs as j,nn as k,vs as l,cs as m,Pn as n,dn as o,es as p,Gs as q,dl as r,Un as s,as as t,Sn as u,gn as v,vn as w,yn as x,Ln as y,on as z};