@prismatic-io/components-intercom 0.3.0 → 0.3.1

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/index.js CHANGED
@@ -215,4 +215,4 @@ e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=
215
215
  * @author Feross Aboukhadijeh <https://feross.org>
216
216
  * @license MIT
217
217
  */
218
- let t=Nm(),n=Pm(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(K(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||fe(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(K(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return le(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return de(e).length;default:if(i)return r?-1:le(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return A(this,t,n);case`ascii`:return N(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return k(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return I(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?A(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,fe(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(fe(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return G(le(t,e.length-n),e,n,r)}function E(e,t,n,r){return G(W(t),e,n,r)}function D(e,t,n,r){return G(de(t),e,n,r)}function O(e,t,n,r){return G(ue(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return O(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function k(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function A(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return M(r)}let j=4096;function M(e){let t=e.length;if(t<=j)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=j));return n}function N(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=pe[e[r]];return i}function I(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function L(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)};function R(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function z(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function B(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=me(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=me(function(e,t=0){return B(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=me(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=me(function(e,t=0){return B(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ee(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let U={};function te(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}te(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),te(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),te(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ne(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ne(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ne(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function re(e,t,n){ae(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&oe(t,e.length-(n+1))}function ie(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}re(r,i,a)}function ae(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function oe(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ae(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let se=/[^+/0-9A-Za-z-_]/g;function ce(e){if(e=e.split(`=`)[0],e=e.trim().replace(se,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function le(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function W(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ue(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function de(e){return t.toByteArray(ce(e))}function G(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function fe(e){return e!==e}let pe=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function me(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}})),Im=a(((e,t)=>{let n=Mm(),r=typeof window<`u`?Fm().Buffer:global.Buffer;function i(e){return 12+4*Math.ceil(e.length/4)}function a(){return!(typeof window<`u`&&typeof document<`u`)}function o(e){return e.BYTES_PER_ELEMENT?e.length*e.BYTES_PER_ELEMENT:-1}function s(e){let t=0;try{let n=e;if(e instanceof Map?n=Object.fromEntries(e):e instanceof Set&&(n=Array.from(e)),ArrayBuffer.isView(e))return o(e);let i=JSON.stringify(n,(e,t)=>typeof t==`bigint`||typeof t==`function`?t.toString():t===void 0?`undefined`:typeof t==`symbol`||t instanceof RegExp?t.toString():t);t=r.byteLength(i,`utf8`)}catch{return Error(-1)}return t}function c(e){let t=[],o=[e],s=0;for(;o.length;){let c=o.pop();if(typeof c==`boolean`)s+=n.BYTES;else if(typeof c==`string`)a()?s+=i(c):s+=c.length*n.STRING;else if(typeof c==`number`)s+=n.NUMBER;else if(typeof c==`symbol`)Symbol.keyFor&&Symbol.keyFor(e)?s+=Symbol.keyFor(e).length*n.STRING:s+=(e.toString().length-8)*n.STRING;else if(typeof c==`bigint`)s+=r.from(c.toString()).byteLength;else if(typeof c==`function`)s+=c.toString().length;else if(typeof c==`object`&&t.indexOf(c)===-1){t.push(c);for(let e in c)o.push(c[e])}}return s}t.exports=function(e){let t=0;return t=typeof e==`object`&&e?s(e):c(e),t}})),Lm=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inputs=e.debugRequest=e.fileDataFileNames=e.fileData=e.formData=e.retryAllErrors=e.useExponentialBackoff=e.retryDelayMS=e.maxRetries=e.queryParams=e.headers=e.responseType=e.method=e.timeout=e.data=e.url=void 0;let t=Om();e.url=(0,t.input)({label:`URL`,placeholder:`URL to call`,type:`string`,required:!0,comments:`This is the URL to call.`,example:`/sobjects/Account`,clean:e=>t.util.types.toString(e)}),e.data=(0,t.input)({label:`Data`,placeholder:`Data to send`,type:`string`,required:!1,comments:`The HTTP body payload to send to the URL.`,example:`{"exampleKey": "Example Data"}`}),e.timeout=(0,t.input)({label:`Timeout`,type:`string`,required:!1,comments:`The maximum time that a client will await a response to its request`,example:`2000`,clean:e=>t.util.types.toNumber(e)}),e.method=(0,t.input)({label:`Method`,type:`string`,required:!0,model:[`DELETE`,`GET`,`HEAD`,`LINK`,`OPTIONS`,`PATCH`,`POST`,`PURGE`,`PUT`,`UNLINK`].map(e=>({label:e,value:e})),comments:`The HTTP method to use.`,clean:e=>t.util.types.toString(e)}),e.responseType=(0,t.input)({label:`Response Type`,placeholder:`Response Type`,type:`string`,default:`json`,required:!0,comments:`The type of data you expect in the response. You can request json, text, or binary data.`,model:[`arraybuffer`,`document`,`json`,`text`].map(e=>({label:e,value:e})),clean:e=>t.util.types.toString(e)}),e.headers=(0,t.input)({label:`Header`,placeholder:`Header`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`A list of headers to send with the request.`,example:`User-Agent: curl/7.64.1`}),e.queryParams=(0,t.input)({label:`Query Parameter`,placeholder:`Query Parameter`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.`}),e.maxRetries=(0,t.input)({label:`Max Retry Count`,placeholder:`Max Retries`,type:`string`,required:!1,comments:`The maximum number of retries to attempt. Specify 0 for no retries.`,default:`0`,clean:e=>t.util.types.toNumber(e)}),e.retryDelayMS=(0,t.input)({label:`Retry Delay (ms)`,placeholder:`Retry Delay`,type:`string`,required:!1,comments:`The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled.`,default:`0`,clean:e=>t.util.types.toNumber(e,0)}),e.useExponentialBackoff=(0,t.input)({label:`Use Exponential Backoff`,type:`boolean`,default:`false`,required:!1,comments:`Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored.`,clean:e=>t.util.types.toBool(e)}),e.retryAllErrors=(0,t.input)({label:`Retry On All Errors`,type:`boolean`,default:`false`,required:!1,comments:`If true, retries on all erroneous responses regardless of type. This is helpful when retrying after HTTP 429 or other 3xx or 4xx errors. Otherwise, only retries on HTTP 5xx and network errors.`,clean:e=>t.util.types.toBool(e)}),e.formData=(0,t.input)({label:`Form Data`,placeholder:`Data to send`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`The Form Data to be sent as a multipart form upload.`,example:`[{"key": "Example Key", "value": new Buffer("Hello World")}]`}),e.fileData=(0,t.input)({label:`File Data`,placeholder:`Data to send`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`File Data to be sent as a multipart form upload.`,example:`[{key: "example.txt", value: "My File Contents"}]`}),e.fileDataFileNames=(0,t.input)({label:`File Data File Names`,placeholder:`The file name to apply to a file`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`File names to apply to the file data inputs. Keys must match the file data keys above.`,clean:e=>e?t.util.types.keyValPairListToObject(e):void 0}),e.debugRequest=(0,t.input)({label:`Debug Request`,type:`boolean`,required:!1,comments:`Enabling this flag will log out the current request.`,clean:e=>t.util.types.toBool(e)}),e.inputs={url:e.url,method:e.method,data:e.data,formData:e.formData,fileData:e.fileData,fileDataFileNames:e.fileDataFileNames,queryParams:e.queryParams,headers:e.headers,responseType:e.responseType,timeout:e.timeout,debugRequest:e.debugRequest,retryDelayMS:e.retryDelayMS,retryAllErrors:e.retryAllErrors,maxRetries:e.maxRetries,useExponentialBackoff:e.useExponentialBackoff}})),Rm=a((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),i=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},a=e&&e.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},o=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.inputs=e.buildRawRequestAction=e.sendRawRequest=e.handleErrors=e.createClient=e.toAxiosRetryConfig=void 0;let s=o(Nu()),c=r(Am()),l=o(bu()),u=o(jm()),d=o(Im()),f=Om(),p=o(dl()),m=Lm();Object.defineProperty(e,"inputs",{enumerable:!0,get:function(){return m.inputs}});let h=/^(cookie|set-cookie)$|auth|token|secret|password|api[-_]?key/i,g=e=>typeof e==`object`&&!!e&&typeof e.toJSON==`function`,_=e=>{let t=g(e)?e.toJSON():Object.assign({},e);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,h.test(e)?`[REDACTED]`:t]))},v=e=>{let t=p.default.types.toString(e.token?.access_token);if(t)return{Authorization:`Bearer ${t}`};let n=p.default.types.toString(e.fields?.apiKey);if(n)return{Authorization:`Bearer ${n}`};let r=p.default.types.toString(e.fields?.username),i=p.default.types.toString(e.fields?.password);if(r&&i)return{Authorization:`Basic ${Buffer.from(`${r}:${i}`).toString(`base64`)}`};throw Error(`Failed to guess at authorization parameters for Connection: ${e.key}`)},y=(e,t,n={})=>{let r=new l.default;return(e||[]).map(({key:e,value:t})=>r.append(e,t)),(t||[]).map(({key:e,value:t})=>r.append(e,p.default.types.toBufferDataPayload(t).data,{filename:n?.[e]||e})),r},b=(e,t)=>t?typeof e==`number`?t=>2**(t-1)*e:c.exponentialDelay:typeof e==`number`?()=>e:e;e.toAxiosRetryConfig=e=>{var{retryDelay:t,retryAllErrors:n,retryCondition:r,useExponentialBackoff:i}=e,o=a(e,[`retryDelay`,`retryAllErrors`,`retryCondition`,`useExponentialBackoff`]);return Object.assign(Object.assign({},o),{retryDelay:b(t,i),retryCondition:n?()=>!0:typeof r==`function`?r:c.isNetworkOrIdempotentRequestError})},e.createClient=({baseUrl:t,responseType:n,headers:r,timeout:i,params:a,debug:o=!1,retryConfig:l})=>{let u=s.default.create({baseURL:t,responseType:n,headers:r,timeout:i,params:a,maxContentLength:1/0,maxBodyLength:1/0});return o&&(u.interceptors.request.use(e=>{let{baseURL:t,headers:n,method:r,timeout:i,url:a,data:o,params:s}=e,c=(0,d.default)(o);return console.log(p.default.types.toJSON({type:`request`,baseURL:t,params:s,url:a,headers:_(n),method:r,timeout:i,data:c>1024*10||Buffer.isBuffer(o)?`<data (${c} bytes)>`:o},!0,!0)),e}),u.interceptors.response.use(e=>{let{headers:t,status:n,statusText:r,data:i}=e,a=(0,d.default)(i);return console.log(p.default.types.toJSON({type:`response`,headers:_(t),status:n,statusText:r,data:a>1024*10||Buffer.isBuffer(i)?`<data (${a} bytes)>`:i},!0,!0)),e})),l&&(0,c.default)(u,(0,e.toAxiosRetryConfig)(l)),u},e.handleErrors=e=>{if(s.default.isAxiosError(e)){let{message:t,response:n}=e;return{message:t,data:n?.data,status:n?.status,headers:n?.headers}}return e},e.sendRawRequest=(t,n,...r)=>i(void 0,[t,n,...r],void 0,function*(t,n,r={}){if(n.data&&(!(0,u.default)(n.formData)||!(0,u.default)(n.fileData)))throw Error(`Cannot specify both Data and File/Form Data.`);let i=!(0,u.default)(n.formData)||!(0,u.default)(n.fileData)?y(n.formData,n.fileData,n.fileDataFileNames):n.data;return yield(0,e.createClient)({baseUrl:t,debug:n.debugRequest,responseType:n.responseType,timeout:n.timeout,retryConfig:{retries:n.maxRetries,retryDelay:n.retryDelayMS,retryAllErrors:n.retryAllErrors,useExponentialBackoff:n.useExponentialBackoff}}).request({method:n.method,url:n.url,headers:Object.assign(Object.assign(Object.assign({},p.default.types.keyValPairListToObject(n.headers)),i instanceof l.default?i.getHeaders():{}),r),params:p.default.types.keyValPairListToObject(n.queryParams),data:i||void 0})}),e.buildRawRequestAction=(t,n=`Raw Request`,r=`Issue a raw HTTP request`)=>(0,f.action)({display:{label:n,description:r},inputs:Object.assign({connection:{label:`Connection`,type:`connection`,required:!0}},m.inputs),perform:(n,r)=>i(void 0,void 0,void 0,function*(){var{connection:n}=r,i=a(r,[`connection`]);let{data:o}=yield(0,e.sendRawRequest)(t,i,v(n));return{data:o}})})}))(),$=Om();const zm=(0,$.oauth2Connection)({key:`intercom`,display:{label:`OAuth 2.0`,description:`OAuth 2.0 connection for Intercom`},oauth2Type:$.OAuth2Type.AuthorizationCode,inputs:{authorizeUrl:{label:`Authorize URL`,type:`string`,required:!0,shown:!1,default:`https://app.intercom.com/oauth`,comments:`Authorization URL for Intercom`},tokenUrl:{label:`Token URL`,type:`string`,required:!0,shown:!1,default:`https://api.intercom.io/auth/eagle/token`,comments:`Token URL for Intercom`},scopes:{label:`Scopes`,type:`string`,required:!1,shown:!1,default:``,comments:`Space delimited scopes`},clientId:{label:`Client ID`,type:`string`,required:!0,comments:`Client ID of your Intercom app`},clientSecret:{label:`Client Secret`,type:`password`,required:!0,comments:`Client Secret of your Intercom app`}}}),Bm=(0,$.connection)({key:`intercomAccesssToken`,display:{label:`Access Token`,description:`Access Token connection for Intercom`},inputs:{accessToken:{label:`Access Token`,type:`password`,required:!0,comments:`Access Token for Intercom`}}});var Vm=[zm,Bm];const Hm=`https://api.intercom.io/`,Um=e=>{if(e.key!==zm.key&&e.key!==Bm.key)throw new $.ConnectionError(e,`Received unexpected connection type`)},Wm=e=>{Um(e);let t=`Did not receive a connection containing an access token.`,n=e.key===zm.key,r=e.key===Bm.key;if(n||r){let r=n?e.token?.access_token:e.fields.accessToken;if(!r)throw new $.ConnectionError(e,t);return $.util.types.toString(r)}throw new $.ConnectionError(e,t)},Gm=e=>({accessToken:Wm(e),baseUrl:Hm}),Km=(e,t)=>{let n=Wm(e);return(0,Rm.createClient)({baseUrl:Hm,headers:{Authorization:`Bearer ${n}`,Accept:`application/json`},responseType:`json`,debug:t})},qm={type:`company`,id:`531ee472cce572a6ec000006`,name:`Blue Sun`,plan:`plan1`,company_id:`6`,remote_created_at:1394531169,created_at:1394533506,updated_at:1396874658,size:85,website:`http://www.example.com`,industry:`Manufacturing`,monthly_spend:49,session_count:26,user_count:10,custom_attributes:{paid_subscriber:!0,team_mates:0}},Jm={data:{type:`company`,company_id:`1`,id:`667d60808a68186f43bafd31`,app_id:`this_is_an_id128_that_should_be_at_least_`,name:`company1`,remote_created_at:1719492736,created_at:1719492736,updated_at:1719492736,monthly_spend:0,session_count:0,user_count:1,tags:{type:`tag.list`,tags:[]},segments:{type:`segment.list`,segments:[]},plan:{},custom_attributes:{}}},Ym={data:{id:`5ba682d23d7cf92bef87bfd4`,object:`company`,deleted:`true`}},Xm={CONTACTS:`contacts`,COMPANIES:`companies`},Zm={[Xm.CONTACTS]:{label:`Contacts`},[Xm.COMPANIES]:{label:`Companies`}},Qm=Object.entries(Zm).map(([e,{label:t}])=>({label:t,value:e})),$m=e=>$.util.types.toString(e),eh=e=>e?$.util.types.toObject(e):void 0,th=e=>e?$.util.types.toString(e):void 0,nh=async(e,t,n=void 0)=>{let{data:{data:r,pages:i}}=await e.get(t,{params:n});return{data:r,pages:i}},rh=async(e,t=void 0,n=!1,r)=>{if(!n){let{data:n,pages:i}=await nh(e,r,t);return{data:n,pages:i}}let i=[],a,o=null;for(;;){let{data:t,pages:n}=await nh(e,r,{per_page:50,starting_after:a});if(i=i.concat(t),a=n.next?.starting_after,!a){o=n;break}}return{data:i,pages:o}},ih=async(e,t)=>{let n={operator:`AND`,value:[{field:`updated_at`,operator:`>`,value:t}]},r=[],i,a=!0;for(;a;){let{data:t}=await e.post(`/contacts/search`,{query:n,pagination:{per_page:50,...i?{starting_after:i}:{}}});r.push(...t.data??[]),i=t.pages?.next?.starting_after,a=!!i}return r},ah=async e=>{let{data:t}=await rh(e,void 0,!0,`/companies`);return t},oh=(e,t)=>{let n=[],r=[];for(let i of e)i.created_at>t?n.push(i):i.updated_at>t&&r.push(i);return{created:n,updated:r}},sh=/^(\d{4})-(\d{2})-(\d{2})$/,ch=e=>{let t=$.util.types.toString(e).trim();if(t===``)return``;let n=t.match(sh);if(!n)throw Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${t}`);let[,r,i,a]=n,o=$.util.types.toNumber(r),s=$.util.types.toNumber(i),c=$.util.types.toNumber(a),l=new Date(Date.UTC(o,s-1,c));if(l.getUTCFullYear()!==o||l.getUTCMonth()!==s-1||l.getUTCDate()!==c)throw Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${t}`);if(l.getTime()>Date.now())throw Error(`Look-back Date cannot be a future date. Received: ${t}`);return l.toISOString()},lh=e=>Math.floor(new Date(e).getTime()/1e3),uh=(e,t,n)=>{if(e?.lastPolledAt){let t=lh(e.lastPolledAt);return{lastPolledUnix:t,searchSinceUnix:t,isBackfill:!1}}if(t){let e=lh(t);return{lastPolledUnix:e-1,searchSinceUnix:e-86400,isBackfill:!0}}let r=lh(n);return{lastPolledUnix:r,searchSinceUnix:r,isBackfill:!1}},dh=async(e,t,n,{showNew:r,showUpdated:i})=>{let a=t===Xm.CONTACTS?await ih(e,n.searchSinceUnix):await ah(e),{created:o,updated:s}=oh(a,n.lastPolledUnix);return{created:n.isBackfill||r?o:[],updated:n.isBackfill||i?s:[]}},fh=e=>{let t=e??{created:[],updated:[]};return[...(t.created??[]).map(e=>({changeType:`created`,record:e})),...(t.updated??[]).map(e=>({changeType:`updated`,record:e}))]},ph=(0,$.input)({label:`Connection`,type:`connection`,required:!0}),mh=(0,$.input)({label:`ID`,type:`string`,clean:th,comments:`Unique identifier for the entity given by Intercom`}),hh=(0,$.input)({label:`External ID`,type:`string`,clean:th,comments:`Unique identifier for the entity from external systems`}),gh=(0,$.input)({label:`Starting After Cursor`,type:`string`,clean:th,comments:`If you want to get the next page of data in the batch, you must make a new request with the starting_after parameter equal to the cursor pointer string. Use the starting_after parameter of the previous response.`}),_h=(0,$.input)({label:`Page`,type:`string`,comments:`The page of results to fetch.`,required:!1,example:`1`,placeholder:`1`,clean:th}),vh=(0,$.input)({label:`Per Page`,type:`string`,comments:`How many results to return per page. Default is 15. Max is 50.`,required:!1,example:`15`,placeholder:`15`,clean:th}),yh=(0,$.input)({label:`Order`,type:`string`,comments:`The order to sort the results in. Default is 'desc'.`,required:!1,model:[{value:`asc`,label:`Ascending`},{value:`desc`,label:`Descending`}],default:`desc`,clean:th}),bh=(0,$.input)({label:`Ticket Attributes`,language:`json`,type:`code`,comments:`The attributes set on the ticket. When setting the default title and description attributes, the attribute keys that should be used are _default_title_ and _default_description_`,required:!1,example:JSON.stringify({_default_title_:`example`,_default_description_:`there is a problem`},null,2),clean:eh}),xh=(0,$.input)({label:`Ticket Type ID`,type:`string`,comments:`The ID of the type of ticket you want to create`,example:`147`,placeholder:`147`,required:!0,dataSource:`selectTicketType`,clean:th}),Sh=(0,$.input)({label:`Contact ID`,type:`string`,comments:`The ID / email / external Id of the user affected by this ticket.`,example:`6657af026abd0167d9419def`,placeholder:`6657af026abd0167d9419def`,required:!0,dataSource:`selectContact`,clean:th}),Ch=(0,$.input)({label:`Company ID`,type:`string`,comments:`The ID of the company that the ticket is associated with. The ID that you set upon company creation.`,example:`147`,placeholder:`147`,required:!1,dataSource:`selectCompany`,clean:th}),wh=(0,$.input)({label:`Fetch All`,type:`boolean`,comments:`If true, all pages of results will be fetched.`,required:!1,clean:$.util.types.toBool}),Th={connection:ph},Eh={connection:ph},Dh={connection:ph},Oh={connection:ph},kh={connection:ph},Ah=(0,$.input)({label:`Remote Created At`,type:`string`,required:!0,clean:$m,comments:`Time the company was created by you`}),jh=(0,$.input)({label:`Name`,type:`string`,required:!0,clean:$.util.types.toString,comments:`Name of the company`}),Mh=(0,$.input)({label:`Monthly Spend`,type:`string`,clean:$.util.types.toNumber,comments:`How much revenue the company generates for your business`}),Nh=(0,$.input)({label:`Plan`,type:`string`,clean:$.util.types.toString,comments:`Name of the plan associated with the company`}),Ph=(0,$.input)({label:`Size`,type:`string`,clean:$.util.types.toNumber,comments:`Number of employees in this company`}),Fh=(0,$.input)({label:`Website`,type:`string`,clean:$.util.types.toString,comments:`The URL for this company's website`}),Ih=(0,$.input)({label:`Industry`,type:`string`,clean:$.util.types.toString,comments:`The industry this company operates in`}),Lh=(0,$.input)({label:`Company ID`,type:`string`,required:!0,clean:$.util.types.toString,dataSource:`selectCompany`,comments:`Identifier of Company`}),Rh=(0,$.input)({label:`Segment ID`,type:`string`,required:!1,clean:$.util.types.toString,comments:`Id of the segment to be used as filter.`}),zh=(0,$.action)({display:{label:`Create Company`,description:`Create a new Company`},inputs:{connection:ph,company_id:Lh,remote_created_at:Ah,name:jh,monthly_spend:Mh,plan:Nh,size:Ph,website:Fh,industry:Ih},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/companies`,n);return{data:r}},examplePayload:{data:qm}}),Bh=(0,$.action)({display:{label:`Delete Company`,description:`Delete an existing Company`},inputs:{connection:ph,id:Lh},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).delete(`/companies/${n}`);return{data:r}},examplePayload:Ym}),Vh=(0,$.action)({display:{label:`Get Company`,description:`Retrieves an existing Company`},inputs:{connection:ph,id:Lh},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).get(`/companies/${n}`);return{data:r}},examplePayload:Jm}),Hh={data:[{type:`company`,company_id:`remote_companies_scroll_2`,id:`6657add06abd0167d9419cc3`,app_id:`this_is_an_id158_that_should_be_at_least_`,name:`IntercomQATest1`,remote_created_at:1717022160,created_at:1717022160,updated_at:1717022160,monthly_spend:0,session_count:0,user_count:4,tags:{type:`tag.list`,tags:[]},segments:{type:`segment.list`,segments:[]},plan:{},custom_attributes:{}}],pages:{type:`companies`,next:null,page:1,per_page:15,total_pages:1}},Uh={type:`ticket`,id:`773`,ticket_id:`35`,ticket_attributes:{_default_title_:`example`,_default_description_:`there is a problem`},ticket_state:`submitted`,ticket_state_internal_label:`Submitted`,ticket_state_external_label:`Submitted`,ticket_type:{type:`ticket_type`,id:`147`,name:`my-ticket-type-15`,description:`my ticket type description is awesome.`,icon:`🦁`,workspace_id:`this_is_an_id648_that_should_be_at_least_`,archived:!1,created_at:1717022465,updated_at:1717022465,is_internal:!1,ticket_type_attributes:{type:`list`,data:[{type:`ticket_type_attribute`,id:`388`,workspace_id:`this_is_an_id648_that_should_be_at_least_`,name:`_default_title_`,description:`ola`,data_type:`string`,input_options:null,order:0,required_to_create:!0,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!1,default:!1,ticket_type_id:147,archived:!1,created_at:1717022465,updated_at:1717022465},{type:`ticket_type_attribute`,id:`389`,workspace_id:`this_is_an_id648_that_should_be_at_least_`,name:`_default_description_`,description:`ola`,data_type:`string`,input_options:null,order:0,required_to_create:!0,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!1,default:!1,ticket_type_id:147,archived:!1,created_at:1717022465,updated_at:1717022465}]},category:`Back-office`},contacts:{type:`contact.list`,contacts:[{type:`contact`,id:`6657af026abd0167d9419def`,external_id:`70`}]},admin_assignee_id:`0`,team_assignee_id:`0`,created_at:1717022466,updated_at:1717022466,ticket_parts:{type:`ticket_part.list`,ticket_parts:[{type:`ticket_part`,id:`199`,part_type:`ticket_state_updated_by_admin`,ticket_state:`submitted`,previous_ticket_state:`submitted`,created_at:1717022466,updated_at:1717022466,author:{id:`991268827`,type:`bot`,name:`Operator`,email:`operator+this_is_an_id648_that_should_be_at_least_@intercom.io`},attachments:[],redacted:!1}],total_count:1},open:!0,linked_objects:{type:`list`,data:[],total_count:0,has_more:!1},category:`Back-office`,is_shared:!1},Wh={type:`list`,data:[{type:`ticket_type`,id:`126`,name:`Bug Report`,description:`Bug Report Template`,icon:`🎟️`,workspace_id:`this_is_an_id608_that_should_be_at_least_`,archived:!1,created_at:1717022435,updated_at:1717022435,is_internal:!1,ticket_type_attributes:{type:`list`,data:[{type:`ticket_type_attribute`,id:`354`,workspace_id:`this_is_an_id608_that_should_be_at_least_`,name:`_default_title_`,description:``,data_type:`string`,input_options:{multiline:!1},order:0,required_to_create:!1,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!0,default:!0,ticket_type_id:126,archived:!1,created_at:1717022435,updated_at:1717022435},{type:`ticket_type_attribute`,id:`356`,workspace_id:`this_is_an_id608_that_should_be_at_least_`,name:`name`,description:`description`,data_type:`string`,input_options:null,order:0,required_to_create:!1,required_to_create_for_contacts:!1,visible_on_create:!1,visible_to_contacts:!1,default:!1,ticket_type_id:126,archived:!1,created_at:1717022435,updated_at:1717022435},{type:`ticket_type_attribute`,id:`355`,workspace_id:`this_is_an_id608_that_should_be_at_least_`,name:`_default_description_`,description:``,data_type:`string`,input_options:{multiline:!0},order:1,required_to_create:!1,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!0,default:!0,ticket_type_id:126,archived:!1,created_at:1717022435,updated_at:1717022435}]},category:`Customer`}]},Gh={data:[{type:`contact`,id:`5ba682d23d7cf92bef87bfd4`,external_id:`f3b87a2e09d514c6c2e79b9a`,workspace_id:`ecahpwf5`,role:`user`,email:`joe@example.com`,email_domain:`example.com`,phone:`+1123456789`,formatted_phone:`+1123456789`,name:`John Doe`,owner_id:123,has_hard_bounced:!0,marked_email_as_spam:!0,unsubscribed_from_emails:!0,created_at:1571672154,updated_at:1571672154,signed_up_at:1571672154,last_seen_at:1571672154,last_replied_at:1571672154,last_contacted_at:1571672154,last_email_opened_at:1571672154,last_email_clicked_at:1571672154,language_override:`en`,browser:`Chrome`,browser_version:`80.0.3987.132`,browser_language:`en-US`,os:`Mac OS X`,android_app_name:`Intercom`,android_app_version:`5.0.0`,android_device:`Pixel 3`,android_os_version:`10`,android_sdk_version:`28`,android_last_seen_at:1571672154,ios_app_name:`Intercom`,ios_app_version:`5.0.0`,ios_device:`iPhone 11`,ios_os_version:`13.3.1`,ios_sdk_version:`13.3.1`,ios_last_seen_at:1571672154,custom_attributes:{},avatar:{type:`avatar`,image_url:`https://example.org/128Wash.jpg`},tags:{data:[{type:`note`,id:`123`,url:`/contacts/5ba682d23d7cf92bef87bfd4/notes`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/tags`,total_count:100,has_more:!0},notes:{data:[{type:`note`,id:`123`,url:`/contacts/5ba682d23d7cf92bef87bfd4/notes`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/notes`,total_count:100,has_more:!0},companies:{url:`/contacts/5ba682d23d7cf92bef87bfd4/companies`,total_count:100,has_more:!0},location:{type:`location`,country:`Ireland`,region:`Dublin`,city:`Dublin`},social_profiles:{data:[{type:`social_profile`,name:`Facebook`,url:`http://twitter.com/th1sland`}]}}],total_count:100,pages:{type:`pages`,page:1,next:{per_page:2,starting_after:`your-cursor-from-response`},per_page:2,total_pages:13}},Kh={type:`ticket`,id:`777`,ticket_id:`39`,ticket_attributes:{_default_title_:`attribute_value`,_default_description_:null},ticket_state:`submitted`,ticket_state_internal_label:`Submitted`,ticket_state_external_label:`Submitted`,ticket_type:{type:`ticket_type`,id:`153`,name:`my-ticket-type-21`,description:`my ticket type description is awesome.`,icon:`🦁`,workspace_id:`this_is_an_id660_that_should_be_at_least_`,archived:!1,created_at:1717022478,updated_at:1717022478,is_internal:!1,ticket_type_attributes:{type:`list`,data:[{type:`ticket_type_attribute`,id:`404`,workspace_id:`this_is_an_id660_that_should_be_at_least_`,name:`_default_title_`,description:`ola`,data_type:`string`,input_options:null,order:0,required_to_create:!0,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!1,default:!1,ticket_type_id:153,archived:!1,created_at:1717022478,updated_at:1717022478},{type:`ticket_type_attribute`,id:`405`,workspace_id:`this_is_an_id660_that_should_be_at_least_`,name:`_default_description_`,description:`ola`,data_type:`string`,input_options:null,order:0,required_to_create:!0,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!1,default:!1,ticket_type_id:153,archived:!1,created_at:1717022479,updated_at:1717022479}]},category:`Back-office`},contacts:{type:`contact.list`,contacts:[{type:`contact`,id:`6657af0f6abd0167d9419df3`,external_id:`2274eea8-d400-48f6-9345-2fb84a96e94d`}]},admin_assignee_id:`0`,team_assignee_id:`0`,created_at:1717022479,updated_at:1717022479,ticket_parts:{type:`ticket_part.list`,ticket_parts:[{type:`ticket_part`,id:`208`,part_type:`ticket_state_updated_by_admin`,ticket_state:`submitted`,previous_ticket_state:`submitted`,created_at:1717022479,updated_at:1717022479,author:{id:`991268868`,type:`admin`,name:`Ciaran445 Lee`,email:`admin445@email.com`},attachments:[],redacted:!1}],total_count:1},open:!0,linked_objects:{type:`list`,data:[],total_count:0,has_more:!1},category:`Back-office`,is_shared:!1},qh=(0,$.input)({label:`Name`,type:`string`,required:!0,clean:$.util.types.toString,comments:`Name of the tag`}),Jh=(0,$.input)({label:`Tag ID`,type:`string`,required:!0,dataSource:`selectTag`,clean:$.util.types.toString,comments:`ID of the tag`}),Yh=(0,$.action)({display:{label:`List Companies`,description:`Page through all Companies`},inputs:{fetchAll:wh,page:_h,perPage:vh,order:yh,companyName:{...jh,required:!1,comments:`Name of the company to be used as filter.`},companyId:{...Ch,comments:`Id of the company to be used as filter.`},tagId:{...Jh,required:!1,comments:`Id of the tag to be used as filter.`},segmentId:Rh,startingAfter:gh,connection:ph},perform:async(e,{connection:t,order:n,page:r,perPage:i,startingAfter:a,fetchAll:o,companyId:s,companyName:c,tagId:l,segmentId:u})=>({data:await rh(Km(t,e.debug.enabled),{company_id:s,name:c,tag_id:l,segment_id:u,order:n,page:r,per_page:i,starting_after:a},o,`/companies`)}),examplePayload:{data:Hh}}),Xh=(0,$.input)({label:`Tag ID`,type:`string`,required:!0,clean:$.util.types.toString,comments:`Identifier of Tag`,dataSource:`selectTag`}),Zh=(0,$.input)({label:`Role`,type:`string`,required:!0,model:[{label:`User`,value:`user`},{label:`Lead`,value:`lead`}],clean:$.util.types.toString,comments:`The role of the contact`}),Qh=(0,$.input)({label:`Email`,type:`string`,required:!0,clean:$.util.types.toString,comments:`Email of the contact`}),$h=(0,$.input)({label:`Phone`,type:`string`,clean:$.util.types.toString,comments:`Phone of the contact`}),eg=(0,$.input)({label:`Name`,type:`string`,clean:$.util.types.toString,comments:`Name of the contact`}),tg=(0,$.input)({label:`Avatar URL`,type:`string`,clean:$.util.types.toString,comments:`An image URL containing the avatar of a contact`}),ng=(0,$.input)({label:`Signed Up At`,type:`string`,clean:$m,comments:`The time specified for when a contact signed up`}),rg=(0,$.input)({label:`Last Seen At`,type:`string`,clean:$m,comments:`The time when the contact was last seen`}),ig=(0,$.input)({label:`Unsubscribed From Emails`,type:`boolean`,clean:$.util.types.toBool,comments:`Whether the contact is unsubscribed from emails`}),ag=(0,$.input)({label:`JSON Query`,required:!1,type:`code`,language:`json`,clean:$.util.types.toObject,comments:`If you wanted to provide a custom query instead of the one constructed by the action, you can use this input to bypass it.`});var og={listCompanies:Yh,createCompany:zh,updateCompany:(0,$.action)({display:{label:`Update Company`,description:`Update an existing Company`},inputs:{connection:ph,company_id:Lh,remote_created_at:{...Ah,required:!1},name:{...eg,required:!1},monthly_spend:Mh,plan:Nh,size:Ph,website:Fh,industry:Ih},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/companies`,n);return{data:r}},examplePayload:{data:qm}}),deleteCompany:Bh,getCompany:Vh};const sg={type:`contact`,id:`5ba682d23d7cf92bef87bfd4`,workspace_id:`ecahpwf5`,external_id:`25`,role:`user`,email:`wash@serenity.io`,phone:`+1123456789`,name:`Hoban Washburn`,avatar:`https://example.org/128Wash.jpg`,owner_id:127,social_profiles:{type:`list`,data:[{type:`social_profile`,name:`Twitter`,url:`http://twitter.com/th1sland`}]},unsubscribed_from_emails:!1,created_at:1571672154,updated_at:1571672158,signed_up_at:1571069751,last_seen_at:1571069751,last_replied_at:1571672158,last_contacted_at:1571672158,last_email_opened_at:1571673478,last_email_clicked_at:1571676789,language_override:null,browser:`chrome`,browser_version:`77.0.3865.90`,browser_language:`en`,os:`OS X 10.14.6`,location:{type:`location`,country:`Ireland`,region:`Dublin`,city:`Dublin`},android_app_name:null,android_app_version:null,android_device:null,android_os_version:null,android_sdk_version:null,android_last_seen_at:null,ios_app_name:null,ios_app_version:null,ios_device:null,ios_os_version:null,ios_sdk_version:null,ios_last_seen_at:null,custom_attributes:{paid_subscriber:!0,monthly_spend:155.5,team_mates:1},tags:{type:`list`,data:[{type:`tag`,id:`2`,url:`/tags/2`},{type:`tag`,id:`4`,url:`/tags/4`},{type:`tag`,id:`5`,url:`/tags/5`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/tags`},notes:{type:`list`,data:[{type:`note`,id:`20114858`,url:`/notes/20114858`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/notes`},companies:{type:`list`,data:[{type:`company`,id:`5ba686093d7cf93552a3dc99`,url:`/companies/5ba686093d7cf93552a3dc99`},{type:`company`,id:`5cee64a03d7cf90c51b36f19`,url:`/companies/5cee64a03d7cf90c51b36f19`},{type:`company`,id:`5d7668883d7cf944dbc5c791`,url:`/companies/5d7668883d7cf944dbc5c791`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/companies`}},cg={data:{type:`contact`,id:`667d60a98a68186f43bafdb9`,workspace_id:`this_is_an_id252_that_should_be_at_least_`,external_id:`70`,role:`user`,email:`joe@bloggs.com`,phone:null,name:`Joe Bloggs`,avatar:null,owner_id:null,social_profiles:{type:`list`,data:[]},has_hard_bounced:!1,marked_email_as_spam:!1,unsubscribed_from_emails:!1,created_at:1719492777,updated_at:1719492777,signed_up_at:1719492777,last_seen_at:null,last_replied_at:null,last_contacted_at:null,last_email_opened_at:null,last_email_clicked_at:null,language_override:null,browser:null,browser_version:null,browser_language:null,os:null,location:{type:`location`,country:null,region:null,city:null,country_code:null,continent_code:null},android_app_name:null,android_app_version:null,android_device:null,android_os_version:null,android_sdk_version:null,android_last_seen_at:null,ios_app_name:null,ios_app_version:null,ios_device:null,ios_os_version:null,ios_sdk_version:null,ios_last_seen_at:null,custom_attributes:{},tags:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/tags`,total_count:0,has_more:!1},notes:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/notes`,total_count:0,has_more:!1},companies:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/companies`,total_count:0,has_more:!1},opted_out_subscription_types:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/subscriptions`,total_count:0,has_more:!1},opted_in_subscription_types:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/subscriptions`,total_count:0,has_more:!1},utm_campaign:null,utm_content:null,utm_medium:null,utm_source:null,utm_term:null,referrer:null}},lg={data:{type:`company`,company_id:`1`,id:`667d608d8a68186f43bafd70`,app_id:`this_is_an_id166_that_should_be_at_least_`,name:`company6`,remote_created_at:1719492749,created_at:1719492749,updated_at:1719492749,monthly_spend:0,session_count:0,user_count:1,tags:{type:`tag.list`,tags:[]},segments:{type:`segment.list`,segments:[]},plan:{},custom_attributes:{}}},ug={data:{type:`company`,company_id:`1`,id:`667d60918a68186f43bafd80`,app_id:`this_is_an_id174_that_should_be_at_least_`,name:`company8`,remote_created_at:1719492753,created_at:1719492753,updated_at:1719492753,monthly_spend:0,session_count:0,user_count:0,tags:{type:`tag.list`,tags:[]},segments:{type:`segment.list`,segments:[]},plan:{},custom_attributes:{}}},dg={data:{id:`5ba682d23d7cf92bef87bfd4`,object:`contact`,archived:!0}},fg={data:{data:{id:`5ba682d23d7cf92bef87bfd4`,object:`contact`,deleted:!0}}},pg=(0,$.action)({display:{label:`Archive Contact`,description:`Archive an existing Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`}},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/contacts/${n}/archive`);return{data:r}},examplePayload:dg}),mg=(0,$.action)({display:{label:`Attach Company to Contact`,description:`Attach Company to Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},companyId:Lh},perform:async(e,{connection:t,id:n,companyId:r})=>{let{data:i}=await Km(t,e.debug.enabled).post(`/contacts/${n}/companies`,{id:r});return{data:i}},examplePayload:lg}),hg=(0,$.action)({display:{label:`Attach Tag to Contact`,description:`Attach a Tag to a Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},tagId:Xh},perform:async(e,{connection:t,id:n,tagId:r})=>{let{data:i}=await Km(t,e.debug.enabled).post(`/contacts/${n}/tags`,{id:r});return{data:i}}}),gg=(0,$.action)({display:{label:`Create Contact`,description:`Create a new Contact`},inputs:{connection:ph,role:Zh,external_id:hh,email:Qh,phone:$h,name:eg,avatar:tg,signed_up_at:ng,last_seen_at:rg,unsubscribed_from_emails:ig},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/contacts`,n);return{data:r}},examplePayload:{data:sg}}),_g=(0,$.action)({display:{label:`Delete Contact`,description:`Delete an existing Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`}},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).delete(`/contacts/${n}`);return{data:r}},examplePayload:fg}),vg=(0,$.action)({display:{label:`Detach Company from Contact`,description:`Detach Company from Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},companyId:Lh},perform:async(e,{connection:t,id:n,companyId:r})=>{let{data:i}=await Km(t,e.debug.enabled).delete(`/contacts/${n}/companies/${r}`);return{data:i}},examplePayload:ug}),yg=(0,$.action)({display:{label:`Detach Tag from Contact`,description:`Detach a Tag from a Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},tagId:Xh},perform:async(e,{connection:t,id:n,tagId:r})=>{let{data:i}=await Km(t,e.debug.enabled).delete(`/contacts/${n}/tags/${r}`);return{data:i}}}),bg=(0,$.action)({display:{label:`Get Contact`,description:`Retrieves an existing Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`}},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).get(`/contacts/${n}`);return{data:r}},examplePayload:cg}),xg=(0,$.action)({display:{label:`List Contacts`,description:`Page through all Contacts`},inputs:{fetchAll:wh,page:_h,perPage:vh,order:yh,startingAfter:gh,connection:ph},perform:async(e,{connection:t,order:n,page:r,perPage:i,startingAfter:a,fetchAll:o})=>({data:await rh(Km(t,e.debug.enabled),{order:n,page:r,per_page:i,starting_after:a},o,`/contacts`)}),examplePayload:{data:Gh}}),Sg=(0,$.action)({display:{label:`Search Contacts`,description:`Search through all Contacts`},inputs:{connection:ph,role:{...Zh,required:!1},name:{...eg,required:!1},email:{...Qh,required:!1},jsonQuery:ag,startingAfter:gh},perform:async(e,{connection:t,role:n,name:r,email:i,startingAfter:a,jsonQuery:o})=>{let s=[];n&&s.push({field:`role`,operator:`=`,value:n}),r&&s.push({field:`name`,operator:`=`,value:r}),i&&s.push({field:`email`,operator:`=`,value:i});let{data:c}=await Km(t,e.debug.enabled).post(`/contacts/search`,{query:o||{operator:`AND`,value:s}},{params:{startingAfter:a}});return{data:c}}}),Cg=(0,$.action)({display:{label:`Unarchive Contact`,description:`Unarchive an archived Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`}},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/contacts/${n}/unarchive`);return{data:r}},examplePayload:{data:{id:`5ba682d23d7cf92bef87bfd4`,object:`contact`,archived:!1}}});var wg={listContacts:xg,createContact:gg,updateContact:(0,$.action)({display:{label:`Update Contact`,description:`Update an existing Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},role:Zh,external_id:hh,email:Qh,phone:$h,name:eg,avatar:tg,signed_up_at:ng,last_seen_at:rg,unsubscribed_from_emails:ig},perform:async(e,{connection:t,id:n,...r})=>{let{data:i}=await Km(t,e.debug.enabled).put(`/contacts/${n}`,r);return{data:i}},examplePayload:{data:sg}}),deleteContact:_g,archiveContact:pg,unarchiveContact:Cg,searchContacts:Sg,attachTag:hg,detachTag:yg,attachCompany:mg,detachCompany:vg,getContact:bg};const{debugRequest:Tg,...Eg}=Rm.inputs,Dg=(0,$.action)({display:{label:`Raw Request`,description:`Send a raw request to Intercom`},perform:async(e,{connection:t,...n})=>{let{baseUrl:r,accessToken:i}=Gm(t),{data:a}=await(0,Rm.sendRawRequest)(r,{...n,debugRequest:e.debug.enabled},{Authorization:`Bearer ${i}`,Accept:`application/json`,"Content-Type":`application/json`});return{data:a}},inputs:{connection:ph,...Eg}}),Og={id:`17513`,name:`independent`,type:`tag`},kg=(0,$.action)({display:{label:`Create Tag`,description:`Create a new Tag`},inputs:{connection:ph,name:qh},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/tags`,n);return{data:r}},examplePayload:{data:Og}}),Ag=(0,$.action)({display:{label:`Delete Tag`,description:`Delete an existing Tag`},inputs:{connection:ph,id:Jh},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).delete(`/tags/${n}`);return{data:r}},examplePayload:{data:Og}});var jg={createTag:kg,listTags:(0,$.action)({display:{label:`List Tags`,description:`List all Tags`},inputs:{connection:ph},perform:async(e,{connection:t})=>{let{data:n}=await Km(t,e.debug.enabled).get(`/tags`);return{data:n}},examplePayload:{data:{type:`list`,data:[Og]}}}),updateTag:(0,$.action)({display:{label:`Update Tag`,description:`Update an existing Tag`},inputs:{connection:ph,id:Jh,name:qh},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/tags`,n);return{data:r}},examplePayload:{data:Og}}),deleteTag:Ag},Mg={createTicket:(0,$.action)({display:{label:`Create Ticket`,description:`Create a new Ticket`},inputs:{ticketTypeId:xh,contactId:Sh,companyId:Ch,ticketAttributes:bh,connection:ph},perform:async(e,{connection:t,companyId:n,contactId:r,ticketAttributes:i,ticketTypeId:a})=>{let{data:o}=await Km(t,e.debug.enabled).post(`/tickets`,{ticket_type_id:a,contacts:[{id:r}],company_id:n,ticketAttributes:i});return{data:o}},examplePayload:{data:Uh}}),getTicket:(0,$.action)({display:{label:`Retrieve a ticket`,description:`Retrieve a ticket by ID`},inputs:{ticketId:{...mh,label:`Ticket ID`,comments:`ID of the ticket to retrieve.`,required:!0,example:`5ba682d23d7cf92bef87bfd4`,placeholder:`5ba682d23d7cf92bef87bfd4`,dataSource:`selectTicket`},connection:ph},perform:async(e,{connection:t,ticketId:n})=>{let{data:r}=await Km(t,e.debug.enabled).get(`/tickets/${n}`);return{data:r}},examplePayload:{data:Kh}}),listTicketTypes:(0,$.action)({display:{label:`List Ticket Types`,description:`Get a list of all ticket types for a workspace.`},inputs:{connection:ph},perform:async(e,{connection:t})=>{let{data:n}=await Km(t,e.debug.enabled).get(`/ticket_types`);return{data:n}},examplePayload:{data:Wh}})},Ng={...wg,...og,...jg,...Mg,rawRequest:Dg},Pg={selectCompany:(0,$.dataSource)({display:{label:`Select Company`,description:`A Picklist of Intercom companies`},dataSourceType:`picklist`,inputs:Th,perform:async(e,{connection:t})=>{let{data:n}=await rh(Km(t,!1),{order:`asc`},!0,`/companies`);return{result:n.map(({id:e,name:t})=>({label:t,key:e}))}}}),selectContact:(0,$.dataSource)({display:{label:`Select Contact`,description:`A Picklist of Intercom contacts`},dataSourceType:`picklist`,inputs:Eh,perform:async(e,{connection:t})=>{let{data:n}=await rh(Km(t,!1),{order:`asc`},!0,`/contacts`);return{result:n.map(({id:e,name:t,email:n})=>({label:t||n,key:e}))}}}),selectTag:(0,$.dataSource)({display:{label:`Select Tag`,description:`A Picklist of Intercom tags`},dataSourceType:`picklist`,inputs:Dh,perform:async(e,{connection:t})=>{let{data:{data:n}}=await Km(t,!1).get(`/tags`);return{result:(n||[]).map(({id:e,name:t})=>({label:t,key:e}))}}}),selectTicket:(0,$.dataSource)({display:{label:`Select Ticket`,description:`A Picklist of Intercom open tickets`},dataSourceType:`picklist`,inputs:Oh,perform:async(e,{connection:t})=>{let n=Km(t,!1),r,i=[];do{let{data:e}=await n.post(`/tickets/search`,{query:{field:`open`,operator:`=`,value:!0},pagination:{per_page:50,starting_after:r}});i.push(...e.tickets||[]),r=e.pages?.next?.starting_after}while(r);return{result:i.map(e=>({label:e.ticket_attributes?._default_title_||`Ticket ${e.ticket_id}`,key:e.id}))}}}),selectTicketType:(0,$.dataSource)({display:{label:`Select Ticket Type`,description:`A Picklist of Intercom ticket types`},dataSourceType:`picklist`,inputs:kh,perform:async(e,{connection:t})=>{let{data:{data:n}}=await Km(t,!1).get(`/ticket_types`);return{result:(n||[]).map(({id:e,name:t})=>({label:t,key:e}))}}})};const Fg=(0,$.input)({label:`Resource Type`,type:`string`,required:!0,comments:`The type of resource to poll for new and updated records.`,model:Qm,clean:$.util.types.toString}),Ig=(0,$.input)({label:`Show New Records`,type:`boolean`,required:!0,default:`true`,comments:`Include newly created records in trigger results.`,clean:$.util.types.toBool}),Lg=(0,$.input)({label:`Show Updated Records`,type:`boolean`,required:!0,default:`true`,comments:`Include updated records in trigger results.`,clean:$.util.types.toBool}),Rg=(0,$.input)({label:`Look-back Date`,placeholder:`Enter look-back date (YYYY-MM-DD)`,type:`string`,required:!1,comments:`The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each record modified on or after this date once, ignoring the trigger's visibility filters.`,example:`2026-01-01`,clean:ch});var zg={pollChangesTrigger:(0,$.pollingTrigger)({display:{label:`New and Updated Records`,description:`Retrieves existing and ongoing records for a specified Intercom resource type. Load history once, check for changes on a schedule, or both.`},inputs:{connection:ph,resourceType:Fg,showNewRecords:Ig,showUpdatedRecords:Lg,lookBackDate:Rg},triggerResolverSupport:`valid`,batchConfig:{batchSize:50},triggerResolver:{resolveItems:(e,{payload:t})=>fh(t.body.data)},perform:async(e,t,n)=>{let r=new Date().toISOString(),i=uh(e.polling.getState(),n.lookBackDate,r),a=await dh(Km(n.connection,e.debug.enabled),n.resourceType,i,{showNew:n.showNewRecords,showUpdated:n.showUpdatedRecords}),o=a.created.length+a.updated.length;return e.polling.setState({lastPolledAt:r}),e.debug.enabled&&e.logger.debug(`Polled ${n.resourceType}: ${a.created.length} new, ${a.updated.length} updated`),{payload:{...t,body:{data:a}},polledNoChanges:o===0}}})},Bg=(0,$.component)({key:`intercom`,public:!0,documentationUrl:`https://prismatic.io/docs/components/intercom/`,display:{label:`Intercom`,description:`Manage companies, contacts and tags on the Intercom platform`,category:`Application Connectors`,iconPath:`icon.png`},hooks:{error:Rm.handleErrors},actions:Ng,triggers:zg,connections:Vm,dataSources:Pg});exports.default=Bg;
218
+ let t=Nm(),n=Pm(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(K(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||fe(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(K(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return le(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return de(e).length;default:if(i)return r?-1:le(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return A(this,t,n);case`ascii`:return N(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return k(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return I(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?A(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,fe(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(fe(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return G(le(t,e.length-n),e,n,r)}function E(e,t,n,r){return G(W(t),e,n,r)}function D(e,t,n,r){return G(de(t),e,n,r)}function O(e,t,n,r){return G(ue(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return O(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function k(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function A(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return M(r)}let j=4096;function M(e){let t=e.length;if(t<=j)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=j));return n}function N(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=pe[e[r]];return i}function I(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function L(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)};function R(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function z(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function B(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=me(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=me(function(e,t=0){return B(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=me(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=me(function(e,t=0){return B(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ee(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let U={};function te(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}te(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),te(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),te(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ne(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ne(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ne(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function re(e,t,n){ae(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&oe(t,e.length-(n+1))}function ie(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}re(r,i,a)}function ae(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function oe(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ae(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let se=/[^+/0-9A-Za-z-_]/g;function ce(e){if(e=e.split(`=`)[0],e=e.trim().replace(se,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function le(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function W(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ue(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function de(e){return t.toByteArray(ce(e))}function G(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function fe(e){return e!==e}let pe=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function me(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}})),Im=a(((e,t)=>{let n=Mm(),r=typeof window<`u`?Fm().Buffer:global.Buffer;function i(e){return 12+4*Math.ceil(e.length/4)}function a(){return!(typeof window<`u`&&typeof document<`u`)}function o(e){return e.BYTES_PER_ELEMENT?e.length*e.BYTES_PER_ELEMENT:-1}function s(e){let t=0;try{let n=e;if(e instanceof Map?n=Object.fromEntries(e):e instanceof Set&&(n=Array.from(e)),ArrayBuffer.isView(e))return o(e);let i=JSON.stringify(n,(e,t)=>typeof t==`bigint`||typeof t==`function`?t.toString():t===void 0?`undefined`:typeof t==`symbol`||t instanceof RegExp?t.toString():t);t=r.byteLength(i,`utf8`)}catch{return Error(-1)}return t}function c(e){let t=[],o=[e],s=0;for(;o.length;){let c=o.pop();if(typeof c==`boolean`)s+=n.BYTES;else if(typeof c==`string`)a()?s+=i(c):s+=c.length*n.STRING;else if(typeof c==`number`)s+=n.NUMBER;else if(typeof c==`symbol`)Symbol.keyFor&&Symbol.keyFor(e)?s+=Symbol.keyFor(e).length*n.STRING:s+=(e.toString().length-8)*n.STRING;else if(typeof c==`bigint`)s+=r.from(c.toString()).byteLength;else if(typeof c==`function`)s+=c.toString().length;else if(typeof c==`object`&&t.indexOf(c)===-1){t.push(c);for(let e in c)o.push(c[e])}}return s}t.exports=function(e){let t=0;return t=typeof e==`object`&&e?s(e):c(e),t}})),Lm=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inputs=e.debugRequest=e.fileDataFileNames=e.fileData=e.formData=e.retryAllErrors=e.useExponentialBackoff=e.retryDelayMS=e.maxRetries=e.queryParams=e.headers=e.responseType=e.method=e.timeout=e.data=e.url=void 0;let t=Om();e.url=(0,t.input)({label:`URL`,placeholder:`URL to call`,type:`string`,required:!0,comments:`This is the URL to call.`,example:`/sobjects/Account`,clean:e=>t.util.types.toString(e)}),e.data=(0,t.input)({label:`Data`,placeholder:`Data to send`,type:`string`,required:!1,comments:`The HTTP body payload to send to the URL.`,example:`{"exampleKey": "Example Data"}`}),e.timeout=(0,t.input)({label:`Timeout`,type:`string`,required:!1,comments:`The maximum time that a client will await a response to its request`,example:`2000`,clean:e=>t.util.types.toNumber(e)}),e.method=(0,t.input)({label:`Method`,type:`string`,required:!0,model:[`DELETE`,`GET`,`HEAD`,`LINK`,`OPTIONS`,`PATCH`,`POST`,`PURGE`,`PUT`,`UNLINK`].map(e=>({label:e,value:e})),comments:`The HTTP method to use.`,clean:e=>t.util.types.toString(e)}),e.responseType=(0,t.input)({label:`Response Type`,placeholder:`Response Type`,type:`string`,default:`json`,required:!0,comments:`The type of data you expect in the response. You can request json, text, or binary data.`,model:[`arraybuffer`,`document`,`json`,`text`].map(e=>({label:e,value:e})),clean:e=>t.util.types.toString(e)}),e.headers=(0,t.input)({label:`Header`,placeholder:`Header`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`A list of headers to send with the request.`,example:`User-Agent: curl/7.64.1`}),e.queryParams=(0,t.input)({label:`Query Parameter`,placeholder:`Query Parameter`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.`}),e.maxRetries=(0,t.input)({label:`Max Retry Count`,placeholder:`Max Retries`,type:`string`,required:!1,comments:`The maximum number of retries to attempt. Specify 0 for no retries.`,default:`0`,clean:e=>t.util.types.toNumber(e)}),e.retryDelayMS=(0,t.input)({label:`Retry Delay (ms)`,placeholder:`Retry Delay`,type:`string`,required:!1,comments:`The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled.`,default:`0`,clean:e=>t.util.types.toNumber(e,0)}),e.useExponentialBackoff=(0,t.input)({label:`Use Exponential Backoff`,type:`boolean`,default:`false`,required:!1,comments:`Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored.`,clean:e=>t.util.types.toBool(e)}),e.retryAllErrors=(0,t.input)({label:`Retry On All Errors`,type:`boolean`,default:`false`,required:!1,comments:`If true, retries on all erroneous responses regardless of type. This is helpful when retrying after HTTP 429 or other 3xx or 4xx errors. Otherwise, only retries on HTTP 5xx and network errors.`,clean:e=>t.util.types.toBool(e)}),e.formData=(0,t.input)({label:`Form Data`,placeholder:`Data to send`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`The Form Data to be sent as a multipart form upload.`,example:`[{"key": "Example Key", "value": new Buffer("Hello World")}]`}),e.fileData=(0,t.input)({label:`File Data`,placeholder:`Data to send`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`File Data to be sent as a multipart form upload.`,example:`[{key: "example.txt", value: "My File Contents"}]`}),e.fileDataFileNames=(0,t.input)({label:`File Data File Names`,placeholder:`The file name to apply to a file`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`File names to apply to the file data inputs. Keys must match the file data keys above.`,clean:e=>e?t.util.types.keyValPairListToObject(e):void 0}),e.debugRequest=(0,t.input)({label:`Debug Request`,type:`boolean`,required:!1,comments:`Enabling this flag will log out the current request.`,clean:e=>t.util.types.toBool(e)}),e.inputs={url:e.url,method:e.method,data:e.data,formData:e.formData,fileData:e.fileData,fileDataFileNames:e.fileDataFileNames,queryParams:e.queryParams,headers:e.headers,responseType:e.responseType,timeout:e.timeout,debugRequest:e.debugRequest,retryDelayMS:e.retryDelayMS,retryAllErrors:e.retryAllErrors,maxRetries:e.maxRetries,useExponentialBackoff:e.useExponentialBackoff}})),Rm=a((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),i=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},a=e&&e.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},o=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.inputs=e.buildRawRequestAction=e.sendRawRequest=e.handleErrors=e.createClient=e.toAxiosRetryConfig=void 0;let s=o(Nu()),c=r(Am()),l=o(bu()),u=o(jm()),d=o(Im()),f=Om(),p=o(dl()),m=Lm();Object.defineProperty(e,"inputs",{enumerable:!0,get:function(){return m.inputs}});let h=/^(cookie|set-cookie)$|auth|token|secret|password|api[-_]?key/i,g=e=>typeof e==`object`&&!!e&&typeof e.toJSON==`function`,_=e=>{let t=g(e)?e.toJSON():Object.assign({},e);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,h.test(e)?`[REDACTED]`:t]))},v=e=>{let t=p.default.types.toString(e.token?.access_token);if(t)return{Authorization:`Bearer ${t}`};let n=p.default.types.toString(e.fields?.apiKey);if(n)return{Authorization:`Bearer ${n}`};let r=p.default.types.toString(e.fields?.username),i=p.default.types.toString(e.fields?.password);if(r&&i)return{Authorization:`Basic ${Buffer.from(`${r}:${i}`).toString(`base64`)}`};throw Error(`Failed to guess at authorization parameters for Connection: ${e.key}`)},y=(e,t,n={})=>{let r=new l.default;return(e||[]).map(({key:e,value:t})=>r.append(e,t)),(t||[]).map(({key:e,value:t})=>r.append(e,p.default.types.toBufferDataPayload(t).data,{filename:n?.[e]||e})),r},b=(e,t)=>t?typeof e==`number`?t=>2**(t-1)*e:c.exponentialDelay:typeof e==`number`?()=>e:e;e.toAxiosRetryConfig=e=>{var{retryDelay:t,retryAllErrors:n,retryCondition:r,useExponentialBackoff:i}=e,o=a(e,[`retryDelay`,`retryAllErrors`,`retryCondition`,`useExponentialBackoff`]);return Object.assign(Object.assign({},o),{retryDelay:b(t,i),retryCondition:n?()=>!0:typeof r==`function`?r:c.isNetworkOrIdempotentRequestError})},e.createClient=({baseUrl:t,responseType:n,headers:r,timeout:i,params:a,debug:o=!1,retryConfig:l})=>{let u=s.default.create({baseURL:t,responseType:n,headers:r,timeout:i,params:a,maxContentLength:1/0,maxBodyLength:1/0});return o&&(u.interceptors.request.use(e=>{let{baseURL:t,headers:n,method:r,timeout:i,url:a,data:o,params:s}=e,c=(0,d.default)(o);return console.log(p.default.types.toJSON({type:`request`,baseURL:t,params:s,url:a,headers:_(n),method:r,timeout:i,data:c>1024*10||Buffer.isBuffer(o)?`<data (${c} bytes)>`:o},!0,!0)),e}),u.interceptors.response.use(e=>{let{headers:t,status:n,statusText:r,data:i}=e,a=(0,d.default)(i);return console.log(p.default.types.toJSON({type:`response`,headers:_(t),status:n,statusText:r,data:a>1024*10||Buffer.isBuffer(i)?`<data (${a} bytes)>`:i},!0,!0)),e})),l&&(0,c.default)(u,(0,e.toAxiosRetryConfig)(l)),u},e.handleErrors=e=>{if(s.default.isAxiosError(e)){let{message:t,response:n}=e;return{message:t,data:n?.data,status:n?.status,headers:n?.headers}}return e},e.sendRawRequest=(t,n,...r)=>i(void 0,[t,n,...r],void 0,function*(t,n,r={}){if(n.data&&(!(0,u.default)(n.formData)||!(0,u.default)(n.fileData)))throw Error(`Cannot specify both Data and File/Form Data.`);let i=!(0,u.default)(n.formData)||!(0,u.default)(n.fileData)?y(n.formData,n.fileData,n.fileDataFileNames):n.data;return yield(0,e.createClient)({baseUrl:t,debug:n.debugRequest,responseType:n.responseType,timeout:n.timeout,retryConfig:{retries:n.maxRetries,retryDelay:n.retryDelayMS,retryAllErrors:n.retryAllErrors,useExponentialBackoff:n.useExponentialBackoff}}).request({method:n.method,url:n.url,headers:Object.assign(Object.assign(Object.assign({},p.default.types.keyValPairListToObject(n.headers)),i instanceof l.default?i.getHeaders():{}),r),params:p.default.types.keyValPairListToObject(n.queryParams),data:i||void 0})}),e.buildRawRequestAction=(t,n=`Raw Request`,r=`Issue a raw HTTP request`)=>(0,f.action)({display:{label:n,description:r},inputs:Object.assign({connection:{label:`Connection`,type:`connection`,required:!0}},m.inputs),perform:(n,r)=>i(void 0,void 0,void 0,function*(){var{connection:n}=r,i=a(r,[`connection`]);let{data:o}=yield(0,e.sendRawRequest)(t,i,v(n));return{data:o}})})}))(),$=Om();const zm=(0,$.oauth2Connection)({key:`intercom`,display:{label:`OAuth 2.0`,description:`OAuth 2.0 connection for Intercom`},oauth2Type:$.OAuth2Type.AuthorizationCode,inputs:{authorizeUrl:{label:`Authorize URL`,type:`string`,required:!0,shown:!1,default:`https://app.intercom.com/oauth`,comments:`Authorization URL for Intercom`},tokenUrl:{label:`Token URL`,type:`string`,required:!0,shown:!1,default:`https://api.intercom.io/auth/eagle/token`,comments:`Token URL for Intercom`},scopes:{label:`Scopes`,type:`string`,required:!1,shown:!1,default:``,comments:`Space delimited scopes`},clientId:{label:`Client ID`,type:`string`,required:!0,comments:`Client ID of your Intercom app`},clientSecret:{label:`Client Secret`,type:`password`,required:!0,comments:`Client Secret of your Intercom app`}}}),Bm=(0,$.connection)({key:`intercomAccesssToken`,display:{label:`Access Token`,description:`Access Token connection for Intercom`},inputs:{accessToken:{label:`Access Token`,type:`password`,required:!0,comments:`Access Token for Intercom`}}});var Vm=[zm,Bm];const Hm=`https://api.intercom.io/`,Um=e=>{if(e.key!==zm.key&&e.key!==Bm.key)throw new $.ConnectionError(e,`Received unexpected connection type`)},Wm=e=>{Um(e);let t=`Did not receive a connection containing an access token.`,n=e.key===zm.key,r=e.key===Bm.key;if(n||r){let r=n?e.token?.access_token:e.fields.accessToken;if(!r)throw new $.ConnectionError(e,t);return $.util.types.toString(r)}throw new $.ConnectionError(e,t)},Gm=e=>({accessToken:Wm(e),baseUrl:Hm}),Km=(e,t)=>{let n=Wm(e);return(0,Rm.createClient)({baseUrl:Hm,headers:{Authorization:`Bearer ${n}`,Accept:`application/json`},responseType:`json`,debug:t})},qm={type:`company`,id:`531ee472cce572a6ec000006`,name:`Blue Sun`,plan:`plan1`,company_id:`6`,remote_created_at:1394531169,created_at:1394533506,updated_at:1396874658,size:85,website:`http://www.example.com`,industry:`Manufacturing`,monthly_spend:49,session_count:26,user_count:10,custom_attributes:{paid_subscriber:!0,team_mates:0}},Jm={data:{type:`company`,company_id:`1`,id:`667d60808a68186f43bafd31`,app_id:`this_is_an_id128_that_should_be_at_least_`,name:`company1`,remote_created_at:1719492736,created_at:1719492736,updated_at:1719492736,monthly_spend:0,session_count:0,user_count:1,tags:{type:`tag.list`,tags:[]},segments:{type:`segment.list`,segments:[]},plan:{},custom_attributes:{}}},Ym={data:{id:`5ba682d23d7cf92bef87bfd4`,object:`company`,deleted:`true`}},Xm={CONTACTS:`contacts`,COMPANIES:`companies`},Zm={[Xm.CONTACTS]:{label:`Contacts`},[Xm.COMPANIES]:{label:`Companies`}},Qm=Object.entries(Zm).map(([e,{label:t}])=>({label:t,value:e})),$m=e=>$.util.types.toString(e),eh=e=>e?$.util.types.toObject(e):void 0,th=e=>e?$.util.types.toString(e):void 0,nh=async(e,t,n=void 0)=>{let{data:{data:r,pages:i}}=await e.get(t,{params:n});return{data:r,pages:i}},rh=async(e,t=void 0,n=!1,r)=>{if(!n){let{data:n,pages:i}=await nh(e,r,t);return{data:n,pages:i}}let i=[],a,o=null;for(;;){let{data:t,pages:n}=await nh(e,r,{per_page:50,starting_after:a});if(i=i.concat(t),a=n.next?.starting_after,!a){o=n;break}}return{data:i,pages:o}},ih=async(e,t)=>{let n={operator:`AND`,value:[{field:`updated_at`,operator:`>`,value:t}]},r=[],i,a=!0;for(;a;){let{data:t}=await e.post(`/contacts/search`,{query:n,pagination:{per_page:50,...i?{starting_after:i}:{}}});r.push(...t.data??[]),i=t.pages?.next?.starting_after,a=!!i}return r},ah=async e=>{let{data:t}=await rh(e,void 0,!0,`/companies`);return t},oh=(e,t)=>{let n=[],r=[];for(let i of e)i.created_at>t?n.push(i):i.updated_at>t&&r.push(i);return{created:n,updated:r}},sh=/^(\d{4})-(\d{2})-(\d{2})$/,ch=e=>{let t=$.util.types.toString(e).trim();if(t===``)return``;let n=t.match(sh);if(!n)throw Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${t}`);let[,r,i,a]=n,o=$.util.types.toNumber(r),s=$.util.types.toNumber(i),c=$.util.types.toNumber(a),l=new Date(Date.UTC(o,s-1,c));if(l.getUTCFullYear()!==o||l.getUTCMonth()!==s-1||l.getUTCDate()!==c)throw Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${t}`);if(l.getTime()>Date.now())throw Error(`Look-back Date cannot be a future date. Received: ${t}`);return l.toISOString()},lh=e=>Math.floor(new Date(e).getTime()/1e3),uh=(e,t,n)=>{if(e?.lastPolledAt){let t=lh(e.lastPolledAt);return{lastPolledUnix:t,searchSinceUnix:t,isBackfill:!1}}if(t){let e=lh(t);return{lastPolledUnix:e-1,searchSinceUnix:e-86400,isBackfill:!0}}let r=lh(n);return{lastPolledUnix:r,searchSinceUnix:r,isBackfill:!1}},dh=async(e,t,n,{showNew:r,showUpdated:i})=>{let a=t===Xm.CONTACTS?await ih(e,n.searchSinceUnix):await ah(e),{created:o,updated:s}=oh(a,n.lastPolledUnix);return{created:n.isBackfill||r?o:[],updated:n.isBackfill||i?s:[]}},fh=e=>{let t=e??{created:[],updated:[]};return[...(t.created??[]).map(e=>({changeType:`created`,record:e})),...(t.updated??[]).map(e=>({changeType:`updated`,record:e}))]},ph=(0,$.input)({label:`Connection`,type:`connection`,required:!0}),mh=(0,$.input)({label:`ID`,type:`string`,clean:th,comments:`Unique identifier for the entity given by Intercom`}),hh=(0,$.input)({label:`External ID`,type:`string`,clean:th,comments:`Unique identifier for the entity from external systems`}),gh=(0,$.input)({label:`Starting After Cursor`,type:`string`,clean:th,comments:`If you want to get the next page of data in the batch, you must make a new request with the starting_after parameter equal to the cursor pointer string. Use the starting_after parameter of the previous response.`}),_h=(0,$.input)({label:`Page`,type:`string`,comments:`The page of results to fetch.`,required:!1,example:`1`,placeholder:`1`,clean:th}),vh=(0,$.input)({label:`Per Page`,type:`string`,comments:`How many results to return per page. Default is 15. Max is 50.`,required:!1,example:`15`,placeholder:`15`,clean:th}),yh=(0,$.input)({label:`Order`,type:`string`,comments:`The order to sort the results in. Default is 'desc'.`,required:!1,model:[{value:`asc`,label:`Ascending`},{value:`desc`,label:`Descending`}],default:`desc`,clean:th}),bh=(0,$.input)({label:`Ticket Attributes`,language:`json`,type:`code`,comments:`The attributes set on the ticket. When setting the default title and description attributes, the attribute keys that should be used are _default_title_ and _default_description_`,required:!1,example:JSON.stringify({_default_title_:`example`,_default_description_:`there is a problem`},null,2),clean:eh}),xh=(0,$.input)({label:`Ticket Type ID`,type:`string`,comments:`The ID of the type of ticket you want to create`,example:`147`,placeholder:`147`,required:!0,dataSource:`selectTicketType`,clean:th}),Sh=(0,$.input)({label:`Contact ID`,type:`string`,comments:`The ID / email / external Id of the user affected by this ticket.`,example:`6657af026abd0167d9419def`,placeholder:`6657af026abd0167d9419def`,required:!0,dataSource:`selectContact`,clean:th}),Ch=(0,$.input)({label:`Company ID`,type:`string`,comments:`The ID of the company that the ticket is associated with. The ID that you set upon company creation.`,example:`147`,placeholder:`147`,required:!1,dataSource:`selectCompany`,clean:th}),wh=(0,$.input)({label:`Fetch All`,type:`boolean`,comments:`If true, all pages of results will be fetched.`,required:!1,clean:$.util.types.toBool}),Th={connection:ph},Eh={connection:ph},Dh={connection:ph},Oh={connection:ph},kh={connection:ph},Ah=(0,$.input)({label:`Remote Created At`,type:`string`,required:!0,clean:$m,comments:`Time the company was created by you`}),jh=(0,$.input)({label:`Name`,type:`string`,required:!0,clean:$.util.types.toString,comments:`Name of the company`}),Mh=(0,$.input)({label:`Monthly Spend`,type:`string`,clean:$.util.types.toNumber,comments:`How much revenue the company generates for your business`}),Nh=(0,$.input)({label:`Plan`,type:`string`,clean:$.util.types.toString,comments:`Name of the plan associated with the company`}),Ph=(0,$.input)({label:`Size`,type:`string`,clean:$.util.types.toNumber,comments:`Number of employees in this company`}),Fh=(0,$.input)({label:`Website`,type:`string`,clean:$.util.types.toString,comments:`The URL for this company's website`}),Ih=(0,$.input)({label:`Industry`,type:`string`,clean:$.util.types.toString,comments:`The industry this company operates in`}),Lh=(0,$.input)({label:`Company ID`,type:`string`,required:!0,clean:$.util.types.toString,dataSource:`selectCompany`,comments:`Identifier of Company`}),Rh=(0,$.input)({label:`Segment ID`,type:`string`,required:!1,clean:$.util.types.toString,comments:`Id of the segment to be used as filter.`}),zh=(0,$.action)({display:{label:`Create Company`,description:`Create a new Company`},inputs:{connection:ph,company_id:Lh,remote_created_at:Ah,name:jh,monthly_spend:Mh,plan:Nh,size:Ph,website:Fh,industry:Ih},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/companies`,n);return{data:r}},examplePayload:{data:qm}}),Bh=(0,$.action)({display:{label:`Delete Company`,description:`Delete an existing Company`},inputs:{connection:ph,id:Lh},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).delete(`/companies/${n}`);return{data:r}},examplePayload:Ym}),Vh=(0,$.action)({display:{label:`Get Company`,description:`Retrieves an existing Company`},inputs:{connection:ph,id:Lh},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).get(`/companies/${n}`);return{data:r}},examplePayload:Jm}),Hh={data:[{type:`company`,company_id:`remote_companies_scroll_2`,id:`6657add06abd0167d9419cc3`,app_id:`this_is_an_id158_that_should_be_at_least_`,name:`IntercomQATest1`,remote_created_at:1717022160,created_at:1717022160,updated_at:1717022160,monthly_spend:0,session_count:0,user_count:4,tags:{type:`tag.list`,tags:[]},segments:{type:`segment.list`,segments:[]},plan:{},custom_attributes:{}}],pages:{type:`companies`,next:null,page:1,per_page:15,total_pages:1}},Uh={type:`ticket`,id:`773`,ticket_id:`35`,ticket_attributes:{_default_title_:`example`,_default_description_:`there is a problem`},ticket_state:`submitted`,ticket_state_internal_label:`Submitted`,ticket_state_external_label:`Submitted`,ticket_type:{type:`ticket_type`,id:`147`,name:`my-ticket-type-15`,description:`my ticket type description is awesome.`,icon:`🦁`,workspace_id:`this_is_an_id648_that_should_be_at_least_`,archived:!1,created_at:1717022465,updated_at:1717022465,is_internal:!1,ticket_type_attributes:{type:`list`,data:[{type:`ticket_type_attribute`,id:`388`,workspace_id:`this_is_an_id648_that_should_be_at_least_`,name:`_default_title_`,description:`ola`,data_type:`string`,input_options:null,order:0,required_to_create:!0,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!1,default:!1,ticket_type_id:147,archived:!1,created_at:1717022465,updated_at:1717022465},{type:`ticket_type_attribute`,id:`389`,workspace_id:`this_is_an_id648_that_should_be_at_least_`,name:`_default_description_`,description:`ola`,data_type:`string`,input_options:null,order:0,required_to_create:!0,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!1,default:!1,ticket_type_id:147,archived:!1,created_at:1717022465,updated_at:1717022465}]},category:`Back-office`},contacts:{type:`contact.list`,contacts:[{type:`contact`,id:`6657af026abd0167d9419def`,external_id:`70`}]},admin_assignee_id:`0`,team_assignee_id:`0`,created_at:1717022466,updated_at:1717022466,ticket_parts:{type:`ticket_part.list`,ticket_parts:[{type:`ticket_part`,id:`199`,part_type:`ticket_state_updated_by_admin`,ticket_state:`submitted`,previous_ticket_state:`submitted`,created_at:1717022466,updated_at:1717022466,author:{id:`991268827`,type:`bot`,name:`Operator`,email:`operator+this_is_an_id648_that_should_be_at_least_@intercom.io`},attachments:[],redacted:!1}],total_count:1},open:!0,linked_objects:{type:`list`,data:[],total_count:0,has_more:!1},category:`Back-office`,is_shared:!1},Wh={type:`list`,data:[{type:`ticket_type`,id:`126`,name:`Bug Report`,description:`Bug Report Template`,icon:`🎟️`,workspace_id:`this_is_an_id608_that_should_be_at_least_`,archived:!1,created_at:1717022435,updated_at:1717022435,is_internal:!1,ticket_type_attributes:{type:`list`,data:[{type:`ticket_type_attribute`,id:`354`,workspace_id:`this_is_an_id608_that_should_be_at_least_`,name:`_default_title_`,description:``,data_type:`string`,input_options:{multiline:!1},order:0,required_to_create:!1,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!0,default:!0,ticket_type_id:126,archived:!1,created_at:1717022435,updated_at:1717022435},{type:`ticket_type_attribute`,id:`356`,workspace_id:`this_is_an_id608_that_should_be_at_least_`,name:`name`,description:`description`,data_type:`string`,input_options:null,order:0,required_to_create:!1,required_to_create_for_contacts:!1,visible_on_create:!1,visible_to_contacts:!1,default:!1,ticket_type_id:126,archived:!1,created_at:1717022435,updated_at:1717022435},{type:`ticket_type_attribute`,id:`355`,workspace_id:`this_is_an_id608_that_should_be_at_least_`,name:`_default_description_`,description:``,data_type:`string`,input_options:{multiline:!0},order:1,required_to_create:!1,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!0,default:!0,ticket_type_id:126,archived:!1,created_at:1717022435,updated_at:1717022435}]},category:`Customer`}]},Gh={data:[{type:`contact`,id:`5ba682d23d7cf92bef87bfd4`,external_id:`f3b87a2e09d514c6c2e79b9a`,workspace_id:`ecahpwf5`,role:`user`,email:`joe@example.com`,email_domain:`example.com`,phone:`+1123456789`,formatted_phone:`+1123456789`,name:`John Doe`,owner_id:123,has_hard_bounced:!0,marked_email_as_spam:!0,unsubscribed_from_emails:!0,created_at:1571672154,updated_at:1571672154,signed_up_at:1571672154,last_seen_at:1571672154,last_replied_at:1571672154,last_contacted_at:1571672154,last_email_opened_at:1571672154,last_email_clicked_at:1571672154,language_override:`en`,browser:`Chrome`,browser_version:`80.0.3987.132`,browser_language:`en-US`,os:`Mac OS X`,android_app_name:`Intercom`,android_app_version:`5.0.0`,android_device:`Pixel 3`,android_os_version:`10`,android_sdk_version:`28`,android_last_seen_at:1571672154,ios_app_name:`Intercom`,ios_app_version:`5.0.0`,ios_device:`iPhone 11`,ios_os_version:`13.3.1`,ios_sdk_version:`13.3.1`,ios_last_seen_at:1571672154,custom_attributes:{},avatar:{type:`avatar`,image_url:`https://example.org/128Wash.jpg`},tags:{data:[{type:`note`,id:`123`,url:`/contacts/5ba682d23d7cf92bef87bfd4/notes`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/tags`,total_count:100,has_more:!0},notes:{data:[{type:`note`,id:`123`,url:`/contacts/5ba682d23d7cf92bef87bfd4/notes`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/notes`,total_count:100,has_more:!0},companies:{url:`/contacts/5ba682d23d7cf92bef87bfd4/companies`,total_count:100,has_more:!0},location:{type:`location`,country:`Ireland`,region:`Dublin`,city:`Dublin`},social_profiles:{data:[{type:`social_profile`,name:`Facebook`,url:`http://twitter.com/th1sland`}]}}],total_count:100,pages:{type:`pages`,page:1,next:{per_page:2,starting_after:`your-cursor-from-response`},per_page:2,total_pages:13}},Kh={type:`ticket`,id:`777`,ticket_id:`39`,ticket_attributes:{_default_title_:`attribute_value`,_default_description_:null},ticket_state:`submitted`,ticket_state_internal_label:`Submitted`,ticket_state_external_label:`Submitted`,ticket_type:{type:`ticket_type`,id:`153`,name:`my-ticket-type-21`,description:`my ticket type description is awesome.`,icon:`🦁`,workspace_id:`this_is_an_id660_that_should_be_at_least_`,archived:!1,created_at:1717022478,updated_at:1717022478,is_internal:!1,ticket_type_attributes:{type:`list`,data:[{type:`ticket_type_attribute`,id:`404`,workspace_id:`this_is_an_id660_that_should_be_at_least_`,name:`_default_title_`,description:`ola`,data_type:`string`,input_options:null,order:0,required_to_create:!0,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!1,default:!1,ticket_type_id:153,archived:!1,created_at:1717022478,updated_at:1717022478},{type:`ticket_type_attribute`,id:`405`,workspace_id:`this_is_an_id660_that_should_be_at_least_`,name:`_default_description_`,description:`ola`,data_type:`string`,input_options:null,order:0,required_to_create:!0,required_to_create_for_contacts:!1,visible_on_create:!0,visible_to_contacts:!1,default:!1,ticket_type_id:153,archived:!1,created_at:1717022479,updated_at:1717022479}]},category:`Back-office`},contacts:{type:`contact.list`,contacts:[{type:`contact`,id:`6657af0f6abd0167d9419df3`,external_id:`2274eea8-d400-48f6-9345-2fb84a96e94d`}]},admin_assignee_id:`0`,team_assignee_id:`0`,created_at:1717022479,updated_at:1717022479,ticket_parts:{type:`ticket_part.list`,ticket_parts:[{type:`ticket_part`,id:`208`,part_type:`ticket_state_updated_by_admin`,ticket_state:`submitted`,previous_ticket_state:`submitted`,created_at:1717022479,updated_at:1717022479,author:{id:`991268868`,type:`admin`,name:`Ciaran445 Lee`,email:`admin445@email.com`},attachments:[],redacted:!1}],total_count:1},open:!0,linked_objects:{type:`list`,data:[],total_count:0,has_more:!1},category:`Back-office`,is_shared:!1},qh=(0,$.input)({label:`Name`,type:`string`,required:!0,clean:$.util.types.toString,comments:`Name of the tag`}),Jh=(0,$.input)({label:`Tag ID`,type:`string`,required:!0,dataSource:`selectTag`,clean:$.util.types.toString,comments:`ID of the tag`}),Yh=(0,$.action)({display:{label:`List Companies`,description:`Page through all Companies`},inputs:{fetchAll:wh,page:_h,perPage:vh,order:yh,companyName:{...jh,required:!1,comments:`Name of the company to be used as filter.`},companyId:{...Ch,comments:`Id of the company to be used as filter.`},tagId:{...Jh,required:!1,comments:`Id of the tag to be used as filter.`},segmentId:Rh,startingAfter:gh,connection:ph},perform:async(e,{connection:t,order:n,page:r,perPage:i,startingAfter:a,fetchAll:o,companyId:s,companyName:c,tagId:l,segmentId:u})=>({data:await rh(Km(t,e.debug.enabled),{company_id:s,name:c,tag_id:l,segment_id:u,order:n,page:r,per_page:i,starting_after:a},o,`/companies`)}),examplePayload:{data:Hh}}),Xh=(0,$.input)({label:`Tag ID`,type:`string`,required:!0,clean:$.util.types.toString,comments:`Identifier of Tag`,dataSource:`selectTag`}),Zh=(0,$.input)({label:`Role`,type:`string`,required:!0,model:[{label:`User`,value:`user`},{label:`Lead`,value:`lead`}],clean:$.util.types.toString,comments:`The role of the contact`}),Qh=(0,$.input)({label:`Email`,type:`string`,required:!0,clean:$.util.types.toString,comments:`Email of the contact`}),$h=(0,$.input)({label:`Phone`,type:`string`,clean:$.util.types.toString,comments:`Phone of the contact`}),eg=(0,$.input)({label:`Name`,type:`string`,clean:$.util.types.toString,comments:`Name of the contact`}),tg=(0,$.input)({label:`Avatar URL`,type:`string`,clean:$.util.types.toString,comments:`An image URL containing the avatar of a contact`}),ng=(0,$.input)({label:`Signed Up At`,type:`string`,clean:$m,comments:`The time specified for when a contact signed up`}),rg=(0,$.input)({label:`Last Seen At`,type:`string`,clean:$m,comments:`The time when the contact was last seen`}),ig=(0,$.input)({label:`Unsubscribed From Emails`,type:`boolean`,clean:$.util.types.toBool,comments:`Whether the contact is unsubscribed from emails`}),ag=(0,$.input)({label:`JSON Query`,required:!1,type:`code`,language:`json`,clean:$.util.types.toObject,comments:`If you wanted to provide a custom query instead of the one constructed by the action, you can use this input to bypass it.`});var og={listCompanies:Yh,createCompany:zh,updateCompany:(0,$.action)({display:{label:`Update Company`,description:`Update an existing Company`},inputs:{connection:ph,company_id:Lh,remote_created_at:{...Ah,required:!1},name:{...eg,required:!1},monthly_spend:Mh,plan:Nh,size:Ph,website:Fh,industry:Ih},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/companies`,n);return{data:r}},examplePayload:{data:qm}}),deleteCompany:Bh,getCompany:Vh};const sg={type:`contact`,id:`5ba682d23d7cf92bef87bfd4`,workspace_id:`ecahpwf5`,external_id:`25`,role:`user`,email:`wash@serenity.io`,phone:`+1123456789`,name:`Hoban Washburn`,avatar:`https://example.org/128Wash.jpg`,owner_id:127,social_profiles:{type:`list`,data:[{type:`social_profile`,name:`Twitter`,url:`http://twitter.com/th1sland`}]},unsubscribed_from_emails:!1,created_at:1571672154,updated_at:1571672158,signed_up_at:1571069751,last_seen_at:1571069751,last_replied_at:1571672158,last_contacted_at:1571672158,last_email_opened_at:1571673478,last_email_clicked_at:1571676789,language_override:null,browser:`chrome`,browser_version:`77.0.3865.90`,browser_language:`en`,os:`OS X 10.14.6`,location:{type:`location`,country:`Ireland`,region:`Dublin`,city:`Dublin`},android_app_name:null,android_app_version:null,android_device:null,android_os_version:null,android_sdk_version:null,android_last_seen_at:null,ios_app_name:null,ios_app_version:null,ios_device:null,ios_os_version:null,ios_sdk_version:null,ios_last_seen_at:null,custom_attributes:{paid_subscriber:!0,monthly_spend:155.5,team_mates:1},tags:{type:`list`,data:[{type:`tag`,id:`2`,url:`/tags/2`},{type:`tag`,id:`4`,url:`/tags/4`},{type:`tag`,id:`5`,url:`/tags/5`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/tags`},notes:{type:`list`,data:[{type:`note`,id:`20114858`,url:`/notes/20114858`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/notes`},companies:{type:`list`,data:[{type:`company`,id:`5ba686093d7cf93552a3dc99`,url:`/companies/5ba686093d7cf93552a3dc99`},{type:`company`,id:`5cee64a03d7cf90c51b36f19`,url:`/companies/5cee64a03d7cf90c51b36f19`},{type:`company`,id:`5d7668883d7cf944dbc5c791`,url:`/companies/5d7668883d7cf944dbc5c791`}],url:`/contacts/5ba682d23d7cf92bef87bfd4/companies`}},cg={data:{type:`contact`,id:`667d60a98a68186f43bafdb9`,workspace_id:`this_is_an_id252_that_should_be_at_least_`,external_id:`70`,role:`user`,email:`joe@bloggs.com`,phone:null,name:`Joe Bloggs`,avatar:null,owner_id:null,social_profiles:{type:`list`,data:[]},has_hard_bounced:!1,marked_email_as_spam:!1,unsubscribed_from_emails:!1,created_at:1719492777,updated_at:1719492777,signed_up_at:1719492777,last_seen_at:null,last_replied_at:null,last_contacted_at:null,last_email_opened_at:null,last_email_clicked_at:null,language_override:null,browser:null,browser_version:null,browser_language:null,os:null,location:{type:`location`,country:null,region:null,city:null,country_code:null,continent_code:null},android_app_name:null,android_app_version:null,android_device:null,android_os_version:null,android_sdk_version:null,android_last_seen_at:null,ios_app_name:null,ios_app_version:null,ios_device:null,ios_os_version:null,ios_sdk_version:null,ios_last_seen_at:null,custom_attributes:{},tags:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/tags`,total_count:0,has_more:!1},notes:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/notes`,total_count:0,has_more:!1},companies:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/companies`,total_count:0,has_more:!1},opted_out_subscription_types:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/subscriptions`,total_count:0,has_more:!1},opted_in_subscription_types:{type:`list`,data:[],url:`/contacts/667d60a98a68186f43bafdb9/subscriptions`,total_count:0,has_more:!1},utm_campaign:null,utm_content:null,utm_medium:null,utm_source:null,utm_term:null,referrer:null}},lg={data:{type:`company`,company_id:`1`,id:`667d608d8a68186f43bafd70`,app_id:`this_is_an_id166_that_should_be_at_least_`,name:`company6`,remote_created_at:1719492749,created_at:1719492749,updated_at:1719492749,monthly_spend:0,session_count:0,user_count:1,tags:{type:`tag.list`,tags:[]},segments:{type:`segment.list`,segments:[]},plan:{},custom_attributes:{}}},ug={data:{type:`company`,company_id:`1`,id:`667d60918a68186f43bafd80`,app_id:`this_is_an_id174_that_should_be_at_least_`,name:`company8`,remote_created_at:1719492753,created_at:1719492753,updated_at:1719492753,monthly_spend:0,session_count:0,user_count:0,tags:{type:`tag.list`,tags:[]},segments:{type:`segment.list`,segments:[]},plan:{},custom_attributes:{}}},dg={data:{id:`5ba682d23d7cf92bef87bfd4`,object:`contact`,archived:!0}},fg={data:{data:{id:`5ba682d23d7cf92bef87bfd4`,object:`contact`,deleted:!0}}},pg=(0,$.action)({display:{label:`Archive Contact`,description:`Archive an existing Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`}},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/contacts/${n}/archive`);return{data:r}},examplePayload:dg}),mg=(0,$.action)({display:{label:`Attach Company to Contact`,description:`Attach Company to Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},companyId:Lh},perform:async(e,{connection:t,id:n,companyId:r})=>{let{data:i}=await Km(t,e.debug.enabled).post(`/contacts/${n}/companies`,{id:r});return{data:i}},examplePayload:lg}),hg=(0,$.action)({display:{label:`Attach Tag to Contact`,description:`Attach a Tag to a Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},tagId:Xh},perform:async(e,{connection:t,id:n,tagId:r})=>{let{data:i}=await Km(t,e.debug.enabled).post(`/contacts/${n}/tags`,{id:r});return{data:i}}}),gg=(0,$.action)({display:{label:`Create Contact`,description:`Create a new Contact`},inputs:{connection:ph,role:Zh,external_id:hh,email:Qh,phone:$h,name:eg,avatar:tg,signed_up_at:ng,last_seen_at:rg,unsubscribed_from_emails:ig},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/contacts`,n);return{data:r}},examplePayload:{data:sg}}),_g=(0,$.action)({display:{label:`Delete Contact`,description:`Delete an existing Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`}},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).delete(`/contacts/${n}`);return{data:r}},examplePayload:fg}),vg=(0,$.action)({display:{label:`Detach Company from Contact`,description:`Detach Company from Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},companyId:Lh},perform:async(e,{connection:t,id:n,companyId:r})=>{let{data:i}=await Km(t,e.debug.enabled).delete(`/contacts/${n}/companies/${r}`);return{data:i}},examplePayload:ug}),yg=(0,$.action)({display:{label:`Detach Tag from Contact`,description:`Detach a Tag from a Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},tagId:Xh},perform:async(e,{connection:t,id:n,tagId:r})=>{let{data:i}=await Km(t,e.debug.enabled).delete(`/contacts/${n}/tags/${r}`);return{data:i}}}),bg=(0,$.action)({display:{label:`Get Contact`,description:`Retrieves an existing Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`}},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).get(`/contacts/${n}`);return{data:r}},examplePayload:cg}),xg=(0,$.action)({display:{label:`List Contacts`,description:`Page through all Contacts`},inputs:{fetchAll:wh,page:_h,perPage:vh,order:yh,startingAfter:gh,connection:ph},perform:async(e,{connection:t,order:n,page:r,perPage:i,startingAfter:a,fetchAll:o})=>({data:await rh(Km(t,e.debug.enabled),{order:n,page:r,per_page:i,starting_after:a},o,`/contacts`)}),examplePayload:{data:Gh}}),Sg=(0,$.action)({display:{label:`Search Contacts`,description:`Search through all Contacts`},inputs:{connection:ph,role:{...Zh,required:!1},name:{...eg,required:!1},email:{...Qh,required:!1},jsonQuery:ag,startingAfter:gh},perform:async(e,{connection:t,role:n,name:r,email:i,startingAfter:a,jsonQuery:o})=>{let s=[];n&&s.push({field:`role`,operator:`=`,value:n}),r&&s.push({field:`name`,operator:`=`,value:r}),i&&s.push({field:`email`,operator:`=`,value:i});let{data:c}=await Km(t,e.debug.enabled).post(`/contacts/search`,{query:o||{operator:`AND`,value:s}},{params:{startingAfter:a}});return{data:c}}}),Cg=(0,$.action)({display:{label:`Unarchive Contact`,description:`Unarchive an archived Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`}},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/contacts/${n}/unarchive`);return{data:r}},examplePayload:{data:{id:`5ba682d23d7cf92bef87bfd4`,object:`contact`,archived:!1}}});var wg={listContacts:xg,createContact:gg,updateContact:(0,$.action)({display:{label:`Update Contact`,description:`Update an existing Contact`},inputs:{connection:ph,id:{...mh,required:!0,label:`Contact ID`,dataSource:`selectContact`},role:Zh,external_id:hh,email:Qh,phone:$h,name:eg,avatar:tg,signed_up_at:ng,last_seen_at:rg,unsubscribed_from_emails:ig},perform:async(e,{connection:t,id:n,...r})=>{let{data:i}=await Km(t,e.debug.enabled).put(`/contacts/${n}`,r);return{data:i}},examplePayload:{data:sg}}),deleteContact:_g,archiveContact:pg,unarchiveContact:Cg,searchContacts:Sg,attachTag:hg,detachTag:yg,attachCompany:mg,detachCompany:vg,getContact:bg};const{debugRequest:Tg,...Eg}=Rm.inputs,Dg=(0,$.action)({display:{label:`Raw Request`,description:`Send a raw request to Intercom`},perform:async(e,{connection:t,...n})=>{let{baseUrl:r,accessToken:i}=Gm(t),{data:a}=await(0,Rm.sendRawRequest)(r,{...n,debugRequest:e.debug.enabled},{Authorization:`Bearer ${i}`,Accept:`application/json`,"Content-Type":`application/json`});return{data:a}},inputs:{connection:ph,...Eg}}),Og={id:`17513`,name:`independent`,type:`tag`},kg=(0,$.action)({display:{label:`Create Tag`,description:`Create a new Tag`},inputs:{connection:ph,name:qh},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/tags`,n);return{data:r}},examplePayload:{data:Og}}),Ag=(0,$.action)({display:{label:`Delete Tag`,description:`Delete an existing Tag`},inputs:{connection:ph,id:Jh},perform:async(e,{connection:t,id:n})=>{let{data:r}=await Km(t,e.debug.enabled).delete(`/tags/${n}`);return{data:r}},examplePayload:{data:Og}});var jg={createTag:kg,listTags:(0,$.action)({display:{label:`List Tags`,description:`List all Tags`},inputs:{connection:ph},perform:async(e,{connection:t})=>{let{data:n}=await Km(t,e.debug.enabled).get(`/tags`);return{data:n}},examplePayload:{data:{type:`list`,data:[Og]}}}),updateTag:(0,$.action)({display:{label:`Update Tag`,description:`Update an existing Tag`},inputs:{connection:ph,id:Jh,name:qh},perform:async(e,{connection:t,...n})=>{let{data:r}=await Km(t,e.debug.enabled).post(`/tags`,n);return{data:r}},examplePayload:{data:Og}}),deleteTag:Ag},Mg={createTicket:(0,$.action)({display:{label:`Create Ticket`,description:`Create a new Ticket`},inputs:{ticketTypeId:xh,contactId:Sh,companyId:Ch,ticketAttributes:bh,connection:ph},perform:async(e,{connection:t,companyId:n,contactId:r,ticketAttributes:i,ticketTypeId:a})=>{let{data:o}=await Km(t,e.debug.enabled).post(`/tickets`,{ticket_type_id:a,contacts:[{id:r}],company_id:n,ticketAttributes:i});return{data:o}},examplePayload:{data:Uh}}),getTicket:(0,$.action)({display:{label:`Retrieve a ticket`,description:`Retrieve a ticket by ID`},inputs:{ticketId:{...mh,label:`Ticket ID`,comments:`ID of the ticket to retrieve.`,required:!0,example:`5ba682d23d7cf92bef87bfd4`,placeholder:`5ba682d23d7cf92bef87bfd4`,dataSource:`selectTicket`},connection:ph},perform:async(e,{connection:t,ticketId:n})=>{let{data:r}=await Km(t,e.debug.enabled).get(`/tickets/${n}`);return{data:r}},examplePayload:{data:Kh}}),listTicketTypes:(0,$.action)({display:{label:`List Ticket Types`,description:`Get a list of all ticket types for a workspace.`},inputs:{connection:ph},perform:async(e,{connection:t})=>{let{data:n}=await Km(t,e.debug.enabled).get(`/ticket_types`);return{data:n}},examplePayload:{data:Wh}})},Ng={...wg,...og,...jg,...Mg,rawRequest:Dg},Pg={selectCompany:(0,$.dataSource)({display:{label:`Select Company`,description:`A Picklist of Intercom companies`},dataSourceType:`picklist`,inputs:Th,perform:async(e,{connection:t})=>{let{data:n}=await rh(Km(t,!1),{order:`asc`},!0,`/companies`);return{result:n.map(({id:e,name:t})=>({label:t,key:e}))}}}),selectContact:(0,$.dataSource)({display:{label:`Select Contact`,description:`A Picklist of Intercom contacts`},dataSourceType:`picklist`,inputs:Eh,perform:async(e,{connection:t})=>{let{data:n}=await rh(Km(t,!1),{order:`asc`},!0,`/contacts`);return{result:n.map(({id:e,name:t,email:n})=>({label:t||n,key:e}))}}}),selectTag:(0,$.dataSource)({display:{label:`Select Tag`,description:`A Picklist of Intercom tags`},dataSourceType:`picklist`,inputs:Dh,perform:async(e,{connection:t})=>{let{data:{data:n}}=await Km(t,!1).get(`/tags`);return{result:(n||[]).map(({id:e,name:t})=>({label:t,key:e}))}}}),selectTicket:(0,$.dataSource)({display:{label:`Select Ticket`,description:`A Picklist of Intercom open tickets`},dataSourceType:`picklist`,inputs:Oh,perform:async(e,{connection:t})=>{let n=Km(t,!1),r,i=[];do{let{data:e}=await n.post(`/tickets/search`,{query:{field:`open`,operator:`=`,value:!0},pagination:{per_page:50,starting_after:r}});i.push(...e.tickets||[]),r=e.pages?.next?.starting_after}while(r);return{result:i.map(e=>({label:e.ticket_attributes?._default_title_||`Ticket ${e.ticket_id}`,key:e.id}))}}}),selectTicketType:(0,$.dataSource)({display:{label:`Select Ticket Type`,description:`A Picklist of Intercom ticket types`},dataSourceType:`picklist`,inputs:kh,perform:async(e,{connection:t})=>{let{data:{data:n}}=await Km(t,!1).get(`/ticket_types`);return{result:(n||[]).map(({id:e,name:t})=>({label:t,key:e}))}}})};const Fg=(0,$.input)({label:`Resource Type`,type:`string`,required:!0,comments:`The type of resource to poll for new and updated records.`,model:Qm,clean:$.util.types.toString}),Ig=(0,$.input)({label:`Show New Records`,type:`boolean`,required:!0,default:`true`,comments:`Include newly created records in trigger results.`,clean:$.util.types.toBool}),Lg=(0,$.input)({label:`Show Updated Records`,type:`boolean`,required:!0,default:`true`,comments:`Include updated records in trigger results.`,clean:$.util.types.toBool}),Rg=(0,$.input)({label:`Look-back Date`,placeholder:`Enter look-back date (YYYY-MM-DD)`,type:`string`,required:!1,comments:`The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each record modified on or after this date once, ignoring the trigger's visibility filters.`,example:`2026-01-01`,clean:ch});var zg={pollChangesTrigger:(0,$.pollingTrigger)({display:{label:`New and Updated Records`,description:`Retrieves existing and ongoing records for a specified Intercom resource type. Load history once, check for changes on a schedule, or both.`},inputs:{connection:ph,resourceType:Fg,showNewRecords:Ig,showUpdatedRecords:Lg,lookBackDate:Rg},triggerResolverSupport:`valid`,batchConfig:{batchSize:50},triggerResolver:{resolveItems:(e,{payload:t})=>fh(t.body.data)},perform:async(e,t,n)=>{let r=new Date().toISOString(),i=uh(e.polling.getState(),n.lookBackDate,r),a=await dh(Km(n.connection,e.debug.enabled),n.resourceType,i,{showNew:n.showNewRecords,showUpdated:n.showUpdatedRecords}),o=a.created.length+a.updated.length;return e.polling.setState({lastPolledAt:r}),e.debug.enabled&&e.logger.debug(`Polled ${n.resourceType}: ${a.created.length} new, ${a.updated.length} updated`),{payload:{...t,body:{data:a}},polledNoChanges:o===0}}})},Bg=(0,$.component)({key:`intercom`,public:!0,documentationUrl:`https://prismatic.io/docs/components/intercom/`,display:{label:`Intercom`,description:`Manage Intercom contacts, companies, tags, and tickets, and react to new and updated records.`,category:`Application Connectors`,iconPath:`icon.png`},hooks:{error:Rm.handleErrors},actions:Ng,triggers:zg,connections:Vm,dataSources:Pg});exports.default=Bg;
@@ -2076,7 +2076,7 @@ var src_default = (0, _prismatic_io_spectral.component)({
2076
2076
  documentationUrl: "https://prismatic.io/docs/components/intercom/",
2077
2077
  display: {
2078
2078
  label: "Intercom",
2079
- description: "Manage companies, contacts and tags on the Intercom platform",
2079
+ description: "Manage Intercom contacts, companies, tags, and tickets, and react to new and updated records.",
2080
2080
  category: "Application Connectors",
2081
2081
  iconPath: "icon.png"
2082
2082
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/components-intercom",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "main": "./npm-dist/index.cjs",
5
5
  "types": "./npm-dist/index.d.cts",
6
6
  "exports": {
@@ -45,6 +45,7 @@
45
45
  "tsdown": "0.22.3",
46
46
  "typescript": "6.0.3",
47
47
  "vitest": "4.1.9",
48
- "@prismatic-io/spectral": "^10.39.1"
48
+ "@prismatic-io/spectral": "^10.39.1",
49
+ "build-config": "file:../../packages/build-config"
49
50
  }
50
51
  }