@pipedream/connect-react 1.0.0-preview.16 → 1.0.0-preview.17

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.
@@ -12406,10 +12406,12 @@ function gy(e) {
12406
12406
  color: o.colors.neutral90,
12407
12407
  fontWeight: 450,
12408
12408
  gridArea: "label",
12409
- textTransform: "capitalize",
12410
12409
  lineHeight: "1.5"
12411
12410
  };
12412
- return /* @__PURE__ */ W("label", { htmlFor: r, ...i("label", a, e), children: t });
12411
+ return (
12412
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12413
+ /* @__PURE__ */ W("label", { htmlFor: r, ...i("label", a, e), children: t })
12414
+ );
12413
12415
  }
12414
12416
  const my = (e) => {
12415
12417
  const {
@@ -16,4 +16,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
16
16
  `});++r<e.length;)r&&n.push({type:"text",value:`
17
17
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
18
18
  `}),n}function oa(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function sa(e,t){const n=Lm(e,t),r=n.one(e,void 0),i=Pm(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
19
- `},i),o}function Zm(e,t){return e&&"run"in e?async function(n,r){const i=sa(n,{file:r,...t});await e.run(i,r)}:function(n,r){return sa(n,{file:r,...e||t})}}function ua(e){if(e)throw e}var Gr=Object.prototype.hasOwnProperty,aa=Object.prototype.toString,la=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,da=function(t){return typeof Array.isArray=="function"?Array.isArray(t):aa.call(t)==="[object Array]"},pa=function(t){if(!t||aa.call(t)!=="[object Object]")return!1;var n=Gr.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Gr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Gr.call(t,i)},fa=function(t,n){la&&n.name==="__proto__"?la(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ha=function(t,n){if(n==="__proto__")if(Gr.call(t,n)){if(ca)return ca(t,n).value}else return;return t[n]},jm=function e(){var t,n,r,i,o,s,u=arguments[0],a=1,l=arguments.length,c=!1;for(typeof u=="boolean"&&(c=u,u=arguments[1]||{},a=2),(u==null||typeof u!="object"&&typeof u!="function")&&(u={});a<l;++a)if(t=arguments[a],t!=null)for(n in t)r=ha(u,n),i=ha(t,n),u!==i&&(c&&i&&(pa(i)||(o=da(i)))?(o?(o=!1,s=r&&da(r)?r:[]):s=r&&pa(r)?r:{},fa(u,{name:n,newValue:e(c,s,i)})):typeof i<"u"&&fa(u,{name:n,newValue:i}));return u};const Zi=So(jm);function ji(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Jm(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);u(null,...i);function u(a,...l){const c=e[++o];let d=-1;if(a){s(a);return}for(;++d<i.length;)(l[d]===null||l[d]===void 0)&&(l[d]=i[d]);i=l,c?Ym(c,u)(...l):s(null,...l)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Ym(e,t){let n;return r;function r(...s){const u=e.length>s.length;let a;u&&s.push(i);try{a=e.apply(this,s)}catch(l){const c=l;if(u&&n)throw c;return i(c)}u||(a&&a.then&&typeof a.then=="function"?a.then(o,i):a instanceof Error?i(a):o(a))}function i(s,...u){n||(n=!0,t(s,...u))}function o(s){i(null,s)}}const lt={basename:_m,dirname:Um,extname:Qm,join:qm,sep:"/"};function _m(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');zn(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Um(e){if(zn(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Qm(e){zn(e);let t=e.length,n=-1,r=0,i=-1,o=0,s;for(;t--;){const u=e.codePointAt(t);if(u===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),u===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function qm(...e){let t=-1,n;for(;++t<e.length;)zn(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$m(n)}function $m(e){zn(e);const t=e.codePointAt(0)===47;let n=Km(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Km(e,t){let n="",r=0,i=-1,o=0,s=-1,u,a;for(;++s<=e.length;){if(s<e.length)u=e.codePointAt(s);else{if(u===47)break;u=47}if(u===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",r=0):(n=n.slice(0,a),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,o=0}else u===46&&o>-1?o++:o=-1}return n}function zn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const eb={cwd:tb};function tb(){return"/"}function Ji(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function nb(e){if(typeof e=="string")e=new URL(e);else if(!Ji(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return rb(e)}function rb(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Yi=["history","path","basename","stem","extname","dirname"];class ga{constructor(t){let n;t?Ji(t)?n={path:t}:typeof t=="string"||ib(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":eb.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yi.length;){const o=Yi[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)Yi.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?lt.basename(this.path):void 0}set basename(t){Ui(t,"basename"),_i(t,"basename"),this.path=lt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?lt.dirname(this.path):void 0}set dirname(t){ma(this.basename,"dirname"),this.path=lt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?lt.extname(this.path):void 0}set extname(t){if(_i(t,"extname"),ma(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=lt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ji(t)&&(t=nb(t)),Ui(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?lt.basename(this.path,this.extname):void 0}set stem(t){Ui(t,"stem"),_i(t,"stem"),this.path=lt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Te(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function _i(e,t){if(e&&e.includes(lt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+lt.sep+"`")}function Ui(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ma(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ib(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ob=function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},sb={}.hasOwnProperty;class Qi extends ob{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Jm()}copy(){const t=new Qi;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Zi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ki("data",this.frozen),this.namespace[t]=n,this):sb.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ki("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=kr(t),r=this.parser||this.Parser;return qi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),qi("process",this.parser||this.Parser),$i("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const u=kr(t),a=r.parse(u);r.run(a,u,function(c,d,f){if(c||!d||!f)return l(c);const p=d,b=r.stringify(p,f);lb(b)?f.value=b:f.result=b,l(c,f)});function l(c,d){c||!d?s(c):o?o(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),qi("processSync",this.parser||this.Parser),$i("processSync",this.compiler||this.Compiler),this.process(t,i),ya("processSync","process",n),r;function i(o,s){n=!0,ua(o),r=s}}run(t,n,r){ba(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(s,u){const a=kr(n);i.run(t,a,l);function l(c,d,f){const p=d||t;c?u(c):s?s(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),ya("runSync","run",r),i;function o(s,u){ua(s),i=u,r=!0}}stringify(t,n){this.freeze();const r=kr(n),i=this.compiler||this.Compiler;return $i("stringify",i),ba(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Ki("use",this.frozen),t!=null)if(typeof t=="function")a(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(l){if(typeof l=="function")a(l,[]);else if(typeof l=="object")if(Array.isArray(l)){const[c,...d]=l;a(c,d)}else s(l);else throw new TypeError("Expected usable value, not `"+l+"`")}function s(l){if(!("plugins"in l)&&!("settings"in l))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(l.plugins),l.settings&&(i.settings=Zi(!0,i.settings,l.settings))}function u(l){let c=-1;if(l!=null)if(Array.isArray(l))for(;++c<l.length;){const d=l[c];o(d)}else throw new TypeError("Expected a list of plugins, not `"+l+"`")}function a(l,c){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===l){f=d;break}if(f===-1)r.push([l,...c]);else if(c.length>0){let[p,...b]=c;const g=r[f][1];ji(g)&&ji(p)&&(p=Zi(!0,g,p)),r[f]=[l,p,...b]}}}}const ub=new Qi().freeze();function qi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $i(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ki(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ba(e){if(!ji(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ya(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function kr(e){return ab(e)?e:new ga(e)}function ab(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function lb(e){return typeof e=="string"||cb(e)}function cb(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const db="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ia=[],va={allowDangerousHtml:!0},pb=/^(https?|ircs?|mailto|xmpp)$/i,fb=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function hb(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",i=e.className,o=e.components,s=e.disallowedElements,u=e.rehypePlugins||Ia,a=e.remarkPlugins||Ia,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...va}:va,c=e.skipHtml,d=e.unwrapDisallowed,f=e.urlTransform||gb,p=ub().use(Ug).use(a).use(Zm,l).use(u),b=new ga;typeof r=="string"&&(b.value=r);for(const E of fb)Object.hasOwn(e,E.from)&&(""+E.from+(E.to?"use `"+E.to+"` instead":"remove it")+db+E.id,void 0);const g=p.parse(b);let I=p.runSync(g,b);return i&&(I={type:"element",tagName:"div",properties:{className:i},children:I.type==="root"?I.children:[I]}),ia(I,v),Df(I,{Fragment:R.Fragment,components:o,ignoreInvalidStyle:!0,jsx:R.jsx,jsxs:R.jsxs,passKeys:!0,passNode:!0});function v(E,w,S){if(E.type==="raw"&&S&&typeof w=="number")return c?S.children.splice(w,1):S.children[w]={type:"text",value:E.value},w;if(E.type==="element"){let P;for(P in ki)if(Object.hasOwn(ki,P)&&Object.hasOwn(E.properties,P)){const A=E.properties[P],O=ki[P];(O===null||O.includes(E.tagName))&&(E.properties[P]=f(String(A||""),P,E))}}if(E.type==="element"){let P=t?!t.includes(E.tagName):s?s.includes(E.tagName):!1;if(!P&&n&&typeof w=="number"&&(P=!n(E,w,S)),P&&S&&typeof w=="number")return d&&E.children?S.children.splice(w,1,...E.children):S.children.splice(w,1),w}}}function gb(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t<0||i>-1&&t>i||n>-1&&t>n||r>-1&&t>r||pb.test(e.slice(0,t))?e:""}function Ca(e){e.field||console.log("props",e);const{field:t,markdown:n}=e,{prop:r}=t,{getClassNames:i,getStyles:o,theme:s}=je(),u={color:s.colors.neutral50,fontWeight:400,fontSize:"0.75rem",gridArea:"description",textWrap:"balance",lineHeight:"1.5"};return r.type==="app"?R.jsx("p",{className:i("description",e),style:o("description",u,e),children:"Credentials are encrypted."}):r.description?R.jsx("div",{className:i("description",e),style:o("description",u,e),children:R.jsx(hb,{children:n})}):null}function xa(e){const{errors:t}=e,{getProps:n,theme:r}=je(),i={color:r.colors.danger,gridArea:"errors"};return t.length?R.jsx("ul",{...n("errors",i,e),children:t.map(o=>R.jsx("li",{...n("error",i,e),children:o},o))}):null}function Aa(e){const{text:t,field:n}=e,{id:r}=n,{getProps:i,theme:o}=je(),s={color:o.colors.neutral90,fontWeight:450,gridArea:"label",textTransform:"capitalize",lineHeight:"1.5"};return R.jsx("label",{htmlFor:r,...i("label",s,e),children:t})}const Sa=e=>{const{prop:t,enabled:n,onClick:r}=e,{getProps:i,theme:o}=je(),s={color:o.colors.neutral60,display:"inline-flex",alignItems:"center",padding:`${o.spacing.baseUnit}px ${o.spacing.baseUnit*1.5}px ${o.spacing.baseUnit}px ${o.spacing.baseUnit*2.5}px`,border:`1px solid ${o.colors.neutral30}`,borderRadius:o.borderRadius,cursor:"pointer",fontSize:"0.8125rem",fontWeight:450,gap:o.spacing.baseUnit*2,textWrap:"nowrap"};return R.jsxs("button",{onClick:r,type:"button",...i("optionalFieldButton",s,e),children:[R.jsx("span",{children:n?"-":"+"}),R.jsx("span",{style:{marginRight:8},children:t.label||t.name})]})},wa={Description:Ca,Errors:xa,Label:Aa,OptionalFieldButton:Sa},Br=B.createContext({classNames:{},classNamePrefix:"",components:{},styles:{},theme:yr,unstyled:!1});function mb(){const e=B.useContext(Br)??{},t=Js(e.theme??{});function n(){return e.classNamePrefix??""}function r(u){var c;const a=`${(e==null?void 0:e.classNamePrefix)??"pd-"}${u}`,l={...((c=e.classNames)==null?void 0:c[u])??{}};return typeof(l==null?void 0:l.container)=="function"&&(l.container=typeof(l==null?void 0:l.container)=="function"?(...d)=>{var f;return[(f=l==null?void 0:l.container)==null?void 0:f.call(l,...d),a].join(" ")}:()=>a),l}function i(u,a){var l;return{...hr,...a??{},...((l=e==null?void 0:e.components)==null?void 0:l[u])??{}}}function o(u,a){var l;return Np(((l=e.styles)==null?void 0:l[u])??{},a??{})}function s(u,a){return{classNamePrefix:n(),classNames:r(u),components:i(u,a==null?void 0:a.components),styles:o(u,a==null?void 0:a.styles),theme:t}}return{getClassNamePrefix:n,getClassNames:r,getComponents:i,getProps:s,getStyles:o,theme:t}}function je(){const e=B.useContext(Br)??{},t=e.theme,n=e.unstyled?js:yr,r=typeof t=="function"?Ir(n,t(n)):Ir(n,t);function i(a,l){var f;const c=`${(e==null?void 0:e.classNamePrefix)??"pd-"}${a.toLowerCase()}`,d=(f=e.classNames)==null?void 0:f[a];if(typeof d=="function"){const p=d,b={...l??{},theme:r};return[c,p(b)].filter(Boolean).join(" ")}return[c,d].filter(Boolean).join(" ")}function o(){return{...wa,...(e==null?void 0:e.components)??{}}}function s(a,l,c){var f;const d=(f=e.styles)==null?void 0:f[a];if(typeof d=="function"){const p=d,b={...c??{},theme:r};return p(l,b)}return d?{...l,...d}:l}function u(a,l,c){return{className:i(a,c),style:s(a,l,c)}}return{getClassNames:i,getComponents:o,getProps:u,getStyles:s,select:mb(),theme:r}}const bb=({children:e,...t})=>R.jsx(Br.Provider,{value:t,children:e}),eo=B.createContext(void 0),Ht=()=>{const e=B.useContext(eo);if(!e)throw new Error("Must be used inside FormFieldContext.Provider");return e},Ea=(e,t)=>{var i;const n=mt(),r=Mt({...t==null?void 0:t.useQueryOpts,queryKey:["accounts",e],queryFn:()=>n.getAccounts(e)});return{...r,accounts:((i=r.data)==null?void 0:i.data)||[]}},yb=e=>R.jsx(hr.Option,{...e,children:e.data.name});function Fa({app:e}){const t=mt(),n=Ht(),{id:r,prop:i,value:o,onChange:s}=n,{getProps:u,select:a,theme:l}=je(),c={color:l.colors.neutral60,gridArea:"control"},d={backgroundColor:l.colors.primary,borderRadius:l.borderRadius,border:"solid 1px",borderColor:l.colors.primary25,color:l.colors.primary25,padding:"0.25rem 0.5rem",gridArea:"control"},f={components:{Option:yb},styles:{control:S=>({...S,gridArea:"control",boxShadow:l.boxShadow.input})}},p=a.getProps("controlAppSelect",f),b=void 0,{isLoading:g,accounts:I,refetch:v}=Ea({app:e.name_slug,oauth_app_id:b},{useQueryOpts:{enabled:!!e,suspense:!!e}}),E=async()=>{t.connectAccount({app:i.app,oauthAppId:b,onSuccess:async S=>{await v(),s({authProvisionId:S.id})},onError:()=>{}})},w=B.useMemo(()=>{let S=o;if(S!=null){for(const P of I)if(S.authProvisionId===P.id){S=P;break}}return S},[I,o]);return R.jsx("div",{...u("controlApp",c,{app:e,...n}),children:g?`Loading ${e.name} accounts...`:I.length?R.jsx(br,{instanceId:r,value:w,options:[...I,{id:"_new",name:`Connect new ${e.name} account...`}],...p,required:!0,placeholder:`Select ${e.name} account...`,isLoading:g,isClearable:!0,isSearchable:!0,getOptionLabel:S=>S.name,getOptionValue:S=>S.id,onChange:S=>{S?S.id==="_new"?E():s({authProvisionId:S.id}):s(void 0)}}):R.jsxs("button",{type:"button",...u("connectButton",d,{app:e,...n}),onClick:()=>E(),children:["Connect ",e.name]})})}function Pa(){const e=Ht(),{id:t,value:n,onChange:r}=e,{getProps:i}=je(),o={width:"16px",height:"16px",gridArea:"control",margin:"0 0.5rem 0 0"};return R.jsx("input",{id:t,type:"checkbox",...i("controlBoolean",o,e),checked:n??!1,onChange:s=>r(s.target.checked)})}function Ga(){const e=Ht(),{id:t,onChange:n,prop:r,value:i}=e,{getProps:o,theme:s}=je(),u={color:s.colors.neutral60,display:"block",border:"1px solid",borderColor:s.colors.neutral20,padding:6,width:"100%",borderRadius:s.borderRadius,gridArea:"control",boxShadow:s.boxShadow.input};let a="off",l="text",c=d=>d;switch(r.type){case"string":break;case"integer":l="number",c=d=>d?parseInt(d):void 0;break;default:throw new Error("unexpected prop.type for ControlInput: "+r.type)}return"secret"in r&&r.secret&&(l="password",a="new-password"),R.jsx("input",{id:t,type:l,name:r.name,value:i??"",onChange:d=>n(c(d.target.value)),...o("controlInput",u,e),min:"min"in r?r.min:void 0,max:"max"in r?r.max:void 0,autoComplete:a,"data-lpignore":"true","data-1p-ignore":"true",required:!r.optional})}var Ib=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],ka=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=String(t).toLowerCase(),o=String(r.getOptionValue(n)).toLowerCase(),s=String(r.getOptionLabel(n)).toLowerCase();return o===i||s===i},to={formatCreateLabel:function(t){return'Create "'.concat(t,'"')},isValidNewOption:function(t,n,r,i){return!(!t||n.some(function(o){return ka(t,o,i)})||r.some(function(o){return ka(t,o,i)}))},getNewOptionData:function(t,n){return{label:n,value:t,__isNew__:!0}}};function vb(e){var t=e.allowCreateWhileLoading,n=t===void 0?!1:t,r=e.createOptionPosition,i=r===void 0?"last":r,o=e.formatCreateLabel,s=o===void 0?to.formatCreateLabel:o,u=e.isValidNewOption,a=u===void 0?to.isValidNewOption:u,l=e.getNewOptionData,c=l===void 0?to.getNewOptionData:l,d=e.onCreateOption,f=e.options,p=f===void 0?[]:f,b=e.onChange,g=st(e,Ib),I=g.getOptionValue,v=I===void 0?Vs:I,E=g.getOptionLabel,w=E===void 0?Ts:E,S=g.inputValue,P=g.isLoading,A=g.isMulti,O=g.value,k=g.name,V=B.useMemo(function(){return a(S,lr(O),p,{getOptionValue:v,getOptionLabel:w})?c(S,s(S)):void 0},[s,c,w,v,S,a,p,O]),Z=B.useMemo(function(){return(n||!P)&&V?i==="first"?[V].concat(on(p)):[].concat(on(p),[V]):p},[n,i,P,V,p]),M=B.useCallback(function(D,re){if(re.action!=="select-option")return b(D,re);var ae=Array.isArray(D)?D:[D];if(ae[ae.length-1]===V){if(d)d(S);else{var J=c(S,S),ie={action:"create-option",name:k,option:J};b(On(A,[].concat(on(lr(O)),[J]),J),ie)}return}b(D,re)},[c,S,A,k,V,d,b,O]);return Y(Y({},g),{},{options:Z,onChange:M})}var Cb=B.forwardRef(function(e,t){var n=Uo(e),r=vb(n);return te.createElement(Ii,_({ref:t},r))}),xb=Cb;function Or({isCreatable:e,options:t,selectProps:n}){const r=Ht(),{id:i,prop:o,value:s,onChange:u}=r,{select:a,theme:l}=je(),c={styles:{container:p=>({...p,gridArea:"control",boxShadow:l.boxShadow.input})}},d=B.useMemo(()=>{let p=s;if(p!=null)if(Array.isArray(p)){if(typeof p[0]!="object"){const b=[];for(const g of p)b.push({label:g,value:g});p=b}}else if(typeof p!="object"){if((t==null?void 0:t[0])&&typeof t[0]=="object"){for(const g of t)if(g.value===s){p=g;break}}}else p.__lv&&(p=p.__lv);return p},[s,t]),f=e?xb:br;return R.jsx(f,{inputId:i,instanceId:i,options:t,value:d,isMulti:o.type.endsWith("[]"),isClearable:!0,required:!o.optional,...a.getProps("controlSelect",c),...n,onChange:p=>{if(p)if(Array.isArray(p))if(typeof p[0]=="object"&&"value"in p[0]){const b=[];for(const g of p)o.withLabel?b.push(g):b.push(g.value);u(b)}else u(p);else if(typeof p=="object"&&"value"in p)o.withLabel?u({__lv:p}):u(p.value);else throw new Error("unhandled option type");else u(void 0)}})}function Ba({queryEnabled:e}){const t=mt(),{userId:n,component:r,configurableProps:i,configuredProps:o,dynamicProps:s,props:{disableQueryDisabling:u}}=tr(),{idx:a,prop:l}=Ht(),[c,d]=B.useState(""),f={};for(let A=0;A<a;A++){const O=i[A];f[O.name]=o[O.name]}const p={userId:n,componentId:r.key,propName:l.name,configuredProps:f,dynamicPropsId:s==null?void 0:s.id};l.useQuery&&(p.query=c||"");const b={...p};delete b.dynamicPropsId;const[g,I]=B.useState(),{isFetching:v,data:E,refetch:w}=Mt({queryKey:["componentConfigure",b],queryFn:async()=>{I(void 0);const A=await t.componentConfigure(p),{options:O,stringOptions:k,errors:V}=A;if(V!=null&&V.length){try{I(JSON.parse(V[0]))}catch{I({name:"Error",message:V[0]})}return[]}if(O!=null&&O.length)return O;if(k!=null&&k.length){const Z=[];for(const M of k)Z.push({label:M,value:M});return Z}return[]},enabled:!!e}),S=g?g.message:u?"Click to configure":e?void 0:"Configure props above first",P=u?!1:!e;return R.jsx(Or,{options:E||[],selectProps:{isLoading:v,placeholder:S,isDisabled:P,inputValue:l.useQuery?c:void 0,onInputChange(A){l.useQuery&&(d(A),w())},onMenuOpen(){u&&!e&&w()}}})}function Oa(e){const{field:t,form:n}=e,{queryDisabledIdx:r}=n,{prop:i,idx:o}=t,s="app"in t.extra?t.extra.app:void 0;if(i.remoteOptions||i.type==="$.discord.channel")return R.jsx(Ba,{queryEnabled:r==null||r>=o});if("options"in i&&i.options){let u=i.options;return typeof u[0]!="object"&&(u=u.map(a=>({label:a,value:a}))),R.jsx(Or,{options:u,components:{IndicatorSeparator:()=>null}})}if(i.type.endsWith("[][]"))throw new Error("Unsupported property type: "+i.type);if(i.type.endsWith("[]"))return R.jsx(Or,{isCreatable:!0,options:[],components:{IndicatorSeparator:()=>null}});switch(i.type){case"app":return R.jsx(Fa,{app:s});case"boolean":return R.jsx(Pa,{});case"string":case"integer":return R.jsx(Ga,{});default:throw new Error("Unsupported property type: "+i.type)}}function Ta(e){const{form:t,field:n}=e,{prop:r}=n,{getProps:i,getComponents:o}=je(),s={display:"grid",gridTemplateAreas:n.prop.type=="boolean"?'"control label" "description description" "error error"':'"label label" "control control" "description description" "error error"',gridTemplateColumns:"min-content auto",gap:"0.25rem 0",alignItems:"center",fontSize:"0.875rem"},{Label:u,Description:a,Errors:l}=o(),c=[],d="app"in n.extra?n.extra.app:void 0;if(d&&!d.auth_type)return null;let f=r.label||r.name;return d&&(f=`Connect ${d.name} account`),R.jsxs("div",{...i("field",s,e),children:[R.jsx(u,{text:f,field:n,form:t}),R.jsx(Oa,{field:n,form:t}),R.jsx(a,{markdown:r.description,field:n,form:t}),R.jsx(l,{errors:c,field:n,form:t})]})}const Va=(e,t)=>{var i;const n=mt(),r=Mt({queryKey:["app",e],queryFn:()=>n.app(e),...t==null?void 0:t.useQueryOpts});return{...r,app:(i=r.data)==null?void 0:i.data}};function Ra({prop:e,idx:t}){const n=tr(),{id:r,configuredProps:i,registerField:o,setConfiguredProp:s}=n,u=e.type==="app"&&"app"in e?e.app:void 0,{app:a}=Va(u||"",{useQueryOpts:{enabled:!!u,suspense:!!u}}),c={id:`pd${r}${e.name}`,prop:e,idx:t,value:i[e.name],onChange(d){s(t,d)},extra:{app:a}};return B.useEffect(()=>o(c),[c]),R.jsx(eo.Provider,{value:c,children:R.jsx(Ta,{field:c,form:n})})}class Da extends B.Component{constructor(){super(...arguments),this.state={err:void 0}}static getDerivedStateFromError(t){return{err:t}}render(){const{err:t}=this.state;return t?this.props.fallback(t):this.props.children}}function Na(e){const{form:t}=e,{propsNeedConfiguring:n,submitting:r}=t,{getProps:i,theme:o}=je(),s=u=>{var a;return{width:"fit-content",textTransform:"capitalize",backgroundColor:u?o.colors.neutral10:o.colors.primary,color:u?o.colors.neutral40:o.colors.neutral0,padding:`${o.spacing.baseUnit*1.75}px ${o.spacing.baseUnit*16}px`,borderRadius:o.borderRadius,boxShadow:(a=o.boxShadow)==null?void 0:a.button,cursor:"pointer",fontSize:"0.875rem",opacity:r?.5:void 0,margin:"0.5rem 0 0 0"}};return R.jsx("input",{type:"submit",value:r?"Submitting...":"Submit",...i("controlSubmit",s(n.length||r),e),disabled:n.length||r})}function Ma(){const e=tr(),{configurableProps:t,dynamicPropsQueryIsFetching:n,isValid:r,optionalPropIsEnabled:i,optionalPropSetEnabled:o,props:s,setSubmitting:u}=e,{hideOptionalProps:a,onSubmit:l}=s,{getComponents:c,getProps:d,theme:f}=je(),{OptionalFieldButton:p}=c(),b={display:"flex",flexDirection:"column",gap:"1.5rem"},g={display:"flex",flexWrap:"wrap",gap:"0.375rem"},I={fontWeight:600,textTransform:"capitalize",color:f.colors.neutral60,fontSize:"0.875rem",lineHeight:"1.375",margin:"0 0 0.5rem 0"},v=async S=>{if(l&&(S.preventDefault(),r)){u(!0);try{await l(e)}finally{u(!1)}}},E=[],w=[];for(let S=0;S<t.length;S++){const P=t[S];if(!P.hidden&&!kn.includes(P.type)){if(P.optional){const A=i(P);if(w.push([P,A]),!A)continue}E.push([P,S])}}return R.jsx(Da,{fallback:S=>R.jsxs("p",{style:{color:"red"},children:["Error: ",S&&typeof S=="object"&&"message"in S&&typeof S.message=="string"?S.message:"Unknown"]}),children:R.jsx(B.Suspense,{fallback:R.jsx("p",{children:"Loading form..."}),children:R.jsxs("form",{...d("componentForm",b,s),onSubmit:v,children:[E.map(([S,P])=>S.type==="alert"?R.jsx(Ao,{prop:S},S.name):R.jsx(Ra,{prop:S,idx:P},S.name)),n&&R.jsx("p",{children:"Loading dynamic props..."}),!a&&w.length?R.jsxs("div",{children:[R.jsx("div",{...d("heading",I,s),children:"Optional Props"}),R.jsx("div",{...d("optionalFields",g,s),children:w.map(([S,P])=>R.jsx(p,{prop:S,enabled:P,onClick:()=>o(S,!P)},S.name))})]}):null,l&&R.jsx(Na,{form:e})]})})})}function La(e){return R.jsx(jo,{props:e,children:R.jsx(Ma,{})})}const Xa=({key:e},t)=>{var i;const n=mt(),r=Mt({queryKey:["component",e],queryFn:()=>n.component({key:e}),enabled:!!e,...t==null?void 0:t.useQueryOpts});return{...r,component:(i=r.data)==null?void 0:i.data}};function Ab(e){const{isLoading:t,error:n,component:r}=Xa({key:e.componentKey});if(!e.componentKey)throw new Error("componentKey required");return t?R.jsx("p",{children:"Loading..."}):n?R.jsxs("p",{children:["Error: ",n.message]}):r?R.jsx(La,{component:r,...e}):R.jsx("p",{children:"Component not found"})}function Sb(){const e=Ht(),{id:t,onChange:n,value:r}=e,{getProps:i,theme:o}=je(),s={display:"block",gridArea:"control",width:"100%",fontSize:"0.875rem",boxShadow:o.boxShadow.input};let u=r;return typeof u=="object"&&(u=JSON.stringify(u)),R.jsx("textarea",{id:t,value:u,onChange:a=>n(a.target.value),...i("controlAny",s,e)})}const za=e=>{var r;const t=mt(),n=Mt({queryKey:["apps",e],queryFn:()=>t.apps(e)});return{...n,apps:(r=n.data)==null?void 0:r.data}};function wb({value:e,onChange:t}){const[n,r]=B.useState(""),i=B.useId(),{isLoading:o,apps:s}=za({q:n}),{Option:u}=hr;return R.jsx(br,{instanceId:i,className:"react-select-container text-sm",classNamePrefix:"react-select",components:{Option:a=>R.jsx(u,{...a,children:R.jsxs("div",{style:{display:"flex",gap:10},children:[R.jsx("img",{src:`https://pipedream.com/s.v0/${a.data.id}/logo/48`,style:{height:24,width:24},alt:a.data.name}),R.jsx("span",{style:{whiteSpace:"nowrap"},children:a.data.name})]})}),IndicatorSeparator:()=>null},options:s||[],getOptionLabel:a=>a.name||a.name_slug,getOptionValue:a=>a.name_slug,value:e,onChange:a=>t==null?void 0:t(a||void 0),onInputChange:a=>r(a),isLoading:o})}const Ha=e=>{var r;const t=mt(),n=Mt({queryKey:["components",e],queryFn:()=>t.components(e)});return{...n,components:((r=n.data)==null?void 0:r.data)||[]}};function Eb({app:e,componentType:t,value:n,onChange:r}){const i=B.useId(),{isLoading:o,components:s}=Ha({app:e==null?void 0:e.name_slug,componentType:t});return R.jsx(br,{instanceId:i,className:"react-select-container text-sm",classNamePrefix:"react-select",options:s,getOptionLabel:u=>u.name||u.key,getOptionValue:u=>u.key,value:n,onChange:u=>r==null?void 0:r(u||void 0),isLoading:o,components:{IndicatorSeparator:()=>null}})}X.Alert=Ao,X.ComponentForm=La,X.ComponentFormContainer=Ab,X.Control=Oa,X.ControlAny=Sb,X.ControlApp=Fa,X.ControlBoolean=Pa,X.ControlInput=Ga,X.ControlSelect=Or,X.ControlSubmit=Na,X.CustomizationContext=Br,X.CustomizeProvider=bb,X.Description=Ca,X.ErrorBoundary=Da,X.Errors=xa,X.Field=Ta,X.FormContext=ri,X.FormContextProvider=jo,X.FormFieldContext=eo,X.FrontendClientProvider=_l,X.InternalComponentForm=Ma,X.InternalField=Ra,X.Label=Aa,X.OptionalFieldButton=Sa,X.RemoteOptionsContainer=Ba,X.SelectApp=wb,X.SelectComponent=Eb,X.defaultComponents=wa,X.defaultTheme=yr,X.getReactSelectTheme=Js,X.mergeTheme=Ir,X.skippablePropTypes=kn,X.unstyledTheme=js,X.useAccounts=Ea,X.useApp=Va,X.useApps=za,X.useComponent=Xa,X.useComponents=Ha,X.useCustomize=je,X.useFormContext=tr,X.useFormFieldContext=Ht,X.useFrontendClient=mt,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
19
+ `},i),o}function Zm(e,t){return e&&"run"in e?async function(n,r){const i=sa(n,{file:r,...t});await e.run(i,r)}:function(n,r){return sa(n,{file:r,...e||t})}}function ua(e){if(e)throw e}var Gr=Object.prototype.hasOwnProperty,aa=Object.prototype.toString,la=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,da=function(t){return typeof Array.isArray=="function"?Array.isArray(t):aa.call(t)==="[object Array]"},pa=function(t){if(!t||aa.call(t)!=="[object Object]")return!1;var n=Gr.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Gr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Gr.call(t,i)},fa=function(t,n){la&&n.name==="__proto__"?la(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ha=function(t,n){if(n==="__proto__")if(Gr.call(t,n)){if(ca)return ca(t,n).value}else return;return t[n]},jm=function e(){var t,n,r,i,o,s,u=arguments[0],a=1,l=arguments.length,c=!1;for(typeof u=="boolean"&&(c=u,u=arguments[1]||{},a=2),(u==null||typeof u!="object"&&typeof u!="function")&&(u={});a<l;++a)if(t=arguments[a],t!=null)for(n in t)r=ha(u,n),i=ha(t,n),u!==i&&(c&&i&&(pa(i)||(o=da(i)))?(o?(o=!1,s=r&&da(r)?r:[]):s=r&&pa(r)?r:{},fa(u,{name:n,newValue:e(c,s,i)})):typeof i<"u"&&fa(u,{name:n,newValue:i}));return u};const Zi=So(jm);function ji(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Jm(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);u(null,...i);function u(a,...l){const c=e[++o];let d=-1;if(a){s(a);return}for(;++d<i.length;)(l[d]===null||l[d]===void 0)&&(l[d]=i[d]);i=l,c?Ym(c,u)(...l):s(null,...l)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Ym(e,t){let n;return r;function r(...s){const u=e.length>s.length;let a;u&&s.push(i);try{a=e.apply(this,s)}catch(l){const c=l;if(u&&n)throw c;return i(c)}u||(a&&a.then&&typeof a.then=="function"?a.then(o,i):a instanceof Error?i(a):o(a))}function i(s,...u){n||(n=!0,t(s,...u))}function o(s){i(null,s)}}const lt={basename:_m,dirname:Um,extname:Qm,join:qm,sep:"/"};function _m(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');zn(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Um(e){if(zn(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Qm(e){zn(e);let t=e.length,n=-1,r=0,i=-1,o=0,s;for(;t--;){const u=e.codePointAt(t);if(u===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),u===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function qm(...e){let t=-1,n;for(;++t<e.length;)zn(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$m(n)}function $m(e){zn(e);const t=e.codePointAt(0)===47;let n=Km(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Km(e,t){let n="",r=0,i=-1,o=0,s=-1,u,a;for(;++s<=e.length;){if(s<e.length)u=e.codePointAt(s);else{if(u===47)break;u=47}if(u===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",r=0):(n=n.slice(0,a),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,o=0}else u===46&&o>-1?o++:o=-1}return n}function zn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const eb={cwd:tb};function tb(){return"/"}function Ji(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function nb(e){if(typeof e=="string")e=new URL(e);else if(!Ji(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return rb(e)}function rb(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Yi=["history","path","basename","stem","extname","dirname"];class ga{constructor(t){let n;t?Ji(t)?n={path:t}:typeof t=="string"||ib(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":eb.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yi.length;){const o=Yi[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)Yi.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?lt.basename(this.path):void 0}set basename(t){Ui(t,"basename"),_i(t,"basename"),this.path=lt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?lt.dirname(this.path):void 0}set dirname(t){ma(this.basename,"dirname"),this.path=lt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?lt.extname(this.path):void 0}set extname(t){if(_i(t,"extname"),ma(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=lt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ji(t)&&(t=nb(t)),Ui(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?lt.basename(this.path,this.extname):void 0}set stem(t){Ui(t,"stem"),_i(t,"stem"),this.path=lt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Te(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function _i(e,t){if(e&&e.includes(lt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+lt.sep+"`")}function Ui(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ma(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ib(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ob=function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},sb={}.hasOwnProperty;class Qi extends ob{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Jm()}copy(){const t=new Qi;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Zi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ki("data",this.frozen),this.namespace[t]=n,this):sb.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ki("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=kr(t),r=this.parser||this.Parser;return qi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),qi("process",this.parser||this.Parser),$i("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const u=kr(t),a=r.parse(u);r.run(a,u,function(c,d,f){if(c||!d||!f)return l(c);const p=d,b=r.stringify(p,f);lb(b)?f.value=b:f.result=b,l(c,f)});function l(c,d){c||!d?s(c):o?o(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),qi("processSync",this.parser||this.Parser),$i("processSync",this.compiler||this.Compiler),this.process(t,i),ya("processSync","process",n),r;function i(o,s){n=!0,ua(o),r=s}}run(t,n,r){ba(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(s,u){const a=kr(n);i.run(t,a,l);function l(c,d,f){const p=d||t;c?u(c):s?s(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),ya("runSync","run",r),i;function o(s,u){ua(s),i=u,r=!0}}stringify(t,n){this.freeze();const r=kr(n),i=this.compiler||this.Compiler;return $i("stringify",i),ba(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Ki("use",this.frozen),t!=null)if(typeof t=="function")a(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(l){if(typeof l=="function")a(l,[]);else if(typeof l=="object")if(Array.isArray(l)){const[c,...d]=l;a(c,d)}else s(l);else throw new TypeError("Expected usable value, not `"+l+"`")}function s(l){if(!("plugins"in l)&&!("settings"in l))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(l.plugins),l.settings&&(i.settings=Zi(!0,i.settings,l.settings))}function u(l){let c=-1;if(l!=null)if(Array.isArray(l))for(;++c<l.length;){const d=l[c];o(d)}else throw new TypeError("Expected a list of plugins, not `"+l+"`")}function a(l,c){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===l){f=d;break}if(f===-1)r.push([l,...c]);else if(c.length>0){let[p,...b]=c;const g=r[f][1];ji(g)&&ji(p)&&(p=Zi(!0,g,p)),r[f]=[l,p,...b]}}}}const ub=new Qi().freeze();function qi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $i(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ki(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ba(e){if(!ji(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ya(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function kr(e){return ab(e)?e:new ga(e)}function ab(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function lb(e){return typeof e=="string"||cb(e)}function cb(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const db="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ia=[],va={allowDangerousHtml:!0},pb=/^(https?|ircs?|mailto|xmpp)$/i,fb=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function hb(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",i=e.className,o=e.components,s=e.disallowedElements,u=e.rehypePlugins||Ia,a=e.remarkPlugins||Ia,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...va}:va,c=e.skipHtml,d=e.unwrapDisallowed,f=e.urlTransform||gb,p=ub().use(Ug).use(a).use(Zm,l).use(u),b=new ga;typeof r=="string"&&(b.value=r);for(const E of fb)Object.hasOwn(e,E.from)&&(""+E.from+(E.to?"use `"+E.to+"` instead":"remove it")+db+E.id,void 0);const g=p.parse(b);let I=p.runSync(g,b);return i&&(I={type:"element",tagName:"div",properties:{className:i},children:I.type==="root"?I.children:[I]}),ia(I,v),Df(I,{Fragment:R.Fragment,components:o,ignoreInvalidStyle:!0,jsx:R.jsx,jsxs:R.jsxs,passKeys:!0,passNode:!0});function v(E,w,S){if(E.type==="raw"&&S&&typeof w=="number")return c?S.children.splice(w,1):S.children[w]={type:"text",value:E.value},w;if(E.type==="element"){let P;for(P in ki)if(Object.hasOwn(ki,P)&&Object.hasOwn(E.properties,P)){const A=E.properties[P],O=ki[P];(O===null||O.includes(E.tagName))&&(E.properties[P]=f(String(A||""),P,E))}}if(E.type==="element"){let P=t?!t.includes(E.tagName):s?s.includes(E.tagName):!1;if(!P&&n&&typeof w=="number"&&(P=!n(E,w,S)),P&&S&&typeof w=="number")return d&&E.children?S.children.splice(w,1,...E.children):S.children.splice(w,1),w}}}function gb(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t<0||i>-1&&t>i||n>-1&&t>n||r>-1&&t>r||pb.test(e.slice(0,t))?e:""}function Ca(e){e.field||console.log("props",e);const{field:t,markdown:n}=e,{prop:r}=t,{getClassNames:i,getStyles:o,theme:s}=je(),u={color:s.colors.neutral50,fontWeight:400,fontSize:"0.75rem",gridArea:"description",textWrap:"balance",lineHeight:"1.5"};return r.type==="app"?R.jsx("p",{className:i("description",e),style:o("description",u,e),children:"Credentials are encrypted."}):r.description?R.jsx("div",{className:i("description",e),style:o("description",u,e),children:R.jsx(hb,{children:n})}):null}function xa(e){const{errors:t}=e,{getProps:n,theme:r}=je(),i={color:r.colors.danger,gridArea:"errors"};return t.length?R.jsx("ul",{...n("errors",i,e),children:t.map(o=>R.jsx("li",{...n("error",i,e),children:o},o))}):null}function Aa(e){const{text:t,field:n}=e,{id:r}=n,{getProps:i,theme:o}=je(),s={color:o.colors.neutral90,fontWeight:450,gridArea:"label",lineHeight:"1.5"};return R.jsx("label",{htmlFor:r,...i("label",s,e),children:t})}const Sa=e=>{const{prop:t,enabled:n,onClick:r}=e,{getProps:i,theme:o}=je(),s={color:o.colors.neutral60,display:"inline-flex",alignItems:"center",padding:`${o.spacing.baseUnit}px ${o.spacing.baseUnit*1.5}px ${o.spacing.baseUnit}px ${o.spacing.baseUnit*2.5}px`,border:`1px solid ${o.colors.neutral30}`,borderRadius:o.borderRadius,cursor:"pointer",fontSize:"0.8125rem",fontWeight:450,gap:o.spacing.baseUnit*2,textWrap:"nowrap"};return R.jsxs("button",{onClick:r,type:"button",...i("optionalFieldButton",s,e),children:[R.jsx("span",{children:n?"-":"+"}),R.jsx("span",{style:{marginRight:8},children:t.label||t.name})]})},wa={Description:Ca,Errors:xa,Label:Aa,OptionalFieldButton:Sa},Br=B.createContext({classNames:{},classNamePrefix:"",components:{},styles:{},theme:yr,unstyled:!1});function mb(){const e=B.useContext(Br)??{},t=Js(e.theme??{});function n(){return e.classNamePrefix??""}function r(u){var c;const a=`${(e==null?void 0:e.classNamePrefix)??"pd-"}${u}`,l={...((c=e.classNames)==null?void 0:c[u])??{}};return typeof(l==null?void 0:l.container)=="function"&&(l.container=typeof(l==null?void 0:l.container)=="function"?(...d)=>{var f;return[(f=l==null?void 0:l.container)==null?void 0:f.call(l,...d),a].join(" ")}:()=>a),l}function i(u,a){var l;return{...hr,...a??{},...((l=e==null?void 0:e.components)==null?void 0:l[u])??{}}}function o(u,a){var l;return Np(((l=e.styles)==null?void 0:l[u])??{},a??{})}function s(u,a){return{classNamePrefix:n(),classNames:r(u),components:i(u,a==null?void 0:a.components),styles:o(u,a==null?void 0:a.styles),theme:t}}return{getClassNamePrefix:n,getClassNames:r,getComponents:i,getProps:s,getStyles:o,theme:t}}function je(){const e=B.useContext(Br)??{},t=e.theme,n=e.unstyled?js:yr,r=typeof t=="function"?Ir(n,t(n)):Ir(n,t);function i(a,l){var f;const c=`${(e==null?void 0:e.classNamePrefix)??"pd-"}${a.toLowerCase()}`,d=(f=e.classNames)==null?void 0:f[a];if(typeof d=="function"){const p=d,b={...l??{},theme:r};return[c,p(b)].filter(Boolean).join(" ")}return[c,d].filter(Boolean).join(" ")}function o(){return{...wa,...(e==null?void 0:e.components)??{}}}function s(a,l,c){var f;const d=(f=e.styles)==null?void 0:f[a];if(typeof d=="function"){const p=d,b={...c??{},theme:r};return p(l,b)}return d?{...l,...d}:l}function u(a,l,c){return{className:i(a,c),style:s(a,l,c)}}return{getClassNames:i,getComponents:o,getProps:u,getStyles:s,select:mb(),theme:r}}const bb=({children:e,...t})=>R.jsx(Br.Provider,{value:t,children:e}),eo=B.createContext(void 0),Ht=()=>{const e=B.useContext(eo);if(!e)throw new Error("Must be used inside FormFieldContext.Provider");return e},Ea=(e,t)=>{var i;const n=mt(),r=Mt({...t==null?void 0:t.useQueryOpts,queryKey:["accounts",e],queryFn:()=>n.getAccounts(e)});return{...r,accounts:((i=r.data)==null?void 0:i.data)||[]}},yb=e=>R.jsx(hr.Option,{...e,children:e.data.name});function Fa({app:e}){const t=mt(),n=Ht(),{id:r,prop:i,value:o,onChange:s}=n,{getProps:u,select:a,theme:l}=je(),c={color:l.colors.neutral60,gridArea:"control"},d={backgroundColor:l.colors.primary,borderRadius:l.borderRadius,border:"solid 1px",borderColor:l.colors.primary25,color:l.colors.primary25,padding:"0.25rem 0.5rem",gridArea:"control"},f={components:{Option:yb},styles:{control:S=>({...S,gridArea:"control",boxShadow:l.boxShadow.input})}},p=a.getProps("controlAppSelect",f),b=void 0,{isLoading:g,accounts:I,refetch:v}=Ea({app:e.name_slug,oauth_app_id:b},{useQueryOpts:{enabled:!!e,suspense:!!e}}),E=async()=>{t.connectAccount({app:i.app,oauthAppId:b,onSuccess:async S=>{await v(),s({authProvisionId:S.id})},onError:()=>{}})},w=B.useMemo(()=>{let S=o;if(S!=null){for(const P of I)if(S.authProvisionId===P.id){S=P;break}}return S},[I,o]);return R.jsx("div",{...u("controlApp",c,{app:e,...n}),children:g?`Loading ${e.name} accounts...`:I.length?R.jsx(br,{instanceId:r,value:w,options:[...I,{id:"_new",name:`Connect new ${e.name} account...`}],...p,required:!0,placeholder:`Select ${e.name} account...`,isLoading:g,isClearable:!0,isSearchable:!0,getOptionLabel:S=>S.name,getOptionValue:S=>S.id,onChange:S=>{S?S.id==="_new"?E():s({authProvisionId:S.id}):s(void 0)}}):R.jsxs("button",{type:"button",...u("connectButton",d,{app:e,...n}),onClick:()=>E(),children:["Connect ",e.name]})})}function Pa(){const e=Ht(),{id:t,value:n,onChange:r}=e,{getProps:i}=je(),o={width:"16px",height:"16px",gridArea:"control",margin:"0 0.5rem 0 0"};return R.jsx("input",{id:t,type:"checkbox",...i("controlBoolean",o,e),checked:n??!1,onChange:s=>r(s.target.checked)})}function Ga(){const e=Ht(),{id:t,onChange:n,prop:r,value:i}=e,{getProps:o,theme:s}=je(),u={color:s.colors.neutral60,display:"block",border:"1px solid",borderColor:s.colors.neutral20,padding:6,width:"100%",borderRadius:s.borderRadius,gridArea:"control",boxShadow:s.boxShadow.input};let a="off",l="text",c=d=>d;switch(r.type){case"string":break;case"integer":l="number",c=d=>d?parseInt(d):void 0;break;default:throw new Error("unexpected prop.type for ControlInput: "+r.type)}return"secret"in r&&r.secret&&(l="password",a="new-password"),R.jsx("input",{id:t,type:l,name:r.name,value:i??"",onChange:d=>n(c(d.target.value)),...o("controlInput",u,e),min:"min"in r?r.min:void 0,max:"max"in r?r.max:void 0,autoComplete:a,"data-lpignore":"true","data-1p-ignore":"true",required:!r.optional})}var Ib=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],ka=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=String(t).toLowerCase(),o=String(r.getOptionValue(n)).toLowerCase(),s=String(r.getOptionLabel(n)).toLowerCase();return o===i||s===i},to={formatCreateLabel:function(t){return'Create "'.concat(t,'"')},isValidNewOption:function(t,n,r,i){return!(!t||n.some(function(o){return ka(t,o,i)})||r.some(function(o){return ka(t,o,i)}))},getNewOptionData:function(t,n){return{label:n,value:t,__isNew__:!0}}};function vb(e){var t=e.allowCreateWhileLoading,n=t===void 0?!1:t,r=e.createOptionPosition,i=r===void 0?"last":r,o=e.formatCreateLabel,s=o===void 0?to.formatCreateLabel:o,u=e.isValidNewOption,a=u===void 0?to.isValidNewOption:u,l=e.getNewOptionData,c=l===void 0?to.getNewOptionData:l,d=e.onCreateOption,f=e.options,p=f===void 0?[]:f,b=e.onChange,g=st(e,Ib),I=g.getOptionValue,v=I===void 0?Vs:I,E=g.getOptionLabel,w=E===void 0?Ts:E,S=g.inputValue,P=g.isLoading,A=g.isMulti,O=g.value,k=g.name,V=B.useMemo(function(){return a(S,lr(O),p,{getOptionValue:v,getOptionLabel:w})?c(S,s(S)):void 0},[s,c,w,v,S,a,p,O]),Z=B.useMemo(function(){return(n||!P)&&V?i==="first"?[V].concat(on(p)):[].concat(on(p),[V]):p},[n,i,P,V,p]),M=B.useCallback(function(D,re){if(re.action!=="select-option")return b(D,re);var ae=Array.isArray(D)?D:[D];if(ae[ae.length-1]===V){if(d)d(S);else{var J=c(S,S),ie={action:"create-option",name:k,option:J};b(On(A,[].concat(on(lr(O)),[J]),J),ie)}return}b(D,re)},[c,S,A,k,V,d,b,O]);return Y(Y({},g),{},{options:Z,onChange:M})}var Cb=B.forwardRef(function(e,t){var n=Uo(e),r=vb(n);return te.createElement(Ii,_({ref:t},r))}),xb=Cb;function Or({isCreatable:e,options:t,selectProps:n}){const r=Ht(),{id:i,prop:o,value:s,onChange:u}=r,{select:a,theme:l}=je(),c={styles:{container:p=>({...p,gridArea:"control",boxShadow:l.boxShadow.input})}},d=B.useMemo(()=>{let p=s;if(p!=null)if(Array.isArray(p)){if(typeof p[0]!="object"){const b=[];for(const g of p)b.push({label:g,value:g});p=b}}else if(typeof p!="object"){if((t==null?void 0:t[0])&&typeof t[0]=="object"){for(const g of t)if(g.value===s){p=g;break}}}else p.__lv&&(p=p.__lv);return p},[s,t]),f=e?xb:br;return R.jsx(f,{inputId:i,instanceId:i,options:t,value:d,isMulti:o.type.endsWith("[]"),isClearable:!0,required:!o.optional,...a.getProps("controlSelect",c),...n,onChange:p=>{if(p)if(Array.isArray(p))if(typeof p[0]=="object"&&"value"in p[0]){const b=[];for(const g of p)o.withLabel?b.push(g):b.push(g.value);u(b)}else u(p);else if(typeof p=="object"&&"value"in p)o.withLabel?u({__lv:p}):u(p.value);else throw new Error("unhandled option type");else u(void 0)}})}function Ba({queryEnabled:e}){const t=mt(),{userId:n,component:r,configurableProps:i,configuredProps:o,dynamicProps:s,props:{disableQueryDisabling:u}}=tr(),{idx:a,prop:l}=Ht(),[c,d]=B.useState(""),f={};for(let A=0;A<a;A++){const O=i[A];f[O.name]=o[O.name]}const p={userId:n,componentId:r.key,propName:l.name,configuredProps:f,dynamicPropsId:s==null?void 0:s.id};l.useQuery&&(p.query=c||"");const b={...p};delete b.dynamicPropsId;const[g,I]=B.useState(),{isFetching:v,data:E,refetch:w}=Mt({queryKey:["componentConfigure",b],queryFn:async()=>{I(void 0);const A=await t.componentConfigure(p),{options:O,stringOptions:k,errors:V}=A;if(V!=null&&V.length){try{I(JSON.parse(V[0]))}catch{I({name:"Error",message:V[0]})}return[]}if(O!=null&&O.length)return O;if(k!=null&&k.length){const Z=[];for(const M of k)Z.push({label:M,value:M});return Z}return[]},enabled:!!e}),S=g?g.message:u?"Click to configure":e?void 0:"Configure props above first",P=u?!1:!e;return R.jsx(Or,{options:E||[],selectProps:{isLoading:v,placeholder:S,isDisabled:P,inputValue:l.useQuery?c:void 0,onInputChange(A){l.useQuery&&(d(A),w())},onMenuOpen(){u&&!e&&w()}}})}function Oa(e){const{field:t,form:n}=e,{queryDisabledIdx:r}=n,{prop:i,idx:o}=t,s="app"in t.extra?t.extra.app:void 0;if(i.remoteOptions||i.type==="$.discord.channel")return R.jsx(Ba,{queryEnabled:r==null||r>=o});if("options"in i&&i.options){let u=i.options;return typeof u[0]!="object"&&(u=u.map(a=>({label:a,value:a}))),R.jsx(Or,{options:u,components:{IndicatorSeparator:()=>null}})}if(i.type.endsWith("[][]"))throw new Error("Unsupported property type: "+i.type);if(i.type.endsWith("[]"))return R.jsx(Or,{isCreatable:!0,options:[],components:{IndicatorSeparator:()=>null}});switch(i.type){case"app":return R.jsx(Fa,{app:s});case"boolean":return R.jsx(Pa,{});case"string":case"integer":return R.jsx(Ga,{});default:throw new Error("Unsupported property type: "+i.type)}}function Ta(e){const{form:t,field:n}=e,{prop:r}=n,{getProps:i,getComponents:o}=je(),s={display:"grid",gridTemplateAreas:n.prop.type=="boolean"?'"control label" "description description" "error error"':'"label label" "control control" "description description" "error error"',gridTemplateColumns:"min-content auto",gap:"0.25rem 0",alignItems:"center",fontSize:"0.875rem"},{Label:u,Description:a,Errors:l}=o(),c=[],d="app"in n.extra?n.extra.app:void 0;if(d&&!d.auth_type)return null;let f=r.label||r.name;return d&&(f=`Connect ${d.name} account`),R.jsxs("div",{...i("field",s,e),children:[R.jsx(u,{text:f,field:n,form:t}),R.jsx(Oa,{field:n,form:t}),R.jsx(a,{markdown:r.description,field:n,form:t}),R.jsx(l,{errors:c,field:n,form:t})]})}const Va=(e,t)=>{var i;const n=mt(),r=Mt({queryKey:["app",e],queryFn:()=>n.app(e),...t==null?void 0:t.useQueryOpts});return{...r,app:(i=r.data)==null?void 0:i.data}};function Ra({prop:e,idx:t}){const n=tr(),{id:r,configuredProps:i,registerField:o,setConfiguredProp:s}=n,u=e.type==="app"&&"app"in e?e.app:void 0,{app:a}=Va(u||"",{useQueryOpts:{enabled:!!u,suspense:!!u}}),c={id:`pd${r}${e.name}`,prop:e,idx:t,value:i[e.name],onChange(d){s(t,d)},extra:{app:a}};return B.useEffect(()=>o(c),[c]),R.jsx(eo.Provider,{value:c,children:R.jsx(Ta,{field:c,form:n})})}class Da extends B.Component{constructor(){super(...arguments),this.state={err:void 0}}static getDerivedStateFromError(t){return{err:t}}render(){const{err:t}=this.state;return t?this.props.fallback(t):this.props.children}}function Na(e){const{form:t}=e,{propsNeedConfiguring:n,submitting:r}=t,{getProps:i,theme:o}=je(),s=u=>{var a;return{width:"fit-content",textTransform:"capitalize",backgroundColor:u?o.colors.neutral10:o.colors.primary,color:u?o.colors.neutral40:o.colors.neutral0,padding:`${o.spacing.baseUnit*1.75}px ${o.spacing.baseUnit*16}px`,borderRadius:o.borderRadius,boxShadow:(a=o.boxShadow)==null?void 0:a.button,cursor:"pointer",fontSize:"0.875rem",opacity:r?.5:void 0,margin:"0.5rem 0 0 0"}};return R.jsx("input",{type:"submit",value:r?"Submitting...":"Submit",...i("controlSubmit",s(n.length||r),e),disabled:n.length||r})}function Ma(){const e=tr(),{configurableProps:t,dynamicPropsQueryIsFetching:n,isValid:r,optionalPropIsEnabled:i,optionalPropSetEnabled:o,props:s,setSubmitting:u}=e,{hideOptionalProps:a,onSubmit:l}=s,{getComponents:c,getProps:d,theme:f}=je(),{OptionalFieldButton:p}=c(),b={display:"flex",flexDirection:"column",gap:"1.5rem"},g={display:"flex",flexWrap:"wrap",gap:"0.375rem"},I={fontWeight:600,textTransform:"capitalize",color:f.colors.neutral60,fontSize:"0.875rem",lineHeight:"1.375",margin:"0 0 0.5rem 0"},v=async S=>{if(l&&(S.preventDefault(),r)){u(!0);try{await l(e)}finally{u(!1)}}},E=[],w=[];for(let S=0;S<t.length;S++){const P=t[S];if(!P.hidden&&!kn.includes(P.type)){if(P.optional){const A=i(P);if(w.push([P,A]),!A)continue}E.push([P,S])}}return R.jsx(Da,{fallback:S=>R.jsxs("p",{style:{color:"red"},children:["Error: ",S&&typeof S=="object"&&"message"in S&&typeof S.message=="string"?S.message:"Unknown"]}),children:R.jsx(B.Suspense,{fallback:R.jsx("p",{children:"Loading form..."}),children:R.jsxs("form",{...d("componentForm",b,s),onSubmit:v,children:[E.map(([S,P])=>S.type==="alert"?R.jsx(Ao,{prop:S},S.name):R.jsx(Ra,{prop:S,idx:P},S.name)),n&&R.jsx("p",{children:"Loading dynamic props..."}),!a&&w.length?R.jsxs("div",{children:[R.jsx("div",{...d("heading",I,s),children:"Optional Props"}),R.jsx("div",{...d("optionalFields",g,s),children:w.map(([S,P])=>R.jsx(p,{prop:S,enabled:P,onClick:()=>o(S,!P)},S.name))})]}):null,l&&R.jsx(Na,{form:e})]})})})}function La(e){return R.jsx(jo,{props:e,children:R.jsx(Ma,{})})}const Xa=({key:e},t)=>{var i;const n=mt(),r=Mt({queryKey:["component",e],queryFn:()=>n.component({key:e}),enabled:!!e,...t==null?void 0:t.useQueryOpts});return{...r,component:(i=r.data)==null?void 0:i.data}};function Ab(e){const{isLoading:t,error:n,component:r}=Xa({key:e.componentKey});if(!e.componentKey)throw new Error("componentKey required");return t?R.jsx("p",{children:"Loading..."}):n?R.jsxs("p",{children:["Error: ",n.message]}):r?R.jsx(La,{component:r,...e}):R.jsx("p",{children:"Component not found"})}function Sb(){const e=Ht(),{id:t,onChange:n,value:r}=e,{getProps:i,theme:o}=je(),s={display:"block",gridArea:"control",width:"100%",fontSize:"0.875rem",boxShadow:o.boxShadow.input};let u=r;return typeof u=="object"&&(u=JSON.stringify(u)),R.jsx("textarea",{id:t,value:u,onChange:a=>n(a.target.value),...i("controlAny",s,e)})}const za=e=>{var r;const t=mt(),n=Mt({queryKey:["apps",e],queryFn:()=>t.apps(e)});return{...n,apps:(r=n.data)==null?void 0:r.data}};function wb({value:e,onChange:t}){const[n,r]=B.useState(""),i=B.useId(),{isLoading:o,apps:s}=za({q:n}),{Option:u}=hr;return R.jsx(br,{instanceId:i,className:"react-select-container text-sm",classNamePrefix:"react-select",components:{Option:a=>R.jsx(u,{...a,children:R.jsxs("div",{style:{display:"flex",gap:10},children:[R.jsx("img",{src:`https://pipedream.com/s.v0/${a.data.id}/logo/48`,style:{height:24,width:24},alt:a.data.name}),R.jsx("span",{style:{whiteSpace:"nowrap"},children:a.data.name})]})}),IndicatorSeparator:()=>null},options:s||[],getOptionLabel:a=>a.name||a.name_slug,getOptionValue:a=>a.name_slug,value:e,onChange:a=>t==null?void 0:t(a||void 0),onInputChange:a=>r(a),isLoading:o})}const Ha=e=>{var r;const t=mt(),n=Mt({queryKey:["components",e],queryFn:()=>t.components(e)});return{...n,components:((r=n.data)==null?void 0:r.data)||[]}};function Eb({app:e,componentType:t,value:n,onChange:r}){const i=B.useId(),{isLoading:o,components:s}=Ha({app:e==null?void 0:e.name_slug,componentType:t});return R.jsx(br,{instanceId:i,className:"react-select-container text-sm",classNamePrefix:"react-select",options:s,getOptionLabel:u=>u.name||u.key,getOptionValue:u=>u.key,value:n,onChange:u=>r==null?void 0:r(u||void 0),isLoading:o,components:{IndicatorSeparator:()=>null}})}X.Alert=Ao,X.ComponentForm=La,X.ComponentFormContainer=Ab,X.Control=Oa,X.ControlAny=Sb,X.ControlApp=Fa,X.ControlBoolean=Pa,X.ControlInput=Ga,X.ControlSelect=Or,X.ControlSubmit=Na,X.CustomizationContext=Br,X.CustomizeProvider=bb,X.Description=Ca,X.ErrorBoundary=Da,X.Errors=xa,X.Field=Ta,X.FormContext=ri,X.FormContextProvider=jo,X.FormFieldContext=eo,X.FrontendClientProvider=_l,X.InternalComponentForm=Ma,X.InternalField=Ra,X.Label=Aa,X.OptionalFieldButton=Sa,X.RemoteOptionsContainer=Ba,X.SelectApp=wb,X.SelectComponent=Eb,X.defaultComponents=wa,X.defaultTheme=yr,X.getReactSelectTheme=Js,X.mergeTheme=Ir,X.skippablePropTypes=kn,X.unstyledTheme=js,X.useAccounts=Ea,X.useApp=Va,X.useApps=za,X.useComponent=Xa,X.useComponents=Ha,X.useCustomize=je,X.useFormContext=tr,X.useFormFieldContext=Ht,X.useFrontendClient=mt,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/connect-react",
3
- "version": "1.0.0-preview.16",
3
+ "version": "1.0.0-preview.17",
4
4
  "description": "Pipedream Connect library for React",
5
5
  "files": [
6
6
  "dist"