@kya-os/consent 0.1.8 → 0.1.11

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,6 +1,6 @@
1
- var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e,r)=>{for(var s=r>1?void 0:r?Qe(t,e):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(s=(r?a(t,e,s):a(s))||s);return r&&s&&Je(t,e,s),s};var oe=globalThis,ne=oe.ShadowRoot&&(oe.ShadyCSS===void 0||oe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pe=Symbol(),Ce=new WeakMap,K=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==pe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(ne&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Ce.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Ce.set(e,t))}return t}toString(){return this.cssText}},Ee=i=>new K(typeof i=="string"?i:i+"",void 0,pe),v=(i,...t)=>{let e=i.length===1?i[0]:t.reduce(((r,s,o)=>r+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[o+1]),i[0]);return new K(e,i,pe)},Ae=(i,t)=>{if(ne)i.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let r=document.createElement("style"),s=oe.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},ue=ne?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Ee(e)})(i):i;var{is:Xe,defineProperty:Ze,getOwnPropertyDescriptor:et,getOwnPropertyNames:tt,getOwnPropertySymbols:rt,getPrototypeOf:it}=Object,P=globalThis,Se=P.trustedTypes,st=Se?Se.emptyScript:"",ot=P.reactiveElementPolyfillSupport,W=(i,t)=>i,J={toAttribute(i,t){switch(t){case Boolean:i=i?st:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},ae=(i,t)=>!Xe(i,t),_e={attribute:!0,type:String,converter:J,reflect:!1,useDefault:!1,hasChanged:ae};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),P.litPropertyMetadata??(P.litPropertyMetadata=new WeakMap);var N=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=_e){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Ze(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){let{get:s,set:o}=et(this.prototype,t)??{get(){return this[e]},set(a){this[e]=a}};return{get:s,set(a){let p=s?.call(this);o?.call(this,a),this.requestUpdate(t,p,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_e}static _$Ei(){if(this.hasOwnProperty(W("elementProperties")))return;let t=it(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(W("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W("properties"))){let e=this.properties,r=[...tt(e),...rt(e)];for(let s of r)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let s of r)e.unshift(ue(s))}else t!==void 0&&e.push(ue(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.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((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ae(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:J).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){let r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let o=r.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:J;this._$Em=s;let p=a.fromAttribute(e,o.type);this[s]=p??this._$Ej?.get(s)??p,this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){let s=this.constructor,o=this[t];if(r??(r=s.getPropertyOptions(t)),!((r.hasChanged??ae)(o,e)||r.useDefault&&r.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:s,wrapped:o},a){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,a??e??this[t]),o!==!0||a!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),s===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(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:a}=o,p=this[s];a!==!0||this._$AL.has(s)||p===void 0||this.C(s,void 0,o,p)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((r=>r.hostUpdate?.())),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach((e=>this._$ET(e,this[e])))),this._$EM()}updated(t){}firstUpdated(t){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[W("elementProperties")]=new Map,N[W("finalized")]=new Map,ot?.({ReactiveElement:N}),(P.reactiveElementVersions??(P.reactiveElementVersions=[])).push("2.1.1");var X=globalThis,le=X.trustedTypes,Te=le?le.createPolicy("lit-html",{createHTML:i=>i}):void 0,Ne="$lit$",M=`lit$${Math.random().toFixed(9).slice(2)}$`,Le="?"+M,nt=`<${Le}>`,F=document,Z=()=>F.createComment(""),ee=i=>i===null||typeof i!="object"&&typeof i!="function",ye=Array.isArray,at=i=>ye(i)||typeof i?.[Symbol.iterator]=="function",he=`[
2
- \f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ke=/-->/g,Re=/>/g,O=RegExp(`>|${he}(?:([^\\s"'>=/]+)(${he}*=${he}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ie=/'/g,Ue=/"/g,Pe=/^(?:script|style|textarea|title)$/i,xe=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=xe(1),It=xe(2),Ut=xe(3),L=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),De=new WeakMap,B=F.createTreeWalker(F,129);function Me(i,t){if(!ye(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Te!==void 0?Te.createHTML(t):t}var lt=(i,t)=>{let e=i.length-1,r=[],s,o=t===2?"<svg>":t===3?"<math>":"",a=Q;for(let p=0;p<e;p++){let c=i[p],f,y,h=-1,k=0;for(;k<c.length&&(a.lastIndex=k,y=a.exec(c),y!==null);)k=a.lastIndex,a===Q?y[1]==="!--"?a=ke:y[1]!==void 0?a=Re:y[2]!==void 0?(Pe.test(y[2])&&(s=RegExp("</"+y[2],"g")),a=O):y[3]!==void 0&&(a=O):a===O?y[0]===">"?(a=s??Q,h=-1):y[1]===void 0?h=-2:(h=a.lastIndex-y[2].length,f=y[1],a=y[3]===void 0?O:y[3]==='"'?Ue:Ie):a===Ue||a===Ie?a=O:a===ke||a===Re?a=Q:(a=O,s=void 0);let R=a===O&&i[p+1].startsWith("/>")?" ":"";o+=a===Q?c+nt:h>=0?(r.push(f),c.slice(0,h)+Ne+c.slice(h)+M+R):c+M+(h===-2?p:R)}return[Me(i,o+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},te=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let o=0,a=0,p=t.length-1,c=this.parts,[f,y]=lt(t,e);if(this.el=i.createElement(f,r),B.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(s=B.nextNode())!==null&&c.length<p;){if(s.nodeType===1){if(s.hasAttributes())for(let h of s.getAttributeNames())if(h.endsWith(Ne)){let k=y[a++],R=s.getAttribute(h).split(M),q=/([.?@])?(.*)/.exec(k);c.push({type:1,index:o,name:q[2],strings:R,ctor:q[1]==="."?ge:q[1]==="?"?fe:q[1]==="@"?ve:j}),s.removeAttribute(h)}else h.startsWith(M)&&(c.push({type:6,index:o}),s.removeAttribute(h));if(Pe.test(s.tagName)){let h=s.textContent.split(M),k=h.length-1;if(k>0){s.textContent=le?le.emptyScript:"";for(let R=0;R<k;R++)s.append(h[R],Z()),B.nextNode(),c.push({type:2,index:++o});s.append(h[k],Z())}}}else if(s.nodeType===8)if(s.data===Le)c.push({type:2,index:o});else{let h=-1;for(;(h=s.data.indexOf(M,h+1))!==-1;)c.push({type:7,index:o}),h+=M.length-1}o++}}static createElement(t,e){let r=F.createElement("template");return r.innerHTML=t,r}};function z(i,t,e=i,r){if(t===L)return t;let s=r!==void 0?e._$Co?.[r]:e._$Cl,o=ee(t)?void 0:t._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(i),s._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=s:e._$Cl=s),s!==void 0&&(t=z(i,s._$AS(i,t.values),s,r)),t}var me=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,s=(t?.creationScope??F).importNode(e,!0);B.currentNode=s;let o=B.nextNode(),a=0,p=0,c=r[0];for(;c!==void 0;){if(a===c.index){let f;c.type===2?f=new re(o,o.nextSibling,this,t):c.type===1?f=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(f=new be(o,this,t)),this._$AV.push(f),c=r[++p]}a!==c?.index&&(o=B.nextNode(),a++)}return B.currentNode=F,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},re=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,s){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=z(this,t,e),ee(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==L&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):at(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&ee(this._$AH)?this._$AA.nextSibling.data=t:this.T(F.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=te.createElement(Me(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(e);else{let o=new me(s,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=De.get(t.strings);return e===void 0&&De.set(t.strings,e=new te(t)),e}k(t){ye(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let o of t)s===e.length?e.push(r=new i(this.O(Z()),this.O(Z()),this,this.options)):r=e[s],r._$AI(o),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},j=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,o){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,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=u}_$AI(t,e=this,r,s){let o=this.strings,a=!1;if(o===void 0)t=z(this,t,e,0),a=!ee(t)||t!==this._$AH&&t!==L,a&&(this._$AH=t);else{let p=t,c,f;for(t=o[0],c=0;c<o.length-1;c++)f=z(this,p[r+c],e,c),f===L&&(f=this._$AH[c]),a||(a=!ee(f)||f!==this._$AH[c]),f===u?t=u:t!==u&&(t+=(f??"")+o[c+1]),this._$AH[c]=f}a&&!s&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ge=class extends j{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},fe=class extends j{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},ve=class extends j{constructor(t,e,r,s,o){super(t,e,r,s,o),this.type=5}_$AI(t,e=this){if((t=z(this,t,e,0)??u)===L)return;let r=this._$AH,s=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==u&&(r===u||s);s&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},be=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){z(this,t)}};var dt=X.litHtmlPolyfillSupport;dt?.(te,re),(X.litHtmlVersions??(X.litHtmlVersions=[])).push("3.3.1");var Oe=(i,t,e)=>{let r=e?.renderBefore??t,s=r._$litPart$;if(s===void 0){let o=e?.renderBefore??null;r._$litPart$=s=new re(t.insertBefore(Z(),o),o,void 0,e??{})}return s._$AI(i),s};var ie=globalThis,g=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Oe(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return L}};g._$litElement$=!0,g.finalized=!0,ie.litElementHydrateSupport?.({LitElement:g});var ct=ie.litElementPolyfillSupport;ct?.({LitElement:g});(ie.litElementVersions??(ie.litElementVersions=[])).push("4.2.1");var x=i=>(t,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(i,t)})):customElements.define(i,t)};var pt={attribute:!0,type:String,converter:J,reflect:!1,hasChanged:ae},ut=(i=pt,t,e)=>{let{kind:r,metadata:s}=e,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(e.name,i),r==="accessor"){let{name:a}=e;return{set(p){let c=t.get.call(this);t.set.call(this,p),this.requestUpdate(a,c,i)},init(p){return p!==void 0&&this.C(a,void 0,i,p),p}}}if(r==="setter"){let{name:a}=e;return function(p){let c=this[a];t.call(this,p),this.requestUpdate(a,c,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(t,e)=>typeof e=="object"?ut(i,t,e):((r,s,o)=>{let a=s.hasOwnProperty(o);return s.constructor.createProperty(o,r),a?Object.getOwnPropertyDescriptor(s,o):void 0})(i,t,e)}function w(i){return l({...i,state:!0,attribute:!1})}var V=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);var ht;function Be(i){return(t,e)=>V(t,e,{get(){return(this.renderRoot??ht??(ht=document.createDocumentFragment())).querySelectorAll(i)}})}var _=class extends g{constructor(){super();this.variant="primary";this.type="button";this.disabled=!1;this.fullWidth=!1;this.loading=!1;this.internals=this.attachInternals()}handleClick(){if(this.disabled||this.loading)return;let e=this.internals.form;e&&(this.type==="submit"?e.requestSubmit():this.type==="reset"&&e.reset())}render(){return d`
1
+ var Xe=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var n=(i,t,e,r)=>{for(var s=r>1?void 0:r?Ze(t,e):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(s=(r?a(t,e,s):a(s))||s);return r&&s&&Xe(t,e,s),s};var ne=globalThis,ae=ne.ShadowRoot&&(ne.ShadyCSS===void 0||ne.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ue=Symbol(),Ee=new WeakMap,W=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==ue)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(ae&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Ee.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Ee.set(e,t))}return t}toString(){return this.cssText}},Ae=i=>new W(typeof i=="string"?i:i+"",void 0,ue),y=(i,...t)=>{let e=i.length===1?i[0]:t.reduce(((r,s,o)=>r+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[o+1]),i[0]);return new W(e,i,ue)},Se=(i,t)=>{if(ae)i.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let r=document.createElement("style"),s=ne.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},he=ae?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Ae(e)})(i):i;var{is:et,defineProperty:tt,getOwnPropertyDescriptor:rt,getOwnPropertyNames:it,getOwnPropertySymbols:st,getPrototypeOf:ot}=Object,O=globalThis,_e=O.trustedTypes,nt=_e?_e.emptyScript:"",at=O.reactiveElementPolyfillSupport,J=(i,t)=>i,Q={toAttribute(i,t){switch(t){case Boolean:i=i?nt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},le=(i,t)=>!et(i,t),Te={attribute:!0,type:String,converter:Q,reflect:!1,useDefault:!1,hasChanged:le};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),O.litPropertyMetadata??(O.litPropertyMetadata=new WeakMap);var N=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Te){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&tt(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){let{get:s,set:o}=rt(this.prototype,t)??{get(){return this[e]},set(a){this[e]=a}};return{get:s,set(a){let p=s?.call(this);o?.call(this,a),this.requestUpdate(t,p,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Te}static _$Ei(){if(this.hasOwnProperty(J("elementProperties")))return;let t=ot(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(J("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(J("properties"))){let e=this.properties,r=[...it(e),...st(e)];for(let s of r)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let s of r)e.unshift(he(s))}else t!==void 0&&e.push(he(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.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((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Se(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:Q).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){let r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let o=r.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Q;this._$Em=s;let p=a.fromAttribute(e,o.type);this[s]=p??this._$Ej?.get(s)??p,this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){let s=this.constructor,o=this[t];if(r??(r=s.getPropertyOptions(t)),!((r.hasChanged??le)(o,e)||r.useDefault&&r.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:s,wrapped:o},a){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,a??e??this[t]),o!==!0||a!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),s===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(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:a}=o,p=this[s];a!==!0||this._$AL.has(s)||p===void 0||this.C(s,void 0,o,p)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((r=>r.hostUpdate?.())),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach((e=>this._$ET(e,this[e])))),this._$EM()}updated(t){}firstUpdated(t){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[J("elementProperties")]=new Map,N[J("finalized")]=new Map,at?.({ReactiveElement:N}),(O.reactiveElementVersions??(O.reactiveElementVersions=[])).push("2.1.1");var Z=globalThis,de=Z.trustedTypes,ke=de?de.createPolicy("lit-html",{createHTML:i=>i}):void 0,Ue="$lit$",M=`lit$${Math.random().toFixed(9).slice(2)}$`,Le="?"+M,lt=`<${Le}>`,F=document,ee=()=>F.createComment(""),te=i=>i===null||typeof i!="object"&&typeof i!="function",xe=Array.isArray,dt=i=>xe(i)||typeof i?.[Symbol.iterator]=="function",me=`[
2
+ \f\r]`,X=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Re=/-->/g,Ie=/>/g,B=RegExp(`>|${me}(?:([^\\s"'>=/]+)(${me}*=${me}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Pe=/'/g,De=/"/g,Oe=/^(?:script|style|textarea|title)$/i,we=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=we(1),Nt=we(2),Ut=we(3),U=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),Ne=new WeakMap,H=F.createTreeWalker(F,129);function Me(i,t){if(!xe(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ke!==void 0?ke.createHTML(t):t}var ct=(i,t)=>{let e=i.length-1,r=[],s,o=t===2?"<svg>":t===3?"<math>":"",a=X;for(let p=0;p<e;p++){let c=i[p],v,b,m=-1,k=0;for(;k<c.length&&(a.lastIndex=k,b=a.exec(c),b!==null);)k=a.lastIndex,a===X?b[1]==="!--"?a=Re:b[1]!==void 0?a=Ie:b[2]!==void 0?(Oe.test(b[2])&&(s=RegExp("</"+b[2],"g")),a=B):b[3]!==void 0&&(a=B):a===B?b[0]===">"?(a=s??X,m=-1):b[1]===void 0?m=-2:(m=a.lastIndex-b[2].length,v=b[1],a=b[3]===void 0?B:b[3]==='"'?De:Pe):a===De||a===Pe?a=B:a===Re||a===Ie?a=X:(a=B,s=void 0);let R=a===B&&i[p+1].startsWith("/>")?" ":"";o+=a===X?c+lt:m>=0?(r.push(v),c.slice(0,m)+Ue+c.slice(m)+M+R):c+M+(m===-2?p:R)}return[Me(i,o+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},re=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let o=0,a=0,p=t.length-1,c=this.parts,[v,b]=ct(t,e);if(this.el=i.createElement(v,r),H.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(s=H.nextNode())!==null&&c.length<p;){if(s.nodeType===1){if(s.hasAttributes())for(let m of s.getAttributeNames())if(m.endsWith(Ue)){let k=b[a++],R=s.getAttribute(m).split(M),z=/([.?@])?(.*)/.exec(k);c.push({type:1,index:o,name:z[2],strings:R,ctor:z[1]==="."?fe:z[1]==="?"?ve:z[1]==="@"?ye:j}),s.removeAttribute(m)}else m.startsWith(M)&&(c.push({type:6,index:o}),s.removeAttribute(m));if(Oe.test(s.tagName)){let m=s.textContent.split(M),k=m.length-1;if(k>0){s.textContent=de?de.emptyScript:"";for(let R=0;R<k;R++)s.append(m[R],ee()),H.nextNode(),c.push({type:2,index:++o});s.append(m[k],ee())}}}else if(s.nodeType===8)if(s.data===Le)c.push({type:2,index:o});else{let m=-1;for(;(m=s.data.indexOf(M,m+1))!==-1;)c.push({type:7,index:o}),m+=M.length-1}o++}}static createElement(t,e){let r=F.createElement("template");return r.innerHTML=t,r}};function V(i,t,e=i,r){if(t===U)return t;let s=r!==void 0?e._$Co?.[r]:e._$Cl,o=te(t)?void 0:t._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(i),s._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=s:e._$Cl=s),s!==void 0&&(t=V(i,s._$AS(i,t.values),s,r)),t}var ge=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,s=(t?.creationScope??F).importNode(e,!0);H.currentNode=s;let o=H.nextNode(),a=0,p=0,c=r[0];for(;c!==void 0;){if(a===c.index){let v;c.type===2?v=new ie(o,o.nextSibling,this,t):c.type===1?v=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(v=new be(o,this,t)),this._$AV.push(v),c=r[++p]}a!==c?.index&&(o=H.nextNode(),a++)}return H.currentNode=F,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ie=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,s){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=V(this,t,e),te(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==U&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):dt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&te(this._$AH)?this._$AA.nextSibling.data=t:this.T(F.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=re.createElement(Me(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(e);else{let o=new ge(s,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=Ne.get(t.strings);return e===void 0&&Ne.set(t.strings,e=new re(t)),e}k(t){xe(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let o of t)s===e.length?e.push(r=new i(this.O(ee()),this.O(ee()),this,this.options)):r=e[s],r._$AI(o),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},j=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,o){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,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=u}_$AI(t,e=this,r,s){let o=this.strings,a=!1;if(o===void 0)t=V(this,t,e,0),a=!te(t)||t!==this._$AH&&t!==U,a&&(this._$AH=t);else{let p=t,c,v;for(t=o[0],c=0;c<o.length-1;c++)v=V(this,p[r+c],e,c),v===U&&(v=this._$AH[c]),a||(a=!te(v)||v!==this._$AH[c]),v===u?t=u:t!==u&&(t+=(v??"")+o[c+1]),this._$AH[c]=v}a&&!s&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},fe=class extends j{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},ve=class extends j{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},ye=class extends j{constructor(t,e,r,s,o){super(t,e,r,s,o),this.type=5}_$AI(t,e=this){if((t=V(this,t,e,0)??u)===U)return;let r=this._$AH,s=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==u&&(r===u||s);s&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},be=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){V(this,t)}};var pt=Z.litHtmlPolyfillSupport;pt?.(re,ie),(Z.litHtmlVersions??(Z.litHtmlVersions=[])).push("3.3.1");var Be=(i,t,e)=>{let r=e?.renderBefore??t,s=r._$litPart$;if(s===void 0){let o=e?.renderBefore??null;r._$litPart$=s=new ie(t.insertBefore(ee(),o),o,void 0,e??{})}return s._$AI(i),s};var se=globalThis,g=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Be(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};g._$litElement$=!0,g.finalized=!0,se.litElementHydrateSupport?.({LitElement:g});var ut=se.litElementPolyfillSupport;ut?.({LitElement:g});(se.litElementVersions??(se.litElementVersions=[])).push("4.2.1");var x=i=>(t,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(i,t)})):customElements.define(i,t)};var ht={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:le},mt=(i=ht,t,e)=>{let{kind:r,metadata:s}=e,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(e.name,i),r==="accessor"){let{name:a}=e;return{set(p){let c=t.get.call(this);t.set.call(this,p),this.requestUpdate(a,c,i)},init(p){return p!==void 0&&this.C(a,void 0,i,p),p}}}if(r==="setter"){let{name:a}=e;return function(p){let c=this[a];t.call(this,p),this.requestUpdate(a,c,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(t,e)=>typeof e=="object"?mt(i,t,e):((r,s,o)=>{let a=s.hasOwnProperty(o);return s.constructor.createProperty(o,r),a?Object.getOwnPropertyDescriptor(s,o):void 0})(i,t,e)}function w(i){return l({...i,state:!0,attribute:!1})}var G=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);var gt;function He(i){return(t,e)=>G(t,e,{get(){return(this.renderRoot??gt??(gt=document.createDocumentFragment())).querySelectorAll(i)}})}var _=class extends g{constructor(){super();this.variant="primary";this.type="button";this.disabled=!1;this.fullWidth=!1;this.loading=!1;this.internals=this.attachInternals()}handleClick(){if(this.disabled||this.loading)return;let e=this.internals.form;e&&(this.type==="submit"?e.requestSubmit():this.type==="reset"&&e.reset())}render(){return d`
4
4
  <button
5
5
  part="button"
6
6
  type="button"
@@ -11,7 +11,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
11
11
  ${this.loading?d`<span class="spinner"></span>`:null}
12
12
  <slot></slot>
13
13
  </button>
14
- `}};_.formAssociated=!0,_.styles=v`
14
+ `}};_.formAssociated=!0,_.styles=y`
15
15
  :host {
16
16
  display: inline-block;
17
17
  }
@@ -97,7 +97,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
97
97
  <slot></slot>
98
98
  </span>
99
99
  </label>
100
- `}};T.formAssociated=!0,T.styles=v`
100
+ `}};T.formAssociated=!0,T.styles=y`
101
101
  :host {
102
102
  display: block;
103
103
  }
@@ -236,7 +236,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
236
236
  </div>
237
237
  ${this.error?d`<div class="error-message">${this.error}</div>`:null}
238
238
  </div>
239
- `}};C.formAssociated=!0,C.styles=v`
239
+ `}};C.formAssociated=!0,C.styles=y`
240
240
  :host {
241
241
  display: block;
242
242
  }
@@ -406,7 +406,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
406
406
  <slot name="footer"></slot>
407
407
  </footer>
408
408
  </div>
409
- `}};I.styles=v`
409
+ `}};I.styles=y`
410
410
  :host {
411
411
  display: block;
412
412
  /* System font stack with font smoothing for crisp text */
@@ -491,7 +491,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
491
491
  height: 24px;
492
492
  color: var(--_primary);
493
493
  }
494
- `,n([l({type:String,attribute:"page-title"})],I.prototype,"pageTitle",2),n([l({type:String,attribute:"logo-url"})],I.prototype,"logoUrl",2),n([l({type:String,attribute:"company-name"})],I.prototype,"companyName",2),n([l({type:String,attribute:"primary-color"})],I.prototype,"primaryColor",2),n([l({type:String,attribute:"secondary-color"})],I.prototype,"secondaryColor",2),I=n([x("consent-shell")],I);var U=class extends g{constructor(){super(...arguments);this.scopes=[];this.interactive=!1;this.selectAll=!1;this.iconStyle="check";this.selectedScopes=new Set;this.previousScopeIds=new Set}connectedCallback(){super.connectedCallback(),this.interactive&&this.initializeSelectedScopes()}updated(e){e.has("scopes")&&this.interactive&&this.reinitializeSelectedScopes()}reinitializeSelectedScopes(){let e=new Set(this.normalizedScopes.map(o=>o.id)),r=new Set(Array.from(this.selectedScopes).filter(o=>e.has(o))),s=Array.from(e).filter(o=>!this.previousScopeIds.has(o));if(this.selectAll)this.selectedScopes=new Set([...r,...s]);else{let o=this.normalizedScopes.filter(a=>a.required).map(a=>a.id);this.selectedScopes=new Set([...r,...o])}this.previousScopeIds=e,this.dispatchEvent(new CustomEvent("change",{detail:{selected:this.getSelectedScopes()},bubbles:!0,composed:!0}))}initializeSelectedScopes(){this.previousScopeIds=new Set(this.normalizedScopes.map(e=>e.id)),this.selectAll?this.selectedScopes=new Set(this.normalizedScopes.map(e=>e.id)):this.selectedScopes=new Set(this.normalizedScopes.filter(e=>e.required).map(e=>e.id))}get normalizedScopes(){return this.scopes.map(e=>typeof e=="string"?{id:e,label:this.formatScopeLabel(e)}:e)}formatScopeLabel(e){return e.replace(/[_:-]/g," ").replace(/\b\w/g,r=>r.toUpperCase())}getSelectedScopes(){return Array.from(this.selectedScopes)}handleCheckboxChange(e,r){r?this.selectedScopes.add(e):this.selectedScopes.delete(e),this.requestUpdate(),this.dispatchEvent(new CustomEvent("change",{detail:{selected:this.getSelectedScopes()},bubbles:!0,composed:!0}))}renderIcon(){switch(this.iconStyle){case"bullet":return d`<div class="icon icon-bullet"></div>`;case"shield":return d`
494
+ `,n([l({type:String,attribute:"page-title"})],I.prototype,"pageTitle",2),n([l({type:String,attribute:"logo-url"})],I.prototype,"logoUrl",2),n([l({type:String,attribute:"company-name"})],I.prototype,"companyName",2),n([l({type:String,attribute:"primary-color"})],I.prototype,"primaryColor",2),n([l({type:String,attribute:"secondary-color"})],I.prototype,"secondaryColor",2),I=n([x("consent-shell")],I);var P=class extends g{constructor(){super(...arguments);this.scopes=[];this.interactive=!1;this.selectAll=!1;this.iconStyle="check";this.selectedScopes=new Set;this.previousScopeIds=new Set}connectedCallback(){super.connectedCallback(),this.interactive&&this.initializeSelectedScopes()}updated(e){e.has("scopes")&&this.interactive&&this.reinitializeSelectedScopes()}reinitializeSelectedScopes(){let e=new Set(this.normalizedScopes.map(o=>o.id)),r=new Set(Array.from(this.selectedScopes).filter(o=>e.has(o))),s=Array.from(e).filter(o=>!this.previousScopeIds.has(o));if(this.selectAll)this.selectedScopes=new Set([...r,...s]);else{let o=this.normalizedScopes.filter(a=>a.required).map(a=>a.id);this.selectedScopes=new Set([...r,...o])}this.previousScopeIds=e,this.dispatchEvent(new CustomEvent("change",{detail:{selected:this.getSelectedScopes()},bubbles:!0,composed:!0}))}initializeSelectedScopes(){this.previousScopeIds=new Set(this.normalizedScopes.map(e=>e.id)),this.selectAll?this.selectedScopes=new Set(this.normalizedScopes.map(e=>e.id)):this.selectedScopes=new Set(this.normalizedScopes.filter(e=>e.required).map(e=>e.id))}get normalizedScopes(){return this.scopes.map(e=>typeof e=="string"?{id:e,label:this.formatScopeLabel(e)}:e)}formatScopeLabel(e){return e.replace(/[_:-]/g," ").replace(/\b\w/g,r=>r.toUpperCase())}getSelectedScopes(){return Array.from(this.selectedScopes)}handleCheckboxChange(e,r){r?this.selectedScopes.add(e):this.selectedScopes.delete(e),this.requestUpdate(),this.dispatchEvent(new CustomEvent("change",{detail:{selected:this.getSelectedScopes()},bubbles:!0,composed:!0}))}renderIcon(){switch(this.iconStyle){case"bullet":return d`<div class="icon icon-bullet"></div>`;case"shield":return d`
495
495
  <div class="icon icon-shield">
496
496
  <svg
497
497
  xmlns="http://www.w3.org/2000/svg"
@@ -539,7 +539,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
539
539
  <ul class="permission-list" part="list" role="list">
540
540
  ${e.map(r=>this.renderPermissionItem(r))}
541
541
  </ul>
542
- `}};U.styles=v`
542
+ `}};P.styles=y`
543
543
  :host {
544
544
  display: block;
545
545
  --_primary: var(--consent-primary, #2563eb);
@@ -680,7 +680,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
680
680
  font-size: 0.875rem;
681
681
  padding: 1rem 0;
682
682
  }
683
- `,n([l({type:Array,converter:{fromAttribute:e=>{if(!e)return[];try{let r=JSON.parse(e);return Array.isArray(r)?r:(console.warn("[consent-permissions] Expected array, got:",typeof r),[])}catch{return[]}},toAttribute:e=>JSON.stringify(e)}})],U.prototype,"scopes",2),n([l({type:Boolean})],U.prototype,"interactive",2),n([l({type:Boolean,attribute:"select-all"})],U.prototype,"selectAll",2),n([l({type:String,attribute:"icon-style"})],U.prototype,"iconStyle",2),n([w()],U.prototype,"selectedScopes",2),U=n([x("consent-permissions")],U);var $=class extends g{constructor(){super();this.name="termsAccepted";this.text="Terms and Conditions";this.labelPrefix="I agree to the";this.conjunction="and";this.checked=!1;this.required=!0;this.disabled=!1;this.value="accepted";this.internals=this.attachInternals()}updated(e){(e.has("checked")||e.has("value"))&&this.updateFormValue()}updateFormValue(){this.checked?this.internals.setFormValue(this.value):this.internals.setFormValue(null)}handleChange(e){let r=e.target;this.checked=r.checked,this.updateFormValue(),this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.value},bubbles:!0,composed:!0}))}renderLink(e,r){return r?d`<a
683
+ `,n([l({type:Array,converter:{fromAttribute:e=>{if(!e)return[];try{let r=JSON.parse(e);return Array.isArray(r)?r:(console.warn("[consent-permissions] Expected array, got:",typeof r),[])}catch{return[]}},toAttribute:e=>JSON.stringify(e)}})],P.prototype,"scopes",2),n([l({type:Boolean})],P.prototype,"interactive",2),n([l({type:Boolean,attribute:"select-all"})],P.prototype,"selectAll",2),n([l({type:String,attribute:"icon-style"})],P.prototype,"iconStyle",2),n([w()],P.prototype,"selectedScopes",2),P=n([x("consent-permissions")],P);var $=class extends g{constructor(){super();this.name="termsAccepted";this.text="Terms and Conditions";this.labelPrefix="I agree to the";this.conjunction="and";this.checked=!1;this.required=!0;this.disabled=!1;this.value="accepted";this.internals=this.attachInternals()}updated(e){(e.has("checked")||e.has("value"))&&this.updateFormValue()}updateFormValue(){this.checked?this.internals.setFormValue(this.value):this.internals.setFormValue(null)}handleChange(e){let r=e.target;this.checked=r.checked,this.updateFormValue(),this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.value},bubbles:!0,composed:!0}))}renderLink(e,r){return r?d`<a
684
684
  href=${r}
685
685
  target="_blank"
686
686
  rel="noopener noreferrer"
@@ -708,7 +708,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
708
708
  ${this.required?d`<span class="required">*</span>`:u}
709
709
  </span>
710
710
  </label>
711
- `}};$.formAssociated=!0,$.styles=v`
711
+ `}};$.formAssociated=!0,$.styles=y`
712
712
  :host {
713
713
  display: block;
714
714
  --_primary: var(--consent-primary, #2563eb);
@@ -815,7 +815,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
815
815
  color: #ef4444;
816
816
  margin-left: 0.125rem;
817
817
  }
818
- `,n([l({type:String})],$.prototype,"name",2),n([l({type:String})],$.prototype,"text",2),n([l({type:String})],$.prototype,"url",2),n([l({type:String,attribute:"privacy-text"})],$.prototype,"privacyText",2),n([l({type:String,attribute:"privacy-url"})],$.prototype,"privacyUrl",2),n([l({type:String,attribute:"label-prefix"})],$.prototype,"labelPrefix",2),n([l({type:String})],$.prototype,"conjunction",2),n([l({type:Boolean,reflect:!0})],$.prototype,"checked",2),n([l({type:Boolean})],$.prototype,"required",2),n([l({type:Boolean,reflect:!0})],$.prototype,"disabled",2),n([l({type:String})],$.prototype,"value",2),$=n([x("consent-terms")],$);var Fe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ce=i=>(...t)=>({_$litDirective$:i,values:t}),de=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var H=class extends de{constructor(t){if(super(t),this.it=u,t.type!==Fe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===u||t==null)return this._t=void 0,this.it=t;if(t===L)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};H.directiveName="unsafeHTML",H.resultType=1;var Gr=ce(H);var se=class extends H{};se.directiveName="unsafeSVG",se.resultType=2;var He=ce(se);function mt(i){if(!i||typeof i!="string")return"";let t=i.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");return t=t.replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi,""),t=t.replace(/\s*on\w+\s*=\s*[^\s>]*/gi,""),t=t.replace(/(href|src|xlink:href)\s*=\s*["']?\s*javascript:[^"'>\s]*/gi,'$1=""'),t=t.replace(/(href|src|xlink:href)\s*=\s*["']?\s*data:[^"'>\s]*/gi,'$1=""'),t=t.replace(/data:text\/html[^"'>\s]*/gi,""),t}var qe={google:{name:"Google",bgColor:"#ffffff",textColor:"#374151",borderColor:"#d1d5db",hoverBgColor:"#f9fafb"},microsoft:{name:"Microsoft",bgColor:"#2f2f2f",textColor:"#ffffff",borderColor:"#2f2f2f",hoverBgColor:"#1f1f1f"},apple:{name:"Apple",bgColor:"#000000",textColor:"#ffffff",borderColor:"#000000",hoverBgColor:"#1a1a1a"},github:{name:"GitHub",bgColor:"#24292f",textColor:"#ffffff",borderColor:"#24292f",hoverBgColor:"#1b1f23"},twitter:{name:"Twitter",bgColor:"#1da1f2",textColor:"#ffffff",borderColor:"#1da1f2",hoverBgColor:"#0c8de4"},facebook:{name:"Facebook",bgColor:"#1877f2",textColor:"#ffffff",borderColor:"#1877f2",hoverBgColor:"#0b5ed7"},custom:{name:"Sign in",bgColor:"#ffffff",textColor:"#374151",borderColor:"#d1d5db",hoverBgColor:"#f9fafb"}},S=class extends g{constructor(){super(...arguments);this.provider="custom";this.url="";this.loading=!1;this.disabled=!1;this.fullWidth=!1;this.redirecting=!1}get config(){return qe[this.provider]||qe.custom}get displayName(){return this.providerName?this.providerName:this.config.name}get displayText(){return this.buttonText?this.buttonText:`Continue with ${this.displayName}`}handleClick(){this.disabled||this.loading||this.redirecting||(this.url&&(this.redirecting=!0,window.location.href=this.url),this.dispatchEvent(new CustomEvent("oauth-click",{detail:{provider:this.provider,url:this.url},bubbles:!0,composed:!0})))}renderProviderIcon(){if(this.customIcon){let e=mt(this.customIcon);return d`<div class="icon">${He(e)}</div>`}switch(this.provider){case"google":return d`
818
+ `,n([l({type:String})],$.prototype,"name",2),n([l({type:String})],$.prototype,"text",2),n([l({type:String})],$.prototype,"url",2),n([l({type:String,attribute:"privacy-text"})],$.prototype,"privacyText",2),n([l({type:String,attribute:"privacy-url"})],$.prototype,"privacyUrl",2),n([l({type:String,attribute:"label-prefix"})],$.prototype,"labelPrefix",2),n([l({type:String})],$.prototype,"conjunction",2),n([l({type:Boolean,reflect:!0})],$.prototype,"checked",2),n([l({type:Boolean})],$.prototype,"required",2),n([l({type:Boolean,reflect:!0})],$.prototype,"disabled",2),n([l({type:String})],$.prototype,"value",2),$=n([x("consent-terms")],$);var Fe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},pe=i=>(...t)=>({_$litDirective$:i,values:t}),ce=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var q=class extends ce{constructor(t){if(super(t),this.it=u,t.type!==Fe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===u||t==null)return this._t=void 0,this.it=t;if(t===U)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};q.directiveName="unsafeHTML",q.resultType=1;var Wr=pe(q);var oe=class extends q{};oe.directiveName="unsafeSVG",oe.resultType=2;var qe=pe(oe);function ft(i){if(!i||typeof i!="string")return"";let t=i.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");return t=t.replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi,""),t=t.replace(/\s*on\w+\s*=\s*[^\s>]*/gi,""),t=t.replace(/(href|src|xlink:href)\s*=\s*["']?\s*javascript:[^"'>\s]*/gi,'$1=""'),t=t.replace(/(href|src|xlink:href)\s*=\s*["']?\s*data:[^"'>\s]*/gi,'$1=""'),t=t.replace(/data:text\/html[^"'>\s]*/gi,""),t}var ze={google:{name:"Google",bgColor:"#ffffff",textColor:"#374151",borderColor:"#d1d5db",hoverBgColor:"#f9fafb"},microsoft:{name:"Microsoft",bgColor:"#2f2f2f",textColor:"#ffffff",borderColor:"#2f2f2f",hoverBgColor:"#1f1f1f"},apple:{name:"Apple",bgColor:"#000000",textColor:"#ffffff",borderColor:"#000000",hoverBgColor:"#1a1a1a"},github:{name:"GitHub",bgColor:"#24292f",textColor:"#ffffff",borderColor:"#24292f",hoverBgColor:"#1b1f23"},twitter:{name:"Twitter",bgColor:"#1da1f2",textColor:"#ffffff",borderColor:"#1da1f2",hoverBgColor:"#0c8de4"},facebook:{name:"Facebook",bgColor:"#1877f2",textColor:"#ffffff",borderColor:"#1877f2",hoverBgColor:"#0b5ed7"},custom:{name:"Sign in",bgColor:"#ffffff",textColor:"#374151",borderColor:"#d1d5db",hoverBgColor:"#f9fafb"}},S=class extends g{constructor(){super(...arguments);this.provider="custom";this.url="";this.loading=!1;this.disabled=!1;this.fullWidth=!1;this.redirecting=!1}get config(){return ze[this.provider]||ze.custom}get displayName(){return this.providerName?this.providerName:this.config.name}get displayText(){return this.buttonText?this.buttonText:`Continue with ${this.displayName}`}handleClick(){this.disabled||this.loading||this.redirecting||(this.url&&(this.redirecting=!0,window.location.href=this.url),this.dispatchEvent(new CustomEvent("oauth-click",{detail:{provider:this.provider,url:this.url},bubbles:!0,composed:!0})))}renderProviderIcon(){if(this.customIcon){let e=ft(this.customIcon);return d`<div class="icon">${qe(e)}</div>`}switch(this.provider){case"google":return d`
819
819
  <div class="icon">
820
820
  <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
821
821
  <path
@@ -897,7 +897,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
897
897
  ${e?d`<span class="spinner"></span>`:this.renderProviderIcon()}
898
898
  <span class="text" part="text">${this.displayText}</span>
899
899
  </button>
900
- `}};S.styles=v`
900
+ `}};S.styles=y`
901
901
  :host {
902
902
  display: inline-block;
903
903
  }
@@ -985,7 +985,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
985
985
  <div class="container" part="container" role="group" aria-label="One-time password input">
986
986
  ${Array.from({length:this.length},(e,r)=>this.renderDigitInput(r))}
987
987
  </div>
988
- `}};A.formAssociated=!0,A.styles=v`
988
+ `}};A.formAssociated=!0,A.styles=y`
989
989
  :host {
990
990
  display: block;
991
991
  --_primary: var(--consent-primary, #2563eb);
@@ -1064,7 +1064,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
1064
1064
  gap: 0.375rem;
1065
1065
  }
1066
1066
  }
1067
- `,n([l({type:Number})],A.prototype,"length",2),n([l({type:String})],A.prototype,"name",2),n([l({type:String})],A.prototype,"value",2),n([l({type:Boolean,reflect:!0})],A.prototype,"disabled",2),n([l({type:Boolean,reflect:!0})],A.prototype,"error",2),n([l({type:Boolean,attribute:"auto-focus"})],A.prototype,"autoFocus",2),n([l({type:String,attribute:"input-type"})],A.prototype,"inputType",2),n([w()],A.prototype,"digits",2),n([Be("input")],A.prototype,"inputs",2),A=n([x("consent-otp-input")],A);var b={CONSENT_ONLY:"consent-only",CREDENTIALS:"credentials",OAUTH:"oauth",MAGIC_LINK:"magic-link",OTP:"otp",QR_CODE:"qr-code",PASSKEY:"passkey",IDV:"idv"};var G={PRIMARY:"#2563EB",SECONDARY:"#DBEAFE",BACKGROUND:"#F9FAFB",TEXT_PRIMARY:"#111827",TEXT_SECONDARY:"#6B7280",TEXT_MUTED:"#9CA3AF",BORDER:"#E5E7EB",BORDER_DARK:"#D1D5DB",SUCCESS:"#16A34A",ERROR:"#DC2626",WARNING:"#F59E0B"};var hi={primaryColor:G.PRIMARY,secondaryColor:G.SECONDARY,logoUrl:void 0,companyName:void 0},E={title:"Permission request",description:"It looks like you would like to use [AI Agent] to access resources on your behalf.",expirationText:"This delegation will expire in",cancelButtonText:"Cancel",submitButtonText:"Allow access",permissionsHeader:"The agent is requesting the following permissions:",autoClose:!1,popupEnabled:!1,theme:"auto"},Y={text:"Terms and Conditions",url:void 0,version:void 0,required:!0},D={title:"Access Granted",description:"The agent now has permission to act on your behalf.",showCredential:!0,redirectUrl:void 0,redirectDelay:void 0,continueButtonText:"Close"};var ze=30;function gt(i){return i?/^#[0-9A-Fa-f]{6}$/.test(i):!1}function je(i,t){return gt(i)?i:t}function ft(i){if(!i)return!1;try{let t=new URL(i);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function vt(i){if(ft(i))return i}function Ve(i){let t=i.replace(/^#/,""),e=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),s=parseInt(t.slice(4,6),16);return`${e}, ${r}, ${s}`}function bt(i){return{"--consent-primary":i.primaryColor,"--consent-secondary":i.secondaryColor,"--consent-primary-rgb":Ve(i.primaryColor),"--consent-secondary-rgb":Ve(i.secondaryColor)}}function Ge(i){let t=je(i?.primaryColor,G.PRIMARY),e=je(i?.secondaryColor,G.SECONDARY),r=vt(i?.logoUrl),s=i?.companyName?.trim()||void 0,o=bt({primaryColor:t,secondaryColor:e});return{primaryColor:t,secondaryColor:e,logoUrl:r,companyName:s,cssVars:o}}var yt="[AI Agent]";function Ye(i,t){return t?i.replace(new RegExp(xt(yt),"g"),t):i}function xt(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ke(i,t){let e=i?.ui??{},r=i?.terms??{},s=i?.success??{},o=e.title??E.title,a=e.description??E.description,p=e.expirationText??E.expirationText,c=e.cancelButtonText??E.cancelButtonText,f=e.submitButtonText??E.submitButtonText,y=e.permissionsHeader??E.permissionsHeader,h=r.text??Y.text,k=s.title??D.title,R=s.description??D.description,q=Ye(a,t),We=Ye(R,t);return{title:o,description:a,expirationText:p,cancelButtonText:c,submitButtonText:f,permissionsHeader:y,termsText:h,termsUrl:r.url,termsRequired:r.required??Y.required,resolvedDescription:q,successTitle:k,successDescription:R,resolvedSuccessDescription:We,showCredential:s.showCredential??D.showCredential,continueButtonText:s.continueButtonText??D.continueButtonText}}function wt(i){return!i||i.length===0?[]:i.slice(0,10).filter(e=>!(!e.name||!e.label||!/^[a-zA-Z0-9_]+$/.test(e.name)||e.type==="select"&&(!e.options||e.options.length===0)))}function $t(i){return i==null?ze:i<1?1:i>365?365:Math.floor(i)}function we(i){return i?.oauth?.providerId?b.OAUTH:i?.credentials?.usernameLabel||i?.credentials?.passwordLabel?b.CREDENTIALS:i?.magicLink?.enabled?b.MAGIC_LINK:i?.otp?.enabled?b.OTP:b.CONSENT_ONLY}function Ct(i){return{title:i?.title??E.title,description:i?.description??E.description,expirationText:i?.expirationText??E.expirationText,cancelButtonText:i?.cancelButtonText??E.cancelButtonText,submitButtonText:i?.submitButtonText??E.submitButtonText,permissionsHeader:i?.permissionsHeader??E.permissionsHeader,autoClose:i?.autoClose??E.autoClose,popupEnabled:i?.popupEnabled??E.popupEnabled,theme:i?.theme??E.theme}}function Et(i){return{text:i?.text??Y.text,url:i?.url,version:i?.version,required:i?.required??Y.required}}function At(i){return{title:i?.title??D.title,description:i?.description??D.description,showCredential:i?.showCredential??D.showCredential,redirectUrl:i?.redirectUrl,redirectDelay:i?.redirectDelay,continueButtonText:i?.continueButtonText??D.continueButtonText}}function $e(i,t){let e=Ge(i?.branding),r=Ke(i,t),s=Ct(i?.ui),o=Et(i?.terms),a=At(i?.success),p=wt(i?.customFields),c=$t(i?.expirationDays),f=we(i);return{branding:e,copy:r,ui:s,terms:o,success:a,customFields:p,expirationDays:c,authMode:f,credentials:i?.credentials,oauth:i?.oauth,magicLink:i?.magicLink,otp:i?.otp,qrCode:i?.qrCode,passkey:i?.passkey,idv:i?.idv}}var m=class extends g{constructor(){super(...arguments);this.tool="";this.scopes=[];this.agentDid="";this.sessionId="";this.projectId="";this.serverUrl="";this.agentName="";this.currentMode=b.CONSENT_ONLY;this.loading=!1;this.step="consent";this.termsAccepted=!1;this.formData={};this.resendCooldown=0;this.selectedScopes=[]}connectedCallback(){super.connectedCallback(),this.resolved=$e(this.config,this.agentName),this.currentMode=this.mode??we(this.config)??b.CONSENT_ONLY,this.selectedScopes=[...this.scopes]}disconnectedCallback(){super.disconnectedCallback(),this.resendCooldownInterval!==void 0&&(clearInterval(this.resendCooldownInterval),this.resendCooldownInterval=void 0)}updated(e){(e.has("config")||e.has("agentName"))&&(this.resolved=$e(this.config,this.agentName)),e.has("mode")&&this.mode&&(this.currentMode=this.mode),e.has("scopes")&&(this.selectedScopes=[...this.scopes]),this.resolved&&(this.style.setProperty("--consent-primary",this.resolved.branding.primaryColor),this.style.setProperty("--consent-secondary",this.resolved.branding.secondaryColor))}getProviderType(){switch(this.currentMode){case b.CREDENTIALS:return"credential";case b.OAUTH:return this.oauthIdentity?.provider??"oauth2";case b.MAGIC_LINK:return"magic_link";case b.OTP:return"otp";case b.CONSENT_ONLY:default:return"none"}}async handleApprove(e){if(e?.preventDefault(),!this.loading){if(!this.termsAccepted&&this.resolved?.terms.required){this.error="Please accept the terms to continue";return}if(this.scopes.length>0&&this.selectedScopes.length===0){this.error="Please select at least one permission";return}this.loading=!0,this.error=void 0;try{let r=new FormData;r.append("tool",this.tool),r.append("scopes",JSON.stringify(this.selectedScopes)),r.append("agent_did",this.agentDid),r.append("session_id",this.sessionId),r.append("project_id",this.projectId),r.append("auth_mode",this.currentMode),r.append("provider_type",this.getProviderType()),r.append("termsAccepted",String(this.termsAccepted)),Object.entries(this.formData).forEach(([a,p])=>{r.append(a,p)});let s=await fetch(`${this.serverUrl}/consent/approve`,{method:"POST",body:r});if(!s.ok){let a=await s.json().catch(()=>({}));throw new Error(a.message||"Approval failed")}let o=await s.json();this.step="success",this.dispatchEvent(new CustomEvent("mcp-consent:approve",{detail:{success:!0,redirectUrl:o.redirectUrl},bubbles:!0,composed:!0}))}catch(r){this.error=r instanceof Error?r.message:"Unknown error",this.dispatchEvent(new CustomEvent("mcp-consent:error",{detail:{error:this.error},bubbles:!0,composed:!0}))}finally{this.loading=!1}}}handleDeny(){this.dispatchEvent(new CustomEvent("mcp-consent:deny",{bubbles:!0,composed:!0})),window.close()}handleTermsChange(e){this.termsAccepted=e.detail.checked}handleInputChange(e,r){this.formData={...this.formData,[e]:r}}handleResendOtp(){if(this.resendCooldown>0)return;let e=this.resolved?.otp?.resendCooldown??60;this.resendCooldown=e,this.resendCooldownInterval!==void 0&&clearInterval(this.resendCooldownInterval),this.resendCooldownInterval=setInterval(()=>{this.resendCooldown--,this.resendCooldown<=0&&(clearInterval(this.resendCooldownInterval),this.resendCooldownInterval=void 0)},1e3),this.dispatchEvent(new CustomEvent("mcp-consent:resend-otp",{bubbles:!0,composed:!0}))}renderAgentInfo(){let e=this.agentName||"this agent";return d`
1067
+ `,n([l({type:Number})],A.prototype,"length",2),n([l({type:String})],A.prototype,"name",2),n([l({type:String})],A.prototype,"value",2),n([l({type:Boolean,reflect:!0})],A.prototype,"disabled",2),n([l({type:Boolean,reflect:!0})],A.prototype,"error",2),n([l({type:Boolean,attribute:"auto-focus"})],A.prototype,"autoFocus",2),n([l({type:String,attribute:"input-type"})],A.prototype,"inputType",2),n([w()],A.prototype,"digits",2),n([He("input")],A.prototype,"inputs",2),A=n([x("consent-otp-input")],A);var f={CONSENT_ONLY:"consent-only",CREDENTIALS:"credentials",OAUTH:"oauth",MAGIC_LINK:"magic-link",OTP:"otp",QR_CODE:"qr-code",PASSKEY:"passkey",IDV:"idv"},L={NONE:"none",PASSWORD:"password",OAUTH2:"oauth2",MAGIC_LINK:"magic_link",OTP:"otp"},vt={[f.CONSENT_ONLY]:L.NONE,[f.CREDENTIALS]:L.PASSWORD,[f.OAUTH]:L.OAUTH2,[f.MAGIC_LINK]:L.MAGIC_LINK,[f.OTP]:L.OTP,[f.QR_CODE]:L.NONE,[f.PASSKEY]:L.NONE,[f.IDV]:L.NONE};function Ve(i){return vt[i]??L.NONE}var Y={PRIMARY:"#2563EB",SECONDARY:"#DBEAFE",BACKGROUND:"#F9FAFB",TEXT_PRIMARY:"#111827",TEXT_SECONDARY:"#6B7280",TEXT_MUTED:"#9CA3AF",BORDER:"#E5E7EB",BORDER_DARK:"#D1D5DB",SUCCESS:"#16A34A",ERROR:"#DC2626",WARNING:"#F59E0B"};var fi={primaryColor:Y.PRIMARY,secondaryColor:Y.SECONDARY,logoUrl:void 0,companyName:void 0},E={title:"Permission request",description:"It looks like you would like to use [AI Agent] to access resources on your behalf.",expirationText:"This delegation will expire in",cancelButtonText:"Cancel",submitButtonText:"Allow access",permissionsHeader:"The agent is requesting the following permissions:",autoClose:!1,popupEnabled:!1,theme:"auto"},K={text:"Terms and Conditions",url:void 0,version:void 0,required:!0},D={title:"Access Granted",description:"The agent now has permission to act on your behalf.",showCredential:!0,redirectUrl:void 0,redirectDelay:void 0,continueButtonText:"Close"};var je=30;function yt(i){return i?/^#[0-9A-Fa-f]{6}$/.test(i):!1}function Ge(i,t){return yt(i)?i:t}function bt(i){if(!i)return!1;try{let t=new URL(i);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function xt(i){if(bt(i))return i}function Ye(i){let t=i.replace(/^#/,""),e=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),s=parseInt(t.slice(4,6),16);return`${e}, ${r}, ${s}`}function wt(i){return{"--consent-primary":i.primaryColor,"--consent-secondary":i.secondaryColor,"--consent-primary-rgb":Ye(i.primaryColor),"--consent-secondary-rgb":Ye(i.secondaryColor)}}function Ke(i){let t=Ge(i?.primaryColor,Y.PRIMARY),e=Ge(i?.secondaryColor,Y.SECONDARY),r=xt(i?.logoUrl),s=i?.companyName?.trim()||void 0,o=wt({primaryColor:t,secondaryColor:e});return{primaryColor:t,secondaryColor:e,logoUrl:r,companyName:s,cssVars:o}}var $t="[AI Agent]";function We(i,t){return t?i.replace(new RegExp(Ct($t),"g"),t):i}function Ct(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Je(i,t){let e=i?.ui??{},r=i?.terms??{},s=i?.success??{},o=e.title??E.title,a=e.description??E.description,p=e.expirationText??E.expirationText,c=e.cancelButtonText??E.cancelButtonText,v=e.submitButtonText??E.submitButtonText,b=e.permissionsHeader??E.permissionsHeader,m=r.text??K.text,k=s.title??D.title,R=s.description??D.description,z=We(a,t),Qe=We(R,t);return{title:o,description:a,expirationText:p,cancelButtonText:c,submitButtonText:v,permissionsHeader:b,termsText:m,termsUrl:r.url,termsRequired:r.required??K.required,resolvedDescription:z,successTitle:k,successDescription:R,resolvedSuccessDescription:Qe,showCredential:s.showCredential??D.showCredential,continueButtonText:s.continueButtonText??D.continueButtonText}}function Et(i){return!i||i.length===0?[]:i.slice(0,10).filter(e=>!(!e.name||!e.label||!/^[a-zA-Z0-9_]+$/.test(e.name)||e.type==="select"&&(!e.options||e.options.length===0)))}function At(i){return i==null?je:i<1?1:i>365?365:Math.floor(i)}function $e(i){return i?.oauth?.providerId?f.OAUTH:i?.credentials?.usernameLabel||i?.credentials?.passwordLabel?f.CREDENTIALS:i?.magicLink?.enabled?f.MAGIC_LINK:i?.otp?.enabled?f.OTP:f.CONSENT_ONLY}function St(i){return{title:i?.title??E.title,description:i?.description??E.description,expirationText:i?.expirationText??E.expirationText,cancelButtonText:i?.cancelButtonText??E.cancelButtonText,submitButtonText:i?.submitButtonText??E.submitButtonText,permissionsHeader:i?.permissionsHeader??E.permissionsHeader,autoClose:i?.autoClose??E.autoClose,popupEnabled:i?.popupEnabled??E.popupEnabled,theme:i?.theme??E.theme}}function _t(i){return{text:i?.text??K.text,url:i?.url,version:i?.version,required:i?.required??K.required}}function Tt(i){return{title:i?.title??D.title,description:i?.description??D.description,showCredential:i?.showCredential??D.showCredential,redirectUrl:i?.redirectUrl,redirectDelay:i?.redirectDelay,continueButtonText:i?.continueButtonText??D.continueButtonText}}function Ce(i,t){let e=Ke(i?.branding),r=Je(i,t),s=St(i?.ui),o=_t(i?.terms),a=Tt(i?.success),p=Et(i?.customFields),c=At(i?.expirationDays),v=$e(i);return{branding:e,copy:r,ui:s,terms:o,success:a,customFields:p,expirationDays:c,authMode:v,credentials:i?.credentials,oauth:i?.oauth,magicLink:i?.magicLink,otp:i?.otp,qrCode:i?.qrCode,passkey:i?.passkey,idv:i?.idv}}var h=class extends g{constructor(){super(...arguments);this.tool="";this.scopes=[];this.agentDid="";this.sessionId="";this.projectId="";this.serverUrl="";this.agentName="";this.provider="";this.csrfToken="";this.credentialProviderType="";this.credentialProvider="";this.currentMode=f.CONSENT_ONLY;this.loading=!1;this.step="consent";this.termsAccepted=!1;this.formData={};this.resendCooldown=0;this.selectedScopes=[]}connectedCallback(){super.connectedCallback(),this.resolved=Ce(this.config,this.agentName),this.currentMode=this.mode??$e(this.config)??f.CONSENT_ONLY,this.selectedScopes=[...this.scopes]}disconnectedCallback(){super.disconnectedCallback(),this.resendCooldownInterval!==void 0&&(clearInterval(this.resendCooldownInterval),this.resendCooldownInterval=void 0)}updated(e){(e.has("config")||e.has("agentName"))&&(this.resolved=Ce(this.config,this.agentName)),e.has("mode")&&this.mode&&(this.currentMode=this.mode),e.has("scopes")&&(this.selectedScopes=[...this.scopes]),this.resolved&&(this.style.setProperty("--consent-primary",this.resolved.branding.primaryColor),this.style.setProperty("--consent-secondary",this.resolved.branding.secondaryColor))}getProviderType(){return this.currentMode===f.OAUTH&&this.oauthIdentity?.provider?this.oauthIdentity.provider:Ve(this.currentMode)}async handleApprove(e){if(e?.preventDefault(),!this.loading){if(!this.termsAccepted&&this.resolved?.terms.required){this.error="Please accept the terms to continue";return}if(this.scopes.length>0&&this.selectedScopes.length===0){this.error="Please select at least one permission";return}this.loading=!0,this.error=void 0;try{let r=new FormData;r.append("tool",this.tool),r.append("scopes",JSON.stringify(this.selectedScopes)),r.append("agent_did",this.agentDid),r.append("session_id",this.sessionId),r.append("project_id",this.projectId),r.append("auth_mode",this.currentMode),r.append("provider_type",this.getProviderType()),this.provider&&r.append("provider",this.provider),this.csrfToken&&r.append("csrf_token",this.csrfToken),r.append("termsAccepted",String(this.termsAccepted)),this.credentialProviderType&&r.append("credential_provider_type",this.credentialProviderType),this.credentialProvider&&r.append("credential_provider",this.credentialProvider),console.log("[mcp-consent] handleApprove formData:",{keys:Object.keys(this.formData),hasUsername:"username"in this.formData,hasPassword:"password"in this.formData,usernameValue:this.formData.username,passwordLength:this.formData.password?.length??"null/undefined"}),Object.entries(this.formData).forEach(([a,p])=>{r.append(a,p)});let s=await fetch(`${this.serverUrl}/consent/approve`,{method:"POST",body:r});if(!s.ok){let a=await s.json().catch(()=>({}));throw new Error(a.message||"Approval failed")}let o=await s.json();if(o.redirectUrl){this.dispatchEvent(new CustomEvent("mcp-consent:approve",{detail:{success:!0,redirectUrl:o.redirectUrl},bubbles:!0,composed:!0})),window.location.href=o.redirectUrl;return}this.step="success",this.dispatchEvent(new CustomEvent("mcp-consent:approve",{detail:{success:!0,delegationId:o.delegation_id},bubbles:!0,composed:!0}))}catch(r){this.error=r instanceof Error?r.message:"Unknown error",this.dispatchEvent(new CustomEvent("mcp-consent:error",{detail:{error:this.error},bubbles:!0,composed:!0}))}finally{this.loading=!1}}}handleDeny(){this.dispatchEvent(new CustomEvent("mcp-consent:deny",{bubbles:!0,composed:!0})),window.close()}handleTermsChange(e){this.termsAccepted=e.detail.checked}handleInputChange(e,r){console.log("[mcp-consent] handleInputChange:",{name:e,valueType:typeof r,valueLength:r?.length??"null/undefined",value:e==="password"?"***":r}),this.formData={...this.formData,[e]:r}}handleResendOtp(){if(this.resendCooldown>0)return;let e=this.resolved?.otp?.resendCooldown??60;this.resendCooldown=e,this.resendCooldownInterval!==void 0&&clearInterval(this.resendCooldownInterval),this.resendCooldownInterval=setInterval(()=>{this.resendCooldown--,this.resendCooldown<=0&&(clearInterval(this.resendCooldownInterval),this.resendCooldownInterval=void 0)},1e3),this.dispatchEvent(new CustomEvent("mcp-consent:resend-otp",{bubbles:!0,composed:!0}))}renderAgentInfo(){let e=this.agentName||"this agent";return d`
1068
1068
  <div class="agent-info">
1069
1069
  <div class="agent-icon">
1070
1070
  <svg
@@ -1161,7 +1161,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
1161
1161
  placeholder=${e?.usernamePlaceholder??"Enter your username"}
1162
1162
  autocomplete="username"
1163
1163
  required
1164
- @input=${r=>this.handleInputChange("username",r.detail.value)}
1164
+ @input=${r=>{let o=r.detail?.value??r.target?.value??"";this.handleInputChange("username",o)}}
1165
1165
  ></consent-input>
1166
1166
 
1167
1167
  <consent-input
@@ -1171,7 +1171,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
1171
1171
  placeholder=${e?.passwordPlaceholder??"Enter your password"}
1172
1172
  autocomplete="current-password"
1173
1173
  required
1174
- @input=${r=>this.handleInputChange("password",r.detail.value)}
1174
+ @input=${r=>{let o=r.detail?.value??r.target?.value??"";this.handleInputChange("password",o)}}
1175
1175
  ></consent-input>
1176
1176
  </div>
1177
1177
 
@@ -1236,7 +1236,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
1236
1236
  placeholder=${e?.emailPlaceholder??"Enter your email address"}
1237
1237
  autocomplete="email"
1238
1238
  required
1239
- @input=${r=>this.handleInputChange("email",r.detail.value)}
1239
+ @input=${r=>{let o=r.detail?.value??r.target?.value??"";this.handleInputChange("email",o)}}
1240
1240
  ></consent-input>
1241
1241
  </div>
1242
1242
 
@@ -1277,8 +1277,8 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
1277
1277
  length=${e?.digits??6}
1278
1278
  name="otp"
1279
1279
  auto-focus
1280
- @complete=${r=>{this.handleInputChange("otp",r.detail.value),this.handleApprove()}}
1281
- @input=${r=>this.handleInputChange("otp",r.detail.value)}
1280
+ @complete=${r=>{let o=r.detail?.value??"";this.handleInputChange("otp",o),this.handleApprove()}}
1281
+ @input=${r=>{let o=r.detail?.value??"";this.handleInputChange("otp",o)}}
1282
1282
  ></consent-otp-input>
1283
1283
  <div class="otp-resend">
1284
1284
  Didn't receive the code?
@@ -1334,12 +1334,13 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
1334
1334
  </consent-button>
1335
1335
  </div>
1336
1336
  </consent-shell>
1337
- `}render(){if(this.step==="success")return this.renderSuccess();switch(this.currentMode){case b.CREDENTIALS:return this.renderCredentials();case b.OAUTH:return this.renderOAuth();case b.MAGIC_LINK:return this.renderMagicLink();case b.OTP:return this.renderOTP();case b.CONSENT_ONLY:default:return this.renderConsentOnly()}}};m.styles=v`
1337
+ `}render(){if(this.step==="success")return this.renderSuccess();switch(this.currentMode){case f.CREDENTIALS:return this.renderCredentials();case f.OAUTH:return this.renderOAuth();case f.MAGIC_LINK:return this.renderMagicLink();case f.OTP:return this.renderOTP();case f.CONSENT_ONLY:default:return this.renderConsentOnly()}}};h.styles=y`
1338
1338
  :host {
1339
1339
  display: block;
1340
1340
  /* System font stack with font smoothing for crisp text */
1341
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
1342
- 'Helvetica Neue', Arial, sans-serif;
1341
+ font-family:
1342
+ -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
1343
+ Arial, sans-serif;
1343
1344
  -webkit-font-smoothing: antialiased;
1344
1345
  -moz-osx-font-smoothing: grayscale;
1345
1346
  --_primary: var(--consent-primary, #2563eb);
@@ -1446,7 +1447,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
1446
1447
 
1447
1448
  .divider::before,
1448
1449
  .divider::after {
1449
- content: '';
1450
+ content: "";
1450
1451
  flex: 1;
1451
1452
  height: 1px;
1452
1453
  background: #e5e7eb;
@@ -1517,7 +1518,7 @@ var Je=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var n=(i,t,e
1517
1518
  color: #9ca3af;
1518
1519
  cursor: not-allowed;
1519
1520
  }
1520
- `,n([l({type:Object,converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):""}})],m.prototype,"config",2),n([l({type:String})],m.prototype,"mode",2),n([l({type:String})],m.prototype,"tool",2),n([l({type:Array,converter:{fromAttribute:e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},toAttribute:e=>JSON.stringify(e)}})],m.prototype,"scopes",2),n([l({type:String,attribute:"agent-did"})],m.prototype,"agentDid",2),n([l({type:String,attribute:"session-id"})],m.prototype,"sessionId",2),n([l({type:String,attribute:"project-id"})],m.prototype,"projectId",2),n([l({type:String,attribute:"server-url"})],m.prototype,"serverUrl",2),n([l({type:String,attribute:"agent-name"})],m.prototype,"agentName",2),n([l({type:Object,attribute:"oauth-identity",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):""}})],m.prototype,"oauthIdentity",2),n([w()],m.prototype,"resolved",2),n([w()],m.prototype,"currentMode",2),n([w()],m.prototype,"loading",2),n([w()],m.prototype,"error",2),n([w()],m.prototype,"step",2),n([w()],m.prototype,"termsAccepted",2),n([w()],m.prototype,"formData",2),n([w()],m.prototype,"resendCooldown",2),n([w()],m.prototype,"selectedScopes",2),m=n([x("mcp-consent")],m);export{_ as ConsentButton,T as ConsentCheckbox,C as ConsentInput,S as ConsentOAuthButton,A as ConsentOTPInput,U as ConsentPermissions,I as ConsentShell,$ as ConsentTerms,m as McpConsent};
1521
+ `,n([l({type:Object,converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):""}})],h.prototype,"config",2),n([l({type:String})],h.prototype,"mode",2),n([l({type:String})],h.prototype,"tool",2),n([l({type:Array,converter:{fromAttribute:e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},toAttribute:e=>JSON.stringify(e)}})],h.prototype,"scopes",2),n([l({type:String,attribute:"agent-did"})],h.prototype,"agentDid",2),n([l({type:String,attribute:"session-id"})],h.prototype,"sessionId",2),n([l({type:String,attribute:"project-id"})],h.prototype,"projectId",2),n([l({type:String,attribute:"server-url"})],h.prototype,"serverUrl",2),n([l({type:String,attribute:"agent-name"})],h.prototype,"agentName",2),n([l({type:String,attribute:"provider"})],h.prototype,"provider",2),n([l({type:String,attribute:"csrf-token"})],h.prototype,"csrfToken",2),n([l({type:String,attribute:"credential-provider-type"})],h.prototype,"credentialProviderType",2),n([l({type:String,attribute:"credential-provider"})],h.prototype,"credentialProvider",2),n([l({type:Object,attribute:"oauth-identity",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):""}})],h.prototype,"oauthIdentity",2),n([w()],h.prototype,"resolved",2),n([w()],h.prototype,"currentMode",2),n([w()],h.prototype,"loading",2),n([w()],h.prototype,"error",2),n([w()],h.prototype,"step",2),n([w()],h.prototype,"termsAccepted",2),n([w()],h.prototype,"formData",2),n([w()],h.prototype,"resendCooldown",2),n([w()],h.prototype,"selectedScopes",2),h=n([x("mcp-consent")],h);export{_ as ConsentButton,T as ConsentCheckbox,C as ConsentInput,S as ConsentOAuthButton,A as ConsentOTPInput,P as ConsentPermissions,I as ConsentShell,$ as ConsentTerms,h as McpConsent};
1521
1522
  /*! Bundled license information:
1522
1523
 
1523
1524
  @lit/reactive-element/css-tag.js: