@kya-os/consent 0.1.0 → 0.1.2
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/index.d.ts +44 -0
- package/dist/bundle/index.d.ts.map +1 -0
- package/dist/bundle/index.js +45 -0
- package/dist/bundle/index.js.map +1 -0
- package/dist/bundle/inline.d.ts +18 -0
- package/dist/bundle/inline.d.ts.map +1 -0
- package/dist/bundle/inline.js +18 -0
- package/dist/bundle/inline.js.map +1 -0
- package/dist/bundle/shell.d.ts +91 -0
- package/dist/bundle/shell.d.ts.map +1 -0
- package/dist/bundle/shell.js +282 -0
- package/dist/bundle/shell.js.map +1 -0
- package/dist/components/consent-button.d.ts +61 -0
- package/dist/components/consent-button.d.ts.map +1 -0
- package/dist/components/consent-button.js +177 -0
- package/dist/components/consent-button.js.map +1 -0
- package/dist/components/consent-checkbox.d.ts +61 -0
- package/dist/components/consent-checkbox.d.ts.map +1 -0
- package/dist/components/consent-checkbox.js +220 -0
- package/dist/components/consent-checkbox.js.map +1 -0
- package/dist/components/consent-input.d.ts +91 -0
- package/dist/components/consent-input.d.ts.map +1 -0
- package/dist/components/consent-input.js +332 -0
- package/dist/components/consent-input.js.map +1 -0
- package/dist/components/consent-oauth-button.d.ts +87 -0
- package/dist/components/consent-oauth-button.d.ts.map +1 -0
- package/dist/components/consent-oauth-button.js +389 -0
- package/dist/components/consent-oauth-button.js.map +1 -0
- package/dist/components/consent-otp-input.d.ts +92 -0
- package/dist/components/consent-otp-input.d.ts.map +1 -0
- package/dist/components/consent-otp-input.js +385 -0
- package/dist/components/consent-otp-input.js.map +1 -0
- package/dist/components/consent-permissions.d.ts +104 -0
- package/dist/components/consent-permissions.d.ts.map +1 -0
- package/dist/components/consent-permissions.js +430 -0
- package/dist/components/consent-permissions.js.map +1 -0
- package/dist/components/consent-shell.d.ts +72 -0
- package/dist/components/consent-shell.d.ts.map +1 -0
- package/dist/components/consent-shell.js +231 -0
- package/dist/components/consent-shell.js.map +1 -0
- package/dist/components/consent-terms.d.ts +89 -0
- package/dist/components/consent-terms.d.ts.map +1 -0
- package/dist/components/consent-terms.js +284 -0
- package/dist/components/consent-terms.js.map +1 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +23 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/mcp-consent.d.ts +152 -0
- package/dist/components/mcp-consent.d.ts.map +1 -0
- package/dist/components/mcp-consent.js +874 -0
- package/dist/components/mcp-consent.js.map +1 -0
- package/dist/consent.js +3744 -0
- package/dist/consent.min.js +1564 -0
- package/dist/constants/auth-modes.d.ts +7 -2
- package/dist/constants/auth-modes.d.ts.map +1 -1
- package/dist/constants/auth-modes.js +28 -36
- package/dist/constants/auth-modes.js.map +1 -1
- package/dist/constants/colors.js +1 -4
- package/dist/constants/colors.js.map +1 -1
- package/dist/constants/defaults.d.ts +1 -1
- package/dist/constants/defaults.d.ts.map +1 -1
- package/dist/constants/defaults.js +16 -19
- package/dist/constants/defaults.js.map +1 -1
- package/dist/constants/index.d.ts +3 -3
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +3 -26
- package/dist/constants/index.js.map +1 -1
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -23
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.ts +123 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +154 -0
- package/dist/react/index.js.map +1 -0
- package/dist/resolution/index.d.ts +3 -3
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +3 -19
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/resolve-branding.d.ts +1 -1
- package/dist/resolution/resolve-branding.d.ts.map +1 -1
- package/dist/resolution/resolve-branding.js +14 -24
- package/dist/resolution/resolve-branding.js.map +1 -1
- package/dist/resolution/resolve-config.d.ts +2 -2
- package/dist/resolution/resolve-config.d.ts.map +1 -1
- package/dist/resolution/resolve-config.js +57 -53
- package/dist/resolution/resolve-config.js.map +1 -1
- package/dist/resolution/resolve-copy.d.ts +2 -2
- package/dist/resolution/resolve-copy.d.ts.map +1 -1
- package/dist/resolution/resolve-copy.js +35 -43
- package/dist/resolution/resolve-copy.js.map +1 -1
- package/dist/schemas/api.schemas.d.ts +7 -4
- package/dist/schemas/api.schemas.d.ts.map +1 -1
- package/dist/schemas/api.schemas.js +70 -74
- package/dist/schemas/api.schemas.js.map +1 -1
- package/dist/schemas/branding.schemas.js +17 -20
- package/dist/schemas/branding.schemas.js.map +1 -1
- package/dist/schemas/config.schemas.d.ts +1 -1
- package/dist/schemas/config.schemas.d.ts.map +1 -1
- package/dist/schemas/config.schemas.js +64 -70
- package/dist/schemas/config.schemas.js.map +1 -1
- package/dist/schemas/index.d.ts +4 -4
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +4 -20
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/modes.schemas.js +60 -63
- package/dist/schemas/modes.schemas.js.map +1 -1
- package/dist/security/escape.d.ts.map +1 -1
- package/dist/security/escape.js +12 -17
- package/dist/security/escape.js.map +1 -1
- package/dist/security/index.d.ts +2 -2
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +2 -18
- package/dist/security/index.js.map +1 -1
- package/dist/security/validators.js +9 -20
- package/dist/security/validators.js.map +1 -1
- package/dist/styles/css-variables.d.ts +1 -1
- package/dist/styles/css-variables.d.ts.map +1 -1
- package/dist/styles/css-variables.js +18 -27
- package/dist/styles/css-variables.js.map +1 -1
- package/dist/styles/index.d.ts +3 -3
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/index.js +3 -19
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/stylesheet.d.ts +1 -1
- package/dist/styles/stylesheet.d.ts.map +1 -1
- package/dist/styles/stylesheet.js +20 -27
- package/dist/styles/stylesheet.js.map +1 -1
- package/dist/styles/tokens.js +1 -4
- package/dist/styles/tokens.js.map +1 -1
- package/dist/templates/base/base-template.d.ts +3 -3
- package/dist/templates/base/base-template.d.ts.map +1 -1
- package/dist/templates/base/base-template.js +31 -35
- package/dist/templates/base/base-template.js.map +1 -1
- package/dist/templates/base/components.js +49 -65
- package/dist/templates/base/components.js.map +1 -1
- package/dist/templates/base/index.d.ts +2 -2
- package/dist/templates/base/index.d.ts.map +1 -1
- package/dist/templates/base/index.js +2 -20
- package/dist/templates/base/index.js.map +1 -1
- package/dist/templates/index.d.ts +9 -9
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +9 -25
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/modes/consent-only.template.d.ts +2 -2
- package/dist/templates/modes/consent-only.template.d.ts.map +1 -1
- package/dist/templates/modes/consent-only.template.js +11 -15
- package/dist/templates/modes/consent-only.template.js.map +1 -1
- package/dist/templates/modes/credentials.template.d.ts +4 -4
- package/dist/templates/modes/credentials.template.d.ts.map +1 -1
- package/dist/templates/modes/credentials.template.js +20 -24
- package/dist/templates/modes/credentials.template.js.map +1 -1
- package/dist/templates/modes/index.d.ts +6 -6
- package/dist/templates/modes/index.d.ts.map +1 -1
- package/dist/templates/modes/index.js +6 -16
- package/dist/templates/modes/index.js.map +1 -1
- package/dist/templates/modes/magic-link.template.d.ts +2 -2
- package/dist/templates/modes/magic-link.template.d.ts.map +1 -1
- package/dist/templates/modes/magic-link.template.js +14 -18
- package/dist/templates/modes/magic-link.template.js.map +1 -1
- package/dist/templates/modes/oauth.template.d.ts +2 -2
- package/dist/templates/modes/oauth.template.d.ts.map +1 -1
- package/dist/templates/modes/oauth.template.js +21 -25
- package/dist/templates/modes/oauth.template.js.map +1 -1
- package/dist/templates/modes/otp.template.d.ts +2 -2
- package/dist/templates/modes/otp.template.d.ts.map +1 -1
- package/dist/templates/modes/otp.template.js +17 -21
- package/dist/templates/modes/otp.template.js.map +1 -1
- package/dist/templates/modes/success.template.d.ts +2 -2
- package/dist/templates/modes/success.template.d.ts.map +1 -1
- package/dist/templates/modes/success.template.js +24 -29
- package/dist/templates/modes/success.template.js.map +1 -1
- package/dist/templates/registry.d.ts +4 -4
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +30 -38
- package/dist/templates/registry.js.map +1 -1
- package/dist/types/api.types.d.ts +6 -5
- package/dist/types/api.types.d.ts.map +1 -1
- package/dist/types/api.types.js +1 -2
- package/dist/types/api.types.js.map +1 -1
- package/dist/types/branding.types.js +1 -2
- package/dist/types/branding.types.js.map +1 -1
- package/dist/types/config.types.d.ts +5 -5
- package/dist/types/config.types.d.ts.map +1 -1
- package/dist/types/config.types.js +1 -2
- package/dist/types/config.types.js.map +1 -1
- package/dist/types/copy.types.js +1 -2
- package/dist/types/copy.types.js.map +1 -1
- package/dist/types/index.d.ts +6 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +6 -22
- package/dist/types/index.js.map +1 -1
- package/dist/types/modes.types.js +1 -4
- package/dist/types/modes.types.js.map +1 -1
- package/dist/types/page.types.d.ts +6 -6
- package/dist/types/page.types.d.ts.map +1 -1
- package/dist/types/page.types.js +1 -2
- package/dist/types/page.types.js.map +1 -1
- package/package.json +41 -4
|
@@ -0,0 +1,1564 @@
|
|
|
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,ke=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,Te=/-->/g,Re=/>/g,O=RegExp(`>|${he}(?:([^\\s"'>=/]+)(${he}*=${he}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ue=/'/g,Ie=/"/g,Pe=/^(?:script|style|textarea|title)$/i,xe=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=xe(1),Ut=xe(2),It=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 ke!==void 0?ke.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,b,h=-1,T=0;for(;T<c.length&&(a.lastIndex=T,b=a.exec(c),b!==null);)T=a.lastIndex,a===Q?b[1]==="!--"?a=Te:b[1]!==void 0?a=Re:b[2]!==void 0?(Pe.test(b[2])&&(s=RegExp("</"+b[2],"g")),a=O):b[3]!==void 0&&(a=O):a===O?b[0]===">"?(a=s??Q,h=-1):b[1]===void 0?h=-2:(h=a.lastIndex-b[2].length,f=b[1],a=b[3]===void 0?O:b[3]==='"'?Ie:Ue):a===Ie||a===Ue?a=O:a===Te||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,b]=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 T=b[a++],R=s.getAttribute(h).split(M),q=/([.?@])?(.*)/.exec(T);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),T=h.length-1;if(T>0){s.textContent=le?le.emptyScript:"";for(let R=0;R<T;R++)s.append(h[R],Z()),B.nextNode(),c.push({type:2,index:++o});s.append(h[T],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 y=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 x(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`
|
|
4
|
+
<button
|
|
5
|
+
part="button"
|
|
6
|
+
type="button"
|
|
7
|
+
?disabled=${this.disabled||this.loading}
|
|
8
|
+
aria-busy=${this.loading}
|
|
9
|
+
@click=${this.handleClick}
|
|
10
|
+
>
|
|
11
|
+
${this.loading?d`<span class="spinner"></span>`:null}
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</button>
|
|
14
|
+
`}};_.formAssociated=!0,_.styles=v`
|
|
15
|
+
:host {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host([full-width]) {
|
|
20
|
+
display: block;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
button {
|
|
25
|
+
/* Base styles - matches AgentShield PreviewButton exactly */
|
|
26
|
+
padding: 0.75rem 1rem;
|
|
27
|
+
height: 2.75rem;
|
|
28
|
+
border-radius: 0.5rem;
|
|
29
|
+
font-size: 0.875rem;
|
|
30
|
+
font-weight: 500;
|
|
31
|
+
font-family: inherit;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
transition: opacity 0.15s ease, background-color 0.15s ease;
|
|
34
|
+
border: none;
|
|
35
|
+
width: 100%;
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
gap: 0.5rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Primary variant */
|
|
43
|
+
:host([variant='primary']) button {
|
|
44
|
+
background-color: var(--consent-primary, #2563eb);
|
|
45
|
+
color: white;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([variant='primary']) button:hover:not(:disabled) {
|
|
49
|
+
opacity: 0.9;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Secondary variant */
|
|
53
|
+
:host([variant='secondary']) button {
|
|
54
|
+
background-color: transparent;
|
|
55
|
+
color: #374151;
|
|
56
|
+
border: 1px solid #d1d5db;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host([variant='secondary']) button:hover:not(:disabled) {
|
|
60
|
+
background-color: #f9fafb;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Disabled state */
|
|
64
|
+
button:disabled {
|
|
65
|
+
opacity: 0.5;
|
|
66
|
+
cursor: not-allowed;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Loading spinner */
|
|
70
|
+
.spinner {
|
|
71
|
+
width: 1rem;
|
|
72
|
+
height: 1rem;
|
|
73
|
+
border: 2px solid currentColor;
|
|
74
|
+
border-top-color: transparent;
|
|
75
|
+
border-radius: 50%;
|
|
76
|
+
animation: spin 0.8s linear infinite;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@keyframes spin {
|
|
80
|
+
to {
|
|
81
|
+
transform: rotate(360deg);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`,n([l({type:String,reflect:!0})],_.prototype,"variant",2),n([l({type:String})],_.prototype,"type",2),n([l({type:Boolean,reflect:!0})],_.prototype,"disabled",2),n([l({type:Boolean,attribute:"full-width"})],_.prototype,"fullWidth",2),n([l({type:Boolean,reflect:!0})],_.prototype,"loading",2),_=n([y("consent-button")],_);var k=class extends g{constructor(){super();this.name="";this.checked=!1;this.required=!1;this.disabled=!1;this.value="on";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}))}render(){return d`
|
|
85
|
+
<label part="label">
|
|
86
|
+
<input
|
|
87
|
+
part="checkbox"
|
|
88
|
+
type="checkbox"
|
|
89
|
+
name=${this.name}
|
|
90
|
+
.value=${this.value}
|
|
91
|
+
.checked=${this.checked}
|
|
92
|
+
?required=${this.required}
|
|
93
|
+
?disabled=${this.disabled}
|
|
94
|
+
@change=${this.handleChange}
|
|
95
|
+
/>
|
|
96
|
+
<span class="text">
|
|
97
|
+
<slot></slot>
|
|
98
|
+
</span>
|
|
99
|
+
</label>
|
|
100
|
+
`}};k.formAssociated=!0,k.styles=v`
|
|
101
|
+
:host {
|
|
102
|
+
display: block;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
label {
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
gap: 0.75rem;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
font-size: 0.875rem;
|
|
111
|
+
color: #374151;
|
|
112
|
+
line-height: 1.5;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:host([disabled]) label {
|
|
116
|
+
cursor: not-allowed;
|
|
117
|
+
opacity: 0.6;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Custom checkbox styling - matches AgentShield exactly */
|
|
121
|
+
input[type='checkbox'] {
|
|
122
|
+
/* Reset */
|
|
123
|
+
appearance: none;
|
|
124
|
+
-webkit-appearance: none;
|
|
125
|
+
margin: 0;
|
|
126
|
+
|
|
127
|
+
/* Size - matches AgentShield w-4 h-4 */
|
|
128
|
+
width: 1rem;
|
|
129
|
+
height: 1rem;
|
|
130
|
+
min-width: 1rem;
|
|
131
|
+
margin-top: 0.125rem; /* Align with text baseline */
|
|
132
|
+
|
|
133
|
+
/* Border */
|
|
134
|
+
border: 1px solid #d1d5db;
|
|
135
|
+
border-radius: 0.25rem;
|
|
136
|
+
|
|
137
|
+
/* Background */
|
|
138
|
+
background-color: white;
|
|
139
|
+
|
|
140
|
+
/* Interaction */
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
position: relative;
|
|
143
|
+
transition: background-color 0.15s ease, border-color 0.15s ease;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
input[type='checkbox']:hover:not(:disabled) {
|
|
147
|
+
border-color: var(--consent-primary, #2563eb);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
input[type='checkbox']:focus-visible {
|
|
151
|
+
outline: 2px solid var(--consent-primary, #2563eb);
|
|
152
|
+
outline-offset: 2px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* Checked state */
|
|
156
|
+
input[type='checkbox']:checked {
|
|
157
|
+
background-color: var(--consent-primary, #2563eb);
|
|
158
|
+
border-color: var(--consent-primary, #2563eb);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* Checkmark */
|
|
162
|
+
input[type='checkbox']:checked::after {
|
|
163
|
+
content: '';
|
|
164
|
+
position: absolute;
|
|
165
|
+
left: 4px;
|
|
166
|
+
top: 1px;
|
|
167
|
+
width: 5px;
|
|
168
|
+
height: 9px;
|
|
169
|
+
border: solid white;
|
|
170
|
+
border-width: 0 2px 2px 0;
|
|
171
|
+
transform: rotate(45deg);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* Disabled */
|
|
175
|
+
input[type='checkbox']:disabled {
|
|
176
|
+
cursor: not-allowed;
|
|
177
|
+
opacity: 0.5;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* Text wrapper */
|
|
181
|
+
.text {
|
|
182
|
+
flex: 1;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Links in label */
|
|
186
|
+
::slotted(a) {
|
|
187
|
+
color: var(--consent-primary, #2563eb);
|
|
188
|
+
text-decoration: underline;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
::slotted(a:hover) {
|
|
192
|
+
text-decoration: none;
|
|
193
|
+
}
|
|
194
|
+
`,n([l({type:String})],k.prototype,"name",2),n([l({type:Boolean,reflect:!0})],k.prototype,"checked",2),n([l({type:Boolean})],k.prototype,"required",2),n([l({type:Boolean,reflect:!0})],k.prototype,"disabled",2),n([l({type:String})],k.prototype,"value",2),k=n([y("consent-checkbox")],k);var $=class extends g{constructor(){super();this.type="text";this.name="";this.value="";this.label="";this.placeholder="";this.required=!1;this.disabled=!1;this.autocomplete="";this.showPassword=!1;this.internals=this.attachInternals()}updated(e){e.has("value")&&this.internals.setFormValue(this.value||null)}handleInput(e){let r=e.target;this.value=r.value,this.internals.setFormValue(this.value||null),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},bubbles:!0,composed:!0}))}handleChange(e){let r=e.target;this.value=r.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}togglePasswordVisibility(){this.showPassword=!this.showPassword}renderPasswordToggle(){if(this.type!=="password")return null;let e=this.showPassword?d`
|
|
195
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
196
|
+
<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>
|
|
197
|
+
<line x1="1" y1="1" x2="23" y2="23"/>
|
|
198
|
+
</svg>
|
|
199
|
+
`:d`
|
|
200
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
201
|
+
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
|
|
202
|
+
<circle cx="12" cy="12" r="3"/>
|
|
203
|
+
</svg>
|
|
204
|
+
`;return d`
|
|
205
|
+
<button
|
|
206
|
+
type="button"
|
|
207
|
+
class="password-toggle"
|
|
208
|
+
@click=${this.togglePasswordVisibility}
|
|
209
|
+
tabindex="-1"
|
|
210
|
+
aria-label=${this.showPassword?"Hide password":"Show password"}
|
|
211
|
+
>
|
|
212
|
+
${e}
|
|
213
|
+
</button>
|
|
214
|
+
`}render(){let e=this.type==="password"&&this.showPassword?"text":this.type;return d`
|
|
215
|
+
<div class="field">
|
|
216
|
+
${this.label?d`
|
|
217
|
+
<label part="label" for="input">
|
|
218
|
+
${this.label}${this.required?d`<span class="required">*</span>`:null}
|
|
219
|
+
</label>
|
|
220
|
+
`:null}
|
|
221
|
+
<div class="input-wrapper${this.error?" has-error":""}">
|
|
222
|
+
<input
|
|
223
|
+
part="input"
|
|
224
|
+
id="input"
|
|
225
|
+
type=${e}
|
|
226
|
+
name=${this.name}
|
|
227
|
+
.value=${this.value}
|
|
228
|
+
placeholder=${this.placeholder}
|
|
229
|
+
?required=${this.required}
|
|
230
|
+
?disabled=${this.disabled}
|
|
231
|
+
autocomplete=${this.autocomplete||"off"}
|
|
232
|
+
@input=${this.handleInput}
|
|
233
|
+
@change=${this.handleChange}
|
|
234
|
+
/>
|
|
235
|
+
${this.renderPasswordToggle()}
|
|
236
|
+
</div>
|
|
237
|
+
${this.error?d`<div class="error-message">${this.error}</div>`:null}
|
|
238
|
+
</div>
|
|
239
|
+
`}};$.formAssociated=!0,$.styles=v`
|
|
240
|
+
:host {
|
|
241
|
+
display: block;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.field {
|
|
245
|
+
display: flex;
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
gap: 0.375rem;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
label {
|
|
251
|
+
font-size: 0.875rem;
|
|
252
|
+
font-weight: 500;
|
|
253
|
+
color: #374151;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.input-wrapper {
|
|
257
|
+
position: relative;
|
|
258
|
+
display: flex;
|
|
259
|
+
align-items: center;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* Base input styles - use .input-wrapper for higher specificity */
|
|
263
|
+
.input-wrapper input {
|
|
264
|
+
width: 100%;
|
|
265
|
+
padding: 0.625rem 0.75rem;
|
|
266
|
+
font-size: 0.875rem;
|
|
267
|
+
font-family: inherit;
|
|
268
|
+
color: #111827;
|
|
269
|
+
background-color: white;
|
|
270
|
+
border: 1px solid #d1d5db;
|
|
271
|
+
border-radius: 0.5rem;
|
|
272
|
+
outline: none;
|
|
273
|
+
box-shadow: none;
|
|
274
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.input-wrapper input:focus {
|
|
278
|
+
border-color: var(--consent-primary, #2563eb);
|
|
279
|
+
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.input-wrapper input:disabled {
|
|
283
|
+
background-color: #f9fafb;
|
|
284
|
+
cursor: not-allowed;
|
|
285
|
+
opacity: 0.6;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.input-wrapper input::placeholder {
|
|
289
|
+
color: #9ca3af;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* Prevent browser validation styling before user interaction */
|
|
293
|
+
.input-wrapper input:invalid {
|
|
294
|
+
border-color: #d1d5db;
|
|
295
|
+
box-shadow: none;
|
|
296
|
+
outline: none;
|
|
297
|
+
background-color: white;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* Override browser autofill styling */
|
|
301
|
+
.input-wrapper input:-webkit-autofill,
|
|
302
|
+
.input-wrapper input:-webkit-autofill:hover,
|
|
303
|
+
.input-wrapper input:-webkit-autofill:focus {
|
|
304
|
+
-webkit-box-shadow: 0 0 0 1000px white inset;
|
|
305
|
+
-webkit-text-fill-color: #111827;
|
|
306
|
+
border-color: #d1d5db;
|
|
307
|
+
transition: background-color 5000s ease-in-out 0s;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* Only show validation styling after user interaction */
|
|
311
|
+
.input-wrapper input:user-invalid {
|
|
312
|
+
border-color: #ef4444;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.input-wrapper input:user-invalid:focus {
|
|
316
|
+
border-color: #ef4444;
|
|
317
|
+
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/* Password toggle */
|
|
321
|
+
.input-wrapper input[type='password'] {
|
|
322
|
+
padding-right: 2.5rem;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.password-toggle {
|
|
326
|
+
position: absolute;
|
|
327
|
+
right: 0.5rem;
|
|
328
|
+
padding: 0.375rem;
|
|
329
|
+
background: none;
|
|
330
|
+
border: none;
|
|
331
|
+
cursor: pointer;
|
|
332
|
+
color: #6b7280;
|
|
333
|
+
display: flex;
|
|
334
|
+
align-items: center;
|
|
335
|
+
justify-content: center;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.password-toggle:hover {
|
|
339
|
+
color: #374151;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.password-toggle svg {
|
|
343
|
+
width: 1.25rem;
|
|
344
|
+
height: 1.25rem;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* Error state - use class instead of attribute for proper specificity */
|
|
348
|
+
.input-wrapper.has-error input {
|
|
349
|
+
border-color: #ef4444;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.input-wrapper.has-error input:focus {
|
|
353
|
+
border-color: #ef4444;
|
|
354
|
+
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.error-message {
|
|
358
|
+
font-size: 0.75rem;
|
|
359
|
+
color: #ef4444;
|
|
360
|
+
margin-top: 0.25rem;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* Required indicator */
|
|
364
|
+
.required {
|
|
365
|
+
color: #ef4444;
|
|
366
|
+
margin-left: 0.125rem;
|
|
367
|
+
}
|
|
368
|
+
`,n([l({type:String})],$.prototype,"type",2),n([l({type:String})],$.prototype,"name",2),n([l({type:String})],$.prototype,"value",2),n([l({type:String})],$.prototype,"label",2),n([l({type:String})],$.prototype,"placeholder",2),n([l({type:Boolean})],$.prototype,"required",2),n([l({type:Boolean,reflect:!0})],$.prototype,"disabled",2),n([l({type:String})],$.prototype,"autocomplete",2),n([l({type:String})],$.prototype,"error",2),n([x()],$.prototype,"showPassword",2),$=n([y("consent-input")],$);var U=class extends g{constructor(){super(...arguments);this.pageTitle="Permission Request";this.primaryColor="#2563EB";this.secondaryColor="#DBEAFE"}renderLogo(){return this.logoUrl?d`
|
|
369
|
+
<img
|
|
370
|
+
class="logo"
|
|
371
|
+
src=${this.logoUrl}
|
|
372
|
+
alt=${this.companyName||"Company logo"}
|
|
373
|
+
/>
|
|
374
|
+
`:d`
|
|
375
|
+
<div class="default-icon">
|
|
376
|
+
<svg
|
|
377
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
378
|
+
viewBox="0 0 24 24"
|
|
379
|
+
fill="none"
|
|
380
|
+
stroke="currentColor"
|
|
381
|
+
stroke-width="2"
|
|
382
|
+
stroke-linecap="round"
|
|
383
|
+
stroke-linejoin="round"
|
|
384
|
+
>
|
|
385
|
+
<path
|
|
386
|
+
d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"
|
|
387
|
+
fill="currentColor"
|
|
388
|
+
opacity="0.2"
|
|
389
|
+
/>
|
|
390
|
+
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
|
|
391
|
+
</svg>
|
|
392
|
+
</div>
|
|
393
|
+
`}updated(e){(e.has("primaryColor")||e.has("secondaryColor"))&&(this.style.setProperty("--consent-primary",this.primaryColor),this.style.setProperty("--consent-secondary",this.secondaryColor))}render(){return d`
|
|
394
|
+
<div class="container" part="container">
|
|
395
|
+
<header class="header" part="header">
|
|
396
|
+
${this.renderLogo()}
|
|
397
|
+
${this.companyName?d`<div class="company-name">${this.companyName}</div>`:null}
|
|
398
|
+
<h1 class="title">${this.pageTitle}</h1>
|
|
399
|
+
</header>
|
|
400
|
+
|
|
401
|
+
<div class="content" part="content">
|
|
402
|
+
<slot name="content"></slot>
|
|
403
|
+
</div>
|
|
404
|
+
|
|
405
|
+
<footer class="footer" part="footer">
|
|
406
|
+
<slot name="footer"></slot>
|
|
407
|
+
</footer>
|
|
408
|
+
</div>
|
|
409
|
+
`}};U.styles=v`
|
|
410
|
+
:host {
|
|
411
|
+
display: block;
|
|
412
|
+
/* System font stack with font smoothing for crisp text */
|
|
413
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
414
|
+
'Helvetica Neue', Arial, sans-serif;
|
|
415
|
+
-webkit-font-smoothing: antialiased;
|
|
416
|
+
-moz-osx-font-smoothing: grayscale;
|
|
417
|
+
/* Allow customization via CSS variables */
|
|
418
|
+
--_primary: var(--consent-primary, #2563eb);
|
|
419
|
+
--_secondary: var(--consent-secondary, #dbeafe);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/* Container - matches AgentShield PreviewShell exactly */
|
|
423
|
+
.container {
|
|
424
|
+
background: white;
|
|
425
|
+
border-radius: 20px;
|
|
426
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
427
|
+
box-shadow:
|
|
428
|
+
0 20px 25px -5px rgba(0, 0, 0, 0.1),
|
|
429
|
+
0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
|
430
|
+
overflow: hidden;
|
|
431
|
+
max-width: 512px;
|
|
432
|
+
width: 100%;
|
|
433
|
+
margin: 0 auto;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/* Header */
|
|
437
|
+
.header {
|
|
438
|
+
padding: 1.25rem 2rem 0;
|
|
439
|
+
text-align: center;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.logo {
|
|
443
|
+
max-height: 48px;
|
|
444
|
+
max-width: 200px;
|
|
445
|
+
margin-bottom: 0.5rem;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.company-name {
|
|
449
|
+
font-size: 0.875rem;
|
|
450
|
+
color: #6b7280;
|
|
451
|
+
margin-bottom: 0.5rem;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.title {
|
|
455
|
+
font-size: 1.5rem;
|
|
456
|
+
font-weight: 700;
|
|
457
|
+
color: #333333;
|
|
458
|
+
margin: 0;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/* Content */
|
|
462
|
+
.content {
|
|
463
|
+
padding: 1rem 2rem 2rem;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/* Footer */
|
|
467
|
+
.footer {
|
|
468
|
+
padding: 0 2rem 2rem;
|
|
469
|
+
display: flex;
|
|
470
|
+
gap: 0.75rem;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.footer ::slotted(*) {
|
|
474
|
+
flex: 1;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/* Default icon when no logo */
|
|
478
|
+
.default-icon {
|
|
479
|
+
width: 48px;
|
|
480
|
+
height: 48px;
|
|
481
|
+
margin: 0 auto 0.5rem;
|
|
482
|
+
background: var(--_secondary);
|
|
483
|
+
border-radius: 12px;
|
|
484
|
+
display: flex;
|
|
485
|
+
align-items: center;
|
|
486
|
+
justify-content: center;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.default-icon svg {
|
|
490
|
+
width: 24px;
|
|
491
|
+
height: 24px;
|
|
492
|
+
color: var(--_primary);
|
|
493
|
+
}
|
|
494
|
+
`,n([l({type:String,attribute:"page-title"})],U.prototype,"pageTitle",2),n([l({type:String,attribute:"logo-url"})],U.prototype,"logoUrl",2),n([l({type:String,attribute:"company-name"})],U.prototype,"companyName",2),n([l({type:String,attribute:"primary-color"})],U.prototype,"primaryColor",2),n([l({type:String,attribute:"secondary-color"})],U.prototype,"secondaryColor",2),U=n([y("consent-shell")],U);var I=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
|
+
<div class="icon icon-shield">
|
|
496
|
+
<svg
|
|
497
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
498
|
+
viewBox="0 0 24 24"
|
|
499
|
+
fill="none"
|
|
500
|
+
stroke="currentColor"
|
|
501
|
+
stroke-width="2"
|
|
502
|
+
>
|
|
503
|
+
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
|
|
504
|
+
</svg>
|
|
505
|
+
</div>
|
|
506
|
+
`;default:return d`
|
|
507
|
+
<div class="icon icon-check">
|
|
508
|
+
<svg
|
|
509
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
510
|
+
viewBox="0 0 24 24"
|
|
511
|
+
fill="none"
|
|
512
|
+
stroke="currentColor"
|
|
513
|
+
stroke-width="2"
|
|
514
|
+
>
|
|
515
|
+
<polyline points="20 6 9 17 4 12" />
|
|
516
|
+
</svg>
|
|
517
|
+
</div>
|
|
518
|
+
`}}renderPermissionItem(e){let r=this.selectedScopes.has(e.id);return d`
|
|
519
|
+
<li class="permission-item" part="item">
|
|
520
|
+
${this.interactive?d`
|
|
521
|
+
<input
|
|
522
|
+
type="checkbox"
|
|
523
|
+
class="checkbox"
|
|
524
|
+
.checked=${r}
|
|
525
|
+
?disabled=${e.required}
|
|
526
|
+
@change=${s=>this.handleCheckboxChange(e.id,s.target.checked)}
|
|
527
|
+
aria-label=${e.label}
|
|
528
|
+
/>
|
|
529
|
+
`:this.renderIcon()}
|
|
530
|
+
<div class="content">
|
|
531
|
+
<span class="label">
|
|
532
|
+
${e.label}
|
|
533
|
+
${e.required?d`<span class="required-badge">Required</span>`:null}
|
|
534
|
+
</span>
|
|
535
|
+
${e.description?d`<div class="description">${e.description}</div>`:null}
|
|
536
|
+
</div>
|
|
537
|
+
</li>
|
|
538
|
+
`}render(){let e=this.normalizedScopes;return e.length===0?d`<div class="empty">No permissions requested</div>`:d`
|
|
539
|
+
<ul class="permission-list" part="list" role="list">
|
|
540
|
+
${e.map(r=>this.renderPermissionItem(r))}
|
|
541
|
+
</ul>
|
|
542
|
+
`}};I.styles=v`
|
|
543
|
+
:host {
|
|
544
|
+
display: block;
|
|
545
|
+
--_primary: var(--consent-primary, #2563eb);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.permission-list {
|
|
549
|
+
list-style: none;
|
|
550
|
+
padding: 0;
|
|
551
|
+
margin: 0;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.permission-item {
|
|
555
|
+
display: flex;
|
|
556
|
+
align-items: flex-start;
|
|
557
|
+
gap: 0.75rem;
|
|
558
|
+
padding: 0.625rem 0;
|
|
559
|
+
font-size: 0.875rem;
|
|
560
|
+
color: #374151;
|
|
561
|
+
border-bottom: 1px solid #f3f4f6;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.permission-item:last-child {
|
|
565
|
+
border-bottom: none;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/* Icon styles */
|
|
569
|
+
.icon {
|
|
570
|
+
flex-shrink: 0;
|
|
571
|
+
width: 1.25rem;
|
|
572
|
+
height: 1.25rem;
|
|
573
|
+
margin-top: 0.0625rem;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.icon-check {
|
|
577
|
+
background: var(--_primary);
|
|
578
|
+
border-radius: 0.25rem;
|
|
579
|
+
display: flex;
|
|
580
|
+
align-items: center;
|
|
581
|
+
justify-content: center;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.icon-check svg {
|
|
585
|
+
width: 0.75rem;
|
|
586
|
+
height: 0.75rem;
|
|
587
|
+
color: white;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.icon-bullet {
|
|
591
|
+
background: var(--_primary);
|
|
592
|
+
border-radius: 50%;
|
|
593
|
+
width: 0.5rem;
|
|
594
|
+
height: 0.5rem;
|
|
595
|
+
margin: 0.375rem;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
.icon-shield {
|
|
599
|
+
color: var(--_primary);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.icon-shield svg {
|
|
603
|
+
width: 1.25rem;
|
|
604
|
+
height: 1.25rem;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/* Content */
|
|
608
|
+
.content {
|
|
609
|
+
flex: 1;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.label {
|
|
613
|
+
font-weight: 500;
|
|
614
|
+
color: #111827;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.description {
|
|
618
|
+
font-size: 0.75rem;
|
|
619
|
+
color: #6b7280;
|
|
620
|
+
margin-top: 0.125rem;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.required-badge {
|
|
624
|
+
font-size: 0.625rem;
|
|
625
|
+
text-transform: uppercase;
|
|
626
|
+
letter-spacing: 0.05em;
|
|
627
|
+
color: #6b7280;
|
|
628
|
+
background: #f3f4f6;
|
|
629
|
+
padding: 0.125rem 0.375rem;
|
|
630
|
+
border-radius: 0.25rem;
|
|
631
|
+
margin-left: 0.5rem;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/* Interactive mode checkbox */
|
|
635
|
+
.checkbox {
|
|
636
|
+
appearance: none;
|
|
637
|
+
-webkit-appearance: none;
|
|
638
|
+
width: 1rem;
|
|
639
|
+
height: 1rem;
|
|
640
|
+
border: 1px solid #d1d5db;
|
|
641
|
+
border-radius: 0.25rem;
|
|
642
|
+
background: white;
|
|
643
|
+
cursor: pointer;
|
|
644
|
+
position: relative;
|
|
645
|
+
flex-shrink: 0;
|
|
646
|
+
margin-top: 0.125rem;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.checkbox:checked {
|
|
650
|
+
background: var(--_primary);
|
|
651
|
+
border-color: var(--_primary);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
.checkbox:checked::after {
|
|
655
|
+
content: '';
|
|
656
|
+
position: absolute;
|
|
657
|
+
left: 4px;
|
|
658
|
+
top: 1px;
|
|
659
|
+
width: 5px;
|
|
660
|
+
height: 9px;
|
|
661
|
+
border: solid white;
|
|
662
|
+
border-width: 0 2px 2px 0;
|
|
663
|
+
transform: rotate(45deg);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.checkbox:disabled {
|
|
667
|
+
opacity: 0.5;
|
|
668
|
+
cursor: not-allowed;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
.checkbox:focus-visible {
|
|
672
|
+
outline: 2px solid var(--_primary);
|
|
673
|
+
outline-offset: 2px;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/* Empty state */
|
|
677
|
+
.empty {
|
|
678
|
+
text-align: center;
|
|
679
|
+
color: #6b7280;
|
|
680
|
+
font-size: 0.875rem;
|
|
681
|
+
padding: 1rem 0;
|
|
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)}})],I.prototype,"scopes",2),n([l({type:Boolean})],I.prototype,"interactive",2),n([l({type:Boolean,attribute:"select-all"})],I.prototype,"selectAll",2),n([l({type:String,attribute:"icon-style"})],I.prototype,"iconStyle",2),n([x()],I.prototype,"selectedScopes",2),I=n([y("consent-permissions")],I);var w=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
|
+
href=${r}
|
|
685
|
+
target="_blank"
|
|
686
|
+
rel="noopener noreferrer"
|
|
687
|
+
part="link"
|
|
688
|
+
@click=${s=>s.stopPropagation()}
|
|
689
|
+
>${e}</a
|
|
690
|
+
>`:d`<span>${e}</span>`}render(){let e=this.privacyText&&this.privacyUrl;return d`
|
|
691
|
+
<label part="label">
|
|
692
|
+
<input
|
|
693
|
+
part="checkbox"
|
|
694
|
+
type="checkbox"
|
|
695
|
+
name=${this.name}
|
|
696
|
+
.value=${this.value}
|
|
697
|
+
.checked=${this.checked}
|
|
698
|
+
?required=${this.required}
|
|
699
|
+
?disabled=${this.disabled}
|
|
700
|
+
@change=${this.handleChange}
|
|
701
|
+
/>
|
|
702
|
+
<span class="text">
|
|
703
|
+
${this.labelPrefix} ${this.renderLink(this.text,this.url)}
|
|
704
|
+
${e?d`
|
|
705
|
+
${this.conjunction}
|
|
706
|
+
${this.renderLink(this.privacyText,this.privacyUrl)}
|
|
707
|
+
`:u}
|
|
708
|
+
${this.required?d`<span class="required">*</span>`:u}
|
|
709
|
+
</span>
|
|
710
|
+
</label>
|
|
711
|
+
`}};w.formAssociated=!0,w.styles=v`
|
|
712
|
+
:host {
|
|
713
|
+
display: block;
|
|
714
|
+
--_primary: var(--consent-primary, #2563eb);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
label {
|
|
718
|
+
display: flex;
|
|
719
|
+
align-items: flex-start;
|
|
720
|
+
gap: 0.75rem;
|
|
721
|
+
cursor: pointer;
|
|
722
|
+
font-size: 0.875rem;
|
|
723
|
+
color: #374151;
|
|
724
|
+
line-height: 1.5;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
:host([disabled]) label {
|
|
728
|
+
cursor: not-allowed;
|
|
729
|
+
opacity: 0.6;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/* Custom checkbox styling - matches AgentShield exactly */
|
|
733
|
+
input[type='checkbox'] {
|
|
734
|
+
appearance: none;
|
|
735
|
+
-webkit-appearance: none;
|
|
736
|
+
margin: 0;
|
|
737
|
+
|
|
738
|
+
/* Size - matches AgentShield w-4 h-4 */
|
|
739
|
+
width: 1rem;
|
|
740
|
+
height: 1rem;
|
|
741
|
+
min-width: 1rem;
|
|
742
|
+
margin-top: 0.125rem;
|
|
743
|
+
|
|
744
|
+
/* Border */
|
|
745
|
+
border: 1px solid #d1d5db;
|
|
746
|
+
border-radius: 0.25rem;
|
|
747
|
+
|
|
748
|
+
/* Background */
|
|
749
|
+
background-color: white;
|
|
750
|
+
|
|
751
|
+
/* Interaction */
|
|
752
|
+
cursor: pointer;
|
|
753
|
+
position: relative;
|
|
754
|
+
transition: background-color 0.15s ease, border-color 0.15s ease;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
input[type='checkbox']:hover:not(:disabled) {
|
|
758
|
+
border-color: var(--_primary);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
input[type='checkbox']:focus-visible {
|
|
762
|
+
outline: 2px solid var(--_primary);
|
|
763
|
+
outline-offset: 2px;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/* Checked state */
|
|
767
|
+
input[type='checkbox']:checked {
|
|
768
|
+
background-color: var(--_primary);
|
|
769
|
+
border-color: var(--_primary);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/* Checkmark */
|
|
773
|
+
input[type='checkbox']:checked::after {
|
|
774
|
+
content: '';
|
|
775
|
+
position: absolute;
|
|
776
|
+
left: 4px;
|
|
777
|
+
top: 1px;
|
|
778
|
+
width: 5px;
|
|
779
|
+
height: 9px;
|
|
780
|
+
border: solid white;
|
|
781
|
+
border-width: 0 2px 2px 0;
|
|
782
|
+
transform: rotate(45deg);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/* Disabled */
|
|
786
|
+
input[type='checkbox']:disabled {
|
|
787
|
+
cursor: not-allowed;
|
|
788
|
+
opacity: 0.5;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/* Text wrapper */
|
|
792
|
+
.text {
|
|
793
|
+
flex: 1;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/* Links */
|
|
797
|
+
a {
|
|
798
|
+
color: var(--_primary);
|
|
799
|
+
text-decoration: underline;
|
|
800
|
+
text-underline-offset: 2px;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
a:hover {
|
|
804
|
+
text-decoration: none;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
a:focus-visible {
|
|
808
|
+
outline: 2px solid var(--_primary);
|
|
809
|
+
outline-offset: 2px;
|
|
810
|
+
border-radius: 2px;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/* Required indicator */
|
|
814
|
+
.required {
|
|
815
|
+
color: #ef4444;
|
|
816
|
+
margin-left: 0.125rem;
|
|
817
|
+
}
|
|
818
|
+
`,n([l({type:String})],w.prototype,"name",2),n([l({type:String})],w.prototype,"text",2),n([l({type:String})],w.prototype,"url",2),n([l({type:String,attribute:"privacy-text"})],w.prototype,"privacyText",2),n([l({type:String,attribute:"privacy-url"})],w.prototype,"privacyUrl",2),n([l({type:String,attribute:"label-prefix"})],w.prototype,"labelPrefix",2),n([l({type:String})],w.prototype,"conjunction",2),n([l({type:Boolean,reflect:!0})],w.prototype,"checked",2),n([l({type:Boolean})],w.prototype,"required",2),n([l({type:Boolean,reflect:!0})],w.prototype,"disabled",2),n([l({type:String})],w.prototype,"value",2),w=n([y("consent-terms")],w);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"}},A=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`
|
|
819
|
+
<div class="icon">
|
|
820
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
821
|
+
<path
|
|
822
|
+
fill="#4285F4"
|
|
823
|
+
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
824
|
+
/>
|
|
825
|
+
<path
|
|
826
|
+
fill="#34A853"
|
|
827
|
+
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
828
|
+
/>
|
|
829
|
+
<path
|
|
830
|
+
fill="#FBBC05"
|
|
831
|
+
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
832
|
+
/>
|
|
833
|
+
<path
|
|
834
|
+
fill="#EA4335"
|
|
835
|
+
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
836
|
+
/>
|
|
837
|
+
</svg>
|
|
838
|
+
</div>
|
|
839
|
+
`;case"microsoft":return d`
|
|
840
|
+
<div class="icon">
|
|
841
|
+
<svg viewBox="0 0 21 21" xmlns="http://www.w3.org/2000/svg">
|
|
842
|
+
<rect x="1" y="1" width="9" height="9" fill="#f25022" />
|
|
843
|
+
<rect x="1" y="11" width="9" height="9" fill="#00a4ef" />
|
|
844
|
+
<rect x="11" y="1" width="9" height="9" fill="#7fba00" />
|
|
845
|
+
<rect x="11" y="11" width="9" height="9" fill="#ffb900" />
|
|
846
|
+
</svg>
|
|
847
|
+
</div>
|
|
848
|
+
`;case"apple":return d`
|
|
849
|
+
<div class="icon">
|
|
850
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
851
|
+
<path
|
|
852
|
+
fill="currentColor"
|
|
853
|
+
d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"
|
|
854
|
+
/>
|
|
855
|
+
</svg>
|
|
856
|
+
</div>
|
|
857
|
+
`;case"github":return d`
|
|
858
|
+
<div class="icon">
|
|
859
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
860
|
+
<path
|
|
861
|
+
fill="currentColor"
|
|
862
|
+
d="M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.17 6.839 9.49.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.464-1.11-1.464-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.831.092-.646.35-1.086.636-1.336-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836c.85.004 1.705.114 2.504.336 1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.167 22 16.418 22 12c0-5.523-4.477-10-10-10z"
|
|
863
|
+
/>
|
|
864
|
+
</svg>
|
|
865
|
+
</div>
|
|
866
|
+
`;case"twitter":return d`
|
|
867
|
+
<div class="icon">
|
|
868
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
869
|
+
<path
|
|
870
|
+
fill="currentColor"
|
|
871
|
+
d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
|
|
872
|
+
/>
|
|
873
|
+
</svg>
|
|
874
|
+
</div>
|
|
875
|
+
`;case"facebook":return d`
|
|
876
|
+
<div class="icon">
|
|
877
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
878
|
+
<path
|
|
879
|
+
fill="currentColor"
|
|
880
|
+
d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"
|
|
881
|
+
/>
|
|
882
|
+
</svg>
|
|
883
|
+
</div>
|
|
884
|
+
`;default:return u}}updated(e){if(e.has("provider")){let r=this.config;this.style.setProperty("--button-bg",r.bgColor),this.style.setProperty("--button-text",r.textColor),this.style.setProperty("--button-border",r.borderColor),this.style.setProperty("--button-hover-bg",r.hoverBgColor)}}render(){let e=this.loading||this.redirecting;return d`
|
|
885
|
+
<button
|
|
886
|
+
part="button"
|
|
887
|
+
type="button"
|
|
888
|
+
?disabled=${this.disabled||e}
|
|
889
|
+
@click=${this.handleClick}
|
|
890
|
+
style="
|
|
891
|
+
background-color: var(--button-bg, ${this.config.bgColor});
|
|
892
|
+
color: var(--button-text, ${this.config.textColor});
|
|
893
|
+
border: 1px solid var(--button-border, ${this.config.borderColor});
|
|
894
|
+
"
|
|
895
|
+
aria-busy=${e}
|
|
896
|
+
>
|
|
897
|
+
${e?d`<span class="spinner"></span>`:this.renderProviderIcon()}
|
|
898
|
+
<span class="text" part="text">${this.displayText}</span>
|
|
899
|
+
</button>
|
|
900
|
+
`}};A.styles=v`
|
|
901
|
+
:host {
|
|
902
|
+
display: inline-block;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
:host([full-width]) {
|
|
906
|
+
display: block;
|
|
907
|
+
width: 100%;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
button {
|
|
911
|
+
width: 100%;
|
|
912
|
+
padding: 0.75rem 1rem;
|
|
913
|
+
height: 2.75rem;
|
|
914
|
+
border-radius: 0.5rem;
|
|
915
|
+
font-size: 0.875rem;
|
|
916
|
+
font-weight: 500;
|
|
917
|
+
font-family: inherit;
|
|
918
|
+
cursor: pointer;
|
|
919
|
+
transition: background-color 0.15s ease, opacity 0.15s ease;
|
|
920
|
+
display: inline-flex;
|
|
921
|
+
align-items: center;
|
|
922
|
+
justify-content: center;
|
|
923
|
+
gap: 0.75rem;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
button:disabled {
|
|
927
|
+
opacity: 0.5;
|
|
928
|
+
cursor: not-allowed;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
button:focus-visible {
|
|
932
|
+
outline: 2px solid #2563eb;
|
|
933
|
+
outline-offset: 2px;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
.icon {
|
|
937
|
+
width: 1.125rem;
|
|
938
|
+
height: 1.125rem;
|
|
939
|
+
flex-shrink: 0;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
.icon svg {
|
|
943
|
+
width: 100%;
|
|
944
|
+
height: 100%;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/* Loading spinner */
|
|
948
|
+
.spinner {
|
|
949
|
+
width: 1rem;
|
|
950
|
+
height: 1rem;
|
|
951
|
+
border: 2px solid currentColor;
|
|
952
|
+
border-top-color: transparent;
|
|
953
|
+
border-radius: 50%;
|
|
954
|
+
animation: spin 0.8s linear infinite;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
@keyframes spin {
|
|
958
|
+
to {
|
|
959
|
+
transform: rotate(360deg);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
.text {
|
|
964
|
+
flex: 1;
|
|
965
|
+
text-align: center;
|
|
966
|
+
}
|
|
967
|
+
`,n([l({type:String})],A.prototype,"provider",2),n([l({type:String,attribute:"provider-name"})],A.prototype,"providerName",2),n([l({type:String})],A.prototype,"url",2),n([l({type:String,attribute:"button-text"})],A.prototype,"buttonText",2),n([l({type:Boolean,reflect:!0})],A.prototype,"loading",2),n([l({type:Boolean,reflect:!0})],A.prototype,"disabled",2),n([l({type:Boolean,attribute:"full-width"})],A.prototype,"fullWidth",2),n([l({type:String,attribute:"custom-icon"})],A.prototype,"customIcon",2),n([x()],A.prototype,"redirecting",2),A=n([y("consent-oauth-button")],A);var E=class extends g{constructor(){super();this.length=6;this.name="otp";this.value="";this.disabled=!1;this.error=!1;this.autoFocus=!1;this.inputType="text";this.digits=[];this.internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.initializeDigits()}initializeDigits(){this.digits=Array.from({length:this.length},()=>""),this.value&&this.value.replace(/\D/g,"").slice(0,this.length).split("").forEach((s,o)=>{this.digits[o]=s})}firstUpdated(){this.autoFocus&&this.inputs.length>0&&this.inputs[0]?.focus()}updated(e){e.has("value")&&!e.has("digits")&&this.initializeDigits(),e.has("length")&&this.initializeDigits();let r=this.digits.join("");this.internals.setFormValue(r||null)}getFullValue(){return this.digits.join("")}handleInput(e,r){let s=r.target,o=s.value;if(o.length>1&&(o=o.slice(-1)),o&&!/^\d$/.test(o)){s.value=this.digits[e]??"";return}this.digits[e]=o,this.digits=[...this.digits],s.value=o;let a=this.getFullValue();this.value=a,this.dispatchEvent(new CustomEvent("input",{detail:{value:a,index:e,digit:o},bubbles:!0,composed:!0})),o&&e<this.length-1&&this.inputs[e+1]?.focus(),a.length===this.length&&this.dispatchEvent(new CustomEvent("complete",{detail:{value:a},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:a},bubbles:!0,composed:!0}))}handleKeyDown(e,r){switch(r.key){case"Backspace":!this.digits[e]&&e>0?(r.preventDefault(),this.inputs[e-1]?.focus(),this.digits[e-1]="",this.digits=[...this.digits]):(this.digits[e]="",this.digits=[...this.digits]),this.value=this.getFullValue();break;case"ArrowLeft":r.preventDefault(),e>0&&this.inputs[e-1]?.focus();break;case"ArrowRight":r.preventDefault(),e<this.length-1&&this.inputs[e+1]?.focus();break;case"Delete":this.digits[e]="",this.digits=[...this.digits],this.value=this.getFullValue();break}}handlePaste(e){e.preventDefault();let s=(e.clipboardData?.getData("text")||"").replace(/\D/g,"").slice(0,this.length);if(s){this.digits=Array.from({length:this.length},(a,p)=>s[p]||""),this.value=this.getFullValue(),this.requestUpdate();let o=Math.min(s.length,this.length-1);setTimeout(()=>{this.inputs[o]?.focus()},0),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value,index:0,digit:s[0]||""},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})),s.length===this.length&&this.dispatchEvent(new CustomEvent("complete",{detail:{value:this.value},bubbles:!0,composed:!0}))}}handleFocus(e){e.target.select()}focus(){let e=this.digits.findIndex(s=>!s),r=e>=0?e:this.length-1;this.inputs[r]?.focus()}clear(){this.digits=Array.from({length:this.length},()=>""),this.value="",this.inputs[0]?.focus()}renderDigitInput(e){let r=this.digits[e]||"",s=r!=="";return d`
|
|
968
|
+
<input
|
|
969
|
+
part="input"
|
|
970
|
+
type=${this.inputType}
|
|
971
|
+
inputmode="numeric"
|
|
972
|
+
pattern="[0-9]*"
|
|
973
|
+
maxlength="1"
|
|
974
|
+
.value=${r}
|
|
975
|
+
?disabled=${this.disabled}
|
|
976
|
+
placeholder="○"
|
|
977
|
+
class=${s?"filled":""}
|
|
978
|
+
@input=${o=>this.handleInput(e,o)}
|
|
979
|
+
@keydown=${o=>this.handleKeyDown(e,o)}
|
|
980
|
+
@paste=${this.handlePaste}
|
|
981
|
+
@focus=${this.handleFocus}
|
|
982
|
+
aria-label=${`Digit ${e+1} of ${this.length}`}
|
|
983
|
+
/>
|
|
984
|
+
`}render(){return d`
|
|
985
|
+
<div class="container" part="container" role="group" aria-label="One-time password input">
|
|
986
|
+
${Array.from({length:this.length},(e,r)=>this.renderDigitInput(r))}
|
|
987
|
+
</div>
|
|
988
|
+
`}};E.formAssociated=!0,E.styles=v`
|
|
989
|
+
:host {
|
|
990
|
+
display: block;
|
|
991
|
+
--_primary: var(--consent-primary, #2563eb);
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
.container {
|
|
995
|
+
display: flex;
|
|
996
|
+
gap: 0.5rem;
|
|
997
|
+
justify-content: center;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
input {
|
|
1001
|
+
width: 2.75rem;
|
|
1002
|
+
height: 3.5rem;
|
|
1003
|
+
text-align: center;
|
|
1004
|
+
font-size: 1.5rem;
|
|
1005
|
+
font-weight: 600;
|
|
1006
|
+
font-family: inherit;
|
|
1007
|
+
color: #111827;
|
|
1008
|
+
background: white;
|
|
1009
|
+
border: 1px solid #d1d5db;
|
|
1010
|
+
border-radius: 0.5rem;
|
|
1011
|
+
outline: none;
|
|
1012
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
1013
|
+
|
|
1014
|
+
/* Hide spinner for number inputs */
|
|
1015
|
+
-moz-appearance: textfield;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
input::-webkit-outer-spin-button,
|
|
1019
|
+
input::-webkit-inner-spin-button {
|
|
1020
|
+
-webkit-appearance: none;
|
|
1021
|
+
margin: 0;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
input:focus {
|
|
1025
|
+
border-color: var(--_primary);
|
|
1026
|
+
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
input:disabled {
|
|
1030
|
+
background: #f9fafb;
|
|
1031
|
+
cursor: not-allowed;
|
|
1032
|
+
opacity: 0.6;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
input::placeholder {
|
|
1036
|
+
color: #d1d5db;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/* Error state */
|
|
1040
|
+
:host([error]) input {
|
|
1041
|
+
border-color: #ef4444;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
:host([error]) input:focus {
|
|
1045
|
+
border-color: #ef4444;
|
|
1046
|
+
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/* Filled state */
|
|
1050
|
+
input.filled {
|
|
1051
|
+
border-color: var(--_primary);
|
|
1052
|
+
background: #f0f9ff;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/* Responsive: smaller on mobile */
|
|
1056
|
+
@media (max-width: 400px) {
|
|
1057
|
+
input {
|
|
1058
|
+
width: 2.25rem;
|
|
1059
|
+
height: 3rem;
|
|
1060
|
+
font-size: 1.25rem;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
.container {
|
|
1064
|
+
gap: 0.375rem;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
`,n([l({type:Number})],E.prototype,"length",2),n([l({type:String})],E.prototype,"name",2),n([l({type:String})],E.prototype,"value",2),n([l({type:Boolean,reflect:!0})],E.prototype,"disabled",2),n([l({type:Boolean,reflect:!0})],E.prototype,"error",2),n([l({type:Boolean,attribute:"auto-focus"})],E.prototype,"autoFocus",2),n([l({type:String,attribute:"input-type"})],E.prototype,"inputType",2),n([x()],E.prototype,"digits",2),n([Be("input")],E.prototype,"inputs",2),E=n([y("consent-otp-input")],E);var S={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},C={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??C.title,a=e.description??C.description,p=e.expirationText??C.expirationText,c=e.cancelButtonText??C.cancelButtonText,f=e.submitButtonText??C.submitButtonText,b=e.permissionsHeader??C.permissionsHeader,h=r.text??Y.text,T=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:b,termsText:h,termsUrl:r.url,termsRequired:r.required??Y.required,resolvedDescription:q,successTitle:T,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?S.OAUTH:i?.credentials?.usernameLabel||i?.credentials?.passwordLabel?S.CREDENTIALS:i?.magicLink?.enabled?S.MAGIC_LINK:i?.otp?.enabled?S.OTP:S.CONSENT_ONLY}function Ct(i){return{title:i?.title??C.title,description:i?.description??C.description,expirationText:i?.expirationText??C.expirationText,cancelButtonText:i?.cancelButtonText??C.cancelButtonText,submitButtonText:i?.submitButtonText??C.submitButtonText,permissionsHeader:i?.permissionsHeader??C.permissionsHeader,autoClose:i?.autoClose??C.autoClose,popupEnabled:i?.popupEnabled??C.popupEnabled,theme:i?.theme??C.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=S.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)??S.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))}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.oauthIdentity?.provider??"none"),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`
|
|
1068
|
+
<div class="agent-info">
|
|
1069
|
+
<div class="agent-icon">
|
|
1070
|
+
<svg
|
|
1071
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1072
|
+
viewBox="0 0 24 24"
|
|
1073
|
+
fill="none"
|
|
1074
|
+
stroke="currentColor"
|
|
1075
|
+
stroke-width="2"
|
|
1076
|
+
>
|
|
1077
|
+
<circle cx="12" cy="12" r="10" />
|
|
1078
|
+
<path d="M12 16v-4M12 8h.01" />
|
|
1079
|
+
</svg>
|
|
1080
|
+
</div>
|
|
1081
|
+
<div class="agent-text">
|
|
1082
|
+
<p>
|
|
1083
|
+
<strong>${e}</strong> is requesting permission to
|
|
1084
|
+
${this.tool?d`use the <strong>${this.tool}</strong> tool`:"access your data"}
|
|
1085
|
+
on your behalf.
|
|
1086
|
+
</p>
|
|
1087
|
+
</div>
|
|
1088
|
+
</div>
|
|
1089
|
+
`}handlePermissionsChange(e){this.selectedScopes=e.detail.selected}renderPermissions(){return this.scopes.length===0?u:d`
|
|
1090
|
+
<p class="permissions-header">
|
|
1091
|
+
${this.resolved?.ui.permissionsHeader??"The agent is requesting the following permissions:"}
|
|
1092
|
+
</p>
|
|
1093
|
+
<div class="permissions">
|
|
1094
|
+
<consent-permissions
|
|
1095
|
+
.scopes=${this.scopes}
|
|
1096
|
+
interactive
|
|
1097
|
+
select-all
|
|
1098
|
+
@change=${this.handlePermissionsChange}
|
|
1099
|
+
></consent-permissions>
|
|
1100
|
+
</div>
|
|
1101
|
+
`}renderExpiration(){let e=this.resolved?.expirationDays??7;return d`
|
|
1102
|
+
<p class="expiration">
|
|
1103
|
+
${this.resolved?.ui.expirationText??"This delegation will expire in"}
|
|
1104
|
+
<strong>${e} ${e===1?"day":"days"}</strong>
|
|
1105
|
+
</p>
|
|
1106
|
+
`}renderTerms(){return this.resolved?.terms?d`
|
|
1107
|
+
<div class="terms">
|
|
1108
|
+
<consent-terms
|
|
1109
|
+
name="termsAccepted"
|
|
1110
|
+
text=${this.resolved.terms.text}
|
|
1111
|
+
url=${this.resolved.terms.url??""}
|
|
1112
|
+
?required=${this.resolved.terms.required}
|
|
1113
|
+
@change=${this.handleTermsChange}
|
|
1114
|
+
></consent-terms>
|
|
1115
|
+
</div>
|
|
1116
|
+
`:u}renderError(){return this.error?d`<div class="error-message">${this.error}</div>`:u}renderFooter(){return d`
|
|
1117
|
+
<div slot="footer">
|
|
1118
|
+
<consent-button variant="secondary" @click=${this.handleDeny}>
|
|
1119
|
+
${this.resolved?.ui.cancelButtonText??"Cancel"}
|
|
1120
|
+
</consent-button>
|
|
1121
|
+
<consent-button
|
|
1122
|
+
variant="primary"
|
|
1123
|
+
?loading=${this.loading}
|
|
1124
|
+
?disabled=${this.resolved?.terms.required&&!this.termsAccepted}
|
|
1125
|
+
@click=${this.handleApprove}
|
|
1126
|
+
>
|
|
1127
|
+
${this.resolved?.ui.submitButtonText??"Allow access"}
|
|
1128
|
+
</consent-button>
|
|
1129
|
+
</div>
|
|
1130
|
+
`}renderConsentOnly(){return d`
|
|
1131
|
+
<consent-shell
|
|
1132
|
+
page-title=${this.resolved?.ui.title??"Permission Request"}
|
|
1133
|
+
company-name=${this.resolved?.branding.companyName??""}
|
|
1134
|
+
logo-url=${this.resolved?.branding.logoUrl??""}
|
|
1135
|
+
primary-color=${this.resolved?.branding.primaryColor??"#2563eb"}
|
|
1136
|
+
secondary-color=${this.resolved?.branding.secondaryColor??"#dbeafe"}
|
|
1137
|
+
>
|
|
1138
|
+
<div slot="content">
|
|
1139
|
+
${this.renderError()} ${this.renderAgentInfo()}
|
|
1140
|
+
${this.renderPermissions()} ${this.renderExpiration()}
|
|
1141
|
+
${this.renderTerms()}
|
|
1142
|
+
</div>
|
|
1143
|
+
${this.renderFooter()}
|
|
1144
|
+
</consent-shell>
|
|
1145
|
+
`}renderCredentials(){let e=this.resolved?.credentials;return d`
|
|
1146
|
+
<consent-shell
|
|
1147
|
+
page-title=${this.resolved?.ui.title??"Sign In"}
|
|
1148
|
+
company-name=${this.resolved?.branding.companyName??""}
|
|
1149
|
+
logo-url=${this.resolved?.branding.logoUrl??""}
|
|
1150
|
+
primary-color=${this.resolved?.branding.primaryColor??"#2563eb"}
|
|
1151
|
+
secondary-color=${this.resolved?.branding.secondaryColor??"#dbeafe"}
|
|
1152
|
+
>
|
|
1153
|
+
<div slot="content">
|
|
1154
|
+
${this.renderError()} ${this.renderAgentInfo()}
|
|
1155
|
+
|
|
1156
|
+
<div class="form-fields">
|
|
1157
|
+
<consent-input
|
|
1158
|
+
type="text"
|
|
1159
|
+
name="username"
|
|
1160
|
+
label=${e?.usernameLabel??"Username"}
|
|
1161
|
+
placeholder=${e?.usernamePlaceholder??"Enter your username"}
|
|
1162
|
+
autocomplete="username"
|
|
1163
|
+
required
|
|
1164
|
+
@input=${r=>this.handleInputChange("username",r.detail.value)}
|
|
1165
|
+
></consent-input>
|
|
1166
|
+
|
|
1167
|
+
<consent-input
|
|
1168
|
+
type="password"
|
|
1169
|
+
name="password"
|
|
1170
|
+
label=${e?.passwordLabel??"Password"}
|
|
1171
|
+
placeholder=${e?.passwordPlaceholder??"Enter your password"}
|
|
1172
|
+
autocomplete="current-password"
|
|
1173
|
+
required
|
|
1174
|
+
@input=${r=>this.handleInputChange("password",r.detail.value)}
|
|
1175
|
+
></consent-input>
|
|
1176
|
+
</div>
|
|
1177
|
+
|
|
1178
|
+
${e?.showForgotPassword&&e.forgotPasswordUrl?d`
|
|
1179
|
+
<p style="text-align: right; margin-bottom: 1rem;">
|
|
1180
|
+
<a
|
|
1181
|
+
href=${e.forgotPasswordUrl}
|
|
1182
|
+
style="font-size: 0.75rem; color: var(--_primary);"
|
|
1183
|
+
>
|
|
1184
|
+
Forgot password?
|
|
1185
|
+
</a>
|
|
1186
|
+
</p>
|
|
1187
|
+
`:u}
|
|
1188
|
+
${this.renderPermissions()} ${this.renderExpiration()}
|
|
1189
|
+
${this.renderTerms()}
|
|
1190
|
+
</div>
|
|
1191
|
+
${this.renderFooter()}
|
|
1192
|
+
</consent-shell>
|
|
1193
|
+
`}renderOAuth(){let e=this.resolved?.oauth,r=e?.providerId??"oauth",s=e?.providerName??"OAuth Provider";return d`
|
|
1194
|
+
<consent-shell
|
|
1195
|
+
page-title=${this.resolved?.ui.title??"Sign In"}
|
|
1196
|
+
company-name=${this.resolved?.branding.companyName??""}
|
|
1197
|
+
logo-url=${this.resolved?.branding.logoUrl??""}
|
|
1198
|
+
primary-color=${this.resolved?.branding.primaryColor??"#2563eb"}
|
|
1199
|
+
secondary-color=${this.resolved?.branding.secondaryColor??"#dbeafe"}
|
|
1200
|
+
>
|
|
1201
|
+
<div slot="content">
|
|
1202
|
+
${this.renderError()} ${this.renderAgentInfo()}
|
|
1203
|
+
|
|
1204
|
+
<consent-oauth-button
|
|
1205
|
+
provider=${r}
|
|
1206
|
+
provider-name=${s}
|
|
1207
|
+
url=${`${this.serverUrl}/oauth/${encodeURIComponent(r)}?session_id=${encodeURIComponent(this.sessionId)}`}
|
|
1208
|
+
button-text=${e?.buttonText??`Continue with ${s}`}
|
|
1209
|
+
full-width
|
|
1210
|
+
></consent-oauth-button>
|
|
1211
|
+
|
|
1212
|
+
${this.renderPermissions()}
|
|
1213
|
+
|
|
1214
|
+
<div class="divider">or</div>
|
|
1215
|
+
|
|
1216
|
+
${this.renderExpiration()} ${this.renderTerms()}
|
|
1217
|
+
</div>
|
|
1218
|
+
${this.renderFooter()}
|
|
1219
|
+
</consent-shell>
|
|
1220
|
+
`}renderMagicLink(){let e=this.resolved?.magicLink;return d`
|
|
1221
|
+
<consent-shell
|
|
1222
|
+
page-title=${this.resolved?.ui.title??"Sign In"}
|
|
1223
|
+
company-name=${this.resolved?.branding.companyName??""}
|
|
1224
|
+
logo-url=${this.resolved?.branding.logoUrl??""}
|
|
1225
|
+
primary-color=${this.resolved?.branding.primaryColor??"#2563eb"}
|
|
1226
|
+
secondary-color=${this.resolved?.branding.secondaryColor??"#dbeafe"}
|
|
1227
|
+
>
|
|
1228
|
+
<div slot="content">
|
|
1229
|
+
${this.renderError()} ${this.renderAgentInfo()}
|
|
1230
|
+
|
|
1231
|
+
<div class="form-fields">
|
|
1232
|
+
<consent-input
|
|
1233
|
+
type="email"
|
|
1234
|
+
name="email"
|
|
1235
|
+
label=${e?.emailLabel??"Email"}
|
|
1236
|
+
placeholder=${e?.emailPlaceholder??"Enter your email address"}
|
|
1237
|
+
autocomplete="email"
|
|
1238
|
+
required
|
|
1239
|
+
@input=${r=>this.handleInputChange("email",r.detail.value)}
|
|
1240
|
+
></consent-input>
|
|
1241
|
+
</div>
|
|
1242
|
+
|
|
1243
|
+
${this.renderPermissions()} ${this.renderExpiration()}
|
|
1244
|
+
${this.renderTerms()}
|
|
1245
|
+
</div>
|
|
1246
|
+
|
|
1247
|
+
<div slot="footer">
|
|
1248
|
+
<consent-button variant="secondary" @click=${this.handleDeny}>
|
|
1249
|
+
Cancel
|
|
1250
|
+
</consent-button>
|
|
1251
|
+
<consent-button
|
|
1252
|
+
variant="primary"
|
|
1253
|
+
?loading=${this.loading}
|
|
1254
|
+
?disabled=${this.resolved?.terms.required&&!this.termsAccepted}
|
|
1255
|
+
@click=${this.handleApprove}
|
|
1256
|
+
>
|
|
1257
|
+
${e?.buttonText??"Send magic link"}
|
|
1258
|
+
</consent-button>
|
|
1259
|
+
</div>
|
|
1260
|
+
</consent-shell>
|
|
1261
|
+
`}renderOTP(){let e=this.resolved?.otp;return d`
|
|
1262
|
+
<consent-shell
|
|
1263
|
+
page-title=${this.resolved?.ui.title??"Verify Code"}
|
|
1264
|
+
company-name=${this.resolved?.branding.companyName??""}
|
|
1265
|
+
logo-url=${this.resolved?.branding.logoUrl??""}
|
|
1266
|
+
primary-color=${this.resolved?.branding.primaryColor??"#2563eb"}
|
|
1267
|
+
secondary-color=${this.resolved?.branding.secondaryColor??"#dbeafe"}
|
|
1268
|
+
>
|
|
1269
|
+
<div slot="content">
|
|
1270
|
+
${this.renderError()} ${this.renderAgentInfo()}
|
|
1271
|
+
|
|
1272
|
+
<div class="otp-section">
|
|
1273
|
+
<p class="otp-instructions">
|
|
1274
|
+
${e?.instructions??"Enter the verification code sent to your device"}
|
|
1275
|
+
</p>
|
|
1276
|
+
<consent-otp-input
|
|
1277
|
+
length=${e?.digits??6}
|
|
1278
|
+
name="otp"
|
|
1279
|
+
auto-focus
|
|
1280
|
+
@complete=${r=>{this.handleInputChange("otp",r.detail.value),this.handleApprove()}}
|
|
1281
|
+
@input=${r=>this.handleInputChange("otp",r.detail.value)}
|
|
1282
|
+
></consent-otp-input>
|
|
1283
|
+
<div class="otp-resend">
|
|
1284
|
+
Didn't receive the code?
|
|
1285
|
+
<button
|
|
1286
|
+
type="button"
|
|
1287
|
+
?disabled=${this.resendCooldown>0}
|
|
1288
|
+
@click=${this.handleResendOtp}
|
|
1289
|
+
>
|
|
1290
|
+
${this.resendCooldown>0?`Resend in ${this.resendCooldown}s`:"Resend"}
|
|
1291
|
+
</button>
|
|
1292
|
+
</div>
|
|
1293
|
+
</div>
|
|
1294
|
+
|
|
1295
|
+
${this.renderPermissions()} ${this.renderTerms()}
|
|
1296
|
+
</div>
|
|
1297
|
+
${this.renderFooter()}
|
|
1298
|
+
</consent-shell>
|
|
1299
|
+
`}renderSuccess(){let e=this.resolved?.success;return d`
|
|
1300
|
+
<consent-shell
|
|
1301
|
+
page-title=${e?.title??"Access Granted"}
|
|
1302
|
+
company-name=${this.resolved?.branding.companyName??""}
|
|
1303
|
+
logo-url=${this.resolved?.branding.logoUrl??""}
|
|
1304
|
+
primary-color=${this.resolved?.branding.primaryColor??"#2563eb"}
|
|
1305
|
+
secondary-color=${this.resolved?.branding.secondaryColor??"#dbeafe"}
|
|
1306
|
+
>
|
|
1307
|
+
<div slot="content">
|
|
1308
|
+
<div class="success-view">
|
|
1309
|
+
<div class="success-icon">
|
|
1310
|
+
<svg
|
|
1311
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1312
|
+
viewBox="0 0 24 24"
|
|
1313
|
+
fill="none"
|
|
1314
|
+
stroke="currentColor"
|
|
1315
|
+
stroke-width="2"
|
|
1316
|
+
>
|
|
1317
|
+
<polyline points="20 6 9 17 4 12" />
|
|
1318
|
+
</svg>
|
|
1319
|
+
</div>
|
|
1320
|
+
<h2 class="success-title">${e?.title??"Access Granted"}</h2>
|
|
1321
|
+
<p class="success-description">
|
|
1322
|
+
${e?.description??"You have successfully granted access. You can now close this window."}
|
|
1323
|
+
</p>
|
|
1324
|
+
</div>
|
|
1325
|
+
</div>
|
|
1326
|
+
|
|
1327
|
+
<div slot="footer">
|
|
1328
|
+
<consent-button
|
|
1329
|
+
variant="primary"
|
|
1330
|
+
full-width
|
|
1331
|
+
@click=${()=>window.close()}
|
|
1332
|
+
>
|
|
1333
|
+
${e?.continueButtonText??"Close"}
|
|
1334
|
+
</consent-button>
|
|
1335
|
+
</div>
|
|
1336
|
+
</consent-shell>
|
|
1337
|
+
`}render(){if(this.step==="success")return this.renderSuccess();switch(this.currentMode){case S.CREDENTIALS:return this.renderCredentials();case S.OAUTH:return this.renderOAuth();case S.MAGIC_LINK:return this.renderMagicLink();case S.OTP:return this.renderOTP();case S.CONSENT_ONLY:default:return this.renderConsentOnly()}}};m.styles=v`
|
|
1338
|
+
:host {
|
|
1339
|
+
display: block;
|
|
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;
|
|
1343
|
+
-webkit-font-smoothing: antialiased;
|
|
1344
|
+
-moz-osx-font-smoothing: grayscale;
|
|
1345
|
+
--_primary: var(--consent-primary, #2563eb);
|
|
1346
|
+
--_secondary: var(--consent-secondary, #dbeafe);
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/* Agent info box */
|
|
1350
|
+
.agent-info {
|
|
1351
|
+
display: flex;
|
|
1352
|
+
gap: 1rem;
|
|
1353
|
+
padding: 1rem;
|
|
1354
|
+
background: #f9fafb;
|
|
1355
|
+
border-radius: 0.5rem;
|
|
1356
|
+
margin-bottom: 1rem;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
.agent-icon {
|
|
1360
|
+
width: 40px;
|
|
1361
|
+
height: 40px;
|
|
1362
|
+
background: var(--_secondary);
|
|
1363
|
+
border-radius: 0.5rem;
|
|
1364
|
+
display: flex;
|
|
1365
|
+
align-items: center;
|
|
1366
|
+
justify-content: center;
|
|
1367
|
+
flex-shrink: 0;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
.agent-icon svg {
|
|
1371
|
+
width: 20px;
|
|
1372
|
+
height: 20px;
|
|
1373
|
+
color: var(--_primary);
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
.agent-text {
|
|
1377
|
+
flex: 1;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
.agent-text p {
|
|
1381
|
+
margin: 0;
|
|
1382
|
+
font-size: 0.875rem;
|
|
1383
|
+
color: #374151;
|
|
1384
|
+
line-height: 1.5;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
.agent-text strong {
|
|
1388
|
+
color: #111827;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/* Permissions section */
|
|
1392
|
+
.permissions-header {
|
|
1393
|
+
font-size: 0.875rem;
|
|
1394
|
+
color: #6b7280;
|
|
1395
|
+
margin-bottom: 0.5rem;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
.permissions {
|
|
1399
|
+
margin-bottom: 1rem;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
/* Expiration */
|
|
1403
|
+
.expiration {
|
|
1404
|
+
font-size: 0.75rem;
|
|
1405
|
+
color: #6b7280;
|
|
1406
|
+
margin-top: 1rem;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
.expiration strong {
|
|
1410
|
+
color: #374151;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/* Terms */
|
|
1414
|
+
.terms {
|
|
1415
|
+
margin-top: 1.5rem;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/* Error message */
|
|
1419
|
+
.error-message {
|
|
1420
|
+
background: #fef2f2;
|
|
1421
|
+
border: 1px solid #fecaca;
|
|
1422
|
+
border-radius: 0.5rem;
|
|
1423
|
+
padding: 0.75rem 1rem;
|
|
1424
|
+
margin-bottom: 1rem;
|
|
1425
|
+
color: #dc2626;
|
|
1426
|
+
font-size: 0.875rem;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/* Form fields */
|
|
1430
|
+
.form-fields {
|
|
1431
|
+
display: flex;
|
|
1432
|
+
flex-direction: column;
|
|
1433
|
+
gap: 1rem;
|
|
1434
|
+
margin-bottom: 1rem;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
/* Divider */
|
|
1438
|
+
.divider {
|
|
1439
|
+
display: flex;
|
|
1440
|
+
align-items: center;
|
|
1441
|
+
gap: 1rem;
|
|
1442
|
+
margin: 1.5rem 0;
|
|
1443
|
+
color: #6b7280;
|
|
1444
|
+
font-size: 0.75rem;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
.divider::before,
|
|
1448
|
+
.divider::after {
|
|
1449
|
+
content: '';
|
|
1450
|
+
flex: 1;
|
|
1451
|
+
height: 1px;
|
|
1452
|
+
background: #e5e7eb;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
/* Success view */
|
|
1456
|
+
.success-view {
|
|
1457
|
+
text-align: center;
|
|
1458
|
+
padding: 2rem 0;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
.success-icon {
|
|
1462
|
+
width: 64px;
|
|
1463
|
+
height: 64px;
|
|
1464
|
+
background: #d1fae5;
|
|
1465
|
+
border-radius: 50%;
|
|
1466
|
+
display: flex;
|
|
1467
|
+
align-items: center;
|
|
1468
|
+
justify-content: center;
|
|
1469
|
+
margin: 0 auto 1.5rem;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
.success-icon svg {
|
|
1473
|
+
width: 32px;
|
|
1474
|
+
height: 32px;
|
|
1475
|
+
color: #059669;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
.success-title {
|
|
1479
|
+
font-size: 1.25rem;
|
|
1480
|
+
font-weight: 600;
|
|
1481
|
+
color: #111827;
|
|
1482
|
+
margin: 0 0 0.5rem;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
.success-description {
|
|
1486
|
+
font-size: 0.875rem;
|
|
1487
|
+
color: #6b7280;
|
|
1488
|
+
margin: 0 0 1.5rem;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
/* OTP section */
|
|
1492
|
+
.otp-section {
|
|
1493
|
+
text-align: center;
|
|
1494
|
+
margin-bottom: 1.5rem;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
.otp-instructions {
|
|
1498
|
+
font-size: 0.875rem;
|
|
1499
|
+
color: #6b7280;
|
|
1500
|
+
margin-bottom: 1rem;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
.otp-resend {
|
|
1504
|
+
margin-top: 1rem;
|
|
1505
|
+
font-size: 0.75rem;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
.otp-resend button {
|
|
1509
|
+
background: none;
|
|
1510
|
+
border: none;
|
|
1511
|
+
color: var(--_primary);
|
|
1512
|
+
cursor: pointer;
|
|
1513
|
+
text-decoration: underline;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
.otp-resend button:disabled {
|
|
1517
|
+
color: #9ca3af;
|
|
1518
|
+
cursor: not-allowed;
|
|
1519
|
+
}
|
|
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([x()],m.prototype,"resolved",2),n([x()],m.prototype,"currentMode",2),n([x()],m.prototype,"loading",2),n([x()],m.prototype,"error",2),n([x()],m.prototype,"step",2),n([x()],m.prototype,"termsAccepted",2),n([x()],m.prototype,"formData",2),n([x()],m.prototype,"resendCooldown",2),n([x()],m.prototype,"selectedScopes",2),m=n([y("mcp-consent")],m);export{_ as ConsentButton,k as ConsentCheckbox,$ as ConsentInput,A as ConsentOAuthButton,E as ConsentOTPInput,I as ConsentPermissions,U as ConsentShell,w as ConsentTerms,m as McpConsent};
|
|
1521
|
+
/*! Bundled license information:
|
|
1522
|
+
|
|
1523
|
+
@lit/reactive-element/css-tag.js:
|
|
1524
|
+
(**
|
|
1525
|
+
* @license
|
|
1526
|
+
* Copyright 2019 Google LLC
|
|
1527
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1528
|
+
*)
|
|
1529
|
+
|
|
1530
|
+
@lit/reactive-element/reactive-element.js:
|
|
1531
|
+
lit-html/lit-html.js:
|
|
1532
|
+
lit-element/lit-element.js:
|
|
1533
|
+
@lit/reactive-element/decorators/custom-element.js:
|
|
1534
|
+
@lit/reactive-element/decorators/property.js:
|
|
1535
|
+
@lit/reactive-element/decorators/state.js:
|
|
1536
|
+
@lit/reactive-element/decorators/event-options.js:
|
|
1537
|
+
@lit/reactive-element/decorators/base.js:
|
|
1538
|
+
@lit/reactive-element/decorators/query.js:
|
|
1539
|
+
@lit/reactive-element/decorators/query-all.js:
|
|
1540
|
+
@lit/reactive-element/decorators/query-async.js:
|
|
1541
|
+
@lit/reactive-element/decorators/query-assigned-nodes.js:
|
|
1542
|
+
lit-html/directive.js:
|
|
1543
|
+
lit-html/directives/unsafe-html.js:
|
|
1544
|
+
lit-html/directives/unsafe-svg.js:
|
|
1545
|
+
(**
|
|
1546
|
+
* @license
|
|
1547
|
+
* Copyright 2017 Google LLC
|
|
1548
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1549
|
+
*)
|
|
1550
|
+
|
|
1551
|
+
lit-html/is-server.js:
|
|
1552
|
+
(**
|
|
1553
|
+
* @license
|
|
1554
|
+
* Copyright 2022 Google LLC
|
|
1555
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1556
|
+
*)
|
|
1557
|
+
|
|
1558
|
+
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
1559
|
+
(**
|
|
1560
|
+
* @license
|
|
1561
|
+
* Copyright 2021 Google LLC
|
|
1562
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1563
|
+
*)
|
|
1564
|
+
*/
|