kryptos-connect-dynamic-sdk 1.0.0
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/kryptos-sdk.umd.js +14 -0
- package/dist/style.css +1 -0
- package/npm-wrapper/index.tsx +117 -0
- package/npm-wrapper/load-remote.ts +168 -0
- package/package.json +44 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
(function(I,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],b):(I=typeof globalThis<"u"?globalThis:I||self,b(I.__KRYPTOS_SDK__={},I.React))})(this,function(I,b){"use strict";var ve={exports:{}},ne={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var vt=b,Bt=Symbol.for("react.element"),Ft=Symbol.for("react.fragment"),Dt=Object.prototype.hasOwnProperty,Mt=vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,$t={key:!0,ref:!0,__self:!0,__source:!0};function Be(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)Dt.call(t,r)&&!$t.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:Bt,type:e,key:i,ref:o,props:s,_owner:Mt.current}}ne.Fragment=Ft,ne.jsx=Be,ne.jsxs=Be,ve.exports=ne;var f=ve.exports;const Fe=b.createContext(void 0);function Ht({config:e,children:t}){const r=`kryptos-theme-${e.theme||"light"}`,[s,i]=b.useState(!1),[o,c]=b.useState(!1),[p,l]=b.useState(""),[u,y]=b.useState(null),[g,E]=b.useState(""),[d,h]=b.useState(null),[m,x]=b.useState(null);return f.jsx(Fe.Provider,{value:{...e,isInitialized:s,setIsInitialized:i,linkToken:p,setLinkToken:l,user:u,setUser:y,email:g,setEmail:E,userConsent:d,setUserConsent:h,clientInfo:m,isAuthorized:o,setIsAuthorized:c},children:f.jsx("div",{className:`kryptos-sdk-container ${r}`,children:t})})}function B(){const e=b.useContext(Fe);if(!e)throw new Error("useKryptosContext must be used within KryptosConnectProvider");return e}function De(e,t){return function(){return e.apply(t,arguments)}}const{toString:Kt}=Object.prototype,{getPrototypeOf:we}=Object,{iterator:re,toStringTag:Me}=Symbol,se=(e=>t=>{const n=Kt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),P=e=>(e=e.toLowerCase(),t=>se(t)===e),oe=e=>t=>typeof t===e,{isArray:V}=Array,W=oe("undefined");function X(e){return e!==null&&!W(e)&&e.constructor!==null&&!W(e.constructor)&&N(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const $e=P("ArrayBuffer");function qt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$e(e.buffer),t}const zt=oe("string"),N=oe("function"),He=oe("number"),G=e=>e!==null&&typeof e=="object",Vt=e=>e===!0||e===!1,ie=e=>{if(se(e)!=="object")return!1;const t=we(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Me in e)&&!(re in e)},Wt=e=>{if(!G(e)||X(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Jt=P("Date"),Xt=P("File"),Gt=P("Blob"),Zt=P("FileList"),Qt=e=>G(e)&&N(e.pipe),Yt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||N(e.append)&&((t=se(e))==="formdata"||t==="object"&&N(e.toString)&&e.toString()==="[object FormData]"))},en=P("URLSearchParams"),[tn,nn,rn,sn]=["ReadableStream","Request","Response","Headers"].map(P),on=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Z(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),V(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(X(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let c;for(r=0;r<o;r++)c=i[r],t.call(null,e[c],c,e)}}function Ke(e,t){if(X(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const H=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,qe=e=>!W(e)&&e!==H;function ge(){const{caseless:e,skipUndefined:t}=qe(this)&&this||{},n={},r=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=e&&Ke(n,i)||i;ie(n[o])&&ie(s)?n[o]=ge(n[o],s):ie(s)?n[o]=ge({},s):V(s)?n[o]=s.slice():(!t||!W(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Z(arguments[s],r);return n}const an=(e,t,n,{allOwnKeys:r}={})=>(Z(t,(s,i)=>{n&&N(s)?Object.defineProperty(e,i,{value:De(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),cn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ln=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},un=(e,t,n,r)=>{let s,i,o;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=n!==!1&&we(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},dn=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},fn=e=>{if(!e)return null;if(V(e))return e;let t=e.length;if(!He(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},pn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&we(Uint8Array)),hn=(e,t)=>{const r=(e&&e[re]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},mn=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},yn=P("HTMLFormElement"),wn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),ze=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),gn=P("RegExp"),Ve=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Z(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},bn=e=>{Ve(e,(t,n)=>{if(N(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(N(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},En=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return V(e)?r(e):r(String(e).split(t)),n},xn=()=>{},Sn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Cn(e){return!!(e&&N(e.append)&&e[Me]==="FormData"&&e[re])}const On=e=>{const t=new Array(10),n=(r,s)=>{if(G(r)){if(t.indexOf(r)>=0)return;if(X(r))return r;if(!("toJSON"in r)){t[s]=r;const i=V(r)?[]:{};return Z(r,(o,c)=>{const p=n(o,s+1);!W(p)&&(i[c]=p)}),t[s]=void 0,i}}return r};return n(e,0)},Rn=P("AsyncFunction"),Tn=e=>e&&(G(e)||N(e))&&N(e.then)&&N(e.catch),We=((e,t)=>e?setImmediate:t?((n,r)=>(H.addEventListener("message",({source:s,data:i})=>{s===H&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),H.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",N(H.postMessage)),Nn=typeof queueMicrotask<"u"?queueMicrotask.bind(H):typeof process<"u"&&process.nextTick||We,a={isArray:V,isArrayBuffer:$e,isBuffer:X,isFormData:Yt,isArrayBufferView:qt,isString:zt,isNumber:He,isBoolean:Vt,isObject:G,isPlainObject:ie,isEmptyObject:Wt,isReadableStream:tn,isRequest:nn,isResponse:rn,isHeaders:sn,isUndefined:W,isDate:Jt,isFile:Xt,isBlob:Gt,isRegExp:gn,isFunction:N,isStream:Qt,isURLSearchParams:en,isTypedArray:pn,isFileList:Zt,forEach:Z,merge:ge,extend:an,trim:on,stripBOM:cn,inherits:ln,toFlatObject:un,kindOf:se,kindOfTest:P,endsWith:dn,toArray:fn,forEachEntry:hn,matchAll:mn,isHTMLForm:yn,hasOwnProperty:ze,hasOwnProp:ze,reduceDescriptors:Ve,freezeMethods:bn,toObjectSet:En,toCamelCase:wn,noop:xn,toFiniteNumber:Sn,findKey:Ke,global:H,isContextDefined:qe,isSpecCompliantForm:Cn,toJSONObject:On,isAsyncFn:Rn,isThenable:Tn,setImmediate:We,asap:Nn,isIterable:e=>e!=null&&N(e[re])};let w=class It extends Error{static from(t,n,r,s,i,o){const c=new It(t.message,n||t.code,r,s,i);return c.cause=t,c.name=t.name,o&&Object.assign(c,o),c}constructor(t,n,r,s,i){super(t),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}};w.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",w.ERR_BAD_OPTION="ERR_BAD_OPTION",w.ECONNABORTED="ECONNABORTED",w.ETIMEDOUT="ETIMEDOUT",w.ERR_NETWORK="ERR_NETWORK",w.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",w.ERR_DEPRECATED="ERR_DEPRECATED",w.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",w.ERR_BAD_REQUEST="ERR_BAD_REQUEST",w.ERR_CANCELED="ERR_CANCELED",w.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",w.ERR_INVALID_URL="ERR_INVALID_URL";const An=null;function be(e){return a.isPlainObject(e)||a.isArray(e)}function Je(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Xe(e,t,n){return e?e.concat(t).map(function(s,i){return s=Je(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function kn(e){return a.isArray(e)&&!e.some(be)}const jn=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ae(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,m){return!a.isUndefined(m[h])});const r=n.metaTokens,s=n.visitor||u,i=n.dots,o=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function l(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!p&&a.isBlob(d))throw new w("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?p&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,h,m){let x=d;if(d&&!m&&typeof d=="object"){if(a.endsWith(h,"{}"))h=r?h:h.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&kn(d)||(a.isFileList(d)||a.endsWith(h,"[]"))&&(x=a.toArray(d)))return h=Je(h),x.forEach(function(C,O){!(a.isUndefined(C)||C===null)&&t.append(o===!0?Xe([h],O,i):o===null?h:h+"[]",l(C))}),!1}return be(d)?!0:(t.append(Xe(m,h,i),l(d)),!1)}const y=[],g=Object.assign(jn,{defaultVisitor:u,convertValue:l,isVisitable:be});function E(d,h){if(!a.isUndefined(d)){if(y.indexOf(d)!==-1)throw Error("Circular reference detected in "+h.join("."));y.push(d),a.forEach(d,function(x,T){(!(a.isUndefined(x)||x===null)&&s.call(t,x,a.isString(T)?T.trim():T,h,g))===!0&&E(x,h?h.concat(T):[T])}),y.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return E(e),t}function Ge(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ee(e,t){this._pairs=[],e&&ae(e,this,t)}const Ze=Ee.prototype;Ze.append=function(t,n){this._pairs.push([t,n])},Ze.toString=function(t){const n=t?function(r){return t.call(this,r,Ge)}:Ge;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function _n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Qe(e,t,n){if(!t)return e;const r=n&&n.encode||_n,s=a.isFunction(n)?{serialize:n}:n,i=s&&s.serialize;let o;if(i?o=i(t,s):o=a.isURLSearchParams(t)?t.toString():new Ee(t,s).toString(r),o){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ye{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const xe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ln={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ee,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Se=typeof window<"u"&&typeof document<"u",Ce=typeof navigator=="object"&&navigator||void 0,Un=Se&&(!Ce||["ReactNative","NativeScript","NS"].indexOf(Ce.product)<0),In=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pn=Se&&window.location.href||"http://localhost",R={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Se,hasStandardBrowserEnv:Un,hasStandardBrowserWebWorkerEnv:In,navigator:Ce,origin:Pn},Symbol.toStringTag,{value:"Module"})),...Ln};function vn(e,t){return ae(e,new R.classes.URLSearchParams,{visitor:function(n,r,s,i){return R.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Bn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Fn(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function et(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),p=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,p?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=Fn(s[o])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Bn(r),s,n,0)}),n}return null}function Dn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Q={transitional:xe,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(et(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return vn(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return ae(c?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Dn(t)):t}],transformResponse:[function(t){const n=this.transitional||Q.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?w.from(c,w.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:R.classes.FormData,Blob:R.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{Q.headers[e]={}});const Mn=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),$n=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
10
|
+
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Mn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},tt=Symbol("internals");function Y(e){return e&&String(e).trim().toLowerCase()}function ce(e){return e===!1||e==null?e:a.isArray(e)?e.map(ce):String(e)}function Hn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Kn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Oe(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function qn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function zn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let A=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(c,p,l){const u=Y(p);if(!u)throw new Error("header name must be a non-empty string");const y=a.findKey(s,u);(!y||s[y]===void 0||l===!0||l===void 0&&s[y]!==!1)&&(s[y||p]=ce(c))}const o=(c,p)=>a.forEach(c,(l,u)=>i(l,u,p));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!Kn(t))o($n(t),n);else if(a.isObject(t)&&a.isIterable(t)){let c={},p,l;for(const u of t){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[l=u[0]]=(p=c[l])?a.isArray(p)?[...p,u[1]]:[p,u[1]]:u[1]}o(c,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Y(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Hn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Y(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Oe(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Y(o),o){const c=a.findKey(r,o);c&&(!n||Oe(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||Oe(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,i)=>{const o=a.findKey(r,i);if(o){n[o]=ce(s),delete n[i];return}const c=t?qn(i):String(i).trim();c!==i&&delete n[i],n[c]=ce(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
11
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[tt]=this[tt]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=Y(o);r[c]||(zn(s,o),r[c]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};A.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(A.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),a.freezeMethods(A);function Re(e,t){const n=this||Q,r=t||n,s=A.from(r.headers);let i=r.data;return a.forEach(e,function(c){i=c.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function nt(e){return!!(e&&e.__CANCEL__)}let ee=class extends w{constructor(t,n,r){super(t??"canceled",w.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function rt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new w("Request failed with status code "+n.status,[w.ERR_BAD_REQUEST,w.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Vn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Wn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(p){const l=Date.now(),u=r[i];o||(o=l),n[s]=p,r[s]=l;let y=i,g=0;for(;y!==s;)g+=n[y++],y=y%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),l-o<t)return;const E=u&&l-u;return E?Math.round(g*1e3/E):void 0}}function Jn(e,t){let n=0,r=1e3/t,s,i;const o=(l,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...l)};return[(...l)=>{const u=Date.now(),y=u-n;y>=r?o(l,u):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},r-y)))},()=>s&&o(s)]}const le=(e,t,n=3)=>{let r=0;const s=Wn(50,250);return Jn(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,p=o-r,l=s(p),u=o<=c;r=o;const y={loaded:o,total:c,progress:c?o/c:void 0,bytes:p,rate:l||void 0,estimated:l&&c&&u?(c-o)/l:void 0,event:i,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(y)},n)},st=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ot=e=>(...t)=>a.asap(()=>e(...t)),Xn=R.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,R.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(R.origin),R.navigator&&/(msie|trident)/i.test(R.navigator.userAgent)):()=>!0,Gn=R.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&c.push(`path=${r}`),a.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),a.isString(o)&&c.push(`SameSite=${o}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Zn(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function it(e,t,n){let r=!Zn(t);return e&&(r||n==!1)?Qn(e,t):t}const at=e=>e instanceof A?{...e}:e;function K(e,t){t=t||{};const n={};function r(l,u,y,g){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:g},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(l,u,y,g){if(a.isUndefined(u)){if(!a.isUndefined(l))return r(void 0,l,y,g)}else return r(l,u,y,g)}function i(l,u){if(!a.isUndefined(u))return r(void 0,u)}function o(l,u){if(a.isUndefined(u)){if(!a.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function c(l,u,y){if(y in t)return r(l,u);if(y in e)return r(void 0,l)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(l,u,y)=>s(at(l),at(u),y,!0)};return a.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const y=a.hasOwnProp(p,u)?p[u]:s,g=y(e[u],t[u],u);a.isUndefined(g)&&y!==c||(n[u]=g)}),n}const ct=e=>{const t=K({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=t;if(t.headers=o=A.from(o),t.url=Qe(it(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(n)){if(R.hasStandardBrowserEnv||R.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const p=n.getHeaders(),l=["content-type","content-length"];Object.entries(p).forEach(([u,y])=>{l.includes(u.toLowerCase())&&o.set(u,y)})}}if(R.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Xn(t.url))){const p=s&&i&&Gn.read(i);p&&o.set(s,p)}return t},Yn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const s=ct(e);let i=s.data;const o=A.from(s.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:l}=s,u,y,g,E,d;function h(){E&&E(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function x(){if(!m)return;const C=A.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),L={data:!c||c==="text"||c==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:C,config:e,request:m};rt(function(k){n(k),h()},function(k){r(k),h()},L),m=null}"onloadend"in m?m.onloadend=x:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(x)},m.onabort=function(){m&&(r(new w("Request aborted",w.ECONNABORTED,e,m)),m=null)},m.onerror=function(O){const L=O&&O.message?O.message:"Network Error",v=new w(L,w.ERR_NETWORK,e,m);v.event=O||null,r(v),m=null},m.ontimeout=function(){let O=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const L=s.transitional||xe;s.timeoutErrorMessage&&(O=s.timeoutErrorMessage),r(new w(O,L.clarifyTimeoutError?w.ETIMEDOUT:w.ECONNABORTED,e,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(O,L){m.setRequestHeader(L,O)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),c&&c!=="json"&&(m.responseType=s.responseType),l&&([g,d]=le(l,!0),m.addEventListener("progress",g)),p&&m.upload&&([y,E]=le(p),m.upload.addEventListener("progress",y),m.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(u=C=>{m&&(r(!C||C.type?new ee(null,e,m):C),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const T=Vn(s.url);if(T&&R.protocols.indexOf(T)===-1){r(new w("Unsupported protocol "+T+":",w.ERR_BAD_REQUEST,e));return}m.send(i||null)})},er=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(l){if(!s){s=!0,c();const u=l instanceof Error?l:this.reason;r.abort(u instanceof w?u:new ee(u instanceof Error?u.message:u))}};let o=t&&setTimeout(()=>{o=null,i(new w(`timeout of ${t}ms exceeded`,w.ETIMEDOUT))},t);const c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),e=null)};e.forEach(l=>l.addEventListener("abort",i));const{signal:p}=r;return p.unsubscribe=()=>a.asap(c),p}},tr=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},nr=async function*(e,t){for await(const n of rr(e))yield*tr(n,t)},rr=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},lt=(e,t,n,r)=>{const s=nr(e,t);let i=0,o,c=p=>{o||(o=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:l,value:u}=await s.next();if(l){c(),p.close();return}let y=u.byteLength;if(n){let g=i+=y;n(g)}p.enqueue(new Uint8Array(u))}catch(l){throw c(l),l}},cancel(p){return c(p),s.return()}},{highWaterMark:2})},ut=64*1024,{isFunction:ue}=a,sr=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:dt,TextEncoder:ft}=a.global,pt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},or=e=>{e=a.merge.call({skipUndefined:!0},sr,e);const{fetch:t,Request:n,Response:r}=e,s=t?ue(t):typeof fetch=="function",i=ue(n),o=ue(r);if(!s)return!1;const c=s&&ue(dt),p=s&&(typeof ft=="function"?(d=>h=>d.encode(h))(new ft):async d=>new Uint8Array(await new n(d).arrayBuffer())),l=i&&c&&pt(()=>{let d=!1;const h=new n(R.origin,{body:new dt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!h}),u=o&&c&&pt(()=>a.isReadableStream(new r("").body)),y={stream:u&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!y[d]&&(y[d]=(h,m)=>{let x=h&&h[d];if(x)return x.call(h);throw new w(`Response type '${d}' is not supported`,w.ERR_NOT_SUPPORT,m)})});const g=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new n(R.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await p(d)).byteLength},E=async(d,h)=>{const m=a.toFiniteNumber(d.getContentLength());return m??g(h)};return async d=>{let{url:h,method:m,data:x,signal:T,cancelToken:C,timeout:O,onDownloadProgress:L,onUploadProgress:v,responseType:k,headers:Ie,withCredentials:he="same-origin",fetchOptions:At}=ct(d),kt=t||fetch;k=k?(k+"").toLowerCase():"text";let me=er([T,C&&C.toAbortSignal()],O),te=null;const z=me&&me.unsubscribe&&(()=>{me.unsubscribe()});let jt;try{if(v&&l&&m!=="get"&&m!=="head"&&(jt=await E(Ie,x))!==0){let $=new n(h,{method:"POST",body:x,duplex:"half"}),J;if(a.isFormData(x)&&(J=$.headers.get("content-type"))&&Ie.setContentType(J),$.body){const[Pe,ye]=st(jt,le(ot(v)));x=lt($.body,ut,Pe,ye)}}a.isString(he)||(he=he?"include":"omit");const j=i&&"credentials"in n.prototype,_t={...At,signal:me,method:m.toUpperCase(),headers:Ie.normalize().toJSON(),body:x,duplex:"half",credentials:j?he:void 0};te=i&&new n(h,_t);let M=await(i?kt(te,At):kt(h,_t));const Lt=u&&(k==="stream"||k==="response");if(u&&(L||Lt&&z)){const $={};["status","statusText","headers"].forEach(Ut=>{$[Ut]=M[Ut]});const J=a.toFiniteNumber(M.headers.get("content-length")),[Pe,ye]=L&&st(J,le(ot(L),!0))||[];M=new r(lt(M.body,ut,Pe,()=>{ye&&ye(),z&&z()}),$)}k=k||"text";let $r=await y[a.findKey(y,k)||"text"](M,d);return!Lt&&z&&z(),await new Promise(($,J)=>{rt($,J,{data:$r,headers:A.from(M.headers),status:M.status,statusText:M.statusText,config:d,request:te})})}catch(j){throw z&&z(),j&&j.name==="TypeError"&&/Load failed|fetch/i.test(j.message)?Object.assign(new w("Network Error",w.ERR_NETWORK,d,te,j&&j.response),{cause:j.cause||j}):w.from(j,j&&j.code,d,te,j&&j.response)}}},ir=new Map,ht=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,c=o,p,l,u=ir;for(;c--;)p=i[c],l=u.get(p),l===void 0&&u.set(p,l=c?new Map:or(t)),u=l;return l};ht();const Te={http:An,xhr:Yn,fetch:{get:ht}};a.forEach(Te,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const mt=e=>`- ${e}`,ar=e=>a.isFunction(e)||e===null||e===!1;function cr(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let c;if(s=r,!ar(r)&&(s=Te[(c=String(r)).toLowerCase()],s===void 0))throw new w(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[c||"#"+o]=s}if(!s){const o=Object.entries(i).map(([p,l])=>`adapter ${p} `+(l===!1?"is not supported by the environment":"is not available in the build"));let c=n?o.length>1?`since :
|
|
12
|
+
`+o.map(mt).join(`
|
|
13
|
+
`):" "+mt(o[0]):"as no adapter specified";throw new w("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const yt={getAdapter:cr,adapters:Te};function Ne(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ee(null,e)}function wt(e){return Ne(e),e.headers=A.from(e.headers),e.data=Re.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),yt.getAdapter(e.adapter||Q.adapter,e)(e).then(function(r){return Ne(e),r.data=Re.call(e,e.transformResponse,r),r.headers=A.from(r.headers),r},function(r){return nt(r)||(Ne(e),r&&r.response&&(r.response.data=Re.call(e,e.transformResponse,r.response),r.response.headers=A.from(r.response.headers))),Promise.reject(r)})}const gt="1.13.5",de={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{de[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const bt={};de.transitional=function(t,n,r){function s(i,o){return"[Axios v"+gt+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,c)=>{if(t===!1)throw new w(s(o," has been removed"+(n?" in "+n:"")),w.ERR_DEPRECATED);return n&&!bt[o]&&(bt[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,c):!0}},de.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function lr(e,t,n){if(typeof e!="object")throw new w("options must be an object",w.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const c=e[i],p=c===void 0||o(c,i,e);if(p!==!0)throw new w("option "+i+" must be "+p,w.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new w("Unknown option "+i,w.ERR_BAD_OPTION)}}const fe={assertOptions:lr,validators:de},U=fe.validators;let q=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ye,response:new Ye}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
14
|
+
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=K(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&fe.assertOptions(r,{silentJSONParsing:U.transitional(U.boolean),forcedJSONParsing:U.transitional(U.boolean),clarifyTimeoutError:U.transitional(U.boolean),legacyInterceptorReqResOrdering:U.transitional(U.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:fe.assertOptions(s,{encode:U.function,serialize:U.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),fe.assertOptions(n,{baseUrl:U.spelling("baseURL"),withXsrfToken:U.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),n.headers=A.concat(o,i);const c=[];let p=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(n)===!1)return;p=p&&h.synchronous;const m=n.transitional||xe;m&&m.legacyInterceptorReqResOrdering?c.unshift(h.fulfilled,h.rejected):c.push(h.fulfilled,h.rejected)});const l=[];this.interceptors.response.forEach(function(h){l.push(h.fulfilled,h.rejected)});let u,y=0,g;if(!p){const d=[wt.bind(this),void 0];for(d.unshift(...c),d.push(...l),g=d.length,u=Promise.resolve(n);y<g;)u=u.then(d[y++],d[y++]);return u}g=c.length;let E=n;for(;y<g;){const d=c[y++],h=c[y++];try{E=d(E)}catch(m){h.call(this,m);break}}try{u=wt.call(this,E)}catch(d){return Promise.reject(d)}for(y=0,g=l.length;y<g;)u=u.then(l[y++],l[y++]);return u}getUri(t){t=K(this.defaults,t);const n=it(t.baseURL,t.url,t.allowAbsoluteUrls);return Qe(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){q.prototype[t]=function(n,r){return this.request(K(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,c){return this.request(K(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}q.prototype[t]=n(),q.prototype[t+"Form"]=n(!0)});let ur=class Pt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{r.subscribe(c),i=c}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,c){r.reason||(r.reason=new ee(i,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Pt(function(s){t=s}),cancel:t}}};function dr(e){return function(n){return e.apply(null,n)}}function fr(e){return a.isObject(e)&&e.isAxiosError===!0}const Ae={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ae).forEach(([e,t])=>{Ae[t]=e});function Et(e){const t=new q(e),n=De(q.prototype.request,t);return a.extend(n,q.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Et(K(e,s))},n}const S=Et(Q);S.Axios=q,S.CanceledError=ee,S.CancelToken=ur,S.isCancel=nt,S.VERSION=gt,S.toFormData=ae,S.AxiosError=w,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=dr,S.isAxiosError=fr,S.mergeConfig=K,S.AxiosHeaders=A,S.formToJSON=e=>et(a.isHTMLForm(e)?new FormData(e):e),S.getAdapter=yt.getAdapter,S.HttpStatusCode=Ae,S.default=S;const{Axios:Jr,AxiosError:Xr,CanceledError:Gr,isCancel:Zr,CancelToken:Qr,VERSION:Yr,all:es,Cancel:ts,isAxiosError:ns,spread:rs,toFormData:ss,AxiosHeaders:os,HttpStatusCode:is,formToJSON:as,getAdapter:cs,mergeConfig:ls}=S,xt="https://connect-api.kryptos.io/";let St=xt;function pr(e){St=e||xt}const _=S.create({headers:{"Content-Type":"application/json"}});_.interceptors.request.use(e=>(e.baseURL=St,e));const hr="openid profile offline_access email portfolios:read transactions:read integrations:read tax:read accounting:read reports:read workspace:read users:read";async function mr(e,t,n){return(await _.post("/v1/sendEmailOTP",{email:t,purpose:"login",clientId:n},{headers:{"X-LINK-TOKEN":e}})).data}async function yr(e,t,n,r){return(await _.post("/v1/loginUserUsingOTP",{email:t,code:n,clientId:r,purpose:"login"},{headers:{"X-LINK-TOKEN":e}})).data}async function wr(e,t){var r;return(r=(await _.post("/link-token/login",{clientId:t},{headers:{"X-LINK-TOKEN":e}})).data)==null?void 0:r.data}async function gr(e,t){var r;return(r=(await _.post("/integrations/keys",{keys:[...t]},{headers:{"X-LINK-TOKEN":e}})).data)==null?void 0:r.data}async function br(e){var n;return(n=(await _.post("/consent",{granted_scopes:hr},{headers:{"X-LINK-TOKEN":e}})).data)==null?void 0:n.data}async function Er(e,t){var r;return(r=(await _.post("/integrations/credentials/test",t,{headers:{"X-LINK-TOKEN":e}})).data)==null?void 0:r.data}async function xr(e,t){var r;return(r=(await _.get(`/integrations/providers${t?`?id=${t}`:""}`,{headers:{"X-LINK-TOKEN":e}})).data)==null?void 0:r.data}async function Sr(e,t){var r;return(r=(await _.get("/integrations/providers",{params:{searchTerm:t},headers:{"X-LINK-TOKEN":e}})).data)==null?void 0:r.data}async function Cr(e){var n;return(n=(await _.get("/integrations",{headers:{"X-LINK-TOKEN":e}})).data)==null?void 0:n.data}async function Or(e,t){var r,s;return((s=(r=(await _.get("/integrations/user-used-chain",{headers:{"X-LINK-TOKEN":e},params:{id:t}})).data)==null?void 0:r.data)==null?void 0:s.chains)||[]}async function Rr(e){var n;return(n=(await _.get("/client",{headers:{"X-LINK-TOKEN":e}})).data)==null?void 0:n.data}async function Tr(e){var n;return(n=(await _.get("/link-token/session",{headers:{"X-LINK-TOKEN":e}})).data)==null?void 0:n.data}const Ct="https://connect-api.kryptos.io/";function ke(){const{linkToken:e,clientId:t,baseUrl:n=Ct}=B();b.useEffect(()=>{pr(n??Ct)},[n]);const r=b.useCallback(h=>mr(e,h,t),[e,t]),s=b.useCallback((h,m)=>yr(e,h,m,t),[e,t]),i=b.useCallback(()=>wr(e,t),[e,t]),o=b.useCallback(h=>gr(e,h),[e]),c=b.useCallback(()=>br(e),[e]),p=b.useCallback(h=>Er(e,h),[e]),l=b.useCallback(h=>xr(e,h),[e]),u=b.useCallback(h=>Sr(e,h),[e]),y=b.useCallback(()=>Cr(e),[e]),g=b.useCallback(h=>Or(e,h),[e]),E=b.useCallback(()=>Rr(e),[e]),d=b.useCallback(()=>Tr(e),[e]);return{sendEmailOtp:r,loginWithOtp:s,createAnonymousUser:i,addUserIntegration:o,giveUserConsent:c,testCredentials:p,getSupportedProviders:l,searchProviders:u,getUserIntegrations:y,getUserUsedChains:g,getClientInfo:E,getUserInfo:d,linkToken:e,clientId:t}}function F(...e){return e.filter(Boolean).join(" ")}const pe=b.forwardRef(({variant:e="primary",size:t="md",className:n,children:r,...s},i)=>{const o=F("kc-button",`kc-button--${e}`,`kc-button--${t}`,n);return f.jsx("button",{ref:i,className:o,...s,children:r})});pe.displayName="Button";var D=(e=>(e.INIT="INIT",e.AUTH="AUTH",e.OTP="OTP",e.INTEGRATION="INTEGRATION",e.PERMISSIONS="PERMISSIONS",e.STATUS="STATUS",e.END="END",e))(D||{});const Nr=({...e})=>f.jsx("svg",{fill:"currentColor",width:"24px",height:"24px",viewBox:"0 0 0.72 0.72",xmlns:"http://www.w3.org/2000/svg",...e,children:f.jsx("path",{d:"M0.658 0.348C0.597 0.207 0.483 0.12 0.36 0.12s-0.237 0.087 -0.298 0.228a0.03 0.03 0 0 0 0 0.024C0.123 0.513 0.237 0.6 0.36 0.6s0.237 -0.087 0.298 -0.228a0.03 0.03 0 0 0 0 -0.024M0.36 0.54c-0.095 0 -0.185 -0.069 -0.237 -0.18C0.175 0.249 0.265 0.18 0.36 0.18s0.185 0.069 0.237 0.18c-0.052 0.111 -0.142 0.18 -0.237 0.18m0 -0.3a0.12 0.12 0 1 0 0.12 0.12 0.12 0.12 0 0 0 -0.12 -0.12m0 0.18a0.06 0.06 0 1 1 0.06 -0.06 0.06 0.06 0 0 1 -0.06 0.06"})}),Ar=({...e})=>f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[f.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),f.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),kr=({className:e="",...t})=>f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`kc-animate-spin ${e}`,...t,children:f.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),jr=({...e})=>f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[f.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),f.jsx("path",{d:"m9 12 2 2 4-4"})]}),Ot=b.forwardRef(({variant:e="default",className:t,children:n,...r},s)=>f.jsx("div",{ref:s,role:"alert",className:F("kc-alert",`kc-alert--${e}`,t),...r,children:n}));Ot.displayName="Alert";const _r=b.forwardRef(({className:e,children:t,...n},r)=>f.jsx("div",{ref:r,className:F("kc-alert-title",e),...n,children:t}));_r.displayName="AlertTitle";const Rt=b.forwardRef(({className:e,children:t,...n},r)=>f.jsx("div",{ref:r,className:F("kc-alert-description",e),...n,children:t}));Rt.displayName="AlertDescription";const Lr=()=>{const{config:e}=B();return f.jsx("div",{className:"kc-sandbox-mode",children:"Sandbox Mode"})},Tt=({isDarkTheme:e,width:t="36",height:n="36"})=>f.jsxs("svg",{width:t,height:n,viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("path",{d:"M0 4.11429C0 1.84203 1.84203 0 4.11429 0H31.8857C34.158 0 36 1.84203 36 4.11429V31.8857C36 34.158 34.158 36 31.8857 36H4.11429C1.84203 36 0 34.158 0 31.8857V4.11429Z",fill:e?"white":"#00C693"}),f.jsx("path",{d:"M12.3916 28.2857H8.43388C8.03646 28.2857 7.71429 27.9886 7.71429 27.6221V22.92C7.71429 22.744 7.7901 22.5752 7.92505 22.4508L9.66229 20.8487C9.79724 20.7243 9.98027 20.6544 10.1711 20.6544H12.3916C12.789 20.6544 13.1112 20.9515 13.1112 21.318V27.6221C13.1112 27.9886 12.789 28.2857 12.3916 28.2857Z",fill:e?"#00C693":"white"}),f.jsx("path",{d:"M27.5647 28.2857H22.0443C21.8535 28.2857 21.6704 28.2158 21.5355 28.0914L13.9798 21.1236C13.6988 20.8645 13.6988 20.4443 13.9798 20.1851L15.7788 18.5262C15.9137 18.4017 16.0968 18.3318 16.2876 18.3318H18.21C18.4009 18.3318 18.5839 18.4017 18.7189 18.5262L28.0735 27.1529C28.5268 27.5709 28.2058 28.2857 27.5647 28.2857Z",fill:e?"#00C693":"white"}),f.jsx("path",{d:"M27.5647 7.71429H22.0443C21.8535 7.71429 21.6704 7.7842 21.5355 7.90865L13.9798 14.8764C13.6988 15.1355 13.6988 15.5557 13.9798 15.8149L15.7788 17.4738C15.9137 17.5983 16.0968 17.6682 16.2876 17.6682H18.21C18.4009 17.6682 18.5839 17.5983 18.7189 17.4738L28.0735 8.84711C28.5268 8.42907 28.2058 7.71429 27.5647 7.71429Z",fill:e?"#00C693":"white"}),f.jsx("path",{d:"M12.3916 7.71429H8.43388C8.03646 7.71429 7.71429 8.01139 7.71429 8.37788V13.08C7.71429 13.256 7.7901 13.4248 7.92505 13.5492L9.66229 15.1513C9.79724 15.2757 9.98027 15.3456 10.1711 15.3456H12.3916C12.789 15.3456 13.1112 15.0485 13.1112 14.682V8.37788C13.1112 8.01139 12.789 7.71429 12.3916 7.71429Z",fill:e?"#00C693":"white"})]}),Ur=()=>f.jsxs("div",{className:"kc-powered-by",children:["Powered by"," ",f.jsx("span",{className:"kc-powered-by-logo",onClick:()=>window.open("https://kryptos.io","_blank"),children:f.jsx(Tt,{height:"16",width:"16"})})]}),Nt=()=>f.jsxs("div",{className:"kc-footer",children:[f.jsx(Ur,{}),f.jsx(Lr,{})]}),je=({isOpen:e,onClose:t,children:n,size:r="md",closeOnOverlayClick:s=!0,closeOnEsc:i=!0,disableClose:o=!0,className:c})=>{const p=b.useCallback(l=>{!o&&s&&l.target===l.currentTarget&&t()},[o,s,t]);return b.useEffect(()=>{const l=u=>{!o&&i&&u.key==="Escape"&&t()};return e&&(document.addEventListener("keydown",l),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",l),document.body.style.overflow="unset"}},[e,o,i,t]),e?f.jsx("div",{className:"kc-modal-overlay",onClick:p,children:f.jsx("div",{className:F("kc-modal-container",`kc-modal-container--${r}`,c),children:n})}):null};je.displayName="Modal";const _e=({children:e,onClose:t,showCloseButton:n=!0,className:r})=>f.jsxs("div",{className:F("kc-modal-header",r),children:[f.jsx("div",{className:"kc-modal-title",children:e}),n&&t&&f.jsx("button",{className:"kc-modal-close",onClick:t,"aria-label":"Close modal",children:f.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]});_e.displayName="ModalHeader";const Le=({children:e,className:t})=>f.jsx("div",{className:F("kc-modal-body",t),children:e});Le.displayName="ModalBody";const Ue=({children:e,className:t})=>f.jsx("div",{className:F("kc-modal-footer",t),children:e});Ue.displayName="ModalFooter";const Ir=({...e})=>f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[f.jsx("path",{d:"m19 5 3-3"}),f.jsx("path",{d:"m2 22 3-3"}),f.jsx("path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z"}),f.jsx("path",{d:"M7.5 13.5 10 11"}),f.jsx("path",{d:"M10.5 16.5 13 14"}),f.jsx("path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z"})]}),Pr=()=>f.jsx("div",{className:"kc-connect-logo-fixed",children:f.jsx(Tt,{})}),vr=()=>{const{appName:e,appLogo:t}=B(),n=s=>{try{return new URL(s),!0}catch{return!1}},r=()=>b.isValidElement(t)?t:typeof t=="string"&&n(t)?f.jsx("img",{src:t,alt:"app-logo",width:24,height:24}):e?e.charAt(0).toUpperCase():"?";return f.jsxs("div",{className:"kc-connect-logo-container",children:[f.jsx(Pr,{}),f.jsx(Ir,{}),f.jsx("div",{className:"kc-connect-logo-dynamic",children:r()})]})},Br=({open:e,onGuestSuccess:t,onClose:n})=>{const{appName:r,setUser:s}=B(),{createAnonymousUser:i}=ke(),[o,c]=b.useState(!1),[p,l]=b.useState(""),u=()=>{n(),l("")},y=async()=>{var g,E;try{c(!0),l("");const d=await i();s(d),t()}catch(d){console.error(d),l(((E=(g=d==null?void 0:d.response)==null?void 0:g.data)==null?void 0:E.message)||"Failed to continue as guest")}finally{c(!1)}};return f.jsxs(je,{isOpen:e,onClose:u,children:[f.jsxs(_e,{onClose:u,children:[null," "]}),f.jsx(Le,{children:f.jsxs("div",{className:"kc-auth",children:[f.jsxs("div",{className:"kc-auth-title",children:["Link your accounts to"," ",f.jsx("span",{className:"kc-auth-title-app-name",children:r})," using Kryptos"]}),f.jsx(vr,{}),[{icon:f.jsx(Ar,{}),title:"Simple and secure",text:"Link your accounts in just a few clicks"},{icon:f.jsx(jr,{}),title:"Control what you share",text:"We never share your data without your permission"},{icon:f.jsx(Nr,{}),title:"View Only Access",text:"Kryptos retrieves view-only data and cannot perform any transactions on your behalf."}].map(g=>f.jsxs("div",{className:"kc-auth-info-section",children:[f.jsx("span",{className:"kc-auth-info-icon",children:g.icon}),f.jsxs("div",{className:"kc-auth-info-content",children:[f.jsx("div",{className:"kc-auth-info-title",children:g.title}),f.jsx("div",{className:"kc-auth-info-description",children:g.text})]})]},g.title)),p&&f.jsx(Ot,{variant:"destructive",children:f.jsx(Rt,{children:p})}),f.jsxs("div",{className:"kc-auth-footer",children:["By continuing, you agree to Kryptos"," ",f.jsx("a",{target:"_blank",rel:"noreferrer",href:"https://kryptos.io/privacy-policy",children:"Privacy Policy"})," ","and"," ",f.jsx("a",{target:"_blank",rel:"noreferrer",href:"https://kryptos.io/terms-of-services",children:"Terms of Service"})]}),f.jsx(pe,{onClick:y,variant:"primary",disabled:o,style:{width:"100%"},children:o?f.jsx(kr,{className:"size-4"}):"Continue"})]})}),f.jsx(Ue,{children:f.jsx(Nt,{})})]})},Fr=({open:e,onSuccess:t,onClose:n,generateLinkToken:r})=>{const{setIsInitialized:s,isInitialized:i,setLinkToken:o,setIsAuthorized:c,setUser:p}=B(),{getUserInfo:l}=ke();return b.useEffect(()=>{(async()=>{const y=await r();if(o(y.link_token),s(!0),c(!!(y!=null&&y.isAuthorized)),y.isAuthorized){const g=await l();p(g)}t(y.isAuthorized?{isAuthorized:!0}:null)})()},[]),f.jsxs(je,{isOpen:e,onClose:n,size:"sm",children:[f.jsx(_e,{onClose:n,children:"Kryptos Connect"}),f.jsx(Le,{children:f.jsxs("div",{className:"kc-init-container",children:[f.jsx("div",{className:"kc-init-spinner"}),f.jsx("p",{className:"kc-init-message",children:i?"Initialized!":"Initializing..."})]})}),f.jsx(Ue,{children:f.jsx(Nt,{})})]})},Dr=({open:e,onClose:t,onConnectSuccess:n,onConnectError:r,generateLinkToken:s,integrationName:i,currentStep:o,setCurrentStep:c})=>{const{theme:p}=B();return console.log("open",e),e?f.jsxs("div",{className:"kc-connect-flow","data-kc-theme":p,children:[o===D.INIT&&f.jsx(Fr,{open:e,generateLinkToken:s,onSuccess:l=>{l!=null&&l.isAuthorized?c(D.INTEGRATION):c(D.AUTH)},onClose:()=>t()}),o===D.AUTH&&f.jsx(Br,{open:e,onGuestSuccess:()=>c(D.INTEGRATION),onClose:()=>t()})]}):null};function Mr({generateLinkToken:e,onConnectSuccess:t,onConnectError:n,children:r,className:s,disabled:i=!1,size:o="md",integrationName:c,...p}){const{setIsInitialized:l,setIsAuthorized:u,setLinkToken:y,setUser:g,setEmail:E,setUserConsent:d}=B(),[h,m]=b.useState(!1),[x,T]=b.useState(!1),[C,O]=b.useState(D.INIT),L=async()=>{if(!i)try{m(!0),T(!0)}catch(k){console.error("Kryptos Connect Modal error:",k)}},v=()=>{T(!1),m(!1),l(!1),O(D.INIT),d(null),g(null),E(""),y("")};return f.jsxs(f.Fragment,{children:[f.jsx(pe,{onClick:L,disabled:i||h,size:o,className:s,"aria-busy":h,...p,children:h?"Connecting...":r??(c?`Connect ${c} Account`:"Connect with Kryptos")}),f.jsx(Dr,{open:x,onClose:v,onConnectSuccess:t,onConnectError:n,generateLinkToken:e,integrationName:c,currentStep:C,setCurrentStep:O})]})}I.Button=pe,I.KryptosConnectButton=Mr,I.KryptosConnectProvider=Ht,I.useKryptosApi=ke,I.useKryptosContext=B,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";@keyframes kc-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.kc-animate-spin{animation:kc-spin 1s linear infinite}:root,[data-kc-theme=light]{--kc-bg-primary: #ffffff;--kc-bg-secondary: #f9fafb;--kc-bg-tertiary: #e5e7eb;--kc-bg-hover: #f3f4f6;--kc-text-primary: #1f2937;--kc-text-secondary: #4b5563;--kc-text-tertiary: #9ca3af;--kc-text-inverse: #ffffff;--kc-border: #e5e7eb;--kc-border-focus: #00c693;--kc-primary: #00c693;--kc-primary-hover: #007558;--kc-primary-light: #42ffd0;--kc-primary-text: #ffffff;--kc-primary-rgb: 59, 130, 246;--kc-secondary: #4b5563;--kc-secondary-hover: #1f2937;--kc-success: #22c55e;--kc-success-light: #86efac;--kc-success-dark: #15803d;--kc-error: #ef4444;--kc-error-light: #fca5a5;--kc-error-dark: #b91c1c;--kc-warning: #f59e0b;--kc-warning-light: #fcd34d;--kc-warning-dark: #d97706;--kc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .05);--kc-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1);--kc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1)}[data-kc-theme=dark]{--kc-bg-primary: #0a0a0a;--kc-bg-secondary: #1a1a1d;--kc-bg-tertiary: #030405;--kc-bg-hover: #2e2e2e;--kc-text-primary: #f6f6f8;--kc-text-secondary: #e5e7eb;--kc-text-tertiary: #9ca3af;--kc-text-inverse: #1f2937;--kc-border: #334155;--kc-border-focus: #42ffd0;--kc-primary: #00c693;--kc-primary-hover: #42ffd0;--kc-primary-light: #42ffd0;--kc-primary-text: #ffffff;--kc-primary-rgb: 59, 130, 246;--kc-secondary: #4b5563;--kc-secondary-hover: #9ca3af;--kc-success: #22c55e;--kc-success-light: #86efac;--kc-success-dark: #15803d;--kc-error: #ef4444;--kc-error-light: #fca5a5;--kc-error-dark: #b91c1c;--kc-warning: #f59e0b;--kc-warning-light: #fcd34d;--kc-warning-dark: #d97706;--kc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .3);--kc-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .3);--kc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .3)}.kc-theme-wrapper *{transition:background-color .2s cubic-bezier(.4,0,.2,1),border-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1)}.kc-button{display:inline-flex;align-items:center;justify-content:center;border:none;font-weight:500;border-radius:.5rem;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1);font-family:inherit;text-decoration:none;white-space:nowrap}.kc-button:focus{outline:none;box-shadow:0 0 0 3px #4ef63b4d}.kc-button:disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.kc-button--sm{font-size:.75rem;padding:0 .75rem;height:36px;gap:.5rem}.kc-button--md{font-size:.875rem;padding:0 1rem;height:38px;gap:.5rem}.kc-button--lg{font-size:.875rem;padding:0 1.25rem;height:40px;gap:.5rem}.kc-button--primary{background-color:var(--kc-primary);color:var(--kc-primary-text)}.kc-button--primary:hover:not(:disabled){background-color:var(--kc-primary-hover)}.kc-button--secondary{background-color:var(--kc-secondary);color:#fff}.kc-button--secondary:hover:not(:disabled){background-color:var(--kc-secondary-hover)}.kc-button--outline{background-color:transparent;border:1px solid var(--kc-border);color:var(--kc-text-primary)}.kc-button--outline:hover:not(:disabled){background-color:var(--kc-bg-hover)}.kc-button--ghost{background-color:transparent;color:var(--kc-text-primary)}.kc-button--ghost:hover:not(:disabled){background-color:var(--kc-bg-hover)}.kc-button--success{background-color:var(--kc-success);color:#fff}.kc-button--success:hover:not(:disabled){background-color:var(--kc-success-dark)}.kc-button--error{background-color:var(--kc-error);color:#fff}.kc-button--error:hover:not(:disabled){background-color:var(--kc-error-dark)}.kc-card{background-color:var(--kc-bg-primary);border:1px solid var(--kc-border);border-radius:.75rem;padding:1rem;box-shadow:var(--kc-shadow-sm)}.kc-card--hoverable{cursor:pointer;transition:border-color .2s cubic-bezier(.4,0,.2,1)}.kc-card--hoverable:hover{border-color:var(--kc-primary)}.kc-card--bordered{border:2px solid var(--kc-border)}.kc-card-header{margin-bottom:.75rem;padding-bottom:.5rem;border-bottom:1px solid var(--kc-border)}.kc-card-title{font-size:1rem;font-weight:600;color:var(--kc-text-primary);margin:0;text-align:left}.kc-card-description{font-size:.75rem;color:var(--kc-text-secondary);margin-top:.5rem;text-align:left}.kc-card-content{color:var(--kc-text-primary)}.kc-card-footer{margin-top:.75rem;padding-top:.5rem;border-top:1px solid var(--kc-border)}.kc-accordion{display:flex;flex-direction:column;width:100%;border:1px solid var(--kc-border);border-radius:.5rem;background-color:var(--kc-background)}.kc-accordion-item{border:none;border-bottom:1px solid var(--kc-border);border-radius:0;transition:background-color .2s cubic-bezier(.4,0,.2,1);background-color:var(--kc-background)}.kc-accordion-item:last-child{border-bottom:none}.kc-accordion-item--open{background-color:var(--kc-background)}.kc-accordion-item--disabled{opacity:.5;pointer-events:none}.kc-accordion-trigger{width:100%;display:flex;align-items:center;justify-content:space-between;padding:.75rem;background-color:transparent;border:none;cursor:pointer;font-size:.875rem;font-weight:500;color:var(--kc-text-primary);text-align:left;transition:background-color .2s cubic-bezier(.4,0,.2,1);outline:none;height:40px}.kc-accordion-trigger:hover{background-color:#00000005}.kc-accordion-trigger:focus-visible{outline:none!important}.kc-accordion-trigger:focus{outline:none!important}.kc-accordion-trigger-text{flex:1}.kc-accordion-trigger-icon{display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-left:.5rem;transition:transform .2s cubic-bezier(.4,0,.2,1);color:#9ca3af}.kc-accordion-trigger-icon svg{width:20px;height:20px}.kc-accordion-trigger-icon--open{transform:rotate(180deg)}.kc-accordion-content-wrapper{overflow:hidden;transition:height .2s cubic-bezier(.4,0,.2,1)}.kc-accordion-content{padding:0 .75rem .5rem;color:var(--kc-text-secondary);font-size:.75rem;line-height:1.6}.kc-accordion-content p{margin:0 0 .75rem}.kc-accordion-content p:last-child{margin-bottom:0}.kc-input-wrapper{display:flex;flex-direction:column;width:100%}.kc-input-label{display:block;font-size:.875rem;font-weight:500;color:var(--kc-text-primary);margin-bottom:.25rem}.kc-input{width:100%;padding:0 .75rem;height:38px;font-size:.875rem;font-family:inherit;color:var(--kc-text-primary);background-color:var(--kc-bg-primary);border:1px solid var(--kc-border);border-radius:.5rem;transition:all .2s cubic-bezier(.4,0,.2,1)}.kc-input::placeholder{color:var(--kc-text-tertiary)}.kc-input:focus{outline:none;border-color:var(--kc-border-focus);box-shadow:0 0 0 3px #3b82f61a}.kc-input:disabled{opacity:.6;cursor:not-allowed;background-color:var(--kc-bg-secondary)}.kc-input--error{border-color:var(--kc-error)}.kc-input--error:focus{border-color:var(--kc-error);box-shadow:0 0 0 3px #ef44441a}.kc-input--success{border-color:var(--kc-success)}.kc-input--success:focus{border-color:var(--kc-success);box-shadow:0 0 0 3px #22c55e1a}.kc-input-helper{font-size:.875rem;margin-top:.25rem;color:var(--kc-text-secondary)}.kc-input-error{font-size:.875rem;margin-top:.25rem;color:var(--kc-error)}input:-webkit-autofill{-webkit-box-shadow:0 0 0 1000px rgba(59,130,246,.1) inset!important;-webkit-text-fill-color:var(--kc-text-primary)!important;transition:background-color 9999s ease-in-out 0s}.kc-otp-wrapper{display:flex;flex-direction:column;gap:.5rem}.kc-otp-label{font-size:.75rem;font-weight:500;color:var(--kc-text-primary)}.kc-otp-container{display:flex;gap:.75rem;justify-content:center;align-items:center}.kc-otp-input{width:2.5rem;height:2.5rem;text-align:center;font-size:1.125rem;font-weight:600;font-family:inherit;color:var(--kc-text-primary);background-color:var(--kc-bg-primary);border:1.5px solid var(--kc-border);border-radius:.5rem;transition:all .2s cubic-bezier(.4,0,.2,1)}.kc-otp-input:focus{outline:none;border-color:var(--kc-border-focus);box-shadow:0 0 0 3px #3b82f61a}.kc-otp-input:disabled{opacity:.6;cursor:not-allowed;background-color:var(--kc-bg-secondary)}.kc-otp-input--error{border-color:var(--kc-error)}.kc-otp-input--error:focus{border-color:var(--kc-error);box-shadow:0 0 0 3px #ef44441a}.kc-otp-input--success{border-color:var(--kc-success)}.kc-otp-error{font-size:.875rem;color:var(--kc-error);text-align:center}.kc-modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:9999;padding:1rem;animation:kc-modal-fade-in .2s ease-out}.kc-modal-container{background-color:var(--kc-bg-primary);border-radius:.75rem;box-shadow:var(--kc-shadow-lg);width:100%;max-width:420px;max-height:90vh;height:600px;overflow:hidden;display:flex;flex-direction:column;animation:kc-modal-scale-in .2s ease-out}.kc-modal-header{padding:1rem 1.25rem;border-bottom:1px solid var(--kc-border);display:flex;align-items:center;justify-content:space-between}.kc-modal-title{font-size:1.125rem;font-weight:600;color:var(--kc-text-primary);margin:0;display:flex;align-items:center}.kc-modal-close{background:none;border:none;cursor:pointer;padding:.25rem;color:var(--kc-text-secondary);display:flex;align-items:center;justify-content:center;border-radius:.25rem;transition:all .2s cubic-bezier(.4,0,.2,1)}.kc-modal-close:hover{background-color:var(--kc-bg-hover);color:var(--kc-text-primary)}.kc-modal-close:focus{outline:none;box-shadow:0 0 0 3px #3b82f61a}.kc-modal-body{padding:1.25rem;overflow-y:auto;flex:1;color:var(--kc-text-primary)}.kc-modal-footer{border-top:1px solid var(--kc-border);display:flex;gap:.75rem;justify-content:flex-end}@keyframes kc-modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes kc-modal-scale-in{0%{transform:scale(.95);opacity:0}to{transform:scale(1);opacity:1}}.kc-alert{position:relative;width:100%;border-radius:.5rem;border:1px solid var(--kc-border);padding:.5rem;background-color:var(--kc-bg-primary);color:var(--kc-text-primary);font-size:.75rem;line-height:1.4}.kc-alert--default{background-color:var(--kc-bg-primary);border-color:var(--kc-border)}.kc-alert--destructive{border-color:var(--kc-error-light);color:var(--kc-error-dark);background-color:#ef44440d}[data-kc-theme=dark] .kc-alert--destructive{border-color:var(--kc-error-dark);color:var(--kc-error-light);background-color:#ef44441a}.kc-alert--destructive .kc-alert-title{color:var(--kc-error)}.kc-alert-title{margin:.75rem;font-weight:600;font-size:.875rem;line-height:1.3;letter-spacing:-.025em;color:var(--kc-text-primary)}.kc-alert-title:only-child{margin-bottom:0}.kc-alert-description{font-size:.75rem;line-height:1.4;color:var(--kc-text-secondary);text-align:center}.kc-alert-description:only-child{margin:0}.kc-alert-title+.kc-alert-description{margin-top:.25rem}.kc-logo{display:inline-flex;align-items:center;gap:.25rem;text-decoration:none;transition:all .2s cubic-bezier(.4,0,.2,1)}.kc-logo:focus{outline:none;opacity:.8}.kc-logo--clickable{cursor:pointer}.kc-logo--clickable:hover{opacity:.8}.kc-logo--sm .kc-logo-image{width:20px;height:20px}.kc-logo--sm .kc-logo-text{font-size:.75rem}.kc-logo--md .kc-logo-image{width:28px;height:28px}.kc-logo--md .kc-logo-text{font-size:.875rem}.kc-logo--lg .kc-logo-image{width:40px;height:40px}.kc-logo--lg .kc-logo-text{font-size:1rem}.kc-logo--xl .kc-logo-image{width:56px;height:56px}.kc-logo--xl .kc-logo-text{font-size:1.125rem}.kc-logo-image{display:block;object-fit:contain}.kc-logo-text{font-weight:700;color:var(--kc-text-primary);line-height:1}.kc-sandbox-mode{font-size:.75rem;font-weight:500;padding:2px .5rem;border-radius:.25rem;background-color:var(--kc-warning-bg, rgba(251, 191, 36, .1));color:var(--kc-warning, #f59e0b);border:1px solid var(--kc-warning-border, rgba(251, 191, 36, .2));white-space:nowrap;text-transform:uppercase;letter-spacing:.025em;text-align:center}.kc-powered-by{font-size:.75rem;color:var(--kc-text-secondary);line-height:1.5;text-align:center;width:80%;margin:0 auto;display:flex;align-items:center;justify-content:center;gap:.25rem;padding:.5rem 0}.kc-powered-by .kc-powered-by-logo{cursor:pointer;display:flex;align-items:center}.kc-powered-by .kc-powered-by-logo:hover{opacity:.8}.kc-footer{width:100%}.kc-connect-logo-container{display:flex;align-items:center;justify-content:center;gap:.75rem}.kc-connect-logo-fixed{width:40px;height:40px;display:flex;align-items:center;justify-content:center;color:var(--kc-text-primary)}.kc-connect-logo-dynamic{font-size:.875rem;font-weight:600;display:flex;align-items:center;justify-content:center;color:var(--kc-text-primary);width:40px;height:40px}.kc-connect-logo-dynamic img{width:100%!important;height:100%!important;object-fit:contain}.kc-connect-logo-fixed--true{width:40px;height:40px;display:flex;align-items:center;justify-content:center;color:var(--kc-text-primary)}.kc-init-container{display:flex;flex-direction:column;align-items:center;padding:1.25rem;min-height:120px;gap:1rem;min-height:100%;justify-content:center}.kc-init-spinner{width:32px;height:32px;border:2.5px solid var(--kc-border);border-top-color:var(--kc-primary);border-radius:9999px;animation:kc-spin .8s linear infinite}[data-kc-theme=dark] .kc-init-spinner{border-color:var(--kc-border);border-top-color:var(--kc-primary)}@keyframes kc-spin{to{transform:rotate(360deg)}}.kc-init-message{margin:0;font-size:.875rem;font-weight:500;color:var(--kc-text-primary);text-align:center;line-height:1.4}.kc-connect-flow{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;font-family:system-ui,-apple-system,sans-serif;isolation:isolate}.kc-connect-custom-trigger-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1);border:none;background:none;padding:0;color:var(--kc-text-primary);width:max-content}.kc-connect-custom-trigger-btn:hover{opacity:.9}.kc-connect-custom-trigger-btn:active{transform:scale(.98)}.kc-connect-custom-trigger-btn:disabled{opacity:.5;cursor:not-allowed}.kc-connect-custom-trigger-btn:focus-visible{outline:2px solid var(--kc-primary);outline-offset:2px;border-radius:.25rem}.kc-connect-default-trigger-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1);text-transform:capitalize}.kc-connect-btn-content{display:flex;align-items:center;justify-content:center;gap:.25rem;font-weight:500;padding:.25rem .5rem}.kc-auth{display:flex;flex-direction:column;align-items:stretch;width:100%;padding:0;gap:1rem;min-height:100%;justify-content:center}.kc-auth .kc-auth-title{font-size:1rem;font-weight:500;color:var(--kc-text-primary);text-align:center}.kc-auth .kc-auth-title-app-name{font-weight:700}.kc-auth .kc-auth-info-section{display:flex;align-items:flex-start;gap:.75rem;width:100%;padding:.75rem;border-radius:.5rem;background-color:var(--kc-bg-secondary)}.kc-auth .kc-auth-info-icon{display:flex;align-items:center;justify-content:center;width:32px;height:32px;min-width:32px;border-radius:.5rem;border:1px solid var(--kc-border);color:var(--kc-primary)}.kc-auth .kc-auth-info-icon svg{width:18px;height:18px}.kc-auth .kc-auth-info-content{flex:1;display:flex;flex-direction:column;gap:.25rem;text-align:left}.kc-auth .kc-auth-info-title{font-size:.875rem;font-weight:600;color:var(--kc-text-primary);line-height:1.3;text-align:left}.kc-auth .kc-auth-info-description{font-size:.75rem;color:var(--kc-text-secondary);line-height:1.4;text-align:left}.kc-auth .kc-auth-form{width:100%;display:flex;flex-direction:column;gap:.75rem}.kc-auth .kc-auth-error{color:var(--kc-error);font-size:.875rem;margin-top:.25rem}.kc-auth .kc-auth-footer{font-size:.75rem;color:var(--kc-text-secondary);line-height:1.5;text-align:center;width:80%;margin:0 auto}.kc-auth .kc-auth-footer a{color:var(--kc-primary);text-decoration:none;font-weight:500}.kc-auth .kc-auth-footer a:hover{text-decoration:underline}.kc-otp-verify{display:flex;flex-direction:column;align-items:stretch;width:100%;padding:0;gap:1rem}.kc-otp-verify .kc-otp-email-info{margin-bottom:0}.kc-otp-verify .kc-otp-email-info p{margin:0;font-size:.75rem;color:var(--kc-text-secondary);line-height:1.4}.kc-otp-verify .kc-otp-email-info p.kc-otp-email-address{font-weight:600;color:var(--kc-text-primary);margin-top:.25rem}.kc-otp-verify form{width:100%;display:flex;flex-direction:column;gap:.75rem}.kc-otp-verify .kc-otp-resend-container{margin-top:0;text-align:left;display:flex;justify-content:center}.kc-permissions{display:flex;flex-direction:column;align-items:stretch;width:100%;padding:0;gap:1rem}.kc-permissions .kc-permissions-list{width:100%;padding:.75rem;border-radius:.5rem;background-color:var(--kc-bg-secondary);border:1px solid var(--kc-border)}.kc-permissions .kc-permissions-subtitle{margin:0 0 .75rem;font-size:.875rem;font-weight:600;color:var(--kc-text-primary);line-height:1.3;text-align:left}.kc-permissions .kc-permissions-items{margin:0;padding-left:1.25rem;list-style-type:decimal}.kc-permissions .kc-permissions-items li{font-size:.75rem;color:var(--kc-text-secondary);line-height:1.5;margin-bottom:.5rem;text-align:left}.kc-permissions .kc-permissions-items li:last-child{margin-bottom:0}.kc-permissions .kc-permissions-items li::marker{color:var(--kc-primary);font-weight:600}.kc-permissions .kc-permissions-info{width:100%;padding:.75rem;border-radius:.5rem;background-color:var(--kc-bg-secondary);border:1px solid var(--kc-border);font-size:.75rem;color:var(--kc-text-secondary);line-height:1.4;text-align:left}.kc-permissions .kc-permissions-info strong{color:var(--kc-primary);font-weight:600}.kc-status-modal{display:flex;flex-direction:column;align-items:center;width:100%;padding:1rem 0;gap:1.25rem;text-align:center;min-height:100%;justify-content:center}.kc-status-modal .kc-status-icon{display:flex;align-items:center;justify-content:center;min-width:100px;min-height:100px;height:100px;width:100px;margin:0 auto;animation:kc-status-appear .4s ease-out}.kc-status-modal .kc-status-icon svg{width:100%;height:100%}.kc-status-modal .kc-status-icon--success{color:var(--kc-success)}.kc-status-modal .kc-status-icon--success svg{filter:drop-shadow(0 4px 12px rgba(34,197,94,.2))}.kc-status-modal .kc-status-icon--error{color:var(--kc-error)}.kc-status-modal .kc-status-icon--error svg{filter:drop-shadow(0 4px 12px rgba(239,68,68,.2))}.kc-status-modal .kc-status-message{margin:0;font-size:1rem;font-weight:600;color:var(--kc-text-primary);line-height:1.3}.kc-status-modal .kc-status-message-description{margin:0;font-size:.875rem;font-weight:500;color:var(--kc-text-secondary);line-height:1.3}@keyframes kc-status-appear{0%{opacity:0;transform:scale(.8)}50%{transform:scale(1.05)}to{opacity:1;transform:scale(1)}}.kc-status-modal-container{height:auto!important}.kc-add-integration-form{display:flex;flex-direction:column;gap:.75rem;width:100%;min-height:100%;justify-content:space-between;flex:1}.kc-integration-header{display:flex;align-items:center;justify-content:flex-start;gap:.5rem;text-transform:capitalize;font-size:.875rem;font-weight:500;color:var(--kc-text-primary)}.kc-add-integration-header{display:flex;flex-direction:column;gap:.75rem;width:100%;height:100%;flex:1}.kc-integration-logo{width:20px;height:20px;object-fit:contain}.kc-integration-name{color:var(--kc-text-primary)}.kc-field-error{font-size:.875rem;color:var(--kc-error);margin-top:.25rem}.kc-chain-selection{display:flex;flex-direction:column;gap:.5rem;margin-top:0}.kc-chain-selection-title{font-size:.75rem;font-weight:500;color:var(--kc-text-primary);text-align:left}.kc-chain-chips{display:flex;flex-wrap:wrap;gap:.5rem}.kc-chain-chip{display:inline-flex;align-items:center;gap:.25rem;padding:6px .5rem;border-radius:.25rem;border:1px solid var(--kc-border);background-color:var(--kc-background);font-size:.75rem;cursor:pointer;transition:border-color .2s ease;opacity:.7}.kc-chain-chip--selected{opacity:1;border-color:var(--kc-primary);background-color:var(--kc-bg-secondary)}.kc-chain-chip--selected .kc-chain-chip-name{font-weight:500;color:var(--kc-primary)}.kc-chain-chip--selected svg{color:var(--kc-primary)!important}.kc-chain-chip--error{opacity:1;border-color:var(--kc-error);background-color:var(--kc-bg-secondary)}.kc-chain-chip--error .kc-chain-chip-name{color:var(--kc-error)}.kc-chain-chip-name{color:var(--kc-text-primary)}.kc-chain-chip-btn{background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center;color:var(--kc-text-secondary)}.kc-chain-chip-btn svg{width:14px;height:14px}.kc-chain-errors{margin-top:.75rem;padding:.75rem;background-color:var(--kc-bg-secondary);border-radius:.5rem;border:1px solid var(--kc-error)}.kc-chain-errors-title{font-size:.75rem;font-weight:500;color:var(--kc-error);margin-bottom:.5rem;text-align:left}.kc-chain-error-item{font-size:.75rem;color:var(--kc-error);margin-top:.25rem;text-align:left}.kc-chain-chip--remove-all{border:none!important;color:var(--kc-primary)!important;opacity:1;width:max-content;padding:0}.kc-chain-chip--remove-all .kc-chain-chip-name{color:var(--kc-primary)!important}.kc-chain-chip--remove-all svg{color:var(--kc-primary)!important}.kc-chain-chip--remove-all:hover{opacity:.8}.kc-integration{display:flex;flex-direction:column;width:100%;gap:.5rem;min-height:100%}.kc-integration-title{text-align:left;font-size:1rem;font-weight:500;color:var(--kc-text-primary)}.kc-integration-list{display:flex;flex-direction:column;overflow-y:auto;height:60%;gap:.5rem;max-height:255px;padding:2px}.kc-integration-item{display:flex;justify-content:space-between;align-items:center;gap:.75rem;padding:.5rem .75rem;border:1px solid var(--kc-border);border-radius:.5rem;cursor:pointer;transition:border-color .2s cubic-bezier(.4,0,.2,1);background-color:var(--kc-background)}.kc-integration-item:hover{border-color:var(--kc-primary)}.kc-integration-item-info{display:flex;align-items:center;gap:.5rem}.kc-integration-item-logo{width:20px;height:20px;object-fit:contain;flex-shrink:0}.kc-integration-item-name{font-size:.875rem;font-weight:500;color:var(--kc-text-primary);text-transform:capitalize}.kc-integration-item-status{display:flex;align-items:center;gap:4px;color:var(--kc-success);font-size:.75rem;font-weight:500}.kc-integration-item-status svg{width:16px;height:16px}.kc-integration-item-status p{margin:0;color:var(--kc-text-secondary)}.kc-integration-empty{text-align:center;margin-bottom:.75rem;margin-top:.75rem}.kc-integration-empty p{font-size:.875rem;color:var(--kc-text-secondary);margin:0}.kc-integration-loading{display:flex;justify-content:center;margin-top:.75rem}@keyframes kc-skeleton-pulse{0%,to{opacity:1}50%{opacity:.5}}.kc-integration-item-skeleton{cursor:default;pointer-events:none;animation:kc-skeleton-pulse 2s cubic-bezier(.4,0,.6,1) infinite}.kc-integration-item-skeleton:hover{border-color:var(--kc-border)}.kc-skeleton-circle{background-color:var(--kc-border);border-radius:50%;display:flex;align-items:center;justify-content:center}.kc-skeleton-text{background-color:var(--kc-border);border-radius:.25rem;height:16px;width:120px}.kc-integration-continue-btn{width:100%}.kc-integration-tabs{display:flex;gap:1rem;justify-content:flex-start;align-items:center;width:100%;margin-bottom:.25rem;margin-top:.25rem}.kc-integration-tab{cursor:pointer;font-size:.875rem;font-weight:500;color:var(--kc-text-secondary);padding-bottom:.25rem}.kc-integration-tab-active{color:var(--kc-primary);border-bottom:2px solid var(--kc-primary)}.kc-add-integration-footer{display:flex;flex-direction:column;gap:.5rem}.kc-integration-info-import-guide{color:var(--kc-primary);font-size:.875rem;font-weight:500;cursor:pointer;text-align:right;display:flex;align-items:center;gap:.25rem;max-width:max-content;place-self:end}.kc-integration-info-import-guide:hover{text-decoration:underline}.kc-integration-info-video-link{display:inline-flex;align-items:center;gap:.25rem;padding:.5rem .75rem;color:var(--kc-primary);text-decoration:none;border-radius:.5rem;font-size:.75rem;font-weight:500;transition:background-color .2s cubic-bezier(.4,0,.2,1)}.kc-integration-info-video-link:before{content:"▶";font-size:.75rem}.kc-integration-info-list{margin:0;padding-left:1rem;list-style-position:outside}.kc-integration-info-list li{margin-bottom:.25rem;line-height:1.6;color:var(--kc-text-secondary)}.kc-integration-info-list li:last-child{margin-bottom:0}.kc-integration-info-list:is(ol){list-style-type:decimal}.kc-integration-info-list:is(ol) li{padding-left:.25rem}.kc-integration-info-list:is(ul){list-style-type:disc}.kc-integration-info-list:is(ul) li{padding-left:.25rem}.kc-wallet-connect-integrations{display:flex;flex-direction:column;gap:.75rem;width:100%;min-height:100%;justify-content:space-between;flex:1}.kc-wallet-connect-header,.kc-wallet-connect-footer{display:flex;flex-direction:column;gap:.75rem;width:100%}.kc-wallet-connect-loading{display:flex;align-items:center;justify-content:center;padding:.5rem;gap:.25rem;color:var(--kc-text-secondary)}.kc-wallet-connect-address{color:var(--kc-text-primary);font-size:1rem;margin:0;text-align:center}.kc-wallet-connect-btn{text-transform:capitalize}[data-kc-theme=dark] .kc-wallet-connect-loading{color:var(--kc-text-secondary)}.kryptos-sdk-container{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}.kryptos-sdk-container *,.kryptos-sdk-container *:before,.kryptos-sdk-container *:after{box-sizing:border-box}.kc-connect-flow a{color:var(--kc-primary);text-decoration:none}.kc-connect-flow a:hover{text-decoration:underline}webkit-scrollbar{display:none}::-webkit-scrollbar{width:10px;height:10px;background-color:var(--kc-bg-secondary);box-shadow:0 0 10px #0000001a;transition:all .3s ease}::-webkit-scrollbar-track{background-color:var(--kc-bg-secondary)}::-webkit-scrollbar-thumb{background-color:var(--kc-bg-secondary);border-radius:5px;border:1px solid var(--kc-border);padding:5px;margin:5px;box-shadow:0 0 10px #0000001a;transition:all .3s ease}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { ComponentType, useEffect, useState } from "react";
|
|
2
|
+
import { isKryptosSDKLoaded, loadKryptosSDK } from "./load-remote";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Kryptos Connect SDK - NPM Wrapper
|
|
6
|
+
*
|
|
7
|
+
* This wrapper dynamically loads the SDK from CDN and provides React components.
|
|
8
|
+
* React and ReactDOM are automatically exposed as globals by load-remote.ts
|
|
9
|
+
* to ensure compatibility with the UMD bundle.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// Type definitions
|
|
13
|
+
export interface KryptosConfig {
|
|
14
|
+
theme: "light" | "dark" | "auto";
|
|
15
|
+
clientId?: string;
|
|
16
|
+
environment?: "sandbox" | "production";
|
|
17
|
+
baseUrl?: string;
|
|
18
|
+
appName: string;
|
|
19
|
+
appLogo?: React.ReactNode | string;
|
|
20
|
+
walletConnectProjectId: string;
|
|
21
|
+
[key: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface KryptosConnectProviderProps {
|
|
25
|
+
config: KryptosConfig;
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface KryptosConnectButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
30
|
+
generateLinkToken: () => Promise<{
|
|
31
|
+
link_token: string;
|
|
32
|
+
isAuthorized?: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
onConnectSuccess: (data: any) => void;
|
|
35
|
+
onConnectError: (error: Error) => void;
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
size?: "sm" | "md" | "lg";
|
|
38
|
+
integrationName?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface KryptosSDK {
|
|
42
|
+
KryptosConnectProvider: ComponentType<KryptosConnectProviderProps>;
|
|
43
|
+
KryptosConnectButton: ComponentType<KryptosConnectButtonProps>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// HOC to wrap components with SDK loader
|
|
47
|
+
function withSDKLoader<P extends object>(
|
|
48
|
+
componentName: keyof KryptosSDK,
|
|
49
|
+
): React.FC<P> {
|
|
50
|
+
return (props: P) => {
|
|
51
|
+
const [sdk, setSdk] = useState<KryptosSDK | null>(null);
|
|
52
|
+
const [error, setError] = useState<Error | null>(null);
|
|
53
|
+
const [isLoading, setIsLoading] = useState(!isKryptosSDKLoaded());
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
// Skip loading in SSR
|
|
57
|
+
if (typeof window === "undefined") {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// If already loaded, use it immediately
|
|
62
|
+
if (isKryptosSDKLoaded()) {
|
|
63
|
+
const loadedSDK = (window as any).__KRYPTOS_SDK__;
|
|
64
|
+
setSdk(loadedSDK);
|
|
65
|
+
setIsLoading(false);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Load SDK from CDN
|
|
70
|
+
loadKryptosSDK()
|
|
71
|
+
.then((loadedSDK) => {
|
|
72
|
+
setSdk(loadedSDK);
|
|
73
|
+
setIsLoading(false);
|
|
74
|
+
})
|
|
75
|
+
.catch((err) => {
|
|
76
|
+
setError(err);
|
|
77
|
+
setIsLoading(false);
|
|
78
|
+
console.error("Failed to load Kryptos SDK:", err);
|
|
79
|
+
});
|
|
80
|
+
}, []);
|
|
81
|
+
|
|
82
|
+
// SSR: return null
|
|
83
|
+
if (typeof window === "undefined") {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Loading state
|
|
88
|
+
if (isLoading) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Error state
|
|
93
|
+
if (error) {
|
|
94
|
+
console.error("Kryptos SDK Error:", error);
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// SDK not loaded
|
|
99
|
+
if (!sdk || !sdk[componentName]) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const Component = sdk[componentName] as ComponentType<P>;
|
|
104
|
+
return <Component {...props} />;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Export wrapped components
|
|
109
|
+
export const KryptosConnectProvider =
|
|
110
|
+
withSDKLoader<KryptosConnectProviderProps>("KryptosConnectProvider");
|
|
111
|
+
|
|
112
|
+
export const KryptosConnectButton = withSDKLoader<KryptosConnectButtonProps>(
|
|
113
|
+
"KryptosConnectButton",
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
// Export utility functions
|
|
117
|
+
export { isKryptosSDKLoaded, loadKryptosSDK } from "./load-remote";
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamically loads the Kryptos SDK from the CDN
|
|
3
|
+
* SSR-safe: only runs in browser environment
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import ReactDOM from "react-dom";
|
|
8
|
+
|
|
9
|
+
// For local testing, use the local build output
|
|
10
|
+
// For production, use the remote CDN URL
|
|
11
|
+
// The dev server (Vite/Next.js) should serve /dist from the root project
|
|
12
|
+
const CDN_BASE_URL =
|
|
13
|
+
// process.env.NODE_ENV === "production"
|
|
14
|
+
// ?
|
|
15
|
+
"https://assets.kryptos.io/kryptos-connect/web";
|
|
16
|
+
// : typeof window !== "undefined" && window.location.origin
|
|
17
|
+
// ? `${window.location.origin}/dist`
|
|
18
|
+
// : "http://localhost:5001/dist";
|
|
19
|
+
|
|
20
|
+
const CDN_JS_URL = `${CDN_BASE_URL}/kryptos-sdk.umd.js`;
|
|
21
|
+
const CDN_CSS_URL = `${CDN_BASE_URL}/style.css`;
|
|
22
|
+
|
|
23
|
+
const GLOBAL_NAME = "__KRYPTOS_SDK__";
|
|
24
|
+
|
|
25
|
+
let loadingPromise: Promise<any> | null = null;
|
|
26
|
+
let isLoaded = false;
|
|
27
|
+
let cssLoaded = false;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Ensure React and ReactDOM are available globally for the UMD bundle
|
|
31
|
+
* The CDN-loaded UMD bundle expects React and ReactDOM as global variables
|
|
32
|
+
*/
|
|
33
|
+
function ensureReactGlobals(): void {
|
|
34
|
+
if (typeof window === "undefined") return;
|
|
35
|
+
|
|
36
|
+
if (!(window as any).React) {
|
|
37
|
+
(window as any).React = React;
|
|
38
|
+
console.log("[Kryptos SDK] Exposed React globally for UMD bundle");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!(window as any).ReactDOM) {
|
|
42
|
+
(window as any).ReactDOM = ReactDOM;
|
|
43
|
+
console.log("[Kryptos SDK] Exposed ReactDOM globally for UMD bundle");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Dynamically load CSS file
|
|
49
|
+
*/
|
|
50
|
+
function loadCSS(): Promise<void> {
|
|
51
|
+
if (cssLoaded) {
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
const link = document.createElement("link");
|
|
57
|
+
link.rel = "stylesheet";
|
|
58
|
+
link.href = CDN_CSS_URL;
|
|
59
|
+
|
|
60
|
+
link.onload = () => {
|
|
61
|
+
cssLoaded = true;
|
|
62
|
+
resolve();
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
link.onerror = () => {
|
|
66
|
+
reject(new Error(`Failed to load CSS from ${CDN_CSS_URL}`));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
document.head.appendChild(link);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Loads the Kryptos SDK from CDN
|
|
75
|
+
* Returns a promise that resolves when the SDK is loaded
|
|
76
|
+
*/
|
|
77
|
+
export function loadKryptosSDK(): Promise<any> {
|
|
78
|
+
// Check if we're in a browser environment
|
|
79
|
+
if (typeof window === "undefined") {
|
|
80
|
+
return Promise.reject(new Error("loadKryptosSDK can only run in browser"));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// If already loaded, return the SDK
|
|
84
|
+
if (isLoaded && (window as any)[GLOBAL_NAME]) {
|
|
85
|
+
return Promise.resolve((window as any)[GLOBAL_NAME]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// If loading is in progress, return the existing promise
|
|
89
|
+
if (loadingPromise) {
|
|
90
|
+
return loadingPromise;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Start loading
|
|
94
|
+
loadingPromise = new Promise((resolve, reject) => {
|
|
95
|
+
// First, ensure React globals are available for the UMD bundle
|
|
96
|
+
ensureReactGlobals();
|
|
97
|
+
|
|
98
|
+
// Then load CSS
|
|
99
|
+
loadCSS()
|
|
100
|
+
.then(() => {
|
|
101
|
+
// Check if SDK is already loaded (e.g., by another instance)
|
|
102
|
+
if ((window as any)[GLOBAL_NAME]) {
|
|
103
|
+
isLoaded = true;
|
|
104
|
+
resolve((window as any)[GLOBAL_NAME]);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Create script tag
|
|
109
|
+
const script = document.createElement("script");
|
|
110
|
+
script.src = CDN_JS_URL;
|
|
111
|
+
script.async = true;
|
|
112
|
+
|
|
113
|
+
script.onload = () => {
|
|
114
|
+
// Check if the SDK was loaded successfully
|
|
115
|
+
const sdk = (window as any)[GLOBAL_NAME];
|
|
116
|
+
if (sdk) {
|
|
117
|
+
isLoaded = true;
|
|
118
|
+
resolve(sdk);
|
|
119
|
+
} else {
|
|
120
|
+
reject(
|
|
121
|
+
new Error(
|
|
122
|
+
`SDK script loaded but ${GLOBAL_NAME} not found on window`,
|
|
123
|
+
),
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
script.onerror = () => {
|
|
129
|
+
reject(new Error(`Failed to load SDK from ${CDN_JS_URL}`));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Append to document
|
|
133
|
+
document.head.appendChild(script);
|
|
134
|
+
})
|
|
135
|
+
.catch((error) => {
|
|
136
|
+
reject(error);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return loadingPromise;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Gets the loaded SDK
|
|
145
|
+
* Returns null if not loaded yet
|
|
146
|
+
*/
|
|
147
|
+
export function getKryptosSDK(): any | null {
|
|
148
|
+
if (typeof window === "undefined") {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return (window as any)[GLOBAL_NAME] || null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Checks if the SDK is loaded
|
|
156
|
+
*/
|
|
157
|
+
export function isSDKLoaded(): boolean {
|
|
158
|
+
return (
|
|
159
|
+
isLoaded && typeof window !== "undefined" && !!(window as any)[GLOBAL_NAME]
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Alias for isSDKLoaded - kept for backward compatibility
|
|
165
|
+
*/
|
|
166
|
+
export function isKryptosSDKLoaded(): boolean {
|
|
167
|
+
return isSDKLoaded();
|
|
168
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kryptos-connect-dynamic-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Kryptos Connect SDK - React-based SDK with CDN and NPM wrapper",
|
|
5
|
+
"main": "npm-wrapper/index.tsx",
|
|
6
|
+
"types": "npm-wrapper/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build:cdn": "vite build",
|
|
10
|
+
"dev": "vite build --watch",
|
|
11
|
+
"typecheck": "tsc --noEmit"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"kryptos",
|
|
15
|
+
"connect",
|
|
16
|
+
"sdk",
|
|
17
|
+
"react",
|
|
18
|
+
"nextjs"
|
|
19
|
+
],
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
22
|
+
"react-dom": "^17.0.0 || ^18.0.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^20.10.0",
|
|
26
|
+
"@types/react": "^18.2.45",
|
|
27
|
+
"@types/react-dom": "^18.2.18",
|
|
28
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
29
|
+
"react": "^18.2.0",
|
|
30
|
+
"react-dom": "^18.2.0",
|
|
31
|
+
"sass": "^1.69.5",
|
|
32
|
+
"typescript": "^5.3.3",
|
|
33
|
+
"vite": "^5.0.8"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"npm-wrapper",
|
|
37
|
+
"dist",
|
|
38
|
+
"README.md"
|
|
39
|
+
],
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"axios": "^1.13.5"
|
|
43
|
+
}
|
|
44
|
+
}
|