dev-process-kit 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boards.js +1 -1
- package/dist/chunks/{shared-zDGLGSqj.js → shared-0HXwrPVn.js} +54 -54
- package/dist/chunks/{shared-C1y1ymFB.js → shared-B2F5LY6f.js} +13 -13
- package/dist/chunks/shared-B7MDu9J_.js +6912 -0
- package/dist/chunks/{shared-DFW6nDO8.js → shared-BSEt0fN6.js} +9 -2
- package/dist/chunks/{shared-CpI8ATFw.js → shared-BugVP_yn.js} +2 -2
- package/dist/chunks/shared-C1sWnXGY.js +1 -0
- package/dist/chunks/{shared-DPayIyBW.js → shared-C2_qMOyi.js} +1 -1
- package/dist/chunks/{shared-DVAXtJwE.js → shared-CeNV36-9.js} +134 -28
- package/dist/chunks/{shared-UIN_s3sw.js → shared-CjWMknuE.js} +1 -1
- package/dist/chunks/{shared-tkjGdHLh.js → shared-CxTKp5CX.js} +18 -18
- package/dist/chunks/{shared-DKxWTptq.js → shared-CyOyXHQO.js} +1 -1
- package/dist/chunks/{shared-DIEHJb_n.js → shared-D3Xm9wF8.js} +3 -3
- package/dist/chunks/shared-DCnxYUIB.js +3 -0
- package/dist/chunks/{shared-giADQT1w.js → shared-DE09J93T.js} +494 -226
- package/dist/chunks/{shared-Dp6JBc2T.js → shared-DJCdfkg-.js} +1 -1
- package/dist/chunks/{shared-BOQp0U9U.js → shared-Dxf3BUk6.js} +1055 -224
- package/dist/chunks/{shared-DOAi2-QH.js → shared-qLSu7C5m.js} +10 -10
- package/dist/chunks/{shared-CVBp1_S_.js → shared-tq8QsPTt.js} +2 -2
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sync.js +1 -1
- package/dist/views/delegation-poker.js +1 -1
- package/dist/views/plain.js +1 -1
- package/dist/views/prototype.js +1 -1
- package/dist/views/slides.js +1 -1
- package/dist/views/task-board.js +1 -1
- package/dist/views/usm.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-BTu8ZSVC.js +0 -1
- package/dist/chunks/shared-BjLRqdzA.js +0 -6724
- package/dist/chunks/shared-CJZKj_HI.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4 as M,a8 as P,aB as hn,A as pe,aC as he,aD as un,aE as gn,al as I,aF as ue,a6 as j,a3 as mt,af as Mt,aw as ge,u as Tt,g as mn,z as fn,av as At,aG as bn,aH as ft,aI as me,ak as kn,ax as vn,t as xn,aJ as yn,R as wn,S as $n}from"./shared-giADQT1w.js";import{o as W,r as Cn}from"./shared-D4PPk0Dk.js";import{e as Sn}from"./shared-DKxWTptq.js";import{a as fe,c as En}from"./shared-zDGLGSqj.js";import{c as zn}from"./shared-tkjGdHLh.js";import{m as _,o as Lt,k as m,I as be,D as ke,x as st,h as $,u as Dt,s as Rt,A as ve,j as k,B as Mn,n as bt,q as w,v as C,H as Pt,w as E,C as G,g as nt,z as xe,l as V,y as ye,G as we,J as Tn,K as $e}from"./shared-CJZKj_HI.js";import{p as An,i as Ln,r as Dn,c as Rn,a as Ce,b as Se,d as Pn,e as On,f as qn,h as Ee,g as Un,j as Ot,s as In,k as jn,l as Nn,m as Fn,n as Hn,t as Wn}from"./shared-DVAXtJwE.js";import{B as _n,t as Bn,v as ze,i as Gn,k as Kn,j as Vn}from"./shared-DFW6nDO8.js";import{d as Jn}from"./shared-Dp6JBc2T.js";class at{#a;#t;#e=null;#n=null;#s=null;#i=null;#r=new Map;#o=null;constructor(t){this.#a=t,this.#t=new zt(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=An(this.#r.get(e)??"",[],{...this.#i===null?{}:{label:this.#i},key:e,...this.#o===e&&t.errorMessage!==void 0?{error:t.errorMessage}:{}});return d`${Ln(e,Dn(Rn(t.locale),s,a=>this.#d(e,t.submit,a)))}`}#d(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 kt=(n,t,e,s)=>{if(n===null)return null;const a=ce(n),i=t.find(o=>o.value===a);return i===void 0?null:{id:"review-comment",entries:[{kind:"item",id:"review-comment",label:e.reviewComment,run:()=>s(a,i.label)}]}},vt=.08,Me=1.8,Te=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}},Ae=(n,t)=>n+t/12,Xn=(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}},qt=16,Yn=.8,xt=(n,t,e,s,a)=>n==="start"?qt-Ae(t,e)*s:(a-e*s)/2-t*s,Le=(n,t,e,s,a="center")=>{if(t.width===0||t.height===0)return{...n,x:0,y:0};const i=(o,r,l,u)=>{const c=l*n.scale,g=u*Yn;if(c<=u){const b=xt(a,r,l,n.scale,u);return K(o,b-g,b+g)}return K(o,u-(r+l)*n.scale-g,-r*n.scale+g)};return{...n,x:i(n.x,t.x,t.width,e),y:i(n.y,t.y,t.height,s)}},Zn=(n,t,e,s,a,i,o="center")=>{const r=Math.abs(i)>Math.abs(a);if(r&&t.height*n.scale<=s)return null;const l=Le({...n,x:n.x-a,y:n.y-i},t,e,s,o);return r&&l.y===n.y?null:l},Qn=n=>Math.exp(-n*.01),De='button,[role="button"],a,input,textarea,select',Ut=(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},ta=n=>{const{canvas:t,world:e,onClearSelection:s,onView:a,align:i="center",sizeWorld:o=!0}=n;let r={x:0,y:0,width:0,height:0},l={x:0,y:0,scale:1};const u=()=>({width:t.clientWidth||1e3,height:t.clientHeight||560}),c=()=>{const{width:p,height:f}=u();l=Le(l,r,p,f,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)},g=()=>{const{width:p,height:f}=u(),v=r.width/1.2||1,y=r.height/1.2||1,S=K(Math.min((p-24)/v,(f-40)/y),vt,1);l={scale:S,x:xt(i,r.x,r.width,S,p),y:xt(i,r.y,r.height,S,f)},c()},b=p=>{const{width:f,height:v}=u(),y=Te([p]),S=y.width/1.2||1,D=y.height/1.2||1;l={...l,scale:K(Math.min((f-24)/S,(v-40)/D),vt,Me)},l={...l,x:(f-y.width*l.scale)/2-y.x*l.scale,y:(v-y.height*l.scale)/2-y.y*l.scale},c()},L=()=>{const{width:p}=u(),f=r.width/1.2||1,v=K((p-24)/f,vt,1);l={scale:v,x:(p-r.width*v)/2-r.x*v,y:16},c()},gt=p=>{const{width:f,height:v}=u(),y=(S,D,le,de)=>de!==void 0?qt-de:D<=le?xt(i,S,D,1,le):qt-Ae(S,D);l={scale:1,x:y(r.x,r.width,f,p?.x),y:y(r.y,r.height,v,p?.y)},c()},H=(p,f=u().width/2,v=u().height/2)=>{const y=l.scale,S=K(y*p,vt,Me);S!==y&&(l={scale:S,x:f-(f-l.x)*S/y,y:v-(v-l.y)*S/y},c())},Q=p=>{if(Ut(p,t,".diagram-zoom")!==null)return;const f=p.deltaMode===1?16:p.deltaMode===2?u().height:1;if(p.ctrlKey||p.metaKey){p.preventDefault();const D=t.getBoundingClientRect();H(Qn(p.deltaY),p.clientX-D.left,p.clientY-D.top);return}const{width:v,height:y}=u(),S=Zn(l,r,v,y,p.deltaX*f,p.deltaY*f,i);S!==null&&(p.preventDefault(),l=S,c())},q=new Map;let A=null,U=!1;const N=()=>{const p=[...q.values()],f=p[0];if(!f)return null;const v=p[1];return v?{x:(f.x+v.x)/2,y:(f.y+v.y)/2,distance:Math.hypot(v.x-f.x,v.y-f.y)}:{...f,distance:0}},tt=p=>{q.size===0&&(U=!1);const f=Ut(p,t,De);p.button!==0||p.pointerType!=="touch"&&f!==null||(q.set(p.pointerId,{x:p.clientX,y:p.clientY}),A=N(),f===null&&t.setPointerCapture(p.pointerId),p.pointerType!=="touch"&&f===null&&(p.preventDefault(),t.focus({preventScroll:!0})))},se=p=>{if(!q.has(p.pointerId)||A===null)return;q.set(p.pointerId,{x:p.clientX,y:p.clientY});const f=N();if(f===null)return;const v=f.x-A.x,y=f.y-A.y;if((Math.abs(v)+Math.abs(y)>1||Math.abs(f.distance-A.distance)>1)&&(U=!0),f.distance>0&&A.distance>0){const S=t.getBoundingClientRect();H(Math.pow(f.distance/A.distance,.45),A.x-S.left,A.y-S.top)}l={...l,x:l.x+v,y:l.y+y},c(),A=f,t.classList.toggle("is-panning",U)},et=p=>{q.delete(p.pointerId),A=N(),!(q.size>0)&&(t.classList.remove("is-panning"),p.type==="pointercancel"&&(U=!1))},ne=p=>{U&&(p.preventDefault(),p.stopPropagation()),et(p)},ae=p=>{if(U){p.preventDefault(),p.stopPropagation(),U=!1;return}!(p.target instanceof Element)||Ut(p,t,De)!==null||s()},ie=p=>{if(p.target!==t)return;const f=30;if(p.key==="+"||p.key==="=")H(1.1);else if(p.key==="-")H(1/1.1);else if(p.key==="0")g();else if(p.key==="Escape"){if(s()===!1)return}else if(p.key==="ArrowLeft"||p.key==="ArrowRight"||p.key==="ArrowUp"||p.key==="ArrowDown")l={...l,x:l.x+(p.key==="ArrowLeft"?f:p.key==="ArrowRight"?-f:0),y:l.y+(p.key==="ArrowUp"?f:p.key==="ArrowDown"?-f:0)},c();else return;p.preventDefault()},re=p=>{const f=p.target instanceof HTMLElement?p.target:null;if(f===null||!p.composedPath().includes(e))return;const v=f.getBoundingClientRect(),y=t.getBoundingClientRect();let S=0,D=0;v.left<y.left+12?S=y.left+12-v.left:v.right>y.right-12&&(S=y.right-12-v.right),v.top<y.top+12?D=y.top+12-v.top:v.bottom>y.bottom-40&&(D=y.bottom-40-v.bottom),!(S===0&&D===0)&&(l={...l,x:l.x+S,y:l.y+D},c())};t.addEventListener("wheel",Q,{passive:!1}),t.addEventListener("pointerdown",tt),t.addEventListener("pointermove",se),t.addEventListener("pointerup",ne),t.addEventListener("pointercancel",et),t.addEventListener("lostpointercapture",et),t.addEventListener("click",ae,!0),t.addEventListener("keydown",ie),t.addEventListener("focusin",re);const oe=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>c());return oe?.observe(t),{setContent(p){r=Te(p.width===0&&p.height===0?[]:[p]),o&&(e.style.width=`${p.width}px`,e.style.height=`${p.height}px`),c()},apply:c,fit:g,fitTo:b,fitWidth:L,reset:gt,zoom:H,view:()=>({...l}),destroy(){oe?.disconnect(),t.removeEventListener("wheel",Q),t.removeEventListener("pointerdown",tt),t.removeEventListener("pointermove",se),t.removeEventListener("pointerup",ne),t.removeEventListener("pointercancel",et),t.removeEventListener("lostpointercapture",et),t.removeEventListener("click",ae,!0),t.removeEventListener("keydown",ie),t.removeEventListener("focusin",re)}}},ea=["fit","fit-width","actual","none"];class sa{#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=ta({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=ea.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 na=(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),Re=160,It=(n,t,e=Re)=>Math.max(e,Math.round(n+t)),aa=(n,t,e,s=Re)=>{const a=e?96:24;return t==="ArrowDown"?It(n,a,s):t==="ArrowUp"?It(n,-a,s):null},Pe={kind:"idle"};class ia{constructor(t,e){this.#e=null,this.#n=Pe,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(It(a.startHeight,s.clientY-a.startY))},pointerup:s=>this.#i(s),pointercancel:s=>this.#i(s),keydown:s=>{const a=aa(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=Pe,this.#a.requestUpdate())}}const ra=R({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 Oe extends z{static{this.styles=[T,B,M`
|
|
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
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
color: var(--dpk-ink);
|
|
@@ -119,8 +119,8 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
.subject {
|
|
122
|
-
font-size:
|
|
123
|
-
color: var(--dpk-ink-
|
|
122
|
+
font-size: 11px;
|
|
123
|
+
color: var(--dpk-ink-soft);
|
|
124
124
|
padding-left: 10px;
|
|
125
125
|
border-left: 1px solid var(--dpk-rule-strong);
|
|
126
126
|
}
|
|
@@ -306,7 +306,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
306
306
|
border-radius: var(--dpk-radius-sm);
|
|
307
307
|
background: transparent;
|
|
308
308
|
color: var(--dpk-ink-soft);
|
|
309
|
-
font-size:
|
|
309
|
+
font-size: 11px;
|
|
310
310
|
cursor: pointer;
|
|
311
311
|
transition:
|
|
312
312
|
background var(--dpk-dur-fast) var(--dpk-ease),
|
|
@@ -367,7 +367,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
367
367
|
display: none;
|
|
368
368
|
}
|
|
369
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
|
|
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
371
|
${this.maximized?d`<div class="placeholder" style="height:${this.#n}px"></div>`:h}
|
|
372
372
|
<section
|
|
373
373
|
class=${this.maximized?"panel is-maximized":"panel"}
|
|
@@ -391,14 +391,14 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
391
391
|
</div>
|
|
392
392
|
<slot name="footer"></slot>
|
|
393
393
|
</section>
|
|
394
|
-
`}get#i(){return
|
|
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
395
|
<div class="world" part="world"><slot></slot></div>
|
|
396
396
|
<slot name="overlay"></slot>
|
|
397
|
-
</div>`}#o(t){const e=this.#i,s=[this.canvas?this.#
|
|
398
|
-
<slot name="controls" @slotchange=${this.#
|
|
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
399
|
${s.map((a,i)=>d`${i>0||this.#s?d`<span class="separator"></span>`:h}${a}`)}
|
|
400
|
-
</div>`}#
|
|
401
|
-
${
|
|
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
402
|
</button>
|
|
403
403
|
<button
|
|
404
404
|
type="button"
|
|
@@ -410,24 +410,24 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
410
410
|
100%
|
|
411
411
|
</button>
|
|
412
412
|
<button type="button" aria-label=${t.zoomIn} title=${t.zoomIn} @click=${()=>this.zoom(1.1)}>
|
|
413
|
-
${
|
|
413
|
+
${we()}
|
|
414
414
|
</button>`}#c(){const t=this.maximized?this.#i.restore:this.#i.maximize;return d`<button
|
|
415
415
|
type="button"
|
|
416
416
|
class="maximize"
|
|
417
417
|
aria-label=${t}
|
|
418
418
|
title=${t}
|
|
419
419
|
aria-pressed=${this.maximized?"true":"false"}
|
|
420
|
-
@click=${()=>this.#
|
|
420
|
+
@click=${()=>this.#d(!this.maximized)}
|
|
421
421
|
>
|
|
422
|
-
${this.maximized
|
|
422
|
+
${this.maximized?$e():Fn()}
|
|
423
423
|
</button>`}#p(){const t=this.#i.restore;return d`<button
|
|
424
424
|
type="button"
|
|
425
425
|
class="exit-fullscreen"
|
|
426
426
|
aria-label=${t}
|
|
427
427
|
title=${t}
|
|
428
|
-
@click=${()=>this.#
|
|
428
|
+
@click=${()=>this.#d(!1)}
|
|
429
429
|
>
|
|
430
|
-
${
|
|
430
|
+
${$e()}
|
|
431
431
|
</button>`}#g(){const t=this.#i,e=this.#e.handlers;return d`<div
|
|
432
432
|
class="grip"
|
|
433
433
|
part="grip"
|
|
@@ -443,8 +443,8 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
443
443
|
@keydown=${e.keydown}
|
|
444
444
|
@dblclick=${e.dblclick}
|
|
445
445
|
>
|
|
446
|
-
${
|
|
447
|
-
</div>`}#
|
|
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
448
|
:host {
|
|
449
449
|
display: block;
|
|
450
450
|
flex-shrink: 0;
|
|
@@ -482,8 +482,8 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
482
482
|
border-radius: var(--dpk-radius-xs);
|
|
483
483
|
padding: 4px 8px;
|
|
484
484
|
background: transparent;
|
|
485
|
-
color: var(--dpk-ink-
|
|
486
|
-
font-size:
|
|
485
|
+
color: var(--dpk-ink-soft);
|
|
486
|
+
font-size: 11px;
|
|
487
487
|
font-weight: 600;
|
|
488
488
|
letter-spacing: 0.01em;
|
|
489
489
|
cursor: pointer;
|
|
@@ -494,7 +494,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
.diagram-match button:hover[aria-pressed='false'] {
|
|
497
|
-
color: var(--dpk-ink
|
|
497
|
+
color: var(--dpk-ink);
|
|
498
498
|
}
|
|
499
499
|
|
|
500
500
|
.diagram-match button[aria-pressed='true'] {
|
|
@@ -514,7 +514,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
514
514
|
border-radius: var(--dpk-radius-xs);
|
|
515
515
|
background: var(--dpk-paper-inset);
|
|
516
516
|
color: var(--dpk-ink-soft);
|
|
517
|
-
font-size:
|
|
517
|
+
font-size: 11px;
|
|
518
518
|
cursor: pointer;
|
|
519
519
|
transition:
|
|
520
520
|
background 140ms var(--dpk-ease),
|
|
@@ -531,7 +531,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
531
531
|
.dpk-tag[aria-pressed='true'] {
|
|
532
532
|
border-color: color-mix(in srgb, var(--dpk-blue) 45%, transparent);
|
|
533
533
|
background: var(--dpk-blue-soft);
|
|
534
|
-
color: var(--dpk-blue);
|
|
534
|
+
color: color-mix(in srgb, var(--dpk-blue) 78%, var(--dpk-ink));
|
|
535
535
|
font-weight: 600;
|
|
536
536
|
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 20%, transparent);
|
|
537
537
|
}
|
|
@@ -546,8 +546,7 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
546
546
|
.dpk-tag-count {
|
|
547
547
|
flex: none;
|
|
548
548
|
font-family: var(--dpk-mono);
|
|
549
|
-
font-size:
|
|
550
|
-
opacity: 0.7;
|
|
549
|
+
font-size: 11px;
|
|
551
550
|
font-variant-numeric: tabular-nums;
|
|
552
551
|
}
|
|
553
552
|
|
|
@@ -555,8 +554,8 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
555
554
|
border: 0;
|
|
556
555
|
background: none;
|
|
557
556
|
padding: 4px 6px;
|
|
558
|
-
color: var(--dpk-ink-
|
|
559
|
-
font-size:
|
|
557
|
+
color: var(--dpk-ink-soft);
|
|
558
|
+
font-size: 11px;
|
|
560
559
|
cursor: pointer;
|
|
561
560
|
}
|
|
562
561
|
|
|
@@ -564,37 +563,37 @@ import{ai as zt,a5 as h,ag as d,L as ce,ar as K,_ as R,a7 as z,O as T,i as B,a4
|
|
|
564
563
|
outline: none;
|
|
565
564
|
box-shadow: var(--dpk-focus);
|
|
566
565
|
}
|
|
567
|
-
`]}static{this.properties={tags:{attribute:!1},active:{attribute:!1},match:{type:String,reflect:!0}}}#a=new
|
|
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`
|
|
568
567
|
<div class="diagram-tags" part="row" role="group" aria-label=${e.tagFilter}>
|
|
569
568
|
<div class="diagram-match" role="group" aria-label=${e.tagMatch}>
|
|
570
|
-
${
|
|
569
|
+
${li.map(([s,a])=>d`
|
|
571
570
|
<button
|
|
572
571
|
type="button"
|
|
573
572
|
data-match=${s}
|
|
574
573
|
aria-pressed=${this.match===s?"true":"false"}
|
|
575
|
-
@click=${()=>this.#s(
|
|
574
|
+
@click=${()=>this.#s(Va(this.#n,s))}
|
|
576
575
|
>
|
|
577
576
|
${a}
|
|
578
577
|
</button>
|
|
579
578
|
`)}
|
|
580
579
|
</div>
|
|
581
|
-
${
|
|
580
|
+
${U(t,s=>s.tag,s=>d`
|
|
582
581
|
<button
|
|
583
582
|
type="button"
|
|
584
583
|
class="dpk-tag"
|
|
585
584
|
data-tag=${s.tag}
|
|
586
585
|
aria-pressed=${this.active.includes(s.tag)?"true":"false"}
|
|
587
|
-
@click=${()=>this.#s(
|
|
586
|
+
@click=${()=>this.#s(Ka(this.#n,s.tag))}
|
|
588
587
|
>
|
|
589
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>`}
|
|
590
589
|
</button>
|
|
591
590
|
`)}
|
|
592
|
-
${this.active.length>0?d`<button type="button" class="dpk-tag-clear" @click=${()=>this.#s(
|
|
591
|
+
${this.active.length>0?d`<button type="button" class="dpk-tag-clear" @click=${()=>this.#s(Ga(this.#n))}>
|
|
593
592
|
${e.clearTags}
|
|
594
593
|
</button>`:h}
|
|
595
594
|
</div>
|
|
596
|
-
`}get#e(){return
|
|
597
|
-
${
|
|
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=_`
|
|
598
597
|
:host {
|
|
599
598
|
display: block;
|
|
600
599
|
min-width: 0;
|
|
@@ -615,59 +614,59 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
615
614
|
font-family: var(--dpk-mono);
|
|
616
615
|
font-size: 10px;
|
|
617
616
|
}
|
|
618
|
-
`,
|
|
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}>
|
|
619
618
|
${e.title===""&&e.caption===""?h:d`<header class="dpk-chart-head">
|
|
620
619
|
${e.title===""?h:d`<span class="dpk-chart-title">${e.title}</span>`}
|
|
621
620
|
${e.caption===""?h:d`<span class="dpk-chart-value">${e.caption}</span>`}
|
|
622
621
|
</header>`}
|
|
623
622
|
<div class="dpk-chart-plot">${this.#i(e,s,a)}</div>
|
|
624
623
|
${this.#c(e)}
|
|
625
|
-
</section>`}#s(t){return d`<section class="dpk-chart" role="status">${t}</section>`}#i(t,e,s){const{plot:a,width:i,height:
|
|
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}>
|
|
626
625
|
<title>${s}</title>
|
|
627
626
|
<g class="dpk-chart-grid">
|
|
628
|
-
${e.yTicks.map(l=>
|
|
627
|
+
${e.yTicks.map(l=>H`<line x1=${a.left} x2=${a.left+a.width} y1=${l.y} y2=${l.y}></line>`)}
|
|
629
628
|
</g>
|
|
630
629
|
<g class="dpk-chart-axis">
|
|
631
|
-
<line x1=${a.left} x2=${a.left} y1=${a.top} y2=${
|
|
632
|
-
<line x1=${a.left} x2=${a.left+a.width} y1=${
|
|
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>
|
|
633
632
|
</g>
|
|
634
|
-
${e.yTicks.map(l=>
|
|
635
|
-
${e.xTicks.map(l=>
|
|
636
|
-
${t.xAxis.label===void 0?h:
|
|
637
|
-
${t.yAxis.label===void 0?h:
|
|
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>`}
|
|
638
637
|
${e.guides.map(l=>this.#o(l))}
|
|
639
638
|
${e.series.map(l=>this.#r(l))}
|
|
640
|
-
${e.marks.map(l=>this.#
|
|
641
|
-
</svg>`}#r(t){return t.path===""?h:
|
|
642
|
-
<path class="dpk-chart-line" d=${t.path} style=${
|
|
643
|
-
${t.nodes.map(e=>
|
|
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
|
|
644
643
|
class="dpk-chart-point"
|
|
645
644
|
cx=${e.x}
|
|
646
645
|
cy=${e.y}
|
|
647
646
|
r="2.5"
|
|
648
|
-
style=${
|
|
649
|
-
></circle>`)}`}#o(t){return t.path===""?h:
|
|
647
|
+
style=${K(t.tone)}
|
|
648
|
+
></circle>`)}`}#o(t){return t.path===""?h:H`<path
|
|
650
649
|
class="guide"
|
|
651
650
|
d=${t.path}
|
|
652
|
-
style=${
|
|
651
|
+
style=${K(t.tone)}
|
|
653
652
|
?data-dashed=${t.dashed}
|
|
654
|
-
></path>`}#
|
|
653
|
+
></path>`}#l(t,e,s){return H`<line
|
|
655
654
|
class="dpk-chart-mark"
|
|
656
655
|
x1=${t.x}
|
|
657
656
|
x2=${t.x}
|
|
658
657
|
y1=${e}
|
|
659
658
|
y2=${s}
|
|
660
|
-
style=${
|
|
659
|
+
style=${K(t.tone)}
|
|
661
660
|
></line>
|
|
662
|
-
<text class="dpk-chart-mark-label" x=${t.x+4} y=${e+10} style=${
|
|
661
|
+
<text class="dpk-chart-mark-label" x=${t.x+4} y=${e+10} style=${K(t.tone)}
|
|
663
662
|
>${t.label}</text
|
|
664
663
|
>`}#c(t){return t.series.length===0&&t.guides.length===0&&t.marks.length===0?h:d`<div class="dpk-chart-legend">
|
|
665
|
-
${t.series.map(e=>d`<span class="dpk-chart-key" data-variant=${e.area?"area":"line"} style=${
|
|
664
|
+
${t.series.map(e=>d`<span class="dpk-chart-key" data-variant=${e.area?"area":"line"} style=${K(e.tone)}
|
|
666
665
|
>${e.label}</span
|
|
667
666
|
>`)}
|
|
668
|
-
${t.guides.map(e=>d`<span class="dpk-chart-key" data-variant="dashed" style=${
|
|
669
|
-
${t.marks.map(e=>d`<span class="dpk-chart-key" data-variant="mark" style=${
|
|
670
|
-
</div>`}}const
|
|
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,_`
|
|
671
670
|
:host {
|
|
672
671
|
display: block;
|
|
673
672
|
container-type: inline-size;
|
|
@@ -1145,50 +1144,50 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1145
1144
|
font-size: 11px;
|
|
1146
1145
|
color: var(--dpk-accent);
|
|
1147
1146
|
}
|
|
1148
|
-
`],
|
|
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`
|
|
1149
1148
|
<section class="spec">
|
|
1150
1149
|
<header class="spec-toolbar">
|
|
1151
1150
|
<span class="spec-title">${this.heading??t.heading}</span>
|
|
1152
1151
|
${this.subject?d`<span class="spec-subject">${this.subject}</span>`:h}
|
|
1153
|
-
<span class="spec-stats">${this.#
|
|
1152
|
+
<span class="spec-stats">${this.#_(e)}</span>
|
|
1154
1153
|
</header>
|
|
1155
1154
|
${this.#e===null?h:d`<p class="spec-notice" role="alert">${t.dataError}<br />${this.#e}</p>`}
|
|
1156
1155
|
${this.#e===null&&e.claims.length===0?d`<p class="spec-empty">${t.empty}</p>`:h}
|
|
1157
1156
|
<div class="spec-groups">
|
|
1158
|
-
${
|
|
1157
|
+
${U(gs(e),s=>s.target?.id??"",s=>this.#L(s))}
|
|
1159
1158
|
</div>
|
|
1160
1159
|
</section>
|
|
1161
|
-
${this.#
|
|
1162
|
-
${this.#c.render({locale:this.#p.locale,errorMessage:this.#
|
|
1163
|
-
`}#
|
|
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)}
|
|
1164
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">
|
|
1165
|
-
${
|
|
1164
|
+
${U(t.claims,a=>a.id,a=>this.#T(a))}
|
|
1166
1165
|
</div>`,s=t.target;return s===null?e:d`<section class="target-group" data-target=${s.id}>
|
|
1167
|
-
<header class="target-head" data-dpk-target=${this.#
|
|
1168
|
-
<span class="target-label">${this.#
|
|
1166
|
+
<header class="target-head" data-dpk-target=${this.#f({kind:"target",target:s.id})}>
|
|
1167
|
+
<span class="target-label">${this.#d.target}</span>
|
|
1169
1168
|
<h3 class="target-name">${s.name}</h3>
|
|
1170
1169
|
${s.code===null?h:d`<code class="target-code">${s.code}</code>`}
|
|
1171
1170
|
</header>
|
|
1172
|
-
${s.summary===null?h:d`<p class="target-summary">${this
|
|
1173
|
-
${t.claims.length===0?d`<p class="spec-empty">${this.#
|
|
1174
|
-
</section>`}#
|
|
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`
|
|
1175
1174
|
<article class="claim" data-claim=${t.id} data-tone=${s.tone}>
|
|
1176
1175
|
<div
|
|
1177
1176
|
class="claim-head"
|
|
1178
|
-
data-dpk-target=${this.#
|
|
1179
|
-
@click=${
|
|
1177
|
+
data-dpk-target=${this.#f({kind:"claim",claim:t.id})}
|
|
1178
|
+
@click=${o=>this.#C(o,t.id)}
|
|
1180
1179
|
>
|
|
1181
1180
|
<button
|
|
1182
1181
|
type="button"
|
|
1183
1182
|
class="dpk-icon-btn claim-toggle"
|
|
1184
1183
|
aria-expanded=${a?"true":"false"}
|
|
1185
|
-
aria-controls=${a?
|
|
1184
|
+
aria-controls=${a?r:h}
|
|
1186
1185
|
aria-label=${a?e.hideDetails:e.showDetails}
|
|
1187
|
-
@click=${()=>this.#
|
|
1186
|
+
@click=${()=>this.#h(t.id)}
|
|
1188
1187
|
>
|
|
1189
|
-
${
|
|
1188
|
+
${Se()}
|
|
1190
1189
|
</button>
|
|
1191
|
-
<h4 class="claim-statement">${this
|
|
1190
|
+
<h4 class="claim-statement">${this.#M(t.statement)}</h4>
|
|
1192
1191
|
<button
|
|
1193
1192
|
type="button"
|
|
1194
1193
|
class="assurance-badge"
|
|
@@ -1202,51 +1201,51 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1202
1201
|
${s.label}
|
|
1203
1202
|
</button>
|
|
1204
1203
|
</div>
|
|
1205
|
-
${a?this.#
|
|
1204
|
+
${a?this.#D(t,r):h}
|
|
1206
1205
|
</article>
|
|
1207
|
-
`}#
|
|
1206
|
+
`}#D(t,e){const s=this.#d,a=te(s,t.assurance);return d`<div class="claim-body" id=${e}>
|
|
1208
1207
|
<dl class="claim-parts">
|
|
1209
|
-
${t.subjects.length===0?h:this.#
|
|
1208
|
+
${t.subjects.length===0?h:this.#A("subjects",s.subjects,t,t.subjects)}
|
|
1210
1209
|
${t.premises.length===0?d`<div class="claim-part" data-part="premises">
|
|
1211
1210
|
<dt>${s.premises}</dt>
|
|
1212
1211
|
<dd><p class="claim-none">${s.noPremises}</p></dd>
|
|
1213
|
-
</div>`:this.#
|
|
1214
|
-
${this.#
|
|
1212
|
+
</div>`:this.#A("premises",s.premises,t,t.premises)}
|
|
1213
|
+
${this.#A("conclusions",s.conclusions,t,t.conclusions)}
|
|
1215
1214
|
</dl>
|
|
1216
1215
|
${a.itemsLabel===null?h:d`<div class="assurance" data-tone=${a.tone}>
|
|
1217
1216
|
<p class="assurance-label">${a.itemsLabel}</p>
|
|
1218
1217
|
<ul>
|
|
1219
|
-
${a.items.map(i=>d`<li>${this
|
|
1218
|
+
${a.items.map(i=>d`<li>${this.#M(i)}</li>`)}
|
|
1220
1219
|
</ul>
|
|
1221
1220
|
</div>`}
|
|
1222
1221
|
${t.examples.length===0?h:d`<section class="claim-aside" data-part="examples">
|
|
1223
1222
|
<h5>${s.examples}</h5>
|
|
1224
|
-
${this.#
|
|
1223
|
+
${this.#P(t,t.examples)}
|
|
1225
1224
|
</section>`}
|
|
1226
1225
|
${t.notClaimed.length===0?h:d`<section class="claim-aside" data-part="not-claimed">
|
|
1227
1226
|
<h5>${s.notClaimed}</h5>
|
|
1228
|
-
${this.#
|
|
1227
|
+
${this.#P(t,t.notClaimed)}
|
|
1229
1228
|
</section>`}
|
|
1230
|
-
${this.#
|
|
1231
|
-
</div>`}#
|
|
1229
|
+
${this.#O(t)}
|
|
1230
|
+
</div>`}#A(t,e,s,a){return d`<div class="claim-part" data-part=${t}>
|
|
1232
1231
|
<dt>${e}</dt>
|
|
1233
|
-
<dd>${this.#
|
|
1234
|
-
</div>`}#
|
|
1235
|
-
${
|
|
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
|
|
1236
1235
|
class="clause"
|
|
1237
1236
|
data-clause=${s.id}
|
|
1238
|
-
data-dpk-target=${this.#
|
|
1237
|
+
data-dpk-target=${this.#f({kind:"clause",claim:t.id,clause:s.id})}
|
|
1239
1238
|
>
|
|
1240
|
-
<span class="clause-text">${this
|
|
1239
|
+
<span class="clause-text">${this.#M(s.text)}</span>
|
|
1241
1240
|
</li>`)}
|
|
1242
|
-
</ul>`}#
|
|
1243
|
-
${s.length===0?h:d`<span class="claim-foot-label">${e.usesTerms}</span> ${s.map(a=>this
|
|
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))}`}
|
|
1244
1243
|
${t.source===null?h:d`<span class="claim-source"
|
|
1245
1244
|
>${e.source}: ${t.source.tool===null?h:d`${t.source.tool} · `}<code
|
|
1246
1245
|
>${t.source.ref}</code
|
|
1247
1246
|
></span
|
|
1248
1247
|
>`}
|
|
1249
|
-
</footer>`}
|
|
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
|
|
1250
1249
|
type="button"
|
|
1251
1250
|
class=${t}
|
|
1252
1251
|
data-term=${e}
|
|
@@ -1257,7 +1256,7 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1257
1256
|
@click=${a.show}
|
|
1258
1257
|
>
|
|
1259
1258
|
${s}
|
|
1260
|
-
</button>`}#
|
|
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
|
|
1261
1260
|
id="spec-tip"
|
|
1262
1261
|
class="spec-tip"
|
|
1263
1262
|
role="tooltip"
|
|
@@ -1266,10 +1265,10 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1266
1265
|
>
|
|
1267
1266
|
<p class="tip-title">${e.title}</p>
|
|
1268
1267
|
<p class="tip-body">${e.body}</p>
|
|
1269
|
-
</div>`}#
|
|
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,`
|
|
1270
1269
|
`).replace(/<\\\/script/gi,"<\/script").split(`
|
|
1271
|
-
`),e=t.findIndex(
|
|
1272
|
-
`,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 o=/^[0-7]{3}/.exec(n.slice(a+1))?.[0];if(o!==void 0){t.push(Number.parseInt(o,8)),a+=3;continue}const r=n.charAt(a+1);t.push(...e.encode(s[r]??r)),a+=1}return new TextDecoder().decode(new Uint8Array(t))},lt=n=>{const t=n.trimEnd();if(t.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(t)?.[0];if(s!==void 0)return os(s)}const e=t.indexOf(" ");return e===-1?t:t.slice(0,e)},dt=(n,t)=>n.startsWith(t)?n.slice(t.length):n,ls=(n,t)=>{const e=lt(n);return e==="/dev/null"?null:dt(e,t)},ii=n=>{if(n.startsWith('"')){const s=/^"(?:\\.|[^\\"])*"/.exec(n)?.[0];if(s===void 0)return[null,null];const a=n.slice(s.length).trimStart();return[dt(os(s),"a/"),dt(lt(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]:[dt(n.slice(0,e),"a/"),dt(lt(n.slice(e+1)),"b/")]},ds=()=>({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}),ri=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(r=>({oldStart:r.oldStart,oldCount:r.oldCount,newStart:r.newStart,newCount:r.newCount,section:r.section,lines:r.lines})),o=i.flatMap(r=>r.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:o.filter(r=>r.kind==="add").length,deletions:o.filter(r=>r.kind==="del").length}},oi=(n,t)=>{const e=ni.exec(n);if(e===null)throw new Error(`line ${t}: unreadable hunk header "${n}"`);const[,s="0",a="1",i="0",o="1",r=""]=e,l={oldCount:Number(a),newCount:Number(o)};return{oldStart:Number(s),newStart:Number(i),...l,section:r.trim(),lines:[],oldLeft:l.oldCount,newLeft:l.newCount}},li=(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},cs=n=>{const t=n?.lines.at(-1);n!==void 0&&t!==void 0&&(n.lines[n.lines.length-1]={...t,noNewline:!0})},ps=n=>{const t=ai(n),e=[];let s=null,a=null;const i=()=>{s!==null&&e.push(ri(s)),s=null,a=null};for(const[r,l]of t.entries()){const u=r+1,c=a;if(c!==null){if(c.oldLeft>0||c.newLeft>0){if(l.startsWith("\\")){cs(c);continue}if(li(c,l))continue}else if(l.startsWith("\\")){cs(c);continue}a=null}if(l.startsWith("diff --git ")){i();const b=ds();[b.headerOld,b.headerNew]=ii(l.slice(11)),s=b;continue}if(l.startsWith("diff --cc ")||l.startsWith("diff --combined "))throw new Error(`line ${u}: combined (merge) diffs are not supported`);if(l.startsWith("--- ")&&(t[r+1]??"").startsWith("+++ ")){const b=s;(b===null||b.hunks.length>0||b.sawOld)&&(i(),s=ds()),s!==null&&(s.oldPath=ls(l.slice(4),"a/"),s.sawOld=!0);continue}const g=s;if(!(g===null||g.skipping)){if(l.startsWith("+++ ")&&g.hunks.length===0&&!g.sawNew){g.newPath=ls(l.slice(4),"b/"),g.sawNew=!0;continue}if(l.startsWith("@@ ")){const b=oi(l,u);g.hunks.push(b),a=b;continue}g.hunks.length>0||di(g,l)}}if(i(),e.length===0&&t.length>0)throw new Error("no file diff found (expected the output of git diff)");const o=new Set;for(const r of e){if(o.has(r.path))throw new Error(`the diff has ${r.path} twice`);o.add(r.path)}return{files:e}},di=(n,t)=>{const e=r=>t.startsWith(r)?t.slice(r.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 o=e("new mode ");if(o!==null){n.newMode=o.trim();return}for(const[r,l,u]of[["rename from ","old","renamed"],["rename to ","new","renamed"],["copy from ","old","copied"],["copy to ","new","copied"]]){const c=e(r);if(c!==null){n.status=u,l==="old"?n.oldPath=lt(c):n.newPath=lt(c);return}}if(t.startsWith("Binary files ")&&t.endsWith(" differ")){n.binary=!0;return}t==="GIT binary patch"&&(n.binary=!0,n.skipping=!0)},x=(n,t,e)=>e===void 0?{kind:n,pattern:t}:{kind:n,pattern:t,next:e},ct=x(null,/\s+/y),_t=x("string",/"(?:\\.|[^\\"\n])*"?|'(?:\\.|[^\\'\n])*'?/y),Bt=x("comment",/\/\*[\s\S]*?(?:\*\/|$)/y),ci=["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"],pi={js:{start:"code",rules:{code:[ct,x("comment",/\/\/[^\n]*/y),Bt,x("string",/`(?:\\[\s\S]|[^\\`])*`?/y),_t,x("number",/(?:0[xob][\da-f_]+|\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?)n?/iy),x("keyword",new RegExp(`(?:${ci.join("|")})(?![\\w$])`,"y")),x("function",/[A-Za-z_$][\w$]*(?=\s*\()/y),x(null,/[A-Za-z_$][\w$]*/y)]}},html:{start:"text",rules:{text:[x("comment",/<!--[\s\S]*?(?:-->|$)/y),x("keyword",/&#?\w+;/y),x("tag",/<\/?[A-Za-z][\w:.-]*/y,"tag"),x(null,/[^<&]+/y)],tag:[ct,x("tag",/\/?>/y,"text"),x("punct",/=/y),x("string",/"[^"]*"?|'[^']*'?/y),x("attr",/[^\s=>/"']+/y)]}},css:{start:"sheet",rules:{sheet:[ct,Bt,_t,x("keyword",/@[\w-]+/y),x("punct",/[{}]/y),x("tag",/[^{};]+(?=\{)/y),x("property",/-{0,2}[A-Za-z][\w-]*(?=\s*:)/y),x("number",/#[\da-f]{3,8}(?![\w-])/iy),x(null,/-?[A-Za-z_][\w-]*/y),x("number",/-?(?:\d*\.)?\d+[a-z%]*/iy)]}},json:{start:"value",rules:{value:[ct,x("comment",/\/\/[^\n]*/y),Bt,x("property",/"(?:\\.|[^\\"\n])*"(?=\s*:)/y),x("string",/"(?:\\.|[^\\"\n])*"?/y),x("number",/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/iy),x("keyword",/(?:true|false|null)(?!\w)/y)]}},sh:{start:"line",rules:{line:[ct,x("comment",/(?<!\S)#[^\n]*/y),_t,x("keyword",/\$\{[^}\n]*\}?|\$\w+/y),x("attr",/(?<!\S)--?[\w-]+/y),x(null,/[^\s"'$#]+/y)]}}},hi={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"},ui=n=>n===null?null:hi[n.trim().toLowerCase()]??null,hs=(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})},Gt=(n,t)=>{const e=ui(t);if(e===null)return n===""?[]:[{kind:null,text:n}];const{start:s,rules:a}=pi[e],i=[];let o=s,r=0;for(;r<n.length;){const l=(a[o]??[]).find(u=>(u.pattern.lastIndex=r,u.pattern.test(n)&&u.pattern.lastIndex>r));if(l===void 0){hs(i,null,n.charAt(r)),r+=1;continue}hs(i,l.kind,n.slice(r,l.pattern.lastIndex)),r=l.pattern.lastIndex,o=l.next??o}return i},gi=n=>n.kind==="file"?["file",n.path]:["line",n.path,n.line],us=n=>{const t=n.slice(n.lastIndexOf("/")+1),e=t.lastIndexOf(".");return e<=0?null:t.slice(e+1)},wt=/[\p{L}\p{N}_$]/u,mi=(n,t)=>{let e=t;for(;e>0&&wt.test(n.charAt(e-1))&&wt.test(n.charAt(e));)e-=1;return e},fi=(n,t)=>{let e=t;for(;e<n.length&&wt.test(n.charAt(e))&&wt.test(n.charAt(e-1));)e+=1;return e},bi=(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 o=r=>{const l=mi(r,s),u=fi(r,r.length-a);return[l,Math.max(l,u)]};return{before:o(n),after:o(t)}},ki=(n,t,e)=>{const s=[];let a=0;for(const i of Gt(n,t)){const o=a+i.text.length,r=e===null?[]:e.filter(u=>u>a&&u<o);let l=a;for(const u of[...r,o]){const c=i.text.slice(l-a,u-a),g=e!==null&&l>=e[0]&&u<=e[1]&&e[0]<e[1];c!==""&&s.push({kind:i.kind,text:c,changed:g}),l=u}a=o}return s},gs=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 o=bi(a.text,i.text);o!==null&&(t.set(a,o.before),t.set(i,o.after))}return t},ms=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},pt=(n,t,e,s=!0)=>({line:n,id:ot(n),segments:ki(n.text,t,e.get(n)??null),target:s}),vi=n=>{const t=us(n.path);return n.hunks.flatMap(e=>{const s=gs(ms(e));return[{kind:"hunk",hunk:e},...e.lines.map(a=>({kind:"line",cell:pt(a,t,s)}))]})},xi=n=>{const t=us(n.path);return n.hunks.flatMap(e=>{const s=ms(e),a=gs(s),i=[{kind:"hunk",hunk:e}];for(const o of s){if(o.kind==="context"){i.push({kind:"pair",left:pt(o.line,t,a,!1),right:pt(o.line,t,a)});continue}for(let r=0;r<Math.max(o.dels.length,o.adds.length);r+=1){const l=o.dels[r],u=o.adds[r];i.push({kind:"pair",left:l===void 0?null:pt(l,t,a),right:u===void 0?null:pt(u,t,a)})}}return i})},fs=40,yi=n=>{const t=n.trim().replace(/\s+/g," ");return t.length>fs?`${t.slice(0,fs-1)}\u2026`:t},wi=(n,t)=>t.startsWith("R")?t.slice(1):n.deletedLine(`-${t.slice(1)}`),bs=(n,t,e)=>n.lineLabel(t,wi(n,ot(e)),yi(e.text)),$i=(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:ot(a)},label:bs(n,e.path,a)})))]),Ci=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)}),Si=[T,B,mt,M`
|
|
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,_`
|
|
1273
1272
|
:host {
|
|
1274
1273
|
display: block;
|
|
1275
1274
|
color: var(--dpk-ink);
|
|
@@ -1868,8 +1867,8 @@ ${fe.cssText}`,document.head.append(t)},Sa=R({en:{aria:"Line chart",empty:"No da
|
|
|
1868
1867
|
padding: 8px 12px;
|
|
1869
1868
|
border-top: 1px solid var(--dpk-rule);
|
|
1870
1869
|
}
|
|
1871
|
-
`],
|
|
1872
|
-
${t}`,
|
|
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`
|
|
1873
1872
|
<section class="diff" data-view=${s}>
|
|
1874
1873
|
<header class="toolbar">
|
|
1875
1874
|
<span class="title">${this.heading??t.heading}</span>
|
|
@@ -1882,7 +1881,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1882
1881
|
${["unified","split"].map(a=>d`<button
|
|
1883
1882
|
type="button"
|
|
1884
1883
|
aria-pressed=${s===a?"true":"false"}
|
|
1885
|
-
@click=${()=>this.#
|
|
1884
|
+
@click=${()=>this.#B(a)}
|
|
1886
1885
|
>
|
|
1887
1886
|
${t[a]}
|
|
1888
1887
|
</button>`)}
|
|
@@ -1890,10 +1889,10 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1890
1889
|
</header>
|
|
1891
1890
|
${this.#i===null?h:d`<p class="notice" role="alert">${t.dataError}<br />${this.#i}</p>`}
|
|
1892
1891
|
${this.#i===null&&e.files===0?d`<p class="empty">${t.empty}</p>`:h}
|
|
1893
|
-
${
|
|
1892
|
+
${U(this.#s.files,a=>a.path,a=>this.#N(a,s))}
|
|
1894
1893
|
</section>
|
|
1895
|
-
${this.#t.render({locale:this.#a.locale,errorMessage:t.sendFailed,submit:(a,i)=>this.#
|
|
1896
|
-
`}#
|
|
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}>
|
|
1897
1896
|
<header class="file-head" data-dpk-target=${this.id?i:h}>
|
|
1898
1897
|
<button
|
|
1899
1898
|
type="button"
|
|
@@ -1901,32 +1900,32 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1901
1900
|
data-size="sm"
|
|
1902
1901
|
aria-expanded=${a?"true":"false"}
|
|
1903
1902
|
aria-label=${a?s.collapse(t.path):s.expand(t.path)}
|
|
1904
|
-
@click=${()=>this.#
|
|
1903
|
+
@click=${()=>this.#I(t.path)}
|
|
1905
1904
|
>
|
|
1906
|
-
${
|
|
1905
|
+
${Se()}
|
|
1907
1906
|
</button>
|
|
1908
1907
|
<span class="status" data-status=${t.status}>${s[t.status]}</span>
|
|
1909
1908
|
<span class="path"
|
|
1910
|
-
>${
|
|
1909
|
+
>${r?d`<span class="old-path">${t.oldPath}</span> → `:h}${t.path}</span
|
|
1911
1910
|
>
|
|
1912
1911
|
<span class="file-stat"
|
|
1913
1912
|
><span class="stat-add">+${t.additions}</span> <span class="stat-del">−${t.deletions}</span></span
|
|
1914
1913
|
>
|
|
1915
1914
|
${this.id?this.#Y(i,t.path):h}
|
|
1916
1915
|
</header>
|
|
1917
|
-
${a?this.#Z(i):h} ${a?this.#
|
|
1918
|
-
</section>`}#
|
|
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">
|
|
1919
1918
|
<table class="lines" data-view=${e}>
|
|
1920
|
-
${e==="split"?this.#
|
|
1919
|
+
${e==="split"?this.#j(t):this.#V(t)}
|
|
1921
1920
|
</table>
|
|
1922
|
-
</div>`}#
|
|
1921
|
+
</div>`}#V(t){return d`<colgroup>
|
|
1923
1922
|
<col class="col-num" />
|
|
1924
1923
|
<col class="col-num" />
|
|
1925
1924
|
<col class="col-act" />
|
|
1926
1925
|
<col />
|
|
1927
1926
|
</colgroup>
|
|
1928
1927
|
<tbody>
|
|
1929
|
-
${
|
|
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
|
|
1930
1929
|
class="line"
|
|
1931
1930
|
data-kind=${s.line.kind}
|
|
1932
1931
|
data-line=${s.id}
|
|
@@ -1934,11 +1933,11 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1934
1933
|
>
|
|
1935
1934
|
<td class="num">${s.line.oldLine??""}</td>
|
|
1936
1935
|
<td class="num">${s.line.newLine??""}</td>
|
|
1937
|
-
<td class="act">${this.#
|
|
1936
|
+
<td class="act">${this.#J(t,s,a)}</td>
|
|
1938
1937
|
${this.#W(s)}
|
|
1939
1938
|
</tr>
|
|
1940
|
-
${this.#
|
|
1941
|
-
</tbody>`}#
|
|
1939
|
+
${this.#G(t,s,Ps)}`})}
|
|
1940
|
+
</tbody>`}#j(t){return d`<colgroup>
|
|
1942
1941
|
<col class="col-num" />
|
|
1943
1942
|
<col class="col-act" />
|
|
1944
1943
|
<col class="col-half" />
|
|
@@ -1947,15 +1946,15 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1947
1946
|
<col class="col-half" />
|
|
1948
1947
|
</colgroup>
|
|
1949
1948
|
<tbody>
|
|
1950
|
-
${
|
|
1949
|
+
${ir(t).map(e=>e.kind==="hunk"?this.#H(e.hunk,ie):d`<tr class="pair">
|
|
1951
1950
|
${this.#F(t,e.left,"old")} ${this.#F(t,e.right,"new")}
|
|
1952
1951
|
</tr>
|
|
1953
|
-
${e.left!==null&&e.left.target?this.#
|
|
1954
|
-
${e.right===null?h:this.#
|
|
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)}`)}
|
|
1955
1954
|
</tbody>`}#F(t,e,s){if(e===null)return d`<td class="num" data-blank></td>
|
|
1956
1955
|
<td class="act" data-blank></td>
|
|
1957
|
-
<td class="code" data-blank></td>`;const a=this.#
|
|
1958
|
-
<td class="act" data-kind=${e.line.kind}>${this.#
|
|
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>
|
|
1959
1958
|
${this.#W(e,a)}`}#H(t,e){const s=`@@ -${t.oldStart},${t.oldCount} +${t.newStart},${t.newCount} @@`;return d`<tr class="hunk">
|
|
1960
1959
|
<td colspan=${e}>
|
|
1961
1960
|
<span class="hunk-range">${s}</span
|
|
@@ -1965,62 +1964,62 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
1965
1964
|
<span class="sign" aria-hidden="true">${s}</span
|
|
1966
1965
|
><span class="text"
|
|
1967
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
|
|
1968
|
-
>${t.line.noNewline?d`<span class="no-newline" title=${this.#
|
|
1969
|
-
</td>`}#
|
|
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}
|
|
1970
1969
|
><button
|
|
1971
1970
|
type="button"
|
|
1972
1971
|
class="line-btn"
|
|
1973
|
-
aria-label=${this.#
|
|
1972
|
+
aria-label=${this.#h.addOn(a)}
|
|
1974
1973
|
aria-expanded=${i?"true":"false"}
|
|
1975
|
-
title=${this.#
|
|
1974
|
+
title=${this.#h.addOn(a)}
|
|
1976
1975
|
@click=${()=>this.#L({ref:s,path:t.path,line:e.line,label:a},"comment")}
|
|
1977
1976
|
>
|
|
1978
|
-
${
|
|
1977
|
+
${we()}
|
|
1979
1978
|
</button></span
|
|
1980
1979
|
>`}#Y(t,e){return d`<button
|
|
1981
1980
|
type="button"
|
|
1982
1981
|
class="dpk-icon-btn"
|
|
1983
1982
|
data-size="sm"
|
|
1984
|
-
aria-label=${this.#
|
|
1985
|
-
title=${this.#
|
|
1986
|
-
@click=${()=>this.#
|
|
1983
|
+
aria-label=${this.#h.commentOn(e)}
|
|
1984
|
+
title=${this.#h.commentOn(e)}
|
|
1985
|
+
@click=${()=>this.#E(t,e)}
|
|
1987
1986
|
>
|
|
1988
|
-
${
|
|
1989
|
-
</button>`}#
|
|
1990
|
-
<td colspan=${s}>${this.#
|
|
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>
|
|
1991
1990
|
</tr>`}${a.map(l=>d`<tr class="extra">
|
|
1992
1991
|
<td colspan=${s}>${this.#Q(e.line,l)}</td>
|
|
1993
|
-
</tr>`)}${
|
|
1994
|
-
<td colspan=${s}>${this.#tt(
|
|
1995
|
-
</tr>`}`}#Z(t){const e=this.#
|
|
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)}>
|
|
1996
1995
|
<ol class="thread-items">
|
|
1997
|
-
${e.map(l=>{const
|
|
1996
|
+
${e.map(l=>{const c=new Date(l.createdAt);return d`<li class="thread-item" data-comment=${l.id}>
|
|
1998
1997
|
<p class="thread-meta">
|
|
1999
|
-
${
|
|
2000
|
-
${Number.isNaN(
|
|
1998
|
+
${$t()}
|
|
1999
|
+
${Number.isNaN(c.getTime())?h:d`<time datetime=${l.createdAt}>${o.format(c)}</time>`}
|
|
2001
2000
|
</p>
|
|
2002
|
-
<p class="thread-body">${
|
|
2001
|
+
<p class="thread-body">${Wn(l)}</p>
|
|
2003
2002
|
</li>`})}
|
|
2004
2003
|
</ol>
|
|
2005
|
-
${this.#
|
|
2004
|
+
${this.#k===t?d`<div
|
|
2006
2005
|
class="thread-compose"
|
|
2007
|
-
@keydown=${l=>{l.isComposing||(l.key==="Escape"?(l.preventDefault(),l.stopPropagation(),this.#
|
|
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)))}}
|
|
2008
2007
|
>
|
|
2009
2008
|
<textarea
|
|
2010
2009
|
class="dpk-textarea"
|
|
2011
2010
|
rows="3"
|
|
2012
2011
|
aria-label=${s.reply}
|
|
2013
2012
|
data-dpk-text-key=${i}
|
|
2014
|
-
.value=${
|
|
2015
|
-
@input=${l=>{l.currentTarget instanceof HTMLTextAreaElement&&(this.#
|
|
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())}}
|
|
2016
2015
|
></textarea>
|
|
2017
|
-
${this.#
|
|
2016
|
+
${this.#m===i?d`<p class="composer-error" role="alert">${s.sendFailed}</p>`:h}
|
|
2018
2017
|
<div class="composer-actions">
|
|
2019
2018
|
<button
|
|
2020
2019
|
class="dpk-btn dpk-btn--accent"
|
|
2021
2020
|
type="button"
|
|
2022
|
-
?disabled=${
|
|
2023
|
-
@click=${()=>this.#
|
|
2021
|
+
?disabled=${r.trim()===""}
|
|
2022
|
+
@click=${()=>this.#P(t)}
|
|
2024
2023
|
>
|
|
2025
2024
|
${s.reply}
|
|
2026
2025
|
</button>
|
|
@@ -2028,17 +2027,17 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2028
2027
|
class="dpk-btn dpk-btn--ghost"
|
|
2029
2028
|
type="button"
|
|
2030
2029
|
data-dpk-text-discard
|
|
2031
|
-
@click=${()=>this.#
|
|
2030
|
+
@click=${()=>this.#A(!0)}
|
|
2032
2031
|
>
|
|
2033
2032
|
${s.cancel}
|
|
2034
2033
|
</button>
|
|
2035
2034
|
</div>
|
|
2036
|
-
</div>`:d`<button type="button" class="thread-reply" @click=${()=>this.#
|
|
2035
|
+
</div>`:d`<button type="button" class="thread-reply" @click=${()=>this.#D(t)}>
|
|
2037
2036
|
${s.replyPlaceholder}
|
|
2038
2037
|
</button>`}
|
|
2039
2038
|
</section>`}#Q(t,e){const s=e.text===""?[]:e.text.split(`
|
|
2040
2039
|
`);return d`<div class="suggestion" data-action=${e.action}>
|
|
2041
|
-
<p class="suggestion-head">${
|
|
2040
|
+
<p class="suggestion-head">${Bn()} ${this.#h.suggestion}</p>
|
|
2042
2041
|
<div class="suggestion-lines">
|
|
2043
2042
|
<div class="suggestion-line" data-kind="del">
|
|
2044
2043
|
<span class="sign">-</span><span class="text">${t.text}</span>
|
|
@@ -2047,28 +2046,28 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2047
2046
|
<span class="sign">+</span><span class="text">${a}</span>
|
|
2048
2047
|
</div>`)}
|
|
2049
2048
|
</div>
|
|
2050
|
-
</div>`}#tt(t){const e=this.#
|
|
2051
|
-
`).length+1)),i=
|
|
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
|
|
2052
2051
|
class="composer-tabs"
|
|
2053
2052
|
role="tablist"
|
|
2054
2053
|
aria-label=${e.composerTabs}
|
|
2055
|
-
@keydown=${
|
|
2054
|
+
@keydown=${o=>{o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),this.#T(t.tab==="comment"?"suggest":"comment","tab"))}}
|
|
2056
2055
|
>
|
|
2057
|
-
${["comment","suggest"].map(
|
|
2056
|
+
${["comment","suggest"].map(o=>d`<button
|
|
2058
2057
|
type="button"
|
|
2059
2058
|
role="tab"
|
|
2060
|
-
aria-selected=${t.tab===
|
|
2061
|
-
tabindex=${t.tab===
|
|
2062
|
-
@click=${()=>this.#
|
|
2059
|
+
aria-selected=${t.tab===o?"true":"false"}
|
|
2060
|
+
tabindex=${t.tab===o?0:-1}
|
|
2061
|
+
@click=${()=>this.#T(o,"text")}
|
|
2063
2062
|
>
|
|
2064
|
-
${
|
|
2063
|
+
${o==="comment"?e.comment:e.suggestChange}
|
|
2065
2064
|
</button>`)}
|
|
2066
2065
|
</div>`:d`<strong class="composer-title">${e.comment}</strong>`;return d`<div
|
|
2067
2066
|
class="composer"
|
|
2068
2067
|
data-tab=${t.tab}
|
|
2069
|
-
@keydown=${
|
|
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.#$()))}}
|
|
2070
2069
|
>
|
|
2071
|
-
<div class="composer-head">${
|
|
2070
|
+
<div class="composer-head">${r}<span class="composer-target">${t.label}</span></div>
|
|
2072
2071
|
<textarea
|
|
2073
2072
|
class="dpk-textarea"
|
|
2074
2073
|
rows=${a}
|
|
@@ -2076,15 +2075,15 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2076
2075
|
aria-label=${t.tab==="suggest"?e.suggestionLabel:e.comment}
|
|
2077
2076
|
data-dpk-text-key=${i}
|
|
2078
2077
|
.value=${s}
|
|
2079
|
-
@input=${
|
|
2078
|
+
@input=${o=>{o.currentTarget instanceof HTMLTextAreaElement&&(this.#d=new Map(this.#d).set(i,o.currentTarget.value),this.#m=null,this.requestUpdate())}}
|
|
2080
2079
|
></textarea>
|
|
2081
|
-
${this.#
|
|
2080
|
+
${this.#m===i?d`<p class="composer-error" role="alert">${e.unrecorded}</p>`:h}
|
|
2082
2081
|
<div class="composer-actions">
|
|
2083
2082
|
<button
|
|
2084
2083
|
class="dpk-btn dpk-btn--accent"
|
|
2085
2084
|
type="button"
|
|
2086
|
-
?disabled=${!this.#
|
|
2087
|
-
@click=${()=>this
|
|
2085
|
+
?disabled=${!this.#R(t)}
|
|
2086
|
+
@click=${()=>this.#$()}
|
|
2088
2087
|
>
|
|
2089
2088
|
${t.tab==="suggest"?e.suggest:e.addComment}
|
|
2090
2089
|
</button>
|
|
@@ -2092,12 +2091,844 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2092
2091
|
class="dpk-btn dpk-btn--ghost"
|
|
2093
2092
|
type="button"
|
|
2094
2093
|
data-dpk-text-discard
|
|
2095
|
-
@click=${()=>this.#
|
|
2094
|
+
@click=${()=>this.#O(!0)}
|
|
2096
2095
|
>
|
|
2097
2096
|
${e.cancel}
|
|
2098
2097
|
</button>
|
|
2099
2098
|
</div>
|
|
2100
|
-
</div>`}}const
|
|
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,_`
|
|
2101
2932
|
:host {
|
|
2102
2933
|
position: relative;
|
|
2103
2934
|
display: block;
|
|
@@ -2110,11 +2941,11 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2110
2941
|
font-size: 11px;
|
|
2111
2942
|
color: var(--dpk-accent);
|
|
2112
2943
|
}
|
|
2113
|
-
`]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new
|
|
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=_`
|
|
2114
2945
|
:host {
|
|
2115
2946
|
display: contents;
|
|
2116
2947
|
}
|
|
2117
|
-
`}static{this.properties={config:{attribute:!1}}}#a=null;#t=null;#e=null;#n=null;constructor(){super(),this.config=null}connectedCallback(){super.connectedCallback(),this.#e=
|
|
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,_`
|
|
2118
2949
|
:host {
|
|
2119
2950
|
position: relative;
|
|
2120
2951
|
display: inline-block;
|
|
@@ -2127,7 +2958,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2127
2958
|
simply being there when the reader looks back. */
|
|
2128
2959
|
animation: dpk-rise-in var(--dpk-dur-fast) var(--dpk-ease-out);
|
|
2129
2960
|
}
|
|
2130
|
-
`]}static{this.properties={target:{type:String},label:{type:String},open:{type:Boolean,reflect:!0}}}#a=new
|
|
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,_`
|
|
2131
2962
|
:host {
|
|
2132
2963
|
display: block;
|
|
2133
2964
|
font-size: inherit;
|
|
@@ -2220,9 +3051,9 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2220
3051
|
::slotted([data-name]) {
|
|
2221
3052
|
animation: dpk-fade-in var(--dpk-dur) var(--dpk-ease) backwards;
|
|
2222
3053
|
}
|
|
2223
|
-
`]}static{this.properties={selected:{type:String,reflect:!0}}}#a=`dpk-tabs-${++
|
|
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}>
|
|
2224
3055
|
<span class="indicator" aria-hidden="true"></span>
|
|
2225
|
-
${
|
|
3056
|
+
${U(e,(a,i)=>`${i}:${a}`,(a,i)=>d`<button
|
|
2226
3057
|
type="button"
|
|
2227
3058
|
role="tab"
|
|
2228
3059
|
id="${this.#a}-tab-${i}"
|
|
@@ -2236,7 +3067,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2236
3067
|
</div>
|
|
2237
3068
|
<div role="tabpanel" id="${this.#a}-panel" aria-labelledby="${this.#a}-tab-${s}">
|
|
2238
3069
|
<slot></slot>
|
|
2239
|
-
</div>`}updated(t){const e=this.#n,s=e.map(i=>i.dataset.name??""),a=e[
|
|
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,_`
|
|
2240
3071
|
:host {
|
|
2241
3072
|
display: block;
|
|
2242
3073
|
color: var(--dpk-ink);
|
|
@@ -2435,7 +3266,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2435
3266
|
.error {
|
|
2436
3267
|
color: var(--dpk-danger);
|
|
2437
3268
|
}
|
|
2438
|
-
`]}static{this.properties={id:{type:String,reflect:!0},heading:{type:String}}}#a=new
|
|
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">
|
|
2439
3270
|
<div class="head">
|
|
2440
3271
|
<span class="heading">${this.#c}</span>
|
|
2441
3272
|
<span class="count" aria-label=${a}
|
|
@@ -2453,9 +3284,9 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2453
3284
|
<div class="fill" style=${`width: ${s*100}%`}></div>
|
|
2454
3285
|
</div>
|
|
2455
3286
|
${this.#s.items.length===0?d`<p class="empty">${t.empty}</p>`:d`<ul>
|
|
2456
|
-
${
|
|
3287
|
+
${U(this.#s.items,i=>i.id,i=>this.#p(t,i))}
|
|
2457
3288
|
</ul>`}
|
|
2458
|
-
</div>`}get#
|
|
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}>
|
|
2459
3290
|
<span class="check">
|
|
2460
3291
|
<input
|
|
2461
3292
|
id=${s}
|
|
@@ -2464,7 +3295,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2464
3295
|
.checked=${e.checked}
|
|
2465
3296
|
@change=${a=>{a.currentTarget instanceof HTMLInputElement&&this.#g(e,a.currentTarget.checked)}}
|
|
2466
3297
|
/>
|
|
2467
|
-
<span class="check-mark">${
|
|
3298
|
+
<span class="check-mark">${Ct()}</span>
|
|
2468
3299
|
</span>
|
|
2469
3300
|
<label for=${s}>
|
|
2470
3301
|
<span class="label">${e.label}</span>
|
|
@@ -2476,11 +3307,11 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2476
3307
|
type="button"
|
|
2477
3308
|
aria-label=${t.commentOn(e.label)}
|
|
2478
3309
|
title=${t.commentOn(e.label)}
|
|
2479
|
-
@click=${()=>{this.#
|
|
3310
|
+
@click=${()=>{this.#u(e.id)}}
|
|
2480
3311
|
>
|
|
2481
|
-
${
|
|
3312
|
+
${$t()}
|
|
2482
3313
|
</button>`:h}
|
|
2483
|
-
</li>`}#g(t,e){const s=new CustomEvent("dpk-element-action",{detail:{type:
|
|
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=_`
|
|
2484
3315
|
:host {
|
|
2485
3316
|
display: block;
|
|
2486
3317
|
overflow: hidden;
|
|
@@ -2597,16 +3428,16 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2597
3428
|
.punct {
|
|
2598
3429
|
color: var(--dpk-code-punct, var(--dpk-ink-soft));
|
|
2599
3430
|
}
|
|
2600
|
-
`,
|
|
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">
|
|
2601
3432
|
<span class="name">${e}</span>
|
|
2602
3433
|
${this.language?d`<span class="language">${this.language}</span>`:h}
|
|
2603
3434
|
<button type="button" data-state=${this.#e} aria-label=${t.copyLabel(e)} @click=${this.#r}>
|
|
2604
|
-
${this.#e==="copied"?
|
|
3435
|
+
${this.#e==="copied"?Ct():Me()}<span aria-live="polite">${s}</span>
|
|
2605
3436
|
</button>
|
|
2606
3437
|
</div>
|
|
2607
|
-
<pre><code>${this.#s()}</code></pre>`}#s(){return
|
|
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(`
|
|
2608
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(`
|
|
2609
|
-
`)},
|
|
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=_`
|
|
2610
3441
|
:host {
|
|
2611
3442
|
min-width: 0;
|
|
2612
3443
|
}
|
|
@@ -2676,20 +3507,20 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2676
3507
|
display: none;
|
|
2677
3508
|
}
|
|
2678
3509
|
}
|
|
2679
|
-
`;class
|
|
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">
|
|
2680
3511
|
${s.label===""?h:d`<span class="name">${s.label}</span>`}
|
|
2681
3512
|
<div class="tabs" role="tablist" aria-label=${i}>
|
|
2682
|
-
${s.variants.map((
|
|
3513
|
+
${s.variants.map((o,l)=>d`<button
|
|
2683
3514
|
type="button"
|
|
2684
3515
|
role="tab"
|
|
2685
3516
|
id="code-group-tab-${l}"
|
|
2686
3517
|
aria-controls="code-group-panel-${l}"
|
|
2687
3518
|
aria-selected=${l===a}
|
|
2688
3519
|
tabindex=${l===a?0:-1}
|
|
2689
|
-
@click=${()=>this.#
|
|
2690
|
-
@keydown=${
|
|
3520
|
+
@click=${()=>this.#l(l)}
|
|
3521
|
+
@keydown=${c=>this.#c(c,l)}
|
|
2691
3522
|
>
|
|
2692
|
-
${
|
|
3523
|
+
${o.label}
|
|
2693
3524
|
</button>`)}
|
|
2694
3525
|
</div>
|
|
2695
3526
|
<button
|
|
@@ -2698,16 +3529,16 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2698
3529
|
aria-label=${t.copyLabel(i)}
|
|
2699
3530
|
@click=${()=>this.#g()}
|
|
2700
3531
|
>
|
|
2701
|
-
${this.#s==="copied"?
|
|
3532
|
+
${this.#s==="copied"?Ct():Me()}<span aria-live="polite">${r}</span>
|
|
2702
3533
|
</button>
|
|
2703
3534
|
</div>
|
|
2704
|
-
${s.variants.map((
|
|
3535
|
+
${s.variants.map((o,l)=>d`<pre
|
|
2705
3536
|
role="tabpanel"
|
|
2706
3537
|
id="code-group-panel-${l}"
|
|
2707
3538
|
aria-labelledby="code-group-tab-${l}"
|
|
2708
3539
|
?hidden=${l!==a}
|
|
2709
|
-
><code>${this.#p(
|
|
2710
|
-
${e}`}#
|
|
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,_`
|
|
2711
3542
|
:host {
|
|
2712
3543
|
display: block;
|
|
2713
3544
|
height: var(--dpk-browser-height, 460px);
|
|
@@ -2747,17 +3578,17 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
2747
3578
|
::slotted(*) {
|
|
2748
3579
|
flex: 1 0 auto;
|
|
2749
3580
|
}
|
|
2750
|
-
`]}static{this.properties={url:{type:String},viewport:{type:String,reflect:!0},profile:{type:String}}}#a=new
|
|
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
|
|
2751
3582
|
class="browser"
|
|
2752
|
-
data-viewport=${this.#
|
|
3583
|
+
data-viewport=${this.#l?"mobile":"desktop"}
|
|
2753
3584
|
?data-loading=${this.#s!==null}
|
|
2754
3585
|
>
|
|
2755
|
-
${
|
|
3586
|
+
${$a(i)}
|
|
2756
3587
|
<div class="browser-page">
|
|
2757
|
-
${
|
|
3588
|
+
${Ca(i,r===void 0?void 0:d`<slot></slot>`)}
|
|
2758
3589
|
</div>
|
|
2759
|
-
${
|
|
2760
|
-
</div>`}updated(){const t=this.#e===null?void 0:
|
|
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,_`
|
|
2761
3592
|
:host {
|
|
2762
3593
|
display: block;
|
|
2763
3594
|
}
|
|
@@ -3076,11 +3907,11 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3076
3907
|
color: var(--dpk-danger);
|
|
3077
3908
|
font-size: 12px;
|
|
3078
3909
|
}
|
|
3079
|
-
`]}static{this.properties={label:{type:String},placeholder:{type:String},multiple:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}}}#a=`dpk-combobox-${++
|
|
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`
|
|
3080
3911
|
<div class="field">
|
|
3081
3912
|
${this.label?d`<label class="field-label" id=${this.#g}>${this.label}</label>`:h}
|
|
3082
3913
|
<div class="combo-control">
|
|
3083
|
-
${this.multiple?
|
|
3914
|
+
${this.multiple?U(i,c=>c.value,c=>this.#x(c,t)):h}
|
|
3084
3915
|
<input
|
|
3085
3916
|
class="input"
|
|
3086
3917
|
type="text"
|
|
@@ -3090,15 +3921,15 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3090
3921
|
aria-expanded=${this.#o?"true":"false"}
|
|
3091
3922
|
aria-haspopup="listbox"
|
|
3092
3923
|
aria-autocomplete="list"
|
|
3093
|
-
aria-controls=${this.#
|
|
3924
|
+
aria-controls=${this.#u}
|
|
3094
3925
|
aria-labelledby=${this.label?this.#g:h}
|
|
3095
|
-
aria-activedescendant=${a>=0?this.#
|
|
3096
|
-
placeholder=${
|
|
3926
|
+
aria-activedescendant=${a>=0?this.#d(s[a]?.value??""):h}
|
|
3927
|
+
placeholder=${o?this.placeholder??"":""}
|
|
3097
3928
|
.value=${l}
|
|
3098
|
-
@focus=${this.#
|
|
3099
|
-
@click=${this.#
|
|
3100
|
-
@input=${this.#
|
|
3101
|
-
@keydown=${this.#
|
|
3929
|
+
@focus=${this.#f}
|
|
3930
|
+
@click=${this.#f}
|
|
3931
|
+
@input=${this.#k}
|
|
3932
|
+
@keydown=${this.#h}
|
|
3102
3933
|
/>
|
|
3103
3934
|
<button
|
|
3104
3935
|
type="button"
|
|
@@ -3106,27 +3937,27 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3106
3937
|
tabindex="-1"
|
|
3107
3938
|
aria-hidden="true"
|
|
3108
3939
|
data-open=${this.#o?"true":"false"}
|
|
3109
|
-
@mousedown=${
|
|
3110
|
-
@click=${this.#
|
|
3940
|
+
@mousedown=${c=>c.preventDefault()}
|
|
3941
|
+
@click=${this.#C}
|
|
3111
3942
|
>
|
|
3112
|
-
${
|
|
3943
|
+
${ia()}
|
|
3113
3944
|
</button>
|
|
3114
3945
|
</div>
|
|
3115
3946
|
</div>
|
|
3116
|
-
${this.#o?this.#
|
|
3117
|
-
`}updated(t){super.updated(t),this.#
|
|
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`
|
|
3118
3949
|
<div
|
|
3119
3950
|
class="combo-listbox"
|
|
3120
3951
|
popover="manual"
|
|
3121
3952
|
role="listbox"
|
|
3122
|
-
id=${this.#
|
|
3953
|
+
id=${this.#u}
|
|
3123
3954
|
aria-label=${this.label??s.listLabel}
|
|
3124
3955
|
aria-multiselectable=${this.multiple?"true":"false"}
|
|
3125
3956
|
>
|
|
3126
3957
|
<div class="options">
|
|
3127
3958
|
${t.length===0?d`<p class="empty">${s.empty}</p>`:a.map(i=>d`
|
|
3128
3959
|
${i.group!==null?d`<div class="group-heading">${i.group}</div>`:h}
|
|
3129
|
-
${
|
|
3960
|
+
${U(i.options,r=>r.value,r=>this.#b(r,t.indexOf(r)===e))}
|
|
3130
3961
|
`)}
|
|
3131
3962
|
</div>
|
|
3132
3963
|
<div class="footer">
|
|
@@ -3137,26 +3968,26 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3137
3968
|
</span>
|
|
3138
3969
|
</div>
|
|
3139
3970
|
</div>
|
|
3140
|
-
`}#
|
|
3971
|
+
`}#b(t,e){const s=Ko(this.#i,t.value);return d`
|
|
3141
3972
|
<div
|
|
3142
3973
|
class="option"
|
|
3143
|
-
id=${this.#
|
|
3974
|
+
id=${this.#d(t.value)}
|
|
3144
3975
|
role="option"
|
|
3145
3976
|
aria-selected=${s?"true":"false"}
|
|
3146
3977
|
data-active=${e?"true":"false"}
|
|
3147
3978
|
@mousedown=${a=>a.preventDefault()}
|
|
3148
3979
|
@click=${()=>this.#w(t.value)}
|
|
3149
3980
|
>
|
|
3150
|
-
<span class="avatar" data-tone=${
|
|
3981
|
+
<span class="avatar" data-tone=${zn(t.value)}>${t.avatar??Mn(t.label)}</span>
|
|
3151
3982
|
<span class="option-text">
|
|
3152
3983
|
<span class="option-name">${t.label}</span>
|
|
3153
3984
|
${t.description!==null?d`<span class="option-desc">${t.description}</span>`:h}
|
|
3154
3985
|
</span>
|
|
3155
|
-
${s?d`<span class="option-check" aria-hidden="true">${
|
|
3986
|
+
${s?d`<span class="option-check" aria-hidden="true">${Ct()}</span>`:h}
|
|
3156
3987
|
</div>
|
|
3157
3988
|
`}#x(t,e){return d`
|
|
3158
3989
|
<span class="chip">
|
|
3159
|
-
<span class="avatar" data-tone=${
|
|
3990
|
+
<span class="avatar" data-tone=${zn(t.value)}>${t.avatar??Mn(t.label)}</span>
|
|
3160
3991
|
<span class="chip-label">${t.label}</span>
|
|
3161
3992
|
<button
|
|
3162
3993
|
type="button"
|
|
@@ -3164,12 +3995,12 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3164
3995
|
tabindex="-1"
|
|
3165
3996
|
aria-label=${e.removeChip(t.label)}
|
|
3166
3997
|
@mousedown=${s=>s.preventDefault()}
|
|
3167
|
-
@click=${s=>{s.stopPropagation(),this.#y(
|
|
3998
|
+
@click=${s=>{s.stopPropagation(),this.#y(Bo(this.#i,t.value))}}
|
|
3168
3999
|
>
|
|
3169
|
-
${
|
|
4000
|
+
${Te()}
|
|
3170
4001
|
</button>
|
|
3171
4002
|
</span>
|
|
3172
|
-
`}#
|
|
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,_`
|
|
3173
4004
|
:host {
|
|
3174
4005
|
display: contents;
|
|
3175
4006
|
}
|
|
@@ -3186,7 +4017,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3186
4017
|
transform: translateX(-50%);
|
|
3187
4018
|
z-index: 45;
|
|
3188
4019
|
}
|
|
3189
|
-
`]}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),
|
|
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`
|
|
3190
4021
|
<div
|
|
3191
4022
|
class="dpk-floatbar"
|
|
3192
4023
|
popover="manual"
|
|
@@ -3196,7 +4027,7 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3196
4027
|
>
|
|
3197
4028
|
<slot></slot>
|
|
3198
4029
|
</div>
|
|
3199
|
-
`}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
|
|
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,_`
|
|
3200
4031
|
:host {
|
|
3201
4032
|
display: block;
|
|
3202
4033
|
color: var(--dpk-ink);
|
|
@@ -3327,12 +4158,12 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3327
4158
|
color: var(--dpk-ink-faint);
|
|
3328
4159
|
text-align: center;
|
|
3329
4160
|
}
|
|
3330
|
-
`];class
|
|
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">
|
|
3331
4162
|
${e===""?h:d`<p class="alternatives-label dpk-label">${e}</p>`}
|
|
3332
4163
|
${this.#n===null?h:d`<p class="alternatives-notice" role="alert">${t.dataError}<br />${this.#n}</p>`}
|
|
3333
4164
|
${this.#n===null&&s.length===0?d`<p class="alternatives-empty">${t.empty}</p>`:h}
|
|
3334
4165
|
${s.length===0?h:d`<ul class="options">
|
|
3335
|
-
${
|
|
4166
|
+
${U(s,a=>a.id,a=>this.#o(a))}
|
|
3336
4167
|
</ul>`}
|
|
3337
4168
|
</section>`}#o(t){const e=t.reason===null&&t.tradeoffs===null?h:d`<dl class="option-facts">
|
|
3338
4169
|
${t.reason===null?h:d`<div class="option-fact">
|
|
@@ -3358,4 +4189,4 @@ ${t}`,zi=(n,t,e)=>{const s=new Map(t.files.flatMap(o=>o.hunks.flatMap(r=>r.lines
|
|
|
3358
4189
|
</div>
|
|
3359
4190
|
${t.summary===null?h:d`<p class="option-summary">${t.summary}</p>`} ${e}
|
|
3360
4191
|
</article>
|
|
3361
|
-
</li>`}}const
|
|
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};
|