dev-process-kit 0.0.1 → 0.0.2-beta.1

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.
@@ -1,1322 +0,0 @@
1
- const oe=globalThis,ve=oe.ShadowRoot&&(oe.ShadyCSS===void 0||oe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ke=Symbol(),Ve=new WeakMap;let We=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ke)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(ve&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=Ve.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ve.set(t,e))}return e}toString(){return this.cssText}};const ys=s=>new We(typeof s=="string"?s:s+"",void 0,ke),P=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((n,i,r)=>n+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[r+1],s[0]);return new We(t,s,ke)},bs=(s,e)=>{if(ve)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=oe.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,s.appendChild(n)}},Ge=ve?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return ys(t)})(s):s,{is:vs,defineProperty:ks,getOwnPropertyDescriptor:xs,getOwnPropertyNames:$s,getOwnPropertySymbols:ws,getPrototypeOf:As}=Object,ae=globalThis,Ye=ae.trustedTypes,_s=Ye?Ye.emptyScript:"",Ss=ae.reactiveElementPolyfillSupport,Y=(s,e)=>s,xe={toAttribute(s,e){switch(e){case Boolean:s=s?_s:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},Ze=(s,e)=>!vs(s,e),Qe={attribute:!0,type:String,converter:xe,reflect:!1,useDefault:!1,hasChanged:Ze};Symbol.metadata??=Symbol("metadata"),ae.litPropertyMetadata??=new WeakMap;let H=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Qe){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&ks(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:r}=xs(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const l=i?.call(this);r?.call(this,o),this.requestUpdate(e,l,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Qe}static _$Ei(){if(this.hasOwnProperty(Y("elementProperties")))return;const e=As(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Y("properties"))){const t=this.properties,n=[...$s(t),...ws(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Ge(i))}else e!==void 0&&t.push(Ge(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bs(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const r=(n.converter?.toAttribute!==void 0?n.converter:xe).toAttribute(t,n.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=n.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:xe;this._$Em=i;const l=o.fromAttribute(t,r.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(e,t,n,i=!1,r){if(e!==void 0){const o=this.constructor;if(i===!1&&(r=this[e]),n??=o.getPropertyOptions(e),!((n.hasChanged??Ze)(r,t)||n.useDefault&&n.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:r},o){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,r]of n){const{wrapped:o}=r,l=this[i];o!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,r,l)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};H.elementStyles=[],H.shadowRootOptions={mode:"open"},H[Y("elementProperties")]=new Map,H[Y("finalized")]=new Map,Ss?.({ReactiveElement:H}),(ae.reactiveElementVersions??=[]).push("2.1.2");const $e=globalThis,Xe=s=>s,le=$e.trustedTypes,et=le?le.createPolicy("lit-html",{createHTML:s=>s}):void 0,tt="$lit$",O=`lit$${Math.random().toFixed(9).slice(2)}$`,st="?"+O,Es=`<${st}>`,N=document,Z=()=>N.createComment(""),Q=s=>s===null||typeof s!="object"&&typeof s!="function",we=Array.isArray,Cs=s=>we(s)||typeof s?.[Symbol.iterator]=="function",Ae=`[
2
- \f\r]`,X=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nt=/-->/g,it=/>/g,R=RegExp(`>|${Ae}(?:([^\\s"'>=/]+)(${Ae}*=${Ae}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),rt=/'/g,ot=/"/g,at=/^(?:script|style|textarea|title)$/i,lt=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),g=lt(1),Ts=lt(2),z=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),ct=new WeakMap,U=N.createTreeWalker(N,129);function pt(s,e){if(!we(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return et!==void 0?et.createHTML(e):e}const Os=(s,e)=>{const t=s.length-1,n=[];let i,r=e===2?"<svg>":e===3?"<math>":"",o=X;for(let l=0;l<t;l++){const a=s[l];let p,d,c=-1,u=0;for(;u<a.length&&(o.lastIndex=u,d=o.exec(a),d!==null);)u=o.lastIndex,o===X?d[1]==="!--"?o=nt:d[1]!==void 0?o=it:d[2]!==void 0?(at.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=R):d[3]!==void 0&&(o=R):o===R?d[0]===">"?(o=i??X,c=-1):d[1]===void 0?c=-2:(c=o.lastIndex-d[2].length,p=d[1],o=d[3]===void 0?R:d[3]==='"'?ot:rt):o===ot||o===rt?o=R:o===nt||o===it?o=X:(o=R,i=void 0);const h=o===R&&s[l+1].startsWith("/>")?" ":"";r+=o===X?a+Es:c>=0?(n.push(p),a.slice(0,c)+tt+a.slice(c)+O+h):a+O+(c===-2?l:h)}return[pt(s,r+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};class re{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,o=0;const l=e.length-1,a=this.parts,[p,d]=Os(e,t);if(this.el=re.createElement(p,n),U.currentNode=this.el.content,t===2||t===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=U.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const c of i.getAttributeNames())if(c.endsWith(tt)){const u=d[o++],h=i.getAttribute(c).split(O),v=/([.?@])?(.*)/.exec(u);a.push({type:1,index:r,name:v[2],strings:h,ctor:v[1]==="."?Ms:v[1]==="?"?Ps:v[1]==="@"?Ns:ce}),i.removeAttribute(c)}else c.startsWith(O)&&(a.push({type:6,index:r}),i.removeAttribute(c));if(at.test(i.tagName)){const c=i.textContent.split(O),u=c.length-1;if(u>0){i.textContent=le?le.emptyScript:"";for(let h=0;h<u;h++)i.append(c[h],Z()),U.nextNode(),a.push({type:2,index:++r});i.append(c[u],Z())}}}else if(i.nodeType===8)if(i.data===st)a.push({type:2,index:r});else{let c=-1;for(;(c=i.data.indexOf(O,c+1))!==-1;)a.push({type:7,index:r}),c+=O.length-1}r++}}static createElement(e,t){const n=N.createElement("template");return n.innerHTML=e,n}}function q(s,e,t=s,n){if(e===z)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const r=Q(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(s),i._$AT(s,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=q(s,i._$AS(s,e.values),i,n)),e}class js{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??N).importNode(t,!0);U.currentNode=i;let r=U.nextNode(),o=0,l=0,a=n[0];for(;a!==void 0;){if(o===a.index){let p;a.type===2?p=new G(r,r.nextSibling,this,e):a.type===1?p=new a.ctor(r,a.name,a.strings,this,e):a.type===6&&(p=new Rs(r,this,e)),this._$AV.push(p),a=n[++l]}o!==a?.index&&(r=U.nextNode(),o++)}return U.currentNode=N,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class G{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=q(this,e,t),Q(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Cs(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&Q(this._$AH)?this._$AA.nextSibling.data=e:this.T(N.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=re.createElement(pt(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new js(i,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=ct.get(e.strings);return t===void 0&&ct.set(e.strings,t=new re(e)),t}k(e){we(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new G(this.O(Z()),this.O(Z()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const n=Xe(e).nextSibling;Xe(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class ce{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,r){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=m}_$AI(e,t=this,n,i){const r=this.strings;let o=!1;if(r===void 0)e=q(this,e,t,0),o=!Q(e)||e!==this._$AH&&e!==z,o&&(this._$AH=e);else{const l=e;let a,p;for(e=r[0],a=0;a<r.length-1;a++)p=q(this,l[n+a],t,a),p===z&&(p=this._$AH[a]),o||=!Q(p)||p!==this._$AH[a],p===m?e=m:e!==m&&(e+=(p??"")+r[a+1]),this._$AH[a]=p}o&&!i&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Ms extends ce{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}}class Ps extends ce{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}}class Ns extends ce{constructor(e,t,n,i,r){super(e,t,n,i,r),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??m)===z)return;const n=this._$AH,i=e===m&&n!==m||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==m&&(n===m||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Rs{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}}const zs={I:G},Us=$e.litHtmlPolyfillSupport;Us?.(re,G),($e.litHtmlVersions??=[]).push("3.3.3");const Is=(s,e,t)=>{const n=t?.renderBefore??e;let i=n._$litPart$;if(i===void 0){const r=t?.renderBefore??null;n._$litPart$=i=new G(e.insertBefore(Z(),r),r,void 0,t??{})}return i._$AI(s),i},_e=globalThis;let j=class extends H{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Is(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return z}};j._$litElement$=!0,j.finalized=!0,_e.litElementHydrateSupport?.({LitElement:j});const Ls=_e.litElementPolyfillSupport;Ls?.({LitElement:j}),(_e.litElementVersions??=[]).push("4.2.2");const pe=P`
4
- :host {
5
- /* Neutral, white-based surface scale. */
6
- --dpk-paper: #fafbfc;
7
- --dpk-paper-raised: #ffffff;
8
- --dpk-paper-sunken: #f3f5f8;
9
- --dpk-paper-inset: #eceef2;
10
- --dpk-ink: #1a1d24;
11
- --dpk-ink-soft: #4d5566;
12
- --dpk-ink-faint: #7c8599;
13
- --dpk-rule: rgba(20, 28, 44, 0.08);
14
- --dpk-rule-strong: rgba(20, 28, 44, 0.14);
15
- --dpk-accent: #d94920;
16
- --dpk-accent-soft: rgba(217, 73, 32, 0.07);
17
- --dpk-accent-ink: #ffffff;
18
- --dpk-blue: #3366cc;
19
- --dpk-blue-soft: rgba(51, 102, 204, 0.08);
20
- --dpk-green: #1a8a4a;
21
- --dpk-green-soft: rgba(26, 138, 74, 0.08);
22
- --dpk-amber: #b47a0a;
23
- --dpk-amber-soft: rgba(180, 122, 10, 0.09);
24
- --dpk-violet: #7c4dcc;
25
- --dpk-violet-soft: rgba(124, 77, 204, 0.08);
26
- --dpk-display: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
27
- --dpk-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
28
- --dpk-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
29
-
30
- /* Shape + elevation scale, so every surface reads as one system. */
31
- --dpk-radius-xs: 5px;
32
- --dpk-radius-sm: 7px;
33
- --dpk-radius: 8px;
34
- --dpk-radius-lg: 12px;
35
- --dpk-shadow-xs: 0 1px 2px rgba(20, 28, 44, 0.05), 0 1px 1px rgba(20, 28, 44, 0.03);
36
- --dpk-shadow-sm: 0 1px 2px rgba(20, 28, 44, 0.06), 0 2px 8px -2px rgba(20, 28, 44, 0.12);
37
- --dpk-shadow: 0 1px 3px rgba(20, 28, 44, 0.06), 0 8px 24px -8px rgba(20, 28, 44, 0.18);
38
- --dpk-shadow-lg: 0 2px 6px rgba(20, 28, 44, 0.06), 0 16px 40px -12px rgba(20, 28, 44, 0.22);
39
- --dpk-focus: 0 0 0 3px rgba(51, 102, 204, 0.25);
40
- --dpk-control-h: 32px;
41
-
42
- color: var(--dpk-ink);
43
- font-family: var(--dpk-body);
44
- font-size: 14px;
45
- line-height: 1.5;
46
- -webkit-font-smoothing: antialiased;
47
- text-rendering: optimizeLegibility;
48
- display: block;
49
- }
50
-
51
- *,
52
- *::before,
53
- *::after {
54
- box-sizing: border-box;
55
- }
56
-
57
- h1,
58
- h2,
59
- h3,
60
- h4 {
61
- font-family: var(--dpk-display);
62
- font-weight: 650;
63
- margin: 0;
64
- line-height: 1.2;
65
- letter-spacing: -0.01em;
66
- }
67
-
68
- button {
69
- font: inherit;
70
- color: inherit;
71
- }
72
-
73
- ::selection {
74
- background: rgba(47, 90, 168, 0.18);
75
- }
76
-
77
- .dpk-mono,
78
- .dpk-num {
79
- font-variant-numeric: tabular-nums;
80
- }
81
-
82
- .dpk-label {
83
- font-family: var(--dpk-mono);
84
- font-size: 10px;
85
- font-weight: 500;
86
- letter-spacing: 0.12em;
87
- text-transform: uppercase;
88
- color: var(--dpk-ink-faint);
89
- }
90
- `,de=P`
91
- .dpk-btn {
92
- display: inline-flex;
93
- align-items: center;
94
- justify-content: center;
95
- gap: 6px;
96
- min-height: 30px;
97
- padding: 0 12px;
98
- border: 1px solid var(--dpk-rule-strong);
99
- border-radius: var(--dpk-radius-sm);
100
- background: var(--dpk-paper-raised);
101
- color: var(--dpk-ink);
102
- font-size: 12.5px;
103
- font-weight: 520;
104
- line-height: 1;
105
- white-space: nowrap;
106
- box-shadow: var(--dpk-shadow-xs);
107
- cursor: pointer;
108
- transition:
109
- background 140ms ease,
110
- border-color 140ms ease,
111
- box-shadow 140ms ease,
112
- color 140ms ease,
113
- transform 80ms ease;
114
- }
115
-
116
- .dpk-btn:hover:not([disabled]) {
117
- background: var(--dpk-paper-sunken);
118
- border-color: rgba(20, 28, 44, 0.22);
119
- box-shadow: var(--dpk-shadow-sm);
120
- }
121
-
122
- .dpk-btn:active:not([disabled]) {
123
- transform: translateY(1px);
124
- box-shadow: none;
125
- }
126
-
127
- .dpk-btn:focus-visible {
128
- outline: none;
129
- box-shadow: var(--dpk-focus);
130
- }
131
-
132
- .dpk-btn[disabled] {
133
- opacity: 0.45;
134
- box-shadow: none;
135
- cursor: not-allowed;
136
- }
137
-
138
- .dpk-btn--accent {
139
- border-color: transparent;
140
- background: linear-gradient(180deg, var(--dpk-accent), #c23e12);
141
- color: var(--dpk-accent-ink);
142
- box-shadow:
143
- 0 1px 2px rgba(217, 73, 32, 0.25),
144
- 0 0 0 1px rgba(217, 73, 32, 0.15);
145
- }
146
-
147
- .dpk-btn--accent:hover:not([disabled]) {
148
- background: linear-gradient(180deg, #e0521f, #b83710);
149
- border-color: transparent;
150
- box-shadow:
151
- 0 2px 6px rgba(217, 73, 32, 0.3),
152
- 0 0 0 1px rgba(217, 73, 32, 0.2);
153
- }
154
-
155
- /* Selection state, shared by every template's filter/nav controls. */
156
- .dpk-btn--selected {
157
- border-color: transparent;
158
- background: linear-gradient(180deg, var(--dpk-blue), #2952a3);
159
- color: #fff;
160
- box-shadow: 0 1px 3px rgba(51, 102, 204, 0.3);
161
- }
162
-
163
- .dpk-btn--selected:hover:not([disabled]) {
164
- background: linear-gradient(180deg, #2952a3, #213f80);
165
- border-color: transparent;
166
- box-shadow: 0 2px 6px rgba(51, 102, 204, 0.35);
167
- }
168
-
169
- .dpk-btn--ghost {
170
- border-color: transparent;
171
- background: transparent;
172
- box-shadow: none;
173
- color: var(--dpk-ink-soft);
174
- }
175
-
176
- .dpk-btn--ghost:hover:not([disabled]) {
177
- background: var(--dpk-paper-inset);
178
- border-color: transparent;
179
- color: var(--dpk-ink);
180
- }
181
-
182
- .dpk-icon-btn {
183
- position: relative;
184
- display: inline-flex;
185
- align-items: center;
186
- justify-content: center;
187
- width: 26px;
188
- height: 26px;
189
- padding: 0;
190
- border: 1px solid transparent;
191
- border-radius: var(--dpk-radius-xs);
192
- background: transparent;
193
- color: var(--dpk-ink-faint);
194
- font-size: 11px;
195
- line-height: 1;
196
- cursor: pointer;
197
- transition:
198
- background 140ms ease,
199
- color 140ms ease,
200
- transform 100ms ease;
201
- }
202
-
203
- .dpk-icon-btn:hover:not([disabled]) {
204
- background: var(--dpk-paper-inset);
205
- color: var(--dpk-ink);
206
- transform: scale(1.08);
207
- }
208
-
209
- .dpk-icon-btn:focus-visible {
210
- outline: none;
211
- box-shadow: var(--dpk-focus);
212
- }
213
-
214
- .dpk-icon-btn[disabled] {
215
- opacity: 0.35;
216
- cursor: default;
217
- }
218
-
219
- .dpk-icon-btn[data-active='true'] {
220
- background: var(--dpk-blue-soft);
221
- color: var(--dpk-blue);
222
- }
223
-
224
- .dpk-icon-btn svg {
225
- display: block;
226
- width: 15px;
227
- height: 15px;
228
- }
229
-
230
- /* Count badge for an icon-only control (comments on a card, drafts on the rail). */
231
- .dpk-icon-badge {
232
- position: absolute;
233
- top: -4px;
234
- right: -4px;
235
- min-width: 15px;
236
- height: 15px;
237
- padding: 0 3px;
238
- border: 1.5px solid var(--dpk-paper-raised);
239
- border-radius: 999px;
240
- background: var(--dpk-accent);
241
- color: var(--dpk-accent-ink);
242
- font-family: var(--dpk-mono);
243
- font-size: 9px;
244
- font-variant-numeric: tabular-nums;
245
- line-height: 12px;
246
- text-align: center;
247
- }
248
-
249
- .dpk-input,
250
- .dpk-textarea,
251
- .dpk-select {
252
- box-sizing: border-box;
253
- width: 100%;
254
- min-height: var(--dpk-control-h);
255
- padding: 5px 9px;
256
- border: 1px solid var(--dpk-rule-strong);
257
- border-radius: var(--dpk-radius-sm);
258
- background: var(--dpk-paper-raised);
259
- color: var(--dpk-ink);
260
- font: inherit;
261
- font-size: 12.5px;
262
- transition:
263
- border-color 120ms ease,
264
- box-shadow 120ms ease;
265
- }
266
-
267
- .dpk-input:hover,
268
- .dpk-textarea:hover,
269
- .dpk-select:hover {
270
- border-color: rgba(20, 22, 26, 0.24);
271
- }
272
-
273
- .dpk-input:focus,
274
- .dpk-textarea:focus,
275
- .dpk-select:focus {
276
- outline: none;
277
- border-color: var(--dpk-blue);
278
- box-shadow: var(--dpk-focus);
279
- }
280
-
281
- .dpk-select {
282
- appearance: none;
283
- background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23878e9e' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
284
- background-repeat: no-repeat;
285
- background-position: right 7px center;
286
- padding-right: 26px;
287
- cursor: pointer;
288
- }
289
-
290
- .dpk-textarea {
291
- resize: vertical;
292
- min-height: 64px;
293
- line-height: 1.55;
294
- }
295
- `,Bs=P`
296
- .comment-pop {
297
- box-sizing: border-box;
298
- overflow: auto;
299
- position: fixed;
300
- inset: auto;
301
- margin: 0;
302
- display: grid;
303
- gap: 8px;
304
- padding: 12px;
305
- border: 1px solid var(--dpk-rule);
306
- border-radius: var(--dpk-radius-lg);
307
- background: var(--dpk-paper-raised);
308
- box-shadow: var(--dpk-shadow-lg);
309
- color: var(--dpk-ink);
310
- font-size: 12.5px;
311
- }
312
-
313
- .comment-pop .comment-list {
314
- list-style: none;
315
- margin: 0;
316
- padding: 0;
317
- display: grid;
318
- gap: 4px;
319
- max-height: 140px;
320
- overflow: auto;
321
- font-size: 12px;
322
- color: var(--dpk-ink-soft);
323
- }
324
-
325
- .comment-pop .comment-list li {
326
- padding-left: 8px;
327
- border-left: 2px solid var(--dpk-accent);
328
- }
329
-
330
- .comment-pop .dpk-textarea {
331
- min-height: 54px;
332
- }
333
-
334
- .pop-actions {
335
- display: flex;
336
- gap: 2px;
337
- align-items: center;
338
- justify-content: flex-end;
339
- }
340
- `,ue=(s,e)=>s instanceof e?s:null;class dt extends j{static{this.styles=[pe,de,P`
341
- :host {
342
- display: inline;
343
- /* Inherit the surrounding type scale instead of forcing the chrome size:
344
- an inline edit inside a 17px heading must look like a 17px heading.
345
- Color comes along too, so an edit on a colored card stays legible. */
346
- font-family: inherit;
347
- font-size: inherit;
348
- font-weight: inherit;
349
- line-height: inherit;
350
- color: inherit;
351
- }
352
-
353
- .view {
354
- cursor: text;
355
- border-bottom: 1px dashed transparent;
356
- border-radius: 3px;
357
- padding: 1px 3px;
358
- transition:
359
- background 140ms ease,
360
- border-color 140ms ease;
361
- }
362
-
363
- .view:hover {
364
- border-bottom-color: var(--dpk-blue);
365
- background: var(--dpk-blue-soft);
366
- }
367
-
368
- .view[data-empty='true'] {
369
- color: var(--dpk-ink-faint);
370
- font-style: italic;
371
- }
372
-
373
- input,
374
- textarea {
375
- font: inherit;
376
- color: inherit;
377
- background: var(--dpk-paper-raised);
378
- border: 1px solid var(--dpk-blue);
379
- border-radius: var(--dpk-radius-sm);
380
- box-shadow: var(--dpk-focus);
381
- padding: 3px 7px;
382
- min-width: 0;
383
- width: 100%;
384
- transition: box-shadow 140ms ease;
385
- }
386
-
387
- textarea {
388
- min-height: var(--dpk-inline-textarea-min-height, 90px);
389
- resize: vertical;
390
- font-family: var(--dpk-body);
391
- line-height: 1.5;
392
- }
393
-
394
- /* wrap: the field wraps like the text it replaces, and Enter still
395
- commits, so a one-line value is edited without losing sight of it. */
396
- :host([wrap]) textarea {
397
- min-height: 0;
398
- resize: none;
399
- line-height: inherit;
400
- }
401
-
402
- /* seamless: no field chrome at all — the text is edited where it sits.
403
- The chrome theme paints fields with its own ink and size, so the
404
- seamless field re-states the inherited type and color. */
405
- :host([seamless]) input,
406
- :host([seamless]) textarea {
407
- padding: 0;
408
- border: none;
409
- border-radius: 0;
410
- background: transparent;
411
- box-shadow: none;
412
- height: 100%;
413
- min-height: 0;
414
- overflow: auto;
415
- resize: none;
416
- font: inherit;
417
- font-size: inherit;
418
- line-height: inherit;
419
- color: inherit;
420
- }
421
-
422
- :host([seamless]) .view {
423
- padding: 0;
424
- }
425
- `]}static{this.properties={value:{type:String},placeholder:{type:String},multiline:{type:Boolean},wrap:{type:Boolean,reflect:!0},seamless:{type:Boolean,reflect:!0},label:{type:String},editing:{state:!0}}}#t="";#r=0;connectedCallback(){super.connectedCallback(),this.#r+=1}constructor(){super(),this.value="",this.placeholder="",this.multiline=!1,this.wrap=!1,this.seamless=!1,this.label="",this.editing=!1,this.#t=""}startEditing(){this.#t=this.value,this.editing=!0}willUpdate(e){e.has("value")&&!this.editing&&(this.#t=this.value)}updated(){if(!this.editing)return;const e=this.renderRoot.querySelector("input, textarea"),t=this.renderRoot,n=t instanceof ShadowRoot?t.activeElement:document.activeElement;e&&n!==e&&(e.focus(),e.select())}render(){if(!this.editing){const t=this.value.length===0;return g`<span
426
- class="view"
427
- data-empty=${String(t)}
428
- role="button"
429
- tabindex="0"
430
- title="クリックして編集"
431
- @click=${this.#e}
432
- @keydown=${this.#i}
433
- >${t?this.placeholder||"\u672A\u8A2D\u5B9A":this.value}</span
434
- >`}const e=this.label||this.placeholder||"\u7DE8\u96C6";return g`
435
- ${this.multiline||this.wrap?g`<textarea
436
- class="dpk-textarea"
437
- .value=${this.#t}
438
- aria-label=${e}
439
- @input=${this.#o}
440
- @keydown=${this.#s}
441
- @blur=${this.#n}
442
- ></textarea>`:g`<input
443
- class="dpk-input"
444
- .value=${this.#t}
445
- aria-label=${e}
446
- @input=${this.#o}
447
- @keydown=${this.#s}
448
- @blur=${this.#n}
449
- />`}
450
- `}#e=e=>{e.stopPropagation(),this.editing=!0};#i=e=>{e.isComposing||(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.editing=!0)};#o=e=>{const t=ue(e.target,HTMLInputElement)??ue(e.target,HTMLTextAreaElement);t!==null&&(this.#t=t.value)};#s=e=>{if(!e.isComposing){if(e.key==="Escape"){e.preventDefault(),this.#t=this.value,this.editing=!1;return}e.key==="Enter"&&(!this.multiline||this.wrap||e.metaKey||e.ctrlKey)&&(e.preventDefault(),this.#c())}};#n=e=>{const t=e.currentTarget;if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement))return;const n=this.#r,{selectionStart:i,selectionEnd:r}=t;queueMicrotask(()=>{!this.isConnected||!this.editing||(n!==this.#r?(t.focus(),t.setSelectionRange(i,r)):this.#c())})};#c=()=>{if(!this.editing)return;this.editing=!1;const t=(this.wrap?this.#t.replace(/\r?\n/g," "):this.#t).trim();t!==this.value&&this.dispatchEvent(new CustomEvent("dpk-commit",{detail:{value:t},bubbles:!0,composed:!0}))}}const Ds=()=>{customElements.get("dpk-component-inline-edit")||customElements.define("dpk-component-inline-edit",dt)},Hs={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Se(s){return Hs}let qs;function Ks(s){return qs?.get(s)}let Fs;function Js(s){return Fs?.get(s)}let Vs;function Ws(s,e){return Vs?.get(s)?.get(e)}function ee(s){const e=typeof s;return e==="string"?`"${s}"`:e==="number"||e==="bigint"||e==="boolean"?`${s}`:e==="object"||e==="function"?(s&&Object.getPrototypeOf(s)?.constructor?.name)??"null":e}function k(s,e,t,n,i){const r=i&&"input"in i?i.input:t.value,o=i?.expected??s.expects??null,l=i?.received??ee(r),a={kind:s.kind,type:s.type,input:r,expected:o,received:l,message:`Invalid ${e}: ${o?`Expected ${o} but r`:"R"}eceived ${l}`,requirement:s.requirement,path:i?.path,issues:i?.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},p=s.kind==="schema",d=i?.message??s.message??Ws(s.reference,a.lang)??(p?Js(a.lang):null)??n.message??Ks(a.lang);d!==void 0&&(a.message=typeof d=="function"?d(a):d),p&&(t.typed=!1),t.issues?t.issues.push(a):t.issues=[a]}function Gs(s,e){return s===e||Number.isNaN(s)&&Number.isNaN(e)}function Ys(s,e){return Object.prototype.hasOwnProperty.call(s,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function Ee(s,e){const t=[...new Set(s)];return t.length>1?`(${t.join(` ${e} `)})`:t[0]??"never"}function $(s){return s["~standard"]={version:1,vendor:"valibot",validate:e=>s["~run"]({value:e},Se())},s}var Zs=class extends Error{constructor(s){super(s[0].message),this.name="ValiError",this.issues=s}};function ut(s){return{kind:"validation",type:"integer",reference:ut,async:!1,expects:null,requirement:Number.isInteger,message:s,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&k(this,"integer",e,t),e}}}function b(s,e){return{kind:"validation",type:"min_length",reference:b,async:!1,expects:`>=${s}`,requirement:s,message:e,"~run"(t,n){return t.typed&&t.value.length<this.requirement&&k(this,"length",t,n,{received:`${t.value.length}`}),t}}}function ht(s,e){return{kind:"validation",type:"min_value",reference:ht,async:!1,expects:`>=${s instanceof Date?s.toJSON():ee(s)}`,requirement:s,message:e,"~run"(t,n){return t.typed&&!(t.value>=this.requirement)&&k(this,"value",t,n,{received:t.value instanceof Date?t.value.toJSON():ee(t.value)}),t}}}function I(s,e){return{kind:"validation",type:"regex",reference:I,async:!1,expects:`${s}`,requirement:s,message:e,"~run"(t,n){return t.typed&&!this.requirement.test(t.value)&&k(this,"format",t,n),t}}}function Ce(){return{kind:"transformation",type:"trim",reference:Ce,async:!1,"~run"(s){return s.value=s.value.trim(),s}}}const Qs={abortEarly:!0};function ft(s,e,t){return typeof s.fallback=="function"?s.fallback(e,t):s.fallback}function he(s,e,t){return typeof s.default=="function"?s.default(e,t):s.default}function L(s,e){return $({kind:"schema",type:"array",reference:L,expects:"Array",async:!1,item:s,message:e,"~run"(t,n){const i=t.value;if(Array.isArray(i)){t.typed=!0,t.value=[];for(let r=0;r<i.length;r++){const o=i[r],l=this.item["~run"]({value:o},n);if(l.issues){const a={type:"array",origin:"value",input:i,key:r,value:o};for(const p of l.issues)p.path?p.path.unshift(a):p.path=[a],t.issues?.push(p);if(t.issues||(t.issues=l.issues),n.abortEarly){t.typed=!1;break}}l.typed||(t.typed=!1),t.value.push(l.value)}}else k(this,"type",t,n);return t}})}function gt(s){return $({kind:"schema",type:"boolean",reference:gt,expects:"boolean",async:!1,message:s,"~run"(e,t){return typeof e.value=="boolean"?e.typed=!0:k(this,"type",e,t),e}})}function S(s,e){return $({kind:"schema",type:"exact_optional",reference:S,expects:s.expects,async:!1,wrapped:s,default:e,"~run"(t,n){return this.wrapped["~run"](t,n)}})}function mt(s){return $({kind:"schema",type:"lazy",reference:mt,expects:"unknown",async:!1,getter:s,"~run"(e,t){return this.getter(e.value)["~run"](e,t)}})}function K(s,e){return $({kind:"schema",type:"literal",reference:K,expects:ee(s),async:!1,literal:s,message:e,"~run"(t,n){return Gs(t.value,this.literal)?t.typed=!0:k(this,"type",t,n),t}})}function yt(s,e){return $({kind:"schema",type:"nullable",reference:yt,expects:`(${s.expects} | null)`,async:!1,wrapped:s,default:e,"~run"(t,n){return t.value===null&&(this.default!==void 0&&(t.value=he(this,t,n)),t.value===null)?(t.typed=!0,t):this.wrapped["~run"](t,n)}})}function bt(s){return $({kind:"schema",type:"number",reference:bt,expects:"number",async:!1,message:s,"~run"(e,t){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:k(this,"type",e,t),e}})}function w(s,e){return $({kind:"schema",type:"object",reference:w,expects:"Object",async:!1,entries:s,message:e,"~run"(t,n){const i=t.value;if(i&&typeof i=="object"){t.typed=!0,t.value={};for(const r in this.entries){const o=this.entries[r];if(r in i||(o.type==="exact_optional"||o.type==="optional"||o.type==="nullish")&&o.default!==void 0){const l=r in i?i[r]:he(o),a=o["~run"]({value:l},n);if(a.issues){const p={type:"object",origin:"value",input:i,key:r,value:l};for(const d of a.issues)d.path?d.path.unshift(p):d.path=[p],t.issues?.push(d);if(t.issues||(t.issues=a.issues),n.abortEarly){t.typed=!1;break}}a.typed||(t.typed=!1),t.value[r]=a.value}else if(o.fallback!==void 0)t.value[r]=ft(o);else if(o.type!=="exact_optional"&&o.type!=="optional"&&o.type!=="nullish"&&(k(this,"key",t,n,{input:void 0,expected:`"${r}"`,path:[{type:"object",origin:"key",input:i,key:r,value:i[r]}]}),n.abortEarly))break}}else k(this,"type",t,n);return t}})}function fe(s,e){return $({kind:"schema",type:"optional",reference:fe,expects:`(${s.expects} | undefined)`,async:!1,wrapped:s,default:e,"~run"(t,n){return t.value===void 0&&(this.default!==void 0&&(t.value=he(this,t,n)),t.value===void 0)?(t.typed=!0,t):this.wrapped["~run"](t,n)}})}function ge(s,e){return $({kind:"schema",type:"picklist",reference:ge,expects:Ee(s.map(ee),"|"),async:!1,options:s,message:e,"~run"(t,n){return this.options.includes(t.value)?t.typed=!0:k(this,"type",t,n),t}})}function vt(s,e,t){return $({kind:"schema",type:"record",reference:vt,expects:"Object",async:!1,key:s,value:e,message:t,"~run"(n,i){const r=n.value;if(r&&typeof r=="object"){n.typed=!0,n.value={};for(const o in r)if(Ys(r,o)){const l=r[o],a=this.key["~run"]({value:o},i);if(a.issues){const d={type:"object",origin:"key",input:r,key:o,value:l};for(const c of a.issues)c.path=[d],n.issues?.push(c);if(n.issues||(n.issues=a.issues),i.abortEarly){n.typed=!1;break}}const p=this.value["~run"]({value:l},i);if(p.issues){const d={type:"object",origin:"value",input:r,key:o,value:l};for(const c of p.issues)c.path?c.path.unshift(d):c.path=[d],n.issues?.push(c);if(n.issues||(n.issues=p.issues),i.abortEarly){n.typed=!1;break}}(!a.typed||!p.typed)&&(n.typed=!1),a.typed&&(n.value[a.value]=p.value)}}else k(this,"type",n,i);return n}})}function F(s,e){return $({kind:"schema",type:"strict_object",reference:F,expects:"Object",async:!1,entries:s,message:e,"~run"(t,n){const i=t.value;if(i&&typeof i=="object"){t.typed=!0,t.value={};for(const r in this.entries){const o=this.entries[r];if(r in i||(o.type==="exact_optional"||o.type==="optional"||o.type==="nullish")&&o.default!==void 0){const l=r in i?i[r]:he(o),a=o["~run"]({value:l},n);if(a.issues){const p={type:"object",origin:"value",input:i,key:r,value:l};for(const d of a.issues)d.path?d.path.unshift(p):d.path=[p],t.issues?.push(d);if(t.issues||(t.issues=a.issues),n.abortEarly){t.typed=!1;break}}a.typed||(t.typed=!1),t.value[r]=a.value}else if(o.fallback!==void 0)t.value[r]=ft(o);else if(o.type!=="exact_optional"&&o.type!=="optional"&&o.type!=="nullish"&&(k(this,"key",t,n,{input:void 0,expected:`"${r}"`,path:[{type:"object",origin:"key",input:i,key:r,value:i[r]}]}),n.abortEarly))break}if(!t.issues||!n.abortEarly){for(const r in i)if(!Object.prototype.hasOwnProperty.call(this.entries,r)){k(this,"key",t,n,{input:r,expected:"never",path:[{type:"object",origin:"key",input:i,key:r,value:i[r]}]});break}}}else k(this,"type",t,n);return t}})}function f(s){return $({kind:"schema",type:"string",reference:f,expects:"string",async:!1,message:s,"~run"(e,t){return typeof e.value=="string"?e.typed=!0:k(this,"type",e,t),e}})}function kt(s){let e;if(s)for(const t of s)if(e)for(const n of t.issues)e.push(n);else e=t.issues;return e}function xt(s,e){return $({kind:"schema",type:"union",reference:xt,expects:Ee(s.map(t=>t.expects),"|"),async:!1,options:s,message:e,"~run"(t,n){let i,r,o;for(const l of this.options){const a=l["~run"]({value:t.value},n);if(a.typed)if(a.issues)r?r.push(a):r=[a];else{i=a;break}else o?o.push(a):o=[a]}if(i)return i;if(r){if(r.length===1)return r[0];k(this,"type",t,n,{issues:kt(r)}),t.typed=!0}else{if(o?.length===1)return o[0];k(this,"type",t,n,{issues:kt(o)})}return t}})}function B(){return $({kind:"schema",type:"unknown",reference:B,expects:"unknown",async:!1,"~run"(s){return s.typed=!0,s}})}function $t(s,e,t){return $({kind:"schema",type:"variant",reference:$t,expects:"Object",async:!1,key:s,options:e,message:t,"~run"(n,i){const r=n.value;if(r&&typeof r=="object"){let o,l=0,a=this.key,p=[];const d=(c,u)=>{for(const h of c.options){if(h.type==="variant")d(h,new Set(u).add(h.key));else{let v=!0,_=0;for(const A of u){const M=h.entries[A];if(A in r?M["~run"]({typed:!1,value:r[A]},Qs).issues:M.type!=="exact_optional"&&M.type!=="optional"&&M.type!=="nullish"){v=!1,a!==A&&(l<_||l===_&&A in r&&!(a in r))&&(l=_,a=A,p=[]),a===A&&p.push(h.entries[A].expects);break}_++}if(v){const A=h["~run"]({value:r},i);(!o||!o.typed&&A.typed)&&(o=A)}}if(o&&!o.issues)break}};if(d(this,new Set([this.key])),o)return o;k(this,"type",n,i,{input:r[a],expected:Ee(p,"|"),path:[{type:"object",origin:"value",input:r,key:a,value:r[a]}]})}else k(this,"type",n,i);return n}})}function wt(s,e,t){const n=s["~run"]({value:e},Se());if(n.issues)throw new Zs(n.issues);return n.value}function y(...s){return $({...s[0],pipe:s,"~run"(e,t){for(const n of s)if(n.kind!=="metadata"){if(e.issues&&(n.kind==="schema"||n.kind==="transformation")){e.typed=!1;break}(!e.issues||!t.abortEarly&&!t.abortPipeEarly)&&(e=n["~run"](e,t))}return e}})}function x(s,e,t){const n=s["~run"]({value:e},Se());return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}const me=w({type:y(f(),b(1)),id:y(f(),b(1))}),Xs=y(f(),b(1),I(/^[A-Za-z0-9_-]+$/,'ids may only contain letters, digits, "_" and "-" (a "." builds a path)')),en=(s,e)=>{if(e===1)return s.includes(".")?null:[s];const t=s.split(".");return t.length===e&&t.every(n=>n.length>0)?t:null},J=w({id:y(f(),b(1)),type:y(f(),b(1)),target:me,payload:B(),note:S(f()),createdAt:y(f(),b(1))}),tn=(s,e,t,n={})=>{const i=w({id:y(f(),b(1)),type:K(s),target:me,payload:t,note:S(f()),createdAt:y(f(),b(1))}),r=o=>{const l=x(J,o);if(!l.success||l.output.type!==s)return null;const a=x(t,o.payload);return a.success?{id:l.output.id,type:s,target:l.output.target,payload:a.output,...l.output.note===void 0?{}:{note:l.output.note},createdAt:l.output.createdAt}:null};return{schema:i,mode:n.mode??"patch",targetType:e,actionType:s,payloadSchema:t,parse:r,...n.dedupeKey?{dedupeKey:n.dedupeKey}:{}}},sn=(s,e)=>{const t=ye(s,e.type);if(t===void 0)return null;const n=t.parse(e);return n===null?null:n},nn=(s,e)=>{const t=x(s.payloadSchema,e.payload);if(!t.success)throw new Error(`invalid payload for action "${e.type}"`);return t.output},ye=(s,e)=>Object.hasOwn(s,e)?s[e]:void 0,rn=s=>{throw new Error(`unhandled action: ${JSON.stringify(s)}`)},on=w({id:y(f(),b(1))}),an=s=>{const e=x(on,s.payload);return`${s.type}|${e.success?e.output.id:JSON.stringify(s.payload)}`},E=s=>`${s.type}:${s.id}`,At=s=>{const e=s.indexOf(":");return e<=0?{type:"unknown",id:s}:{type:s.slice(0,e),id:s.slice(e+1)}},Te=(s,e)=>typeof s=="string"?At(s.includes(":")?s:`${e}:${s}`):{type:s.type,id:s.id},ln=(s,e)=>s.type===e.type&&s.id===e.id,_t=s=>{const e=s.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return e.length>0?e:"item"},cn=(s,e)=>{const t=_t(s),n=new Set(e);if(!n.has(t))return t;for(let i=2;i<1e3;i+=1){const r=`${t}-${i}`;if(!n.has(r))return r}return`${t}-${Math.random().toString(36).slice(2,8)}`},St=()=>{const s=globalThis.crypto;return s?.randomUUID?s.randomUUID():`a-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`},C="comment",te=s=>{const[e]=s;return{path:e?.path?.map(t=>String(t.key)).join(".")??"",message:e?.message??"invalid action"}},Et=w({type:y(f(),b(1)),target:xt([y(f(),b(1)),me]),payload:fe(B()),note:S(f()),id:S(y(f(),b(1))),createdAt:S(y(f(),b(1)))}),pn=(s,e)=>{const t=x(Et,s);if(!t.success)return{ok:!1,issue:te(t.issues)};const n=t.output,i=Te(n.target,e.targetType),r={id:n.id??St(),type:n.type,target:i,payload:n.payload??{},...n.note===void 0?{}:{note:n.note},createdAt:n.createdAt??new Date().toISOString()},o=x(e.schema,r);if(!o.success)return{ok:!1,issue:te(o.issues)};const l=x(J,o.output);return l.success?{ok:!0,action:l.output}:{ok:!1,issue:te(l.issues)}},Oe=(s,e)=>e.dedupeKey?e.dedupeKey(s):e.mode!=="patch"?null:`${s.type}|${E(s.target)}`,je=(s,e,t)=>{const n=Oe(e,t);if(n===null)return[...s,e];const i=s.at(-1);return!i||Oe(i,t)!==n||!dn(i,e)?[...s,e]:[...s.slice(0,-1),e]},dn=(s,e)=>ln(s.target,e.target),Me=s=>JSON.stringify(s.map(e=>({id:e.id,type:e.type,target:e.target,payload:e.payload,...e.note===void 0?{}:{note:e.note},createdAt:e.createdAt})),null,2),Ct=w({id:y(f(),b(1)),type:K(C),target:w({type:y(f(),b(1)),id:y(f(),b(1))}),payload:w({body:y(f(),b(1))}),note:S(f()),createdAt:y(f(),b(1))}),Tt={schema:Ct,mode:"append",targetType:"page"},un=w({body:f()}),Pe=s=>{const e=x(un,s.payload);return e.success?e.output.body:""},Ne="element",Ot=y(f(),I(/^[A-Z][A-Z0-9_]*$/,"component action types are CONSTANT_CASE")),jt=vt(f(),B()),hn=w({type:K(Ne),id:y(f(),I(/^[^/]+\/.+/,"component references start with a provider id"))}),fn=w({id:y(f(),b(1)),type:Ot,target:hn,payload:jt,note:S(f()),createdAt:y(f(),b(1))}),gn={schema:fn,mode:"sequence",targetType:Ne},mn=F({type:Ot,target:y(f(),I(/^element:[^/]+\/.+/)),payload:fe(jt,{})}),Mt=F({id:y(f(),b(1)),title:y(f(),b(1)),summary:S(f()),tone:S(ge(["create","update","delete","move","meta"])),stale:S(ge(["unsupported-action-type","target-missing","constraint-violated"]))}),Re=s=>{if(s.type!==Ne)return null;const e=s.id.indexOf("/");if(e<=0)return null;try{return decodeURIComponent(s.id.slice(0,e))}catch{return null}},T=s=>s.type!==C&&Re(s.target)!==null,yn=(s,e)=>s.filter(t=>T(t)&&Re(t.target)===e),Pt=(s,e)=>{const t=new Map(s.flatMap(n=>T(n)?[[n.id,Re(n.target)]]:[]));return new Map(e.flatMap(n=>n.results.flatMap(i=>t.get(i.id)===n.id?[[i.id,i]]:[])))},ze=Object.freeze({}),Ue=s=>{const e=s.startsWith("#")?s.slice(1):s;if(e.length===0)return ze;const t=new URLSearchParams(e.startsWith("?")?e.slice(1):e),n={};for(const[i,r]of t)i.length>0&&r.length>0&&(n[i]=r);return n},V=s=>{const e=new URLSearchParams;for(const n of Object.keys(s).sort((i,r)=>i<r?-1:i>r?1:0)){const i=s[n];i!=null&&i!==""&&e.set(n,i)}const t=e.toString();return t.length===0?"":`#${t}`},Ie=(s,e)=>{const t={...s};for(const[n,i]of Object.entries(e))i==null||i===""?delete t[n]:t[n]=i;return t},bn=(s,e="json")=>`\`\`\`${e}
451
- ${s}
452
- \`\`\``,vn=s=>JSON.stringify({type:s.type,target:s.target,payload:s.payload,...s.note===void 0?{}:{note:s.note}},null,2),Le=(s,e,t)=>{const{actions:n,state:i}=s,r=n.filter(a=>a.type===C),o=n.filter(a=>a.type!==C),l=[];if(l.push(`# Review draft \u2014 ${e.label}`),l.push(""),l.push(`- template: \`${e.name}\``),l.push(`- framework: \`dev-process-kit@${t}\``),l.push(`- navigation: \`${V(s.navigation)||"(none)"}\``),l.push(`- pending: ${o.length} change(s), ${r.length} comment(s)`),s.stale.length>0&&l.push(`- stale (not applicable to the current base): ${s.stale.length}`),l.push(""),l.push("## How to apply"),l.push(""),l.push("These are patches against the base HTML, not a command log. Apply the requested end state to the meaning model, keep the stable ids of surviving concepts, and keep the base JSON free of any draft envelope."),o.some(T)&&(l.push(""),l.push("Changes targeting `element:<id>/\u2026` belong to the component with that `id` (for example a diagram): apply them to that component's own JSON, following its documented action vocabulary.")),l.push(""),r.length>0){l.push(`## Comments (${r.length})`),l.push("");for(const[a,p]of r.entries()){const d=e.describe(p,i,s.base);l.push(`${a+1}. **${d.targetLabel}** \u2014 \`${E(p.target)}\``),l.push(` > ${Pe(p).replace(/\n/g,`
453
- > `)}`)}l.push("")}if(o.length>0){l.push(`## Requested changes (${o.length})`),l.push("");for(const[a,p]of o.entries()){const d=e.describe(p,i,s.base),c=d.summary?` \u2014 ${d.summary}`:"";l.push(`${a+1}. **${d.title}**${c}`),l.push(` target: \`${E(p.target)}\` (${p.target.type})`),l.push(` \`\`\`json
454
- ${vn(p).replace(/\n/g,`
455
- `)}
456
- \`\`\``)}l.push("")}return o.length===0&&r.length===0&&(l.push("_No pending draft actions._"),l.push("")),l.push("## Canonical draft (JSON)"),l.push(""),l.push(bn(Me(n))),l.push(""),l.join(`
457
- `)},W="0.0.1",Nt=async s=>{try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(s),!0}catch{}const e=document.activeElement,t=document.createElement("textarea");try{return t.value=s,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select(),document.execCommand("copy")}catch{return!1}finally{t.remove(),e instanceof HTMLElement&&e.focus()}},kn=()=>({body:"",attachment:{kind:"page"},copy:{kind:"idle"},copyRequest:0}),Rt=s=>s.kind==="explicit"?{kind:s.resume}:s,zt=(s,e)=>{switch(e.kind){case"input":return{...s,body:e.body};case"attach":return{...s,attachment:{kind:e.current?"current":"page"}};case"clear-target":return{...s,attachment:Rt(s.attachment)};case"target-requested":return{...s,attachment:{kind:"explicit",ref:e.ref,resume:s.attachment.kind==="explicit"?s.attachment.resume:s.attachment.kind}};case"submitted":return{...s,body:"",attachment:Rt(s.attachment),copy:{kind:"idle"},copyRequest:s.copyRequest+1};case"copy-started":return{...s,copy:{kind:"pending",format:e.format},copyRequest:s.copyRequest+1};case"copy-finished":return e.request!==s.copyRequest||s.copy.kind!=="pending"?s:{...s,copy:e.ok?{kind:"copied",format:s.copy.format}:{kind:"failed"}}}},xn=(s,e)=>{const t=s.body.trim();return t===""?null:{target:e,body:t}},Ut=s=>s.group?`${s.group} \xB7 ${s.label}`:s.label,It=(s,e)=>{const{definition:t,state:n,navigation:i,derivation:r}=s,o=t.currentTarget?.(n,i)??null,l=e.attachment,a=l.kind==="explicit"?t.commentTargets(n,i).find(c=>c.value===l.ref):null,p=l.kind==="explicit"?{ref:l.ref,label:a?Ut(a):l.ref}:l.kind==="current"&&o?{ref:o.value,label:Ut(o)}:{ref:`page:${t.name}`,label:"\u30DA\u30FC\u30B8\u5168\u4F53"},d=new Map(r.stale.map(c=>[c.action.id,c.reason]));return{body:e.body,target:p,attachment:l.kind==="explicit"?{kind:"explicit"}:o?{kind:"checkbox",checked:l.kind==="current",group:o.group??""}:{kind:"none"},canSubmit:e.body.trim().length>0,items:r.actions.map(c=>{const u=t.describe(c,n,r.base),h=c.type==="comment";return{id:c.id,title:h?"\u30B3\u30E1\u30F3\u30C8":u.title,targetLabel:u.targetLabel,tone:h?"comment":u.tone,text:{kind:h?"comment":"summary",body:h?Pe(c):u.summary??""},code:t.serialize(c),stale:d.get(c.id)??null}}),issues:s.issues.map(c=>`${c.path?`${c.path}: `:""}${c.message}`),flash:e.copy.kind==="copied"?`copied ${e.copy.format==="json"?"JSON":"brief"} \u2713`:e.copy.kind==="failed"?"copy failed":""}},$n=[pe,de,P`
458
- :host {
459
- display: flex;
460
- flex-direction: column;
461
- min-height: 0;
462
- width: 100%;
463
- background: var(--dpk-paper-raised);
464
- }
465
-
466
- header {
467
- display: flex;
468
- align-items: center;
469
- justify-content: space-between;
470
- gap: 8px;
471
- padding: 14px 16px 12px;
472
- border-bottom: 1px solid var(--dpk-rule);
473
- background: linear-gradient(180deg, var(--dpk-paper-raised), var(--dpk-paper));
474
- }
475
-
476
- header h2 {
477
- font-size: 13.5px;
478
- font-weight: 620;
479
- letter-spacing: -0.01em;
480
- }
481
-
482
- .composer {
483
- display: grid;
484
- gap: 10px;
485
- padding: 14px 16px 14px;
486
- border-bottom: 1px solid var(--dpk-rule);
487
- background: var(--dpk-paper-sunken);
488
- }
489
-
490
- .composer textarea {
491
- min-height: 62px;
492
- background: var(--dpk-paper-raised);
493
- border-radius: var(--dpk-radius);
494
- }
495
-
496
- .composer .row {
497
- display: flex;
498
- align-items: center;
499
- gap: 8px;
500
- }
501
-
502
- .composer .attach {
503
- display: inline-flex;
504
- align-items: center;
505
- gap: 7px;
506
- font-size: 12px;
507
- color: var(--dpk-ink-soft);
508
- cursor: pointer;
509
- }
510
-
511
- .composer .attach input {
512
- width: 14px;
513
- height: 14px;
514
- margin: 0;
515
- accent-color: var(--dpk-accent);
516
- cursor: pointer;
517
- }
518
-
519
- .composer .chip {
520
- display: inline-flex;
521
- align-items: center;
522
- gap: 6px;
523
- padding: 3px 10px;
524
- border: 1px solid var(--dpk-rule);
525
- border-radius: 999px;
526
- background: var(--dpk-paper-raised);
527
- font-size: 11.5px;
528
- cursor: pointer;
529
- }
530
-
531
- .composer .chip svg {
532
- flex: none;
533
- width: 12px;
534
- height: 12px;
535
- }
536
-
537
- .composer .chip:hover {
538
- border-color: var(--dpk-rule-strong);
539
- }
540
-
541
- .target-line {
542
- margin-right: auto;
543
- font-family: var(--dpk-mono);
544
- font-size: 10px;
545
- letter-spacing: 0.03em;
546
- color: var(--dpk-ink-faint);
547
- }
548
-
549
- .list {
550
- list-style: none;
551
- margin: 0;
552
- padding: 10px 12px;
553
- overflow: auto;
554
- flex: 1;
555
- min-height: 0;
556
- display: grid;
557
- gap: 8px;
558
- align-content: start;
559
- }
560
-
561
- .item {
562
- position: relative;
563
- display: grid;
564
- gap: 4px;
565
- padding: 10px 12px 11px 14px;
566
- border: 1px solid var(--dpk-rule);
567
- border-radius: var(--dpk-radius);
568
- background: var(--dpk-paper-raised);
569
- box-shadow: var(--dpk-shadow-xs);
570
- transition:
571
- box-shadow 160ms ease,
572
- border-color 160ms ease;
573
- }
574
-
575
- .item:hover {
576
- box-shadow: var(--dpk-shadow-sm);
577
- }
578
-
579
- .item::before {
580
- content: '';
581
- position: absolute;
582
- left: 0;
583
- top: 10px;
584
- bottom: 10px;
585
- width: 3px;
586
- border-radius: 0 2px 2px 0;
587
- background: var(--tone, var(--dpk-ink-faint));
588
- }
589
-
590
- .item[data-tone='comment'] {
591
- --tone: var(--dpk-accent);
592
- background: linear-gradient(90deg, var(--dpk-accent-soft), transparent 55%);
593
- }
594
-
595
- .item[data-tone='create'] {
596
- --tone: var(--dpk-green);
597
- }
598
-
599
- .item[data-tone='update'] {
600
- --tone: var(--dpk-blue);
601
- }
602
-
603
- .item[data-tone='delete'] {
604
- --tone: var(--dpk-accent);
605
- }
606
-
607
- .item[data-tone='move'] {
608
- --tone: var(--dpk-violet);
609
- }
610
-
611
- .item[data-stale='true'] {
612
- opacity: 0.5;
613
- border-style: dashed;
614
- box-shadow: none;
615
- }
616
-
617
- .item-head {
618
- display: flex;
619
- align-items: center;
620
- gap: 6px;
621
- }
622
-
623
- .item-title {
624
- font-size: 12.5px;
625
- font-weight: 600;
626
- }
627
-
628
- .stale-badge {
629
- padding: 1px 7px;
630
- border: 1px solid var(--dpk-rule-strong);
631
- border-radius: 999px;
632
- font-family: var(--dpk-mono);
633
- font-size: 9px;
634
- letter-spacing: 0.06em;
635
- text-transform: uppercase;
636
- color: var(--dpk-ink-faint);
637
- }
638
-
639
- .item-head .dpk-icon-btn {
640
- margin-left: auto;
641
- }
642
-
643
- .item-target {
644
- font-family: var(--dpk-mono);
645
- font-size: 10px;
646
- color: var(--dpk-ink-faint);
647
- }
648
-
649
- .item-summary {
650
- font-size: 12px;
651
- color: var(--dpk-ink-soft);
652
- }
653
-
654
- .item-body {
655
- margin: 2px 0 0;
656
- padding-left: 9px;
657
- border-left: 2px solid var(--dpk-accent);
658
- font-size: 12.5px;
659
- white-space: pre-wrap;
660
- }
661
-
662
- .item-code {
663
- margin-top: 2px;
664
- font-family: var(--dpk-mono);
665
- font-size: 10px;
666
- color: var(--dpk-ink-faint);
667
- overflow-wrap: anywhere;
668
- }
669
-
670
- .empty {
671
- padding: 6px 4px;
672
- font-size: 12px;
673
- line-height: 1.7;
674
- color: var(--dpk-ink-faint);
675
- }
676
-
677
- .issues {
678
- margin: 10px 12px 0;
679
- padding: 9px 11px;
680
- border: 1px solid rgba(194, 64, 15, 0.35);
681
- border-radius: var(--dpk-radius-sm);
682
- background: var(--dpk-accent-soft);
683
- font-size: 11.5px;
684
- }
685
-
686
- .issues ul {
687
- margin: 4px 0 0;
688
- padding-left: 16px;
689
- }
690
-
691
- footer {
692
- display: flex;
693
- flex-wrap: wrap;
694
- align-items: center;
695
- gap: 8px;
696
- padding: 12px 16px;
697
- border-top: 1px solid var(--dpk-rule);
698
- background: linear-gradient(180deg, var(--dpk-paper-sunken), var(--dpk-paper-inset));
699
- }
700
-
701
- .flash {
702
- font-family: var(--dpk-mono);
703
- font-size: 10px;
704
- letter-spacing: 0.04em;
705
- color: var(--dpk-green);
706
- }
707
- `],wn={CHILD:2},Lt=s=>(...e)=>({_$litDirective$:s,values:e});let Bt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const{I:An}=zs,Dt=s=>s,Ht=()=>document.createComment(""),se=(s,e,t)=>{const n=s._$AA.parentNode,i=e===void 0?s._$AB:e._$AA;if(t===void 0){const r=n.insertBefore(Ht(),i),o=n.insertBefore(Ht(),i);t=new An(r,o,s,s.options)}else{const r=t._$AB.nextSibling,o=t._$AM,l=o!==s;if(l){let a;t._$AQ?.(s),t._$AM=s,t._$AP!==void 0&&(a=s._$AU)!==o._$AU&&t._$AP(a)}if(r!==i||l){let a=t._$AA;for(;a!==r;){const p=Dt(a).nextSibling;Dt(n).insertBefore(a,i),a=p}}}return t},D=(s,e,t=s)=>(s._$AI(e,t),s),_n={},qt=(s,e=_n)=>s._$AH=e,Sn=s=>s._$AH,Be=s=>{s._$AR(),s._$AA.remove()},Kt=(s,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(s[i],i);return n},Ft=Lt(class extends Bt{constructor(s){if(super(s),s.type!==wn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],r=[];let o=0;for(const l of s)i[o]=n?n(l,o):o,r[o]=t(l,o),o++;return{values:r,keys:i}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,n]){const i=Sn(s),{values:r,keys:o}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=o,r;const l=this.ut??=[],a=[];let p,d,c=0,u=i.length-1,h=0,v=r.length-1;for(;c<=u&&h<=v;)if(i[c]===null)c++;else if(i[u]===null)u--;else if(l[c]===o[h])a[h]=D(i[c],r[h]),c++,h++;else if(l[u]===o[v])a[v]=D(i[u],r[v]),u--,v--;else if(l[c]===o[v])a[v]=D(i[c],r[v]),se(s,a[v+1],i[c]),c++,v--;else if(l[u]===o[h])a[h]=D(i[u],r[h]),se(s,i[c],i[u]),u--,h++;else if(p===void 0&&(p=Kt(o,h,v),d=Kt(l,c,u)),p.has(l[c]))if(p.has(l[u])){const _=d.get(o[h]),A=_!==void 0?i[_]:null;if(A===null){const M=se(s,i[c]);D(M,r[h]),a[h]=M}else a[h]=D(A,r[h]),se(s,i[c],A),i[_]=null;h++}else Be(i[u]),u--;else Be(i[c]),c++;for(;h<=v;){const _=se(s,a[v+1]);D(_,r[h]),a[h++]=_}for(;c<=u;){const _=i[c++];_!==null&&Be(_)}return this.ut=o,qt(s,a),z}}),De=()=>g`<svg
708
- viewBox="0 0 16 16"
709
- fill="none"
710
- stroke="currentColor"
711
- stroke-width="1.5"
712
- stroke-linecap="round"
713
- stroke-linejoin="round"
714
- aria-hidden="true"
715
- focusable="false"
716
- >
717
- <path d="M4 4l8 8M12 4l-8 8" />
718
- </svg>`,En=()=>g`<svg
719
- viewBox="0 0 16 16"
720
- fill="none"
721
- stroke="currentColor"
722
- stroke-width="1.5"
723
- stroke-linecap="round"
724
- stroke-linejoin="round"
725
- aria-hidden="true"
726
- focusable="false"
727
- >
728
- <path d="M3.5 5h9M5.5 5V3.5a1 1 0 011-1h3a1 1 0 011 1V5" />
729
- <path d="M5 5l.5 7.5h5L11 5" />
730
- <path d="M6.8 7.5v3.5M9.2 7.5v3.5" />
731
- </svg>`,Cn=()=>g`<svg
732
- viewBox="0 0 16 16"
733
- fill="none"
734
- stroke="currentColor"
735
- stroke-width="1.5"
736
- stroke-linecap="round"
737
- stroke-linejoin="round"
738
- aria-hidden="true"
739
- focusable="false"
740
- >
741
- <path d="M3 13l1.5-1.5M11.3 2.7a1.5 1.5 0 012.1 2.1L5.5 12.7l-3 .8.8-3z" />
742
- </svg>`,Tn=()=>g`<svg
743
- viewBox="0 0 16 16"
744
- fill="none"
745
- stroke="currentColor"
746
- stroke-width="1.5"
747
- stroke-linecap="round"
748
- stroke-linejoin="round"
749
- aria-hidden="true"
750
- focusable="false"
751
- >
752
- <path d="M3.5 3.5h9a1 1 0 011 1v5a1 1 0 01-1 1H8.2l-2.7 2.2v-2.2H3.5a1 1 0 01-1-1v-5a1 1 0 011-1z" />
753
- </svg>`,On=()=>g`<svg
754
- viewBox="0 0 16 16"
755
- fill="none"
756
- stroke="currentColor"
757
- stroke-width="1.5"
758
- stroke-linecap="round"
759
- stroke-linejoin="round"
760
- aria-hidden="true"
761
- focusable="false"
762
- >
763
- <path d="M6.5 9.5l3-3" />
764
- <path d="M7 5.5l1-1a2.1 2.1 0 013 3l-1 1" />
765
- <path d="M9 10.5l-1 1a2.1 2.1 0 01-3-3l1-1" />
766
- </svg>`,jn=()=>g`<svg
767
- viewBox="0 0 16 16"
768
- fill="none"
769
- stroke="currentColor"
770
- stroke-width="1.5"
771
- stroke-linecap="round"
772
- stroke-linejoin="round"
773
- aria-hidden="true"
774
- focusable="false"
775
- >
776
- <path d="M8 3.5v9M3.5 8h9" />
777
- </svg>`,Mn=()=>g`<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" focusable="false">
778
- <circle cx="6.5" cy="4.5" r="1" />
779
- <circle cx="9.5" cy="4.5" r="1" />
780
- <circle cx="6.5" cy="8" r="1" />
781
- <circle cx="9.5" cy="8" r="1" />
782
- <circle cx="6.5" cy="11.5" r="1" />
783
- <circle cx="9.5" cy="11.5" r="1" />
784
- </svg>`,Pn=()=>g`<svg
785
- viewBox="0 0 16 16"
786
- fill="none"
787
- stroke="currentColor"
788
- stroke-width="1.5"
789
- stroke-linecap="round"
790
- stroke-linejoin="round"
791
- aria-hidden="true"
792
- focusable="false"
793
- >
794
- <path
795
- d="M8 2.5v11M8 2.5L5.5 5M8 2.5l2.5 2.5M8 13.5l-2.5-2.5M8 13.5l2.5-2.5M2.5 8h11M2.5 8L5 5.5M2.5 8l2.5 2.5M13.5 8L11 5.5M13.5 8L11 10.5"
796
- />
797
- </svg>`,Nn=()=>g`<svg
798
- viewBox="0 0 16 16"
799
- fill="none"
800
- stroke="currentColor"
801
- stroke-width="1.5"
802
- stroke-linecap="round"
803
- stroke-linejoin="round"
804
- aria-hidden="true"
805
- focusable="false"
806
- >
807
- <path d="M8 12.5V3.5M4.5 7L8 3.5 11.5 7" />
808
- </svg>`,Rn=()=>g`<svg
809
- viewBox="0 0 16 16"
810
- fill="none"
811
- stroke="currentColor"
812
- stroke-width="1.5"
813
- stroke-linecap="round"
814
- stroke-linejoin="round"
815
- aria-hidden="true"
816
- focusable="false"
817
- >
818
- <path d="M8 3.5v9M4.5 9L8 12.5 11.5 9" />
819
- </svg>`,zn=()=>g`<svg
820
- viewBox="0 0 16 16"
821
- fill="none"
822
- stroke="currentColor"
823
- stroke-width="1.5"
824
- stroke-linecap="round"
825
- stroke-linejoin="round"
826
- aria-hidden="true"
827
- focusable="false"
828
- >
829
- <path d="M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5L9 7M2.5 13.5L7 9" />
830
- </svg>`,Un=()=>g`<svg
831
- viewBox="0 0 16 16"
832
- fill="none"
833
- stroke="currentColor"
834
- stroke-width="1.5"
835
- stroke-linecap="round"
836
- stroke-linejoin="round"
837
- aria-hidden="true"
838
- focusable="false"
839
- >
840
- <path d="M13.5 7h-4.5v-4.5M2.5 9h4.5v4.5M9 7l4.5-4.5M7 9l-4.5 4.5" />
841
- </svg>`,In=(s,e,t=!1)=>g`
842
- ${t?m:g`<header><h2>Review notes</h2></header>`}
843
- ${s.issues.length>0?g`<div class="issues" role="alert">
844
- <strong>Action rejected.</strong>
845
- <ul>
846
- ${s.issues.map(n=>g`<li>${n}</li>`)}
847
- </ul>
848
- </div>`:m}
849
- <div class="composer">
850
- <textarea
851
- class="dpk-textarea"
852
- aria-label="レビューコメント"
853
- placeholder="変更したいこと / 気づきを書く(Agent への指示として渡る)"
854
- .value=${s.body}
855
- @input=${n=>{n.currentTarget instanceof HTMLTextAreaElement&&e({kind:"input",body:n.currentTarget.value})}}
856
- @keydown=${n=>{!n.isComposing&&n.key==="Enter"&&(n.metaKey||n.ctrlKey)&&(n.preventDefault(),e({kind:"submit"}))}}
857
- ></textarea>
858
- ${s.attachment.kind==="explicit"?g`<div class="row">
859
- <button class="chip" type="button" aria-label="紐づけを解除" @click=${()=>e({kind:"clear-target"})}>
860
- ${s.target.label} ${De()}
861
- </button>
862
- </div>`:s.attachment.kind==="checkbox"?g`<div class="row">
863
- <label class="attach">
864
- <input
865
- type="checkbox"
866
- .checked=${s.attachment.checked}
867
- @change=${n=>{n.currentTarget instanceof HTMLInputElement&&e({kind:"attach",current:n.currentTarget.checked})}}
868
- />
869
- <span>この ${s.attachment.group} に紐づける</span>
870
- </label>
871
- </div>`:m}
872
- <div class="row">
873
- <span class="target-line">→ ${s.target.label}</span>
874
- <button
875
- class="dpk-btn dpk-btn--accent"
876
- type="button"
877
- ?disabled=${!s.canSubmit}
878
- @click=${()=>e({kind:"submit"})}
879
- >
880
- Add note
881
- </button>
882
- </div>
883
- </div>
884
- <ul class="list">
885
- ${s.items.length===0?g`<li class="empty">
886
- No draft actions yet.<br />
887
- Comments and structural patches both land here, and survive reload via LocalStorage.
888
- </li>`:Ft(s.items,n=>n.id,n=>Ln(n,e))}
889
- </ul>
890
- <footer>
891
- ${t?m:g`
892
- <button class="dpk-btn" type="button" @click=${()=>e({kind:"copy",format:"json"})}>
893
- Copy JSON
894
- </button>
895
- <button class="dpk-btn" type="button" @click=${()=>e({kind:"copy",format:"brief"})}>
896
- Copy brief
897
- </button>
898
- `}
899
- <button
900
- class="dpk-btn dpk-btn--ghost"
901
- type="button"
902
- ?disabled=${s.items.length===0}
903
- @click=${()=>e({kind:"clear"})}
904
- >
905
- Clear
906
- </button>
907
- ${s.flash?g`<span class="flash" role="status">${s.flash}</span>`:m}
908
- </footer>
909
- `,Ln=(s,e)=>g`
910
- <li class="item" data-tone=${s.tone} data-stale=${String(s.stale!==null)}>
911
- <div class="item-head">
912
- <span class="item-title">${s.title}</span>
913
- ${s.stale?g`<span class="stale-badge">${s.stale}</span>`:m}
914
- <button
915
- class="dpk-icon-btn"
916
- type="button"
917
- aria-label="この draft action を削除"
918
- @click=${()=>e({kind:"delete",id:s.id})}
919
- >
920
- ${De()}
921
- </button>
922
- </div>
923
- <div class="item-target">${s.targetLabel}</div>
924
- ${s.text.kind==="comment"?g`<p class="item-body">${s.text.body}</p>`:s.text.body?g`<div class="item-summary">${s.text.body}</div>`:m}
925
- <code class="item-code">${s.code}</code>
926
- </li>
927
- `;class Jt extends j{static{this.styles=$n}static{this.properties={definition:{attribute:!1},state:{attribute:!1},navigation:{attribute:!1},derivation:{attribute:!1},issues:{attribute:!1},pendingTarget:{attribute:!1},onDelete:{attribute:!1},onClear:{attribute:!1},onComment:{attribute:!1},exportBrief:{attribute:!1},embedded:{type:Boolean}}}#t=kn();constructor(){super(),this.embedded=!1,this.definition=null,this.state=void 0,this.navigation={},this.derivation=null,this.issues=[],this.pendingTarget=null}willUpdate(e){e.has("pendingTarget")&&this.pendingTarget&&(this.#t=zt(this.#t,{kind:"target-requested",ref:this.pendingTarget}))}updated(e){e.has("pendingTarget")&&this.pendingTarget&&this.isConnected&&this.renderRoot.querySelector("textarea")?.focus()}#r(){return!this.definition||!this.derivation?null:{definition:this.definition,state:this.state,navigation:this.navigation,derivation:this.derivation,issues:this.issues}}render(){const e=this.#r();return e?In(It(e,this.#t),this.#i,this.embedded):m}#e(e){this.#t=zt(this.#t,e),this.requestUpdate()}#i=e=>{switch(e.kind){case"delete":this.onDelete?.(e.id);return;case"clear":this.onClear?.();return;case"copy":this.#o(e.format);return;case"submit":{const t=this.#r();if(!t||!this.onComment)return;const n=xn(this.#t,It(t,this.#t).target.ref);if(!n||!this.onComment(n.target,n.body).ok)return;this.#e({kind:"submitted"});return}default:this.#e(e)}};async#o(e){const t=this.#r();if(!t)return;this.#e({kind:"copy-started",format:e});const n=this.#t.copyRequest;try{const i=e==="json"?Me(t.derivation.actions):this.exportBrief?.()??Le({...t.derivation,navigation:t.navigation,issues:t.issues},t.definition,W),r=await Nt(i);this.isConnected&&this.#e({kind:"copy-finished",request:n,ok:r})}catch{this.isConnected&&this.#e({kind:"copy-finished",request:n,ok:!1})}}}const Bn=()=>{customElements.get("dpk-component-comment-panel")||customElements.define("dpk-component-comment-panel",Jt)},Vt=L(F({value:y(f(),I(/^element:.+/)),label:y(f(),b(1)),group:S(f())})),Dn=w({targets:Vt,providers:L(w({id:y(f(),b(1)),results:L(Mt)}))}),Hn=F({target:y(f(),I(/^element:.+/)),body:y(f(),Ce(),b(1))}),Wt=s=>s.group?`${s.group} \xB7 ${s.label}`:s.label,Gt=(s,e,t)=>{const n=new Map(e.map(i=>[i.value,i]));return{...s,hasTarget:(i,r)=>s.hasTarget(i,r)||n.has(E(r)),commentTargets:(i,r)=>{const o=s.commentTargets(i,r),l=new Set(o.map(a=>a.value));return[...o,...e.filter(a=>!l.has(a.value))]},describe:(i,r,o)=>{if(T(i)){const p=t.get(i.id),d=n.get(E(i.target));return{title:p?.title??i.type,...p?.summary===void 0?{}:{summary:p.summary},tone:p?.tone??"update",targetLabel:d?Wt(d):i.target.id}}const l=s.describe(i,r,o),a=i.type==="comment"&&!s.hasTarget(r,i.target)?n.get(E(i.target)):void 0;return a===void 0?l:{...l,targetLabel:Wt(a)}},serialize:i=>T(i)?`${i.type} ${E(i.target)} ${JSON.stringify(i.payload)}`:s.serialize(i)}},Yt=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function Zt(s){return typeof Yt.Buffer<"u"&&Yt.Buffer.isBuffer(s)}function Qt(s){if(!s||typeof s!="object")return!1;const e=Object.getPrototypeOf(s);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(s)==="[object Object]":!1}function Xt(s){return Object.getOwnPropertySymbols(s).filter(e=>Object.prototype.propertyIsEnumerable.call(s,e))}function es(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}const qn="[object RegExp]",Kn="[object String]",Fn="[object Number]",Jn="[object Boolean]",Vn="[object Symbol]",Wn="[object Date]",Gn="[object Map]",Yn="[object Set]",Zn="[object Array]",Qn="[object Function]",Xn="[object ArrayBuffer]",He="[object Object]",ei="[object Error]",ti="[object DataView]",si="[object Uint8Array]",ni="[object Uint8ClampedArray]",ii="[object Uint16Array]",ri="[object Uint32Array]",oi="[object BigUint64Array]",ai="[object Int8Array]",li="[object Int16Array]",ci="[object Int32Array]",pi="[object BigInt64Array]",di="[object Float32Array]",ui="[object Float64Array]";function hi(s,e){return s===e||Number.isNaN(s)&&Number.isNaN(e)}function fi(s,e,t){return ne(s,e,void 0,void 0,void 0,void 0,t)}function ne(s,e,t,n,i,r,o){const l=o(s,e,t,n,i,r);if(l!==void 0)return l;if(typeof s==typeof e)switch(typeof s){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return s===e;case"number":return s===e||Object.is(s,e);case"function":return s===e;case"object":return ie(s,e,r,o)}return ie(s,e,r,o)}function ie(s,e,t,n){if(Object.is(s,e))return!0;let i=es(s),r=es(e);if(i==="[object Arguments]"&&(i=He),r==="[object Arguments]"&&(r=He),i!==r)return!1;switch(i){case Kn:return s.toString()===e.toString();case Fn:return hi(s.valueOf(),e.valueOf());case Jn:case Wn:case Vn:return Object.is(s.valueOf(),e.valueOf());case qn:return s.source===e.source&&s.flags===e.flags;case Qn:return s===e}t=t??new Map;const o=t.get(s),l=t.get(e);if(o!=null&&l!=null)return o===e;t.set(s,e),t.set(e,s);try{switch(i){case Gn:if(s.size!==e.size)return!1;for(const[a,p]of s.entries())if(!e.has(a)||!ne(p,e.get(a),a,s,e,t,n))return!1;return!0;case Yn:{if(s.size!==e.size)return!1;const a=Array.from(s.values()),p=Array.from(e.values());for(let d=0;d<a.length;d++){const c=a[d],u=p.findIndex(h=>ne(c,h,void 0,s,e,t,n));if(u===-1)return!1;p.splice(u,1)}return!0}case Zn:case si:case ni:case ii:case ri:case oi:case ai:case li:case ci:case pi:case di:case ui:if(Zt(s)!==Zt(e)||s.length!==e.length)return!1;for(let a=0;a<s.length;a++)if(!ne(s[a],e[a],a,s,e,t,n))return!1;return!0;case Xn:return s.byteLength!==e.byteLength?!1:ie(new Uint8Array(s),new Uint8Array(e),t,n);case ti:return s.byteLength!==e.byteLength||s.byteOffset!==e.byteOffset?!1:ie(new Uint8Array(s),new Uint8Array(e),t,n);case ei:return s.name===e.name&&s.message===e.message;case He:{if(!(ie(s.constructor,e.constructor,t,n)||Qt(s)&&Qt(e)))return!1;const a=[...Object.keys(s),...Xt(s)],p=[...Object.keys(e),...Xt(e)];if(a.length!==p.length)return!1;for(let d=0;d<a.length;d++){const c=a[d],u=s[c];if(!Object.hasOwn(e,c))return!1;const h=e[c];if(!ne(u,h,c,s,e,t,n))return!1}return!0}default:return!1}}finally{t.delete(s),t.delete(e)}}function gi(){}function be(s,e){return fi(s,e,gi)}const ts="page",ss=s=>E(s),ns=(s,e,t,n=new Map)=>{let i=e;const r=[],o=[],l=[],a=[],p=new Map;for(const c of t){if(c.type===C)continue;if(T(c)){const v=n.get(c.id);v===void 0||v.stale!==void 0?o.push({action:c,reason:v?.stale??"target-missing"}):r.push(c);continue}const u=ye(s.actions,c.type);if(!u){o.push({action:c,reason:"unsupported-action-type"});continue}const h=s.apply(i,c);if(h===null){o.push({action:c,reason:s.hasTarget(i,c.target)?"constraint-violated":"target-missing"});continue}if(u.mode!=="append"&&qe(s,i,h)){l.push(c);continue}i=h,r.push(c)}for(const c of t){if(c.type!==C)continue;if(c.target.type!==ts&&!s.hasTarget(i,c.target)){o.push({action:c,reason:"target-missing"});continue}a.push(c);const u=ss(c.target);p.set(u,[...p.get(u)??[],c])}const d=new Map(t.map((c,u)=>[c.id,u]));return o.sort((c,u)=>(d.get(c.action.id)??0)-(d.get(u.action.id)??0)),{base:e,state:i,actions:t,applied:r,stale:o,obsolete:l,comments:a,commentsByTarget:p}},qe=(s,e,t)=>e===t?!0:s.canonicalState===void 0?be(e,t):be(s.canonicalState(e),s.canonicalState(t)),is=s=>{const e=new Set(s.obsolete.map(t=>t.id));return s.actions.filter(t=>!e.has(t.id))},mi=(s,e,t,n)=>{let i=e;const r=n??rs(i).map(o=>o.id);for(const o of[...r].reverse())i=yi(s,i,t,o,n!==void 0)??i;return i},rs=s=>s.applied.filter(e=>!T(e)),yi=(s,e,t,n,i)=>{const r=rs(e),o=r.findIndex(u=>u.id===n),l=r[o];if(l===void 0)return null;const a=r.slice(0,o),p=[...i?bi(s,e.base,r,o):[],...vi(s,a,l)],d=new Set,c=p.filter(u=>{const h=u.join(" ");return d.has(h)?!1:(d.add(h),!0)}).sort((u,h)=>h.length-u.length);for(const u of c){const h=ki(s,e,t,u);if(h!==null)return h}return null},bi=(s,e,t,n)=>{const i=[];let r=e;for(const o of t.slice(0,n+1))i.push(r),r=s.apply(r,o)??r;return i.flatMap((o,l)=>qe(s,o,r)?[t.slice(l,n+1).map(a=>a.id)]:[])},vi=(s,e,t)=>{const n=os(t),i=e.filter(a=>os(a).some(p=>n.includes(p))),r=as(s,t),o=i.filter(a=>as(s,a)===r),l=a=>a.map((p,d)=>[...a.slice(d).map(c=>c.id),t.id]);return[...l(i),...l(o),...i.map(a=>[a.id,t.id]),...i.map(a=>[a.id])]},os=s=>{const e=s.target.type===ts?[]:s.target.id.split("."),t=typeof s.payload=="object"&&s.payload!==null?Object.values(s.payload).filter(n=>typeof n=="string"&&n!==""):[];return[...e,...t]},as=(s,e)=>ye(s.actions,e.type)?.mode,ki=(s,e,t,n)=>{const i=new Set(e.stale.map(o=>o.action.id)),r=new Set(n);for(;;){const o=t(e.actions.filter(a=>!r.has(a.id))),l=o.stale.filter(a=>!i.has(a.action.id)).map(a=>a.action);if(l.length===0)return qe(s,o.state,e.state)?o:null;if(l.some(a=>a.type===C||T(a)))return null;for(const a of l)r.add(a.id)}},xi=w({v:K(1),template:y(f(),b(1)),actions:L(B())});class Ke{constructor(e){this.storage=e}load(e,t){try{const n=this.storage.getItem(e);if(n===null)return[];const i=x(xi,JSON.parse(n));return!i.success||i.output.template!==t?[]:i.output.actions.flatMap(r=>{const o=x(J,r);return o.success?[o.output]:[]})}catch{return[]}}save(e,t,n){const i={v:1,template:t,actions:n};try{this.storage.setItem(e,JSON.stringify(i))}catch{}}clear(e){try{this.storage.removeItem(e)}catch{}}}class Fe{constructor(){this.store=new Map}load(e,t){return new Ke({getItem:n=>this.store.get(n)??null,setItem:(n,i)=>{this.store.set(n,i)},removeItem:n=>{this.store.delete(n)}}).load(e,t)}save(e,t,n){this.store.set(e,JSON.stringify({v:1,template:t,actions:n}))}clear(e){this.store.delete(e)}}const Je=()=>{try{if(typeof localStorage<"u")return new Ke(localStorage)}catch{}return new Fe},ls=s=>`dev-process-kit:draft:${typeof location>"u"?"local":`${location.pathname}${location.search}`}:${s}`,$i=L(B());class cs{#t;#r;#e={targets:[],providers:[]};#i=new Map;#o;#s;#n;#c;#p;#d=new Set;#f=[];#g=0;constructor(e){this.#t=e.definition,this.#r=Gt(e.definition,[],this.#i),this.#o=e.base,this.#p=e.storageKey??ls(e.definition.name),this.#c=e.storage===void 0?Je():e.storage;const t=e.initialActions??this.#c?.load(this.#p,this.definition.name)??[];this.#s=ds(this.definition,t),this.#n=this.#a(this.#s),this.#$()&&this.#k()}get definition(){return this.#r}setComponentSnapshot(e){const t=wt(Dn,e);if(!be(t,this.#e)){this.#e=t,this.#m(),this.#n=this.#a(this.#s);for(const n of this.#d)n()}}#m(){this.#i=Pt(this.#s,this.#e.providers),this.#r=Gt(this.#t,this.#e.targets,this.#i)}#a(e){return ns(this.definition,this.#o,e,Pt(e,this.#e.providers))}get base(){return this.#o}get actions(){return this.#s}get derivation(){return this.#n}get lastIssues(){return this.#f}get prunedCount(){return this.#g}descriptorFor(e,t){return ps(this.definition,e,t)}dispatch(e){const t=this.#b(e,this.#n.state);if(!t.ok)return this.#u([t.issue]);const n=this.descriptorFor(t.action.type,t.action.target);return n?(this.#l(je(this.#s,t.action,n),[t.action.id]),{ok:!0,id:t.action.id}):this.#u([{path:"type",message:"unknown action type"}])}dispatchBatch(e){const t=x($i,e);if(!t.success)return this.#u([te(t.issues)]);const n=t.output;if(n.length===0)return{ok:!0,ids:[]};let i=this.#s,r=this.#n.state;const o=[];for(const l of n){const a=this.#b(l,r);if(!a.ok)return this.#u([a.issue]);const p=a.action,d=this.descriptorFor(p.type,p.target);if(!d)return this.#u([{path:"type",message:"unknown action type"}]);if((p.type==="comment"||T(p)?p.target.type==="page"||this.definition.hasTarget(r,p.target)?r:null:this.definition.apply(r,p))===null)return this.#u([{path:"target",message:"batch action is not applicable"}]);i=je(i,p,d),r=this.#a(i).state,o.push(p.id)}return this.#l(i,o),{ok:!0,ids:o}}#b(e,t){const n=x(Et,e);if(!n.success)return{ok:!1,issue:te(n.issues)};const i=this.descriptorFor(n.output.type,typeof n.output.target=="string"?Te(n.output.target,"page"):n.output.target);if(!i)return{ok:!1,issue:{path:"type",message:`unknown action type "${n.output.type}"`}};const r=pn(n.output,i);if(!r.ok)return r;const o=this.definition.canonicalTarget?.(t,r.action.target)??r.action.target;return{ok:!0,action:{...r.action,target:o}}}#u(e){return this.#f=e,{ok:!1,issues:e}}removeAction(e){const t=this.#s.filter(n=>n.id!==e);t.length!==this.#s.length&&this.#l(t)}clearActions(){this.#s.length>0&&this.#l([])}replaceActions(e){this.#l(ds(this.definition,e))}setBase(e){this.#o=e,this.#l(this.#s)}subscribe(e){return this.#d.add(e),()=>{this.#d.delete(e)}}exportDraft(e){return{template:this.definition.name,frameworkVersion:e,exportedAt:new Date().toISOString(),actions:this.#s}}#l(e,t){this.#f=[],this.#s=e,this.#m(),this.#n=this.#a(this.#s),this.#$(t),this.#k();for(const n of this.#d)n()}#$(e){const t=this.#v(),n=mi(this.definition,this.#n,i=>this.#a(i),e);return n===this.#n?t:(this.#g+=this.#s.length-n.actions.length,this.#s=[...n.actions],this.#m(),this.#n=this.#a(this.#s),this.#v(),!0)}#v(){return this.#n.obsolete.length===0?!1:(this.#g+=this.#n.obsolete.length,this.#s=is(this.#n),this.#m(),this.#n=this.#a(this.#s),!0)}#k(){this.#c?.save(this.#p,this.definition.name,this.#s)}}const ps=(s,e,t)=>e==="comment"?Tt:t!==void 0&&T({type:e,target:t})?gn:ye(s.actions,e),ds=(s,e)=>e.flatMap(t=>{const n=x(J,t);if(!n.success)return[];const i=n.output,r=ps(s,i.type,i.target);if(!r)return[];const o=x(r.schema,i);if(!o.success)return[];const l=x(J,o.output);return l.success?[l.output]:[]}),us=s=>{const e=s.derivation();return{base:e.base,state:e.state,navigation:s.navigation(),actions:s.controller().actions,comments:e.comments,stale:e.stale,issues:s.issues()}},wi=s=>{const e=s.derivation();return{state:e.state,base:e.base,navigation:s.navigation(),actions:s.controller().actions,comments:e.comments,stale:e.stale,commentCount:t=>{const n=typeof t=="string"?t:E(t);return e.commentsByTarget.get(n)?.length??0},dispatch:t=>s.dispatch(t),dispatchBatch:t=>s.dispatchBatch(t),navigate:(t,n)=>s.navigate(t,n),hashFor:t=>s.hashFor(t),requestComment:t=>s.requestComment(t)}},Ai=(s,e)=>{const t=()=>us(s);return{version:W,template:s.definition.name,host:e,ready:s.ready,get base(){return s.controller().base},get state(){return s.derivation().state},get navigation(){return s.navigation()},get actions(){return s.controller().actions},get comments(){return s.derivation().comments},get stale(){return s.derivation().stale},get issues(){return s.issues()},dispatch:n=>s.dispatch(n),dispatchBatch:n=>s.dispatchBatch(n),comment:(n,i)=>s.dispatch({type:C,target:n,payload:{body:i}}),removeAction:n=>s.removeAction(n),clearActions:()=>s.clearActions(),importDraft:n=>s.controller().replaceActions(n),navigate:(n,i)=>s.navigate(n,i),hashFor:n=>s.hashFor(n),snapshot:t,exportDraft:()=>s.controller().exportDraft(W),exportBrief:()=>Le(t(),s.controller().definition,W),subscribe:n=>s.subscribe(n)}},_i=(s,e)=>{const t=[],n=i=>{(i===s||i instanceof ShadowRoot)&&e?.(i);for(const r of i.children)r.hasAttribute("data-template")||(("commentTargets"in r||"elementActions"in r)&&t.push(r),n(r),r.shadowRoot&&n(r.shadowRoot))};return n(s),t},hs=(s,e)=>{const t=new Map;for(const n of s)t.set(e(n),(t.get(e(n))??0)+1);return s.filter(n=>t.get(e(n))===1)},fs=s=>hs(s.filter(e=>"elementActions"in e&&e.id.length>0),e=>e.id),gs=(s,e)=>{for(const t of fs(s)){const n=yn(e,t.id),i=Reflect.get(t,"elementActions");Array.isArray(i)&&i.length===n.length&&n.every((o,l)=>{const a=i[l];return typeof a=="object"&&a!==null&&"id"in a&&a.id===o.id})||Reflect.set(t,"elementActions",n)}},Si=s=>{const e=Reflect.get(s,"elementActionResults");return Array.isArray(e)?e.flatMap(t=>{const n=x(Mt,t);return n.success?[n.output]:[]}):[]},Ei=s=>{const e=[];for(const t of s){if(!("commentTargets"in t))continue;const n=x(Vt,t.commentTargets);n.success&&e.push(...n.output)}return{targets:hs(e,t=>t.value),providers:fs(s).map(t=>({id:t.id,results:Si(t)}))}},ms=()=>Ue(typeof location>"u"?"":location.hash),Ci=(s,e)=>{if(typeof history>"u")return;const t=`${location.pathname}${location.search}${V(s)}`;`${location.pathname}${location.search}${location.hash}`!==t&&(e?history.replaceState(null,"",t):history.pushState(null,"",t))};class Ti{#t;#r=null;#e=0;constructor(e){this.#t=e}get orphans(){return this.#e}route(){const e=this.#t.renderRoot,t=ue(e.querySelector('slot[name="preview"]'),HTMLSlotElement);if(t===null)return;this.#r!==t&&(this.#r=t,t.addEventListener("slotchange",this.#i));const n=new Set(Array.from(e.querySelectorAll("slot")).map(r=>r.getAttribute("name")??"")),i=t.assignedElements();for(const r of i){const o=r.getAttribute("data-preview-id");if(!o)continue;const l=`preview:${o}`;r.getAttribute("slot")!==l&&n.has(l)&&r.setAttribute("slot",l)}i.length!==this.#e&&(this.#e=i.length,queueMicrotask(()=>this.#t.requestUpdate()))}#i=()=>{queueMicrotask(()=>this.route())}}const Oi=[pe,de,P`
928
- :host {
929
- display: block;
930
- min-height: 100%;
931
- background: var(--dpk-paper);
932
- }
933
-
934
- .dpk-shell {
935
- display: grid;
936
- grid-template-rows: auto minmax(0, 1fr) auto;
937
- min-height: 100%;
938
- max-height: 100%;
939
- }
940
-
941
- /* ------------------------------------------------------------- header */
942
-
943
- .dpk-header {
944
- display: flex;
945
- align-items: center;
946
- gap: 16px;
947
- /* Right padding keeps the header content clear of the fixed review button. */
948
- padding: 14px 78px 14px 20px;
949
- border-bottom: 1px solid var(--dpk-rule);
950
- background: linear-gradient(180deg, var(--dpk-paper-raised) 0%, var(--dpk-paper) 100%);
951
- }
952
-
953
- .dpk-title {
954
- display: flex;
955
- flex-direction: column;
956
- gap: 2px;
957
- min-width: 0;
958
- }
959
-
960
- .dpk-title h1 {
961
- font-size: 16.5px;
962
- font-weight: 620;
963
- white-space: nowrap;
964
- overflow: hidden;
965
- text-overflow: ellipsis;
966
- }
967
-
968
- .dpk-template-mark {
969
- display: inline-flex;
970
- align-items: center;
971
- gap: 6px;
972
- padding: 2px 9px 2px 7px;
973
- border-radius: 999px;
974
- background: var(--dpk-accent-soft);
975
- font-family: var(--dpk-mono);
976
- font-size: 9.5px;
977
- font-weight: 550;
978
- letter-spacing: 0.12em;
979
- text-transform: uppercase;
980
- color: var(--dpk-accent);
981
- }
982
-
983
- .dpk-template-mark::before {
984
- content: '';
985
- width: 6px;
986
- height: 6px;
987
- border-radius: 50%;
988
- background: var(--dpk-accent);
989
- }
990
-
991
- .dpk-header-slot {
992
- flex: 1;
993
- min-width: 0;
994
- display: flex;
995
- align-items: center;
996
- gap: 10px;
997
- }
998
-
999
- .dpk-header-meta {
1000
- display: flex;
1001
- align-items: center;
1002
- gap: 8px;
1003
- margin-left: auto;
1004
- padding: 4px 12px;
1005
- border-radius: 999px;
1006
- border: 1px solid var(--dpk-rule);
1007
- background: var(--dpk-paper-sunken);
1008
- font-family: var(--dpk-mono);
1009
- font-size: 10px;
1010
- letter-spacing: 0.04em;
1011
- color: var(--dpk-ink-faint);
1012
- white-space: nowrap;
1013
- }
1014
-
1015
- .dpk-header-meta span + span::before {
1016
- content: '';
1017
- display: inline-block;
1018
- width: 3px;
1019
- height: 3px;
1020
- margin-right: 8px;
1021
- vertical-align: 1px;
1022
- border-radius: 50%;
1023
- background: var(--dpk-ink-faint);
1024
- opacity: 0.5;
1025
- }
1026
-
1027
- /* --------------------------------------------------------------- body */
1028
-
1029
- .dpk-body {
1030
- display: flex;
1031
- min-height: 0;
1032
- }
1033
-
1034
- .dpk-sidebar {
1035
- width: 252px;
1036
- flex: 0 0 auto;
1037
- border-right: 1px solid var(--dpk-rule);
1038
- background: linear-gradient(180deg, var(--dpk-paper-sunken) 0%, var(--dpk-paper-inset) 100%);
1039
- overflow: auto;
1040
- padding: 16px 14px;
1041
- }
1042
-
1043
- .dpk-sidebar[hidden] {
1044
- display: none;
1045
- }
1046
-
1047
- .dpk-main {
1048
- flex: 1 1 0%;
1049
- display: flex;
1050
- flex-direction: column;
1051
- min-width: 0;
1052
- overflow: auto;
1053
- background: var(--dpk-paper);
1054
- }
1055
-
1056
- .dpk-main-body {
1057
- flex: 1 0 auto;
1058
- display: grid;
1059
- align-content: start;
1060
- gap: 16px;
1061
- min-width: 0;
1062
- padding: 24px;
1063
- }
1064
-
1065
- /*
1066
- * Author memo. It sits at the end of the main column and sticks to the
1067
- * bottom of the scrollport: always visible, floating over whatever scrolls
1068
- * behind it, and never stealing height from the preview.
1069
- */
1070
- .dpk-memo {
1071
- position: sticky;
1072
- bottom: 0;
1073
- z-index: 5;
1074
- padding: 0 20px 20px;
1075
- pointer-events: none;
1076
- }
1077
-
1078
- .dpk-memo[hidden] {
1079
- display: none;
1080
- }
1081
-
1082
- .dpk-memo ::slotted(*) {
1083
- display: block;
1084
- max-width: 100%;
1085
- padding: 10px 14px;
1086
- border: 1px solid var(--dpk-rule);
1087
- border-radius: var(--dpk-radius-lg);
1088
- background: var(--dpk-paper-raised);
1089
- box-shadow: var(--dpk-shadow-lg);
1090
- font-size: 12.5px;
1091
- line-height: 1.65;
1092
- color: var(--dpk-ink-soft);
1093
- pointer-events: auto;
1094
- }
1095
-
1096
- .dpk-orphans {
1097
- margin-top: 16px;
1098
- border: 1px dashed var(--dpk-rule-strong);
1099
- border-radius: var(--dpk-radius-sm);
1100
- padding: 10px;
1101
- }
1102
-
1103
- .dpk-banner {
1104
- display: grid;
1105
- gap: 4px;
1106
- margin-bottom: 14px;
1107
- border: 1px solid var(--dpk-accent);
1108
- border-left-width: 3px;
1109
- border-radius: var(--dpk-radius-sm);
1110
- background: var(--dpk-accent-soft);
1111
- padding: 10px 12px;
1112
- max-width: 900px;
1113
- }
1114
-
1115
- .dpk-banner strong {
1116
- font-size: 13px;
1117
- }
1118
-
1119
- .dpk-banner code {
1120
- font-family: var(--dpk-mono);
1121
- font-size: 11px;
1122
- color: var(--dpk-ink-soft);
1123
- overflow-wrap: anywhere;
1124
- }
1125
-
1126
- .dpk-notes {
1127
- flex: 0 0 auto;
1128
- width: 344px;
1129
- border-left: 1px solid var(--dpk-rule);
1130
- background: var(--dpk-paper-raised);
1131
- overflow: hidden;
1132
- display: flex;
1133
- }
1134
-
1135
- .dpk-notes[hidden] {
1136
- display: none;
1137
- }
1138
-
1139
- /* ------------------------------------------------------------- footer */
1140
-
1141
- .dpk-footer {
1142
- border-top: 1px solid var(--dpk-rule);
1143
- padding: 10px 20px;
1144
- display: flex;
1145
- gap: 12px;
1146
- align-items: center;
1147
- background: var(--dpk-paper-sunken);
1148
- font-size: 12px;
1149
- color: var(--dpk-ink-faint);
1150
- }
1151
-
1152
- /* --------------------------------------------------- floating review */
1153
-
1154
- /* Review toggle: pinned to the top right corner, always in the same place. */
1155
- .dpk-fab {
1156
- position: fixed;
1157
- top: 10px;
1158
- right: 16px;
1159
- z-index: 60;
1160
- display: inline-flex;
1161
- align-items: center;
1162
- justify-content: center;
1163
- width: 38px;
1164
- height: 38px;
1165
- padding: 0;
1166
- border: 1px solid var(--dpk-rule-strong);
1167
- border-radius: 999px;
1168
- background: var(--dpk-paper-raised);
1169
- color: var(--dpk-ink-soft);
1170
- box-shadow: var(--dpk-shadow);
1171
- cursor: pointer;
1172
- transition:
1173
- color 160ms ease,
1174
- background 160ms ease,
1175
- border-color 160ms ease,
1176
- box-shadow 160ms ease,
1177
- transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1);
1178
- }
1179
-
1180
- .dpk-fab:hover {
1181
- color: var(--dpk-ink);
1182
- transform: translateY(-2px) scale(1.05);
1183
- box-shadow: var(--dpk-shadow-lg);
1184
- }
1185
-
1186
- .dpk-fab:active {
1187
- transform: translateY(0) scale(0.97);
1188
- box-shadow: var(--dpk-shadow-xs);
1189
- }
1190
-
1191
- .dpk-fab:focus-visible {
1192
- outline: none;
1193
- box-shadow: var(--dpk-focus);
1194
- }
1195
-
1196
- .dpk-fab[aria-expanded='true'] {
1197
- color: var(--dpk-accent-ink);
1198
- border-color: transparent;
1199
- background: linear-gradient(135deg, var(--dpk-accent), #c23e12);
1200
- box-shadow: 0 2px 8px rgba(217, 73, 32, 0.3);
1201
- }
1202
-
1203
- .dpk-fab[aria-expanded='true']:hover {
1204
- box-shadow: 0 4px 14px rgba(217, 73, 32, 0.4);
1205
- }
1206
-
1207
- .dpk-fab-icon {
1208
- position: relative;
1209
- display: block;
1210
- width: 16px;
1211
- height: 12px;
1212
- border: 1.6px solid currentColor;
1213
- border-radius: 3.5px;
1214
- }
1215
-
1216
- .dpk-fab-icon::after {
1217
- content: '';
1218
- position: absolute;
1219
- left: 2px;
1220
- bottom: -4px;
1221
- border-left: 3.5px solid transparent;
1222
- border-right: 3.5px solid transparent;
1223
- border-top: 4px solid currentColor;
1224
- }
1225
-
1226
- .dpk-fab-badge {
1227
- position: absolute;
1228
- top: -5px;
1229
- right: -5px;
1230
- min-width: 18px;
1231
- height: 18px;
1232
- padding: 0 4px;
1233
- border: 2px solid var(--dpk-paper-raised);
1234
- border-radius: 999px;
1235
- background: linear-gradient(135deg, #e55a2b, var(--dpk-accent));
1236
- color: var(--dpk-accent-ink);
1237
- font-family: var(--dpk-mono);
1238
- font-size: 9.5px;
1239
- font-weight: 600;
1240
- font-variant-numeric: tabular-nums;
1241
- line-height: 14px;
1242
- text-align: center;
1243
- box-shadow: 0 1px 4px rgba(217, 73, 32, 0.3);
1244
- }
1245
- `];class ji extends j{static{this.styles=Oi}static{this.properties={storageKey:{type:String,attribute:"storage-key"},storage:{type:String},notes:{type:String},notesOpen:{state:!0}}}#t=!1;#r=new Ti(this);#e;#i=ze;#o=null;#s=new Set;#n=null;#c;#p;#d;#f=[];#g;#m=new Promise(e=>{this.#g=e});#a;connectedCallback(){super.connectedCallback(),this.dataset.template=this.definition.name,this.#t||(this.#t=!0,this.notesOpen=this.notes==="on"||this.notes==="open"),this.#b(),window.addEventListener("hashchange",this.#A),this.addEventListener("click",this.#C),this.addEventListener("dpk-comment-targets-change",this.#h),this.addEventListener("dpk-comment-request",this.#_),this.addEventListener("dpk-comment-submit",this.#S),this.addEventListener("dpk-element-action",this.#E),this.#d??=new MutationObserver(this.#h),this.#h()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("hashchange",this.#A),this.removeEventListener("click",this.#C),this.#p?.disconnect(),this.#d?.disconnect(),this.removeEventListener("dpk-comment-targets-change",this.#h),this.removeEventListener("dpk-comment-request",this.#_),this.removeEventListener("dpk-comment-submit",this.#S),this.removeEventListener("dpk-element-action",this.#E)}#b(e=0){if(this.#e){this.#u();return}if(this.childNodes.length===0&&e<2){queueMicrotask(()=>this.#b(e+1));return}this.#T()}#u(){this.#c||(this.#c=this.#e?.subscribe(()=>this.#P()))}updated(){this.#N()}get api(){return this.#a??=this.#$(),this.#a}get controller(){if(!this.#e)throw new Error(`<${this.tagName.toLowerCase()}> is not initialized yet`);return this.#e}get derivation(){return this.controller.derivation}get navigation(){return this.#i}dispatch(e){const t=this.controller.dispatch(e);return t.ok||(this.requestUpdate(),this.dispatchEvent(new CustomEvent("dpk-error",{detail:{issues:t.issues},bubbles:!0,composed:!0})),this.#y()),t}dispatchBatch(e){const t=this.controller.dispatchBatch(e);return t.ok||(this.requestUpdate(),this.dispatchEvent(new CustomEvent("dpk-error",{detail:{issues:t.issues},bubbles:!0,composed:!0})),this.#y()),t}removeAction(e){this.controller.removeAction(e)}clearActions(){this.controller.clearActions()}navigate(e,t={}){const n=V(this.#x());this.#i=Ie(this.#i,e),this.#w(t.replace??!1);const i=V(this.#x());this.requestUpdate(),n!==i&&(this.#y(),this.dispatchEvent(new CustomEvent("dpk-navigate",{detail:{navigation:this.#i},bubbles:!0,composed:!0})))}hashFor(e){const t=this.#x();return V(this.definition.resolveNavigation(this.derivation.state,Ie(t,e)))}requestComment(e){this.#o=typeof e=="string"?e:E(e),this.notesOpen=!0,this.requestUpdate()}get integratedReview(){return!1}renderReviewPanel(e){return g`<dpk-component-comment-panel
1246
- .definition=${this.controller.definition}
1247
- .state=${e.state}
1248
- .navigation=${e.navigation}
1249
- .derivation=${this.derivation}
1250
- .issues=${this.controller.lastIssues}
1251
- .exportBrief=${()=>this.api.exportBrief()}
1252
- .pendingTarget=${this.#o}
1253
- .embedded=${this.integratedReview}
1254
- .onDelete=${t=>this.removeAction(t)}
1255
- .onClear=${()=>this.clearActions()}
1256
- .onComment=${(t,n)=>{const i=this.dispatch({type:C,target:t,payload:{body:n}});return i.ok&&(this.#o=null),i}}
1257
- ></dpk-component-comment-panel>`}renderChrome(e,t){const n=e.actions.length,i=e.comments.length;return g`
1258
- <div class="dpk-shell">
1259
- <header class="dpk-header">
1260
- <div class="dpk-title">
1261
- <span class="dpk-template-mark">${this.definition.label}</span>
1262
- <h1>${this.definition.title(e.state)}</h1>
1263
- </div>
1264
- <div class="dpk-header-slot">
1265
- ${t.header??m}
1266
- <slot name="header"></slot>
1267
- </div>
1268
- <div class="dpk-header-meta">
1269
- <span>dev-process-kit@${W}</span>
1270
- <span>${this.definition.name}</span>
1271
- <span>${n} draft · ${i} note</span>
1272
- </div>
1273
- </header>
1274
- <div class="dpk-body">
1275
- <aside
1276
- class="dpk-sidebar"
1277
- ?hidden=${t.sidebarHidden||!t.sidebar&&!this.hasSidebarContent()}
1278
- >
1279
- ${t.sidebar??m}
1280
- <slot name="sidebar"></slot>
1281
- </aside>
1282
- <main class="dpk-main">
1283
- <div class="dpk-main-body">
1284
- ${this.#n?g`<div class="dpk-banner" role="alert">
1285
- <strong>base data を読み込めませんでした(空のページとして表示中)</strong>
1286
- <code>${this.#n}</code>
1287
- </div>`:m}
1288
- ${t.main??m}
1289
- <slot name="main"></slot>
1290
- <section class="dpk-orphans" ?hidden=${this.#r.orphans===0}>
1291
- <p class="dpk-label">previews without metadata</p>
1292
- <slot name="preview"></slot>
1293
- </section>
1294
- </div>
1295
- <div class="dpk-memo" ?hidden=${!this.hasMemoContent()}>
1296
- <slot name="memo"></slot>
1297
- </div>
1298
- </main>
1299
- ${this.integratedReview?m:g`<aside class="dpk-notes" ?hidden=${!this.notesOpen}>${this.renderReviewPanel(e)}</aside>`}
1300
- </div>
1301
- ${t.footer||this.hasFooterContent()?g`<footer class="dpk-footer">
1302
- ${t.footer??m}
1303
- <slot name="footer"></slot>
1304
- </footer>`:m}
1305
- ${this.integratedReview?m:g`<button
1306
- class="dpk-fab"
1307
- type="button"
1308
- aria-expanded=${this.notesOpen?"true":"false"}
1309
- title="レビュー / コメント"
1310
- @click=${()=>{this.notesOpen=!this.notesOpen}}
1311
- >
1312
- <span class="dpk-fab-icon" aria-hidden="true"></span>
1313
- <span
1314
- class="dpk-label"
1315
- style="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)"
1316
- >
1317
- レビュー
1318
- </span>
1319
- ${n>0?g`<span class="dpk-fab-badge">${n}</span>`:m}
1320
- </button>`}
1321
- </div>
1322
- `}render(){if(!this.#e)return m;const e=this.#k();return this.renderChrome(e,this.renderRegions(e))}hasSidebarContent(){return this.querySelector('[slot="sidebar"]')!==null}hasMemoContent(){return this.querySelector('[slot="memo"]')!==null}hasFooterContent(){return this.querySelector('[slot="footer"]')!==null}context(){return this.#k()}#l(){return{definition:this.definition,controller:()=>this.controller,derivation:()=>this.derivation,ready:this.#m,navigation:()=>this.#x(),issues:()=>this.controller.lastIssues,dispatch:e=>this.dispatch(e),dispatchBatch:e=>this.dispatchBatch(e),subscribe:e=>(this.#s.add(e),()=>{this.#s.delete(e)}),removeAction:e=>this.removeAction(e),clearActions:()=>this.clearActions(),navigate:(e,t)=>this.navigate(e,t),hashFor:e=>this.hashFor(e),requestComment:e=>this.requestComment(e)}}#$(){return Ai(this.#l(),this)}#v(){return us(this.#l())}#k(){return wi(this.#l())}#x(){return this.definition.resolveNavigation(this.derivation.state,this.#i)}#T(){const e=this.#j();this.#i=ms();const t=this.storageKey;this.#e=new cs({definition:this.definition,base:e,storage:this.#O(),...typeof t=="string"?{storageKey:t}:{}}),this.#u(),this.#h(),this.#w(!0),this.#g?.(),this.#M(),this.requestUpdate()}#O(){return this.storage==="off"?null:this.storage==="memory"?new Fe:Je()}#j(){const e=this.querySelector('script[type="application/json"]');if(!e?.textContent||e.textContent.trim().length===0)return console.warn(`[dev-process-kit] <${this.tagName.toLowerCase()}> has no base JSON; starting from an empty state.`),this.#n='no <script type="application/json"> child found',this.definition.emptyBase();try{return this.definition.parseBase(JSON.parse(e.textContent))}catch(t){return console.error("[dev-process-kit] invalid base data:",t),this.#n=t instanceof Error?t.message:String(t),this.definition.emptyBase()}}#M(){this.querySelector('script[type="application/json"]')||(this.#p=new MutationObserver(()=>{const e=this.querySelector('script[type="application/json"]');if(e){this.#p?.disconnect(),this.#p=void 0;try{this.controller.setBase(this.definition.parseBase(JSON.parse(e.textContent??"null")))}catch(t){console.error("[dev-process-kit] invalid base data:",t)}}}),this.#p.observe(this,{childList:!0,subtree:!0}))}#y(){const e=this.#v();for(const t of this.#s)t(e)}#P(){if(!this.isConnected){this.requestUpdate(),this.#y();return}this.#w(!0),gs(this.#f,this.controller.actions),queueMicrotask(this.#h),this.requestUpdate(),this.#y(),this.dispatchEvent(new CustomEvent("dpk-change",{detail:this.#v(),bubbles:!0,composed:!0}))}#w(e){const t=this.#x();this.#i=t,Ci(t,e)}#A=()=>{this.#i=ms(),this.#w(!0),this.requestUpdate(),this.#y(),this.dispatchEvent(new CustomEvent("dpk-navigate",{detail:{navigation:this.#i},bubbles:!0,composed:!0}))};#h=()=>{this.#d?.disconnect(),this.#f=_i(this,e=>{this.isConnected&&this.#d?.observe(e,{childList:!0,subtree:!0})}),this.#e&&(gs(this.#f,this.#e.actions),this.#e.setComponentSnapshot(Ei(this.#f)))};#_=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!this.#e)return;const t=e.detail;typeof t!="object"||t===null||!("target"in t)||typeof t.target!="string"||(this.#h(),!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(i=>i.value===t.target))||this.requestComment(t.target)};#S=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!e.cancelable||!this.#e)return;const t=x(Hn,e.detail);if(!t.success)return;this.#h();const{target:n,body:i}=t.output;if(!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(l=>l.value===n))return;this.dispatch({type:C,target:n,payload:{body:i}}).ok&&e.preventDefault()};#E=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!e.cancelable||!this.#e)return;const t=x(mn,e.detail);if(!t.success)return;this.#h();const{type:n,target:i,payload:r}=t.output;if(!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(a=>a.value===i))return;this.dispatch({type:n,target:i,payload:r}).ok&&e.preventDefault()};#C=e=>{for(const t of e.composedPath()){if(!(t instanceof Element))continue;if(t===this||t.hasAttribute("data-template"))break;const n=t.getAttribute("data-dpk-navigate");if(n!==null){e.preventDefault(),this.navigate(Ue(n.includes("=")?n:`step=${n}`));return}const i=t.getAttribute("data-dpk-comment");if(i!==null){e.preventDefault(),this.requestComment(i);return}}};#N(){this.#r.route()}}const Mi=(s,e)=>{typeof window>"u"||Object.assign(window,{devProcessKit:{version:s,templates:e}})};export{P as $,Tn as A,Mn as B,C,Jt as D,ze as E,W as F,On as G,Pn as H,Cn as I,jn as J,En as K,is as L,Fe as M,Ue as N,At as O,sn as P,Ie as Q,nn as R,Me as S,ji as T,_t as U,E as V,Ke as W,me as X,Te as Y,pe as Z,Bs as _,Mi as a,m as a0,g as a1,Ft as a2,Ts as a3,j as a4,zn as a5,Un as a6,wt as a7,F as a8,fe as a9,L as aa,f as ab,ge as ac,y as ad,b as ae,bt as af,$t as ag,B as ah,K as ai,gt as aj,x as ak,w as al,mt as am,Ce as an,ht as ao,ut as ap,yt as aq,S as ar,Xs as as,be as at,ue as au,Nt as av,en as aw,Lt as ax,Bt as ay,qt as az,Tt as b,dt as c,cs as d,je as e,rn as f,Le as g,Ct as h,Pe as i,ss as j,de as k,St as l,cn as m,Oe as n,Je as o,ls as p,tn as q,Bn as r,Ds as s,ns as t,J as u,an as v,V as w,Rn as x,Nn as y,De as z};