@pipedream/connect-react 1.0.0-preview.4 → 1.0.0-preview.5
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/connect-react.es.js +277 -276
- package/dist/connect-react.umd.js +1 -1
- package/package.json +1 -1
|
@@ -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 ra(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ia(e,t){const n=km(e,t),r=n.one(e,void 0),i=Im(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 Rm(e,t){return e&&"run"in e?async function(n,r){const i=ia(n,{file:r,...t});await e.run(i,r)}:function(n,r){return ia(n,{file:r,...e||t})}}function oa(e){if(e)throw e}var Pr=Object.prototype.hasOwnProperty,sa=Object.prototype.toString,ua=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,la=function(t){return typeof Array.isArray=="function"?Array.isArray(t):sa.call(t)==="[object Array]"},ca=function(t){if(!t||sa.call(t)!=="[object Object]")return!1;var n=Pr.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Pr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Pr.call(t,i)},da=function(t,n){ua&&n.name==="__proto__"?ua(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},pa=function(t,n){if(n==="__proto__")if(Pr.call(t,n)){if(aa)return aa(t,n).value}else return;return t[n]},Dm=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=pa(u,n),i=pa(t,n),u!==i&&(c&&i&&(ca(i)||(o=la(i)))?(o?(o=!1,s=r&&la(r)?r:[]):s=r&&ca(r)?r:{},da(u,{name:n,newValue:e(c,s,i)})):typeof i<"u"&&da(u,{name:n,newValue:i}));return u};const Hi=xo(Dm);function Wi(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 Nm(){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?Mm(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 Mm(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 st={basename:Lm,dirname:Xm,extname:zm,join:Hm,sep:"/"};function Lm(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Xn(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 Xm(e){if(Xn(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 zm(e){Xn(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 Hm(...e){let t=-1,n;for(;++t<e.length;)Xn(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Wm(n)}function Wm(e){Xn(e);const t=e.codePointAt(0)===47;let n=Zm(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Zm(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 Xn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const jm={cwd:Ym};function Ym(){return"/"}function Zi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Jm(e){if(typeof e=="string")e=new URL(e);else if(!Zi(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 _m(e)}function _m(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 ji=["history","path","basename","stem","extname","dirname"];class fa{constructor(t){let n;t?Zi(t)?n={path:t}:typeof t=="string"||Um(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":jm.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ji.length;){const o=ji[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)ji.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?st.basename(this.path):void 0}set basename(t){Ji(t,"basename"),Yi(t,"basename"),this.path=st.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?st.dirname(this.path):void 0}set dirname(t){ha(this.basename,"dirname"),this.path=st.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?st.extname(this.path):void 0}set extname(t){if(Yi(t,"extname"),ha(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=st.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Zi(t)&&(t=Jm(t)),Ji(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?st.basename(this.path,this.extname):void 0}set stem(t){Ji(t,"stem"),Yi(t,"stem"),this.path=st.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 Pe(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 Yi(e,t){if(e&&e.includes(st.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+st.sep+"`")}function Ji(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ha(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Um(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Qm=function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},qm={}.hasOwnProperty;class _i extends Qm{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=Nm()}copy(){const t=new _i;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Hi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(qi("data",this.frozen),this.namespace[t]=n,this):qm.call(this.namespace,t)&&this.namespace[t]||void 0:t?(qi("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=Gr(t),r=this.parser||this.Parser;return Ui("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ui("process",this.parser||this.Parser),Qi("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const u=Gr(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);eb(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(),Ui("processSync",this.parser||this.Parser),Qi("processSync",this.compiler||this.Compiler),this.process(t,i),ma("processSync","process",n),r;function i(o,s){n=!0,oa(o),r=s}}run(t,n,r){ga(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=Gr(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),ma("runSync","run",r),i;function o(s,u){oa(s),i=u,r=!0}}stringify(t,n){this.freeze();const r=Gr(n),i=this.compiler||this.Compiler;return Qi("stringify",i),ga(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(qi("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=Hi(!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 m=r[f][1];Wi(m)&&Wi(p)&&(p=Hi(!0,m,p)),r[f]=[l,p,...b]}}}}const $m=new _i().freeze();function Ui(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Qi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function qi(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 ga(e){if(!Wi(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ma(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Gr(e){return Km(e)?e:new fa(e)}function Km(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function eb(e){return typeof e=="string"||tb(e)}function tb(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const nb="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ba=[],ya={allowDangerousHtml:!0},rb=/^(https?|ircs?|mailto|xmpp)$/i,ib=[{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 ob(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",i=e.className,o=e.components,s=e.disallowedElements,u=e.rehypePlugins||ba,a=e.remarkPlugins||ba,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ya}:ya,c=e.skipHtml,d=e.unwrapDisallowed,f=e.urlTransform||sb,p=$m().use(Xg).use(a).use(Rm,l).use(u),b=new fa;typeof r=="string"&&(b.value=r);for(const E of ib)Object.hasOwn(e,E.from)&&(""+E.from+(E.to?"use `"+E.to+"` instead":"remove it")+nb+E.id,void 0);const m=p.parse(b);let I=p.runSync(m,b);return i&&(I={type:"element",tagName:"div",properties:{className:i},children:I.type==="root"?I.children:[I]}),na(I,v),Ff(I,{Fragment:D.Fragment,components:o,ignoreInvalidStyle:!0,jsx:D.jsx,jsxs:D.jsxs,passKeys:!0,passNode:!0});function v(E,S,w){if(E.type==="raw"&&w&&typeof S=="number")return c?w.children.splice(S,1):w.children[S]={type:"text",value:E.value},S;if(E.type==="element"){let P;for(P in Pi)if(Object.hasOwn(Pi,P)&&Object.hasOwn(E.properties,P)){const A=E.properties[P],T=Pi[P];(T===null||T.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 S=="number"&&(P=!n(E,S,w)),P&&w&&typeof S=="number")return d&&E.children?w.children.splice(S,1,...E.children):w.children.splice(S,1),S}}}function sb(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||rb.test(e.slice(0,t))?e:""}function Ia(e){e.field||console.log("props",e);const{field:t,markdown:n}=e,{prop:r}=t,{getClassNames:i,getStyles:o,theme:s}=He(),u={color:s.colors.neutral50,fontWeight:400,fontSize:"0.75rem",gridArea:"description",textWrap:"balance",lineHeight:"1.5"};return r.type==="app"?D.jsx("p",{className:i("description",e),style:o("description",u,e),children:"Credentials are encrypted."}):r.description?D.jsx("div",{className:i("description",e),style:o("description",u,e),children:D.jsx(ob,{children:n})}):null}function va(e){const{errors:t}=e,{getProps:n,theme:r}=He(),i={color:r.colors.danger,gridArea:"errors"};return t.length?D.jsx("ul",{...n("errors",i,e),children:t.map(o=>D.jsx("li",{...n("error",i,e),children:o},o))}):null}function Ca(e){const{text:t,field:n}=e,{id:r}=n,{getProps:i,theme:o}=He(),s={color:o.colors.neutral90,fontWeight:450,gridArea:"label",textTransform:"capitalize",lineHeight:"1.5"};return D.jsx("label",{htmlFor:r,...i("label",s,e),children:t})}const xa=e=>{const{prop:t,enabled:n,onClick:r}=e,{getProps:i,theme:o}=He(),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 D.jsxs("button",{onClick:r,type:"button",...i("optionalFieldButton",s,e),children:[D.jsx("span",{children:n?"-":"+"}),D.jsx("span",{style:{marginRight:8},children:t.label||t.name})]})},Aa={Description:Ia,Errors:va,Label:Ca,OptionalFieldButton:xa},kr=O.createContext({classNames:{},classNamePrefix:"",components:{},styles:{},theme:br,unstyled:!1});function ub(){const e=O.useContext(kr)??{},t=Zs(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{...fr,...a??{},...((l=e==null?void 0:e.components)==null?void 0:l[u])??{}}}function o(u,a){var l;return Pp(((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 He(){const e=O.useContext(kr)??{},t=e.theme,n=e.unstyled?Ws:br,r=typeof t=="function"?yr(n,t(n)):yr(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{...Aa,...(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:ub(),theme:r}}const ab=({children:e,...t})=>D.jsx(kr.Provider,{value:t,children:e}),$i=O.createContext(void 0),zt=()=>{const e=O.useContext($i);if(!e)throw new Error("Must be used inside FormFieldContext.Provider");return e},Sa=(e,t)=>{var i;const n=ht(),r=Nt({...t==null?void 0:t.useQueryOpts,queryKey:["accounts",e],queryFn:()=>n.getAccounts(e)});return{...r,accounts:((i=r.data)==null?void 0:i.data)||[]}},lb=e=>D.jsx(fr.Option,{...e,children:e.data.name});function wa({app:e}){const t=ht(),n=zt(),{id:r,prop:i,value:o,onChange:s}=n,{getProps:u,select:a,theme:l}=He(),c={color:l.colors.neutral60,gridArea:"control"},d={borderRadius:l.borderRadius,border:"solid 1px",borderColor:l.colors.neutral20,color:l.colors.neutral60,padding:"0.25rem 0.5rem",gridArea:"control"},f={components:{Option:lb},styles:{control:w=>({...w,gridArea:"control",boxShadow:l.boxShadow.input})}},p=a.getProps("controlAppSelect",f),b=void 0,{isLoading:m,accounts:I,refetch:v}=Sa({app:e.name_slug,oauth_app_id:b},{useQueryOpts:{enabled:!!e,suspense:!!e}}),E=async()=>{t.connectAccount({app:i.app,oauthAppId:b,onSuccess:async w=>{await v(),s({authProvisionId:w.id})},onError:()=>{}})},S=O.useMemo(()=>{let w=o;if(w!=null){for(const P of I)if(w.authProvisionId===P.id){w=P;break}}return w},[I,o]);return D.jsx("div",{...u("controlApp",c,{app:e,...n}),children:m?`Loading ${e.name} accounts...`:I.length?D.jsx(mr,{instanceId:r,value:S,options:[...I,{id:"_new",name:`Connect new ${e.name} account...`}],...p,required:!0,placeholder:`Select ${e.name} account...`,isLoading:m,isClearable:!0,isSearchable:!0,getOptionLabel:w=>w.name,getOptionValue:w=>w.id,onChange:w=>{w?w.id==="_new"?E():s({authProvisionId:w.id}):s(void 0)}}):D.jsxs("button",{type:"button",...u("connectButton",d,{app:e,...n}),onClick:()=>E(),children:["Connect ",e.name]})})}function Ea(){const e=zt(),{id:t,value:n,onChange:r}=e,{getProps:i}=He(),o={width:"16px",height:"16px",gridArea:"control",margin:"0 0.5rem 0 0"};return D.jsx("input",{id:t,type:"checkbox",...i("controlBoolean",o,e),checked:n??!1,onChange:s=>r(s.target.checked)})}function Fa(){const e=zt(),{id:t,onChange:n,prop:r,value:i}=e,{getProps:o,theme:s}=He(),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"),D.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 cb=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],Pa=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},Ki={formatCreateLabel:function(t){return'Create "'.concat(t,'"')},isValidNewOption:function(t,n,r,i){return!(!t||n.some(function(o){return Pa(t,o,i)})||r.some(function(o){return Pa(t,o,i)}))},getNewOptionData:function(t,n){return{label:n,value:t,__isNew__:!0}}};function db(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?Ki.formatCreateLabel:o,u=e.isValidNewOption,a=u===void 0?Ki.isValidNewOption:u,l=e.getNewOptionData,c=l===void 0?Ki.getNewOptionData:l,d=e.onCreateOption,f=e.options,p=f===void 0?[]:f,b=e.onChange,m=rt(e,cb),I=m.getOptionValue,v=I===void 0?Os:I,E=m.getOptionLabel,S=E===void 0?Bs:E,w=m.inputValue,P=m.isLoading,A=m.isMulti,T=m.value,k=m.name,V=O.useMemo(function(){return a(w,ar(T),p,{getOptionValue:v,getOptionLabel:S})?c(w,s(w)):void 0},[s,c,S,v,w,a,p,T]),j=O.useMemo(function(){return(n||!P)&&V?i==="first"?[V].concat(rn(p)):[].concat(rn(p),[V]):p},[n,i,P,V,p]),M=O.useCallback(function(B,ee){if(ee.action!=="select-option")return b(B,ee);var se=Array.isArray(B)?B:[B];if(se[se.length-1]===V){if(d)d(w);else{var Z=c(w,w),ne={action:"create-option",name:k,option:Z};b(Bn(A,[].concat(rn(ar(T)),[Z]),Z),ne)}return}b(B,ee)},[c,w,A,k,V,d,b,T]);return J(J({},m),{},{options:j,onChange:M})}var pb=O.forwardRef(function(e,t){var n=Jo(e),r=db(n);return K.createElement(bi,_({ref:t},r))}),fb=pb;function Br({isCreatable:e,options:t,selectProps:n}){const r=zt(),{id:i,prop:o,value:s,onChange:u}=r,{select:a,theme:l}=He(),c={styles:{container:p=>({...p,gridArea:"control",boxShadow:l.boxShadow.input})}},d=O.useMemo(()=>{let p=s;if(p!=null){if(Array.isArray(p)){if(typeof p[0]!="object"){const b=[];for(const m of p)b.push({label:m,value:m});p=b}}else if(typeof p!="object"&&(t==null?void 0:t[0])&&typeof t[0]=="object"){for(const m of t)if(m.value===s){p=m;break}}}return p},[s,t]),f=e?fb:mr;return D.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 m of p)b.push(m.value);u(b)}else u(p);else if(typeof p=="object"&&"value"in p)u(p.value);else throw new Error("unhandled option type");else u(void 0)}})}function Ga({queryEnabled:e}){const t=ht(),{userId:n,component:r,configurableProps:i,configuredProps:o,dynamicProps:s,props:{disableQueryDisabling:u}}=er(),{idx:a,prop:l}=zt(),[c,d]=O.useState(""),f={};for(let A=0;A<a;A++){const T=i[A];f[T.name]=o[T.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[m,I]=O.useState(),{isFetching:v,data:E,refetch:S}=Nt({queryKey:["componentConfigure",b],queryFn:async()=>{I(void 0);const A=await t.componentConfigure(p),{options:T,string_options:k,errors:V}=A;if(V!=null&&V.length){try{I(JSON.parse(V[0]))}catch{I({name:"Error",message:V[0]})}return[]}if(T!=null&&T.length)return T;if(k!=null&&k.length){const j=[];for(const M of k)j.push({label:M,value:M});return j}return[]},enabled:!!e}),w=m?m.message:u?"Click to configure":e?void 0:"Configure props above first",P=u?!1:!e;return D.jsx(Br,{options:E||[],selectProps:{isLoading:v,placeholder:w,isDisabled:P,inputValue:l.useQuery?c:void 0,onInputChange(A){l.useQuery&&(d(A),S())},onMenuOpen(){u&&!e&&S()}}})}function ka(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 D.jsx(Ga,{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}))),D.jsx(Br,{options:u,components:{IndicatorSeparator:()=>null}})}if(i.type.endsWith("[][]"))throw new Error("Unsupported property type: "+i.type);if(i.type.endsWith("[]"))return D.jsx(Br,{isCreatable:!0,options:[],components:{IndicatorSeparator:()=>null}});switch(i.type){case"app":return D.jsx(wa,{app:s});case"boolean":return D.jsx(Ea,{});case"string":case"integer":return D.jsx(Fa,{});default:throw new Error("Unsupported property type: "+i.type)}}function Ba(e){const{form:t,field:n}=e,{prop:r}=n,{getProps:i,getComponents:o}=He(),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`),D.jsxs("div",{...i("field",s,e),children:[D.jsx(u,{text:f,field:n,form:t}),D.jsx(ka,{field:n,form:t}),D.jsx(a,{markdown:r.description,field:n,form:t}),D.jsx(l,{errors:c,field:n,form:t})]})}const Oa=(e,t)=>{var i;const n=ht(),r=Nt({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 Ta({prop:e,idx:t}){const n=er(),{id:r,configuredProps:i,setConfiguredProp:o}=n,s=e.type==="app"&&"app"in e?e.app:void 0,{app:u}=Oa(s||"",{useQueryOpts:{enabled:!!s,suspense:!!s}}),l={id:`pd${r}${e.name}`,prop:e,idx:t,value:i[e.name],onChange(c){o(t,c)},extra:{app:u}};return D.jsx($i.Provider,{value:l,children:D.jsx(Ba,{field:l,form:n})})}class Va extends O.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 Ra(e){var s;const{form:t}=e,{submitting:n}=t,{getProps:r,theme:i}=He(),o={width:"fit-content",textTransform:"capitalize",backgroundColor:i.colors.primary,color:i.colors.neutral0,padding:`${i.spacing.baseUnit*1.75}px ${i.spacing.baseUnit*16}px`,borderRadius:i.borderRadius,boxShadow:(s=i.boxShadow)==null?void 0:s.button,cursor:"pointer",fontSize:"0.875rem",opacity:n?.5:void 0,margin:"0.5rem 0 0 0"};return D.jsx("input",{type:"submit",value:n?"Submitting...":"Submit",...r("controlSubmit",o,e),disabled:n})}function Da(){const e=er(),{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}=He(),{OptionalFieldButton:p}=c(),b={display:"flex",flexDirection:"column",gap:"1.5rem"},m={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 w=>{if(l&&(w.preventDefault(),r)){u(!0);try{await l(e)}finally{u(!1)}}},E=[],S=[];for(let w=0;w<t.length;w++){const P=t[w];if(!P.hidden){if(P.optional){const A=i(P);if(S.push([P,A]),!A)continue}E.push([P,w])}}return D.jsx(Va,{fallback:w=>D.jsxs("p",{style:{color:"red"},children:["Error: ",w&&typeof w=="object"&&"message"in w&&typeof w.message=="string"?w.message:"Unknown"]}),children:D.jsx(O.Suspense,{fallback:D.jsx("p",{children:"Loading form..."}),children:D.jsxs("form",{...d("componentForm",b,s),onSubmit:v,children:[E.map(([w,P])=>w.type==="alert"?D.jsx(Co,{prop:w},w.name):D.jsx(Ta,{prop:w,idx:P},w.name)),n&&D.jsx("p",{children:"Loading dynamic props..."}),!a&&S.length?D.jsxs("div",{children:[D.jsx("div",{...d("heading",I,s),children:"Optional Props"}),D.jsx("div",{...d("optionalFields",m,s),children:S.map(([w,P])=>D.jsx(p,{prop:w,enabled:P,onClick:()=>o(w,!P)},w.name))})]}):null,l&&D.jsx(Ra,{form:e})]})})})}function Na(e){return D.jsx(Wo,{props:e,children:D.jsx(Da,{})})}const Ma=({key:e},t)=>{var i;const n=ht(),r=Nt({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 hb(e){const{isLoading:t,error:n,component:r}=Ma({key:e.componentKey});if(!e.componentKey)throw new Error("componentKey required");return t?D.jsx("p",{children:"Loading..."}):n?D.jsxs("p",{children:["Error: ",n.message]}):r?D.jsx(Na,{component:r,...e}):D.jsx("p",{children:"Component not found"})}function gb(){const e=zt(),{id:t,onChange:n,value:r}=e,{getProps:i,theme:o}=He(),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)),D.jsx("textarea",{id:t,value:u,onChange:a=>n(a.target.value),...i("controlAny",s,e)})}const La=e=>{var r;const t=ht(),n=Nt({queryKey:["apps",e],queryFn:()=>t.apps(e)});return{...n,apps:(r=n.data)==null?void 0:r.data}};function mb({value:e,onChange:t}){const[n,r]=O.useState(""),i=O.useId(),{isLoading:o,apps:s}=La({q:n}),{Option:u}=fr;return D.jsx(mr,{instanceId:i,className:"react-select-container text-sm",classNamePrefix:"react-select",components:{Option:a=>D.jsx(u,{...a,children:D.jsxs("div",{style:{display:"flex",gap:10},children:[D.jsx("img",{src:`https://pipedream.com/s.v0/${a.data.id}/logo/48`,style:{height:24,width:24},alt:a.data.name}),D.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 Xa=e=>{var r;const t=ht(),n=Nt({queryKey:["components",e],queryFn:()=>t.components(e)});return{...n,components:((r=n.data)==null?void 0:r.data)||[]}};function bb({app:e,componentType:t,value:n,onChange:r}){const i=O.useId(),{isLoading:o,components:s}=Xa({app:e==null?void 0:e.name_slug,componentType:t});return D.jsx(mr,{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}})}L.Alert=Co,L.ComponentForm=Na,L.ComponentFormContainer=hb,L.Control=ka,L.ControlAny=gb,L.ControlApp=wa,L.ControlBoolean=Ea,L.ControlInput=Fa,L.ControlSelect=Br,L.ControlSubmit=Ra,L.CustomizationContext=kr,L.CustomizeProvider=ab,L.Description=Ia,L.ErrorBoundary=Va,L.Errors=va,L.Field=Ba,L.FormContext=ti,L.FormContextProvider=Wo,L.FormFieldContext=$i,L.FrontendClientProvider=Yl,L.InternalComponentForm=Da,L.InternalField=Ta,L.Label=Ca,L.OptionalFieldButton=xa,L.RemoteOptionsContainer=Ga,L.SelectApp=mb,L.SelectComponent=bb,L.defaultComponents=Aa,L.defaultTheme=br,L.getReactSelectTheme=Zs,L.mergeTheme=yr,L.unstyledTheme=Ws,L.useAccounts=Sa,L.useApp=Oa,L.useApps=La,L.useComponent=Ma,L.useComponents=Xa,L.useCustomize=He,L.useFormContext=er,L.useFormFieldContext=zt,L.useFrontendClient=ht,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
|
19
|
+
`},i),o}function Rm(e,t){return e&&"run"in e?async function(n,r){const i=ia(n,{file:r,...t});await e.run(i,r)}:function(n,r){return ia(n,{file:r,...e||t})}}function oa(e){if(e)throw e}var Pr=Object.prototype.hasOwnProperty,sa=Object.prototype.toString,ua=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,la=function(t){return typeof Array.isArray=="function"?Array.isArray(t):sa.call(t)==="[object Array]"},ca=function(t){if(!t||sa.call(t)!=="[object Object]")return!1;var n=Pr.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Pr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Pr.call(t,i)},da=function(t,n){ua&&n.name==="__proto__"?ua(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},pa=function(t,n){if(n==="__proto__")if(Pr.call(t,n)){if(aa)return aa(t,n).value}else return;return t[n]},Dm=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=pa(u,n),i=pa(t,n),u!==i&&(c&&i&&(ca(i)||(o=la(i)))?(o?(o=!1,s=r&&la(r)?r:[]):s=r&&ca(r)?r:{},da(u,{name:n,newValue:e(c,s,i)})):typeof i<"u"&&da(u,{name:n,newValue:i}));return u};const Hi=xo(Dm);function Wi(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 Nm(){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?Mm(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 Mm(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 st={basename:Lm,dirname:Xm,extname:zm,join:Hm,sep:"/"};function Lm(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Xn(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 Xm(e){if(Xn(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 zm(e){Xn(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 Hm(...e){let t=-1,n;for(;++t<e.length;)Xn(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Wm(n)}function Wm(e){Xn(e);const t=e.codePointAt(0)===47;let n=Zm(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Zm(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 Xn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const jm={cwd:Ym};function Ym(){return"/"}function Zi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Jm(e){if(typeof e=="string")e=new URL(e);else if(!Zi(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 _m(e)}function _m(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 ji=["history","path","basename","stem","extname","dirname"];class fa{constructor(t){let n;t?Zi(t)?n={path:t}:typeof t=="string"||Um(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":jm.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ji.length;){const o=ji[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)ji.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?st.basename(this.path):void 0}set basename(t){Ji(t,"basename"),Yi(t,"basename"),this.path=st.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?st.dirname(this.path):void 0}set dirname(t){ha(this.basename,"dirname"),this.path=st.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?st.extname(this.path):void 0}set extname(t){if(Yi(t,"extname"),ha(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=st.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Zi(t)&&(t=Jm(t)),Ji(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?st.basename(this.path,this.extname):void 0}set stem(t){Ji(t,"stem"),Yi(t,"stem"),this.path=st.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 Pe(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 Yi(e,t){if(e&&e.includes(st.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+st.sep+"`")}function Ji(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ha(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Um(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Qm=function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},qm={}.hasOwnProperty;class _i extends Qm{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=Nm()}copy(){const t=new _i;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Hi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(qi("data",this.frozen),this.namespace[t]=n,this):qm.call(this.namespace,t)&&this.namespace[t]||void 0:t?(qi("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=Gr(t),r=this.parser||this.Parser;return Ui("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ui("process",this.parser||this.Parser),Qi("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const u=Gr(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);eb(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(),Ui("processSync",this.parser||this.Parser),Qi("processSync",this.compiler||this.Compiler),this.process(t,i),ma("processSync","process",n),r;function i(o,s){n=!0,oa(o),r=s}}run(t,n,r){ga(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=Gr(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),ma("runSync","run",r),i;function o(s,u){oa(s),i=u,r=!0}}stringify(t,n){this.freeze();const r=Gr(n),i=this.compiler||this.Compiler;return Qi("stringify",i),ga(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(qi("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=Hi(!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 m=r[f][1];Wi(m)&&Wi(p)&&(p=Hi(!0,m,p)),r[f]=[l,p,...b]}}}}const $m=new _i().freeze();function Ui(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Qi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function qi(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 ga(e){if(!Wi(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ma(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Gr(e){return Km(e)?e:new fa(e)}function Km(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function eb(e){return typeof e=="string"||tb(e)}function tb(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const nb="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ba=[],ya={allowDangerousHtml:!0},rb=/^(https?|ircs?|mailto|xmpp)$/i,ib=[{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 ob(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",i=e.className,o=e.components,s=e.disallowedElements,u=e.rehypePlugins||ba,a=e.remarkPlugins||ba,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ya}:ya,c=e.skipHtml,d=e.unwrapDisallowed,f=e.urlTransform||sb,p=$m().use(Xg).use(a).use(Rm,l).use(u),b=new fa;typeof r=="string"&&(b.value=r);for(const E of ib)Object.hasOwn(e,E.from)&&(""+E.from+(E.to?"use `"+E.to+"` instead":"remove it")+nb+E.id,void 0);const m=p.parse(b);let I=p.runSync(m,b);return i&&(I={type:"element",tagName:"div",properties:{className:i},children:I.type==="root"?I.children:[I]}),na(I,v),Ff(I,{Fragment:D.Fragment,components:o,ignoreInvalidStyle:!0,jsx:D.jsx,jsxs:D.jsxs,passKeys:!0,passNode:!0});function v(E,S,w){if(E.type==="raw"&&w&&typeof S=="number")return c?w.children.splice(S,1):w.children[S]={type:"text",value:E.value},S;if(E.type==="element"){let P;for(P in Pi)if(Object.hasOwn(Pi,P)&&Object.hasOwn(E.properties,P)){const A=E.properties[P],T=Pi[P];(T===null||T.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 S=="number"&&(P=!n(E,S,w)),P&&w&&typeof S=="number")return d&&E.children?w.children.splice(S,1,...E.children):w.children.splice(S,1),S}}}function sb(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||rb.test(e.slice(0,t))?e:""}function Ia(e){e.field||console.log("props",e);const{field:t,markdown:n}=e,{prop:r}=t,{getClassNames:i,getStyles:o,theme:s}=He(),u={color:s.colors.neutral50,fontWeight:400,fontSize:"0.75rem",gridArea:"description",textWrap:"balance",lineHeight:"1.5"};return r.type==="app"?D.jsx("p",{className:i("description",e),style:o("description",u,e),children:"Credentials are encrypted."}):r.description?D.jsx("div",{className:i("description",e),style:o("description",u,e),children:D.jsx(ob,{children:n})}):null}function va(e){const{errors:t}=e,{getProps:n,theme:r}=He(),i={color:r.colors.danger,gridArea:"errors"};return t.length?D.jsx("ul",{...n("errors",i,e),children:t.map(o=>D.jsx("li",{...n("error",i,e),children:o},o))}):null}function Ca(e){const{text:t,field:n}=e,{id:r}=n,{getProps:i,theme:o}=He(),s={color:o.colors.neutral90,fontWeight:450,gridArea:"label",textTransform:"capitalize",lineHeight:"1.5"};return D.jsx("label",{htmlFor:r,...i("label",s,e),children:t})}const xa=e=>{const{prop:t,enabled:n,onClick:r}=e,{getProps:i,theme:o}=He(),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 D.jsxs("button",{onClick:r,type:"button",...i("optionalFieldButton",s,e),children:[D.jsx("span",{children:n?"-":"+"}),D.jsx("span",{style:{marginRight:8},children:t.label||t.name})]})},Aa={Description:Ia,Errors:va,Label:Ca,OptionalFieldButton:xa},kr=O.createContext({classNames:{},classNamePrefix:"",components:{},styles:{},theme:br,unstyled:!1});function ub(){const e=O.useContext(kr)??{},t=Zs(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{...fr,...a??{},...((l=e==null?void 0:e.components)==null?void 0:l[u])??{}}}function o(u,a){var l;return Pp(((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 He(){const e=O.useContext(kr)??{},t=e.theme,n=e.unstyled?Ws:br,r=typeof t=="function"?yr(n,t(n)):yr(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{...Aa,...(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:ub(),theme:r}}const ab=({children:e,...t})=>D.jsx(kr.Provider,{value:t,children:e}),$i=O.createContext(void 0),zt=()=>{const e=O.useContext($i);if(!e)throw new Error("Must be used inside FormFieldContext.Provider");return e},Sa=(e,t)=>{var i;const n=ht(),r=Nt({...t==null?void 0:t.useQueryOpts,queryKey:["accounts",e],queryFn:()=>n.getAccounts(e)});return{...r,accounts:((i=r.data)==null?void 0:i.data)||[]}},lb=e=>D.jsx(fr.Option,{...e,children:e.data.name});function wa({app:e}){const t=ht(),n=zt(),{id:r,prop:i,value:o,onChange:s}=n,{getProps:u,select:a,theme:l}=He(),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:lb},styles:{control:w=>({...w,gridArea:"control",boxShadow:l.boxShadow.input})}},p=a.getProps("controlAppSelect",f),b=void 0,{isLoading:m,accounts:I,refetch:v}=Sa({app:e.name_slug,oauth_app_id:b},{useQueryOpts:{enabled:!!e,suspense:!!e}}),E=async()=>{t.connectAccount({app:i.app,oauthAppId:b,onSuccess:async w=>{await v(),s({authProvisionId:w.id})},onError:()=>{}})},S=O.useMemo(()=>{let w=o;if(w!=null){for(const P of I)if(w.authProvisionId===P.id){w=P;break}}return w},[I,o]);return D.jsx("div",{...u("controlApp",c,{app:e,...n}),children:m?`Loading ${e.name} accounts...`:I.length?D.jsx(mr,{instanceId:r,value:S,options:[...I,{id:"_new",name:`Connect new ${e.name} account...`}],...p,required:!0,placeholder:`Select ${e.name} account...`,isLoading:m,isClearable:!0,isSearchable:!0,getOptionLabel:w=>w.name,getOptionValue:w=>w.id,onChange:w=>{w?w.id==="_new"?E():s({authProvisionId:w.id}):s(void 0)}}):D.jsxs("button",{type:"button",...u("connectButton",d,{app:e,...n}),onClick:()=>E(),children:["Connect ",e.name]})})}function Ea(){const e=zt(),{id:t,value:n,onChange:r}=e,{getProps:i}=He(),o={width:"16px",height:"16px",gridArea:"control",margin:"0 0.5rem 0 0"};return D.jsx("input",{id:t,type:"checkbox",...i("controlBoolean",o,e),checked:n??!1,onChange:s=>r(s.target.checked)})}function Fa(){const e=zt(),{id:t,onChange:n,prop:r,value:i}=e,{getProps:o,theme:s}=He(),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"),D.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 cb=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],Pa=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},Ki={formatCreateLabel:function(t){return'Create "'.concat(t,'"')},isValidNewOption:function(t,n,r,i){return!(!t||n.some(function(o){return Pa(t,o,i)})||r.some(function(o){return Pa(t,o,i)}))},getNewOptionData:function(t,n){return{label:n,value:t,__isNew__:!0}}};function db(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?Ki.formatCreateLabel:o,u=e.isValidNewOption,a=u===void 0?Ki.isValidNewOption:u,l=e.getNewOptionData,c=l===void 0?Ki.getNewOptionData:l,d=e.onCreateOption,f=e.options,p=f===void 0?[]:f,b=e.onChange,m=rt(e,cb),I=m.getOptionValue,v=I===void 0?Os:I,E=m.getOptionLabel,S=E===void 0?Bs:E,w=m.inputValue,P=m.isLoading,A=m.isMulti,T=m.value,k=m.name,V=O.useMemo(function(){return a(w,ar(T),p,{getOptionValue:v,getOptionLabel:S})?c(w,s(w)):void 0},[s,c,S,v,w,a,p,T]),j=O.useMemo(function(){return(n||!P)&&V?i==="first"?[V].concat(rn(p)):[].concat(rn(p),[V]):p},[n,i,P,V,p]),M=O.useCallback(function(B,ee){if(ee.action!=="select-option")return b(B,ee);var se=Array.isArray(B)?B:[B];if(se[se.length-1]===V){if(d)d(w);else{var Z=c(w,w),ne={action:"create-option",name:k,option:Z};b(Bn(A,[].concat(rn(ar(T)),[Z]),Z),ne)}return}b(B,ee)},[c,w,A,k,V,d,b,T]);return J(J({},m),{},{options:j,onChange:M})}var pb=O.forwardRef(function(e,t){var n=Jo(e),r=db(n);return K.createElement(bi,_({ref:t},r))}),fb=pb;function Br({isCreatable:e,options:t,selectProps:n}){const r=zt(),{id:i,prop:o,value:s,onChange:u}=r,{select:a,theme:l}=He(),c={styles:{container:p=>({...p,gridArea:"control",boxShadow:l.boxShadow.input})}},d=O.useMemo(()=>{let p=s;if(p!=null){if(Array.isArray(p)){if(typeof p[0]!="object"){const b=[];for(const m of p)b.push({label:m,value:m});p=b}}else if(typeof p!="object"&&(t==null?void 0:t[0])&&typeof t[0]=="object"){for(const m of t)if(m.value===s){p=m;break}}}return p},[s,t]),f=e?fb:mr;return D.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 m of p)b.push(m.value);u(b)}else u(p);else if(typeof p=="object"&&"value"in p)u(p.value);else throw new Error("unhandled option type");else u(void 0)}})}function Ga({queryEnabled:e}){const t=ht(),{userId:n,component:r,configurableProps:i,configuredProps:o,dynamicProps:s,props:{disableQueryDisabling:u}}=er(),{idx:a,prop:l}=zt(),[c,d]=O.useState(""),f={};for(let A=0;A<a;A++){const T=i[A];f[T.name]=o[T.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[m,I]=O.useState(),{isFetching:v,data:E,refetch:S}=Nt({queryKey:["componentConfigure",b],queryFn:async()=>{I(void 0);const A=await t.componentConfigure(p),{options:T,string_options:k,errors:V}=A;if(V!=null&&V.length){try{I(JSON.parse(V[0]))}catch{I({name:"Error",message:V[0]})}return[]}if(T!=null&&T.length)return T;if(k!=null&&k.length){const j=[];for(const M of k)j.push({label:M,value:M});return j}return[]},enabled:!!e}),w=m?m.message:u?"Click to configure":e?void 0:"Configure props above first",P=u?!1:!e;return D.jsx(Br,{options:E||[],selectProps:{isLoading:v,placeholder:w,isDisabled:P,inputValue:l.useQuery?c:void 0,onInputChange(A){l.useQuery&&(d(A),S())},onMenuOpen(){u&&!e&&S()}}})}function ka(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 D.jsx(Ga,{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}))),D.jsx(Br,{options:u,components:{IndicatorSeparator:()=>null}})}if(i.type.endsWith("[][]"))throw new Error("Unsupported property type: "+i.type);if(i.type.endsWith("[]"))return D.jsx(Br,{isCreatable:!0,options:[],components:{IndicatorSeparator:()=>null}});switch(i.type){case"app":return D.jsx(wa,{app:s});case"boolean":return D.jsx(Ea,{});case"string":case"integer":return D.jsx(Fa,{});default:throw new Error("Unsupported property type: "+i.type)}}function Ba(e){const{form:t,field:n}=e,{prop:r}=n,{getProps:i,getComponents:o}=He(),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`),D.jsxs("div",{...i("field",s,e),children:[D.jsx(u,{text:f,field:n,form:t}),D.jsx(ka,{field:n,form:t}),D.jsx(a,{markdown:r.description,field:n,form:t}),D.jsx(l,{errors:c,field:n,form:t})]})}const Oa=(e,t)=>{var i;const n=ht(),r=Nt({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 Ta({prop:e,idx:t}){const n=er(),{id:r,configuredProps:i,setConfiguredProp:o}=n,s=e.type==="app"&&"app"in e?e.app:void 0,{app:u}=Oa(s||"",{useQueryOpts:{enabled:!!s,suspense:!!s}}),l={id:`pd${r}${e.name}`,prop:e,idx:t,value:i[e.name],onChange(c){o(t,c)},extra:{app:u}};return D.jsx($i.Provider,{value:l,children:D.jsx(Ba,{field:l,form:n})})}class Va extends O.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 Ra(e){var s;const{form:t}=e,{submitting:n}=t,{getProps:r,theme:i}=He(),o={width:"fit-content",textTransform:"capitalize",backgroundColor:i.colors.primary,color:i.colors.neutral0,padding:`${i.spacing.baseUnit*1.75}px ${i.spacing.baseUnit*16}px`,borderRadius:i.borderRadius,boxShadow:(s=i.boxShadow)==null?void 0:s.button,cursor:"pointer",fontSize:"0.875rem",opacity:n?.5:void 0,margin:"0.5rem 0 0 0"};return D.jsx("input",{type:"submit",value:n?"Submitting...":"Submit",...r("controlSubmit",o,e),disabled:n})}function Da(){const e=er(),{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}=He(),{OptionalFieldButton:p}=c(),b={display:"flex",flexDirection:"column",gap:"1.5rem"},m={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 w=>{if(l&&(w.preventDefault(),r)){u(!0);try{await l(e)}finally{u(!1)}}},E=[],S=[];for(let w=0;w<t.length;w++){const P=t[w];if(!P.hidden){if(P.optional){const A=i(P);if(S.push([P,A]),!A)continue}E.push([P,w])}}return D.jsx(Va,{fallback:w=>D.jsxs("p",{style:{color:"red"},children:["Error: ",w&&typeof w=="object"&&"message"in w&&typeof w.message=="string"?w.message:"Unknown"]}),children:D.jsx(O.Suspense,{fallback:D.jsx("p",{children:"Loading form..."}),children:D.jsxs("form",{...d("componentForm",b,s),onSubmit:v,children:[E.map(([w,P])=>w.type==="alert"?D.jsx(Co,{prop:w},w.name):D.jsx(Ta,{prop:w,idx:P},w.name)),n&&D.jsx("p",{children:"Loading dynamic props..."}),!a&&S.length?D.jsxs("div",{children:[D.jsx("div",{...d("heading",I,s),children:"Optional Props"}),D.jsx("div",{...d("optionalFields",m,s),children:S.map(([w,P])=>D.jsx(p,{prop:w,enabled:P,onClick:()=>o(w,!P)},w.name))})]}):null,l&&D.jsx(Ra,{form:e})]})})})}function Na(e){return D.jsx(Wo,{props:e,children:D.jsx(Da,{})})}const Ma=({key:e},t)=>{var i;const n=ht(),r=Nt({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 hb(e){const{isLoading:t,error:n,component:r}=Ma({key:e.componentKey});if(!e.componentKey)throw new Error("componentKey required");return t?D.jsx("p",{children:"Loading..."}):n?D.jsxs("p",{children:["Error: ",n.message]}):r?D.jsx(Na,{component:r,...e}):D.jsx("p",{children:"Component not found"})}function gb(){const e=zt(),{id:t,onChange:n,value:r}=e,{getProps:i,theme:o}=He(),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)),D.jsx("textarea",{id:t,value:u,onChange:a=>n(a.target.value),...i("controlAny",s,e)})}const La=e=>{var r;const t=ht(),n=Nt({queryKey:["apps",e],queryFn:()=>t.apps(e)});return{...n,apps:(r=n.data)==null?void 0:r.data}};function mb({value:e,onChange:t}){const[n,r]=O.useState(""),i=O.useId(),{isLoading:o,apps:s}=La({q:n}),{Option:u}=fr;return D.jsx(mr,{instanceId:i,className:"react-select-container text-sm",classNamePrefix:"react-select",components:{Option:a=>D.jsx(u,{...a,children:D.jsxs("div",{style:{display:"flex",gap:10},children:[D.jsx("img",{src:`https://pipedream.com/s.v0/${a.data.id}/logo/48`,style:{height:24,width:24},alt:a.data.name}),D.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 Xa=e=>{var r;const t=ht(),n=Nt({queryKey:["components",e],queryFn:()=>t.components(e)});return{...n,components:((r=n.data)==null?void 0:r.data)||[]}};function bb({app:e,componentType:t,value:n,onChange:r}){const i=O.useId(),{isLoading:o,components:s}=Xa({app:e==null?void 0:e.name_slug,componentType:t});return D.jsx(mr,{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}})}L.Alert=Co,L.ComponentForm=Na,L.ComponentFormContainer=hb,L.Control=ka,L.ControlAny=gb,L.ControlApp=wa,L.ControlBoolean=Ea,L.ControlInput=Fa,L.ControlSelect=Br,L.ControlSubmit=Ra,L.CustomizationContext=kr,L.CustomizeProvider=ab,L.Description=Ia,L.ErrorBoundary=Va,L.Errors=va,L.Field=Ba,L.FormContext=ti,L.FormContextProvider=Wo,L.FormFieldContext=$i,L.FrontendClientProvider=Yl,L.InternalComponentForm=Da,L.InternalField=Ta,L.Label=Ca,L.OptionalFieldButton=xa,L.RemoteOptionsContainer=Ga,L.SelectApp=mb,L.SelectComponent=bb,L.defaultComponents=Aa,L.defaultTheme=br,L.getReactSelectTheme=Zs,L.mergeTheme=yr,L.unstyledTheme=Ws,L.useAccounts=Sa,L.useApp=Oa,L.useApps=La,L.useComponent=Ma,L.useComponents=Xa,L.useCustomize=He,L.useFormContext=er,L.useFormFieldContext=zt,L.useFrontendClient=ht,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|