@kya-os/consent 0.1.12 → 0.1.14
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/bundle/inline.d.ts.map +1 -1
- package/dist/bundle/inline.js +2 -2
- package/dist/bundle/inline.js.map +1 -1
- package/dist/bundle/shell.d.ts +5 -0
- package/dist/bundle/shell.d.ts.map +1 -1
- package/dist/bundle/shell.js +3 -1
- package/dist/bundle/shell.js.map +1 -1
- package/dist/cjs/bundle/index.js +57 -0
- package/dist/cjs/bundle/index.js.map +1 -0
- package/dist/cjs/bundle/inline.js +22 -0
- package/dist/cjs/bundle/inline.js.map +1 -0
- package/dist/cjs/bundle/shell.js +291 -0
- package/dist/cjs/bundle/shell.js.map +1 -0
- package/dist/cjs/components/consent-button.js +180 -0
- package/dist/cjs/components/consent-button.js.map +1 -0
- package/dist/cjs/components/consent-checkbox.js +223 -0
- package/dist/cjs/components/consent-checkbox.js.map +1 -0
- package/dist/cjs/components/consent-input.js +335 -0
- package/dist/cjs/components/consent-input.js.map +1 -0
- package/dist/cjs/components/consent-oauth-button.js +392 -0
- package/dist/cjs/components/consent-oauth-button.js.map +1 -0
- package/dist/cjs/components/consent-otp-input.js +388 -0
- package/dist/cjs/components/consent-otp-input.js.map +1 -0
- package/dist/cjs/components/consent-permissions.js +433 -0
- package/dist/cjs/components/consent-permissions.js.map +1 -0
- package/dist/cjs/components/consent-shell.js +234 -0
- package/dist/cjs/components/consent-shell.js.map +1 -0
- package/dist/cjs/components/consent-terms.js +287 -0
- package/dist/cjs/components/consent-terms.js.map +1 -0
- package/dist/cjs/components/index.js +37 -0
- package/dist/cjs/components/index.js.map +1 -0
- package/dist/cjs/components/mcp-consent.js +1034 -0
- package/dist/cjs/components/mcp-consent.js.map +1 -0
- package/dist/cjs/constants/auth-modes.js +128 -0
- package/dist/cjs/constants/auth-modes.js.map +1 -0
- package/dist/cjs/constants/colors.js +40 -0
- package/dist/cjs/constants/colors.js.map +1 -0
- package/dist/cjs/constants/defaults.js +146 -0
- package/dist/cjs/constants/defaults.js.map +1 -0
- package/dist/cjs/constants/index.js +40 -0
- package/dist/cjs/constants/index.js.map +1 -0
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/react/index.js +190 -0
- package/dist/cjs/react/index.js.map +1 -0
- package/dist/cjs/resolution/index.js +28 -0
- package/dist/cjs/resolution/index.js.map +1 -0
- package/dist/cjs/resolution/resolve-branding.js +159 -0
- package/dist/cjs/resolution/resolve-branding.js.map +1 -0
- package/dist/cjs/resolution/resolve-config.js +270 -0
- package/dist/cjs/resolution/resolve-config.js.map +1 -0
- package/dist/cjs/resolution/resolve-copy.js +136 -0
- package/dist/cjs/resolution/resolve-copy.js.map +1 -0
- package/dist/cjs/schemas/api.schemas.js +156 -0
- package/dist/cjs/schemas/api.schemas.js.map +1 -0
- package/dist/cjs/schemas/branding.schemas.js +57 -0
- package/dist/cjs/schemas/branding.schemas.js.map +1 -0
- package/dist/cjs/schemas/config.schemas.js +147 -0
- package/dist/cjs/schemas/config.schemas.js.map +1 -0
- package/dist/cjs/schemas/index.js +29 -0
- package/dist/cjs/schemas/index.js.map +1 -0
- package/dist/cjs/schemas/modes.schemas.js +107 -0
- package/dist/cjs/schemas/modes.schemas.js.map +1 -0
- package/dist/cjs/security/escape.js +206 -0
- package/dist/cjs/security/escape.js.map +1 -0
- package/dist/cjs/security/index.js +26 -0
- package/dist/cjs/security/index.js.map +1 -0
- package/dist/cjs/security/validators.js +210 -0
- package/dist/cjs/security/validators.js.map +1 -0
- package/dist/cjs/styles/css-variables.js +129 -0
- package/dist/cjs/styles/css-variables.js.map +1 -0
- package/dist/cjs/styles/index.js +28 -0
- package/dist/cjs/styles/index.js.map +1 -0
- package/dist/cjs/styles/stylesheet.js +204 -0
- package/dist/cjs/styles/stylesheet.js.map +1 -0
- package/dist/cjs/styles/tokens.js +183 -0
- package/dist/cjs/styles/tokens.js.map +1 -0
- package/dist/cjs/templates/base/base-template.js +282 -0
- package/dist/cjs/templates/base/base-template.js.map +1 -0
- package/dist/cjs/templates/base/components.js +295 -0
- package/dist/cjs/templates/base/components.js.map +1 -0
- package/dist/cjs/templates/base/index.js +26 -0
- package/dist/cjs/templates/base/index.js.map +1 -0
- package/dist/cjs/templates/index.js +34 -0
- package/dist/cjs/templates/index.js.map +1 -0
- package/dist/cjs/templates/modes/consent-only.template.js +74 -0
- package/dist/cjs/templates/modes/consent-only.template.js.map +1 -0
- package/dist/cjs/templates/modes/credentials.template.js +414 -0
- package/dist/cjs/templates/modes/credentials.template.js.map +1 -0
- package/dist/cjs/templates/modes/index.js +24 -0
- package/dist/cjs/templates/modes/index.js.map +1 -0
- package/dist/cjs/templates/modes/magic-link.template.js +196 -0
- package/dist/cjs/templates/modes/magic-link.template.js.map +1 -0
- package/dist/cjs/templates/modes/oauth.template.js +153 -0
- package/dist/cjs/templates/modes/oauth.template.js.map +1 -0
- package/dist/cjs/templates/modes/otp.template.js +316 -0
- package/dist/cjs/templates/modes/otp.template.js.map +1 -0
- package/dist/cjs/templates/modes/success.template.js +140 -0
- package/dist/cjs/templates/modes/success.template.js.map +1 -0
- package/dist/cjs/templates/registry.js +133 -0
- package/dist/cjs/templates/registry.js.map +1 -0
- package/dist/cjs/types/api.types.js +10 -0
- package/dist/cjs/types/api.types.js.map +1 -0
- package/dist/cjs/types/branding.types.js +10 -0
- package/dist/cjs/types/branding.types.js.map +1 -0
- package/dist/cjs/types/config.types.js +10 -0
- package/dist/cjs/types/config.types.js.map +1 -0
- package/dist/cjs/types/copy.types.js +10 -0
- package/dist/cjs/types/copy.types.js.map +1 -0
- package/dist/cjs/types/index.js +31 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/modes.types.js +140 -0
- package/dist/cjs/types/modes.types.js.map +1 -0
- package/dist/cjs/types/page.types.js +10 -0
- package/dist/cjs/types/page.types.js.map +1 -0
- package/dist/components/mcp-consent.d.ts +17 -0
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +21 -1
- package/dist/components/mcp-consent.js.map +1 -1
- package/dist/consent.js +12 -1
- package/dist/consent.min.js +13 -13
- package/dist/schemas/api.schemas.d.ts +116 -116
- package/dist/schemas/config.schemas.d.ts +116 -116
- package/dist/schemas/modes.schemas.d.ts +28 -28
- package/package.json +29 -15
package/dist/consent.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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),
|
|
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
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,
|
|
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 Xe=Object.defineProperty;var Ze=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=
|
|
14
|
+
`}};_.formAssociated=!0,_.styles=y`
|
|
15
15
|
:host {
|
|
16
16
|
display: inline-block;
|
|
17
17
|
}
|
|
@@ -97,7 +97,7 @@ var Xe=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var n=(i,t,e
|
|
|
97
97
|
<slot></slot>
|
|
98
98
|
</span>
|
|
99
99
|
</label>
|
|
100
|
-
`}};T.formAssociated=!0,T.styles=
|
|
100
|
+
`}};T.formAssociated=!0,T.styles=y`
|
|
101
101
|
:host {
|
|
102
102
|
display: block;
|
|
103
103
|
}
|
|
@@ -236,7 +236,7 @@ var Xe=Object.defineProperty;var Ze=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=
|
|
239
|
+
`}};C.formAssociated=!0,C.styles=y`
|
|
240
240
|
:host {
|
|
241
241
|
display: block;
|
|
242
242
|
}
|
|
@@ -406,7 +406,7 @@ var Xe=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var n=(i,t,e
|
|
|
406
406
|
<slot name="footer"></slot>
|
|
407
407
|
</footer>
|
|
408
408
|
</div>
|
|
409
|
-
`}};I.styles=
|
|
409
|
+
`}};I.styles=y`
|
|
410
410
|
:host {
|
|
411
411
|
display: block;
|
|
412
412
|
/* System font stack with font smoothing for crisp text */
|
|
@@ -539,7 +539,7 @@ var Xe=Object.defineProperty;var Ze=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
|
-
`}};P.styles=
|
|
542
|
+
`}};P.styles=y`
|
|
543
543
|
:host {
|
|
544
544
|
display: block;
|
|
545
545
|
--_primary: var(--consent-primary, #2563eb);
|
|
@@ -708,7 +708,7 @@ var Xe=Object.defineProperty;var Ze=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=
|
|
711
|
+
`}};$.formAssociated=!0,$.styles=y`
|
|
712
712
|
:host {
|
|
713
713
|
display: block;
|
|
714
714
|
--_primary: var(--consent-primary, #2563eb);
|
|
@@ -897,7 +897,7 @@ var Xe=Object.defineProperty;var Ze=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=
|
|
900
|
+
`}};S.styles=y`
|
|
901
901
|
:host {
|
|
902
902
|
display: inline-block;
|
|
903
903
|
}
|
|
@@ -985,7 +985,7 @@ var Xe=Object.defineProperty;var Ze=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=
|
|
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 Xe=Object.defineProperty;var Ze=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([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
|
|
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.userDid="";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),this.userDid&&r.append("user_did",this.userDid),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){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
|
|
@@ -1334,7 +1334,7 @@ var Xe=Object.defineProperty;var Ze=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 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=
|
|
1337
|
+
`}render(){if((this.previewStep??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 */
|
|
@@ -1518,7 +1518,7 @@ var Xe=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var n=(i,t,e
|
|
|
1518
1518
|
color: #9ca3af;
|
|
1519
1519
|
cursor: not-allowed;
|
|
1520
1520
|
}
|
|
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
|
+
`,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:"preview-step"})],h.prototype,"previewStep",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:String,attribute:"user-did"})],h.prototype,"userDid",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};
|
|
1522
1522
|
/*! Bundled license information:
|
|
1523
1523
|
|
|
1524
1524
|
@lit/reactive-element/css-tag.js:
|