@webmcpui/core 0.1.0 → 0.1.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.
package/dist/index.d.ts CHANGED
@@ -189,11 +189,6 @@ declare class WmcpInput extends WmcpFormControl {
189
189
  protected toolInputSchema(): JSONSchema;
190
190
  protected renderControl(): lit.TemplateResult<1>;
191
191
  }
192
- declare global {
193
- interface HTMLElementTagNameMap {
194
- 'wmcp-input': WmcpInput;
195
- }
196
- }
197
192
 
198
193
  /**
199
194
  * `<wmcp-textarea>` — a form-associated, agent-operable multi-line text input.
@@ -212,11 +207,6 @@ declare class WmcpTextarea extends WmcpFormControl {
212
207
  protected get controlNoun(): string;
213
208
  protected renderControl(): lit.TemplateResult<1>;
214
209
  }
215
- declare global {
216
- interface HTMLElementTagNameMap {
217
- 'wmcp-textarea': WmcpTextarea;
218
- }
219
- }
220
210
 
221
211
  interface WmcpSelectOption {
222
212
  value: string;
@@ -266,11 +256,6 @@ declare class WmcpSelect extends WmcpFormControl {
266
256
  private renderOption;
267
257
  protected renderControl(): lit.TemplateResult<1>;
268
258
  }
269
- declare global {
270
- interface HTMLElementTagNameMap {
271
- 'wmcp-select': WmcpSelect;
272
- }
273
- }
274
259
 
275
260
  /**
276
261
  * `<wmcp-checkbox>` — a form-associated, agent-operable boolean checkbox.
@@ -305,11 +290,6 @@ declare class WmcpCheckbox extends WmcpFormControl {
305
290
  protected renderControl(): lit.TemplateResult<1>;
306
291
  render(): lit.TemplateResult<1>;
307
292
  }
308
- declare global {
309
- interface HTMLElementTagNameMap {
310
- 'wmcp-checkbox': WmcpCheckbox;
311
- }
312
- }
313
293
 
314
294
  interface WmcpRadioOption {
315
295
  value: string;
@@ -362,12 +342,6 @@ declare class WmcpRadioGroup extends WmcpFormControl {
362
342
  protected renderControl(): lit.TemplateResult<1>;
363
343
  render(): lit.TemplateResult<1>;
364
344
  }
365
- declare global {
366
- interface HTMLElementTagNameMap {
367
- 'wmcp-radio': WmcpRadio;
368
- 'wmcp-radio-group': WmcpRadioGroup;
369
- }
370
- }
371
345
 
372
346
  /**
373
347
  * Register all webmcpui custom elements. Idempotent — safe to call more than
@@ -376,3 +350,14 @@ declare global {
376
350
  declare function defineComponents(): void;
377
351
 
378
352
  export { JSONSchema, StandardSchemaV1, type ValidationOutcome, WmcpCheckbox, WmcpFormControl, WmcpInput, type WmcpInputType, WmcpRadio, WmcpRadioGroup, type WmcpRadioOption, WmcpSelect, type WmcpSelectItem, type WmcpSelectOption, type WmcpSelectOptionGroup, WmcpTextarea, defineComponents, isStandardSchema, textFieldStyles, validateStandard };
353
+
354
+ declare global {
355
+ interface HTMLElementTagNameMap {
356
+ 'wmcp-input': import('./index.js').WmcpInput;
357
+ 'wmcp-textarea': import('./index.js').WmcpTextarea;
358
+ 'wmcp-select': import('./index.js').WmcpSelect;
359
+ 'wmcp-checkbox': import('./index.js').WmcpCheckbox;
360
+ 'wmcp-radio': import('./index.js').WmcpRadio;
361
+ 'wmcp-radio-group': import('./index.js').WmcpRadioGroup;
362
+ }
363
+ }
@@ -1,7 +1,7 @@
1
- "use strict";var webmcpui=(()=>{var me=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Bt=Object.prototype.hasOwnProperty;var jt=(i,e)=>{for(var t in e)me(i,t,{get:e[t],enumerable:!0})},zt=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Vt(e))!Bt.call(i,s)&&s!==t&&me(i,s,{get:()=>e[s],enumerable:!(r=rt(e,s))||r.enumerable});return i};var qt=i=>zt(me({},"__esModule",{value:!0}),i),v=(i,e,t,r)=>{for(var s=r>1?void 0:r?rt(e,t):e,o=i.length-1,n;o>=0;o--)(n=i[o])&&(s=(r?n(e,t,s):n(s))||s);return r&&s&&me(e,t,s),s};var ur={};jt(ur,{WmcpCheckbox:()=>G,WmcpFormControl:()=>p,WmcpInput:()=>q,WmcpRadio:()=>X,WmcpRadioGroup:()=>D,WmcpSelect:()=>U,WmcpTextarea:()=>F,defineComponents:()=>Ue,exposeTool:()=>Ne,isStandardSchema:()=>Me,isWebMCPAvailable:()=>Nt,textFieldStyles:()=>k,validateStandard:()=>Pe});var it=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var T=function(i,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!s:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(i,t):s?s.value=t:e.set(i,t),t},E=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},J,ve,fe,ee,He,te,ge,H,re,N,be,st;var S={__proto__:null};S.enumerable=!0;Object.freeze(S);var We=(N=class{constructor(e,t={}){if(J.set(this,!1),ve.set(this,!1),fe.set(this,!1),ee.set(this,!1),He.set(this,Date.now()),te.set(this,!1),ge.set(this,void 0),H.set(this,void 0),re.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof t!="object"||!t)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:s,composed:o}=t;T(this,J,!!s,"f"),T(this,ve,!!r,"f"),T(this,fe,!!o,"f"),T(this,ge,`${e}`,"f"),T(this,H,null,"f"),T(this,re,!1,"f")}initEvent(e,t,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){T(this,ee,!0,"f")}get target(){return E(this,H,"f")}get currentTarget(){return E(this,H,"f")}get srcElement(){return E(this,H,"f")}get type(){return E(this,ge,"f")}get cancelable(){return E(this,J,"f")}get defaultPrevented(){return E(this,J,"f")&&E(this,ee,"f")}get timeStamp(){return E(this,He,"f")}composedPath(){return E(this,re,"f")?[E(this,H,"f")]:[]}get returnValue(){return!E(this,J,"f")||!E(this,ee,"f")}get bubbles(){return E(this,ve,"f")}get composed(){return E(this,fe,"f")}get eventPhase(){return E(this,re,"f")?N.AT_TARGET:N.NONE}get cancelBubble(){return E(this,te,"f")}set cancelBubble(e){e&&T(this,te,!0,"f")}stopPropagation(){T(this,te,!0,"f")}get isTrusted(){return!1}},J=new WeakMap,ve=new WeakMap,fe=new WeakMap,ee=new WeakMap,He=new WeakMap,te=new WeakMap,ge=new WeakMap,H=new WeakMap,re=new WeakMap,N.NONE=0,N.CAPTURING_PHASE=1,N.AT_TARGET=2,N.BUBBLING_PHASE=3,N);Object.defineProperties(We.prototype,{initEvent:S,stopImmediatePropagation:S,preventDefault:S,target:S,currentTarget:S,srcElement:S,type:S,cancelable:S,defaultPrevented:S,timeStamp:S,composedPath:S,returnValue:S,bubbles:S,composed:S,eventPhase:S,cancelBubble:S,stopPropagation:S,isTrusted:S});var ot=(st=class extends We{constructor(e,t={}){super(e,t),be.set(this,void 0),T(this,be,t?.detail??null,"f")}initCustomEvent(e,t,r,s){throw new Error("Method not implemented.")}get detail(){return E(this,be,"f")}},be=new WeakMap,st);Object.defineProperties(ot.prototype,{detail:S});var R=We,Ve=ot;var x;var yr=(x=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},x.STYLE_RULE=1,x.CHARSET_RULE=2,x.IMPORT_RULE=3,x.MEDIA_RULE=4,x.FONT_FACE_RULE=5,x.PAGE_RULE=6,x.NAMESPACE_RULE=10,x.KEYFRAMES_RULE=7,x.KEYFRAME_RULE=8,x.SUPPORTS_RULE=12,x.COUNTER_STYLE_RULE=11,x.FONT_FEATURE_VALUES_RULE=14,x.MARGIN_RULE=9,x);globalThis.Event??=R;globalThis.CustomEvent??=Ve;var je=Symbol(),nt=i=>typeof i=="boolean"?i:i?.capture??!1,C={__proto__:null};C.enumerable=!0;Object.freeze(C);var _e=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,r){if(t==null)return;let s=nt(r)?this.__captureEventListeners:this.__eventListeners,o=s.get(e);if(o===void 0)o=new Map,s.set(e,o);else if(o.has(t))return;let n=typeof r=="object"&&r?r:{};n.signal?.addEventListener("abort",()=>this.removeEventListener(e,t,r)),o.set(t,n??{})}removeEventListener(e,t,r){if(t==null)return;let s=nt(r)?this.__captureEventListeners:this.__eventListeners,o=s.get(e);o!==void 0&&(o.delete(t),o.size||s.delete(e))}dispatchEvent(e){let t=this.__resolveFullEventPath();!e.composed&&this.__host&&(t=t.slice(0,t.indexOf(this.__host)));let r=!1,s=!1,o=R.NONE,n=null,l=null,a=null,m=e.stopPropagation,_=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get(){return n??l},...C},srcElement:{get(){return e.target},...C},currentTarget:{get(){return a},...C},eventPhase:{get(){return o},...C},composedPath:{value:()=>t,...C},stopPropagation:{value:()=>{r=!0,m.call(e)},...C},stopImmediatePropagation:{value:()=>{s=!0,_.call(e)},...C}});let c=(g,A,Q)=>{typeof g=="function"?g(e):typeof g?.handleEvent=="function"&&g.handleEvent(e),A.once&&Q.delete(g)},u=()=>(a=null,o=R.NONE,!e.defaultPrevented),d=t.slice().reverse();n=!this.__host||!e.composed?this:null;let y=g=>{for(l=this;l.__host&&g.includes(l.__host);)l=l.__host};for(let g of d){!n&&(!l||l===g.__host)&&y(d.slice(d.indexOf(g))),a=g,o=g===e.target?R.AT_TARGET:R.CAPTURING_PHASE;let A=g.__captureEventListeners.get(e.type);if(A){for(let[Q,De]of A)if(c(Q,De,A),s)return u()}if(r)return u()}let w=e.bubbles?t:[this];l=null;for(let g of w){!n&&(!l||g===l.__host)&&y(w.slice(0,w.indexOf(g)+1)),a=g,o=g===e.target?R.AT_TARGET:R.BUBBLING_PHASE;let A=g.__eventListeners.get(e.type);if(A){for(let[Q,De]of A)if(c(Q,De,A),s)return u()}if(r)return u()}return u()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,ct,Jt]}};var at=new WeakMap,ie=i=>{let e=at.get(i);return e===void 0&&at.set(i,e=new Map),e},se=class extends _e{getRootNode(e){return e?.composed?Be:this.__host?.__shadowRoot??Be}};var lt=class extends se{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var ct=new lt,Be=ct;var ht=class extends se{constructor(e){if(super(),e!==je)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:ye,customElements:qe,document:Be,Document:lt,Element:dt,EventTarget:_e,HTMLElement:pt,Node:se,ShadowRoot:ut,window:this,Window:ht})}};var dt=class extends se{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ie(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){ie(this).set(e,String(t))}removeAttribute(e){ie(this).delete(e)}toggleAttribute(e,t){if(this.hasAttribute(e)){if(t===void 0||!t)return this.removeAttribute(e),!1}else return t===void 0||t?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return ie(this).has(e)}attachShadow(e){this.__shadowRootMode=e.mode;let t=new ut(je,e);return t.__eventTargetParent=this,t.__host=this,this.__shadowRoot=t}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new it(this);return this.__internals=e,e}getAttribute(e){return ie(this).get(e)??null}};var pt=class extends dt{},ze=pt;var ut=class extends se{get host(){return this.__host}constructor(e,t){if(super(),e!==e)throw new TypeError("Illegal constructor");this.mode=t.mode}};globalThis.litServerRoot??=Object.defineProperty(new ze,"localName",{get(){return"lit-server-root"}});function Ft(){let i,e;return{promise:new Promise((r,s)=>{i=r,e=s}),resolve:i,reject:e}}var ye=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(e,t){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
- Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${e}" has already been used with this registry`);if(this.__reverseDefinitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(t)}`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:t.observedAttributes??[]}),this.__reverseDefinitions.set(t,e),this.__pendingWhenDefineds.get(e)?.resolve(t),this.__pendingWhenDefineds.delete(e)}get(e){return this.__definitions.get(e)?.ctor}getName(e){return this.__reverseDefinitions.get(e)??null}initialize(e){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(e){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(e){let t=this.__definitions.get(e);if(t)return t.ctor;let r=this.__pendingWhenDefineds.get(e);return r||(r=Ft(),this.__pendingWhenDefineds.set(e,r)),r.promise}},Gt=ye;var qe=new Gt,Jt=new ht(je);var oe=globalThis,Se=oe.ShadowRoot&&(oe.ShadyCSS===void 0||oe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Fe=Symbol(),mt=new WeakMap,ne=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Fe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Se&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=mt.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&mt.set(t,e))}return e}toString(){return this.cssText}},vt=i=>new ne(typeof i=="string"?i:i+"",void 0,Fe),$=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,s,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[o+1],i[0]);return new ne(t,i,Fe)},ft=(i,e)=>{if(Se)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),s=oe.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=t.cssText,i.appendChild(r)}},Ge=Se||oe.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return vt(t)})(i):i;var{is:Kt,defineProperty:Yt,getOwnPropertyDescriptor:Zt,getOwnPropertyNames:Xt,getOwnPropertySymbols:Qt,getPrototypeOf:er}=Object,ce=globalThis;ce.customElements??=qe;var gt=ce.trustedTypes,tr=gt?gt.emptyScript:"",rr=ce.reactiveElementPolyfillSupport,ae=(i,e)=>i,le={toAttribute(i,e){switch(e){case Boolean:i=i?tr:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},Ee=(i,e)=>!Kt(i,e),bt={attribute:!0,type:String,converter:le,reflect:!1,useDefault:!1,hasChanged:Ee};Symbol.metadata??=Symbol("metadata"),ce.litPropertyMetadata??=new WeakMap;var O=class extends(globalThis.HTMLElement??ze){static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=bt){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){let r=Symbol(),s=this.getPropertyDescriptor(e,r,t);s!==void 0&&Yt(this.prototype,e,s)}}static getPropertyDescriptor(e,t,r){let{get:s,set:o}=Zt(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get:s,set(n){let l=s?.call(this);o?.call(this,n),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??bt}static _$Ei(){if(this.hasOwnProperty(ae("elementProperties")))return;let e=er(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ae("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ae("properties"))){let t=this.properties,r=[...Xt(t),...Qt(t)];for(let s of r)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,s]of t)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let s=this._$Eu(t,r);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let s of r)t.unshift(Ge(s))}else e!==void 0&&t.push(Ge(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r: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_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ft(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,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,r);if(s!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:le).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,s=r._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let o=r.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:le;this._$Em=s;let l=n.fromAttribute(t,o.type);this[s]=l??this._$Ej?.get(s)??l,this._$Em=null}}requestUpdate(e,t,r,s=!1,o){if(e!==void 0){let n=this.constructor;if(s===!1&&(o=this[e]),r??=n.getPropertyOptions(e),!((r.hasChanged??Ee)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:s,wrapped:o},n){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),o!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let 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(let[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[s,o]of r){let{wrapped:n}=o,l=this[s];n!==!0||this._$AL.has(s)||l===void 0||this.C(s,void 0,o,l)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}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){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[ae("elementProperties")]=new Map,O[ae("finalized")]=new Map,rr?.({ReactiveElement:O}),(ce.reactiveElementVersions??=[]).push("2.1.2");var Ce=globalThis,_t=i=>i,xe=Ce.trustedTypes,yt=xe?xe.createPolicy("lit-html",{createHTML:i=>i}):void 0,Ke="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,Ye="?"+P,ir=`<${Ye}>`,B=Ce.document===void 0?{createTreeWalker:()=>({})}:document,de=()=>B.createComment(""),pe=i=>i===null||typeof i!="object"&&typeof i!="function",Ze=Array.isArray,At=i=>Ze(i)||typeof i?.[Symbol.iterator]=="function",Je=`[
1
+ "use strict";var webmcpui=(()=>{var me=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Bt=Object.prototype.hasOwnProperty;var jt=(i,e)=>{for(var t in e)me(i,t,{get:e[t],enumerable:!0})},zt=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Vt(e))!Bt.call(i,s)&&s!==t&&me(i,s,{get:()=>e[s],enumerable:!(r=rt(e,s))||r.enumerable});return i};var qt=i=>zt(me({},"__esModule",{value:!0}),i),v=(i,e,t,r)=>{for(var s=r>1?void 0:r?rt(e,t):e,o=i.length-1,n;o>=0;o--)(n=i[o])&&(s=(r?n(e,t,s):n(s))||s);return r&&s&&me(e,t,s),s};var pr={};jt(pr,{WmcpCheckbox:()=>G,WmcpFormControl:()=>u,WmcpInput:()=>q,WmcpRadio:()=>X,WmcpRadioGroup:()=>D,WmcpSelect:()=>U,WmcpTextarea:()=>F,defineComponents:()=>Ue,exposeTool:()=>Ne,isStandardSchema:()=>Me,isWebMCPAvailable:()=>Nt,textFieldStyles:()=>k,validateStandard:()=>Pe});var it=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var T=function(i,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!s:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(i,t):s?s.value=t:e.set(i,t),t},E=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},J,ve,fe,ee,He,te,ge,H,re,N,_e,st;var S={__proto__:null};S.enumerable=!0;Object.freeze(S);var We=(N=class{constructor(e,t={}){if(J.set(this,!1),ve.set(this,!1),fe.set(this,!1),ee.set(this,!1),He.set(this,Date.now()),te.set(this,!1),ge.set(this,void 0),H.set(this,void 0),re.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof t!="object"||!t)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:s,composed:o}=t;T(this,J,!!s,"f"),T(this,ve,!!r,"f"),T(this,fe,!!o,"f"),T(this,ge,`${e}`,"f"),T(this,H,null,"f"),T(this,re,!1,"f")}initEvent(e,t,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){T(this,ee,!0,"f")}get target(){return E(this,H,"f")}get currentTarget(){return E(this,H,"f")}get srcElement(){return E(this,H,"f")}get type(){return E(this,ge,"f")}get cancelable(){return E(this,J,"f")}get defaultPrevented(){return E(this,J,"f")&&E(this,ee,"f")}get timeStamp(){return E(this,He,"f")}composedPath(){return E(this,re,"f")?[E(this,H,"f")]:[]}get returnValue(){return!E(this,J,"f")||!E(this,ee,"f")}get bubbles(){return E(this,ve,"f")}get composed(){return E(this,fe,"f")}get eventPhase(){return E(this,re,"f")?N.AT_TARGET:N.NONE}get cancelBubble(){return E(this,te,"f")}set cancelBubble(e){e&&T(this,te,!0,"f")}stopPropagation(){T(this,te,!0,"f")}get isTrusted(){return!1}},J=new WeakMap,ve=new WeakMap,fe=new WeakMap,ee=new WeakMap,He=new WeakMap,te=new WeakMap,ge=new WeakMap,H=new WeakMap,re=new WeakMap,N.NONE=0,N.CAPTURING_PHASE=1,N.AT_TARGET=2,N.BUBBLING_PHASE=3,N);Object.defineProperties(We.prototype,{initEvent:S,stopImmediatePropagation:S,preventDefault:S,target:S,currentTarget:S,srcElement:S,type:S,cancelable:S,defaultPrevented:S,timeStamp:S,composedPath:S,returnValue:S,bubbles:S,composed:S,eventPhase:S,cancelBubble:S,stopPropagation:S,isTrusted:S});var ot=(st=class extends We{constructor(e,t={}){super(e,t),_e.set(this,void 0),T(this,_e,t?.detail??null,"f")}initCustomEvent(e,t,r,s){throw new Error("Method not implemented.")}get detail(){return E(this,_e,"f")}},_e=new WeakMap,st);Object.defineProperties(ot.prototype,{detail:S});var R=We,Ve=ot;var $;var yr=($=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},$.STYLE_RULE=1,$.CHARSET_RULE=2,$.IMPORT_RULE=3,$.MEDIA_RULE=4,$.FONT_FACE_RULE=5,$.PAGE_RULE=6,$.NAMESPACE_RULE=10,$.KEYFRAMES_RULE=7,$.KEYFRAME_RULE=8,$.SUPPORTS_RULE=12,$.COUNTER_STYLE_RULE=11,$.FONT_FEATURE_VALUES_RULE=14,$.MARGIN_RULE=9,$);globalThis.Event??=R;globalThis.CustomEvent??=Ve;var je=Symbol(),nt=i=>typeof i=="boolean"?i:i?.capture??!1,C={__proto__:null};C.enumerable=!0;Object.freeze(C);var be=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,r){if(t==null)return;let s=nt(r)?this.__captureEventListeners:this.__eventListeners,o=s.get(e);if(o===void 0)o=new Map,s.set(e,o);else if(o.has(t))return;let n=typeof r=="object"&&r?r:{};n.signal?.addEventListener("abort",()=>this.removeEventListener(e,t,r)),o.set(t,n??{})}removeEventListener(e,t,r){if(t==null)return;let s=nt(r)?this.__captureEventListeners:this.__eventListeners,o=s.get(e);o!==void 0&&(o.delete(t),o.size||s.delete(e))}dispatchEvent(e){let t=this.__resolveFullEventPath();!e.composed&&this.__host&&(t=t.slice(0,t.indexOf(this.__host)));let r=!1,s=!1,o=R.NONE,n=null,l=null,a=null,m=e.stopPropagation,b=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get(){return n??l},...C},srcElement:{get(){return e.target},...C},currentTarget:{get(){return a},...C},eventPhase:{get(){return o},...C},composedPath:{value:()=>t,...C},stopPropagation:{value:()=>{r=!0,m.call(e)},...C},stopImmediatePropagation:{value:()=>{s=!0,b.call(e)},...C}});let c=(g,A,Q)=>{typeof g=="function"?g(e):typeof g?.handleEvent=="function"&&g.handleEvent(e),A.once&&Q.delete(g)},p=()=>(a=null,o=R.NONE,!e.defaultPrevented),d=t.slice().reverse();n=!this.__host||!e.composed?this:null;let y=g=>{for(l=this;l.__host&&g.includes(l.__host);)l=l.__host};for(let g of d){!n&&(!l||l===g.__host)&&y(d.slice(d.indexOf(g))),a=g,o=g===e.target?R.AT_TARGET:R.CAPTURING_PHASE;let A=g.__captureEventListeners.get(e.type);if(A){for(let[Q,De]of A)if(c(Q,De,A),s)return p()}if(r)return p()}let w=e.bubbles?t:[this];l=null;for(let g of w){!n&&(!l||g===l.__host)&&y(w.slice(0,w.indexOf(g)+1)),a=g,o=g===e.target?R.AT_TARGET:R.BUBBLING_PHASE;let A=g.__eventListeners.get(e.type);if(A){for(let[Q,De]of A)if(c(Q,De,A),s)return p()}if(r)return p()}return p()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,ct,Jt]}};var at=new WeakMap,ie=i=>{let e=at.get(i);return e===void 0&&at.set(i,e=new Map),e},se=class extends be{getRootNode(e){return e?.composed?Be:this.__host?.__shadowRoot??Be}};var lt=class extends se{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var ct=new lt,Be=ct;var ht=class extends se{constructor(e){if(super(),e!==je)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:ye,customElements:qe,document:Be,Document:lt,Element:dt,EventTarget:be,HTMLElement:ut,Node:se,ShadowRoot:pt,window:this,Window:ht})}};var dt=class extends se{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ie(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){ie(this).set(e,String(t))}removeAttribute(e){ie(this).delete(e)}toggleAttribute(e,t){if(this.hasAttribute(e)){if(t===void 0||!t)return this.removeAttribute(e),!1}else return t===void 0||t?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return ie(this).has(e)}attachShadow(e){this.__shadowRootMode=e.mode;let t=new pt(je,e);return t.__eventTargetParent=this,t.__host=this,this.__shadowRoot=t}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new it(this);return this.__internals=e,e}getAttribute(e){return ie(this).get(e)??null}};var ut=class extends dt{},ze=ut;var pt=class extends se{get host(){return this.__host}constructor(e,t){if(super(),e!==e)throw new TypeError("Illegal constructor");this.mode=t.mode}};globalThis.litServerRoot??=Object.defineProperty(new ze,"localName",{get(){return"lit-server-root"}});function Ft(){let i,e;return{promise:new Promise((r,s)=>{i=r,e=s}),resolve:i,reject:e}}var ye=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(e,t){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
+ Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${e}" has already been used with this registry`);if(this.__reverseDefinitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(t)}`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:t.observedAttributes??[]}),this.__reverseDefinitions.set(t,e),this.__pendingWhenDefineds.get(e)?.resolve(t),this.__pendingWhenDefineds.delete(e)}get(e){return this.__definitions.get(e)?.ctor}getName(e){return this.__reverseDefinitions.get(e)??null}initialize(e){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(e){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(e){let t=this.__definitions.get(e);if(t)return t.ctor;let r=this.__pendingWhenDefineds.get(e);return r||(r=Ft(),this.__pendingWhenDefineds.set(e,r)),r.promise}},Gt=ye;var qe=new Gt,Jt=new ht(je);var oe=globalThis,Se=oe.ShadowRoot&&(oe.ShadyCSS===void 0||oe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Fe=Symbol(),mt=new WeakMap,ne=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Fe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Se&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=mt.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&mt.set(t,e))}return e}toString(){return this.cssText}},vt=i=>new ne(typeof i=="string"?i:i+"",void 0,Fe),x=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,s,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[o+1],i[0]);return new ne(t,i,Fe)},ft=(i,e)=>{if(Se)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),s=oe.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=t.cssText,i.appendChild(r)}},Ge=Se||oe.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return vt(t)})(i):i;var{is:Kt,defineProperty:Yt,getOwnPropertyDescriptor:Zt,getOwnPropertyNames:Xt,getOwnPropertySymbols:Qt,getPrototypeOf:er}=Object,ce=globalThis;ce.customElements??=qe;var gt=ce.trustedTypes,tr=gt?gt.emptyScript:"",rr=ce.reactiveElementPolyfillSupport,ae=(i,e)=>i,le={toAttribute(i,e){switch(e){case Boolean:i=i?tr:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},Ee=(i,e)=>!Kt(i,e),_t={attribute:!0,type:String,converter:le,reflect:!1,useDefault:!1,hasChanged:Ee};Symbol.metadata??=Symbol("metadata"),ce.litPropertyMetadata??=new WeakMap;var O=class extends(globalThis.HTMLElement??ze){static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_t){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){let r=Symbol(),s=this.getPropertyDescriptor(e,r,t);s!==void 0&&Yt(this.prototype,e,s)}}static getPropertyDescriptor(e,t,r){let{get:s,set:o}=Zt(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get:s,set(n){let l=s?.call(this);o?.call(this,n),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_t}static _$Ei(){if(this.hasOwnProperty(ae("elementProperties")))return;let e=er(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ae("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ae("properties"))){let t=this.properties,r=[...Xt(t),...Qt(t)];for(let s of r)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,s]of t)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let s=this._$Eu(t,r);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let s of r)t.unshift(Ge(s))}else e!==void 0&&t.push(Ge(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r: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_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ft(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,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,r);if(s!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:le).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,s=r._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let o=r.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:le;this._$Em=s;let l=n.fromAttribute(t,o.type);this[s]=l??this._$Ej?.get(s)??l,this._$Em=null}}requestUpdate(e,t,r,s=!1,o){if(e!==void 0){let n=this.constructor;if(s===!1&&(o=this[e]),r??=n.getPropertyOptions(e),!((r.hasChanged??Ee)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:s,wrapped:o},n){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),o!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let 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(let[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[s,o]of r){let{wrapped:n}=o,l=this[s];n!==!0||this._$AL.has(s)||l===void 0||this.C(s,void 0,o,l)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}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){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[ae("elementProperties")]=new Map,O[ae("finalized")]=new Map,rr?.({ReactiveElement:O}),(ce.reactiveElementVersions??=[]).push("2.1.2");var Ce=globalThis,bt=i=>i,$e=Ce.trustedTypes,yt=$e?$e.createPolicy("lit-html",{createHTML:i=>i}):void 0,Ke="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,Ye="?"+P,ir=`<${Ye}>`,B=Ce.document===void 0?{createTreeWalker:()=>({})}:document,de=()=>B.createComment(""),ue=i=>i===null||typeof i!="object"&&typeof i!="function",Ze=Array.isArray,At=i=>Ze(i)||typeof i?.[Symbol.iterator]=="function",Je=`[
3
3
  \f\r]`,he=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,St=/-->/g,Et=/>/g,W=RegExp(`>|${Je}(?:([^\\s"'>=/]+)(${Je}*=${Je}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),xt=/'/g,$t=/"/g,Tt=/^(?:script|style|textarea|title)$/i,Xe=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),b=Xe(1),Qr=Xe(2),ei=Xe(3),M=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),wt=new WeakMap,V=B.createTreeWalker(B,129);function Rt(i,e){if(!Ze(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return yt!==void 0?yt.createHTML(e):e}var Ct=(i,e)=>{let t=i.length-1,r=[],s,o=e===2?"<svg>":e===3?"<math>":"",n=he;for(let l=0;l<t;l++){let a=i[l],m,_,c=-1,u=0;for(;u<a.length&&(n.lastIndex=u,_=n.exec(a),_!==null);)u=n.lastIndex,n===he?_[1]==="!--"?n=St:_[1]!==void 0?n=Et:_[2]!==void 0?(Tt.test(_[2])&&(s=RegExp("</"+_[2],"g")),n=W):_[3]!==void 0&&(n=W):n===W?_[0]===">"?(n=s??he,c=-1):_[1]===void 0?c=-2:(c=n.lastIndex-_[2].length,m=_[1],n=_[3]===void 0?W:_[3]==='"'?$t:xt):n===$t||n===xt?n=W:n===St||n===Et?n=he:(n=W,s=void 0);let d=n===W&&i[l+1].startsWith("/>")?" ":"";o+=n===he?a+ir:c>=0?(r.push(m),a.slice(0,c)+Ke+a.slice(c)+P+d):a+P+(c===-2?l:d)}return[Rt(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},ue=class i{constructor({strings:e,_$litType$:t},r){let s;this.parts=[];let o=0,n=0,l=e.length-1,a=this.parts,[m,_]=Ct(e,t);if(this.el=i.createElement(m,r),V.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(s=V.nextNode())!==null&&a.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(let c of s.getAttributeNames())if(c.endsWith(Ke)){let u=_[n++],d=s.getAttribute(c).split(P),y=/([.?@])?(.*)/.exec(u);a.push({type:1,index:o,name:y[2],strings:d,ctor:y[1]==="."?we:y[1]==="?"?Ae:y[1]==="@"?Te:z}),s.removeAttribute(c)}else c.startsWith(P)&&(a.push({type:6,index:o}),s.removeAttribute(c));if(Tt.test(s.tagName)){let c=s.textContent.split(P),u=c.length-1;if(u>0){s.textContent=xe?xe.emptyScript:"";for(let d=0;d<u;d++)s.append(c[d],de()),V.nextNode(),a.push({type:2,index:++o});s.append(c[u],de())}}}else if(s.nodeType===8)if(s.data===Ye)a.push({type:2,index:o});else{let c=-1;for(;(c=s.data.indexOf(P,c+1))!==-1;)a.push({type:7,index:o}),c+=P.length-1}o++}}static createElement(e,t){let r=B.createElement("template");return r.innerHTML=e,r}};function j(i,e,t=i,r){if(e===M)return e;let s=r!==void 0?t._$Co?.[r]:t._$Cl,o=pe(e)?void 0:e._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(i),s._$AT(i,t,r)),r!==void 0?(t._$Co??=[])[r]=s:t._$Cl=s),s!==void 0&&(e=j(i,s._$AS(i,e.values),s,r)),e}var $e=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,s=(e?.creationScope??B).importNode(t,!0);V.currentNode=s;let o=V.nextNode(),n=0,l=0,a=r[0];for(;a!==void 0;){if(n===a.index){let m;a.type===2?m=new K(o,o.nextSibling,this,e):a.type===1?m=new a.ctor(o,a.name,a.strings,this,e):a.type===6&&(m=new Re(o,this,e)),this._$AV.push(m),a=r[++l]}n!==a?.index&&(o=V.nextNode(),n++)}return V.currentNode=B,s}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},K=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,s){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=j(this,e,t),pe(e)?e===h||e==null||e===""?(this._$AH!==h&&this._$AR(),this._$AH=h):e!==this._$AH&&e!==M&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):At(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!==h&&pe(this._$AH)?this._$AA.nextSibling.data=e:this.T(B.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,s=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ue.createElement(Rt(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(t);else{let o=new $e(s,this),n=o.u(this.options);o.p(t),this.T(n),this._$AH=o}}_$AC(e){let t=wt.get(e.strings);return t===void 0&&wt.set(e.strings,t=new ue(e)),t}k(e){Ze(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,s=0;for(let o of e)s===t.length?t.push(r=new i(this.O(de()),this.O(de()),this,this.options)):r=t[s],r._$AI(o),s++;s<t.length&&(this._$AR(r&&r._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=_t(e).nextSibling;_t(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},z=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,s,o){this.type=1,this._$AH=h,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=h}_$AI(e,t=this,r,s){let o=this.strings,n=!1;if(o===void 0)e=j(this,e,t,0),n=!pe(e)||e!==this._$AH&&e!==M,n&&(this._$AH=e);else{let l=e,a,m;for(e=o[0],a=0;a<o.length-1;a++)m=j(this,l[r+a],t,a),m===M&&(m=this._$AH[a]),n||=!pe(m)||m!==this._$AH[a],m===h?e=h:e!==h&&(e+=(m??"")+o[a+1]),this._$AH[a]=m}n&&!s&&this.j(e)}j(e){e===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},we=class extends z{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===h?void 0:e}},Ae=class extends z{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==h)}},Te=class extends z{constructor(e,t,r,s,o){super(e,t,r,s,o),this.type=5}_$AI(e,t=this){if((e=j(this,e,t,0)??h)===M)return;let r=this._$AH,s=e===h&&r!==h||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==h&&(r===h||s);s&&this.element.removeEventListener(this.name,this,r),o&&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)}},Re=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){j(this,e)}},Ot={M:Ke,P,A:Ye,C:1,L:Ct,R:$e,D:At,V:j,I:K,H:z,N:Ae,U:Te,B:we,F:Re},sr=Ce.litHtmlPolyfillSupport;sr?.(ue,K),(Ce.litHtmlVersions??=[]).push("3.3.3");var Pt=(i,e,t)=>{let r=t?.renderBefore??e,s=r._$litPart$;if(s===void 0){let o=t?.renderBefore??null;r._$litPart$=s=new K(e.insertBefore(de(),o),o,void 0,t??{})}return s._$AI(i),s};var Qe=globalThis,L=class extends O{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Pt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return M}};L._$litElement$=!0,L.finalized=!0,Qe.litElementHydrateSupport?.({LitElement:L});var or=Qe.litElementPolyfillSupport;or?.({LitElement:L});(Qe.litElementVersions??=[]).push("4.2.2");var nr={attribute:!0,type:String,converter:le,reflect:!1,hasChanged:Ee},ar=(i=nr,e,t)=>{let{kind:r,metadata:s}=t,o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),o.set(t.name,i),r==="accessor"){let{name:n}=t;return{set(l){let a=e.get.call(this);e.set.call(this,l),this.requestUpdate(n,a,i,!0,l)},init(l){return l!==void 0&&this.C(n,void 0,i,l),l}}}if(r==="setter"){let{name:n}=t;return function(l){let a=this[n];e.call(this,l),this.requestUpdate(n,a,i,!0,l)}}throw Error("Unsupported decorator location: "+r)};function f(i){return(e,t)=>typeof t=="object"?ar(i,e,t):((r,s,o)=>{let n=s.hasOwnProperty(o);return s.constructor.createProperty(o,r),n?Object.getOwnPropertyDescriptor(s,o):void 0})(i,e,t)}function Y(i){return f({...i,state:!0,attribute:!1})}async function Pe(i,e){let t=await i["~standard"].validate(e);return t.issues?{valid:!1,errors:t.issues.map(r=>r.message)}:{valid:!0,value:t.value,errors:[]}}function Me(i){return typeof i=="object"&&i!==null&&"~standard"in i&&typeof i["~standard"]?.validate=="function"}function Mt(){let i=typeof document<"u"?document.modelContext:void 0,e=typeof navigator<"u"?navigator.modelContext:void 0,t=i??e;return t&&typeof t.registerTool=="function"?t:void 0}function Nt(){return Mt()!==void 0}var lr=globalThis.process?.env?.NODE_ENV!=="production",et=new Set;function Ne(i){let e=Mt();if(!e?.registerTool)return()=>{};let t={name:i.name,description:i.description,inputSchema:i.inputSchema??{type:"object",properties:{}},execute:i.execute};lr&&et.has(t.name)&&console.warn(`[webmcpui] A WebMCP tool named "${t.name}" is already registered on this page. Tool names are page-global, so the host rejects the duplicate and this control won't be agent-callable. Give one control a unique \`name\`, or override it with \`tool-name\`.`),et.add(t.name);let r=typeof AbortController=="function"?new AbortController:void 0,s=e.registerTool(t,r?{signal:r.signal}:void 0),o=!1;return()=>{if(!o){o=!0,et.delete(t.name);try{r?.abort(),s&&typeof s.unregister=="function"?s.unregister():typeof e.unregisterTool=="function"&&e.unregisterTool(i.name)}catch{}}}}var k=$`
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),$t=/'/g,xt=/"/g,Tt=/^(?:script|style|textarea|title)$/i,Xe=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),_=Xe(1),Qr=Xe(2),ei=Xe(3),M=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),wt=new WeakMap,V=B.createTreeWalker(B,129);function Rt(i,e){if(!Ze(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return yt!==void 0?yt.createHTML(e):e}var Ct=(i,e)=>{let t=i.length-1,r=[],s,o=e===2?"<svg>":e===3?"<math>":"",n=he;for(let l=0;l<t;l++){let a=i[l],m,b,c=-1,p=0;for(;p<a.length&&(n.lastIndex=p,b=n.exec(a),b!==null);)p=n.lastIndex,n===he?b[1]==="!--"?n=St:b[1]!==void 0?n=Et:b[2]!==void 0?(Tt.test(b[2])&&(s=RegExp("</"+b[2],"g")),n=W):b[3]!==void 0&&(n=W):n===W?b[0]===">"?(n=s??he,c=-1):b[1]===void 0?c=-2:(c=n.lastIndex-b[2].length,m=b[1],n=b[3]===void 0?W:b[3]==='"'?xt:$t):n===xt||n===$t?n=W:n===St||n===Et?n=he:(n=W,s=void 0);let d=n===W&&i[l+1].startsWith("/>")?" ":"";o+=n===he?a+ir:c>=0?(r.push(m),a.slice(0,c)+Ke+a.slice(c)+P+d):a+P+(c===-2?l:d)}return[Rt(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},pe=class i{constructor({strings:e,_$litType$:t},r){let s;this.parts=[];let o=0,n=0,l=e.length-1,a=this.parts,[m,b]=Ct(e,t);if(this.el=i.createElement(m,r),V.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(s=V.nextNode())!==null&&a.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(let c of s.getAttributeNames())if(c.endsWith(Ke)){let p=b[n++],d=s.getAttribute(c).split(P),y=/([.?@])?(.*)/.exec(p);a.push({type:1,index:o,name:y[2],strings:d,ctor:y[1]==="."?we:y[1]==="?"?Ae:y[1]==="@"?Te:z}),s.removeAttribute(c)}else c.startsWith(P)&&(a.push({type:6,index:o}),s.removeAttribute(c));if(Tt.test(s.tagName)){let c=s.textContent.split(P),p=c.length-1;if(p>0){s.textContent=$e?$e.emptyScript:"";for(let d=0;d<p;d++)s.append(c[d],de()),V.nextNode(),a.push({type:2,index:++o});s.append(c[p],de())}}}else if(s.nodeType===8)if(s.data===Ye)a.push({type:2,index:o});else{let c=-1;for(;(c=s.data.indexOf(P,c+1))!==-1;)a.push({type:7,index:o}),c+=P.length-1}o++}}static createElement(e,t){let r=B.createElement("template");return r.innerHTML=e,r}};function j(i,e,t=i,r){if(e===M)return e;let s=r!==void 0?t._$Co?.[r]:t._$Cl,o=ue(e)?void 0:e._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(i),s._$AT(i,t,r)),r!==void 0?(t._$Co??=[])[r]=s:t._$Cl=s),s!==void 0&&(e=j(i,s._$AS(i,e.values),s,r)),e}var xe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,s=(e?.creationScope??B).importNode(t,!0);V.currentNode=s;let o=V.nextNode(),n=0,l=0,a=r[0];for(;a!==void 0;){if(n===a.index){let m;a.type===2?m=new K(o,o.nextSibling,this,e):a.type===1?m=new a.ctor(o,a.name,a.strings,this,e):a.type===6&&(m=new Re(o,this,e)),this._$AV.push(m),a=r[++l]}n!==a?.index&&(o=V.nextNode(),n++)}return V.currentNode=B,s}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},K=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,s){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=j(this,e,t),ue(e)?e===h||e==null||e===""?(this._$AH!==h&&this._$AR(),this._$AH=h):e!==this._$AH&&e!==M&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):At(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!==h&&ue(this._$AH)?this._$AA.nextSibling.data=e:this.T(B.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,s=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=pe.createElement(Rt(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(t);else{let o=new xe(s,this),n=o.u(this.options);o.p(t),this.T(n),this._$AH=o}}_$AC(e){let t=wt.get(e.strings);return t===void 0&&wt.set(e.strings,t=new pe(e)),t}k(e){Ze(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,s=0;for(let o of e)s===t.length?t.push(r=new i(this.O(de()),this.O(de()),this,this.options)):r=t[s],r._$AI(o),s++;s<t.length&&(this._$AR(r&&r._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=bt(e).nextSibling;bt(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},z=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,s,o){this.type=1,this._$AH=h,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=h}_$AI(e,t=this,r,s){let o=this.strings,n=!1;if(o===void 0)e=j(this,e,t,0),n=!ue(e)||e!==this._$AH&&e!==M,n&&(this._$AH=e);else{let l=e,a,m;for(e=o[0],a=0;a<o.length-1;a++)m=j(this,l[r+a],t,a),m===M&&(m=this._$AH[a]),n||=!ue(m)||m!==this._$AH[a],m===h?e=h:e!==h&&(e+=(m??"")+o[a+1]),this._$AH[a]=m}n&&!s&&this.j(e)}j(e){e===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},we=class extends z{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===h?void 0:e}},Ae=class extends z{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==h)}},Te=class extends z{constructor(e,t,r,s,o){super(e,t,r,s,o),this.type=5}_$AI(e,t=this){if((e=j(this,e,t,0)??h)===M)return;let r=this._$AH,s=e===h&&r!==h||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==h&&(r===h||s);s&&this.element.removeEventListener(this.name,this,r),o&&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)}},Re=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){j(this,e)}},Ot={M:Ke,P,A:Ye,C:1,L:Ct,R:xe,D:At,V:j,I:K,H:z,N:Ae,U:Te,B:we,F:Re},sr=Ce.litHtmlPolyfillSupport;sr?.(pe,K),(Ce.litHtmlVersions??=[]).push("3.3.3");var Pt=(i,e,t)=>{let r=t?.renderBefore??e,s=r._$litPart$;if(s===void 0){let o=t?.renderBefore??null;r._$litPart$=s=new K(e.insertBefore(de(),o),o,void 0,t??{})}return s._$AI(i),s};var Qe=globalThis,L=class extends O{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Pt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return M}};L._$litElement$=!0,L.finalized=!0,Qe.litElementHydrateSupport?.({LitElement:L});var or=Qe.litElementPolyfillSupport;or?.({LitElement:L});(Qe.litElementVersions??=[]).push("4.2.2");var nr={attribute:!0,type:String,converter:le,reflect:!1,hasChanged:Ee},ar=(i=nr,e,t)=>{let{kind:r,metadata:s}=t,o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),o.set(t.name,i),r==="accessor"){let{name:n}=t;return{set(l){let a=e.get.call(this);e.set.call(this,l),this.requestUpdate(n,a,i,!0,l)},init(l){return l!==void 0&&this.C(n,void 0,i,l),l}}}if(r==="setter"){let{name:n}=t;return function(l){let a=this[n];e.call(this,l),this.requestUpdate(n,a,i,!0,l)}}throw Error("Unsupported decorator location: "+r)};function f(i){return(e,t)=>typeof t=="object"?ar(i,e,t):((r,s,o)=>{let n=s.hasOwnProperty(o);return s.constructor.createProperty(o,r),n?Object.getOwnPropertyDescriptor(s,o):void 0})(i,e,t)}function Y(i){return f({...i,state:!0,attribute:!1})}async function Pe(i,e){let t=await i["~standard"].validate(e);return t.issues?{valid:!1,errors:t.issues.map(r=>r.message)}:{valid:!0,value:t.value,errors:[]}}function Me(i){return typeof i=="object"&&i!==null&&"~standard"in i&&typeof i["~standard"]?.validate=="function"}function Mt(){let i=typeof document<"u"?document.modelContext:void 0,e=typeof navigator<"u"?navigator.modelContext:void 0,t=i??e;return t&&typeof t.registerTool=="function"?t:void 0}function Nt(){return Mt()!==void 0}var lr=globalThis.process?.env?.NODE_ENV!=="production",et=new Set;function Ne(i){let e=Mt();if(!e?.registerTool)return()=>{};let t={name:i.name,description:i.description,inputSchema:i.inputSchema??{type:"object",properties:{}},execute:i.execute};lr&&et.has(t.name)&&console.warn(`[webmcpui] A WebMCP tool named "${t.name}" is already registered on this page. Tool names are page-global, so the host rejects the duplicate and this control won't be agent-callable. Give one control a unique \`name\`, or override it with \`tool-name\`.`),et.add(t.name);let r=typeof AbortController=="function"?new AbortController:void 0,s=e.registerTool(t,r?{signal:r.signal}:void 0),o=!1;return()=>{if(!o){o=!0,et.delete(t.name);try{r?.abort(),s&&typeof s.unregister=="function"?s.unregister():typeof e.unregisterTool=="function"&&e.unregisterTool(i.name)}catch{}}}}var k=x`
5
5
  .control {
6
6
  box-sizing: border-box;
7
7
  width: 100%;
@@ -42,7 +42,7 @@ Make sure to test your application with a production build as repeat registratio
42
42
  var(--destructive, oklch(0.577 0.245 27.325))
43
43
  );
44
44
  }
45
- `,p=class extends L{constructor(){super(...arguments);this.label="";this.name="";this.value="";this.placeholder="";this.required=!1;this.disabled=!1;this.helperText="";this.requiredMessage="";this.expose=!1;this.toolName="";this.toolDescription="";this.error="";this.internals=this.attachInternals();this.toolDisposer=()=>{};this.onInvalid=()=>{this.error=this.internals.validationMessage,this.toggleAttribute("invalid",!0)}}static{this.formAssociated=!0}static{this.styles=$`
45
+ `,u=class extends L{constructor(){super(...arguments);this.label="";this.name="";this.value="";this.placeholder="";this.required=!1;this.disabled=!1;this.helperText="";this.requiredMessage="";this.expose=!1;this.toolName="";this.toolDescription="";this.error="";this.internals=this.attachInternals();this.toolDisposer=()=>{};this.onInvalid=()=>{this.error=this.internals.validationMessage,this.toggleAttribute("invalid",!0)}}static{this.formAssociated=!0}static{this.styles=x`
46
46
  :host {
47
47
  display: inline-flex;
48
48
  flex-direction: column;
@@ -74,19 +74,19 @@ Make sure to test your application with a production build as repeat registratio
74
74
  var(--destructive, oklch(0.577 0.245 27.325))
75
75
  );
76
76
  }
77
- `}get controlNoun(){return"field"}get control(){return this.renderRoot?.querySelector("input, textarea, select")??null}get describedBy(){return this.error?"wmcp-error":this.helperText?"wmcp-helper":void 0}connectedCallback(){super.connectedCallback(),this.syncFormValue(),this.addEventListener("invalid",this.onInvalid),this.validate(!1),this.expose&&this.registerTool()}getFormValue(){return this.value}syncFormValue(){this.internals.setFormValue(this.getFormValue())}get validationValue(){return this.value}get isEmpty(){return this.value===""}get requiredMessageDefault(){return"This field is required."}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this.onInvalid),this.toolDisposer(),this.toolDisposer=()=>{}}updated(t){this.syncFormValue(),this.expose&&(t.has("expose")||t.has("name")||t.has("toolName")||t.has("toolDescription"))&&this.registerTool()}get resolvedToolName(){return this.toolName||`fill_${this.name||this.controlNoun}`}registerTool(){this.toolDisposer();let t=this.label||this.name||this.controlNoun;this.toolDisposer=Ne({name:this.resolvedToolName,description:this.toolDescription||`Set the value of the "${t}" field.`,inputSchema:this.toolInputSchema(),execute:async r=>(await this.applyAgentValue(r),{content:[{type:"text",text:this.error?`Set "${t}" but validation failed: ${this.error}`:`Set "${t}" to "${this.stateDescription()}".`}],isError:!!this.error})})}async applyAgentValue(t){let r=t.value;await this.setValueFromAgent(r==null?"":String(r))}stateDescription(){return this.value}toolInputSchema(){return{type:"object",properties:{value:{type:"string",description:this.label||this.name||"The value to set."}},required:["value"]}}async setValueFromAgent(t){this.value=t,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}async onInput(t){this.value=t.target.value,await this.validate()}async computeValidity(){if(this.required&&this.isEmpty)return{valid:!1,message:this.requiredMessage||this.requiredMessageDefault,flags:{valueMissing:!0}};if(Me(this.schema)){let t=await Pe(this.schema,this.validationValue);if(!t.valid)return{valid:!1,message:t.errors[0]??"Invalid value",flags:{customError:!0}}}return{valid:!0,message:"",flags:{}}}async validate(t=!0){let{valid:r,message:s,flags:o}=await this.computeValidity();return r?this.internals.setValidity({}):this.internals.setValidity(o,s,this.control??void 0),t&&(this.error=r?"":s,this.toggleAttribute("invalid",!r)),r}formResetCallback(){this.value="",this.error="",this.toggleAttribute("invalid",!1),this.validate(!1)}renderMessage(){return this.error?b`<span id="wmcp-error" class="message error" role="alert"
77
+ `}get controlNoun(){return"field"}get control(){return this.renderRoot?.querySelector("input, textarea, select")??null}get describedBy(){return this.error?"wmcp-error":this.helperText?"wmcp-helper":void 0}connectedCallback(){super.connectedCallback(),this.syncFormValue(),this.addEventListener("invalid",this.onInvalid),this.validate(!1),this.expose&&this.registerTool()}getFormValue(){return this.value}syncFormValue(){this.internals.setFormValue(this.getFormValue())}get validationValue(){return this.value}get isEmpty(){return this.value===""}get requiredMessageDefault(){return"This field is required."}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this.onInvalid),this.toolDisposer(),this.toolDisposer=()=>{}}updated(t){this.syncFormValue(),this.expose&&(t.has("expose")||t.has("name")||t.has("toolName")||t.has("toolDescription"))&&this.registerTool()}get resolvedToolName(){return this.toolName||`fill_${this.name||this.controlNoun}`}registerTool(){this.toolDisposer();let t=this.label||this.name||this.controlNoun;this.toolDisposer=Ne({name:this.resolvedToolName,description:this.toolDescription||`Set the value of the "${t}" field.`,inputSchema:this.toolInputSchema(),execute:async r=>(await this.applyAgentValue(r),{content:[{type:"text",text:this.error?`Set "${t}" but validation failed: ${this.error}`:`Set "${t}" to "${this.stateDescription()}".`}],isError:!!this.error})})}async applyAgentValue(t){let r=t.value;await this.setValueFromAgent(r==null?"":String(r))}stateDescription(){return this.value}toolInputSchema(){return{type:"object",properties:{value:{type:"string",description:this.label||this.name||"The value to set."}},required:["value"]}}async setValueFromAgent(t){this.value=t,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}async onInput(t){this.value=t.target.value,await this.validate()}async computeValidity(){if(this.required&&this.isEmpty)return{valid:!1,message:this.requiredMessage||this.requiredMessageDefault,flags:{valueMissing:!0}};if(Me(this.schema)){let t=await Pe(this.schema,this.validationValue);if(!t.valid)return{valid:!1,message:t.errors[0]??"Invalid value",flags:{customError:!0}}}return{valid:!0,message:"",flags:{}}}async validate(t=!0){let{valid:r,message:s,flags:o}=await this.computeValidity();return r?this.internals.setValidity({}):this.internals.setValidity(o,s,this.control??void 0),t&&(this.error=r?"":s,this.toggleAttribute("invalid",!r)),r}formResetCallback(){this.value="",this.error="",this.toggleAttribute("invalid",!1),this.validate(!1)}renderMessage(){return this.error?_`<span id="wmcp-error" class="message error" role="alert"
78
78
  >${this.error}</span
79
- >`:this.helperText?b`<span id="wmcp-helper" class="message helper"
79
+ >`:this.helperText?_`<span id="wmcp-helper" class="message helper"
80
80
  >${this.helperText}</span
81
- >`:h}render(){return b`
82
- ${this.label?b`<label for="control">${this.label}</label>`:h}
81
+ >`:h}render(){return _`
82
+ ${this.label?_`<label for="control">${this.label}</label>`:h}
83
83
  ${this.renderControl()}
84
84
  ${this.renderMessage()}
85
- `}};v([f()],p.prototype,"label",2),v([f()],p.prototype,"name",2),v([f()],p.prototype,"value",2),v([f()],p.prototype,"placeholder",2),v([f({type:Boolean,reflect:!0})],p.prototype,"required",2),v([f({type:Boolean,reflect:!0})],p.prototype,"disabled",2),v([f({attribute:"helper-text"})],p.prototype,"helperText",2),v([f({attribute:"required-message"})],p.prototype,"requiredMessage",2),v([f({type:Boolean})],p.prototype,"expose",2),v([f({attribute:"tool-name"})],p.prototype,"toolName",2),v([f({attribute:"tool-description"})],p.prototype,"toolDescription",2),v([f({attribute:!1})],p.prototype,"schema",2),v([Y()],p.prototype,"error",2);var q=class extends p{constructor(){super(...arguments);this.type="text"}static{this.tagName="wmcp-input"}static{this.styles=[p.styles,k,$`
85
+ `}};v([f()],u.prototype,"label",2),v([f()],u.prototype,"name",2),v([f()],u.prototype,"value",2),v([f()],u.prototype,"placeholder",2),v([f({type:Boolean,reflect:!0})],u.prototype,"required",2),v([f({type:Boolean,reflect:!0})],u.prototype,"disabled",2),v([f({attribute:"helper-text"})],u.prototype,"helperText",2),v([f({attribute:"required-message"})],u.prototype,"requiredMessage",2),v([f({type:Boolean})],u.prototype,"expose",2),v([f({attribute:"tool-name"})],u.prototype,"toolName",2),v([f({attribute:"tool-description"})],u.prototype,"toolDescription",2),v([f({attribute:!1})],u.prototype,"schema",2),v([Y()],u.prototype,"error",2);var q=class extends u{constructor(){super(...arguments);this.type="text"}static{this.tagName="wmcp-input"}static{this.styles=[u.styles,k,x`
86
86
  .control {
87
87
  height: var(--input-height-md, 2.25rem);
88
88
  }
89
- `]}get controlNoun(){return"input"}toolInputSchema(){return{type:"object",properties:{value:{type:this.type==="number"?"number":"string",description:this.label||this.name||"The value to set."}},required:["value"]}}renderControl(){return b`
89
+ `]}get controlNoun(){return"input"}toolInputSchema(){return{type:"object",properties:{value:{type:this.type==="number"?"number":"string",description:this.label||this.name||"The value to set."}},required:["value"]}}renderControl(){return _`
90
90
  <input
91
91
  id="control"
92
92
  class="control"
@@ -100,12 +100,12 @@ Make sure to test your application with a production build as repeat registratio
100
100
  aria-describedby=${this.describedBy??h}
101
101
  @input=${this.onInput}
102
102
  />
103
- `}};v([f()],q.prototype,"type",2);var F=class extends p{constructor(){super(...arguments);this.rows=3}static{this.tagName="wmcp-textarea"}static{this.styles=[p.styles,k,$`
103
+ `}};v([f()],q.prototype,"type",2);var F=class extends u{constructor(){super(...arguments);this.rows=3}static{this.tagName="wmcp-textarea"}static{this.styles=[u.styles,k,x`
104
104
  .control {
105
105
  min-height: var(--textarea-min-height, 4.5rem);
106
106
  resize: vertical;
107
107
  }
108
- `]}get controlNoun(){return"textarea"}renderControl(){return b`
108
+ `]}get controlNoun(){return"textarea"}renderControl(){return _`
109
109
  <textarea
110
110
  id="control"
111
111
  class="control"
@@ -119,7 +119,7 @@ Make sure to test your application with a production build as repeat registratio
119
119
  aria-describedby=${this.describedBy??h}
120
120
  @input=${this.onInput}
121
121
  ></textarea>
122
- `}};v([f({type:Number})],F.prototype,"rows",2);var Lt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},kt=i=>(...e)=>({_$litDirective$:i,values:e}),Le=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:cr}=Ot,It=i=>i;var Ut=()=>document.createComment(""),Z=(i,e,t)=>{let r=i._$AA.parentNode,s=e===void 0?i._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(Ut(),s),n=r.insertBefore(Ut(),s);t=new cr(o,n,i,i.options)}else{let o=t._$AB.nextSibling,n=t._$AM,l=n!==i;if(l){let a;t._$AQ?.(i),t._$AM=i,t._$AP!==void 0&&(a=i._$AU)!==n._$AU&&t._$AP(a)}if(o!==s||l){let a=t._$AA;for(;a!==o;){let m=It(a).nextSibling;It(r).insertBefore(a,s),a=m}}}return t},I=(i,e,t=i)=>(i._$AI(e,t),i),hr={},Dt=(i,e=hr)=>i._$AH=e,Ht=i=>i._$AH,ke=i=>{i._$AR(),i._$AA.remove()};var Wt=(i,e,t)=>{let r=new Map;for(let s=e;s<=t;s++)r.set(i[s],s);return r},Ie=kt(class extends Le{constructor(i){if(super(i),i.type!==Lt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let s=[],o=[],n=0;for(let l of i)s[n]=r?r(l,n):n,o[n]=t(l,n),n++;return{values:o,keys:s}}render(i,e,t){return this.dt(i,e,t).values}update(i,[e,t,r]){let s=Ht(i),{values:o,keys:n}=this.dt(e,t,r);if(!Array.isArray(s))return this.ut=n,o;let l=this.ut??=[],a=[],m,_,c=0,u=s.length-1,d=0,y=o.length-1;for(;c<=u&&d<=y;)if(s[c]===null)c++;else if(s[u]===null)u--;else if(l[c]===n[d])a[d]=I(s[c],o[d]),c++,d++;else if(l[u]===n[y])a[y]=I(s[u],o[y]),u--,y--;else if(l[c]===n[y])a[y]=I(s[c],o[y]),Z(i,a[y+1],s[c]),c++,y--;else if(l[u]===n[d])a[d]=I(s[u],o[d]),Z(i,s[c],s[u]),u--,d++;else if(m===void 0&&(m=Wt(n,d,y),_=Wt(l,c,u)),m.has(l[c]))if(m.has(l[u])){let w=_.get(n[d]),g=w!==void 0?s[w]:null;if(g===null){let A=Z(i,s[c]);I(A,o[d]),a[d]=A}else a[d]=I(g,o[d]),Z(i,s[c],g),s[w]=null;d++}else ke(s[u]),u--;else ke(s[c]),c++;for(;d<=y;){let w=Z(i,a[y+1]);I(w,o[d]),a[d++]=w}for(;c<=u;){let w=s[c++];w!==null&&ke(w)}return this.ut=n,Dt(i,a),M}});function tt(i){return Array.isArray(i.options)}var U=class extends p{constructor(){super(...arguments);this.options=[];this.resolvedOptions=[]}static{this.tagName="wmcp-select"}static{this.styles=[p.styles,k,$`
122
+ `}};v([f({type:Number})],F.prototype,"rows",2);var Lt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},kt=i=>(...e)=>({_$litDirective$:i,values:e}),Le=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:cr}=Ot,It=i=>i;var Ut=()=>document.createComment(""),Z=(i,e,t)=>{let r=i._$AA.parentNode,s=e===void 0?i._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(Ut(),s),n=r.insertBefore(Ut(),s);t=new cr(o,n,i,i.options)}else{let o=t._$AB.nextSibling,n=t._$AM,l=n!==i;if(l){let a;t._$AQ?.(i),t._$AM=i,t._$AP!==void 0&&(a=i._$AU)!==n._$AU&&t._$AP(a)}if(o!==s||l){let a=t._$AA;for(;a!==o;){let m=It(a).nextSibling;It(r).insertBefore(a,s),a=m}}}return t},I=(i,e,t=i)=>(i._$AI(e,t),i),hr={},Dt=(i,e=hr)=>i._$AH=e,Ht=i=>i._$AH,ke=i=>{i._$AR(),i._$AA.remove()};var Wt=(i,e,t)=>{let r=new Map;for(let s=e;s<=t;s++)r.set(i[s],s);return r},Ie=kt(class extends Le{constructor(i){if(super(i),i.type!==Lt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let s=[],o=[],n=0;for(let l of i)s[n]=r?r(l,n):n,o[n]=t(l,n),n++;return{values:o,keys:s}}render(i,e,t){return this.dt(i,e,t).values}update(i,[e,t,r]){let s=Ht(i),{values:o,keys:n}=this.dt(e,t,r);if(!Array.isArray(s))return this.ut=n,o;let l=this.ut??=[],a=[],m,b,c=0,p=s.length-1,d=0,y=o.length-1;for(;c<=p&&d<=y;)if(s[c]===null)c++;else if(s[p]===null)p--;else if(l[c]===n[d])a[d]=I(s[c],o[d]),c++,d++;else if(l[p]===n[y])a[y]=I(s[p],o[y]),p--,y--;else if(l[c]===n[y])a[y]=I(s[c],o[y]),Z(i,a[y+1],s[c]),c++,y--;else if(l[p]===n[d])a[d]=I(s[p],o[d]),Z(i,s[c],s[p]),p--,d++;else if(m===void 0&&(m=Wt(n,d,y),b=Wt(l,c,p)),m.has(l[c]))if(m.has(l[p])){let w=b.get(n[d]),g=w!==void 0?s[w]:null;if(g===null){let A=Z(i,s[c]);I(A,o[d]),a[d]=A}else a[d]=I(g,o[d]),Z(i,s[c],g),s[w]=null;d++}else ke(s[p]),p--;else ke(s[c]),c++;for(;d<=y;){let w=Z(i,a[y+1]);I(w,o[d]),a[d++]=w}for(;c<=p;){let w=s[c++];w!==null&&ke(w)}return this.ut=n,Dt(i,a),M}});function tt(i){return Array.isArray(i.options)}var U=class extends u{constructor(){super(...arguments);this.options=[];this.resolvedOptions=[]}static{this.tagName="wmcp-select"}static{this.styles=[u.styles,k,x`
123
123
  .control {
124
124
  height: var(--input-height-md, 2.25rem);
125
125
  cursor: pointer;
@@ -127,13 +127,13 @@ Make sure to test your application with a production build as repeat registratio
127
127
  .control:disabled {
128
128
  cursor: not-allowed;
129
129
  }
130
- `]}get controlNoun(){return"select"}connectedCallback(){this.syncOptions(),super.connectedCallback(),this.optionObserver=new MutationObserver(()=>this.syncOptions()),this.optionObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.optionObserver?.disconnect(),this.optionObserver=void 0}willUpdate(t){t.has("options")&&this.syncOptions()}updated(t){super.updated(t),this.expose&&t.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){let t=s=>({value:s.value,label:s.textContent?.trim()||s.value,disabled:s.disabled}),r=[];for(let s of Array.from(this.children))s instanceof HTMLOptGroupElement?r.push({label:s.label,options:Array.from(s.querySelectorAll("option")).map(t)}):s instanceof HTMLOptionElement&&r.push(t(s));return r}flatOptions(){return this.resolvedOptions.flatMap(t=>tt(t)?t.options:[t])}toolInputSchema(){return{type:"object",properties:{value:{type:"string",enum:this.flatOptions().map(t=>t.value),description:this.label||this.name||"The option value to select."}},required:["value"]}}renderOption(t){return b`<option
130
+ `]}get controlNoun(){return"select"}connectedCallback(){this.syncOptions(),super.connectedCallback(),this.optionObserver=new MutationObserver(()=>this.syncOptions()),this.optionObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.optionObserver?.disconnect(),this.optionObserver=void 0}willUpdate(t){t.has("options")&&this.syncOptions()}updated(t){super.updated(t),this.expose&&t.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){let t=s=>({value:s.value,label:s.textContent?.trim()||s.value,disabled:s.disabled}),r=[];for(let s of Array.from(this.children))s instanceof HTMLOptGroupElement?r.push({label:s.label,options:Array.from(s.querySelectorAll("option")).map(t)}):s instanceof HTMLOptionElement&&r.push(t(s));return r}flatOptions(){return this.resolvedOptions.flatMap(t=>tt(t)?t.options:[t])}toolInputSchema(){return{type:"object",properties:{value:{type:"string",enum:this.flatOptions().map(t=>t.value),description:this.label||this.name||"The option value to select."}},required:["value"]}}renderOption(t){return _`<option
131
131
  value=${t.value}
132
132
  ?disabled=${t.disabled??!1}
133
133
  ?selected=${t.value===this.value}
134
134
  >
135
135
  ${t.label}
136
- </option>`}renderControl(){return b`
136
+ </option>`}renderControl(){return _`
137
137
  <select
138
138
  id="control"
139
139
  class="control"
@@ -144,14 +144,14 @@ Make sure to test your application with a production build as repeat registratio
144
144
  aria-describedby=${this.describedBy??h}
145
145
  @change=${this.onInput}
146
146
  >
147
- ${this.placeholder?b`<option value="" disabled ?selected=${!this.value}>
147
+ ${this.placeholder?_`<option value="" disabled ?selected=${!this.value}>
148
148
  ${this.placeholder}
149
149
  </option>`:h}
150
- ${Ie(this.resolvedOptions,(t,r)=>tt(t)?`g:${t.label}:${r}`:`o:${t.value}`,t=>tt(t)?b`<optgroup label=${t.label}>
150
+ ${Ie(this.resolvedOptions,(t,r)=>tt(t)?`g:${t.label}:${r}`:`o:${t.value}`,t=>tt(t)?_`<optgroup label=${t.label}>
151
151
  ${t.options.map(r=>this.renderOption(r))}
152
152
  </optgroup>`:this.renderOption(t))}
153
153
  </select>
154
- `}};v([f({attribute:!1})],U.prototype,"options",2),v([Y()],U.prototype,"resolvedOptions",2);var G=class extends p{constructor(){super();this.checked=!1;this.defaultChecked=!1;this.value="on"}static{this.tagName="wmcp-checkbox"}static{this.styles=[p.styles,$`
154
+ `}};v([f({attribute:!1})],U.prototype,"options",2),v([Y()],U.prototype,"resolvedOptions",2);var G=class extends u{constructor(){super();this.checked=!1;this.defaultChecked=!1;this.value="on"}static{this.tagName="wmcp-checkbox"}static{this.styles=[u.styles,x`
155
155
  .row {
156
156
  display: inline-flex;
157
157
  align-items: center;
@@ -184,7 +184,7 @@ Make sure to test your application with a production build as repeat registratio
184
184
  font-size: var(--input-font-size, 0.875rem);
185
185
  color: var(--input-text, var(--foreground, oklch(0.145 0 0)));
186
186
  }
187
- `]}get controlNoun(){return"checkbox"}connectedCallback(){this.defaultChecked=this.checked,super.connectedCallback()}getFormValue(){return this.checked?this.value:null}get validationValue(){return this.checked}get isEmpty(){return!this.checked}get requiredMessageDefault(){return"Please check this box."}toolInputSchema(){return{type:"object",properties:{checked:{type:"boolean",description:this.label||this.name||"Whether the box is checked."}},required:["checked"]}}async applyAgentValue(t){this.checked=!!t.checked,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}stateDescription(){return this.checked?"checked":"unchecked"}formResetCallback(){this.checked=this.defaultChecked,this.error="",this.toggleAttribute("invalid",!1),this.validate(!1)}async onToggle(t){this.checked=t.target.checked,await this.validate()}renderControl(){return b`
187
+ `]}get controlNoun(){return"checkbox"}connectedCallback(){this.defaultChecked=this.checked,super.connectedCallback()}getFormValue(){return this.checked?this.value:null}get validationValue(){return this.checked}get isEmpty(){return!this.checked}get requiredMessageDefault(){return"Please check this box."}toolInputSchema(){return{type:"object",properties:{checked:{type:"boolean",description:this.label||this.name||"Whether the box is checked."}},required:["checked"]}}async applyAgentValue(t){this.checked=!!t.checked,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}stateDescription(){return this.checked?"checked":"unchecked"}formResetCallback(){this.checked=this.defaultChecked,this.error="",this.toggleAttribute("invalid",!1),this.validate(!1)}async onToggle(t){this.checked=t.target.checked,await this.validate()}renderControl(){return _`
188
188
  <input
189
189
  id="control"
190
190
  class="control"
@@ -197,13 +197,13 @@ Make sure to test your application with a production build as repeat registratio
197
197
  aria-describedby=${this.describedBy??h}
198
198
  @change=${this.onToggle}
199
199
  />
200
- `}render(){return b`
200
+ `}render(){return _`
201
201
  <label class="row">
202
202
  ${this.renderControl()}
203
- ${this.label?b`<span class="label-text">${this.label}</span>`:h}
203
+ ${this.label?_`<span class="label-text">${this.label}</span>`:h}
204
204
  </label>
205
205
  ${this.renderMessage()}
206
- `}};v([f({type:Boolean,reflect:!0})],G.prototype,"checked",2);var dr=0,X=class extends HTMLElement{static{this.tagName="wmcp-radio"}get value(){return this.getAttribute("value")??""}get label(){return this.getAttribute("label")??this.textContent?.trim()??""}get disabled(){return this.hasAttribute("disabled")}connectedCallback(){this.style.display="none"}},D=class extends p{constructor(){super(...arguments);this.options=[];this.resolvedOptions=[];this.groupName=`wmcp-radio-${++dr}`}static{this.tagName="wmcp-radio-group"}static{this.styles=[p.styles,$`
206
+ `}};v([f({type:Boolean,reflect:!0})],G.prototype,"checked",2);var dr=0,X=class extends HTMLElement{static{this.tagName="wmcp-radio"}get value(){return this.getAttribute("value")??""}get label(){return this.getAttribute("label")??this.textContent?.trim()??""}get disabled(){return this.hasAttribute("disabled")}connectedCallback(){this.style.display="none"}},D=class extends u{constructor(){super(...arguments);this.options=[];this.resolvedOptions=[];this.groupName=`wmcp-radio-${++dr}`}static{this.tagName="wmcp-radio-group"}static{this.styles=[u.styles,x`
207
207
  .group-label {
208
208
  font-size: var(--input-font-size-label, 0.875rem);
209
209
  font-weight: var(--input-font-weight-label, 500);
@@ -246,7 +246,7 @@ Make sure to test your application with a production build as repeat registratio
246
246
  font-size: var(--input-font-size, 0.875rem);
247
247
  color: var(--input-text, var(--foreground, oklch(0.145 0 0)));
248
248
  }
249
- `]}get controlNoun(){return"radio"}connectedCallback(){this.syncOptions(),super.connectedCallback(),this.optionObserver=new MutationObserver(()=>this.syncOptions()),this.optionObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.optionObserver?.disconnect(),this.optionObserver=void 0}willUpdate(t){t.has("options")&&this.syncOptions()}updated(t){super.updated(t),this.expose&&t.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){return Array.from(this.querySelectorAll(":scope > wmcp-radio")).map(t=>({value:t.getAttribute("value")??"",label:t.getAttribute("label")??t.textContent?.trim()??"",disabled:t.hasAttribute("disabled")}))}toolInputSchema(){return{type:"object",properties:{value:{type:"string",enum:this.resolvedOptions.map(t=>t.value),description:this.label||this.name||"The option value to select."}},required:["value"]}}async onSelect(t){this.value=t.target.value,await this.validate()}renderControl(){return b`
249
+ `]}get controlNoun(){return"radio"}connectedCallback(){this.syncOptions(),super.connectedCallback(),this.optionObserver=new MutationObserver(()=>this.syncOptions()),this.optionObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.optionObserver?.disconnect(),this.optionObserver=void 0}willUpdate(t){t.has("options")&&this.syncOptions()}updated(t){super.updated(t),this.expose&&t.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){return Array.from(this.querySelectorAll(":scope > wmcp-radio")).map(t=>({value:t.getAttribute("value")??"",label:t.getAttribute("label")??t.textContent?.trim()??"",disabled:t.hasAttribute("disabled")}))}toolInputSchema(){return{type:"object",properties:{value:{type:"string",enum:this.resolvedOptions.map(t=>t.value),description:this.label||this.name||"The option value to select."}},required:["value"]}}async onSelect(t){this.value=t.target.value,await this.validate()}renderControl(){return _`
250
250
  <div
251
251
  class="group"
252
252
  role="radiogroup"
@@ -254,7 +254,7 @@ Make sure to test your application with a production build as repeat registratio
254
254
  aria-describedby=${this.describedBy??h}
255
255
  aria-invalid=${this.error?"true":"false"}
256
256
  >
257
- ${Ie(this.resolvedOptions,t=>t.value,t=>b`
257
+ ${Ie(this.resolvedOptions,t=>t.value,t=>_`
258
258
  <label class="row">
259
259
  <input
260
260
  type="radio"
@@ -270,11 +270,11 @@ Make sure to test your application with a production build as repeat registratio
270
270
  </label>
271
271
  `)}
272
272
  </div>
273
- `}render(){return b`
274
- ${this.label?b`<span id="group-label" class="group-label">${this.label}</span>`:h}
273
+ `}render(){return _`
274
+ ${this.label?_`<span id="group-label" class="group-label">${this.label}</span>`:h}
275
275
  ${this.renderControl()}
276
276
  ${this.renderMessage()}
277
- `}};v([f({attribute:!1})],D.prototype,"options",2),v([Y()],D.prototype,"resolvedOptions",2);var pr=[q,F,U,G,X,D];function Ue(){if(!(typeof customElements>"u"))for(let i of pr)customElements.get(i.tagName)||customElements.define(i.tagName,i)}Ue();return qt(ur);})();
277
+ `}};v([f({attribute:!1})],D.prototype,"options",2),v([Y()],D.prototype,"resolvedOptions",2);var ur=[q,F,U,G,X,D];function Ue(){if(!(typeof customElements>"u"))for(let i of ur)customElements.get(i.tagName)||customElements.define(i.tagName,i)}Ue();return qt(pr);})();
278
278
  /*! Bundled license information:
279
279
 
280
280
  @lit-labs/ssr-dom-shim/lib/element-internals.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmcpui/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Framework-agnostic WebMCP-native custom elements. Form primitives with Standard Schema validation and imperative WebMCP tool exposure.",
5
5
  "license": "MIT",
6
6
  "author": "Gary Pfaff (Pfaff Digital)",
@@ -40,7 +40,7 @@
40
40
  "dist"
41
41
  ],
42
42
  "scripts": {
43
- "build": "tsup",
43
+ "build": "tsup && node scripts/append-global-dts.mjs",
44
44
  "typecheck": "tsc --noEmit",
45
45
  "test": "wtr",
46
46
  "test:watch": "wtr --watch",