@activepieces/piece-bexio 0.1.6 → 0.1.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +3 -3
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var Zu=Object.create;var Tt=Object.defineProperty;var Hu=Object.getOwnPropertyDescriptor;var Gu=Object.getOwnPropertyNames;var Wu=Object.getPrototypeOf,Ku=Object.prototype.hasOwnProperty;var o=(e,r)=>Tt(e,"name",{value:r,configurable:!0});var z=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Kn=(e,r)=>{for(var n in r)Tt(e,n,{get:r[n],enumerable:!0})},Jn=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Gu(r))!Ku.call(e,i)&&i!==n&&Tt(e,i,{get:()=>r[i],enumerable:!(t=Hu(r,i))||t.enumerable});return e};var Ae=(e,r,n)=>(n=e!=null?Zu(Wu(e)):{},Jn(r||!e||!e.__esModule?Tt(n,"default",{value:e,enumerable:!0}):n,e)),Ju=e=>Jn(Tt({},"__esModule",{value:!0}),e);var fo=z((mo,mr)=>{(function(e){"use strict";let r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},t=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",s={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${r}\\.${r}\\.${r}\\.${r}(${c})?$`,"i")};function p(d,_){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let v=0,b=-1,T=(d.match(s.zoneIndex)||[])[0],S,V;for(T&&(T=T.substring(1),d=d.replace(/%.+$/,""));(b=d.indexOf(":",b+1))>=0;)v++;if(d.substr(0,2)==="::"&&v--,d.substr(-2,2)==="::"&&v--,v>_)return null;for(V=_-v,S=":";V--;)S+="0:";return d=d.replace("::",S),d[0]===":"&&(d=d.slice(1)),d[d.length-1]===":"&&(d=d.slice(0,-1)),_=function(){let ue=d.split(":"),ye=[];for(let Ee=0;Ee<ue.length;Ee++)ye.push(parseInt(ue[Ee],16));return ye}(),{parts:_,zoneId:T}}o(p,"expandIPv6");function m(d,_,v,b){if(d.length!==_.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let T=0,S;for(;b>0;){if(S=v-b,S<0&&(S=0),d[T]>>S!==_[T]>>S)return!1;b-=v,T+=1}return!0}o(m,"matchCIDR");function f(d){if(i.test(d))return parseInt(d,16);if(d[0]==="0"&&!isNaN(parseInt(d[1],10))){if(t.test(d))return parseInt(d,8);throw new Error(`ipaddr: cannot parse ${d} as octal`)}return parseInt(d,10)}o(f,"parseIntAuto");function A(d,_){for(;d.length<_;)d=`0${d}`;return d}o(A,"padPart");let x={};x.IPv4=function(){function d(_){if(_.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let v,b;for(v=0;v<_.length;v++)if(b=_[v],!(0<=b&&b<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=_}return o(d,"IPv4"),d.prototype.SpecialRanges={unspecified:[[new d([0,0,0,0]),8]],broadcast:[[new d([255,255,255,255]),32]],multicast:[[new d([224,0,0,0]),4]],linkLocal:[[new d([169,254,0,0]),16]],loopback:[[new d([127,0,0,0]),8]],carrierGradeNat:[[new d([100,64,0,0]),10]],private:[[new d([10,0,0,0]),8],[new d([172,16,0,0]),12],[new d([192,168,0,0]),16]],reserved:[[new d([192,0,0,0]),24],[new d([192,0,2,0]),24],[new d([192,88,99,0]),24],[new d([198,18,0,0]),15],[new d([198,51,100,0]),24],[new d([203,0,113,0]),24],[new d([240,0,0,0]),4]],as112:[[new d([192,175,48,0]),24],[new d([192,31,196,0]),24]],amt:[[new d([192,52,193,0]),24]]},d.prototype.kind=function(){return"ipv4"},d.prototype.match=function(_,v){let b;if(v===void 0&&(b=_,_=b[0],v=b[1]),_.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return m(this.octets,_.octets,8,v)},d.prototype.prefixLengthFromSubnetMask=function(){let _=0,v=!1,b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},T,S,V;for(T=3;T>=0;T-=1)if(S=this.octets[T],S in b){if(V=b[S],v&&V!==0)return null;V!==8&&(v=!0),_+=V}else return null;return 32-_},d.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){return this.octets.slice(0)},d.prototype.toIPv4MappedAddress=function(){return x.IPv6.parse(`::ffff:${this.toString()}`)},d.prototype.toNormalizedString=function(){return this.toString()},d.prototype.toString=function(){return this.octets.join(".")},d}(),x.IPv4.broadcastAddressFromCIDR=function(d){try{let _=this.parseCIDR(d),v=_[0].toByteArray(),b=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],S=0;for(;S<4;)T.push(parseInt(v[S],10)|parseInt(b[S],10)^255),S++;return new this(T)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.isIPv4=function(d){return this.parser(d)!==null},x.IPv4.isValid=function(d){try{return new this(this.parser(d)),!0}catch{return!1}},x.IPv4.isValidCIDR=function(d){try{return this.parseCIDR(d),!0}catch{return!1}},x.IPv4.isValidFourPartDecimal=function(d){return!!(x.IPv4.isValid(d)&&d.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},x.IPv4.isValidCIDRFourPartDecimal=function(d){let _=d.match(/^(.+)\/(\d+)$/);return!x.IPv4.isValidCIDR(d)||!_?!1:x.IPv4.isValidFourPartDecimal(_[1])},x.IPv4.networkAddressFromCIDR=function(d){let _,v,b,T,S;try{for(_=this.parseCIDR(d),b=_[0].toByteArray(),S=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],v=0;v<4;)T.push(parseInt(b[v],10)&parseInt(S[v],10)),v++;return new this(T)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.parse=function(d){let _=this.parser(d);if(_===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(_)},x.IPv4.parseCIDR=function(d){let _;if(_=d.match(/^(.+)\/(\d+)$/)){let v=parseInt(_[2]);if(v>=0&&v<=32){let b=[this.parse(_[1]),v];return Object.defineProperty(b,"toString",{value:o(function(){return this.join("/")},"value")}),b}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},x.IPv4.parser=function(d){let _,v,b;if(_=d.match(n.fourOctet))return function(){let T=_.slice(1,6),S=[];for(let V=0;V<T.length;V++)v=T[V],S.push(f(v));return S}();if(_=d.match(n.longValue)){if(b=f(_[1]),b>4294967295||b<0)throw new Error("ipaddr: address outside defined range");return function(){let T=[],S;for(S=0;S<=24;S+=8)T.push(b>>S&255);return T}().reverse()}else return(_=d.match(n.twoOctet))?function(){let T=_.slice(1,4),S=[];if(b=f(T[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return S.push(f(T[0])),S.push(b>>16&255),S.push(b>>8&255),S.push(b&255),S}():(_=d.match(n.threeOctet))?function(){let T=_.slice(1,5),S=[];if(b=f(T[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return S.push(f(T[0])),S.push(f(T[1])),S.push(b>>8&255),S.push(b&255),S}():null},x.IPv4.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>32)throw new Error("ipaddr: invalid IPv4 prefix length");let _=[0,0,0,0],v=0,b=Math.floor(d/8);for(;v<b;)_[v]=255,v++;return b<4&&(_[b]=Math.pow(2,d%8)-1<<8-d%8),new this(_)},x.IPv6=function(){function d(_,v){let b,T;if(_.length===16)for(this.parts=[],b=0;b<=14;b+=2)this.parts.push(_[b]<<8|_[b+1]);else if(_.length===8)this.parts=_;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(b=0;b<this.parts.length;b++)if(T=this.parts[b],!(0<=T&&T<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");v&&(this.zoneId=v)}return o(d,"IPv6"),d.prototype.SpecialRanges={unspecified:[new d([0,0,0,0,0,0,0,0]),128],linkLocal:[new d([65152,0,0,0,0,0,0,0]),10],multicast:[new d([65280,0,0,0,0,0,0,0]),8],loopback:[new d([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new d([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new d([0,0,0,0,0,65535,0,0]),96],discard:[new d([256,0,0,0,0,0,0,0]),64],rfc6145:[new d([0,0,0,0,65535,0,0,0]),96],rfc6052:[new d([100,65435,0,0,0,0,0,0]),96],"6to4":[new d([8194,0,0,0,0,0,0,0]),16],teredo:[new d([8193,0,0,0,0,0,0,0]),32],benchmarking:[new d([8193,2,0,0,0,0,0,0]),48],amt:[new d([8193,3,0,0,0,0,0,0]),32],as112v6:[[new d([8193,4,274,0,0,0,0,0]),48],[new d([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new d([8193,16,0,0,0,0,0,0]),28],orchid2:[new d([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new d([8193,48,0,0,0,0,0,0]),28],reserved:[[new d([8193,0,0,0,0,0,0,0]),23],[new d([8193,3512,0,0,0,0,0,0]),32]]},d.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},d.prototype.kind=function(){return"ipv6"},d.prototype.match=function(_,v){let b;if(v===void 0&&(b=_,_=b[0],v=b[1]),_.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return m(this.parts,_.parts,16,v)},d.prototype.prefixLengthFromSubnetMask=function(){let _=0,v=!1,b={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},T,S;for(let V=7;V>=0;V-=1)if(T=this.parts[V],T in b){if(S=b[T],v&&S!==0)return null;S!==16&&(v=!0),_+=S}else return null;return 128-_},d.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){let _,v=[],b=this.parts;for(let T=0;T<b.length;T++)_=b[T],v.push(_>>8),v.push(_&255);return v},d.prototype.toFixedLengthString=function(){let _=function(){let b=[];for(let T=0;T<this.parts.length;T++)b.push(A(this.parts[T].toString(16),4));return b}.call(this).join(":"),v="";return this.zoneId&&(v=`%${this.zoneId}`),_+v},d.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let _=this.parts.slice(-2),v=_[0],b=_[1];return new x.IPv4([v>>8,v&255,b>>8,b&255])},d.prototype.toNormalizedString=function(){let _=function(){let b=[];for(let T=0;T<this.parts.length;T++)b.push(this.parts[T].toString(16));return b}.call(this).join(":"),v="";return this.zoneId&&(v=`%${this.zoneId}`),_+v},d.prototype.toRFC5952String=function(){let _=/((^|:)(0(:|$)){2,})/g,v=this.toNormalizedString(),b=0,T=-1,S;for(;S=_.exec(v);)S[0].length>T&&(b=S.index,T=S[0].length);return T<0?v:`${v.substring(0,b)}::${v.substring(b+T)}`},d.prototype.toString=function(){return this.toRFC5952String()},d}(),x.IPv6.broadcastAddressFromCIDR=function(d){try{let _=this.parseCIDR(d),v=_[0].toByteArray(),b=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],S=0;for(;S<16;)T.push(parseInt(v[S],10)|parseInt(b[S],10)^255),S++;return new this(T)}catch(_){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${_})`)}},x.IPv6.isIPv6=function(d){return this.parser(d)!==null},x.IPv6.isValid=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{let _=this.parser(d);return new this(_.parts,_.zoneId),!0}catch{return!1}},x.IPv6.isValidCIDR=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{return this.parseCIDR(d),!0}catch{return!1}},x.IPv6.networkAddressFromCIDR=function(d){let _,v,b,T,S;try{for(_=this.parseCIDR(d),b=_[0].toByteArray(),S=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],v=0;v<16;)T.push(parseInt(b[v],10)&parseInt(S[v],10)),v++;return new this(T)}catch(V){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${V})`)}},x.IPv6.parse=function(d){let _=this.parser(d);if(_.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(_.parts,_.zoneId)},x.IPv6.parseCIDR=function(d){let _,v,b;if((v=d.match(/^(.+)\/(\d+)$/))&&(_=parseInt(v[2]),_>=0&&_<=128))return b=[this.parse(v[1]),_],Object.defineProperty(b,"toString",{value:o(function(){return this.join("/")},"value")}),b;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},x.IPv6.parser=function(d){let _,v,b,T,S,V;if(b=d.match(s.deprecatedTransitional))return this.parser(`::ffff:${b[1]}`);if(s.native.test(d))return p(d,8);if((b=d.match(s.transitional))&&(V=b[6]||"",_=b[1],b[1].endsWith("::")||(_=_.slice(0,-1)),_=p(_+V,6),_.parts)){for(S=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],v=0;v<S.length;v++)if(T=S[v],!(0<=T&&T<=255))return null;return _.parts.push(S[0]<<8|S[1]),_.parts.push(S[2]<<8|S[3]),{parts:_.parts,zoneId:_.zoneId}}return null},x.IPv6.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>128)throw new Error("ipaddr: invalid IPv6 prefix length");let _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],v=0,b=Math.floor(d/8);for(;v<b;)_[v]=255,v++;return b<16&&(_[b]=Math.pow(2,d%8)-1<<8-d%8),new this(_)},x.fromByteArray=function(d){let _=d.length;if(_===4)return new x.IPv4(d);if(_===16)return new x.IPv6(d);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},x.isValid=function(d){return x.IPv6.isValid(d)||x.IPv4.isValid(d)},x.isValidCIDR=function(d){return x.IPv6.isValidCIDR(d)||x.IPv4.isValidCIDR(d)},x.parse=function(d){if(x.IPv6.isValid(d))return x.IPv6.parse(d);if(x.IPv4.isValid(d))return x.IPv4.parse(d);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},x.parseCIDR=function(d){try{return x.IPv6.parseCIDR(d)}catch{try{return x.IPv4.parseCIDR(d)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},x.process=function(d){let _=this.parse(d);return _.kind()==="ipv6"&&_.isIPv4MappedAddress()?_.toIPv4Address():_},x.subnetMatch=function(d,_,v){let b,T,S,V;v==null&&(v="unicast");for(T in _)if(Object.prototype.hasOwnProperty.call(_,T)){for(S=_[T],S[0]&&!(S[0]instanceof Array)&&(S=[S]),b=0;b<S.length;b++)if(V=S[b],d.kind()===V[0].kind()&&d.match.apply(d,V))return T}return v},typeof mr<"u"&&mr.exports?mr.exports=x:e.ipaddr=x})(mo)});var la=z((Xw,ca)=>{var ua=require("stream").Stream,Ad=require("util");ca.exports=we;function we(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(we,"DelayedStream");Ad.inherits(we,ua);we.create=function(e,r){var n=new this;r=r||{};for(var t in r)n[t]=r[t];n.source=e;var i=e.emit;return e.emit=function(){return n._handleEmit(arguments),i.apply(e,arguments)},e.on("error",function(){}),n.pauseStream&&e.pause(),n};Object.defineProperty(we.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});we.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};we.prototype.resume=function(){this._released||this.release(),this.source.resume()};we.prototype.pause=function(){this.source.pause()};we.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};we.prototype.pipe=function(){var e=ua.prototype.pipe.apply(this,arguments);return this.resume(),e};we.prototype._handleEmit=function(e){if(this._released){this.emit.apply(this,e);return}e[0]==="data"&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e)};we.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}}});var fa=z((eE,ma)=>{var Id=require("util"),pa=require("stream").Stream,da=la();ma.exports=se;function se(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}o(se,"CombinedStream");Id.inherits(se,pa);se.create=function(e){var r=new this;e=e||{};for(var n in e)r[n]=e[n];return r};se.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};se.prototype.append=function(e){var r=se.isStreamLike(e);if(r){if(!(e instanceof da)){var n=da.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=n}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this};se.prototype.pipe=function(e,r){return pa.prototype.pipe.call(this,e,r),this.resume(),e};se.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};se.prototype._realGetNext=function(){var e=this._streams.shift();if(typeof e>"u"){this.end();return}if(typeof e!="function"){this._pipeNext(e);return}var r=e;r(function(n){var t=se.isStreamLike(n);t&&(n.on("data",this._checkDataSize.bind(this)),this._handleErrors(n)),this._pipeNext(n)}.bind(this))};se.prototype._pipeNext=function(e){this._currentStream=e;var r=se.isStreamLike(e);if(r){e.on("end",this._getNext.bind(this)),e.pipe(this,{end:!1});return}var n=e;this.write(n),this._getNext()};se.prototype._handleErrors=function(e){var r=this;e.on("error",function(n){r._emitError(n)})};se.prototype.write=function(e){this.emit("data",e)};se.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};se.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};se.prototype.end=function(){this._reset(),this.emit("end")};se.prototype.destroy=function(){this._reset(),this.emit("close")};se.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};se.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};se.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach(function(r){r.dataSize&&(e.dataSize+=r.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};se.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var ya=z((rE,ga)=>{"use strict";ga.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var ba=z(xe=>{"use strict";var br=ya(),$d=require("path").extname,ha=/^\s*([^;\s]*)(?:;|\s|$)/,wd=/^text\//i;xe.charset=_a;xe.charsets={lookup:_a};xe.contentType=Ed;xe.extension=kd;xe.extensions=Object.create(null);xe.lookup=Nd;xe.types=Object.create(null);zd(xe.extensions,xe.types);function _a(e){if(!e||typeof e!="string")return!1;var r=ha.exec(e),n=r&&br[r[1].toLowerCase()];return n&&n.charset?n.charset:r&&wd.test(r[1])?"UTF-8":!1}o(_a,"charset");function Ed(e){if(!e||typeof e!="string")return!1;var r=e.indexOf("/")===-1?xe.lookup(e):e;if(!r)return!1;if(r.indexOf("charset")===-1){var n=xe.charset(r);n&&(r+="; charset="+n.toLowerCase())}return r}o(Ed,"contentType");function kd(e){if(!e||typeof e!="string")return!1;var r=ha.exec(e),n=r&&xe.extensions[r[1].toLowerCase()];return!n||!n.length?!1:n[0]}o(kd,"extension");function Nd(e){if(!e||typeof e!="string")return!1;var r=$d("x."+e).toLowerCase().substr(1);return r&&xe.types[r]||!1}o(Nd,"lookup");function zd(e,r){var n=["nginx","apache",void 0,"iana"];Object.keys(br).forEach(o(function(i){var c=br[i],u=c.extensions;if(!(!u||!u.length)){e[i]=u;for(var s=0;s<u.length;s++){var p=u[s];if(r[p]){var m=n.indexOf(br[r[p]].source),f=n.indexOf(c.source);if(r[p]!=="application/octet-stream"&&(m>f||m===f&&r[p].substr(0,12)==="application/"))continue}r[p]=i}}},"forEachMimeType"))}o(zd,"populateMaps")});var xa=z((oE,va)=>{va.exports=Dd;function Dd(e){var r=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;r?r(e):setTimeout(e,0)}o(Dd,"defer")});var In=z((sE,Ta)=>{var Pa=xa();Ta.exports=Od;function Od(e){var r=!1;return Pa(function(){r=!0}),o(function(t,i){r?e(t,i):Pa(o(function(){e(t,i)},"nextTick_callback"))},"async_callback")}o(Od,"async")});var $n=z((cE,Sa)=>{Sa.exports=Cd;function Cd(e){Object.keys(e.jobs).forEach(Rd.bind(e)),e.jobs={}}o(Cd,"abort");function Rd(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}o(Rd,"clean")});var wn=z((dE,Ia)=>{var Aa=In(),Ud=$n();Ia.exports=Md;function Md(e,r,n,t){var i=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[i]=Ld(r,i,e[i],function(c,u){i in n.jobs&&(delete n.jobs[i],c?Ud(n):n.results[i]=u,t(c,n.results))})}o(Md,"iterate");function Ld(e,r,n,t){var i;return e.length==2?i=e(n,Aa(t)):i=e(n,r,Aa(t)),i}o(Ld,"runJob")});var En=z((mE,$a)=>{$a.exports=jd;function jd(e,r){var n=!Array.isArray(e),t={index:0,keyedList:n||r?Object.keys(e):null,jobs:{},results:n?{}:[],size:n?Object.keys(e).length:e.length};return r&&t.keyedList.sort(n?r:function(i,c){return r(e[i],e[c])}),t}o(jd,"state")});var kn=z((gE,wa)=>{var Fd=$n(),qd=In();wa.exports=Bd;function Bd(e){Object.keys(this.jobs).length&&(this.index=this.size,Fd(this),qd(e)(null,this.results))}o(Bd,"terminator")});var ka=z((hE,Ea)=>{var Vd=wn(),Zd=En(),Hd=kn();Ea.exports=Gd;function Gd(e,r,n){for(var t=Zd(e);t.index<(t.keyedList||e).length;)Vd(e,r,t,function(i,c){if(i){n(i,c);return}if(Object.keys(t.jobs).length===0){n(null,t.results);return}}),t.index++;return Hd.bind(t,n)}o(Gd,"parallel")});var Nn=z((bE,vr)=>{var Na=wn(),Wd=En(),Kd=kn();vr.exports=Jd;vr.exports.ascending=za;vr.exports.descending=Yd;function Jd(e,r,n,t){var i=Wd(e,n);return Na(e,r,i,o(function c(u,s){if(u){t(u,s);return}if(i.index++,i.index<(i.keyedList||e).length){Na(e,r,i,c);return}t(null,i.results)},"iteratorHandler")),Kd.bind(i,t)}o(Jd,"serialOrdered");function za(e,r){return e<r?-1:e>r?1:0}o(za,"ascending");function Yd(e,r){return-1*za(e,r)}o(Yd,"descending")});var Oa=z((xE,Da)=>{var Xd=Nn();Da.exports=Qd;function Qd(e,r,n){return Xd(e,r,null,n)}o(Qd,"serial")});var Ra=z((TE,Ca)=>{Ca.exports={parallel:ka(),serial:Oa(),serialOrdered:Nn()}});var zn=z((SE,Ua)=>{"use strict";Ua.exports=Object});var La=z((AE,Ma)=>{"use strict";Ma.exports=Error});var Fa=z((IE,ja)=>{"use strict";ja.exports=EvalError});var Ba=z(($E,qa)=>{"use strict";qa.exports=RangeError});var Za=z((wE,Va)=>{"use strict";Va.exports=ReferenceError});var Ga=z((EE,Ha)=>{"use strict";Ha.exports=SyntaxError});var xr=z((kE,Wa)=>{"use strict";Wa.exports=TypeError});var Ja=z((NE,Ka)=>{"use strict";Ka.exports=URIError});var Xa=z((zE,Ya)=>{"use strict";Ya.exports=Math.abs});var es=z((DE,Qa)=>{"use strict";Qa.exports=Math.floor});var rs=z((OE,ts)=>{"use strict";ts.exports=Math.max});var is=z((CE,ns)=>{"use strict";ns.exports=Math.min});var as=z((RE,os)=>{"use strict";os.exports=Math.pow});var us=z((UE,ss)=>{"use strict";ss.exports=Math.round});var ls=z((ME,cs)=>{"use strict";cs.exports=Number.isNaN||o(function(r){return r!==r},"isNaN")});var ps=z((jE,ds)=>{"use strict";var ep=ls();ds.exports=o(function(r){return ep(r)||r===0?r:r<0?-1:1},"sign")});var fs=z((qE,ms)=>{"use strict";ms.exports=Object.getOwnPropertyDescriptor});var Dn=z((BE,gs)=>{"use strict";var Pr=fs();if(Pr)try{Pr([],"length")}catch{Pr=null}gs.exports=Pr});var hs=z((VE,ys)=>{"use strict";var Tr=Object.defineProperty||!1;if(Tr)try{Tr({},"a",{value:1})}catch{Tr=!1}ys.exports=Tr});var On=z((ZE,_s)=>{"use strict";_s.exports=o(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var r={},n=Symbol("test"),t=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(t)!=="[object Symbol]")return!1;var i=42;r[n]=i;for(var c in r)return!1;if(typeof Object.keys=="function"&&Object.keys(r).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(r).length!==0)return!1;var u=Object.getOwnPropertySymbols(r);if(u.length!==1||u[0]!==n||!Object.prototype.propertyIsEnumerable.call(r,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(r,n);if(s.value!==i||s.enumerable!==!0)return!1}return!0},"hasSymbols")});var xs=z((GE,vs)=>{"use strict";var bs=typeof Symbol<"u"&&Symbol,tp=On();vs.exports=o(function(){return typeof bs!="function"||typeof Symbol!="function"||typeof bs("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:tp()},"hasNativeSymbols")});var Cn=z((KE,Ps)=>{"use strict";Ps.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Rn=z((JE,Ts)=>{"use strict";var rp=zn();Ts.exports=rp.getPrototypeOf||null});var Is=z((YE,As)=>{"use strict";var np="Function.prototype.bind called on incompatible ",ip=Object.prototype.toString,op=Math.max,ap="[object Function]",Ss=o(function(r,n){for(var t=[],i=0;i<r.length;i+=1)t[i]=r[i];for(var c=0;c<n.length;c+=1)t[c+r.length]=n[c];return t},"concatty"),sp=o(function(r,n){for(var t=[],i=n||0,c=0;i<r.length;i+=1,c+=1)t[c]=r[i];return t},"slicy"),up=o(function(e,r){for(var n="",t=0;t<e.length;t+=1)n+=e[t],t+1<e.length&&(n+=r);return n},"joiny");As.exports=o(function(r){var n=this;if(typeof n!="function"||ip.apply(n)!==ap)throw new TypeError(np+n);for(var t=sp(arguments,1),i,c=o(function(){if(this instanceof i){var f=n.apply(this,Ss(t,arguments));return Object(f)===f?f:this}return n.apply(r,Ss(t,arguments))},"binder"),u=op(0,n.length-t.length),s=[],p=0;p<u;p++)s[p]="$"+p;if(i=Function("binder","return function ("+up(s,",")+"){ return binder.apply(this,arguments); }")(c),n.prototype){var m=o(function(){},"Empty");m.prototype=n.prototype,i.prototype=new m,m.prototype=null}return i},"bind")});var mt=z((QE,$s)=>{"use strict";var cp=Is();$s.exports=Function.prototype.bind||cp});var Sr=z((ek,ws)=>{"use strict";ws.exports=Function.prototype.call});var Un=z((tk,Es)=>{"use strict";Es.exports=Function.prototype.apply});var Ns=z((rk,ks)=>{"use strict";ks.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Ds=z((nk,zs)=>{"use strict";var lp=mt(),dp=Un(),pp=Sr(),mp=Ns();zs.exports=mp||lp.call(pp,dp)});var Cs=z((ik,Os)=>{"use strict";var fp=mt(),gp=xr(),yp=Sr(),hp=Ds();Os.exports=o(function(r){if(r.length<1||typeof r[0]!="function")throw new gp("a function is required");return hp(fp,yp,r)},"callBindBasic")});var Fs=z((ak,js)=>{"use strict";var _p=Cs(),Rs=Dn(),Ms;try{Ms=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var Mn=!!Ms&&Rs&&Rs(Object.prototype,"__proto__"),Ls=Object,Us=Ls.getPrototypeOf;js.exports=Mn&&typeof Mn.get=="function"?_p([Mn.get]):typeof Us=="function"?o(function(r){return Us(r==null?r:Ls(r))},"getDunder"):!1});var Hs=z((uk,Zs)=>{"use strict";var qs=Cn(),Bs=Rn(),Vs=Fs();Zs.exports=qs?o(function(r){return qs(r)},"getProto"):Bs?o(function(r){if(!r||typeof r!="object"&&typeof r!="function")throw new TypeError("getProto: not an object");return Bs(r)},"getProto"):Vs?o(function(r){return Vs(r)},"getProto"):null});var Ln=z((lk,Gs)=>{"use strict";var bp=Function.prototype.call,vp=Object.prototype.hasOwnProperty,xp=mt();Gs.exports=xp.call(bp,vp)});var eu=z((dk,Qs)=>{"use strict";var J,Pp=zn(),Tp=La(),Sp=Fa(),Ap=Ba(),Ip=Za(),ht=Ga(),yt=xr(),$p=Ja(),wp=Xa(),Ep=es(),kp=rs(),Np=is(),zp=as(),Dp=us(),Op=ps(),Ys=Function,jn=o(function(e){try{return Ys('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),Zt=Dn(),Cp=hs(),Fn=o(function(){throw new yt},"throwTypeError"),Rp=Zt?function(){try{return arguments.callee,Fn}catch{try{return Zt(arguments,"callee").get}catch{return Fn}}}():Fn,ft=xs()(),me=Hs(),Up=Rn(),Mp=Cn(),Xs=Un(),Ht=Sr(),gt={},Lp=typeof Uint8Array>"u"||!me?J:me(Uint8Array),Qe={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?J:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?J:ArrayBuffer,"%ArrayIteratorPrototype%":ft&&me?me([][Symbol.iterator]()):J,"%AsyncFromSyncIteratorPrototype%":J,"%AsyncFunction%":gt,"%AsyncGenerator%":gt,"%AsyncGeneratorFunction%":gt,"%AsyncIteratorPrototype%":gt,"%Atomics%":typeof Atomics>"u"?J:Atomics,"%BigInt%":typeof BigInt>"u"?J:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?J:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?J:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?J:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Tp,"%eval%":eval,"%EvalError%":Sp,"%Float16Array%":typeof Float16Array>"u"?J:Float16Array,"%Float32Array%":typeof Float32Array>"u"?J:Float32Array,"%Float64Array%":typeof Float64Array>"u"?J:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?J:FinalizationRegistry,"%Function%":Ys,"%GeneratorFunction%":gt,"%Int8Array%":typeof Int8Array>"u"?J:Int8Array,"%Int16Array%":typeof Int16Array>"u"?J:Int16Array,"%Int32Array%":typeof Int32Array>"u"?J:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ft&&me?me(me([][Symbol.iterator]())):J,"%JSON%":typeof JSON=="object"?JSON:J,"%Map%":typeof Map>"u"?J:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ft||!me?J:me(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Pp,"%Object.getOwnPropertyDescriptor%":Zt,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?J:Promise,"%Proxy%":typeof Proxy>"u"?J:Proxy,"%RangeError%":Ap,"%ReferenceError%":Ip,"%Reflect%":typeof Reflect>"u"?J:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?J:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ft||!me?J:me(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?J:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ft&&me?me(""[Symbol.iterator]()):J,"%Symbol%":ft?Symbol:J,"%SyntaxError%":ht,"%ThrowTypeError%":Rp,"%TypedArray%":Lp,"%TypeError%":yt,"%Uint8Array%":typeof Uint8Array>"u"?J:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?J:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?J:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?J:Uint32Array,"%URIError%":$p,"%WeakMap%":typeof WeakMap>"u"?J:WeakMap,"%WeakRef%":typeof WeakRef>"u"?J:WeakRef,"%WeakSet%":typeof WeakSet>"u"?J:WeakSet,"%Function.prototype.call%":Ht,"%Function.prototype.apply%":Xs,"%Object.defineProperty%":Cp,"%Object.getPrototypeOf%":Up,"%Math.abs%":wp,"%Math.floor%":Ep,"%Math.max%":kp,"%Math.min%":Np,"%Math.pow%":zp,"%Math.round%":Dp,"%Math.sign%":Op,"%Reflect.getPrototypeOf%":Mp};if(me)try{null.error}catch(e){Ws=me(me(e)),Qe["%Error.prototype%"]=Ws}var Ws,jp=o(function e(r){var n;if(r==="%AsyncFunction%")n=jn("async function () {}");else if(r==="%GeneratorFunction%")n=jn("function* () {}");else if(r==="%AsyncGeneratorFunction%")n=jn("async function* () {}");else if(r==="%AsyncGenerator%"){var t=e("%AsyncGeneratorFunction%");t&&(n=t.prototype)}else if(r==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&me&&(n=me(i.prototype))}return Qe[r]=n,n},"doEval"),Ks={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Gt=mt(),Ar=Ln(),Fp=Gt.call(Ht,Array.prototype.concat),qp=Gt.call(Xs,Array.prototype.splice),Js=Gt.call(Ht,String.prototype.replace),Ir=Gt.call(Ht,String.prototype.slice),Bp=Gt.call(Ht,RegExp.prototype.exec),Vp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Zp=/\\(\\)?/g,Hp=o(function(r){var n=Ir(r,0,1),t=Ir(r,-1);if(n==="%"&&t!=="%")throw new ht("invalid intrinsic syntax, expected closing `%`");if(t==="%"&&n!=="%")throw new ht("invalid intrinsic syntax, expected opening `%`");var i=[];return Js(r,Vp,function(c,u,s,p){i[i.length]=s?Js(p,Zp,"$1"):u||c}),i},"stringToPath"),Gp=o(function(r,n){var t=r,i;if(Ar(Ks,t)&&(i=Ks[t],t="%"+i[0]+"%"),Ar(Qe,t)){var c=Qe[t];if(c===gt&&(c=jp(t)),typeof c>"u"&&!n)throw new yt("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:i,name:t,value:c}}throw new ht("intrinsic "+r+" does not exist!")},"getBaseIntrinsic");Qs.exports=o(function(r,n){if(typeof r!="string"||r.length===0)throw new yt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new yt('"allowMissing" argument must be a boolean');if(Bp(/^%?[^%]*%?$/,r)===null)throw new ht("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var t=Hp(r),i=t.length>0?t[0]:"",c=Gp("%"+i+"%",n),u=c.name,s=c.value,p=!1,m=c.alias;m&&(i=m[0],qp(t,Fp([0,1],m)));for(var f=1,A=!0;f<t.length;f+=1){var x=t[f],d=Ir(x,0,1),_=Ir(x,-1);if((d==='"'||d==="'"||d==="`"||_==='"'||_==="'"||_==="`")&&d!==_)throw new ht("property names with quotes must have matching quotes");if((x==="constructor"||!A)&&(p=!0),i+="."+x,u="%"+i+"%",Ar(Qe,u))s=Qe[u];else if(s!=null){if(!(x in s)){if(!n)throw new yt("base intrinsic for "+r+" exists, but the property is not available.");return}if(Zt&&f+1>=t.length){var v=Zt(s,x);A=!!v,A&&"get"in v&&!("originalValue"in v.get)?s=v.get:s=s[x]}else A=Ar(s,x),s=s[x];A&&!p&&(Qe[u]=s)}}return s},"GetIntrinsic")});var ru=z((mk,tu)=>{"use strict";var Wp=On();tu.exports=o(function(){return Wp()&&!!Symbol.toStringTag},"hasToStringTagShams")});var ou=z((gk,iu)=>{"use strict";var Kp=eu(),nu=Kp("%Object.defineProperty%",!0),Jp=ru()(),Yp=Ln(),Xp=xr(),$r=Jp?Symbol.toStringTag:null;iu.exports=o(function(r,n){var t=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof t<"u"&&typeof t!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new Xp("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");$r&&(t||!Yp(r,$r))&&(nu?nu(r,$r,{configurable:!i,enumerable:!1,value:n,writable:!1}):r[$r]=n)},"setToStringTag")});var su=z((hk,au)=>{"use strict";var Qp=Function.prototype.call,em=Object.prototype.hasOwnProperty,tm=mt();au.exports=tm.call(Qp,em)});var cu=z((_k,uu)=>{"use strict";uu.exports=function(e,r){return Object.keys(r).forEach(function(n){e[n]=e[n]||r[n]}),e}});var Hn=z((bk,du)=>{"use strict";var Zn=fa(),rm=require("util"),qn=require("path"),nm=require("http"),im=require("https"),om=require("url").parse,am=require("fs"),sm=require("stream").Stream,um=require("crypto"),Bn=ba(),cm=Ra(),lm=ou(),He=su(),Vn=cu();function lu(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(lu,"escapeHeaderParam");function X(e){if(!(this instanceof X))return new X(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],Zn.call(this),e=e||{};for(var r in e)this[r]=e[r]}o(X,"FormData");rm.inherits(X,Zn);X.LINE_BREAK=`\r
2
- `;X.DEFAULT_CONTENT_TYPE="application/octet-stream";X.prototype.append=function(e,r,n){n=n||{},typeof n=="string"&&(n={filename:n});var t=Zn.prototype.append.bind(this);if((typeof r=="number"||r==null)&&(r=String(r)),Array.isArray(r)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(e,r,n),c=this._multiPartFooter();t(i),t(r),t(c),this._trackLength(i,r,n)};X.prototype._trackLength=function(e,r,n){var t=0;n.knownLength!=null?t+=Number(n.knownLength):Buffer.isBuffer(r)?t=r.length:typeof r=="string"&&(t=Buffer.byteLength(r)),this._valueLength+=t,this._overheadLength+=Buffer.byteLength(e)+X.LINE_BREAK.length,!(!r||!r.path&&!(r.readable&&He(r,"httpVersion"))&&!(r instanceof sm))&&(n.knownLength||this._valuesToMeasure.push(r))};X.prototype._lengthRetriever=function(e,r){He(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?r(null,e.end+1-(e.start?e.start:0)):am.stat(e.path,function(n,t){if(n){r(n);return}var i=t.size-(e.start?e.start:0);r(null,i)}):He(e,"httpVersion")?r(null,Number(e.headers["content-length"])):He(e,"httpModule")?(e.on("response",function(n){e.pause(),r(null,Number(n.headers["content-length"]))}),e.resume()):r("Unknown stream")};X.prototype._multiPartHeader=function(e,r,n){if(typeof n.header=="string")return n.header;var t=this._getContentDisposition(r,n),i=this._getContentType(r,n),c="",u={"Content-Disposition":["form-data",'name="'+lu(e)+'"'].concat(t||[]),"Content-Type":[].concat(i||[])};typeof n.header=="object"&&Vn(u,n.header);var s;for(var p in u)if(He(u,p)){if(s=u[p],s==null)continue;Array.isArray(s)||(s=[s]),s.length&&(c+=p+": "+s.join("; ")+X.LINE_BREAK)}return"--"+this.getBoundary()+X.LINE_BREAK+c+X.LINE_BREAK};X.prototype._getContentDisposition=function(e,r){var n;if(typeof r.filepath=="string"?n=qn.normalize(r.filepath).replace(/\\/g,"/"):r.filename||e&&(e.name||e.path)?n=qn.basename(r.filename||e&&(e.name||e.path)):e&&e.readable&&He(e,"httpVersion")&&(n=qn.basename(e.client._httpMessage.path||"")),n)return'filename="'+lu(n)+'"'};X.prototype._getContentType=function(e,r){var n=r.contentType;return!n&&e&&e.name&&(n=Bn.lookup(e.name)),!n&&e&&e.path&&(n=Bn.lookup(e.path)),!n&&e&&e.readable&&He(e,"httpVersion")&&(n=e.headers["content-type"]),!n&&(r.filepath||r.filename)&&(n=Bn.lookup(r.filepath||r.filename)),!n&&e&&typeof e=="object"&&(n=X.DEFAULT_CONTENT_TYPE),n};X.prototype._multiPartFooter=function(){return function(e){var r=X.LINE_BREAK,n=this._streams.length===0;n&&(r+=this._lastBoundary()),e(r)}.bind(this)};X.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+X.LINE_BREAK};X.prototype.getHeaders=function(e){var r,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(r in e)He(e,r)&&(n[r.toLowerCase()]=e[r]);return n};X.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};X.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};X.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),r=this.getBoundary(),n=0,t=this._streams.length;n<t;n++)typeof this._streams[n]!="function"&&(Buffer.isBuffer(this._streams[n])?e=Buffer.concat([e,this._streams[n]]):e=Buffer.concat([e,Buffer.from(this._streams[n])]),(typeof this._streams[n]!="string"||this._streams[n].substring(2,r.length+2)!==r)&&(e=Buffer.concat([e,Buffer.from(X.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};X.prototype._generateBoundary=function(){this._boundary="--------------------------"+um.randomBytes(12).toString("hex")};X.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e};X.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};X.prototype.getLength=function(e){var r=this._overheadLength+this._valueLength;if(this._streams.length&&(r+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(e.bind(this,null,r));return}cm.parallel(this._valuesToMeasure,this._lengthRetriever,function(n,t){if(n){e(n);return}t.forEach(function(i){r+=i}),e(null,r)})};X.prototype.submit=function(e,r){var n,t,i={method:"post"};return typeof e=="string"?(e=om(e),t=Vn({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},i)):(t=Vn(e,i),t.port||(t.port=t.protocol==="https:"?443:80)),t.headers=this.getHeaders(e.headers),t.protocol==="https:"?n=im.request(t):n=nm.request(t),this.getLength(function(c,u){if(c&&c!=="Unknown stream"){this._error(c);return}if(u&&n.setHeader("Content-Length",u),this.pipe(n),r){var s,p=o(function(m,f){return n.removeListener("error",p),n.removeListener("response",s),r.call(this,m,f)},"callback");s=p.bind(this,null),n.on("error",p),n.on("response",s)}}.bind(this)),n};X.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};X.prototype.toString=function(){return"[object FormData]"};lm(X.prototype,"FormData");du.exports=X});var bt=z((Gn,Wn)=>{(function(e,r){typeof Gn=="object"&&typeof Wn<"u"?Wn.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=r()})(Gn,function(){"use strict";var e=1e3,r=6e4,n=36e5,t="millisecond",i="second",c="minute",u="hour",s="day",p="week",m="month",f="quarter",A="year",x="date",d="Invalid Date",_=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(F){var $=["th","st","nd","rd"],I=F%100;return"["+F+($[(I-20)%10]||$[I]||$[0])+"]"},"ordinal")},T=o(function(F,$,I){var E=String(F);return!E||E.length>=$?F:""+Array($+1-E.length).join(I)+F},"m"),S={s:T,z:o(function(F){var $=-F.utcOffset(),I=Math.abs($),E=Math.floor(I/60),w=I%60;return($<=0?"+":"-")+T(E,2,"0")+":"+T(w,2,"0")},"z"),m:o(function F($,I){if($.date()<I.date())return-F(I,$);var E=12*(I.year()-$.year())+(I.month()-$.month()),w=$.clone().add(E,m),Z=I-w<0,H=$.clone().add(E+(Z?-1:1),m);return+(-(E+(I-w)/(Z?w-H:H-w))||0)},"t"),a:o(function(F){return F<0?Math.ceil(F)||0:Math.floor(F)},"a"),p:o(function(F){return{M:m,y:A,w:p,d:s,D:x,h:u,m:c,s:i,ms:t,Q:f}[F]||String(F||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(F){return F===void 0},"u")},V="en",ue={};ue[V]=b;var ye=o(function(F){return F instanceof et},"p"),Ee=o(function F($,I,E){var w;if(!$)return V;if(typeof $=="string"){var Z=$.toLowerCase();ue[Z]&&(w=Z),I&&(ue[Z]=I,w=Z);var H=$.split("-");if(!w&&H.length>1)return F(H[0])}else{var re=$.name;ue[re]=$,w=re}return!E&&w&&(V=w),w||!E&&V},"t"),te=o(function(F,$){if(ye(F))return F.clone();var I=typeof $=="object"?$:{};return I.date=F,I.args=arguments,new et(I)},"w"),K=S;K.l=Ee,K.i=ye,K.w=function(F,$){return te(F,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var et=function(){function F(I){this.$L=Ee(I.locale,null,!0),this.parse(I)}o(F,"M");var $=F.prototype;return $.parse=function(I){this.$d=function(E){var w=E.date,Z=E.utc;if(w===null)return new Date(NaN);if(K.u(w))return new Date;if(w instanceof Date)return new Date(w);if(typeof w=="string"&&!/Z$/i.test(w)){var H=w.match(_);if(H){var re=H[2]-1||0,ce=(H[7]||"0").substring(0,3);return Z?new Date(Date.UTC(H[1],re,H[3]||1,H[4]||0,H[5]||0,H[6]||0,ce)):new Date(H[1],re,H[3]||1,H[4]||0,H[5]||0,H[6]||0,ce)}}return new Date(w)}(I),this.$x=I.x||{},this.init()},$.init=function(){var I=this.$d;this.$y=I.getFullYear(),this.$M=I.getMonth(),this.$D=I.getDate(),this.$W=I.getDay(),this.$H=I.getHours(),this.$m=I.getMinutes(),this.$s=I.getSeconds(),this.$ms=I.getMilliseconds()},$.$utils=function(){return K},$.isValid=function(){return this.$d.toString()!==d},$.isSame=function(I,E){var w=te(I);return this.startOf(E)<=w&&w<=this.endOf(E)},$.isAfter=function(I,E){return te(I)<this.startOf(E)},$.isBefore=function(I,E){return this.endOf(E)<te(I)},$.$g=function(I,E,w){return K.u(I)?this[E]:this.set(w,I)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(I,E){var w=this,Z=!!K.u(E)||E,H=K.p(I),re=o(function(Ke,_e){var Le=K.w(w.$u?Date.UTC(w.$y,_e,Ke):new Date(w.$y,_e,Ke),w);return Z?Le:Le.endOf(s)},"l"),ce=o(function(Ke,_e){return K.w(w.toDate()[Ke].apply(w.toDate("s"),(Z?[0,0,0,0]:[23,59,59,999]).slice(_e)),w)},"$"),pe=this.$W,ge=this.$M,Se=this.$D,tt="set"+(this.$u?"UTC":"");switch(H){case A:return Z?re(1,0):re(31,11);case m:return Z?re(1,ge):re(0,ge+1);case p:var We=this.$locale().weekStart||0,xt=(pe<We?pe+7:pe)-We;return re(Z?Se-xt:Se+(6-xt),ge);case s:case x:return ce(tt+"Hours",0);case u:return ce(tt+"Minutes",1);case c:return ce(tt+"Seconds",2);case i:return ce(tt+"Milliseconds",3);default:return this.clone()}},$.endOf=function(I){return this.startOf(I,!1)},$.$set=function(I,E){var w,Z=K.p(I),H="set"+(this.$u?"UTC":""),re=(w={},w[s]=H+"Date",w[x]=H+"Date",w[m]=H+"Month",w[A]=H+"FullYear",w[u]=H+"Hours",w[c]=H+"Minutes",w[i]=H+"Seconds",w[t]=H+"Milliseconds",w)[Z],ce=Z===s?this.$D+(E-this.$W):E;if(Z===m||Z===A){var pe=this.clone().set(x,1);pe.$d[re](ce),pe.init(),this.$d=pe.set(x,Math.min(this.$D,pe.daysInMonth())).$d}else re&&this.$d[re](ce);return this.init(),this},$.set=function(I,E){return this.clone().$set(I,E)},$.get=function(I){return this[K.p(I)]()},$.add=function(I,E){var w,Z=this;I=Number(I);var H=K.p(E),re=o(function(ge){var Se=te(Z);return K.w(Se.date(Se.date()+Math.round(ge*I)),Z)},"y");if(H===m)return this.set(m,this.$M+I);if(H===A)return this.set(A,this.$y+I);if(H===s)return re(1);if(H===p)return re(7);var ce=(w={},w[c]=r,w[u]=n,w[i]=e,w)[H]||1,pe=this.$d.getTime()+I*ce;return K.w(pe,this)},$.subtract=function(I,E){return this.add(-1*I,E)},$.format=function(I){var E=this,w=this.$locale();if(!this.isValid())return w.invalidDate||d;var Z=I||"YYYY-MM-DDTHH:mm:ssZ",H=K.z(this),re=this.$H,ce=this.$m,pe=this.$M,ge=w.weekdays,Se=w.months,tt=w.meridiem,We=o(function(_e,Le,Pt,Wt){return _e&&(_e[Le]||_e(E,Z))||Pt[Le].slice(0,Wt)},"h"),xt=o(function(_e){return K.s(re%12||12,_e,"0")},"d"),Ke=tt||function(_e,Le,Pt){var Wt=_e<12?"AM":"PM";return Pt?Wt.toLowerCase():Wt};return Z.replace(v,function(_e,Le){return Le||function(Pt){switch(Pt){case"YY":return String(E.$y).slice(-2);case"YYYY":return K.s(E.$y,4,"0");case"M":return pe+1;case"MM":return K.s(pe+1,2,"0");case"MMM":return We(w.monthsShort,pe,Se,3);case"MMMM":return We(Se,pe);case"D":return E.$D;case"DD":return K.s(E.$D,2,"0");case"d":return String(E.$W);case"dd":return We(w.weekdaysMin,E.$W,ge,2);case"ddd":return We(w.weekdaysShort,E.$W,ge,3);case"dddd":return ge[E.$W];case"H":return String(re);case"HH":return K.s(re,2,"0");case"h":return xt(1);case"hh":return xt(2);case"a":return Ke(re,ce,!0);case"A":return Ke(re,ce,!1);case"m":return String(ce);case"mm":return K.s(ce,2,"0");case"s":return String(E.$s);case"ss":return K.s(E.$s,2,"0");case"SSS":return K.s(E.$ms,3,"0");case"Z":return H}return null}(_e)||H.replace(":","")})},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(I,E,w){var Z,H=this,re=K.p(E),ce=te(I),pe=(ce.utcOffset()-this.utcOffset())*r,ge=this-ce,Se=o(function(){return K.m(H,ce)},"D");switch(re){case A:Z=Se()/12;break;case m:Z=Se();break;case f:Z=Se()/3;break;case p:Z=(ge-pe)/6048e5;break;case s:Z=(ge-pe)/864e5;break;case u:Z=ge/n;break;case c:Z=ge/r;break;case i:Z=ge/e;break;default:Z=ge}return w?Z:K.a(Z)},$.daysInMonth=function(){return this.endOf(m).$D},$.$locale=function(){return ue[this.$L]},$.locale=function(I,E){if(!I)return this.$L;var w=this.clone(),Z=Ee(I,E,!0);return Z&&(w.$L=Z),w},$.clone=function(){return K.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},F}(),Ge=et.prototype;return te.prototype=Ge,[["$ms",t],["$s",i],["$m",c],["$H",u],["$W",s],["$M",m],["$y",A],["$D",x]].forEach(function(F){Ge[F[1]]=function($){return this.$g($,F[0],F[1])}}),te.extend=function(F,$){return F.$i||(F($,et,te),F.$i=!0),te},te.locale=Ee,te.isDayjs=ye,te.unix=function(F){return te(1e3*F)},te.en=ue[V],te.Ls=ue,te.p={},te})});var xm={};Kn(xm,{bexio:()=>vm});module.exports=Ju(xm);var Yu=Object.freeze({status:"aborted"});function k(e,r,n){function t(s,p){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:p,constr:u,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),r(s,p);let m=u.prototype,f=Object.keys(m);for(let A=0;A<f.length;A++){let x=f[A];x in s||(s[x]=m[x].bind(s))}}o(t,"init");let i=n?.Parent??Object;class c extends i{static{o(this,"Definition")}}Object.defineProperty(c,"name",{value:e});function u(s){var p;let m=n?.Parent?new c:this;t(m,s),(p=m._zod).deferred??(p.deferred=[]);for(let f of m._zod.deferred)f();return m}return o(u,"_"),Object.defineProperty(u,"init",{value:t}),Object.defineProperty(u,Symbol.hasInstance,{value:o(s=>n?.Parent&&s instanceof n.Parent?!0:s?._zod?.traits?.has(e),"value")}),Object.defineProperty(u,"name",{value:e}),u}o(k,"$constructor");var Xu=Symbol("zod_brand"),ke=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Kt=class extends Error{static{o(this,"$ZodEncodeError")}constructor(r){super(`Encountered unidirectional transform during encode: ${r}`),this.name="ZodEncodeError"}},jr={};function De(e){return e&&Object.assign(jr,e),jr}o(De,"config");function qr(e){let r=Object.values(e).filter(t=>typeof t=="number");return Object.entries(e).filter(([t,i])=>r.indexOf(+t)===-1).map(([t,i])=>i)}o(qr,"getEnumValues");function Xn(e,r){return typeof r=="bigint"?r.toString():r}o(Xn,"jsonStringifyReplacer");function Yt(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}o(Yt,"cached");function Qn(e){return e==null}o(Qn,"nullish");function Xt(e){let r=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(r,n)}o(Xt,"cleanRegex");var Yn=Symbol("evaluating");function le(e,r,n){let t;Object.defineProperty(e,r,{get(){if(t!==Yn)return t===void 0&&(t=Yn,t=n()),t},set(i){Object.defineProperty(e,r,{value:i})},configurable:!0})}o(le,"defineLazy");var Br="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function St(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(St,"isObject");var Qu=Yt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ei(e){if(St(e)===!1)return!1;let r=e.constructor;if(r===void 0||typeof r!="function")return!0;let n=r.prototype;return!(St(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}o(ei,"isPlainObject");var ti=new Set(["string","number","symbol"]);function rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(rt,"escapeRegex");function Qt(e,r,n){let t=new e._zod.constr(r??e._zod.def);return(!r||n?.parent)&&(t._zod.parent=e),t}o(Qt,"clone");function ie(e){let r=e;if(!r)return{};if(typeof r=="string")return{error:o(()=>r,"error")};if(r?.message!==void 0){if(r?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");r.error=r.message}return delete r.message,typeof r.error=="string"?{...r,error:o(()=>r.error,"error")}:r}o(ie,"normalizeParams");function ri(e){return Object.keys(e).filter(r=>e[r]._zod.optin==="optional"&&e[r]._zod.optout==="optional")}o(ri,"optionalKeys");var ec={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function nt(e,r=0){if(e.aborted===!0)return!0;for(let n=r;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}o(nt,"aborted");function je(e,r){return r.map(n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n})}o(je,"prefixIssues");function Jt(e){return typeof e=="string"?e:e?.message}o(Jt,"unwrapMessage");function Fe(e,r,n){let t={...e,path:e.path??[]};if(!e.message){let i=Jt(e.inst?._zod.def?.error?.(e))??Jt(r?.error?.(e))??Jt(n.customError?.(e))??Jt(n.localeError?.(e))??"Invalid input";t.message=i}return delete t.inst,delete t.continue,r?.reportInput||delete t.input,t}o(Fe,"finalizeIssue");function ni(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(ni,"getLengthableOrigin");function Vr(...e){let[r,n,t]=e;return typeof r=="string"?{message:r,code:"custom",input:n,inst:t}:{...r}}o(Vr,"issue");var ii=o((e,r)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:r,enumerable:!1}),e.message=JSON.stringify(r,Xn,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),oi=k("$ZodError",ii),At=k("$ZodError",ii,{Parent:Error});var rc=o(e=>(r,n,t,i)=>{let c=t?Object.assign(t,{async:!1}):{async:!1},u=r._zod.run({value:n,issues:[]},c);if(u instanceof Promise)throw new ke;if(u.issues.length){let s=new(i?.Err??e)(u.issues.map(p=>Fe(p,c,De())));throw Br(s,i?.callee),s}return u.value},"_parse"),er=rc(At),nc=o(e=>async(r,n,t,i)=>{let c=t?Object.assign(t,{async:!0}):{async:!0},u=r._zod.run({value:n,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){let s=new(i?.Err??e)(u.issues.map(p=>Fe(p,c,De())));throw Br(s,i?.callee),s}return u.value},"_parseAsync"),tr=nc(At),ic=o(e=>(r,n,t)=>{let i=t?{...t,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},i);if(c instanceof Promise)throw new ke;return c.issues.length?{success:!1,error:new(e??oi)(c.issues.map(u=>Fe(u,i,De())))}:{success:!0,data:c.value}},"_safeParse"),It=ic(At),oc=o(e=>async(r,n,t)=>{let i=t?Object.assign(t,{async:!0}):{async:!0},c=r._zod.run({value:n,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(u=>Fe(u,i,De())))}:{success:!0,data:c.value}},"_safeParseAsync"),$t=oc(At);var ac="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",sc=new RegExp(`^${ac}$`);var ai=o(e=>{let r=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${r}$`)},"string"),si=/^-?\d+n?$/;var Zr=/^-?\d+(?:\.\d+)?$/,ui=/^(?:true|false)$/i;var it=k("$ZodCheck",(e,r)=>{var n;e._zod??(e._zod={}),e._zod.def=r,(n=e._zod).onattach??(n.onattach=[])});var ci=k("$ZodCheckMinLength",(e,r)=>{var n;it.init(e,r),(n=e._zod.def).when??(n.when=t=>{let i=t.value;return!Qn(i)&&i.length!==void 0}),e._zod.onattach.push(t=>{let i=t._zod.bag.minimum??Number.NEGATIVE_INFINITY;r.minimum>i&&(t._zod.bag.minimum=r.minimum)}),e._zod.check=t=>{let i=t.value;if(i.length>=r.minimum)return;let u=ni(i);t.issues.push({origin:u,code:"too_small",minimum:r.minimum,inclusive:!0,input:i,inst:e,continue:!r.abort})}});var Hr=k("$ZodCheckStringFormat",(e,r)=>{var n,t;it.init(e,r),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=r.format,r.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(r.pattern))}),r.pattern?(n=e._zod).check??(n.check=i=>{r.pattern.lastIndex=0,!r.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:r.format,input:i.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:e,continue:!r.abort})}):(t=e._zod).check??(t.check=()=>{})}),li=k("$ZodCheckRegex",(e,r)=>{Hr.init(e,r),e._zod.check=n=>{r.pattern.lastIndex=0,!r.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:r.pattern.toString(),inst:e,continue:!r.abort})}});var pi={major:4,minor:3,patch:6};var oe=k("$ZodType",(e,r)=>{var n;e??(e={}),e._zod.def=r,e._zod.bag=e._zod.bag||{},e._zod.version=pi;let t=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&t.unshift(e);for(let i of t)for(let c of i._zod.onattach)c(e);if(t.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=o((u,s,p)=>{let m=nt(u),f;for(let A of s){if(A._zod.def.when){if(!A._zod.def.when(u))continue}else if(m)continue;let x=u.issues.length,d=A._zod.check(u);if(d instanceof Promise&&p?.async===!1)throw new ke;if(f||d instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await d,u.issues.length!==x&&(m||(m=nt(u,x)))});else{if(u.issues.length===x)continue;m||(m=nt(u,x))}}return f?f.then(()=>u):u},"runChecks"),c=o((u,s,p)=>{if(nt(u))return u.aborted=!0,u;let m=i(s,t,p);if(m instanceof Promise){if(p.async===!1)throw new ke;return m.then(f=>e._zod.parse(f,p))}return e._zod.parse(m,p)},"handleCanaryResult");e._zod.run=(u,s)=>{if(s.skipChecks)return e._zod.parse(u,s);if(s.direction==="backward"){let m=e._zod.parse({value:u.value,issues:[]},{...s,skipChecks:!0});return m instanceof Promise?m.then(f=>c(f,u,s)):c(m,u,s)}let p=e._zod.parse(u,s);if(p instanceof Promise){if(s.async===!1)throw new ke;return p.then(m=>i(m,t,s))}return i(p,t,s)}}le(e,"~standard",()=>({validate:o(i=>{try{let c=It(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return $t(e,i).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},"validate"),vendor:"zod",version:1}))}),ir=k("$ZodString",(e,r)=>{oe.init(e,r),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ai(e._zod.bag),e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Gr=k("$ZodStringFormat",(e,r)=>{Hr.init(e,r),ir.init(e,r)});var hi=k("$ZodURL",(e,r)=>{Gr.init(e,r),e._zod.check=n=>{try{let t=n.value.trim(),i=new URL(t);r.hostname&&(r.hostname.lastIndex=0,r.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:n.value,inst:e,continue:!r.abort})),r.protocol&&(r.protocol.lastIndex=0,r.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:n.value,inst:e,continue:!r.abort})),r.normalize?n.value=i.href:n.value=t;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!r.abort})}}});var _i=k("$ZodNumber",(e,r)=>{oe.init(e,r),e._zod.pattern=e._zod.bag.pattern??Zr,e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;let c=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...c?{received:c}:{}}),n}});var Wr=k("$ZodBoolean",(e,r)=>{oe.init(e,r),e._zod.pattern=ui,e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),bi=k("$ZodBigInt",(e,r)=>{oe.init(e,r),e._zod.pattern=si,e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}});var vi=k("$ZodAny",(e,r)=>{oe.init(e,r),e._zod.parse=n=>n}),xi=k("$ZodUnknown",(e,r)=>{oe.init(e,r),e._zod.parse=n=>n});var Pi=k("$ZodVoid",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{let i=n.value;return typeof i>"u"||n.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),n}}),Ti=k("$ZodDate",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,c=i instanceof Date;return c&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...c?{received:"Invalid Date"}:{},inst:e}),n}});function mi(e,r,n){e.issues.length&&r.issues.push(...je(n,e.issues)),r.value[n]=e.value}o(mi,"handleArrayResult");var Si=k("$ZodArray",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);let c=[];for(let u=0;u<i.length;u++){let s=i[u],p=r.element._zod.run({value:s,issues:[]},t);p instanceof Promise?c.push(p.then(m=>mi(m,n,u))):mi(p,n,u)}return c.length?Promise.all(c).then(()=>n):n}});function nr(e,r,n,t,i){if(e.issues.length){if(i&&!(n in t))return;r.issues.push(...je(n,e.issues))}e.value===void 0?n in t&&(r.value[n]=void 0):r.value[n]=e.value}o(nr,"handlePropertyResult");function uc(e){let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${t}": expected a Zod schema`);let n=ri(e.shape);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(n)}}o(uc,"normalizeDef");function cc(e,r,n,t,i,c){let u=[],s=i.keySet,p=i.catchall._zod,m=p.def.type,f=p.optout==="optional";for(let A in r){if(s.has(A))continue;if(m==="never"){u.push(A);continue}let x=p.run({value:r[A],issues:[]},t);x instanceof Promise?e.push(x.then(d=>nr(d,n,A,r,f))):nr(x,n,A,r,f)}return u.length&&n.issues.push({code:"unrecognized_keys",keys:u,input:r,inst:c}),e.length?Promise.all(e).then(()=>n):n}o(cc,"handleCatchall");var Ai=k("$ZodObject",(e,r)=>{if(oe.init(e,r),!Object.getOwnPropertyDescriptor(r,"shape")?.get){let s=r.shape;Object.defineProperty(r,"shape",{get:o(()=>{let p={...s};return Object.defineProperty(r,"shape",{value:p}),p},"get")})}let t=Yt(()=>uc(r));le(e._zod,"propValues",()=>{let s=r.shape,p={};for(let m in s){let f=s[m]._zod;if(f.values){p[m]??(p[m]=new Set);for(let A of f.values)p[m].add(A)}}return p});let i=St,c=r.catchall,u;e._zod.parse=(s,p)=>{u??(u=t.value);let m=s.value;if(!i(m))return s.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),s;s.value={};let f=[],A=u.shape;for(let x of u.keys){let d=A[x],_=d._zod.optout==="optional",v=d._zod.run({value:m[x],issues:[]},p);v instanceof Promise?f.push(v.then(b=>nr(b,s,x,m,_))):nr(v,s,x,m,_)}return c?cc(f,m,s,p,t.value,e):f.length?Promise.all(f).then(()=>s):s}});function fi(e,r,n,t){for(let c of e)if(c.issues.length===0)return r.value=c.value,r;let i=e.filter(c=>!nt(c));return i.length===1?(r.value=i[0].value,i[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:n,errors:e.map(c=>c.issues.map(u=>Fe(u,t,De())))}),r)}o(fi,"handleUnionResults");var Kr=k("$ZodUnion",(e,r)=>{oe.init(e,r),le(e._zod,"optin",()=>r.options.some(i=>i._zod.optin==="optional")?"optional":void 0),le(e._zod,"optout",()=>r.options.some(i=>i._zod.optout==="optional")?"optional":void 0),le(e._zod,"values",()=>{if(r.options.every(i=>i._zod.values))return new Set(r.options.flatMap(i=>Array.from(i._zod.values)))}),le(e._zod,"pattern",()=>{if(r.options.every(i=>i._zod.pattern)){let i=r.options.map(c=>c._zod.pattern);return new RegExp(`^(${i.map(c=>Xt(c.source)).join("|")})$`)}});let n=r.options.length===1,t=r.options[0]._zod.run;e._zod.parse=(i,c)=>{if(n)return t(i,c);let u=!1,s=[];for(let p of r.options){let m=p._zod.run({value:i.value,issues:[]},c);if(m instanceof Promise)s.push(m),u=!0;else{if(m.issues.length===0)return m;s.push(m)}}return u?Promise.all(s).then(p=>fi(p,i,e,c)):fi(s,i,e,c)}});var Ii=k("$ZodDiscriminatedUnion",(e,r)=>{r.inclusive=!1,Kr.init(e,r);let n=e._zod.parse;le(e._zod,"propValues",()=>{let i={};for(let c of r.options){let u=c._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${r.options.indexOf(c)}"`);for(let[s,p]of Object.entries(u)){i[s]||(i[s]=new Set);for(let m of p)i[s].add(m)}}return i});let t=Yt(()=>{let i=r.options,c=new Map;for(let u of i){let s=u._zod.propValues?.[r.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${r.options.indexOf(u)}"`);for(let p of s){if(c.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);c.set(p,u)}}return c});e._zod.parse=(i,c)=>{let u=i.value;if(!St(u))return i.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),i;let s=t.value.get(u?.[r.discriminator]);return s?s._zod.run(i,c):r.unionFallback?n(i,c):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,input:u,path:[r.discriminator],inst:e}),i)}});var $i=k("$ZodRecord",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{let i=n.value;if(!ei(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let c=[],u=r.keyType._zod.values;if(u){n.value={};let s=new Set;for(let m of u)if(typeof m=="string"||typeof m=="number"||typeof m=="symbol"){s.add(typeof m=="number"?m.toString():m);let f=r.valueType._zod.run({value:i[m],issues:[]},t);f instanceof Promise?c.push(f.then(A=>{A.issues.length&&n.issues.push(...je(m,A.issues)),n.value[m]=A.value})):(f.issues.length&&n.issues.push(...je(m,f.issues)),n.value[m]=f.value)}let p;for(let m in i)s.has(m)||(p=p??[],p.push(m));p&&p.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:p})}else{n.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let p=r.keyType._zod.run({value:s,issues:[]},t);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Zr.test(s)&&p.issues.length){let A=r.keyType._zod.run({value:Number(s),issues:[]},t);if(A instanceof Promise)throw new Error("Async schemas not supported in object keys currently");A.issues.length===0&&(p=A)}if(p.issues.length){r.mode==="loose"?n.value[s]=i[s]:n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(A=>Fe(A,t,De())),input:s,path:[s],inst:e});continue}let f=r.valueType._zod.run({value:i[s],issues:[]},t);f instanceof Promise?c.push(f.then(A=>{A.issues.length&&n.issues.push(...je(s,A.issues)),n.value[p.value]=A.value})):(f.issues.length&&n.issues.push(...je(s,f.issues)),n.value[p.value]=f.value)}}return c.length?Promise.all(c).then(()=>n):n}});var wi=k("$ZodEnum",(e,r)=>{oe.init(e,r);let n=qr(r.entries),t=new Set(n);e._zod.values=t,e._zod.pattern=new RegExp(`^(${n.filter(i=>ti.has(typeof i)).map(i=>typeof i=="string"?rt(i):i.toString()).join("|")})$`),e._zod.parse=(i,c)=>{let u=i.value;return t.has(u)||i.issues.push({code:"invalid_value",values:n,input:u,inst:e}),i}}),Ei=k("$ZodLiteral",(e,r)=>{if(oe.init(e,r),r.values.length===0)throw new Error("Cannot create literal schema with no valid values");let n=new Set(r.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.values.map(t=>typeof t=="string"?rt(t):t?rt(t.toString()):String(t)).join("|")})$`),e._zod.parse=(t,i)=>{let c=t.value;return n.has(c)||t.issues.push({code:"invalid_value",values:r.values,input:c,inst:e}),t}});var ki=k("$ZodTransform",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{if(t.direction==="backward")throw new Kt(e.constructor.name);let i=r.transform(n.value,n);if(t.async)return(i instanceof Promise?i:Promise.resolve(i)).then(u=>(n.value=u,n));if(i instanceof Promise)throw new ke;return n.value=i,n}});function gi(e,r){return e.issues.length&&r===void 0?{issues:[],value:void 0}:e}o(gi,"handleOptionalResult");var Ni=k("$ZodOptional",(e,r)=>{oe.init(e,r),e._zod.optin="optional",e._zod.optout="optional",le(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,void 0]):void 0),le(e._zod,"pattern",()=>{let n=r.innerType._zod.pattern;return n?new RegExp(`^(${Xt(n.source)})?$`):void 0}),e._zod.parse=(n,t)=>{if(r.innerType._zod.optin==="optional"){let i=r.innerType._zod.run(n,t);return i instanceof Promise?i.then(c=>gi(c,n.value)):gi(i,n.value)}return n.value===void 0?n:r.innerType._zod.run(n,t)}});var zi=k("$ZodNullable",(e,r)=>{oe.init(e,r),le(e._zod,"optin",()=>r.innerType._zod.optin),le(e._zod,"optout",()=>r.innerType._zod.optout),le(e._zod,"pattern",()=>{let n=r.innerType._zod.pattern;return n?new RegExp(`^(${Xt(n.source)}|null)$`):void 0}),le(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,null]):void 0),e._zod.parse=(n,t)=>n.value===null?n:r.innerType._zod.run(n,t)});var Di=k("$ZodPipe",(e,r)=>{oe.init(e,r),le(e._zod,"values",()=>r.in._zod.values),le(e._zod,"optin",()=>r.in._zod.optin),le(e._zod,"optout",()=>r.out._zod.optout),le(e._zod,"propValues",()=>r.in._zod.propValues),e._zod.parse=(n,t)=>{if(t.direction==="backward"){let c=r.out._zod.run(n,t);return c instanceof Promise?c.then(u=>rr(u,r.in,t)):rr(c,r.in,t)}let i=r.in._zod.run(n,t);return i instanceof Promise?i.then(c=>rr(c,r.out,t)):rr(i,r.out,t)}});function rr(e,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:e.value,issues:e.issues},n)}o(rr,"handlePipeResult");var Oi=k("$ZodCustom",(e,r)=>{it.init(e,r),oe.init(e,r),e._zod.parse=(n,t)=>n,e._zod.check=n=>{let t=n.value,i=r.fn(t);if(i instanceof Promise)return i.then(c=>yi(c,n,t,e));yi(i,n,t,e)}});function yi(e,r,n,t){if(!e){let i={code:"custom",input:n,inst:t,path:[...t._zod.def.path??[]],continue:!t._zod.def.abort};t._zod.def.params&&(i.params=t._zod.def.params),r.issues.push(Vr(i))}}o(yi,"handleRefineResult");var Ri,mc=Symbol("ZodOutput"),fc=Symbol("ZodInput"),Jr=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(r,...n){let t=n[0];return this._map.set(r,t),t&&typeof t=="object"&&"id"in t&&this._idmap.set(t.id,r),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(r){let n=this._map.get(r);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(r),this}get(r){let n=r._zod.parent;if(n){let t={...this.get(n)??{}};delete t.id;let i={...t,...this._map.get(r)};return Object.keys(i).length?i:void 0}return this._map.get(r)}has(r){return this._map.has(r)}};function Ui(){return new Jr}o(Ui,"registry");(Ri=globalThis).__zod_globalRegistry??(Ri.__zod_globalRegistry=Ui());var Yr=globalThis.__zod_globalRegistry;function Mi(e,r){return new e({type:"string",...ie(r)})}o(Mi,"_string");function Li(e,r){return new e({type:"string",coerce:!0,...ie(r)})}o(Li,"_coercedString");function ji(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ie(r)})}o(ji,"_url");function Fi(e,r){return new e({type:"number",checks:[],...ie(r)})}o(Fi,"_number");function qi(e,r){return new e({type:"number",coerce:!0,checks:[],...ie(r)})}o(qi,"_coercedNumber");function Bi(e,r){return new e({type:"boolean",...ie(r)})}o(Bi,"_boolean");function Vi(e,r){return new e({type:"boolean",coerce:!0,...ie(r)})}o(Vi,"_coercedBoolean");function Zi(e,r){return new e({type:"bigint",coerce:!0,...ie(r)})}o(Zi,"_coercedBigint");function Hi(e){return new e({type:"any"})}o(Hi,"_any");function Gi(e){return new e({type:"unknown"})}o(Gi,"_unknown");function Wi(e,r){return new e({type:"void",...ie(r)})}o(Wi,"_void");function Ki(e,r){return new e({type:"date",coerce:!0,...ie(r)})}o(Ki,"_coercedDate");function $e(e,r){return new ci({check:"min_length",...ie(r),minimum:e})}o($e,"_minLength");function qe(e,r){return new li({check:"string_format",format:"regex",...ie(r),pattern:e})}o(qe,"_regex");function Ji(e,r,n){let t=ie(n);return t.abort??(t.abort=!0),new e({type:"custom",check:"custom",fn:r,...t})}o(Ji,"_custom");var de=k("ZodMiniType",(e,r)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");oe.init(e,r),e.def=r,e.type=r.type,e.parse=(n,t)=>er(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>It(e,n,t),e.parseAsync=async(n,t)=>tr(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>$t(e,n,t),e.check=(...n)=>e.clone({...r,checks:[...r.checks??[],...n.map(t=>typeof t=="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]},{parent:!0}),e.with=e.check,e.clone=(n,t)=>Qt(e,n,t),e.brand=()=>e,e.register=(n,t)=>(n.add(e,t),e),e.apply=n=>n(e)}),ar=k("ZodMiniString",(e,r)=>{ir.init(e,r),de.init(e,r)});function l(e){return Mi(ar,e)}o(l,"string");var Yi=k("ZodMiniStringFormat",(e,r)=>{Gr.init(e,r),ar.init(e,r)});var Sc=k("ZodMiniURL",(e,r)=>{hi.init(e,r),Yi.init(e,r)});function Xi(e){return ji(Sc,e)}o(Xi,"url");var Xr=k("ZodMiniNumber",(e,r)=>{_i.init(e,r),de.init(e,r)});function he(e){return Fi(Xr,e)}o(he,"number");var Qr=k("ZodMiniBoolean",(e,r)=>{Wr.init(e,r),de.init(e,r)});function ee(e){return Bi(Qr,e)}o(ee,"boolean");var Qi=k("ZodMiniBigInt",(e,r)=>{bi.init(e,r),de.init(e,r)});var Ac=k("ZodMiniAny",(e,r)=>{vi.init(e,r),de.init(e,r)});function Et(){return Hi(Ac)}o(Et,"any");var Ic=k("ZodMiniUnknown",(e,r)=>{xi.init(e,r),de.init(e,r)});function M(){return Gi(Ic)}o(M,"unknown");var $c=k("ZodMiniVoid",(e,r)=>{Pi.init(e,r),de.init(e,r)});function eo(e){return Wi($c,e)}o(eo,"_void");var to=k("ZodMiniDate",(e,r)=>{Ti.init(e,r),de.init(e,r)});var wc=k("ZodMiniArray",(e,r)=>{Si.init(e,r),de.init(e,r)});function q(e,r){return new wc({type:"array",element:e,...ie(r)})}o(q,"array");var Ec=k("ZodMiniObject",(e,r)=>{Ai.init(e,r),de.init(e,r),le(e,"shape",()=>r.shape)});function y(e,r){let n={type:"object",shape:e??{},...ie(r)};return new Ec(n)}o(y,"object");var kc=k("ZodMiniUnion",(e,r)=>{Kr.init(e,r),de.init(e,r)});function B(e,r){return new kc({type:"union",options:e,...ie(r)})}o(B,"union");var Nc=k("ZodMiniDiscriminatedUnion",(e,r)=>{Ii.init(e,r),de.init(e,r)});function ot(e,r,n){return new Nc({type:"union",options:r,discriminator:e,...ie(n)})}o(ot,"discriminatedUnion");var zc=k("ZodMiniRecord",(e,r)=>{$i.init(e,r),de.init(e,r)});function L(e,r,n){return new zc({type:"record",keyType:e,valueType:r,...ie(n)})}o(L,"record");var Dc=k("ZodMiniEnum",(e,r)=>{wi.init(e,r),de.init(e,r),e.options=Object.values(r.entries)});function W(e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(t=>[t,t])):e;return new Dc({type:"enum",entries:n,...ie(r)})}o(W,"_enum");var Oc=k("ZodMiniLiteral",(e,r)=>{Ei.init(e,r),de.init(e,r)});function D(e,r){return new Oc({type:"literal",values:Array.isArray(e)?e:[e],...ie(r)})}o(D,"literal");var Cc=k("ZodMiniTransform",(e,r)=>{ki.init(e,r),de.init(e,r)});function Be(e){return new Cc({type:"transform",transform:e})}o(Be,"transform");var Rc=k("ZodMiniOptional",(e,r)=>{Ni.init(e,r),de.init(e,r)});function P(e){return new Rc({type:"optional",innerType:e})}o(P,"optional");var Uc=k("ZodMiniNullable",(e,r)=>{zi.init(e,r),de.init(e,r)});function kt(e){return new Uc({type:"nullable",innerType:e})}o(kt,"nullable");var Mc=k("ZodMiniPipe",(e,r)=>{Di.init(e,r),de.init(e,r)});function Ve(e,r){return new Mc({type:"pipe",in:e,out:r})}o(Ve,"pipe");var Lc=k("ZodMiniCustom",(e,r)=>{Oi.init(e,r),de.init(e,r)});function sr(e,r){return Ji(Lc,e??(()=>!0),r)}o(sr,"custom");var Nt={};Kn(Nt,{bigint:()=>Hc,boolean:()=>Zc,date:()=>Gc,number:()=>Vc,string:()=>Bc});function Bc(e){return Li(ar,e)}o(Bc,"string");function Vc(e){return qi(Xr,e)}o(Vc,"number");function Zc(e){return Vi(Qr,e)}o(Zc,"boolean");function Hc(e){return Zi(Qi,e)}o(Hc,"bigint");function Gc(e){return Ki(to,e)}o(Gc,"date");var tn=y({retryOnFailure:y({defaultValue:P(ee()),hide:P(ee())}),continueOnFailure:y({defaultValue:P(ee()),hide:P(ee())})}),en=class{constructor(r,n,t,i,c,u,s,p,m,f,A){this.name=r;this.displayName=n;this.description=t;this.props=i;this.run=c;this.test=u;this.requireAuth=s;this.errorHandlingOptions=p;this.outputSchema=m;this.audience=f;this.aiMetadata=A}static{o(this,"IAction")}},O=o(e=>new en(e.name,e.displayName,e.description,e.props,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata),"createAction");var Q=y({displayName:l(),description:P(l())}),G=o((e,r)=>y({type:D(r),required:ee(),defaultValue:P(Et())}),"TPropertyValue");var Pe=y({...Q.shape,...G(l(),"SHORT_TEXT").shape}),Oe=y({...Q.shape,...G(l(),"LONG_TEXT").shape});var no=y({label:l(),value:M()}),ur=y({disabled:P(ee()),placeholder:P(l()),options:q(no)});var Te=y({...Q.shape,options:ur,...G(M(),"STATIC_DROPDOWN").shape}),Ce=y({...Q.shape,options:ur,...G(q(M()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var rn=y({...Q.shape,...G(M(),"DROPDOWN").shape,refreshers:q(l())}),zt=y({...Q.shape,...G(q(M()),"MULTI_SELECT_DROPDOWN").shape,refreshers:q(l())});var Re=y({...Q.shape,...G(ee(),"CHECKBOX").shape});var Ue=y({...Q.shape,...G(he(),"NUMBER").shape});var Dt=y({...Q.shape,...G(M(),"FILE").shape});var Ot=y({...Q.shape,...G(l(),"DATE_TIME").shape});var io=L(l(),B([Pe,Oe,Te,zt,Ce,Re,Ue,Dt,Ot])),Ct=y({...Q.shape,properties:io,...G(q(M()),"ARRAY").shape});var Rt=y({...Q.shape,...G(B([L(l(),M())]),"JSON").shape});var oo=B([Pe,Te,Rt,Ct,Ce]),Kc=L(l(),oo),nn=y({refreshers:q(l()),...Q.shape,...G(M(),"DYNAMIC").shape});var cr=y({...Q.shape,...G(eo(),"MARKDOWN").shape});var Ut=(n=>(n.ARCHIVE="ARCHIVE",n.REGISTRY="REGISTRY",n))(Ut||{}),at=(n=>(n.CUSTOM="CUSTOM",n.OFFICIAL="OFFICIAL",n))(at||{}),st=(T=>(T.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",T.COMMUNICATION="COMMUNICATION",T.COMMERCE="COMMERCE",T.CORE="CORE",T.UNIVERSAL_AI="UNIVERSAL_AI",T.FLOW_CONTROL="FLOW_CONTROL",T.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",T.ACCOUNTING="ACCOUNTING",T.PRODUCTIVITY="PRODUCTIVITY",T.CONTENT_AND_FILES="CONTENT_AND_FILES",T.DEVELOPER_TOOLS="DEVELOPER_TOOLS",T.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",T.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",T.HUMAN_RESOURCES="HUMAN_RESOURCES",T.PAYMENT_PROCESSING="PAYMENT_PROCESSING",T.MARKETING="MARKETING",T.SALES_AND_CRM="SALES_AND_CRM",T))(st||{});var Mt=(n=>(n.AUTHORIZATION_CODE="authorization_code",n.CLIENT_CREDENTIALS="client_credentials",n))(Mt||{}),on="both_client_credentials_and_authorization_code";var be=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(be||{}),Lt=(c=>(c.NONE="NONE",c.HEADER_PRESENT="HEADER_PRESENT",c.QUERY_PRESENT="QUERY_PRESENT",c.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",c.HEAD_REQUEST="HEAD_REQUEST",c))(Lt||{}),Jc=y({strategy:W(Lt),paramName:P(l())}),jt=(n=>(n.SIMULATION="SIMULATION",n.TEST_FUNCTION="TEST_FUNCTION",n))(jt||{});var lr=(n=>(n.WEBSOCKET="WEBSOCKET",n.NONE="NONE",n))(lr||{}),ao=y({status:P(he()),body:P(M()),headers:P(L(l(),l()))}),so=y({type:D("DELAY"),resumeDateTime:l(),requestIdToReply:P(l()),handlerId:P(l()),streamStepProgress:P(W(lr))}),uo=y({type:D("WEBHOOK"),requestId:l(),requestIdToReply:P(l()),response:ao,handlerId:P(l()),streamStepProgress:P(W(lr))}),Yc=B([so,uo]);var Xc=y({body:M(),rawBody:P(M()),headers:L(l(),l()),queryParams:L(l(),l())});function fe(e){return e==null}o(fe,"isNil");function Ft(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}o(Ft,"isEmpty");function dr(e,r){if(e==null)throw new Error(`${r} is null or undefined`)}o(dr,"assertNotNullOrUndefined");var an=Ae(require("crypto"),1);var Qc=128,Je,ut,el=o(e=>{!Je||Je.length<e?(Je=Buffer.allocUnsafe(e*Qc),an.default.randomFillSync(Je),ut=0):ut+e>Je.length&&(an.default.randomFillSync(Je),ut=0),ut+=e},"fillPool"),tl=o(e=>(el(e|=0),Je.subarray(ut-e,ut)),"random"),rl=o((e,r,n)=>{let t=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*t*r/e.length);return(c=r)=>{let u="";for(;;){let s=n(i),p=i;for(;p--;)if(u+=e[s[p]&t]||"",u.length===c)return u}}},"customRandom"),lo=o((e,r=21)=>rl(e,r,tl),"customAlphabet");var nl="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",po=21,iT=l().check(qe(new RegExp(`^[0-9a-zA-Z]{${po}}$`))),il=lo(nl,po);var Ze=Ve(Be(e=>e instanceof Date?e.toISOString():e),l()),Ie={id:l(),created:Ze,updated:Ze},ne=o(e=>P(kt(e)),"Nullable");function sn(e){return P(kt(W(e)))}o(sn,"NullableEnum");var sT=Ve(Be(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),P(ee())),pr=o(e=>Ve(Be(r=>Array.isArray(r)?r:r!==void 0?[r]:void 0),P(q(e))),"OptionalArrayFromQuery");var lT=L(l(),M());var qt=(f=>(f.OPENAI="openai",f.OPENROUTER="openrouter",f.ANTHROPIC="anthropic",f.AZURE="azure",f.GOOGLE="google",f.ACTIVEPIECES="activepieces",f.CLOUDFLARE_GATEWAY="cloudflare-gateway",f.CUSTOM="custom",f.BEDROCK="bedrock",f.MISTRAL="mistral",f))(qt||{});var PT=l().check(qe(/^#[0-9A-Fa-f]{6}$/));var ST=y({filename:l(),data:M(),type:D("file"),mimetype:P(l())});var ol=Ae(fo());var NT=y({...Ie,name:l(),permissions:q(l()),platformId:ne(l()),type:l(),userCount:P(he())});var go=(t=>(t.AGENT_DECIDE="agent-decide",t.CHOOSE_YOURSELF="choose-yourself",t.LEAVE_EMPTY="leave-empty",t))(go||{}),un=(n=>(n.FILE="FILE",n.TABLE="TABLE",n))(un||{}),cn=(t=>(t.SSE="sse",t.STREAMABLE_HTTP="streamable-http",t.SIMPLE_HTTP="http",t))(cn||{});var ln=(t=>(t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t))(ln||{});var dn=(n=>(n.IN_PROGRESS="in-progress",n.COMPLETED="completed",n))(dn||{});var al=y({mode:W(go),value:M()}),sl=y({auth:P(l()),fields:L(l(),al)}),ul=y({pieceName:l(),pieceVersion:l(),actionName:l(),predefinedInput:P(sl)}),cl=y({type:D("PIECE"),toolName:l().check($e(1)),pieceMetadata:ul}),ll=y({type:D("none")}),dl=y({type:D("access_token"),accessToken:l()}),pl=y({type:D("api_key"),apiKey:l(),apiKeyHeader:l()}),ml=y({type:D("headers"),headers:L(l(),l())}),fl=ot("type",[ll,dl,pl,ml]),yo=y({type:D("FLOW"),toolName:l().check($e(1)),externalFlowId:l(),flowDisplayName:P(l())}),ho=y({type:D("MCP"),toolName:l().check($e(1)),serverUrl:Xi(),protocol:W(cn),auth:fl}),_o=y({type:D("KNOWLEDGE_BASE"),toolName:l().check($e(1)),sourceType:W(un),sourceId:l(),sourceName:l()}),gl=ot("type",[cl,yo,ho,_o]),yl=y({displayName:l(),description:P(l()),type:W(ln)}),bo=y({type:D("MARKDOWN"),markdown:l()}),ct={type:D("TOOL_CALL"),input:ne(L(l(),M())),output:P(M()),toolName:l(),status:W(dn),toolCallId:l(),startTime:l(),endTime:P(l())},iS=y(ct),vo=ot("toolCallType",[y({...ct,toolCallType:D("PIECE"),pieceName:l(),pieceVersion:l(),actionName:l()}),y({...ct,toolCallType:D("FLOW"),displayName:l(),externalFlowId:l()}),y({...ct,toolCallType:D("MCP"),displayName:l(),serverUrl:l()}),y({...ct,toolCallType:D("KNOWLEDGE_BASE"),displayName:l(),sourceType:l()}),y({...ct,toolCallType:D("UNKNOWN"),displayName:l()})]),hl=B([bo,vo]);var pn=(n=>(n.IMAGE="image",n.TEXT="text",n))(pn||{}),Me=y({apiKey:l()}),_l=Me,bl=y({apiKey:l(),apiKeyHash:l()}),vl=Me,xl=Me,Pl=Me,Tl=Me,Sl=Me,Al=Me,Il=Me,xo=y({accessKeyId:l().check($e(1)),secretAccessKey:l().check($e(1))}),$l=y({}),wl=y({}),El=y({}),kl=y({}),Nl=y({}),zl=y({}),Po=y({modelId:l(),modelName:l(),modelType:W(pn)}),To=y({apiKeyHeader:l(),baseUrl:l(),models:q(Po),defaultHeaders:P(L(l(),l()))}),So=y({accountId:l(),gatewayId:l(),models:q(Po),vertexProject:P(l()),vertexRegion:P(l())}),Ao=y({resourceName:l(),apiVersion:Ve(Be(e=>typeof e=="string"&&e.trim().length===0?void 0:e),P(l()))}),Io=y({region:l().check($e(1))}),Dl=B([_l,Pl,Tl,Sl,Al,xl,vl,bl,xo,Il]),$o=B([To,So,Ao,Io,$l,El,kl,Nl,wl,zl]),Ol=y({id:l(),name:l(),type:W(pn)}),Cl=y({id:l(),name:l(),provider:W(qt),config:$o,enabledForChat:ee()}),Rl=y({provider:W(qt),config:$o,auth:Dl,platformId:l()});var uS={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var Ul=y({base64Url:l(),fileName:l(),extension:P(l())}),Ml=y({mimeType:l(),url:l(),fileName:P(l())}),mn=B([Ul,Ml]);var Ll=B([y({type:D("file"),value:mn}),y({type:D("markdown"),value:l(),files:P(q(mn))})]),jl=y({sessionId:l(),message:l(),files:P(q(l()))});var Eo=(n=>(n.ON_NEW_RECORD="ON_NEW_RECORD",n.ON_UPDATE_RECORD="ON_UPDATE_RECORD",n))(Eo||{}),ko=(n=>(n.ENABLED="ENABLED",n.DISABLED="DISABLED",n))(ko||{}),fn=(t=>(t.RECORD_CREATED="RECORD_CREATED",t.RECORD_UPDATED="RECORD_UPDATED",t.RECORD_DELETED="RECORD_DELETED",t))(fn||{});var Fl=B([y({...Ie,name:l(),externalId:l(),type:D("STATIC_DROPDOWN"),tableId:l(),projectId:l(),data:y({options:q(y({value:l()}))})}),y({...Ie,name:l(),externalId:l(),type:B([D("TEXT"),D("NUMBER"),D("DATE")]),tableId:l(),projectId:l()})]),ql=y({...Ie,name:l(),folderId:ne(l()),projectId:l(),externalId:l(),status:sn(ko),trigger:sn(Eo)}),Bl=y({...Ie,tableId:l(),projectId:l(),cells:L(l(),y({updated:l(),created:l(),value:M(),fieldName:l()}))}),Vl=y({events:q(W(fn)),webhookUrl:l(),flowId:l()}),Zl=y({fields:q(y({id:l(),name:l()})),rows:q(L(l(),l())),name:l()}),Hl=y({projectId:l(),limit:P(Nt.number()),cursor:P(l()),name:P(l()),externalIds:pr(l()),folderId:P(l()),folderIds:pr(l())}),Gl=y({records:q(q(y({fieldId:l(),value:zo()}))),tableId:l()}),Wl=y({cells:P(q(y({fieldId:l(),value:zo()}))),tableId:l(),agentUpdate:P(ee())}),No=ot("operator",[Ye("eq"),Ye("neq"),Ye("gt"),Ye("gte"),Ye("lt"),Ye("lte"),Ye("co"),wo("exists"),wo("not_exists")]),Kl=y({tableId:l(),limit:P(Nt.number()),cursor:P(l()),filters:pr(No)});function zo(){return Ve(Be(e=>e==null?e:String(e)),kt(l()))}o(zo,"coerceToString");function Ye(e){return y({fieldId:l(),operator:D(e),value:l()})}o(Ye,"valueFilter");function wo(e){return y({fieldId:l(),operator:D(e)})}o(wo,"existenceFilter");var Jl=y({status:P(he()),body:P(M()),headers:P(L(l(),l()))}),Yl=y({...Ie,deleted:ne(Ze),ownerId:l(),displayName:l(),platformId:l(),externalId:ne(l())});var Do=y({name:l(),description:P(l()),type:l(),required:ee()}),Xl=y({pieceName:l(),triggerName:l(),input:y({toolName:l(),toolDescription:l(),inputSchema:q(Do),returnsResponse:ee()})});var Oo="^[0-9]+\\.[0-9]+\\.[0-9]+$",$S=new RegExp(Oo),ed="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",wS=l().check(qe(new RegExp(Oo))),ES=l().check(qe(new RegExp(ed))),td=y({packageType:D("ARCHIVE"),pieceType:W(at),pieceName:l(),pieceVersion:l(),archiveId:l(),platformId:l()}),Co=y({packageType:D("REGISTRY"),pieceType:D("OFFICIAL"),pieceName:l(),pieceVersion:l()}),Ro=y({packageType:D("REGISTRY"),pieceType:D("CUSTOM"),pieceName:l(),pieceVersion:l(),platformId:l()}),kS=B([Co,Ro]),NS=B([td,Co,Ro]),Uo=(r=>(r.CRON_EXPRESSION="CRON_EXPRESSION",r))(Uo||{}),rd=y({type:W(Uo),cronExpression:l(),timezone:l()}),zS=y({...Ie,type:W(be),projectId:l(),flowId:l(),triggerName:l(),schedule:ne(rd),flowVersionId:l(),pieceName:l(),pieceVersion:l(),deleted:ne(l()),simulate:ee()}),Mo=(b=>(b.UNKNOWN="UNKNOWN",b.FLOW_RUN_LOG="FLOW_RUN_LOG",b.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",b.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",b.FLOW_STEP_FILE="FLOW_STEP_FILE",b.SAMPLE_DATA="SAMPLE_DATA",b.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",b.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",b.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",b.PROJECT_RELEASE="PROJECT_RELEASE",b.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",b.PLATFORM_ASSET="PLATFORM_ASSET",b.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",b.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",b.KNOWLEDGE_BASE="KNOWLEDGE_BASE",b.FLOW_BUNDLE="FLOW_BUNDLE",b))(Mo||{}),Lo=(n=>(n.NONE="NONE",n.ZSTD="ZSTD",n))(Lo||{}),jo=(n=>(n.S3="S3",n.DB="DB",n))(jo||{}),DS=y({...Ie,projectId:ne(l()),platformId:ne(l()),type:W(Mo),compression:W(Lo),data:P(M()),location:W(jo),size:ne(he()),fileName:ne(l()),s3Key:ne(l()),metadata:ne(L(l(),l()))}),Fo=(t=>(t.ADMIN="ADMIN",t.MEMBER="MEMBER",t.OPERATOR="OPERATOR",t))(Fo||{}),qo=(n=>(n.ACTIVE="ACTIVE",n.INACTIVE="INACTIVE",n))(qo||{}),OS=y({id:l(),email:l(),firstName:l(),status:W(qo),externalId:ne(l()),platformId:ne(l()),platformRole:W(Fo),lastName:l(),created:Ze,updated:Ze,lastActiveDate:ne(Ze),imageUrl:ne(l())});var gn=y({...Q.shape,...G(L(l(),M()),"OBJECT").shape});var Ho=y({...Q.shape,...G(l(),"COLOR").shape});var yn=B([Pe,Oe,cr,Re,Te,Ce,rn,zt,nn,Ue,Ct,gn,Rt,Ot,Dt,Ho]),a={ShortText(e){return{...e,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(e){return{...e,valueSchema:void 0,type:"CHECKBOX"}},LongText(e){return{...e,valueSchema:void 0,type:"LONG_TEXT"}},MarkDown(e){return{displayName:"Markdown",required:!1,description:e.value,type:"MARKDOWN",valueSchema:void 0,variant:e.variant??"INFO"}},Number(e){return{...e,valueSchema:void 0,type:"NUMBER"}},Json(e){return{...e,valueSchema:void 0,type:"JSON"}},Array(e){return{...e,valueSchema:void 0,type:"ARRAY"}},Object(e){return{...e,valueSchema:void 0,type:"OBJECT"}},Dropdown(e){return{...e,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(e){return{...e,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(e){return{...e,valueSchema:void 0,type:"DATE_TIME"}},File(e){return{...e,valueSchema:void 0,type:"FILE"}},Custom(e){let r=e.code.toString();return{...e,code:r,valueSchema:void 0,type:"CUSTOM"}},Color(e){return{...e,valueSchema:void 0,type:"COLOR"}}};var Ne=y({displayName:l(),description:P(l())});var Go=y({username:l(),password:l()}),hn=y({...Ne.shape,username:y({displayName:l(),description:P(l())}),password:y({displayName:l(),description:P(l())}),...G(Go,"BASIC_AUTH").shape});var ad=L(l(),B([Pe,Oe,Ue,Re,Te])),_n=y({...Ne.shape,props:ad,...G(M(),"CUSTOM_AUTH").shape});var Xe=y({...Ne.shape,...G(y({auth:l()}),"SECRET_TEXT").shape});var sd=L(l(),B([Pe,Oe,Xe,Ue,Re,Te,Ce,cr])),Wo=y({...Ne.shape,props:sd,...G(M(),"OIDC").shape});var bn=(n=>(n.HEADER="HEADER",n.BODY="BODY",n))(bn||{}),Ko=B([Pe,Xe,Te]),Jo=L(l(),Ko),ud=y({props:P(L(l(),Ko)),authUrl:l(),tokenUrl:l(),scope:q(l()),prompt:P(B([D("none"),D("consent"),D("login"),D("omit")])),pkce:P(ee()),pkceMethod:P(B([D("plain"),D("S256")])),authorizationMethod:P(W(bn)),grantType:P(B([W(Mt),D(on)])),extra:P(L(l(),l()))}),Yo=y({access_token:l(),props:P(Jo),data:L(l(),Et())}),vn=y({...Ne.shape,...ud.shape,...G(Yo,"OAUTH2").shape});var lt=B([hn,_n,Wo,vn,Xe]),Bt="Connection",xn={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||Bt}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||Bt,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||Bt}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||Bt}},None(){}};var pI={OAUTH2:"OAUTH2",CLOUD_OAUTH2:"OAUTH2",PLATFORM_OAUTH2:"OAUTH2",BASIC_AUTH:"BASIC_AUTH",CUSTOM_AUTH:"CUSTOM_AUTH",OIDC:"OIDC",SECRET_TEXT:"SECRET_TEXT",NO_AUTH:void 0};var cd=y({...Q.shape,...G(M(),"CUSTOM").shape,code:l()});var ld=B([yn,lt]),Pn=L(l(),ld),zI=L(l(),yn);var Xo=B([y({strategy:D("CRON"),cronExpression:l()}),y({strategy:D("NONE")})]),dt=class{constructor(r,n,t,i,c,u,s,p,m,f,A,x,d,_,v,b,T,S,V){this.name=r;this.displayName=n;this.description=t;this.requireAuth=i;this.props=c;this.type=u;this.handshakeConfiguration=s;this.onHandshake=p;this.renewConfiguration=m;this.onRenew=f;this.onEnable=A;this.onDisable=x;this.onStart=d;this.run=_;this.test=v;this.sampleData=b;this.testStrategy=T;this.outputSchema=S;this.aiMetadata=V}static{o(this,"ITrigger")}},ve=o(e=>{switch(e.type){case"WEBHOOK":return new dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:"NONE"},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:"NONE"},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?"TEST_FUNCTION":"SIMULATION",e.outputSchema,e.aiMetadata);case"POLLING":return new dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata);case"MANUAL":return new dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata);case"APP_WEBHOOK":return new dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,fe(e.sampleData)&&fe(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var Qo="2",fr="0.82.0";var Tn=class{constructor(r,n,t,i,c,u,s,p,m=fr,f,A=""){this.displayName=r;this.logoUrl=n;this.authors=t;this.events=i;this.categories=s;this.auth=p;this.minimumSupportedRelease=m;this.maximumSupportedRelease=f;this.description=A;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:Qo}),"getContextInfo");(!dd(m)||pd(m,fr))&&(this.minimumSupportedRelease=fr),c.forEach(x=>this._actions[x.name]=x),u.forEach(x=>this._triggers[x.name]=x)}static{o(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,contextInfo:this.getContextInfo?.()}}getAction(r){return this._actions[r]}getTrigger(r){return this._triggers[r]}actions(){return this._actions}triggers(){return this._triggers}},ea=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((n,t,i)=>t===i.findIndex(c=>c.type===n.type)))throw new Error("Auth properties must be unique by type");return new Tn(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description)},"createPiece");function dd(e){return/^\d+\.\d+\.\d+$/.test(e)}o(dd,"isValidSimpleSemver");function pd(e,r){let[n,t,i]=e.split(".").map(Number),[c,u,s]=r.split(".").map(Number);return n!==c?n<c:t!==u?t<u:i<s}o(pd,"isSemverLessThan");var md=P(L(l(),L(l(),l()))),ta=y({id:P(l()),name:l(),displayName:l(),logoUrl:l(),description:l(),authors:q(l()),platformId:P(l()),directoryPath:P(l()),auth:P(B([lt,q(lt)])),version:l(),categories:P(q(W(st))),minimumSupportedRelease:P(l()),maximumSupportedRelease:P(l()),i18n:md}),fd=W(["human","ai","both"]),ra=y({description:P(l()),idempotent:P(ee())}),na=y({name:l(),displayName:l(),description:l(),props:Pn,requireAuth:ee(),errorHandlingOptions:P(tn),outputSchema:P(sr()),audience:P(fd),aiMetadata:P(ra)}),ia=y({name:l(),displayName:l(),description:l(),props:Pn,errorHandlingOptions:P(tn),type:W(be),sampleData:M(),handshakeConfiguration:P(sr()),renewConfiguration:P(Xo),testStrategy:W(jt),outputSchema:P(sr()),aiMetadata:P(ra)}),gd=y({...ta.shape,actions:L(l(),na),triggers:L(l(),ia)}),yd=y({...ta.shape,actions:he(),triggers:he(),suggestedActions:P(q(ia)),suggestedTriggers:P(q(na))}),oa=y({projectUsage:he(),tags:P(q(l())),pieceType:W(at),packageType:W(Ut),platformId:P(l()),archiveId:P(l())}),z$=y({...gd.shape,...oa.shape}),D$=y({...yd.shape,...oa.shape}),O$=y({name:l(),version:l()});var hd=Ae(require("path")),_d=Ae(require("fs/promises"));var gr=class{constructor(r,n){this.baseUrl=r;this.authenticationConverter=n}static{o(this,"BaseHttpClient")}getUrl(r){let n=new URL(`${this.baseUrl}${r.url}`),t=`${n.origin}${n.pathname}`,i=new URLSearchParams;return n.searchParams.forEach((c,u)=>{i.append(u,c)}),{urlWithoutQueryParams:t,queryParams:i}}getHeaders(r){let n={Accept:"application/json"};if(r.authentication&&this.populateAuthentication(r.authentication,n),r.body)switch(r.headers?.["Content-Type"]){case"text/csv":n["Content-Type"]="text/csv";break;default:n["Content-Type"]="application/json";break}return r.headers&&(n={...n,...r.headers}),n}populateAuthentication(r,n){this.authenticationConverter.convert(r,n)}};var yr=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(r=new Sn,n=new An){this.converters={BEARER_TOKEN:r,BASIC:n}}convert(r,n){return this.converters[r.type].convert(r,n)}},Sn=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(r,n){return n.Authorization=`Bearer ${r.token}`,n}},An=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(r,n){let t=`${r.username}:${r.password}`,i=Buffer.from(t).toString("base64");return n.Authorization=`Basic ${i}`,n}};var hr=class extends Error{constructor(n,t){let i=t.status||500,c=Buffer.isBuffer(t.responseBody)?t.responseBody.toString():t.responseBody;super(JSON.stringify({response:{status:i,body:c},request:{body:n}}));this.requestBody=n;this.status=i,this.responseBody=c}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};var _r=class extends gr{static{o(this,"FetchHttpClient")}constructor(r="",n=new yr){super(r,n)}async sendRequest(r,n){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:t,queryParams:i}=this.getUrl(r),c=this.getHeaders(r),u=r.queryParams??{};for(let[V,ue]of Object.entries(u))i.append(V,ue);let s=i.toString(),p=s?`${t}?${s}`:t,m=r.responseType??"json",f=r.followRedirects??!0,A=r.retries??0,{body:x,extraHeaders:d,isStream:_}=bd(r.body,c),v=xd({...c,...d}),b=await vd(async()=>{let V=new AbortController,ue=r.timeout&&r.timeout>0?setTimeout(()=>V.abort(),r.timeout):void 0;try{let ye={method:r.method.toString(),headers:v,body:x,redirect:f?"follow":"manual",signal:V.signal};return _&&(ye.duplex="half"),n?.dispatcher!==void 0&&(ye.dispatcher=n.dispatcher),await fetch(p,ye)}finally{ue!==void 0&&clearTimeout(ue)}},A),T=f?300:400;if(b.status<200||b.status>=T){let V=await aa(b,m),ue=new hr(r.body,{status:b.status,responseBody:V});throw console.error("[HttpClient#(sanitized error message)] Request failed:",ue),ue}let S=await aa(b,m);return{status:b.status,headers:Pd(b.headers),body:S}}};function bd(e,r){return Sd(e)?{body:void 0,extraHeaders:{},isStream:!1}:Td(e)?{body:e,extraHeaders:e.getHeaders(),isStream:!0}:typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(r["Content-Type"]??r["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}o(bd,"serializeBody");async function aa(e,r){switch(r){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"blob":return await e.blob();case"text":return await e.text();case"json":default:{let n=await e.text();if(n.length===0)return;try{return JSON.parse(n)}catch{return n}}}}o(aa,"parseResponseBody");async function vd(e,r){let n;for(let t=0;t<=r;t++)try{let i=await e();if(i.status>=500&&t<r){await sa(t);continue}return i}catch(i){if(n=i,t<r){await sa(t);continue}throw i}throw n}o(vd,"sendWithRetries");function sa(e){let r=Math.min(1e3*2**e,3e4);return new Promise(n=>setTimeout(n,r))}o(sa,"backoff");function xd(e){let r={};for(let[n,t]of Object.entries(e))t!==void 0&&(r[n]=Array.isArray(t)?t.join(", "):t);return r}o(xd,"normalizeHeaders");function Pd(e){let r={};return e.forEach((n,t)=>{r[t]=n}),r}o(Pd,"toHttpHeaders");function Td(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"}o(Td,"isNodeFormData");function Sd(e){return e==null}o(Sd,"isNil");var pt=new _r;var Vt=(u=>(u.GET="GET",u.POST="POST",u.PATCH="PATCH",u.PUT="PUT",u.DELETE="DELETE",u.HEAD="HEAD",u))(Vt||{});var dm=Ae(require("fs")),pu=Ae(Hn());var pm={"application/json":"json","application/pdf":"pdf","application/xml":"xml","text/xml":"xml","application/zip":"zip","application/gzip":"gz","application/x-tar":"tar","application/octet-stream":"bin","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/rtf":"rtf","application/javascript":"js","application/x-www-form-urlencoded":"bin","text/plain":"txt","text/html":"html","text/css":"css","text/csv":"csv","text/calendar":"ics","text/markdown":"md","image/png":"png","image/jpeg":"jpeg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","image/x-icon":"ico","image/vnd.microsoft.icon":"ico","image/heic":"heic","audio/mpeg":"mp3","audio/mp4":"m4a","audio/wav":"wav","audio/x-wav":"wav","audio/ogg":"ogg","audio/webm":"weba","video/mp4":"mp4","video/mpeg":"mpeg","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","font/woff":"woff","font/woff2":"woff2","font/ttf":"ttf","font/otf":"otf"};function mm(e){let r=e.split(";")[0].trim().toLowerCase();return pm[r]??""}o(mm,"contentTypeToExtension");var fm=o(({baseUrl:e,relativePath:r})=>{let n=e.endsWith("/")?e:`${e}/`,t=r.startsWith("/")?r.slice(1):r;return`${n}${t}`},"joinBaseUrlWithRelativePath"),gm=o((e,r)=>{let n="https://api.example.com";try{let t=r?e(r):void 0;return(t?.endsWith("/")?t.slice(0,-1):t)??n}catch{return n}},"getBaseUrlForDescription");function mu({auth:e,baseUrl:r,authMapping:n,description:t,displayName:i,name:c,props:u,extraProps:s,authLocation:p="headers"}){return O({audience:"human",name:c||"custom_api_call",displayName:i||"Custom API Call",description:t||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:a.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:o(async({auth:m})=>({url:a.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
3
- i.e ${gm(r,m)}/resource or /resource`,required:!0,defaultValue:m?r(m):"",...u?.url??{}})}),"props")}),method:a.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(Vt).map(m=>({label:m,value:m}))},...u?.method??{}}),headers:a.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...u?.headers??{}}),queryParams:a.Object({displayName:"Query Parameters",required:!0,...u?.queryParams??{}}),body_type:a.StaticDropdown({displayName:"Body Type",required:!1,defaultValue:"none",options:{disabled:!1,options:[{label:"None",value:"none"},{label:"JSON",value:"json"},{label:"Form Data",value:"form_data"},{label:"Raw",value:"raw"}]}}),body:a.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:m})=>{if(!m)return{};let f=m,A={};switch(f){case"none":break;case"json":A.data=a.Json({displayName:"JSON Body",required:!0,...u?.body??{}});break;case"raw":A.data=a.LongText({displayName:"Raw Body",required:!0});break;case"form_data":A.data=a.Array({displayName:"Form Data",required:!0,properties:{fieldName:a.ShortText({displayName:"Field Name",required:!0}),fieldType:a.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:a.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:a.File({displayName:"File Field Value",required:!1})}});break}return A},"props")}),response_is_binary:a.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:a.Checkbox({displayName:"No Error on Failure",required:!1,...u?.failsafe??{}}),timeout:a.Number({displayName:"Timeout (in seconds)",required:!1,...u?.timeout??{}}),followRedirects:a.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...s},run:o(async m=>{let{method:f,url:A,headers:x,queryParams:d,body:_,body_type:v,failsafe:b,timeout:T,response_is_binary:S,followRedirects:V}=m.propsValue;dr(f,"Method"),dr(A,"URL");let ue=fe(n)?{}:await n(m.auth,m.propsValue),ye=A.url,Ee=ye.startsWith("http://")||ye.startsWith("https://")?ye:fm({baseUrl:r(m.auth),relativePath:ye}),te={method:f,url:Ee,headers:{...x??{},...p==="headers"||!fe(p)?ue:{}},queryParams:{...p==="queryParams"?ue:{},...d??{}},timeout:T?T*1e3:0,followRedirects:V};if(S&&(te.responseType="arraybuffer"),_)if(v&&v!=="none"){let K=_.data;if(v==="form_data"){let et=K,Ge=new pu.default;for(let{fieldName:F,fieldType:$,textFieldValue:I,fileFieldValue:E}of et)$==="text"&&!Ft(I)?Ge.append(F,I):$==="file"&&!Ft(E)&&Ge.append(F,E.data,{filename:E?.filename});te.body=Ge,te.headers={...te.headers,...Ge.getHeaders()}}else te.body=K}else v||(te.body=_);try{let K=await pt.sendRequest(te);return await ym(m.files,K.body,K.status,K.headers,S)}catch(K){if(b)return K.errorMessage();throw K}},"run")})}o(mu,"createCustomApiCallAction");var ym=o(async(e,r,n,t,i)=>{let c;if(i&&hm(r)){let u=Array.isArray(t?.["content-type"])?t["content-type"][0]:t?.["content-type"],s=mm(u??"")||"txt",p;r instanceof ArrayBuffer?p=Buffer.from(new Uint8Array(r)):Buffer.isBuffer(r)?p=r:p=Buffer.from(r),c=await e.write({fileName:`output.${s}`,data:p})}else c=r;return{status:n,headers:t,body:c}},"handleBinaryResponse"),hm=o(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var Y={async poll(e,{store:r,auth:n,propsValue:t,maxItemsToPoll:i,files:c,server:u}){switch(e.strategy){case 0:{let s=await r.get("lastPoll");if(fe(s))throw new Error("lastPoll doesn't exist in the store.");let p=await e.items({store:r,auth:n,propsValue:t,lastFetchEpochMS:s,server:u}),m=p.reduce((f,A)=>Math.max(f,A.epochMilliSeconds),s);return await r.put("lastPoll",m),p.filter(f=>f.epochMilliSeconds>s).map(f=>f.data)}case 1:{let s=await r.get("lastItem"),p=await e.items({store:r,auth:n,propsValue:t,lastItemId:s,files:c,server:u}),m=p.findIndex(x=>x.id===s),f=[];fe(s)||m==-1?f=p??[]:f=p?.slice(0,m)??[],fe(i)||(f=f.slice(-i));let A=f?.[0]?.id;return fe(A)||await r.put("lastItem",A),f.map(x=>x.data)}}},async onEnable(e,{store:r,auth:n,propsValue:t,server:i}){switch(e.strategy){case 0:{await r.put("lastPoll",Date.now());break}case 1:{let u=(await e.items({store:r,auth:n,propsValue:t,lastItemId:null,server:i}))?.[0]?.id;fe(u)?await r.delete("lastItem"):await r.put("lastItem",u);break}}},async onDisable(e,r){switch(e.strategy){case 0:case 1:return}},async test(e,{auth:r,propsValue:n,store:t,files:i,server:c}){let u=[];switch(e.strategy){case 0:{u=await e.items({store:t,auth:r,propsValue:n,lastFetchEpochMS:0,server:c});break}case 1:{u=await e.items({store:t,auth:r,propsValue:n,lastItemId:null,files:i,server:c});break}}return _m(u.map(s=>s.data))}};function _m(e){return e.length<=5?e:e.slice(0,5)}o(_m,"getFirstFiveOrAll");var _t={baseUrl:"https://api.bexio.com",api_version:"3.0"};var h=class{constructor(r){this.auth=r}static{o(this,"BexioClient")}async makeRequest(r,n,t,i){let c=n.startsWith("/2.0/")||n.startsWith("/3.0/")?`${_t.baseUrl}${n}`:`${_t.baseUrl}/${_t.api_version}${n}`,u={method:r,url:c,authentication:{type:"BEARER_TOKEN",token:this.auth.access_token},headers:{Accept:"application/json","Content-Type":"application/json"}};return t&&(u.body=t),i&&(u.queryParams=i),(await pt.sendRequest(u)).body}async get(r,n){return this.makeRequest("GET",r,void 0,n)}async post(r,n,t){return this.makeRequest("POST",r,n,t)}async patch(r,n){return this.makeRequest("PATCH",r,n)}async delete(r){return this.makeRequest("DELETE",r)}};var g=xn.OAuth2({authUrl:"https://auth.bexio.com/realms/bexio/protocol/openid-connect/auth",tokenUrl:"https://auth.bexio.com/realms/bexio/protocol/openid-connect/token",required:!0,scope:["openid","profile","email","offline_access","contact_show","contact_edit","article_show","article_edit","kb_invoice_show","kb_invoice_edit","kb_offer_show","kb_offer_edit","kb_order_show","kb_order_edit","project_show","project_edit","task_show","monitoring_edit","accounting","file"],validate:o(async({auth:e})=>{try{return await new h(e).get("/users/me"),{valid:!0}}catch{return{valid:!1,error:"Authentication failed. Please check your connection and try again."}}},"validate")});var fu=O({auth:g,name:"create_manual_entry",displayName:"Create Manual Entry",description:"Create a manual accounting entry (single, compound, or group)",audience:"both",aiMetadata:{description:"Books a manual accounting entry in Bexio in one of three modes: a single debit/credit line, a compound entry distributing a total across several accounts, or a group of multiple complete bookings sharing one reference. Use to post journal entries directly to the ledger; requires a booking date and the entry lines for the chosen mode (account ids resolvable via Find Account). Not idempotent: each call posts new ledger bookings.",idempotent:!1},props:{type:a.StaticDropdown({displayName:"Entry Type",description:"Choose the type of manual entry",required:!0,defaultValue:"manual_single_entry",options:{disabled:!1,options:[{label:"Single Entry - Simple one-line booking",value:"manual_single_entry"},{label:"Compound Entry - Total distributed across multiple accounts",value:"manual_compound_entry"},{label:"Group Entry - Multiple separate bookings with same reference",value:"manual_group_entry"}]}}),date:a.ShortText({displayName:"Booking Date",description:"Date of the booking (YYYY-MM-DD)",required:!0}),reference_nr:a.ShortText({displayName:"Reference Number",description:"Reference number for the booking",required:!1}),entryFields:a.DynamicProperties({auth:g,displayName:"Entry Details",description:"Configure the entry details based on selected type",required:!0,refreshers:["type","auth"],props:o(async({type:e,auth:r},n)=>{let t=e||"manual_single_entry",i=[],c=[],u=[];if(r)try{let f=new h(r);i=await f.get("/accounts"),c=await f.get("/taxes"),u=await f.get("/3.0/currencies")}catch(f){console.warn("Failed to fetch accounts/taxes/currencies:",f)}let s=i.map(f=>({label:`${f.account_no} - ${f.name}`,value:f.id})),p=c.map(f=>({label:`${f.name} (${f.percentage}%)`,value:f.id})),m=u.map(f=>({label:f.name,value:f.id}));if(t==="manual_single_entry")return{debit_account:s.length>0?a.StaticDropdown({displayName:"Debit Account",description:"The account to debit",required:!0,options:{disabled:!1,options:s}}):a.Number({displayName:"Debit Account ID",description:"The account ID to debit",required:!0}),credit_account:s.length>0?a.StaticDropdown({displayName:"Credit Account",description:"The account to credit",required:!0,options:{disabled:!1,options:s}}):a.Number({displayName:"Credit Account ID",description:"The account ID to credit",required:!0}),amount:a.Number({displayName:"Amount",description:"The transaction amount",required:!0}),description:a.ShortText({displayName:"Description",description:"Description of the transaction",required:!1}),tax_id:p.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (optional)",required:!1,options:{disabled:!1,options:p}}):a.Number({displayName:"Tax ID",description:"Tax ID (optional)",required:!1}),tax_account:s.length>0?a.StaticDropdown({displayName:"Tax Account",description:"Account for tax calculation",required:!1,options:{disabled:!1,options:s}}):a.Number({displayName:"Tax Account ID",description:"Account ID for tax calculation",required:!1}),currency_id:m.length>0?a.StaticDropdown({displayName:"Currency",description:"Currency (optional)",required:!1,options:{disabled:!1,options:m}}):a.Number({displayName:"Currency ID",description:"Currency ID (optional)",required:!1}),currency_factor:a.Number({displayName:"Currency Factor",description:"Exchange rate factor (defaults to 1)",required:!1}),helper_info:a.MarkDown({value:""}),entries:a.Array({displayName:"Entries",description:"Not used for single entries",required:!1,properties:{}})};{let f=t==="manual_compound_entry";return{debit_account:a.Number({displayName:"Debit Account",description:"Not used for compound/group entries",required:!1}),credit_account:a.Number({displayName:"Credit Account",description:"Not used for compound/group entries",required:!1}),amount:a.Number({displayName:"Amount",description:"Not used for compound/group entries",required:!1}),description:a.ShortText({displayName:"Description",description:"Not used for compound/group entries",required:!1}),tax_id:a.Number({displayName:"Tax ID",description:"Not used for compound/group entries",required:!1}),tax_account:a.Number({displayName:"Tax Account",description:"Not used for compound/group entries",required:!1}),currency_id:a.Number({displayName:"Currency ID",description:"Not used for compound/group entries",required:!1}),currency_factor:a.Number({displayName:"Currency Factor",description:"Not used for compound/group entries",required:!1}),helper_info:a.MarkDown({value:f?"For compound entries, each entry should have EITHER debit_account_id OR credit_account_id (not both).":"For group entries, each entry must have BOTH debit_account_id and credit_account_id."}),entries:a.Array({displayName:"Entries",description:f?"Multiple entries to distribute the total. Each entry should have either debit_account_id OR credit_account_id (not both).":"Multiple complete bookings. Each entry must have both debit_account_id and credit_account_id.",required:!0,properties:{debit_account_id:s.length>0?a.StaticDropdown({displayName:"Debit Account",description:f?"Account to debit (leave empty if this is a credit entry)":"Account to debit",required:!f,options:{disabled:!1,options:s}}):a.Number({displayName:"Debit Account ID",description:f?"Account ID to debit (leave 0 if this is a credit entry)":"Account ID to debit",required:!f}),credit_account_id:s.length>0?a.StaticDropdown({displayName:"Credit Account",description:f?"Account to credit (leave empty if this is a debit entry)":"Account to credit",required:!f,options:{disabled:!1,options:s}}):a.Number({displayName:"Credit Account ID",description:f?"Account ID to credit (leave 0 if this is a debit entry)":"Account ID to credit",required:!f}),amount:a.Number({displayName:"Amount",description:"The transaction amount",required:!0}),description:a.ShortText({displayName:"Description",description:"Description for this entry",required:!1}),tax_id:p.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (optional)",required:!1,options:{disabled:!1,options:p}}):a.Number({displayName:"Tax ID",description:"Tax ID (optional)",required:!1}),tax_account_id:s.length>0?a.StaticDropdown({displayName:"Tax Account",description:"Account for tax calculation (optional)",required:!1,options:{disabled:!1,options:s}}):a.Number({displayName:"Tax Account ID",description:"Account ID for tax calculation (optional)",required:!1}),currency_id:m.length>0?a.StaticDropdown({displayName:"Currency",description:"Currency (optional)",required:!1,options:{disabled:!1,options:m}}):a.Number({displayName:"Currency ID",description:"Currency ID (optional)",required:!1}),currency_factor:a.Number({displayName:"Currency Factor",description:"Exchange rate factor (defaults to 1)",required:!1})}})}}},"props")})},async run(e){let r=new h(e.auth),n=e.propsValue.type,t=e.propsValue.entryFields,i=[];if(n==="manual_single_entry"){let s={debit_account_id:t.debit_account,credit_account_id:t.credit_account,amount:t.amount};t.description&&(s.description=t.description),t.tax_id&&(s.tax_id=t.tax_id),t.tax_account&&(s.tax_account_id=t.tax_account),t.currency_id&&(s.currency_id=t.currency_id),t.currency_factor&&(s.currency_factor=t.currency_factor),i=[s]}else{let s=t.entries;if(!s||s.length===0)throw new Error("At least one entry is required for compound or group entries");i=s.map(p=>{let m={amount:p.amount},f=p.debit_account_id;f&&f!==0&&(m.debit_account_id=f);let A=p.credit_account_id;A&&A!==0&&(m.credit_account_id=A),p.description&&(m.description=p.description);let x=p.tax_id;x&&x!==0&&(m.tax_id=x);let d=p.tax_account_id;d&&d!==0&&(m.tax_account_id=d);let _=p.currency_id;return _&&_!==0&&(m.currency_id=_),p.currency_factor&&(m.currency_factor=p.currency_factor),m})}let c={type:n,date:e.propsValue.date,reference_nr:e.propsValue.reference_nr,entries:i};return await r.post("/accounts/manual_entries",c)}});var gu=O({auth:g,name:"create_company",displayName:"Create Company",description:"Create a new company contact",audience:"both",aiMetadata:{description:"Creates a new organization (company-type) contact in Bexio with name, address, communication, and grouping fields. Use to add a company; pick Create Person for an individual or Update Company to modify an existing one. Requires a company name plus an assigned user and owner. Not idempotent: each call creates a separate contact, so search first to avoid duplicates.",idempotent:!1},props:{name_1:a.ShortText({displayName:"Company Name",description:"The name of the company",required:!0}),name_2:a.ShortText({displayName:"Company Addition",description:'Additional company name (e.g., "Ltd.", "Inc.")',required:!1}),nr:a.ShortText({displayName:"Contact Number",description:"Contact number (leave empty to auto-assign)",required:!1}),salutation_id:a.Dropdown({auth:g,displayName:"Salutation",description:"Salutation for the company",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/salutation")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load salutations",options:[]}}},"options")}),title_id:a.Dropdown({auth:g,displayName:"Title",description:"Title for the company",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/title")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load titles",options:[]}}},"options")}),street_name:a.ShortText({displayName:"Street Name",description:"Street name",required:!1}),house_number:a.ShortText({displayName:"House Number",description:"House number",required:!1}),address_addition:a.ShortText({displayName:"Address Addition",description:'Additional address information (e.g., "Building C")',required:!1}),postcode:a.ShortText({displayName:"Postcode",description:"Postal code",required:!1}),city:a.ShortText({displayName:"City",description:"City",required:!1}),country_id:a.Dropdown({auth:g,displayName:"Country",description:"Country",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/country")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load countries",options:[]}}},"options")}),mail:a.ShortText({displayName:"Email",description:"Primary email address",required:!1}),mail_second:a.ShortText({displayName:"Secondary Email",description:"Secondary email address",required:!1}),phone_fixed:a.ShortText({displayName:"Phone",description:"Fixed phone number",required:!1}),phone_fixed_second:a.ShortText({displayName:"Secondary Phone",description:"Secondary fixed phone number",required:!1}),phone_mobile:a.ShortText({displayName:"Mobile Phone",description:"Mobile phone number",required:!1}),fax:a.ShortText({displayName:"Fax",description:"Fax number",required:!1}),url:a.ShortText({displayName:"Website",description:"Company website URL",required:!1}),skype_name:a.ShortText({displayName:"Skype Name",description:"Skype username",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional notes about the company",required:!1}),language_id:a.Dropdown({auth:g,displayName:"Language",description:"Preferred language",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),contact_group_ids:a.MultiSelectDropdown({auth:g,displayName:"Contact Groups",description:"Select contact groups",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_group")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact groups",options:[]}}},"options")}),contact_branch_ids:a.MultiSelectDropdown({auth:g,displayName:"Contact Sectors",description:"Select contact sectors",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_branch")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact sectors",options:[]}}},"options")}),user_id:a.Dropdown({auth:g,displayName:"User",description:"User assigned to this contact",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),owner_id:a.Dropdown({auth:g,displayName:"Owner",description:"Owner of this contact",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={contact_type_id:1,name_1:n.name_1,user_id:n.user_id,owner_id:n.owner_id};return n.name_2&&(t.name_2=n.name_2),n.nr!==void 0&&n.nr!==null&&n.nr!==""?t.nr=n.nr:t.nr=null,n.salutation_id&&(t.salutation_id=n.salutation_id),n.title_id&&(t.title_id=n.title_id),n.street_name&&(t.street_name=n.street_name),n.house_number&&(t.house_number=n.house_number),n.address_addition&&(t.address_addition=n.address_addition),n.postcode&&(t.postcode=n.postcode),n.city&&(t.city=n.city),n.country_id&&(t.country_id=n.country_id),n.mail&&(t.mail=n.mail),n.mail_second&&(t.mail_second=n.mail_second),n.phone_fixed&&(t.phone_fixed=n.phone_fixed),n.phone_fixed_second&&(t.phone_fixed_second=n.phone_fixed_second),n.phone_mobile&&(t.phone_mobile=n.phone_mobile),n.fax&&(t.fax=n.fax),n.url&&(t.url=n.url),n.skype_name&&(t.skype_name=n.skype_name),n.remarks&&(t.remarks=n.remarks),n.language_id&&(t.language_id=n.language_id),n.contact_group_ids&&Array.isArray(n.contact_group_ids)&&n.contact_group_ids.length>0&&(t.contact_group_ids=n.contact_group_ids.join(",")),n.contact_branch_ids&&Array.isArray(n.contact_branch_ids)&&n.contact_branch_ids.length>0&&(t.contact_branch_ids=n.contact_branch_ids.join(",")),await r.post("/2.0/contact",t)}});var yu=O({auth:g,name:"create_person",displayName:"Create Person",description:"Create a new person contact",audience:"both",aiMetadata:{description:"Creates a new individual (person-type) contact in Bexio with name, address, communication, and grouping fields. Use to add an individual; pick Create Company for an organization or Update Person to modify an existing one. Requires a last name plus an assigned user and owner. Not idempotent: each call creates a separate contact, so search first to avoid duplicates.",idempotent:!1},props:{name_1:a.ShortText({displayName:"Last Name",description:"The last name of the person",required:!0}),name_2:a.ShortText({displayName:"First Name",description:"The first name of the person",required:!1}),nr:a.ShortText({displayName:"Contact Number",description:"Contact number (leave empty to auto-assign)",required:!1}),salutation_id:a.Dropdown({auth:g,displayName:"Salutation",description:"Salutation for the person",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/salutation")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load salutations",options:[]}}},"options")}),salutation_form:a.Number({displayName:"Salutation Form",description:"Salutation form (optional)",required:!1}),title_id:a.Dropdown({auth:g,displayName:"Title",description:"Title for the person (e.g., Dr., Prof.)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/title")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load titles",options:[]}}},"options")}),birthday:a.ShortText({displayName:"Birthday",description:"Birthday date (YYYY-MM-DD)",required:!1}),street_name:a.ShortText({displayName:"Street Name",description:"Street name",required:!1}),house_number:a.ShortText({displayName:"House Number",description:"House number",required:!1}),address_addition:a.ShortText({displayName:"Address Addition",description:'Additional address information (e.g., "Building C")',required:!1}),postcode:a.ShortText({displayName:"Postcode",description:"Postal code",required:!1}),city:a.ShortText({displayName:"City",description:"City",required:!1}),country_id:a.Dropdown({auth:g,displayName:"Country",description:"Country",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/country")).map(t=>({label:`${t.name} (${t.name_short})`,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load countries",options:[]}}},"options")}),mail:a.ShortText({displayName:"Email",description:"Primary email address",required:!1}),mail_second:a.ShortText({displayName:"Secondary Email",description:"Secondary email address",required:!1}),phone_fixed:a.ShortText({displayName:"Phone",description:"Fixed phone number",required:!1}),phone_fixed_second:a.ShortText({displayName:"Secondary Phone",description:"Secondary fixed phone number",required:!1}),phone_mobile:a.ShortText({displayName:"Mobile Phone",description:"Mobile phone number",required:!1}),fax:a.ShortText({displayName:"Fax",description:"Fax number",required:!1}),url:a.ShortText({displayName:"Website",description:"Personal website URL",required:!1}),skype_name:a.ShortText({displayName:"Skype Name",description:"Skype username",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional notes about the person",required:!1}),language_id:a.Dropdown({auth:g,displayName:"Language",description:"Preferred language",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),contact_group_ids:a.MultiSelectDropdown({auth:g,displayName:"Contact Groups",description:"Select contact groups",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_group")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact groups",options:[]}}},"options")}),contact_branch_ids:a.MultiSelectDropdown({auth:g,displayName:"Contact Sectors",description:"Select contact sectors",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_branch")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact sectors",options:[]}}},"options")}),user_id:a.Dropdown({auth:g,displayName:"User",description:"User assigned to this contact",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),owner_id:a.Dropdown({auth:g,displayName:"Owner",description:"Owner of this contact",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={contact_type_id:2,name_1:n.name_1,user_id:n.user_id,owner_id:n.owner_id};return n.name_2&&(t.name_2=n.name_2),n.nr!==void 0&&n.nr!==null&&n.nr!==""?t.nr=n.nr:t.nr=null,n.salutation_id&&(t.salutation_id=n.salutation_id),n.salutation_form&&(t.salutation_form=n.salutation_form),n.title_id&&(t.title_id=n.title_id),n.birthday&&(t.birthday=n.birthday),n.street_name&&(t.street_name=n.street_name),n.house_number&&(t.house_number=n.house_number),n.address_addition&&(t.address_addition=n.address_addition),n.postcode&&(t.postcode=n.postcode),n.city&&(t.city=n.city),n.country_id&&(t.country_id=n.country_id),n.mail&&(t.mail=n.mail),n.mail_second&&(t.mail_second=n.mail_second),n.phone_fixed&&(t.phone_fixed=n.phone_fixed),n.phone_fixed_second&&(t.phone_fixed_second=n.phone_fixed_second),n.phone_mobile&&(t.phone_mobile=n.phone_mobile),n.fax&&(t.fax=n.fax),n.url&&(t.url=n.url),n.skype_name&&(t.skype_name=n.skype_name),n.remarks&&(t.remarks=n.remarks),n.language_id&&(t.language_id=n.language_id),n.contact_group_ids&&Array.isArray(n.contact_group_ids)&&n.contact_group_ids.length>0&&(t.contact_group_ids=n.contact_group_ids.join(",")),n.contact_branch_ids&&Array.isArray(n.contact_branch_ids)&&n.contact_branch_ids.length>0&&(t.contact_branch_ids=n.contact_branch_ids.join(",")),await r.post("/2.0/contact",t)}});var hu=O({auth:g,name:"update_person",displayName:"Update Person",description:"Update an existing person contact",audience:"both",aiMetadata:{description:"Updates fields on an existing person-type contact in Bexio identified by its contact id; only supplied fields change. Use to modify a known individual; pick Create Person to add a new one or Update Company for an organization. Resolve the contact id with Find Company or a contact lookup first. Idempotent: re-sending the same values converges to the same contact state.",idempotent:!0},props:{contact_id:a.Dropdown({auth:g,displayName:"Person",description:"Select the person to update",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).filter(i=>i.contact_type_id===2).map(i=>{let c=i.name_2?`${i.name_2} ${i.name_1}`:i.name_1;return{label:i.nr?`${c} (#${i.nr})`:c,value:i.id}})}}catch{return{disabled:!0,placeholder:"Failed to load persons",options:[]}}},"options")}),name_1:a.ShortText({displayName:"Last Name",description:"The last name of the person",required:!1}),name_2:a.ShortText({displayName:"First Name",description:"The first name of the person",required:!1}),nr:a.ShortText({displayName:"Contact Number",description:"Contact number (leave empty to keep current or auto-assign)",required:!1}),salutation_id:a.Dropdown({auth:g,displayName:"Salutation",description:"Salutation for the person",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/salutation")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load salutations",options:[]}}},"options")}),salutation_form:a.Number({displayName:"Salutation Form",description:"Salutation form (optional)",required:!1}),title_id:a.Dropdown({auth:g,displayName:"Title",description:"Title for the person (e.g., Dr., Prof.)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/title")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load titles",options:[]}}},"options")}),birthday:a.ShortText({displayName:"Birthday",description:"Birthday date (YYYY-MM-DD)",required:!1}),street_name:a.ShortText({displayName:"Street Name",description:"Street name",required:!1}),house_number:a.ShortText({displayName:"House Number",description:"House number",required:!1}),address_addition:a.ShortText({displayName:"Address Addition",description:"Additional address information",required:!1}),postcode:a.ShortText({displayName:"Postcode",description:"Postal code",required:!1}),city:a.ShortText({displayName:"City",description:"City",required:!1}),country_id:a.Dropdown({auth:g,displayName:"Country",description:"Country",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/country")).map(t=>({label:`${t.name} (${t.name_short})`,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load countries",options:[]}}},"options")}),mail:a.ShortText({displayName:"Email",description:"Primary email address",required:!1}),mail_second:a.ShortText({displayName:"Secondary Email",description:"Secondary email address",required:!1}),phone_fixed:a.ShortText({displayName:"Phone",description:"Fixed phone number",required:!1}),phone_fixed_second:a.ShortText({displayName:"Secondary Phone",description:"Secondary fixed phone number",required:!1}),phone_mobile:a.ShortText({displayName:"Mobile Phone",description:"Mobile phone number",required:!1}),fax:a.ShortText({displayName:"Fax",description:"Fax number",required:!1}),url:a.ShortText({displayName:"Website URL",description:"Personal website URL",required:!1}),skype_name:a.ShortText({displayName:"Skype Name",description:"Skype username",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional notes about the person",required:!1}),language_id:a.Dropdown({auth:g,displayName:"Language",description:"Preferred language",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),contact_group_ids:a.MultiSelectDropdown({auth:g,displayName:"Contact Groups",description:"Select contact groups",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_group")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact groups",options:[]}}},"options")}),contact_branch_ids:a.MultiSelectDropdown({auth:g,displayName:"Contact Sectors",description:"Select contact sectors",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_branch")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact sectors",options:[]}}},"options")}),user_id:a.Dropdown({auth:g,displayName:"User",description:"User assigned to this contact",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),owner_id:a.Dropdown({auth:g,displayName:"Owner",description:"Owner of this contact",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run(e){let r=new h(e.auth),n=e.propsValue.contact_id,t=e.propsValue,i={contact_type_id:2};return t.name_1&&(i.name_1=t.name_1),t.name_2!==void 0&&(i.name_2=t.name_2||null),t.nr!==void 0&&t.nr!==null&&t.nr!==""?i.nr=t.nr:t.nr===""&&(i.nr=null),t.salutation_id&&(i.salutation_id=t.salutation_id),t.salutation_form&&(i.salutation_form=t.salutation_form),t.title_id&&(i.title_id=t.title_id),t.birthday&&(i.birthday=t.birthday),t.street_name&&(i.street_name=t.street_name),t.house_number&&(i.house_number=t.house_number),t.address_addition&&(i.address_addition=t.address_addition),t.postcode&&(i.postcode=t.postcode),t.city&&(i.city=t.city),t.country_id&&(i.country_id=t.country_id),t.mail&&(i.mail=t.mail),t.mail_second&&(i.mail_second=t.mail_second),t.phone_fixed&&(i.phone_fixed=t.phone_fixed),t.phone_fixed_second&&(i.phone_fixed_second=t.phone_fixed_second),t.phone_mobile&&(i.phone_mobile=t.phone_mobile),t.fax&&(i.fax=t.fax),t.url&&(i.url=t.url),t.skype_name&&(i.skype_name=t.skype_name),t.remarks&&(i.remarks=t.remarks),t.language_id&&(i.language_id=t.language_id),t.contact_group_ids&&Array.isArray(t.contact_group_ids)&&t.contact_group_ids.length>0&&(i.contact_group_ids=t.contact_group_ids.join(",")),t.contact_branch_ids&&Array.isArray(t.contact_branch_ids)&&t.contact_branch_ids.length>0&&(i.contact_branch_ids=t.contact_branch_ids.join(",")),t.user_id&&(i.user_id=t.user_id),t.owner_id&&(i.owner_id=t.owner_id),await r.patch(`/2.0/contact/${n}`,i)}});var _u=Ae(Hn()),bu=O({auth:g,name:"create_file",displayName:"Create File",description:"Upload a new file to Bexio",audience:"both",aiMetadata:{description:"Uploads a file to the Bexio file manager via multipart form data, returning the stored file metadata. Use to add a document or attachment to Bexio storage; requires the file contents. Not idempotent: each call stores another copy of the file.",idempotent:!1},props:{file:a.File({displayName:"File",description:"The file to upload",required:!0})},async run(e){let r=e.propsValue.file,n=new _u.default;return n.append("file",r.data,r.filename),(await pt.sendRequest({url:`${_t.baseUrl}/3.0/files`,method:"POST",authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},headers:{Accept:"application/json",...n.getHeaders()},body:n})).body}});var ze={account:o(e=>a.Dropdown({auth:g,displayName:e.displayName,description:e.description,required:e.required,refreshers:[],options:o(async({auth:r})=>{if(!r)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(r).get("/accounts")).map(i=>({label:`${i.account_no} - ${i.name}`,value:i.id}))}}catch{return{disabled:!0,placeholder:"Failed to load accounts",options:[]}}},"options")}),"account"),tax:a.Dropdown({auth:g,displayName:"Tax",description:"Select a tax rate",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/taxes")).map(t=>({label:`${t.name} (${t.percentage}%)`,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),currency:o(e=>a.Dropdown({auth:g,displayName:e.displayName,description:e.description,required:e.required,refreshers:[],options:o(async({auth:r})=>{if(!r)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(r).get("/3.0/currencies")).map(i=>({label:i.name,value:i.id}))}}catch{return{disabled:!0,placeholder:"Failed to load currencies",options:[]}}},"options")}),"currency")};var vu=O({auth:g,name:"create_sales_invoice",displayName:"Create Sales Invoice",description:"Create a new product-based sales invoice",audience:"both",aiMetadata:{description:"Creates a new sales invoice in Bexio from one or more line-item positions (custom, article, text, subtotal, discount, or page-break). Use when billing a customer for products or services; requires a user, language, bank account, currency, payment type, tax handling, and at least one position. Not idempotent: each call creates a separate invoice, so guard against duplicates.",idempotent:!1},props:{document_nr:a.ShortText({displayName:"Document Number",description:"Invoice number (required if automatic numbering is disabled)",required:!1}),title:a.ShortText({displayName:"Title",description:"Invoice title",required:!1}),contact_id:a.Dropdown({auth:g,displayName:"Contact",description:"The contact for this invoice",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),contact_sub_id:a.Dropdown({auth:g,displayName:"Contact Sub",description:"Contact sub-address (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),user_id:a.Dropdown({auth:g,displayName:"User",description:"User assigned to this invoice",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),pr_project_id:a.Dropdown({auth:g,displayName:"Project",description:"Project associated with this invoice",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project")).map(t=>({label:t.nr?`${t.name} (#${t.nr})`:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load projects",options:[]}}},"options")}),language_id:a.Dropdown({auth:g,displayName:"Language",description:"Language for the invoice",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),bank_account_id:a.Dropdown({auth:g,displayName:"Bank Account",description:"Bank account for payment",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/banking/accounts")).map(t=>{let i=t.iban_nr||t.bank_account_nr;return{label:i?`${t.name} (${i})`:t.name,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load bank accounts",options:[]}}},"options")}),currency_id:ze.currency({displayName:"Currency",required:!0}),payment_type_id:a.Dropdown({auth:g,displayName:"Payment Type",description:"Payment type for this invoice",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/payment_type")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load payment types",options:[]}}},"options")}),header:a.LongText({displayName:"Header",description:"Header text for the invoice",required:!1}),footer:a.LongText({displayName:"Footer",description:"Footer text for the invoice",required:!1}),mwst_type:a.StaticDropdown({displayName:"Tax Type",description:"How taxes are handled",required:!0,defaultValue:0,options:{disabled:!1,options:[{label:"Including taxes",value:0},{label:"Excluding taxes",value:1},{label:"Exempt from taxes",value:2}]}}),mwst_is_net:a.Checkbox({displayName:"Tax is Net",description:"If taxes are included, set to true to add taxes to total, false to include in total",required:!1,defaultValue:!1}),show_position_taxes:a.Checkbox({displayName:"Show Position Taxes",description:"Show taxes for each position",required:!1,defaultValue:!1}),is_valid_from:a.ShortText({displayName:"Valid From",description:"Invoice valid from date (YYYY-MM-DD)",required:!1}),is_valid_to:a.ShortText({displayName:"Valid To",description:"Invoice valid to date (YYYY-MM-DD)",required:!1}),contact_address_manual:a.LongText({displayName:"Manual Contact Address",description:"Override contact address (leave empty to use contact address)",required:!1}),reference:a.ShortText({displayName:"Reference",description:"Reference number",required:!1}),api_reference:a.ShortText({displayName:"API Reference",description:"Reference for API use (can only be edited via API)",required:!1}),template_slug:a.Dropdown({auth:g,displayName:"Document Template",description:"Document template for the invoice",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/document_templates")).map(t=>({label:t.is_default?`${t.name} (Default)`:t.name,value:t.template_slug}))}}catch{return{disabled:!0,placeholder:"Failed to load templates",options:[]}}},"options")}),positionFields:a.DynamicProperties({auth:g,displayName:"Invoice Positions",description:"Configure invoice line items",required:!0,refreshers:["auth"],props:o(async({auth:e})=>{let r=[],n=[],t=[];if(e)try{let s=new h(e);r=await s.get("/2.0/unit").catch(()=>[]),n=await s.get("/accounts").catch(()=>[]),t=(await s.get("/3.0/taxes?types=sales_tax&scope=active").catch(()=>[])).map(m=>({id:m.id,name:m.display_name||m.name,percentage:m.value.toString()}))}catch{}let i=r.map(s=>({label:s.name,value:s.id})),c=n.map(s=>({label:`${s.account_no} - ${s.name}`,value:s.id})),u=t.map(s=>({label:`${s.name} (${s.percentage}%)`,value:s.id}));return{positions:a.Array({displayName:"Positions",description:"Invoice line items",required:!0,properties:{type:a.StaticDropdown({displayName:"Position Type",description:"Type of invoice position",required:!0,defaultValue:"KbPositionCustom",options:{disabled:!1,options:[{label:"Custom Position",value:"KbPositionCustom"},{label:"Article Position",value:"KbPositionArticle"},{label:"Text Position",value:"KbPositionText"},{label:"Subtotal Position",value:"KbPositionSubtotal"},{label:"Page Break Position",value:"KbPositionPagebreak"},{label:"Discount Position",value:"KbPositionDiscount"}]}}),amount:a.ShortText({displayName:"Amount",description:"Quantity/amount",required:!0}),unit_id:i.length>0?a.StaticDropdown({displayName:"Unit",description:"Unit of measurement",required:!1,options:{disabled:!1,options:i}}):a.Number({displayName:"Unit ID",description:"Unit ID (use List Units action to find IDs)",required:!1}),account_id:c.length>0?a.StaticDropdown({displayName:"Account",description:"Account for this position",required:!1,options:{disabled:!1,options:c}}):a.Number({displayName:"Account ID",description:"Account ID (use List Accounts action to find IDs)",required:!1}),tax_id:u.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (only active sales taxes)",required:!1,options:{disabled:!1,options:u}}):a.Number({displayName:"Tax ID",description:"Tax ID (use List Taxes action to find IDs)",required:!1}),text:a.LongText({displayName:"Description",description:"Position description/text",required:!1}),unit_price:a.ShortText({displayName:"Unit Price",description:"Price per unit (max 6 decimals)",required:!1}),discount_in_percent:a.ShortText({displayName:"Discount (%)",description:"Discount percentage (max 6 decimals)",required:!1}),parent_id:a.Number({displayName:"Parent ID",description:"Parent position ID (for grouped positions)",required:!1})}})}},"props")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={};n.user_id&&(t.user_id=n.user_id),n.language_id&&(t.language_id=n.language_id),n.bank_account_id&&(t.bank_account_id=n.bank_account_id),n.currency_id&&(t.currency_id=n.currency_id),n.payment_type_id&&(t.payment_type_id=n.payment_type_id),n.document_nr&&(t.document_nr=n.document_nr),n.title!==void 0&&(t.title=n.title||null),n.contact_id&&(t.contact_id=n.contact_id),n.contact_sub_id&&(t.contact_sub_id=n.contact_sub_id),n.pr_project_id&&(t.pr_project_id=n.pr_project_id),n.header&&(t.header=n.header),n.footer&&(t.footer=n.footer),n.mwst_type!==void 0&&(t.mwst_type=n.mwst_type),n.mwst_is_net!==void 0&&(t.mwst_is_net=n.mwst_is_net),n.show_position_taxes!==void 0&&(t.show_position_taxes=n.show_position_taxes),n.is_valid_from&&(t.is_valid_from=n.is_valid_from),n.is_valid_to&&(t.is_valid_to=n.is_valid_to),n.contact_address_manual&&(t.contact_address_manual=n.contact_address_manual),n.reference&&(t.reference=n.reference),n.api_reference&&(t.api_reference=n.api_reference),n.template_slug&&(t.template_slug=n.template_slug);let i=n.positionFields;return i&&i.positions&&Array.isArray(i.positions)&&(t.positions=i.positions.map(u=>{let s={type:u.type||"KbPositionCustom"};return u.amount&&(s.amount=u.amount),u.unit_id&&(s.unit_id=u.unit_id),u.account_id&&(s.account_id=u.account_id),u.tax_id&&(s.tax_id=u.tax_id),u.text&&(s.text=u.text),u.unit_price&&(s.unit_price=u.unit_price),u.discount_in_percent&&(s.discount_in_percent=u.discount_in_percent),u.parent_id&&(s.parent_id=u.parent_id),s})),await r.post("/2.0/kb_invoice",t)}});var xu=O({auth:g,name:"export_invoice_pdf",displayName:"Export Invoice to PDF",description:"Export an existing sales invoice as a PDF document",audience:"both",aiMetadata:{description:"Renders an existing Bexio sales invoice as a PDF and returns the downloadable file, keyed by the invoice id. Use when an agent needs the document itself (to attach or store); pick Send Sales Invoice to email it to a recipient instead. Optionally toggle the letterhead. Read-only and idempotent: it generates the file without changing the invoice.",idempotent:!0},props:{invoice_id:a.Dropdown({auth:g,displayName:"Invoice",description:"Select the invoice to export",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/kb_invoice")).map(t=>({label:t.title?`${t.document_nr} - ${t.title}`:t.document_nr,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load invoices",options:[]}}},"options")}),logopaper:a.StaticDropdown({displayName:"Letterhead",description:"Whether to include letterhead in the PDF",required:!1,defaultValue:1,options:{disabled:!1,options:[{label:"With Letterhead",value:1},{label:"Without Letterhead",value:0}]}})},async run({auth:e,propsValue:r,files:n}){let t=new h(e),i=r.invoice_id,c=r.logopaper,u={};c!==void 0&&(u.logopaper=c.toString());let s=await t.get(`/2.0/kb_invoice/${i}/pdf`,u);return{file:await n.write({fileName:s.name||`invoice_${i}.pdf`,data:Buffer.from(s.content,"base64")}),fileName:s.name,size:s.size,mimeType:s.mime}}});var Pu=O({auth:g,name:"send_sales_invoice",displayName:"Send Sales Invoice",description:"Send a sales invoice to an email address",audience:"both",aiMetadata:{description:'Emails an existing Bexio sales invoice to a recipient, with subject and message body, optionally marking the invoice as open and attaching the PDF. Use to deliver an invoice to a customer; pick Export Invoice to PDF if you only need the file. Requires the invoice id and a recipient email, and the message must contain a "[Network Link]" placeholder. Not idempotent: each call sends another email.',idempotent:!1},props:{invoice_id:a.Dropdown({auth:g,displayName:"Invoice",description:"Select the invoice to send",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/kb_invoice")).map(t=>({label:t.title?`${t.document_nr} - ${t.title}`:t.document_nr,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load invoices",options:[]}}},"options")}),recipient_email:a.ShortText({displayName:"Recipient Email",description:"Email address to send the invoice to",required:!0}),subject:a.ShortText({displayName:"Subject",description:"Email subject line",required:!0}),message:a.LongText({displayName:"Message",description:'Email message body. Must include "[Network Link]" placeholder',required:!0}),mark_as_open:a.Checkbox({displayName:"Mark as Open",description:"Mark the invoice as open",required:!1,defaultValue:!1}),attach_pdf:a.Checkbox({displayName:"Attach PDF",description:"Attach PDF directly to the email",required:!1,defaultValue:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.invoice_id,i=r.recipient_email,c=r.subject,u=r.message,s=r.mark_as_open,p=r.attach_pdf,m={recipient_email:i,subject:c,message:u};return s!==void 0&&(m.mark_as_open=s),p!==void 0&&(m.attach_pdf=p),await n.post(`/2.0/kb_invoice/${t}/send`,m)}});var Tu=O({auth:g,name:"create_product",displayName:"Create Product",description:"Create a new product or service",audience:"both",aiMetadata:{description:"Create a new Bexio article (a physical product or a service) with internal code and name, plus optional pricing, taxes, unit, currency, supplier, stock, and dimension details. Not idempotent: each call adds a separate article even if the code repeats, so check for an existing product first to avoid duplicates. Stock-item fields require the stock_edit scope.",idempotent:!1},props:{user_id:a.Dropdown({auth:g,displayName:"User",description:"User associated with this product",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),article_type_id:a.StaticDropdown({displayName:"Product Type",description:"Type of product",required:!0,defaultValue:1,options:{disabled:!1,options:[{label:"Physical Product",value:1},{label:"Service",value:2}]}}),intern_code:a.ShortText({displayName:"Internal Code",description:"Internal product code",required:!0}),intern_name:a.ShortText({displayName:"Internal Name",description:"Internal product name",required:!0}),intern_description:a.LongText({displayName:"Internal Description",description:"Internal product description",required:!1}),contact_id:a.Dropdown({auth:g,displayName:"Contact",description:"Contact associated with this product",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),deliverer_code:a.ShortText({displayName:"Supplier Code",description:"Supplier product code",required:!1}),deliverer_name:a.ShortText({displayName:"Supplier Name",description:"Supplier product name",required:!1}),deliverer_description:a.LongText({displayName:"Supplier Description",description:"Supplier product description",required:!1}),purchase_price:a.ShortText({displayName:"Purchase Price",description:"Purchase price",required:!1}),sale_price:a.ShortText({displayName:"Sale Price",description:"Sale price",required:!1}),purchase_total:a.Number({displayName:"Purchase Total",description:"Total purchase amount",required:!1}),sale_total:a.Number({displayName:"Sale Total",description:"Total sale amount",required:!1}),currency_id:ze.currency({displayName:"Currency",required:!1}),tax_income_id:a.Dropdown({auth:g,displayName:"Income Tax",description:"Tax for income/sales",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/taxes")).filter(t=>t.type==="sales_tax"||!t.type).map(t=>({label:t.display_name||t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),tax_expense_id:a.Dropdown({auth:g,displayName:"Expense Tax",description:"Tax for expenses/purchases",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/taxes")).filter(t=>t.type==="pre_tax"||!t.type).map(t=>({label:t.display_name||t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),unit_id:a.Dropdown({auth:g,displayName:"Unit",description:"Unit of measurement",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/unit")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load units",options:[]}}},"options")}),is_stock:a.Checkbox({displayName:"Is Stock Item",description:"Whether this is a stock item (requires stock_edit scope)",required:!1,defaultValue:!1}),stock_id:a.Dropdown({auth:g,displayName:"Stock Location",description:"Stock location",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/stock").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load stock locations",options:[]}}},"options")}),stock_place_id:a.Dropdown({auth:g,displayName:"Stock Area",description:"Stock area/place",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/stock_place").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load stock areas",options:[]}}},"options")}),stock_nr:a.Number({displayName:"Stock Number",description:"Current stock quantity",required:!0,defaultValue:0}),stock_min_nr:a.Number({displayName:"Minimum Stock",description:"Minimum stock quantity",required:!0,defaultValue:0}),width:a.Number({displayName:"Width",description:"Product width",required:!1}),height:a.Number({displayName:"Height",description:"Product height",required:!1}),weight:a.Number({displayName:"Weight",description:"Product weight",required:!1}),volume:a.Number({displayName:"Volume",description:"Product volume",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional remarks",required:!1}),delivery_price:a.Number({displayName:"Delivery Price",description:"Delivery price",required:!1}),article_group_id:a.Dropdown({auth:g,displayName:"Article Group",description:"Product group/category",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/article_group").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load article groups",options:[]}}},"options")}),account_id:ze.account({displayName:"Account",description:"Account for this product",required:!1}),expense_account_id:ze.account({displayName:"Expense Account",description:"Expense account for this product",required:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r,i={user_id:t.user_id,article_type_id:t.article_type_id,intern_code:t.intern_code,intern_name:t.intern_name,stock_nr:t.stock_nr||0,stock_min_nr:t.stock_min_nr||0};return t.intern_description&&(i.intern_description=t.intern_description),t.contact_id&&(i.contact_id=t.contact_id),t.deliverer_code&&(i.deliverer_code=t.deliverer_code),t.deliverer_name&&(i.deliverer_name=t.deliverer_name),t.deliverer_description&&(i.deliverer_description=t.deliverer_description),t.purchase_price&&(i.purchase_price=t.purchase_price),t.sale_price&&(i.sale_price=t.sale_price),t.purchase_total&&(i.purchase_total=t.purchase_total),t.sale_total&&(i.sale_total=t.sale_total),t.currency_id&&(i.currency_id=t.currency_id),t.tax_income_id&&(i.tax_income_id=t.tax_income_id),t.tax_expense_id&&(i.tax_expense_id=t.tax_expense_id),t.unit_id&&(i.unit_id=t.unit_id),t.is_stock!==void 0&&(i.is_stock=t.is_stock),t.stock_id&&(i.stock_id=t.stock_id),t.stock_place_id&&(i.stock_place_id=t.stock_place_id),t.width&&(i.width=t.width),t.height&&(i.height=t.height),t.weight&&(i.weight=t.weight),t.volume&&(i.volume=t.volume),t.remarks&&(i.remarks=t.remarks),t.delivery_price&&(i.delivery_price=t.delivery_price),t.article_group_id&&(i.article_group_id=t.article_group_id),t.account_id&&(i.account_id=t.account_id),t.expense_account_id&&(i.expense_account_id=t.expense_account_id),await n.post("/2.0/article",i)}});var Su=O({auth:g,name:"update_product",displayName:"Update Product",description:"Update an existing product or service",audience:"both",aiMetadata:{description:"Updates fields on an existing Bexio product/article (codes, names, prices, tax, unit, stock, dimensions, accounts) identified by its article id; only supplied fields change. Use to modify a known product; locate the article id with Find Product first. Idempotent: re-sending the same values converges to the same product state.",idempotent:!0},props:{article_id:a.Dropdown({auth:g,displayName:"Product",description:"Select the product to update",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/article")).map(t=>({label:t.intern_code?`${t.intern_name} (${t.intern_code})`:t.intern_name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load products",options:[]}}},"options")}),user_id:a.Dropdown({auth:g,displayName:"User",description:"User associated with this product",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),intern_code:a.ShortText({displayName:"Internal Code",description:"Internal product code",required:!1}),intern_name:a.ShortText({displayName:"Internal Name",description:"Internal product name",required:!1}),intern_description:a.LongText({displayName:"Internal Description",description:"Internal product description",required:!1}),contact_id:a.Dropdown({auth:g,displayName:"Contact",description:"Contact associated with this product",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),deliverer_code:a.ShortText({displayName:"Supplier Code",description:"Supplier product code",required:!1}),deliverer_name:a.ShortText({displayName:"Supplier Name",description:"Supplier product name",required:!1}),deliverer_description:a.LongText({displayName:"Supplier Description",description:"Supplier product description",required:!1}),purchase_price:a.ShortText({displayName:"Purchase Price",description:"Purchase price",required:!1}),sale_price:a.ShortText({displayName:"Sale Price",description:"Sale price",required:!1}),purchase_total:a.Number({displayName:"Purchase Total",description:"Total purchase amount",required:!1}),sale_total:a.Number({displayName:"Sale Total",description:"Total sale amount",required:!1}),currency_id:ze.currency({displayName:"Currency",required:!1}),tax_income_id:a.Dropdown({auth:g,displayName:"Income Tax",description:"Tax for income/sales",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/taxes")).filter(t=>t.type==="sales_tax"||!t.type).map(t=>({label:t.display_name||t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),tax_expense_id:a.Dropdown({auth:g,displayName:"Expense Tax",description:"Tax for expenses/purchases",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/taxes")).filter(t=>t.type==="pre_tax"||!t.type).map(t=>({label:t.display_name||t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),unit_id:a.Dropdown({auth:g,displayName:"Unit",description:"Unit of measurement",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/unit")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load units",options:[]}}},"options")}),is_stock:a.Checkbox({displayName:"Is Stock Item",description:"Whether this is a stock item (requires stock_edit scope)",required:!1}),stock_id:a.Dropdown({auth:g,displayName:"Stock Location",description:"Stock location",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/stock").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load stock locations",options:[]}}},"options")}),stock_place_id:a.Dropdown({auth:g,displayName:"Stock Area",description:"Stock area/place",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/stock_place").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load stock areas",options:[]}}},"options")}),stock_nr:a.Number({displayName:"Stock Number",description:"Current stock quantity (can only be set if no bookings exist)",required:!1}),stock_min_nr:a.Number({displayName:"Minimum Stock",description:"Minimum stock quantity",required:!1}),width:a.Number({displayName:"Width",description:"Product width",required:!1}),height:a.Number({displayName:"Height",description:"Product height",required:!1}),weight:a.Number({displayName:"Weight",description:"Product weight",required:!1}),volume:a.Number({displayName:"Volume",description:"Product volume",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional remarks",required:!1}),delivery_price:a.Number({displayName:"Delivery Price",description:"Delivery price",required:!1}),article_group_id:a.Dropdown({auth:g,displayName:"Article Group",description:"Product group/category",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/article_group").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load article groups",options:[]}}},"options")}),account_id:ze.account({displayName:"Account",description:"Account for this product",required:!1}),expense_account_id:ze.account({displayName:"Expense Account",description:"Expense account for this product",required:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r,i=t.article_id,c={};return t.user_id&&(c.user_id=t.user_id),t.intern_code&&(c.intern_code=t.intern_code),t.intern_name&&(c.intern_name=t.intern_name),t.intern_description&&(c.intern_description=t.intern_description),t.contact_id&&(c.contact_id=t.contact_id),t.deliverer_code&&(c.deliverer_code=t.deliverer_code),t.deliverer_name&&(c.deliverer_name=t.deliverer_name),t.deliverer_description&&(c.deliverer_description=t.deliverer_description),t.purchase_price&&(c.purchase_price=t.purchase_price),t.sale_price&&(c.sale_price=t.sale_price),t.purchase_total&&(c.purchase_total=t.purchase_total),t.sale_total&&(c.sale_total=t.sale_total),t.currency_id&&(c.currency_id=t.currency_id),t.tax_income_id&&(c.tax_income_id=t.tax_income_id),t.tax_expense_id&&(c.tax_expense_id=t.tax_expense_id),t.unit_id&&(c.unit_id=t.unit_id),t.is_stock!==void 0&&(c.is_stock=t.is_stock),t.stock_id&&(c.stock_id=t.stock_id),t.stock_place_id&&(c.stock_place_id=t.stock_place_id),t.stock_nr!==void 0&&(c.stock_nr=t.stock_nr),t.stock_min_nr!==void 0&&(c.stock_min_nr=t.stock_min_nr),t.width&&(c.width=t.width),t.height&&(c.height=t.height),t.weight&&(c.weight=t.weight),t.volume&&(c.volume=t.volume),t.remarks&&(c.remarks=t.remarks),t.delivery_price&&(c.delivery_price=t.delivery_price),t.article_group_id&&(c.article_group_id=t.article_group_id),t.account_id&&(c.account_id=t.account_id),t.expense_account_id&&(c.expense_account_id=t.expense_account_id),await n.post(`/2.0/article/${i}`,c)}});var Au=O({auth:g,name:"create_sales_order",displayName:"Create Sales Order",description:"Create a new product-based sales order",audience:"both",aiMetadata:{description:"Creates a new sales order in Bexio from one or more line-item positions (custom, article, text, subtotal, discount, or page-break). Use when confirming an order for products or services; pick Create Sales Invoice to bill instead. Requires a contact, user, language, bank account, currency, payment type, tax handling, a valid-from date, and at least one position; supports a separate delivery address. Not idempotent: each call creates a separate order.",idempotent:!1},props:{document_nr:a.ShortText({displayName:"Document Number",description:"Order number (required if automatic numbering is disabled)",required:!1}),title:a.ShortText({displayName:"Title",description:"Order title",required:!1}),contact_id:a.Dropdown({auth:g,displayName:"Contact",description:"The contact for this order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),contact_sub_id:a.Dropdown({auth:g,displayName:"Contact Sub",description:"Contact sub-address (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),user_id:a.Dropdown({auth:g,displayName:"User",description:"User responsible for this order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),pr_project_id:a.Dropdown({auth:g,displayName:"Project",description:"Project associated with this order",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project")).map(t=>({label:t.nr?`${t.name} (#${t.nr})`:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load projects",options:[]}}},"options")}),language_id:a.Dropdown({auth:g,displayName:"Language",description:"Language for the order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),bank_account_id:a.Dropdown({auth:g,displayName:"Bank Account",description:"Bank account for payment",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/banking/accounts")).map(t=>{let i=t.iban_nr||t.bank_account_nr;return{label:i?`${t.name} (${i})`:t.name,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load bank accounts",options:[]}}},"options")}),currency_id:a.Dropdown({auth:g,displayName:"Currency",description:"Currency for this order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/currencies")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load currencies",options:[]}}},"options")}),payment_type_id:a.Dropdown({auth:g,displayName:"Payment Type",description:"Payment type for this order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/payment_type")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load payment types",options:[]}}},"options")}),header:a.LongText({displayName:"Header",description:"Header text for the order",required:!1}),footer:a.LongText({displayName:"Footer",description:"Footer text for the order",required:!1}),mwst_type:a.StaticDropdown({displayName:"Tax Type",description:"How taxes are handled",required:!0,defaultValue:0,options:{disabled:!1,options:[{label:"Including taxes",value:0},{label:"Excluding taxes",value:1},{label:"Exempt from taxes",value:2}]}}),mwst_is_net:a.Checkbox({displayName:"Tax is Net",description:"If taxes are included, set to true to add taxes to total, false to include in total",required:!1,defaultValue:!1}),show_position_taxes:a.Checkbox({displayName:"Show Position Taxes",description:"Show taxes for each position",required:!1,defaultValue:!1}),is_valid_from:a.ShortText({displayName:"Valid From",description:"Order valid from date (YYYY-MM-DD)",required:!0}),contact_address_manual:a.LongText({displayName:"Manual Contact Address",description:"Override contact address (leave empty to use contact address)",required:!1}),delivery_address_type:a.StaticDropdown({displayName:"Delivery Address Type",description:"Type of delivery address",required:!1,defaultValue:0,options:{disabled:!1,options:[{label:"Use Invoice Address",value:0},{label:"Use Custom Address",value:1}]}}),delivery_address_manual_text:a.LongText({displayName:"Manual Delivery Address",description:"Custom delivery address (only used if delivery address type is set to custom)",required:!1}),api_reference:a.ShortText({displayName:"API Reference",description:"Reference for API use (can only be edited via API)",required:!1}),template_slug:a.Dropdown({auth:g,displayName:"Document Template",description:"Document template for the order",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/document_templates")).map(t=>({label:t.is_default?`${t.name} (Default)`:t.name,value:t.template_slug}))}}catch{return{disabled:!0,placeholder:"Failed to load templates",options:[]}}},"options")}),positionFields:a.DynamicProperties({auth:g,displayName:"Order Positions",description:"Configure order line items",required:!0,refreshers:["auth"],props:o(async({auth:e})=>{let r=[],n=[],t=[];if(e)try{let s=new h(e);r=await s.get("/2.0/unit").catch(()=>[]),n=await s.get("/accounts").catch(()=>[]),t=(await s.get("/3.0/taxes?types=sales_tax&scope=active").catch(()=>[])).map(m=>({id:m.id,name:m.display_name||m.name,percentage:m.value.toString()}))}catch{}let i=r.map(s=>({label:s.name,value:s.id})),c=n.map(s=>({label:`${s.account_no} - ${s.name}`,value:s.id})),u=t.map(s=>({label:`${s.name} (${s.percentage}%)`,value:s.id}));return{positions:a.Array({displayName:"Positions",description:"Order line items",required:!0,properties:{type:a.StaticDropdown({displayName:"Position Type",description:"Type of order position",required:!0,defaultValue:"KbPositionCustom",options:{disabled:!1,options:[{label:"Custom Position",value:"KbPositionCustom"},{label:"Article Position",value:"KbPositionArticle"},{label:"Text Position",value:"KbPositionText"},{label:"Subtotal Position",value:"KbPositionSubtotal"},{label:"Page Break Position",value:"KbPositionPagebreak"},{label:"Discount Position",value:"KbPositionDiscount"}]}}),amount:a.ShortText({displayName:"Amount",description:"Quantity/amount",required:!0}),unit_id:i.length>0?a.StaticDropdown({displayName:"Unit",description:"Unit of measurement",required:!1,options:{disabled:!1,options:i}}):a.Number({displayName:"Unit ID",description:"Unit ID (use List Units action to find IDs)",required:!1}),account_id:c.length>0?a.StaticDropdown({displayName:"Account",description:"Account for this position",required:!1,options:{disabled:!1,options:c}}):a.Number({displayName:"Account ID",description:"Account ID (use List Accounts action to find IDs)",required:!1}),tax_id:u.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (only active sales taxes)",required:!1,options:{disabled:!1,options:u}}):a.Number({displayName:"Tax ID",description:"Tax ID (use List Taxes action to find IDs)",required:!1}),text:a.LongText({displayName:"Description",description:"Position description/text",required:!1}),unit_price:a.ShortText({displayName:"Unit Price",description:"Price per unit (max 6 decimals)",required:!1}),discount_in_percent:a.ShortText({displayName:"Discount (%)",description:"Discount percentage (max 6 decimals)",required:!1}),parent_id:a.Number({displayName:"Parent ID",description:"Parent position ID (for grouped positions)",required:!1})}})}},"props")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={contact_id:n.contact_id,user_id:n.user_id,language_id:n.language_id,bank_account_id:n.bank_account_id,currency_id:n.currency_id,payment_type_id:n.payment_type_id,mwst_type:n.mwst_type,is_valid_from:n.is_valid_from};n.document_nr&&(t.document_nr=n.document_nr),n.title!==void 0&&(t.title=n.title||null),n.contact_sub_id&&(t.contact_sub_id=n.contact_sub_id),n.pr_project_id&&(t.pr_project_id=n.pr_project_id),n.header&&(t.header=n.header),n.footer&&(t.footer=n.footer),n.mwst_is_net!==void 0&&(t.mwst_is_net=n.mwst_is_net),n.show_position_taxes!==void 0&&(t.show_position_taxes=n.show_position_taxes),n.contact_address_manual&&(t.contact_address_manual=n.contact_address_manual),n.delivery_address_type!==void 0&&(t.delivery_address_type=n.delivery_address_type),n.delivery_address_manual_text&&(t.delivery_address_manual=n.delivery_address_manual_text),n.api_reference&&(t.api_reference=n.api_reference),n.template_slug&&(t.template_slug=n.template_slug);let i=n.positionFields;return i&&i.positions&&Array.isArray(i.positions)&&(t.positions=i.positions.map(u=>{let s={type:u.type||"KbPositionCustom"};return u.amount&&(s.amount=u.amount),u.unit_id&&(s.unit_id=u.unit_id),u.account_id&&(s.account_id=u.account_id),u.tax_id&&(s.tax_id=u.tax_id),u.text&&(s.text=u.text),u.unit_price&&(s.unit_price=u.unit_price),u.discount_in_percent&&(s.discount_in_percent=u.discount_in_percent),u.parent_id&&(s.parent_id=u.parent_id),s})),await r.post("/2.0/kb_order",t)}});var Iu=O({auth:g,name:"create_project",displayName:"Create Project",description:"Create a new project",audience:"both",aiMetadata:{description:"Creates a new Bexio project linked to a contact, with status, type, responsible user, optional dates, and optional invoicing/budget settings. Use to set up a project before tracking time or billing against it. Requires a name, project status, project type, contact, and user. Not idempotent: each call creates a separate project.",idempotent:!1},props:{document_nr:a.ShortText({displayName:"Document Number",description:"Project number (required if automatic numbering is disabled)",required:!1}),name:a.ShortText({displayName:"Project Name",description:"Name of the project",required:!0}),start_date:a.DateTime({displayName:"Start Date",description:"Project start date",required:!1}),end_date:a.DateTime({displayName:"End Date",description:"Project end date",required:!1}),comment:a.LongText({displayName:"Comment",description:"Project comment/description",required:!1}),pr_state_id:a.Dropdown({auth:g,displayName:"Project Status",description:"Status of the project",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project_state")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load project statuses",options:[]}}},"options")}),pr_project_type_id:a.Dropdown({auth:g,displayName:"Project Type",description:"Type of project",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project_type")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load project types",options:[]}}},"options")}),contact_id:a.Dropdown({auth:g,displayName:"Contact",description:"Contact associated with this project",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),contact_sub_id:a.Dropdown({auth:g,displayName:"Contact Sub",description:"Contact sub-address (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),pr_invoice_type_id:a.StaticDropdown({displayName:"Invoice Type",description:"Type of invoicing for this project",required:!1,options:{disabled:!1,options:[{label:"Hourly rate for client services",value:1},{label:"Hourly rate for employee",value:2},{label:"Hourly rate for project",value:3},{label:"Fix price for project",value:4}]}}),pr_invoice_type_amount:a.ShortText({displayName:"Invoice Type Amount",description:"Amount for invoice type (only for hourly rate project or fix price)",required:!1}),pr_budget_type_id:a.StaticDropdown({displayName:"Budget Type",description:"Type of budget for this project",required:!1,options:{disabled:!1,options:[{label:"Total budget costs",value:1},{label:"Total budget hours",value:2},{label:"Budget for each client services",value:3},{label:"Budget for each employee",value:4}]}}),pr_budget_type_amount:a.ShortText({displayName:"Budget Type Amount",description:"Amount for budget type (only for total budget costs or total budget hours)",required:!1}),user_id:a.Dropdown({auth:g,displayName:"User",description:"User responsible for this project",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run({auth:e,propsValue:r}){let n=new h(e),t=r,i={name:t.name,pr_state_id:t.pr_state_id,pr_project_type_id:t.pr_project_type_id,contact_id:t.contact_id,user_id:t.user_id};if(t.document_nr&&(i.document_nr=t.document_nr),t.start_date){let u=t.start_date;i.start_date=u}if(t.end_date){let u=t.end_date;i.end_date=u}return t.comment&&(i.comment=t.comment),t.contact_sub_id&&(i.contact_sub_id=t.contact_sub_id),t.pr_invoice_type_id&&(i.pr_invoice_type_id=t.pr_invoice_type_id),t.pr_invoice_type_amount&&(i.pr_invoice_type_amount=t.pr_invoice_type_amount),t.pr_budget_type_id&&(i.pr_budget_type_id=t.pr_budget_type_id),t.pr_budget_type_amount&&(i.pr_budget_type_amount=t.pr_budget_type_amount),await n.post("/2.0/pr_project",i)}});var $u=O({auth:g,name:"create_sales_quote",displayName:"Create Sales Quote",description:"Create a new product-based sales quote",audience:"both",aiMetadata:{description:"Create a new Bexio sales quote (kb_offer) with required user, language, currency, payment type, bank account, tax handling, validity dates, and at least one line-item position (custom, article, text, subtotal, discount, or page-break). Not idempotent: each call creates a separate quote, so guard against duplicates. Requires resolved IDs for contact, currency, taxes, units, and accounts; look these up first if not known.",idempotent:!1},props:{document_nr:a.ShortText({displayName:"Document Number",description:"Quote number (required if automatic numbering is disabled)",required:!1}),title:a.ShortText({displayName:"Title",description:"Quote title",required:!1}),contact_id:a.Dropdown({auth:g,displayName:"Contact",description:"The contact for this quote",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),contact_sub_id:a.Dropdown({auth:g,displayName:"Contact Sub",description:"Contact sub-address (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),user_id:a.Dropdown({auth:g,displayName:"User",description:"User responsible for this quote",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),pr_project_id:a.Dropdown({auth:g,displayName:"Project",description:"Project associated with this quote",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project")).map(t=>({label:t.nr?`${t.name} (#${t.nr})`:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load projects",options:[]}}},"options")}),language_id:a.Dropdown({auth:g,displayName:"Language",description:"Language for the quote",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),bank_account_id:a.Dropdown({auth:g,displayName:"Bank Account",description:"Bank account for payment",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/banking/accounts")).map(t=>{let i=t.iban_nr||t.bank_account_nr;return{label:i?`${t.name} (${i})`:t.name,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load bank accounts",options:[]}}},"options")}),currency_id:a.Dropdown({auth:g,displayName:"Currency",description:"Currency for this quote",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/currencies")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load currencies",options:[]}}},"options")}),payment_type_id:a.Dropdown({auth:g,displayName:"Payment Type",description:"Payment type for this quote",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/payment_type")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load payment types",options:[]}}},"options")}),header:a.LongText({displayName:"Header",description:"Header text for the quote",required:!1}),footer:a.LongText({displayName:"Footer",description:"Footer text for the quote",required:!1}),mwst_type:a.StaticDropdown({displayName:"Tax Type",description:"How taxes are handled",required:!0,defaultValue:0,options:{disabled:!1,options:[{label:"Including taxes",value:0},{label:"Excluding taxes",value:1},{label:"Exempt from taxes",value:2}]}}),mwst_is_net:a.Checkbox({displayName:"Tax is Net",description:"If taxes are included, set to true to add taxes to total, false to include in total",required:!1,defaultValue:!1}),show_position_taxes:a.Checkbox({displayName:"Show Position Taxes",description:"Show taxes for each position",required:!1,defaultValue:!1}),is_valid_from:a.ShortText({displayName:"Valid From",description:"Quote valid from date (YYYY-MM-DD)",required:!0}),is_valid_until:a.ShortText({displayName:"Valid Until",description:"Quote valid until date (YYYY-MM-DD)",required:!0}),contact_address_manual:a.LongText({displayName:"Manual Contact Address",description:"Override contact address (leave empty to use contact address)",required:!1}),delivery_address_type:a.StaticDropdown({displayName:"Delivery Address Type",description:"Type of delivery address",required:!1,defaultValue:0,options:{disabled:!1,options:[{label:"Use Invoice Address",value:0},{label:"Use Custom Address",value:1}]}}),delivery_address_manual_text:a.LongText({displayName:"Manual Delivery Address",description:"Custom delivery address (only used if delivery address type is set to custom)",required:!1}),api_reference:a.ShortText({displayName:"API Reference",description:"Reference for API use (can only be edited via API)",required:!1}),viewed_by_client_at:a.DateTime({displayName:"Viewed By Client At",description:"Date when the quote was viewed by the client",required:!1}),kb_terms_of_payment_template_id:a.Number({displayName:"Terms of Payment Template ID",description:"Terms of payment template ID",required:!1}),template_slug:a.Dropdown({auth:g,displayName:"Document Template",description:"Document template for the quote",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/document_templates")).map(t=>({label:t.is_default?`${t.name} (Default)`:t.name,value:t.template_slug}))}}catch{return{disabled:!0,placeholder:"Failed to load templates",options:[]}}},"options")}),positionFields:a.DynamicProperties({auth:g,displayName:"Quote Positions",description:"Configure quote line items",required:!0,refreshers:["auth"],props:o(async({auth:e})=>{let r=[],n=[],t=[];if(e)try{let s=new h(e);r=await s.get("/2.0/unit").catch(()=>[]),n=await s.get("/accounts").catch(()=>[]),t=(await s.get("/3.0/taxes?types=sales_tax&scope=active").catch(()=>[])).map(m=>({id:m.id,name:m.display_name||m.name,percentage:m.value.toString()}))}catch{}let i=r.map(s=>({label:s.name,value:s.id})),c=n.map(s=>({label:`${s.account_no} - ${s.name}`,value:s.id})),u=t.map(s=>({label:`${s.name} (${s.percentage}%)`,value:s.id}));return{positions:a.Array({displayName:"Positions",description:"Quote line items",required:!0,properties:{type:a.StaticDropdown({displayName:"Position Type",description:"Type of quote position",required:!0,defaultValue:"KbPositionCustom",options:{disabled:!1,options:[{label:"Custom Position",value:"KbPositionCustom"},{label:"Article Position",value:"KbPositionArticle"},{label:"Text Position",value:"KbPositionText"},{label:"Subtotal Position",value:"KbPositionSubtotal"},{label:"Page Break Position",value:"KbPositionPagebreak"},{label:"Discount Position",value:"KbPositionDiscount"}]}}),amount:a.ShortText({displayName:"Amount",description:"Quantity/amount",required:!0}),unit_id:i.length>0?a.StaticDropdown({displayName:"Unit",description:"Unit of measurement",required:!1,options:{disabled:!1,options:i}}):a.Number({displayName:"Unit ID",description:"Unit ID (use List Units action to find IDs)",required:!1}),account_id:c.length>0?a.StaticDropdown({displayName:"Account",description:"Account for this position",required:!1,options:{disabled:!1,options:c}}):a.Number({displayName:"Account ID",description:"Account ID (use List Accounts action to find IDs)",required:!1}),tax_id:u.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (only active sales taxes)",required:!1,options:{disabled:!1,options:u}}):a.Number({displayName:"Tax ID",description:"Tax ID (use List Taxes action to find IDs)",required:!1}),text:a.LongText({displayName:"Description",description:"Position description/text",required:!1}),unit_price:a.ShortText({displayName:"Unit Price",description:"Price per unit (max 6 decimals)",required:!1}),discount_in_percent:a.ShortText({displayName:"Discount (%)",description:"Discount percentage (max 6 decimals)",required:!1}),parent_id:a.Number({displayName:"Parent ID",description:"Parent position ID (for grouped positions)",required:!1})}})}},"props")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={user_id:n.user_id,language_id:n.language_id,bank_account_id:n.bank_account_id,currency_id:n.currency_id,payment_type_id:n.payment_type_id,mwst_type:n.mwst_type,is_valid_from:n.is_valid_from,is_valid_until:n.is_valid_until};n.document_nr&&(t.document_nr=n.document_nr),n.title!==void 0&&(t.title=n.title||null),n.contact_id&&(t.contact_id=n.contact_id),n.contact_sub_id&&(t.contact_sub_id=n.contact_sub_id),n.pr_project_id&&(t.pr_project_id=n.pr_project_id),n.header&&(t.header=n.header),n.footer&&(t.footer=n.footer),n.mwst_is_net!==void 0&&(t.mwst_is_net=n.mwst_is_net),n.show_position_taxes!==void 0&&(t.show_position_taxes=n.show_position_taxes),n.contact_address_manual&&(t.contact_address_manual=n.contact_address_manual),n.delivery_address_type!==void 0&&(t.delivery_address_type=n.delivery_address_type),n.delivery_address_manual_text&&(t.delivery_address_manual=n.delivery_address_manual_text),n.api_reference&&(t.api_reference=n.api_reference),n.viewed_by_client_at&&(t.viewed_by_client_at=n.viewed_by_client_at),n.kb_terms_of_payment_template_id&&(t.kb_terms_of_payment_template_id=n.kb_terms_of_payment_template_id),n.template_slug&&(t.template_slug=n.template_slug);let i=n.positionFields;return i&&i.positions&&Array.isArray(i.positions)&&(t.positions=i.positions.map(u=>{let s={type:u.type||"KbPositionCustom"};return u.amount&&(s.amount=u.amount),u.unit_id&&(s.unit_id=u.unit_id),u.account_id&&(s.account_id=u.account_id),u.tax_id&&(s.tax_id=u.tax_id),u.text&&(s.text=u.text),u.unit_price&&(s.unit_price=u.unit_price),u.discount_in_percent&&(s.discount_in_percent=u.discount_in_percent),u.parent_id&&(s.parent_id=u.parent_id),s})),await r.post("/2.0/kb_offer",t)}});var wu=O({auth:g,name:"create_time_tracking",displayName:"Create Time Tracking",description:"Create a new timesheet entry",audience:"both",aiMetadata:{description:"Logs a new timesheet entry in Bexio for a user against a client service/business activity, recording time either as a duration on a date or as a from/to range. Use to record worked or billable hours, optionally tying it to a contact, project, or milestone. Requires a user, client service, billable flag, and the tracking details for the chosen mode. Not idempotent: each call creates a separate entry.",idempotent:!1},props:{user_id:a.Dropdown({auth:g,displayName:"User",description:"User for this timesheet entry",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),status_id:a.Dropdown({auth:g,displayName:"Status",description:"Timesheet status",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/timesheet_status").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load timesheet statuses",options:[]}}},"options")}),client_service_id:a.Dropdown({auth:g,displayName:"Client Service",description:"Business activity/client service",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/client_service").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load client services",options:[]}}},"options")}),text:a.LongText({displayName:"Description",description:"Description of the work performed",required:!1}),allowable_bill:a.Checkbox({displayName:"Allowable Bill",description:"Whether this time is billable",required:!0,defaultValue:!0}),charge:a.ShortText({displayName:"Charge",description:"Charge amount",required:!1}),contact_id:a.Dropdown({auth:g,displayName:"Contact",description:"Contact associated with this timesheet",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),sub_contact_id:a.Dropdown({auth:g,displayName:"Sub Contact",description:"Sub contact (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),pr_project_id:a.Dropdown({auth:g,displayName:"Project",description:"Project associated with this timesheet",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project")).map(t=>({label:t.nr?`${t.name} (#${t.nr})`:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load projects",options:[]}}},"options")}),pr_package_id:a.Number({displayName:"Package ID",description:"Project package ID",required:!1}),pr_milestone_id:a.Number({displayName:"Milestone ID",description:"Project milestone ID",required:!1}),estimated_time:a.ShortText({displayName:"Estimated Time",description:"Estimated time (format: HH:MM)",required:!1}),tracking_type:a.StaticDropdown({displayName:"Tracking Type",description:"Type of time tracking",required:!0,defaultValue:"duration",options:{disabled:!1,options:[{label:"Duration",value:"duration"},{label:"Range",value:"range"}]}}),tracking_details:a.DynamicProperties({auth:g,displayName:"Tracking Details",description:"Time tracking details",required:!0,refreshers:["tracking_type"],props:o(async({tracking_type:e})=>{let r=e||"duration",n={};return r==="duration"?(n.date=a.ShortText({displayName:"Date",description:"Date of the timesheet entry (YYYY-MM-DD)",required:!0}),n.duration=a.ShortText({displayName:"Duration",description:"Duration of time tracked (format: HH:MM)",required:!0})):(n.from=a.DateTime({displayName:"From",description:"Start date and time",required:!0}),n.to=a.DateTime({displayName:"To",description:"End date and time",required:!0})),n},"props")})},async run({auth:e,propsValue:r}){let n=new h(e),t=r,i={user_id:t.user_id,client_service_id:t.client_service_id,allowable_bill:t.allowable_bill};t.status_id&&(i.status_id=t.status_id),t.text&&(i.text=t.text),t.charge&&(i.charge=t.charge),t.contact_id&&(i.contact_id=t.contact_id),t.sub_contact_id&&(i.sub_contact_id=t.sub_contact_id),t.pr_project_id&&(i.pr_project_id=t.pr_project_id),t.pr_package_id&&(i.pr_package_id=t.pr_package_id),t.pr_milestone_id&&(i.pr_milestone_id=t.pr_milestone_id),t.estimated_time&&(i.estimated_time=t.estimated_time);let c=t.tracking_type,u=t.tracking_details,s={type:c};return c==="duration"?(s.date=u.date,s.duration=u.duration):(s.from=u.from,s.to=u.to),i.tracking=s,await n.post("/2.0/timesheet",i)}});var Eu=O({auth:g,name:"update_company",displayName:"Update Company",description:"Update an existing company contact",audience:"both",aiMetadata:{description:"Updates fields on an existing company-type contact in Bexio identified by its contact id; only supplied fields change. Use to modify a known organization; pick Create Company to add a new one or Update Person for an individual. Resolve the contact id with Find Company first. Idempotent: re-sending the same values converges to the same contact state.",idempotent:!0},props:{contact_id:a.Dropdown({auth:g,displayName:"Company",description:"Select the company to update",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).filter(i=>i.contact_type_id===1).map(i=>({label:i.nr?`${i.name_1} (#${i.nr})`:i.name_1,value:i.id}))}}catch{return{disabled:!0,placeholder:"Failed to load companies",options:[]}}},"options")}),name_1:a.ShortText({displayName:"Company Name",description:"The name of the company",required:!1}),name_2:a.ShortText({displayName:"Company Addition",description:'Additional company name (e.g., "Ltd.", "Inc.")',required:!1}),nr:a.ShortText({displayName:"Contact Number",description:"Contact number (leave empty to keep current or auto-assign)",required:!1}),salutation_id:a.Dropdown({auth:g,displayName:"Salutation",description:"Salutation for the company",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/salutation")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load salutations",options:[]}}},"options")}),title_id:a.Dropdown({auth:g,displayName:"Title",description:"Title for the company",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/title")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load titles",options:[]}}},"options")}),street_name:a.ShortText({displayName:"Street Name",description:"Street name",required:!1}),house_number:a.ShortText({displayName:"House Number",description:"House number",required:!1}),address_addition:a.ShortText({displayName:"Address Addition",description:"Additional address information",required:!1}),postcode:a.ShortText({displayName:"Postcode",description:"Postal code",required:!1}),city:a.ShortText({displayName:"City",description:"City",required:!1}),country_id:a.Dropdown({auth:g,displayName:"Country",description:"Country",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/country")).map(t=>({label:`${t.name} (${t.name_short})`,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load countries",options:[]}}},"options")}),mail:a.ShortText({displayName:"Email",description:"Primary email address",required:!1}),mail_second:a.ShortText({displayName:"Secondary Email",description:"Secondary email address",required:!1}),phone_fixed:a.ShortText({displayName:"Phone",description:"Fixed phone number",required:!1}),phone_fixed_second:a.ShortText({displayName:"Secondary Phone",description:"Secondary fixed phone number",required:!1}),phone_mobile:a.ShortText({displayName:"Mobile Phone",description:"Mobile phone number",required:!1}),fax:a.ShortText({displayName:"Fax",description:"Fax number",required:!1}),url:a.ShortText({displayName:"Website URL",description:"Company website URL",required:!1}),skype_name:a.ShortText({displayName:"Skype Name",description:"Skype username",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional notes about the company",required:!1}),language_id:a.Dropdown({auth:g,displayName:"Language",description:"Preferred language",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),contact_group_ids:a.MultiSelectDropdown({auth:g,displayName:"Contact Groups",description:"Select contact groups",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_group")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact groups",options:[]}}},"options")}),contact_branch_ids:a.MultiSelectDropdown({auth:g,displayName:"Contact Sectors",description:"Select contact sectors",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_branch")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact sectors",options:[]}}},"options")}),user_id:a.Dropdown({auth:g,displayName:"User",description:"User assigned to this contact",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),owner_id:a.Dropdown({auth:g,displayName:"Owner",description:"Owner of this contact",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run(e){let r=new h(e.auth),n=e.propsValue.contact_id,t=e.propsValue,i={contact_type_id:1};return t.name_1&&(i.name_1=t.name_1),t.name_2!==void 0&&(i.name_2=t.name_2||null),t.nr!==void 0&&t.nr!==null&&t.nr!==""?i.nr=t.nr:t.nr===""&&(i.nr=null),t.salutation_id&&(i.salutation_id=t.salutation_id),t.title_id&&(i.title_id=t.title_id),t.street_name&&(i.street_name=t.street_name),t.house_number&&(i.house_number=t.house_number),t.address_addition&&(i.address_addition=t.address_addition),t.postcode&&(i.postcode=t.postcode),t.city&&(i.city=t.city),t.country_id&&(i.country_id=t.country_id),t.mail&&(i.mail=t.mail),t.mail_second&&(i.mail_second=t.mail_second),t.phone_fixed&&(i.phone_fixed=t.phone_fixed),t.phone_fixed_second&&(i.phone_fixed_second=t.phone_fixed_second),t.phone_mobile&&(i.phone_mobile=t.phone_mobile),t.fax&&(i.fax=t.fax),t.url&&(i.url=t.url),t.skype_name&&(i.skype_name=t.skype_name),t.remarks&&(i.remarks=t.remarks),t.language_id&&(i.language_id=t.language_id),t.contact_group_ids&&Array.isArray(t.contact_group_ids)&&t.contact_group_ids.length>0&&(i.contact_group_ids=t.contact_group_ids.join(",")),t.contact_branch_ids&&Array.isArray(t.contact_branch_ids)&&t.contact_branch_ids.length>0&&(i.contact_branch_ids=t.contact_branch_ids.join(",")),t.user_id&&(i.user_id=t.user_id),t.owner_id&&(i.owner_id=t.owner_id),await r.post(`/2.0/contact/${n}`,i)}});var ku=O({auth:g,name:"find_account",displayName:"Find Account",description:"Search for accounts using various criteria",audience:"both",aiMetadata:{description:"Searches the Bexio chart of accounts by number, name, type, or account group with operators such as contains, equals, or comparison, with paging. Use to resolve an account to its id before booking a manual entry or assigning an account on a product/position. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding accounts",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"Account Number",value:"account_no"},{label:"Account Name",value:"name"},{label:"Account Type",value:"account_type"},{label:"Account Group ID",value:"fibu_account_group_id"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"}]}})}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.limit,c=r.offset,u=t.map(m=>({field:m.field,value:m.value,criteria:m.criteria||"like"})),s={};return i!==void 0&&(s.limit=i.toString()),c!==void 0&&(s.offset=c.toString()),await n.post("/2.0/accounts/search",u,s)}});var Nu=O({auth:g,name:"find_company",displayName:"Find Company",description:"Search for company contacts using various criteria",audience:"both",aiMetadata:{description:"Searches Bexio contacts for companies, matching one or more field criteria (name, number, email, city, country, etc.) with operators such as contains, equals, or comparison; results are automatically filtered to company-type contacts. Use to locate a company before referencing or updating it; pick Find Country/Find Product/Find Account for those object types. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding companies",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Company Name",value:"name_1"},{label:"Company Addition",value:"name_2"},{label:"Contact Number",value:"nr"},{label:"Address",value:"address"},{label:"Email",value:"mail"},{label:"Secondary Email",value:"mail_second"},{label:"Postcode",value:"postcode"},{label:"City",value:"city"},{label:"Country ID",value:"country_id"},{label:"Contact Group IDs",value:"contact_group_ids"},{label:"Contact Type ID",value:"contact_type_id"},{label:"Updated At",value:"updated_at"},{label:"User ID",value:"user_id"},{label:"Phone",value:"phone_fixed"},{label:"Mobile Phone",value:"phone_mobile"},{label:"Fax",value:"fax"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Contact Number",value:"nr"},{label:"Company Name",value:"name_1"},{label:"Updated At",value:"updated_at"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0}),show_archived:a.Checkbox({displayName:"Show Archived",description:"Show archived contacts only",required:!1,defaultValue:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=r.show_archived,p=t.map(x=>({field:x.field,value:x.value,criteria:x.criteria||"like"}));t.some(x=>x.field==="contact_type_id")||p.push({field:"contact_type_id",value:"1",criteria:"="});let f={};return i&&(f.order_by=i),c!==void 0&&(f.limit=c.toString()),u!==void 0&&(f.offset=u.toString()),s!==void 0&&(f.show_archived=s.toString()),await n.post("/2.0/contact/search",p,f)}});var zu=O({auth:g,name:"find_person",displayName:"Find Person",description:"Search for person contacts using various criteria",audience:"both",aiMetadata:{description:"Search Bexio person contacts (contact_type 2; companies are excluded) by one or more field/operator/value criteria such as name, email, phone, or contact number. Read-only and repeatable; returns matching person records and supports ordering, limit, and offset paging. Use to look up a person before referencing them in another action; for company contacts use the company-oriented lookup instead.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding persons",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"First Name (name_1)",value:"name_1"},{label:"Last Name (name_2)",value:"name_2"},{label:"Contact Number",value:"nr"},{label:"Address",value:"address"},{label:"Email",value:"mail"},{label:"Secondary Email",value:"mail_second"},{label:"Postcode",value:"postcode"},{label:"City",value:"city"},{label:"Country ID",value:"country_id"},{label:"Contact Group IDs",value:"contact_group_ids"},{label:"Contact Type ID",value:"contact_type_id"},{label:"Updated At",value:"updated_at"},{label:"User ID",value:"user_id"},{label:"Fixed Phone",value:"phone_fixed"},{label:"Mobile Phone",value:"phone_mobile"},{label:"Fax",value:"fax"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array of values)",value:"in"},{label:"Not In (array of values)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to sort the results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Contact Number",value:"nr"},{label:"First Name",value:"name_1"},{label:"Updated At",value:"updated_at"}]}}),order_direction:a.StaticDropdown({displayName:"Order Direction",description:"Sort order",required:!1,defaultValue:"asc",options:{disabled:!1,options:[{label:"Ascending",value:"asc"},{label:"Descending",value:"desc"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0}),show_archived:a.Checkbox({displayName:"Show Archived",description:"Include archived contacts in the search results",required:!1,defaultValue:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.order_direction,u=r.limit,s=r.offset,p=r.show_archived,m=[...t],f=m.findIndex(d=>d.field==="contact_type_id");f===-1?m.push({field:"contact_type_id",value:"2",criteria:"="}):m[f].value!=="2"&&(m[f].value="2",m[f].criteria="=");let A={};return i&&(A.order_by=`${i}${c==="desc"?"_desc":""}`),u!==void 0&&(A.limit=u.toString()),s!==void 0&&(A.offset=s.toString()),p!==void 0&&(A.show_archived=p.toString()),await n.post("/2.0/contact/search",m,A)}});var Du=O({auth:g,name:"find_product",displayName:"Find Product",description:"Search for products by name or code",audience:"both",aiMetadata:{description:"Searches Bexio products/articles by internal name or internal code with operators such as contains or equals, with ordering and paging. Use to resolve a product to its id before referencing it on an invoice/order position or before Update Product. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding products",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"Internal Name",value:"intern_name"},{label:"Internal Code",value:"intern_code"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Internal Name",value:"intern_name"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(f=>({field:f.field,value:f.value,criteria:f.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/article/search",s,p)}});var Ou=O({auth:g,name:"find_country",displayName:"Find Country",description:"Search for countries using various criteria",audience:"both",aiMetadata:{description:"Searches the Bexio country list by name or short code with operators such as contains or equals. Use to resolve a country to its id before setting country_id on a contact or other record. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding countries",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"Country Name",value:"name"},{label:"Country Code (Short)",value:"name_short"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Country Name",value:"name"},{label:"Country Code",value:"name_short"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(f=>({field:f.field,value:f.value,criteria:f.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/country/search",s,p)}});var Cu=O({auth:g,name:"search_invoice",displayName:"Search Invoice",description:"Search for invoices using various criteria",audience:"both",aiMetadata:{description:"Searches Bexio sales invoices by one or more field criteria (document number, contact, status, totals, dates, etc.) with operators such as contains, equals, or comparison, with ordering and paging. Use to locate invoices before exporting, sending, or reconciling them; pick Search Order or Search Quote for those document types. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding invoices",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Status ID",value:"kb_item_status_id"},{label:"Document Number",value:"document_nr"},{label:"Title",value:"title"},{label:"API Reference",value:"api_reference"},{label:"Contact ID",value:"contact_id"},{label:"Sub Contact ID",value:"contact_sub_id"},{label:"User ID",value:"user_id"},{label:"Currency ID",value:"currency_id"},{label:"Total Gross",value:"total_gross"},{label:"Total Net",value:"total_net"},{label:"Total",value:"total"},{label:"Valid From",value:"is_valid_from"},{label:"Valid To",value:"is_valid_to"},{label:"Updated At",value:"updated_at"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Total",value:"total"},{label:"Total Net",value:"total_net"},{label:"Total Gross",value:"total_gross"},{label:"Updated At",value:"updated_at"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(f=>({field:f.field,value:f.value,criteria:f.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/kb_invoice/search",s,p)}});var Ru=O({auth:g,name:"search_order",displayName:"Search Order",description:"Search for orders using various criteria",audience:"both",aiMetadata:{description:"Searches Bexio sales orders by one or more field criteria (document number, contact, status, totals, dates, etc.) with operators such as contains, equals, or comparison, with ordering and paging. Use to locate orders before referencing or processing them; pick Search Invoice or Search Quote for those document types. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding orders",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Status ID",value:"kb_item_status_id"},{label:"Document Number",value:"document_nr"},{label:"Title",value:"title"},{label:"Contact ID",value:"contact_id"},{label:"Sub Contact ID",value:"contact_sub_id"},{label:"User ID",value:"user_id"},{label:"Currency ID",value:"currency_id"},{label:"Total Gross",value:"total_gross"},{label:"Total Net",value:"total_net"},{label:"Total",value:"total"},{label:"Valid From",value:"is_valid_from"},{label:"Valid To",value:"is_valid_to"},{label:"Updated At",value:"updated_at"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Total",value:"total"},{label:"Total Net",value:"total_net"},{label:"Total Gross",value:"total_gross"},{label:"Updated At",value:"updated_at"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(f=>({field:f.field,value:f.value,criteria:f.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/kb_order/search",s,p)}});var Uu=O({auth:g,name:"search_quote",displayName:"Search Quote",description:"Search for quotes using various criteria",audience:"both",aiMetadata:{description:"Searches Bexio quotes (offers) by one or more field criteria (document number, contact, status, totals, dates, valid-until, etc.) with operators such as contains, equals, or comparison, with ordering and paging. Use to locate quotes before referencing or following up on them; pick Search Invoice or Search Order for those document types. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding quotes",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Status ID",value:"kb_item_status_id"},{label:"Document Number",value:"document_nr"},{label:"Title",value:"title"},{label:"Contact ID",value:"contact_id"},{label:"Sub Contact ID",value:"contact_sub_id"},{label:"User ID",value:"user_id"},{label:"Currency ID",value:"currency_id"},{label:"Total Gross",value:"total_gross"},{label:"Total Net",value:"total_net"},{label:"Total",value:"total"},{label:"Valid From",value:"is_valid_from"},{label:"Valid To",value:"is_valid_to"},{label:"Valid Until",value:"is_valid_until"},{label:"Updated At",value:"updated_at"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Total",value:"total"},{label:"Total Net",value:"total_net"},{label:"Total Gross",value:"total_gross"},{label:"Updated At",value:"updated_at"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(f=>({field:f.field,value:f.value,criteria:f.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/kb_offer/search",s,p)}});var Er=Ae(bt());var wr={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r})=>{let n=new h(e),t=r===0,i=t?(0,Er.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,Er.default)(r).format("YYYY-MM-DD HH:mm:ss"),c=[{field:"contact_type_id",value:"1",criteria:"="},{field:"updated_at",value:i,criteria:">="}],u={order_by:"updated_at_desc",limit:t?"5":"500"};return(await n.post("/2.0/contact/search",c,u)).map(p=>{let m=p.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,Er.default)(m).valueOf(),data:p}})},"items")},Mu=ve({auth:g,name:"new_updated_company",displayName:"New/Updated Company",description:"Triggers when a company is added or updated",aiMetadata:{description:"Fires when a company contact is created or its updated timestamp changes in Bexio. Emits each matching company with its name, address, contact details (email, phone), group memberships, and lead status. Use to react to new or modified organization contacts."},type:"POLLING",props:{},sampleData:{id:4,nr:null,contact_type_id:1,name_1:"Example Company",name_2:null,salutation_id:2,salutation_form:null,title_id:null,birthday:null,address:"Smith Street 22",street_name:"Smith Street",house_number:"77",address_addition:"Building C",postcode:"8004",city:"Zurich",country_id:1,mail:"contact@example.org",mail_second:"",phone_fixed:"",phone_fixed_second:"",phone_mobile:"",fax:"",url:"",skype_name:"",remarks:"",language_id:null,is_lead:!1,contact_group_ids:"1,2",contact_branch_ids:null,user_id:1,owner_id:1,updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await Y.onEnable(wr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await Y.onDisable(wr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await Y.test(wr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await Y.poll(wr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Nr=Ae(bt());var kr={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r,propsValue:n})=>{let t=new h(e),i=r===0,u=[{field:"updated_at",value:i?(0,Nr.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,Nr.default)(r).format("YYYY-MM-DD HH:mm:ss"),criteria:">="}];n.status_id!==void 0&&n.status_id!==null&&u.push({field:"kb_item_status_id",value:n.status_id.toString(),criteria:"="});let s={order_by:"updated_at_desc",limit:i?"5":"500"};return(await t.post("/2.0/kb_invoice/search",u,s)).map(m=>{let f=m.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,Nr.default)(f).valueOf(),data:m}})},"items")},Lu=ve({auth:g,name:"new_sales_invoice",displayName:"New Sales-Invoice",description:"Triggers when a Sales-Invoice is created or updated with the chosen status",aiMetadata:{description:"Fires when a sales invoice is created or its updated timestamp changes in Bexio, optionally filtered to a chosen invoice status. Emits each matching invoice with its document number, contact, totals (gross, net, taxes), validity dates, and status. Use to react to new or modified customer invoices."},type:"POLLING",props:{status_id:a.Dropdown({auth:g,displayName:"Status",description:"Filter invoices by status (leave empty to trigger for all statuses)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{let n=await new h(e).get("/2.0/kb_invoice_status").catch(()=>[]);return n.length===0?{disabled:!1,placeholder:"Status filter not available - will trigger for all statuses",options:[]}:{disabled:!1,options:n.map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!1,placeholder:"Enter status ID manually or leave empty for all statuses",options:[]}}},"options")})},sampleData:{id:4,document_nr:"RE-00001",title:null,contact_id:14,contact_sub_id:null,user_id:1,project_id:null,language_id:1,bank_account_id:1,currency_id:1,payment_type_id:1,total_gross:"17.800000",total_net:"17.800000",total_taxes:"1.3706",total:"19.150000",kb_item_status_id:3,is_valid_from:"2019-06-24",is_valid_to:"2019-07-24",updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await Y.onEnable(kr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await Y.onDisable(kr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await Y.test(kr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await Y.poll(kr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Dr=Ae(bt());var zr={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r,propsValue:n})=>{let t=new h(e),i=r===0,u=[{field:"updated_at",value:i?(0,Dr.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,Dr.default)(r).format("YYYY-MM-DD HH:mm:ss"),criteria:">="}];n.status_id!==void 0&&n.status_id!==null&&u.push({field:"kb_item_status_id",value:n.status_id.toString(),criteria:"="});let s={order_by:"updated_at_desc",limit:i?"5":"500"};return(await t.post("/2.0/kb_order/search",u,s)).map(m=>{let f=m.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,Dr.default)(f).valueOf(),data:m}})},"items")},ju=ve({auth:g,name:"new_order",displayName:"New Order",description:"Triggers when an Order is created or updated with the chosen status",aiMetadata:{description:"Fires when a sales order is created or its updated timestamp changes in Bexio, optionally filtered to a chosen order status. Emits each matching order with its document number, contact, totals (gross, net, taxes), valid-from date, and status. Use to react to new or modified orders."},type:"POLLING",props:{status_id:a.Dropdown({auth:g,displayName:"Status",description:"Filter orders by status (leave empty to trigger for all statuses)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{let n=await new h(e).get("/2.0/kb_order_status").catch(()=>[]);return n.length===0?{disabled:!1,placeholder:"Status filter not available - will trigger for all statuses",options:[]}:{disabled:!1,options:n.map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!1,placeholder:"Enter status ID manually or leave empty for all statuses",options:[]}}},"options")})},sampleData:{id:4,document_nr:"AU-00001",title:null,contact_id:14,contact_sub_id:null,user_id:1,project_id:null,language_id:1,bank_account_id:1,currency_id:1,payment_type_id:1,total_gross:"17.800000",total_net:"17.800000",total_taxes:"1.3706",total:"19.150000",kb_item_status_id:5,is_valid_from:"2019-06-24",updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await Y.onEnable(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await Y.onDisable(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await Y.test(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await Y.poll(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Cr=Ae(bt());var Or={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r})=>{let n=new h(e),t=r===0,i=t?(0,Cr.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,Cr.default)(r).format("YYYY-MM-DD HH:mm:ss"),c=[{field:"contact_type_id",value:"2",criteria:"="},{field:"updated_at",value:i,criteria:">="}],u={order_by:"updated_at_desc",limit:t?"5":"500"};return(await n.post("/2.0/contact/search",c,u)).map(p=>{let m=p.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,Cr.default)(m).valueOf(),data:p}})},"items")},Fu=ve({auth:g,name:"new_updated_person",displayName:"New/Updated Person",description:"Triggers when a person is added or updated",aiMetadata:{description:"Fires when a person contact is created or its updated timestamp changes in Bexio. Emits each matching person with their name, address, contact details (email, phone), birthday, group memberships, and lead status. Use to react to new or modified individual contacts."},type:"POLLING",props:{},sampleData:{id:4,nr:null,contact_type_id:2,name_1:"John",name_2:"Doe",salutation_id:1,salutation_form:null,title_id:null,birthday:"1990-01-01",address:"Smith Street 22",street_name:"Smith Street",house_number:"77",address_addition:"Building C",postcode:"8004",city:"Zurich",country_id:1,mail:"john.doe@example.org",mail_second:"",phone_fixed:"",phone_fixed_second:"",phone_mobile:"",fax:"",url:"",skype_name:"",remarks:"",language_id:null,is_lead:!1,contact_group_ids:"1,2",contact_branch_ids:null,user_id:1,owner_id:1,updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await Y.onEnable(Or,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await Y.onDisable(Or,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await Y.test(Or,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await Y.poll(Or,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Rr={strategy:1,items:o(async({auth:e,lastItemId:r})=>{let n=new h(e),t={limit:"500"};return(await n.get("/2.0/article",t)).sort((u,s)=>s.id-u.id).map(u=>({id:u.id,data:u}))},"items")},qu=ve({auth:g,name:"new_product",displayName:"New Product",description:"Triggers when a new product is created",aiMetadata:{description:"Fires when a new product (article) is created in Bexio. Polls the article list and emits each newly added product, including its codes, names, pricing, stock levels, and accounting references. Use to react to additions to the product catalog."},type:"POLLING",props:{},sampleData:{id:4,user_id:1,article_type_id:1,contact_id:14,deliverer_code:null,deliverer_name:null,deliverer_description:null,intern_code:"wh-2019",intern_name:"Webhosting",intern_description:null,purchase_price:null,sale_price:null,purchase_total:null,sale_total:null,currency_id:null,tax_income_id:null,tax_id:null,tax_expense_id:null,unit_id:null,is_stock:!1,stock_id:null,stock_place_id:null,stock_nr:0,stock_min_nr:0,stock_reserved_nr:0,stock_available_nr:0,stock_picked_nr:0,stock_disposed_nr:0,stock_ordered_nr:0,width:null,height:null,weight:null,volume:null,html_text:null,remarks:null,delivery_price:null,article_group_id:null,account_id:null,expense_account_id:null},onEnable:o(async e=>{await Y.onEnable(Rr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await Y.onDisable(Rr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await Y.test(Rr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await Y.poll(Rr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Ur={strategy:1,items:o(async({auth:e,lastItemId:r,propsValue:n})=>{let t=new h(e),i=[{field:"name",value:"",criteria:"not_null"}];n.status_id!==void 0&&n.status_id!==null&&i.push({field:"pr_state_id",value:n.status_id.toString(),criteria:"="});let c={order_by:"id_desc",limit:"500"};return(await t.post("/2.0/pr_project/search",i,c)).map(s=>({id:s.id,data:s}))},"items")},Bu=ve({auth:g,name:"new_project",displayName:"New Project",description:"Triggers when a Project is created or updated with the chosen status",aiMetadata:{description:"Fires when a project is created or updated in Bexio, optionally filtered to a chosen project status. Emits each matching project with its number, name, dates, status, type, contact, invoicing and budget settings. Use to track new or changing projects."},type:"POLLING",props:{status_id:a.Dropdown({auth:g,displayName:"Status",description:"Filter projects by status (leave empty to trigger for all statuses)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{let n=await new h(e).get("/2.0/pr_project_state").catch(()=>[]);return n.length===0?{disabled:!1,placeholder:"Status filter not available - will trigger for all statuses",options:[]}:{disabled:!1,options:n.map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!1,placeholder:"Enter status ID manually or leave empty for all statuses",options:[]}}},"options")})},sampleData:{id:2,uuid:"046b6c7f-0b8a-43b9-b35d-6489e6daee91",nr:"000002",name:"Villa Kunterbunt",start_date:"2019-07-12 00:00:00",end_date:null,comment:"",pr_state_id:2,pr_project_type_id:2,contact_id:2,contact_sub_id:null,pr_invoice_type_id:3,pr_invoice_type_amount:"230.00",pr_budget_type_id:1,pr_budget_type_amount:"200.00",user_id:1},onEnable:o(async e=>{await Y.onEnable(Ur,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await Y.onDisable(Ur,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await Y.test(Ur,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await Y.poll(Ur,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Lr=Ae(bt());var Mr={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r,propsValue:n})=>{let t=new h(e),i=r===0,u=[{field:"updated_at",value:i?(0,Lr.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,Lr.default)(r).format("YYYY-MM-DD HH:mm:ss"),criteria:">="}];n.status_id!==void 0&&n.status_id!==null&&u.push({field:"kb_item_status_id",value:n.status_id.toString(),criteria:"="});let s={order_by:"updated_at_desc",limit:i?"5":"500"};return(await t.post("/2.0/kb_offer/search",u,s)).map(m=>{let f=m.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,Lr.default)(f).valueOf(),data:m}})},"items")},Vu=ve({auth:g,name:"new_quote",displayName:"New Quotes",description:"Triggers when a quote is created or updated with the chosen status",aiMetadata:{description:"Fires when a quote (offer) is created or its updated timestamp changes in Bexio, optionally filtered to a chosen quote status. Emits each matching quote with its document number, contact, totals (gross, net, taxes), validity dates, and status. Use to react to new or modified quotes."},type:"POLLING",props:{status_id:a.Dropdown({auth:g,displayName:"Status",description:"Filter quotes by status (leave empty to trigger for all statuses)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{let n=await new h(e).get("/2.0/kb_offer_status").catch(()=>[]);return n.length===0?{disabled:!1,placeholder:"Status filter not available - will trigger for all statuses",options:[]}:{disabled:!1,options:n.map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!1,placeholder:"Enter status ID manually or leave empty for all statuses",options:[]}}},"options")})},sampleData:{id:4,document_nr:"AN-00001",title:null,contact_id:14,contact_sub_id:null,user_id:1,project_id:null,language_id:1,bank_account_id:1,currency_id:1,payment_type_id:1,total_gross:"17.800000",total_net:"17.800000",total_taxes:"1.3706",total:"19.150000",kb_item_status_id:3,is_valid_from:"2019-06-24",is_valid_until:"2019-07-24",updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await Y.onEnable(Mr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await Y.onDisable(Mr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await Y.test(Mr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await Y.poll(Mr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var vm=ea({displayName:"Bexio",description:"Swiss business software for accounting, invoicing, and project management",auth:g,minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/bexio.png",authors:["onyedikachi-david"],categories:["BUSINESS_INTELLIGENCE"],actions:[fu,gu,yu,hu,Eu,ku,Nu,zu,Du,Ou,Cu,Ru,Uu,bu,vu,xu,Pu,Tu,Su,Au,Iu,$u,wu,mu({baseUrl:o(()=>"https://api.bexio.com","baseUrl"),auth:g,authMapping:o(async e=>({Authorization:`Bearer ${e.access_token}`}),"authMapping")})],triggers:[Mu,Fu,qu,Bu,Lu,ju,Vu]});0&&(module.exports={bexio});
1
+ "use strict";var mc=Object.create;var St=Object.defineProperty;var fc=Object.getOwnPropertyDescriptor;var gc=Object.getOwnPropertyNames;var yc=Object.getPrototypeOf,hc=Object.prototype.hasOwnProperty;var o=(e,r)=>St(e,"name",{value:r,configurable:!0});var z=(e,r)=>()=>{try{return r||e((r={exports:{}}).exports,r),r.exports}catch(n){throw r=0,n}},ti=(e,r)=>{for(var n in r)St(e,n,{get:r[n],enumerable:!0})},ri=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of gc(r))!hc.call(e,i)&&i!==n&&St(e,i,{get:()=>r[i],enumerable:!(t=fc(r,i))||t.enumerable});return e};var Ee=(e,r,n)=>(n=e!=null?mc(yc(e)):{},ri(r||!e||!e.__esModule?St(n,"default",{value:e,enumerable:!0}):n,e)),_c=e=>ri(St({},"__esModule",{value:!0}),e);var $o=z((Eo,_r)=>{(function(e){"use strict";let r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},t=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",s={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${r}\\.${r}\\.${r}\\.${r}(${c})?$`,"i")};function p(d,_){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let P=0,b=-1,T=(d.match(s.zoneIndex)||[])[0],S,Z;for(T&&(T=T.substring(1),d=d.replace(/%.+$/,""));(b=d.indexOf(":",b+1))>=0;)P++;if(d.substr(0,2)==="::"&&P--,d.substr(-2,2)==="::"&&P--,P>_)return null;for(Z=_-P,S=":";Z--;)S+="0:";return d=d.replace("::",S),d[0]===":"&&(d=d.slice(1)),d[d.length-1]===":"&&(d=d.slice(0,-1)),_=(function(){let se=d.split(":"),he=[];for(let Te=0;Te<se.length;Te++)he.push(parseInt(se[Te],16));return he})(),{parts:_,zoneId:T}}o(p,"expandIPv6");function g(d,_,P,b){if(d.length!==_.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let T=0,S;for(;b>0;){if(S=P-b,S<0&&(S=0),d[T]>>S!==_[T]>>S)return!1;b-=P,T+=1}return!0}o(g,"matchCIDR");function m(d){if(i.test(d))return parseInt(d,16);if(d[0]==="0"&&!isNaN(parseInt(d[1],10))){if(t.test(d))return parseInt(d,8);throw new Error(`ipaddr: cannot parse ${d} as octal`)}return parseInt(d,10)}o(m,"parseIntAuto");function A(d,_){for(;d.length<_;)d=`0${d}`;return d}o(A,"padPart");let x={};x.IPv4=(function(){function d(_){if(_.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let P,b;for(P=0;P<_.length;P++)if(b=_[P],!(0<=b&&b<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=_}return o(d,"IPv4"),d.prototype.SpecialRanges={unspecified:[[new d([0,0,0,0]),8]],broadcast:[[new d([255,255,255,255]),32]],multicast:[[new d([224,0,0,0]),4]],linkLocal:[[new d([169,254,0,0]),16]],loopback:[[new d([127,0,0,0]),8]],carrierGradeNat:[[new d([100,64,0,0]),10]],private:[[new d([10,0,0,0]),8],[new d([172,16,0,0]),12],[new d([192,168,0,0]),16]],reserved:[[new d([192,0,0,0]),24],[new d([192,0,2,0]),24],[new d([192,88,99,0]),24],[new d([198,18,0,0]),15],[new d([198,51,100,0]),24],[new d([203,0,113,0]),24],[new d([240,0,0,0]),4]],as112:[[new d([192,175,48,0]),24],[new d([192,31,196,0]),24]],amt:[[new d([192,52,193,0]),24]]},d.prototype.kind=function(){return"ipv4"},d.prototype.match=function(_,P){let b;if(P===void 0&&(b=_,_=b[0],P=b[1]),_.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return g(this.octets,_.octets,8,P)},d.prototype.prefixLengthFromSubnetMask=function(){let _=0,P=!1,b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},T,S,Z;for(T=3;T>=0;T-=1)if(S=this.octets[T],S in b){if(Z=b[S],P&&Z!==0)return null;Z!==8&&(P=!0),_+=Z}else return null;return 32-_},d.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){return this.octets.slice(0)},d.prototype.toIPv4MappedAddress=function(){return x.IPv6.parse(`::ffff:${this.toString()}`)},d.prototype.toNormalizedString=function(){return this.toString()},d.prototype.toString=function(){return this.octets.join(".")},d})(),x.IPv4.broadcastAddressFromCIDR=function(d){try{let _=this.parseCIDR(d),P=_[0].toByteArray(),b=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],S=0;for(;S<4;)T.push(parseInt(P[S],10)|parseInt(b[S],10)^255),S++;return new this(T)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.isIPv4=function(d){return this.parser(d)!==null},x.IPv4.isValid=function(d){try{return new this(this.parser(d)),!0}catch{return!1}},x.IPv4.isValidCIDR=function(d){try{return this.parseCIDR(d),!0}catch{return!1}},x.IPv4.isValidFourPartDecimal=function(d){return!!(x.IPv4.isValid(d)&&d.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},x.IPv4.isValidCIDRFourPartDecimal=function(d){let _=d.match(/^(.+)\/(\d+)$/);return!x.IPv4.isValidCIDR(d)||!_?!1:x.IPv4.isValidFourPartDecimal(_[1])},x.IPv4.networkAddressFromCIDR=function(d){let _,P,b,T,S;try{for(_=this.parseCIDR(d),b=_[0].toByteArray(),S=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],P=0;P<4;)T.push(parseInt(b[P],10)&parseInt(S[P],10)),P++;return new this(T)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.parse=function(d){let _=this.parser(d);if(_===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(_)},x.IPv4.parseCIDR=function(d){let _;if(_=d.match(/^(.+)\/(\d+)$/)){let P=parseInt(_[2]);if(P>=0&&P<=32){let b=[this.parse(_[1]),P];return Object.defineProperty(b,"toString",{value:o(function(){return this.join("/")},"value")}),b}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},x.IPv4.parser=function(d){let _,P,b;if(_=d.match(n.fourOctet))return(function(){let T=_.slice(1,6),S=[];for(let Z=0;Z<T.length;Z++)P=T[Z],S.push(m(P));return S})();if(_=d.match(n.longValue)){if(b=m(_[1]),b>4294967295||b<0)throw new Error("ipaddr: address outside defined range");return(function(){let T=[],S;for(S=0;S<=24;S+=8)T.push(b>>S&255);return T})().reverse()}else return(_=d.match(n.twoOctet))?(function(){let T=_.slice(1,4),S=[];if(b=m(T[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return S.push(m(T[0])),S.push(b>>16&255),S.push(b>>8&255),S.push(b&255),S})():(_=d.match(n.threeOctet))?(function(){let T=_.slice(1,5),S=[];if(b=m(T[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return S.push(m(T[0])),S.push(m(T[1])),S.push(b>>8&255),S.push(b&255),S})():null},x.IPv4.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>32)throw new Error("ipaddr: invalid IPv4 prefix length");let _=[0,0,0,0],P=0,b=Math.floor(d/8);for(;P<b;)_[P]=255,P++;return b<4&&(_[b]=Math.pow(2,d%8)-1<<8-d%8),new this(_)},x.IPv6=(function(){function d(_,P){let b,T;if(_.length===16)for(this.parts=[],b=0;b<=14;b+=2)this.parts.push(_[b]<<8|_[b+1]);else if(_.length===8)this.parts=_;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(b=0;b<this.parts.length;b++)if(T=this.parts[b],!(0<=T&&T<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");P&&(this.zoneId=P)}return o(d,"IPv6"),d.prototype.SpecialRanges={unspecified:[new d([0,0,0,0,0,0,0,0]),128],linkLocal:[new d([65152,0,0,0,0,0,0,0]),10],multicast:[new d([65280,0,0,0,0,0,0,0]),8],loopback:[new d([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new d([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new d([0,0,0,0,0,65535,0,0]),96],discard:[new d([256,0,0,0,0,0,0,0]),64],rfc6145:[new d([0,0,0,0,65535,0,0,0]),96],rfc6052:[new d([100,65435,0,0,0,0,0,0]),96],"6to4":[new d([8194,0,0,0,0,0,0,0]),16],teredo:[new d([8193,0,0,0,0,0,0,0]),32],benchmarking:[new d([8193,2,0,0,0,0,0,0]),48],amt:[new d([8193,3,0,0,0,0,0,0]),32],as112v6:[[new d([8193,4,274,0,0,0,0,0]),48],[new d([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new d([8193,16,0,0,0,0,0,0]),28],orchid2:[new d([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new d([8193,48,0,0,0,0,0,0]),28],reserved:[[new d([8193,0,0,0,0,0,0,0]),23],[new d([8193,3512,0,0,0,0,0,0]),32]]},d.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},d.prototype.kind=function(){return"ipv6"},d.prototype.match=function(_,P){let b;if(P===void 0&&(b=_,_=b[0],P=b[1]),_.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return g(this.parts,_.parts,16,P)},d.prototype.prefixLengthFromSubnetMask=function(){let _=0,P=!1,b={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},T,S;for(let Z=7;Z>=0;Z-=1)if(T=this.parts[Z],T in b){if(S=b[T],P&&S!==0)return null;S!==16&&(P=!0),_+=S}else return null;return 128-_},d.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){let _,P=[],b=this.parts;for(let T=0;T<b.length;T++)_=b[T],P.push(_>>8),P.push(_&255);return P},d.prototype.toFixedLengthString=function(){let _=(function(){let b=[];for(let T=0;T<this.parts.length;T++)b.push(A(this.parts[T].toString(16),4));return b}).call(this).join(":"),P="";return this.zoneId&&(P=`%${this.zoneId}`),_+P},d.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let _=this.parts.slice(-2),P=_[0],b=_[1];return new x.IPv4([P>>8,P&255,b>>8,b&255])},d.prototype.toNormalizedString=function(){let _=(function(){let b=[];for(let T=0;T<this.parts.length;T++)b.push(this.parts[T].toString(16));return b}).call(this).join(":"),P="";return this.zoneId&&(P=`%${this.zoneId}`),_+P},d.prototype.toRFC5952String=function(){let _=/((^|:)(0(:|$)){2,})/g,P=this.toNormalizedString(),b=0,T=-1,S;for(;S=_.exec(P);)S[0].length>T&&(b=S.index,T=S[0].length);return T<0?P:`${P.substring(0,b)}::${P.substring(b+T)}`},d.prototype.toString=function(){return this.toRFC5952String()},d})(),x.IPv6.broadcastAddressFromCIDR=function(d){try{let _=this.parseCIDR(d),P=_[0].toByteArray(),b=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],S=0;for(;S<16;)T.push(parseInt(P[S],10)|parseInt(b[S],10)^255),S++;return new this(T)}catch(_){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${_})`)}},x.IPv6.isIPv6=function(d){return this.parser(d)!==null},x.IPv6.isValid=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{let _=this.parser(d);return new this(_.parts,_.zoneId),!0}catch{return!1}},x.IPv6.isValidCIDR=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{return this.parseCIDR(d),!0}catch{return!1}},x.IPv6.networkAddressFromCIDR=function(d){let _,P,b,T,S;try{for(_=this.parseCIDR(d),b=_[0].toByteArray(),S=this.subnetMaskFromPrefixLength(_[1]).toByteArray(),T=[],P=0;P<16;)T.push(parseInt(b[P],10)&parseInt(S[P],10)),P++;return new this(T)}catch(Z){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${Z})`)}},x.IPv6.parse=function(d){let _=this.parser(d);if(_.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(_.parts,_.zoneId)},x.IPv6.parseCIDR=function(d){let _,P,b;if((P=d.match(/^(.+)\/(\d+)$/))&&(_=parseInt(P[2]),_>=0&&_<=128))return b=[this.parse(P[1]),_],Object.defineProperty(b,"toString",{value:o(function(){return this.join("/")},"value")}),b;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},x.IPv6.parser=function(d){let _,P,b,T,S,Z;if(b=d.match(s.deprecatedTransitional))return this.parser(`::ffff:${b[1]}`);if(s.native.test(d))return p(d,8);if((b=d.match(s.transitional))&&(Z=b[6]||"",_=b[1],b[1].endsWith("::")||(_=_.slice(0,-1)),_=p(_+Z,6),_.parts)){for(S=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],P=0;P<S.length;P++)if(T=S[P],!(0<=T&&T<=255))return null;return _.parts.push(S[0]<<8|S[1]),_.parts.push(S[2]<<8|S[3]),{parts:_.parts,zoneId:_.zoneId}}return null},x.IPv6.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>128)throw new Error("ipaddr: invalid IPv6 prefix length");let _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],P=0,b=Math.floor(d/8);for(;P<b;)_[P]=255,P++;return b<16&&(_[b]=Math.pow(2,d%8)-1<<8-d%8),new this(_)},x.fromByteArray=function(d){let _=d.length;if(_===4)return new x.IPv4(d);if(_===16)return new x.IPv6(d);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},x.isValid=function(d){return x.IPv6.isValid(d)||x.IPv4.isValid(d)},x.isValidCIDR=function(d){return x.IPv6.isValidCIDR(d)||x.IPv4.isValidCIDR(d)},x.parse=function(d){if(x.IPv6.isValid(d))return x.IPv6.parse(d);if(x.IPv4.isValid(d))return x.IPv4.parse(d);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},x.parseCIDR=function(d){try{return x.IPv6.parseCIDR(d)}catch{try{return x.IPv4.parseCIDR(d)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},x.process=function(d){let _=this.parse(d);return _.kind()==="ipv6"&&_.isIPv4MappedAddress()?_.toIPv4Address():_},x.subnetMatch=function(d,_,P){let b,T,S,Z;P==null&&(P="unicast");for(T in _)if(Object.prototype.hasOwnProperty.call(_,T)){for(S=_[T],S[0]&&!(S[0]instanceof Array)&&(S=[S]),b=0;b<S.length;b++)if(Z=S[b],d.kind()===Z[0].kind()&&d.match.apply(d,Z))return T}return P},typeof _r<"u"&&_r.exports?_r.exports=x:e.ipaddr=x})(Eo)});var za=z((Ww,Na)=>{var ka=require("stream").Stream,rp=require("util");Na.exports=ke;function ke(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(ke,"DelayedStream");rp.inherits(ke,ka);ke.create=function(e,r){var n=new this;r=r||{};for(var t in r)n[t]=r[t];n.source=e;var i=e.emit;return e.emit=function(){return n._handleEmit(arguments),i.apply(e,arguments)},e.on("error",function(){}),n.pauseStream&&e.pause(),n};Object.defineProperty(ke.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});ke.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};ke.prototype.resume=function(){this._released||this.release(),this.source.resume()};ke.prototype.pause=function(){this.source.pause()};ke.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};ke.prototype.pipe=function(){var e=ka.prototype.pipe.apply(this,arguments);return this.resume(),e};ke.prototype._handleEmit=function(e){if(this._released){this.emit.apply(this,e);return}e[0]==="data"&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e)};ke.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}}});var Ra=z((Jw,Ca)=>{var np=require("util"),Oa=require("stream").Stream,Da=za();Ca.exports=ae;function ae(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}o(ae,"CombinedStream");np.inherits(ae,Oa);ae.create=function(e){var r=new this;e=e||{};for(var n in e)r[n]=e[n];return r};ae.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};ae.prototype.append=function(e){var r=ae.isStreamLike(e);if(r){if(!(e instanceof Da)){var n=Da.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=n}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this};ae.prototype.pipe=function(e,r){return Oa.prototype.pipe.call(this,e,r),this.resume(),e};ae.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};ae.prototype._realGetNext=function(){var e=this._streams.shift();if(typeof e>"u"){this.end();return}if(typeof e!="function"){this._pipeNext(e);return}var r=e;r(function(n){var t=ae.isStreamLike(n);t&&(n.on("data",this._checkDataSize.bind(this)),this._handleErrors(n)),this._pipeNext(n)}.bind(this))};ae.prototype._pipeNext=function(e){this._currentStream=e;var r=ae.isStreamLike(e);if(r){e.on("end",this._getNext.bind(this)),e.pipe(this,{end:!1});return}var n=e;this.write(n),this._getNext()};ae.prototype._handleErrors=function(e){var r=this;e.on("error",function(n){r._emitError(n)})};ae.prototype.write=function(e){this.emit("data",e)};ae.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};ae.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};ae.prototype.end=function(){this._reset(),this.emit("end")};ae.prototype.destroy=function(){this._reset(),this.emit("close")};ae.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};ae.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};ae.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach(function(r){r.dataSize&&(e.dataSize+=r.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};ae.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var Ma=z((Xw,Ua)=>{"use strict";Ua.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var Fa=z(Pe=>{"use strict";var Tr=Ma(),ip=require("path").extname,La=/^\s*([^;\s]*)(?:;|\s|$)/,op=/^text\//i;Pe.charset=ja;Pe.charsets={lookup:ja};Pe.contentType=ap;Pe.extension=sp;Pe.extensions=Object.create(null);Pe.lookup=up;Pe.types=Object.create(null);cp(Pe.extensions,Pe.types);function ja(e){if(!e||typeof e!="string")return!1;var r=La.exec(e),n=r&&Tr[r[1].toLowerCase()];return n&&n.charset?n.charset:r&&op.test(r[1])?"UTF-8":!1}o(ja,"charset");function ap(e){if(!e||typeof e!="string")return!1;var r=e.indexOf("/")===-1?Pe.lookup(e):e;if(!r)return!1;if(r.indexOf("charset")===-1){var n=Pe.charset(r);n&&(r+="; charset="+n.toLowerCase())}return r}o(ap,"contentType");function sp(e){if(!e||typeof e!="string")return!1;var r=La.exec(e),n=r&&Pe.extensions[r[1].toLowerCase()];return!n||!n.length?!1:n[0]}o(sp,"extension");function up(e){if(!e||typeof e!="string")return!1;var r=ip("x."+e).toLowerCase().substr(1);return r&&Pe.types[r]||!1}o(up,"lookup");function cp(e,r){var n=["nginx","apache",void 0,"iana"];Object.keys(Tr).forEach(o(function(i){var c=Tr[i],u=c.extensions;if(!(!u||!u.length)){e[i]=u;for(var s=0;s<u.length;s++){var p=u[s];if(r[p]){var g=n.indexOf(Tr[r[p]].source),m=n.indexOf(c.source);if(r[p]!=="application/octet-stream"&&(g>m||g===m&&r[p].substr(0,12)==="application/"))continue}r[p]=i}}},"forEachMimeType"))}o(cp,"populateMaps")});var qa=z((tk,Ba)=>{Ba.exports=lp;function lp(e){var r=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;r?r(e):setTimeout(e,0)}o(lp,"defer")});var zn=z((nk,Za)=>{var Va=qa();Za.exports=dp;function dp(e){var r=!1;return Va(function(){r=!0}),o(function(t,i){r?e(t,i):Va(o(function(){e(t,i)},"nextTick_callback"))},"async_callback")}o(dp,"async")});var Dn=z((ok,Ha)=>{Ha.exports=pp;function pp(e){Object.keys(e.jobs).forEach(mp.bind(e)),e.jobs={}}o(pp,"abort");function mp(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}o(mp,"clean")});var On=z((sk,Wa)=>{var Ga=zn(),fp=Dn();Wa.exports=gp;function gp(e,r,n,t){var i=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[i]=yp(r,i,e[i],function(c,u){i in n.jobs&&(delete n.jobs[i],c?fp(n):n.results[i]=u,t(c,n.results))})}o(gp,"iterate");function yp(e,r,n,t){var i;return e.length==2?i=e(n,Ga(t)):i=e(n,r,Ga(t)),i}o(yp,"runJob")});var Cn=z((ck,Ka)=>{Ka.exports=hp;function hp(e,r){var n=!Array.isArray(e),t={index:0,keyedList:n||r?Object.keys(e):null,jobs:{},results:n?{}:[],size:n?Object.keys(e).length:e.length};return r&&t.keyedList.sort(n?r:function(i,c){return r(e[i],e[c])}),t}o(hp,"state")});var Rn=z((dk,Ja)=>{var _p=Dn(),bp=zn();Ja.exports=vp;function vp(e){Object.keys(this.jobs).length&&(this.index=this.size,_p(this),bp(e)(null,this.results))}o(vp,"terminator")});var Xa=z((mk,Ya)=>{var xp=On(),Pp=Cn(),Tp=Rn();Ya.exports=Sp;function Sp(e,r,n){for(var t=Pp(e);t.index<(t.keyedList||e).length;)xp(e,r,t,function(i,c){if(i){n(i,c);return}if(Object.keys(t.jobs).length===0){n(null,t.results);return}}),t.index++;return Tp.bind(t,n)}o(Sp,"parallel")});var Un=z((gk,Sr)=>{var Qa=On(),Ap=Cn(),Ip=Rn();Sr.exports=Ep;Sr.exports.ascending=es;Sr.exports.descending=$p;function Ep(e,r,n,t){var i=Ap(e,n);return Qa(e,r,i,o(function c(u,s){if(u){t(u,s);return}if(i.index++,i.index<(i.keyedList||e).length){Qa(e,r,i,c);return}t(null,i.results)},"iteratorHandler")),Ip.bind(i,t)}o(Ep,"serialOrdered");function es(e,r){return e<r?-1:e>r?1:0}o(es,"ascending");function $p(e,r){return-1*es(e,r)}o($p,"descending")});var rs=z((hk,ts)=>{var wp=Un();ts.exports=kp;function kp(e,r,n){return wp(e,r,null,n)}o(kp,"serial")});var is=z((bk,ns)=>{ns.exports={parallel:Xa(),serial:rs(),serialOrdered:Un()}});var Mn=z((vk,os)=>{"use strict";os.exports=Object});var ss=z((xk,as)=>{"use strict";as.exports=Error});var cs=z((Pk,us)=>{"use strict";us.exports=EvalError});var ds=z((Tk,ls)=>{"use strict";ls.exports=RangeError});var ms=z((Sk,ps)=>{"use strict";ps.exports=ReferenceError});var gs=z((Ak,fs)=>{"use strict";fs.exports=SyntaxError});var Ar=z((Ik,ys)=>{"use strict";ys.exports=TypeError});var _s=z((Ek,hs)=>{"use strict";hs.exports=URIError});var vs=z(($k,bs)=>{"use strict";bs.exports=Math.abs});var Ps=z((wk,xs)=>{"use strict";xs.exports=Math.floor});var Ss=z((kk,Ts)=>{"use strict";Ts.exports=Math.max});var Is=z((Nk,As)=>{"use strict";As.exports=Math.min});var $s=z((zk,Es)=>{"use strict";Es.exports=Math.pow});var ks=z((Dk,ws)=>{"use strict";ws.exports=Math.round});var zs=z((Ok,Ns)=>{"use strict";Ns.exports=Number.isNaN||o(function(r){return r!==r},"isNaN")});var Os=z((Rk,Ds)=>{"use strict";var Np=zs();Ds.exports=o(function(r){return Np(r)||r===0?r:r<0?-1:1},"sign")});var Rs=z((Mk,Cs)=>{"use strict";Cs.exports=Object.getOwnPropertyDescriptor});var Ln=z((Lk,Us)=>{"use strict";var Ir=Rs();if(Ir)try{Ir([],"length")}catch{Ir=null}Us.exports=Ir});var Ls=z((jk,Ms)=>{"use strict";var Er=Object.defineProperty||!1;if(Er)try{Er({},"a",{value:1})}catch{Er=!1}Ms.exports=Er});var jn=z((Fk,js)=>{"use strict";js.exports=o(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var r={},n=Symbol("test"),t=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(t)!=="[object Symbol]")return!1;var i=42;r[n]=i;for(var c in r)return!1;if(typeof Object.keys=="function"&&Object.keys(r).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(r).length!==0)return!1;var u=Object.getOwnPropertySymbols(r);if(u.length!==1||u[0]!==n||!Object.prototype.propertyIsEnumerable.call(r,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(r,n);if(s.value!==i||s.enumerable!==!0)return!1}return!0},"hasSymbols")});var qs=z((qk,Bs)=>{"use strict";var Fs=typeof Symbol<"u"&&Symbol,zp=jn();Bs.exports=o(function(){return typeof Fs!="function"||typeof Symbol!="function"||typeof Fs("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:zp()},"hasNativeSymbols")});var Fn=z((Zk,Vs)=>{"use strict";Vs.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Bn=z((Hk,Zs)=>{"use strict";var Dp=Mn();Zs.exports=Dp.getPrototypeOf||null});var Ws=z((Gk,Gs)=>{"use strict";var Op="Function.prototype.bind called on incompatible ",Cp=Object.prototype.toString,Rp=Math.max,Up="[object Function]",Hs=o(function(r,n){for(var t=[],i=0;i<r.length;i+=1)t[i]=r[i];for(var c=0;c<n.length;c+=1)t[c+r.length]=n[c];return t},"concatty"),Mp=o(function(r,n){for(var t=[],i=n||0,c=0;i<r.length;i+=1,c+=1)t[c]=r[i];return t},"slicy"),Lp=o(function(e,r){for(var n="",t=0;t<e.length;t+=1)n+=e[t],t+1<e.length&&(n+=r);return n},"joiny");Gs.exports=o(function(r){var n=this;if(typeof n!="function"||Cp.apply(n)!==Up)throw new TypeError(Op+n);for(var t=Mp(arguments,1),i,c=o(function(){if(this instanceof i){var m=n.apply(this,Hs(t,arguments));return Object(m)===m?m:this}return n.apply(r,Hs(t,arguments))},"binder"),u=Rp(0,n.length-t.length),s=[],p=0;p<u;p++)s[p]="$"+p;if(i=Function("binder","return function ("+Lp(s,",")+"){ return binder.apply(this,arguments); }")(c),n.prototype){var g=o(function(){},"Empty");g.prototype=n.prototype,i.prototype=new g,g.prototype=null}return i},"bind")});var ft=z((Kk,Ks)=>{"use strict";var jp=Ws();Ks.exports=Function.prototype.bind||jp});var $r=z((Jk,Js)=>{"use strict";Js.exports=Function.prototype.call});var qn=z((Yk,Ys)=>{"use strict";Ys.exports=Function.prototype.apply});var Qs=z((Xk,Xs)=>{"use strict";Xs.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var tu=z((Qk,eu)=>{"use strict";var Fp=ft(),Bp=qn(),qp=$r(),Vp=Qs();eu.exports=Vp||Fp.call(qp,Bp)});var nu=z((eN,ru)=>{"use strict";var Zp=ft(),Hp=Ar(),Gp=$r(),Wp=tu();ru.exports=o(function(r){if(r.length<1||typeof r[0]!="function")throw new Hp("a function is required");return Wp(Zp,Gp,r)},"callBindBasic")});var cu=z((rN,uu)=>{"use strict";var Kp=nu(),iu=Ln(),au;try{au=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var Vn=!!au&&iu&&iu(Object.prototype,"__proto__"),su=Object,ou=su.getPrototypeOf;uu.exports=Vn&&typeof Vn.get=="function"?Kp([Vn.get]):typeof ou=="function"?o(function(r){return ou(r==null?r:su(r))},"getDunder"):!1});var fu=z((iN,mu)=>{"use strict";var lu=Fn(),du=Bn(),pu=cu();mu.exports=lu?o(function(r){return lu(r)},"getProto"):du?o(function(r){if(!r||typeof r!="object"&&typeof r!="function")throw new TypeError("getProto: not an object");return du(r)},"getProto"):pu?o(function(r){return pu(r)},"getProto"):null});var Zn=z((aN,gu)=>{"use strict";var Jp=Function.prototype.call,Yp=Object.prototype.hasOwnProperty,Xp=ft();gu.exports=Xp.call(Jp,Yp)});var Pu=z((sN,xu)=>{"use strict";var J,Qp=Mn(),em=ss(),tm=cs(),rm=ds(),nm=ms(),_t=gs(),ht=Ar(),im=_s(),om=vs(),am=Ps(),sm=Ss(),um=Is(),cm=$s(),lm=ks(),dm=Os(),bu=Function,Hn=o(function(e){try{return bu('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),Gt=Ln(),pm=Ls(),Gn=o(function(){throw new ht},"throwTypeError"),mm=Gt?(function(){try{return arguments.callee,Gn}catch{try{return Gt(arguments,"callee").get}catch{return Gn}}})():Gn,gt=qs()(),ge=fu(),fm=Bn(),gm=Fn(),vu=qn(),Wt=$r(),yt={},ym=typeof Uint8Array>"u"||!ge?J:ge(Uint8Array),rt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?J:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?J:ArrayBuffer,"%ArrayIteratorPrototype%":gt&&ge?ge([][Symbol.iterator]()):J,"%AsyncFromSyncIteratorPrototype%":J,"%AsyncFunction%":yt,"%AsyncGenerator%":yt,"%AsyncGeneratorFunction%":yt,"%AsyncIteratorPrototype%":yt,"%Atomics%":typeof Atomics>"u"?J:Atomics,"%BigInt%":typeof BigInt>"u"?J:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?J:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?J:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?J:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":em,"%eval%":eval,"%EvalError%":tm,"%Float16Array%":typeof Float16Array>"u"?J:Float16Array,"%Float32Array%":typeof Float32Array>"u"?J:Float32Array,"%Float64Array%":typeof Float64Array>"u"?J:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?J:FinalizationRegistry,"%Function%":bu,"%GeneratorFunction%":yt,"%Int8Array%":typeof Int8Array>"u"?J:Int8Array,"%Int16Array%":typeof Int16Array>"u"?J:Int16Array,"%Int32Array%":typeof Int32Array>"u"?J:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":gt&&ge?ge(ge([][Symbol.iterator]())):J,"%JSON%":typeof JSON=="object"?JSON:J,"%Map%":typeof Map>"u"?J:Map,"%MapIteratorPrototype%":typeof Map>"u"||!gt||!ge?J:ge(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Qp,"%Object.getOwnPropertyDescriptor%":Gt,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?J:Promise,"%Proxy%":typeof Proxy>"u"?J:Proxy,"%RangeError%":rm,"%ReferenceError%":nm,"%Reflect%":typeof Reflect>"u"?J:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?J:Set,"%SetIteratorPrototype%":typeof Set>"u"||!gt||!ge?J:ge(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?J:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":gt&&ge?ge(""[Symbol.iterator]()):J,"%Symbol%":gt?Symbol:J,"%SyntaxError%":_t,"%ThrowTypeError%":mm,"%TypedArray%":ym,"%TypeError%":ht,"%Uint8Array%":typeof Uint8Array>"u"?J:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?J:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?J:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?J:Uint32Array,"%URIError%":im,"%WeakMap%":typeof WeakMap>"u"?J:WeakMap,"%WeakRef%":typeof WeakRef>"u"?J:WeakRef,"%WeakSet%":typeof WeakSet>"u"?J:WeakSet,"%Function.prototype.call%":Wt,"%Function.prototype.apply%":vu,"%Object.defineProperty%":pm,"%Object.getPrototypeOf%":fm,"%Math.abs%":om,"%Math.floor%":am,"%Math.max%":sm,"%Math.min%":um,"%Math.pow%":cm,"%Math.round%":lm,"%Math.sign%":dm,"%Reflect.getPrototypeOf%":gm};if(ge)try{null.error}catch(e){yu=ge(ge(e)),rt["%Error.prototype%"]=yu}var yu,hm=o(function e(r){var n;if(r==="%AsyncFunction%")n=Hn("async function () {}");else if(r==="%GeneratorFunction%")n=Hn("function* () {}");else if(r==="%AsyncGeneratorFunction%")n=Hn("async function* () {}");else if(r==="%AsyncGenerator%"){var t=e("%AsyncGeneratorFunction%");t&&(n=t.prototype)}else if(r==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&ge&&(n=ge(i.prototype))}return rt[r]=n,n},"doEval"),hu={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Kt=ft(),wr=Zn(),_m=Kt.call(Wt,Array.prototype.concat),bm=Kt.call(vu,Array.prototype.splice),_u=Kt.call(Wt,String.prototype.replace),kr=Kt.call(Wt,String.prototype.slice),vm=Kt.call(Wt,RegExp.prototype.exec),xm=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Pm=/\\(\\)?/g,Tm=o(function(r){var n=kr(r,0,1),t=kr(r,-1);if(n==="%"&&t!=="%")throw new _t("invalid intrinsic syntax, expected closing `%`");if(t==="%"&&n!=="%")throw new _t("invalid intrinsic syntax, expected opening `%`");var i=[];return _u(r,xm,function(c,u,s,p){i[i.length]=s?_u(p,Pm,"$1"):u||c}),i},"stringToPath"),Sm=o(function(r,n){var t=r,i;if(wr(hu,t)&&(i=hu[t],t="%"+i[0]+"%"),wr(rt,t)){var c=rt[t];if(c===yt&&(c=hm(t)),typeof c>"u"&&!n)throw new ht("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:i,name:t,value:c}}throw new _t("intrinsic "+r+" does not exist!")},"getBaseIntrinsic");xu.exports=o(function(r,n){if(typeof r!="string"||r.length===0)throw new ht("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new ht('"allowMissing" argument must be a boolean');if(vm(/^%?[^%]*%?$/,r)===null)throw new _t("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var t=Tm(r),i=t.length>0?t[0]:"",c=Sm("%"+i+"%",n),u=c.name,s=c.value,p=!1,g=c.alias;g&&(i=g[0],bm(t,_m([0,1],g)));for(var m=1,A=!0;m<t.length;m+=1){var x=t[m],d=kr(x,0,1),_=kr(x,-1);if((d==='"'||d==="'"||d==="`"||_==='"'||_==="'"||_==="`")&&d!==_)throw new _t("property names with quotes must have matching quotes");if((x==="constructor"||!A)&&(p=!0),i+="."+x,u="%"+i+"%",wr(rt,u))s=rt[u];else if(s!=null){if(!(x in s)){if(!n)throw new ht("base intrinsic for "+r+" exists, but the property is not available.");return}if(Gt&&m+1>=t.length){var P=Gt(s,x);A=!!P,A&&"get"in P&&!("originalValue"in P.get)?s=P.get:s=s[x]}else A=wr(s,x),s=s[x];A&&!p&&(rt[u]=s)}}return s},"GetIntrinsic")});var Su=z((cN,Tu)=>{"use strict";var Am=jn();Tu.exports=o(function(){return Am()&&!!Symbol.toStringTag},"hasToStringTagShams")});var Eu=z((dN,Iu)=>{"use strict";var Im=Pu(),Au=Im("%Object.defineProperty%",!0),Em=Su()(),$m=Zn(),wm=Ar(),Nr=Em?Symbol.toStringTag:null;Iu.exports=o(function(r,n){var t=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof t<"u"&&typeof t!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new wm("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Nr&&(t||!$m(r,Nr))&&(Au?Au(r,Nr,{configurable:!i,enumerable:!1,value:n,writable:!1}):r[Nr]=n)},"setToStringTag")});var wu=z((mN,$u)=>{"use strict";var km=Function.prototype.call,Nm=Object.prototype.hasOwnProperty,zm=ft();$u.exports=zm.call(km,Nm)});var Nu=z((fN,ku)=>{"use strict";ku.exports=function(e,r){return Object.keys(r).forEach(function(n){e[n]=e[n]||r[n]}),e}});var Xn=z((gN,Du)=>{"use strict";var Yn=Ra(),Dm=require("util"),Wn=require("path"),Om=require("http"),Cm=require("https"),Rm=require("url").parse,Um=require("fs"),Mm=require("stream").Stream,Lm=require("crypto"),Kn=Fa(),jm=is(),Fm=Eu(),Ye=wu(),Jn=Nu();function zu(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(zu,"escapeHeaderParam");function ee(e){if(!(this instanceof ee))return new ee(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],Yn.call(this),e=e||{};for(var r in e)this[r]=e[r]}o(ee,"FormData");Dm.inherits(ee,Yn);ee.LINE_BREAK=`\r
2
+ `;ee.DEFAULT_CONTENT_TYPE="application/octet-stream";ee.prototype.append=function(e,r,n){n=n||{},typeof n=="string"&&(n={filename:n});var t=Yn.prototype.append.bind(this);if((typeof r=="number"||r==null)&&(r=String(r)),Array.isArray(r)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(e,r,n),c=this._multiPartFooter();t(i),t(r),t(c),this._trackLength(i,r,n)};ee.prototype._trackLength=function(e,r,n){var t=0;n.knownLength!=null?t+=Number(n.knownLength):Buffer.isBuffer(r)?t=r.length:typeof r=="string"&&(t=Buffer.byteLength(r)),this._valueLength+=t,this._overheadLength+=Buffer.byteLength(e)+ee.LINE_BREAK.length,!(!r||!r.path&&!(r.readable&&Ye(r,"httpVersion"))&&!(r instanceof Mm))&&(n.knownLength||this._valuesToMeasure.push(r))};ee.prototype._lengthRetriever=function(e,r){Ye(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?r(null,e.end+1-(e.start?e.start:0)):Um.stat(e.path,function(n,t){if(n){r(n);return}var i=t.size-(e.start?e.start:0);r(null,i)}):Ye(e,"httpVersion")?r(null,Number(e.headers["content-length"])):Ye(e,"httpModule")?(e.on("response",function(n){e.pause(),r(null,Number(n.headers["content-length"]))}),e.resume()):r("Unknown stream")};ee.prototype._multiPartHeader=function(e,r,n){if(typeof n.header=="string")return n.header;var t=this._getContentDisposition(r,n),i=this._getContentType(r,n),c="",u={"Content-Disposition":["form-data",'name="'+zu(e)+'"'].concat(t||[]),"Content-Type":[].concat(i||[])};typeof n.header=="object"&&Jn(u,n.header);var s;for(var p in u)if(Ye(u,p)){if(s=u[p],s==null)continue;Array.isArray(s)||(s=[s]),s.length&&(c+=p+": "+s.join("; ")+ee.LINE_BREAK)}return"--"+this.getBoundary()+ee.LINE_BREAK+c+ee.LINE_BREAK};ee.prototype._getContentDisposition=function(e,r){var n;if(typeof r.filepath=="string"?n=Wn.normalize(r.filepath).replace(/\\/g,"/"):r.filename||e&&(e.name||e.path)?n=Wn.basename(r.filename||e&&(e.name||e.path)):e&&e.readable&&Ye(e,"httpVersion")&&(n=Wn.basename(e.client._httpMessage.path||"")),n)return'filename="'+zu(n)+'"'};ee.prototype._getContentType=function(e,r){var n=r.contentType;return!n&&e&&e.name&&(n=Kn.lookup(e.name)),!n&&e&&e.path&&(n=Kn.lookup(e.path)),!n&&e&&e.readable&&Ye(e,"httpVersion")&&(n=e.headers["content-type"]),!n&&(r.filepath||r.filename)&&(n=Kn.lookup(r.filepath||r.filename)),!n&&e&&typeof e=="object"&&(n=ee.DEFAULT_CONTENT_TYPE),n};ee.prototype._multiPartFooter=function(){return function(e){var r=ee.LINE_BREAK,n=this._streams.length===0;n&&(r+=this._lastBoundary()),e(r)}.bind(this)};ee.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+ee.LINE_BREAK};ee.prototype.getHeaders=function(e){var r,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(r in e)Ye(e,r)&&(n[r.toLowerCase()]=e[r]);return n};ee.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};ee.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};ee.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),r=this.getBoundary(),n=0,t=this._streams.length;n<t;n++)typeof this._streams[n]!="function"&&(Buffer.isBuffer(this._streams[n])?e=Buffer.concat([e,this._streams[n]]):e=Buffer.concat([e,Buffer.from(this._streams[n])]),(typeof this._streams[n]!="string"||this._streams[n].substring(2,r.length+2)!==r)&&(e=Buffer.concat([e,Buffer.from(ee.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};ee.prototype._generateBoundary=function(){this._boundary="--------------------------"+Lm.randomBytes(12).toString("hex")};ee.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e};ee.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};ee.prototype.getLength=function(e){var r=this._overheadLength+this._valueLength;if(this._streams.length&&(r+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(e.bind(this,null,r));return}jm.parallel(this._valuesToMeasure,this._lengthRetriever,function(n,t){if(n){e(n);return}t.forEach(function(i){r+=i}),e(null,r)})};ee.prototype.submit=function(e,r){var n,t,i={method:"post"};return typeof e=="string"?(e=Rm(e),t=Jn({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},i)):(t=Jn(e,i),t.port||(t.port=t.protocol==="https:"?443:80)),t.headers=this.getHeaders(e.headers),t.protocol==="https:"?n=Cm.request(t):n=Om.request(t),this.getLength(function(c,u){if(c&&c!=="Unknown stream"){this._error(c);return}if(u&&n.setHeader("Content-Length",u),this.pipe(n),r){var s,p=o(function(g,m){return n.removeListener("error",p),n.removeListener("response",s),r.call(this,g,m)},"callback");s=p.bind(this,null),n.on("error",p),n.on("response",s)}}.bind(this)),n};ee.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};ee.prototype.toString=function(){return"[object FormData]"};Fm(ee.prototype,"FormData");Du.exports=ee});var vt=z((Qn,ei)=>{(function(e,r){typeof Qn=="object"&&typeof ei<"u"?ei.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=r()})(Qn,(function(){"use strict";var e=1e3,r=6e4,n=36e5,t="millisecond",i="second",c="minute",u="hour",s="day",p="week",g="month",m="quarter",A="year",x="date",d="Invalid Date",_=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,P=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(U){var $=["th","st","nd","rd"],I=U%100;return"["+U+($[(I-20)%10]||$[I]||$[0])+"]"},"ordinal")},T=o(function(U,$,I){var k=String(U);return!k||k.length>=$?U:""+Array($+1-k.length).join(I)+U},"m"),S={s:T,z:o(function(U){var $=-U.utcOffset(),I=Math.abs($),k=Math.floor(I/60),E=I%60;return($<=0?"+":"-")+T(k,2,"0")+":"+T(E,2,"0")},"z"),m:o(function U($,I){if($.date()<I.date())return-U(I,$);var k=12*(I.year()-$.year())+(I.month()-$.month()),E=$.clone().add(k,g),G=I-E<0,W=$.clone().add(k+(G?-1:1),g);return+(-(k+(I-E)/(G?E-W:W-E))||0)},"t"),a:o(function(U){return U<0?Math.ceil(U)||0:Math.floor(U)},"a"),p:o(function(U){return{M:g,y:A,w:p,d:s,D:x,h:u,m:c,s:i,ms:t,Q:m}[U]||String(U||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(U){return U===void 0},"u")},Z="en",se={};se[Z]=b;var he=o(function(U){return U instanceof _e},"p"),Te=o(function U($,I,k){var E;if(!$)return Z;if(typeof $=="string"){var G=$.toLowerCase();se[G]&&(E=G),I&&(se[G]=I,E=G);var W=$.split("-");if(!E&&W.length>1)return U(W[0])}else{var te=$.name;se[te]=$,E=te}return!k&&E&&(Z=E),E||!k&&Z},"t"),le=o(function(U,$){if(he(U))return U.clone();var I=typeof $=="object"?$:{};return I.date=U,I.args=arguments,new _e(I)},"w"),K=S;K.l=Te,K.i=he,K.w=function(U,$){return le(U,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var _e=(function(){function U(I){this.$L=Te(I.locale,null,!0),this.parse(I)}o(U,"M");var $=U.prototype;return $.parse=function(I){this.$d=(function(k){var E=k.date,G=k.utc;if(E===null)return new Date(NaN);if(K.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var W=E.match(_);if(W){var te=W[2]-1||0,ue=(W[7]||"0").substring(0,3);return G?new Date(Date.UTC(W[1],te,W[3]||1,W[4]||0,W[5]||0,W[6]||0,ue)):new Date(W[1],te,W[3]||1,W[4]||0,W[5]||0,W[6]||0,ue)}}return new Date(E)})(I),this.$x=I.x||{},this.init()},$.init=function(){var I=this.$d;this.$y=I.getFullYear(),this.$M=I.getMonth(),this.$D=I.getDate(),this.$W=I.getDay(),this.$H=I.getHours(),this.$m=I.getMinutes(),this.$s=I.getSeconds(),this.$ms=I.getMilliseconds()},$.$utils=function(){return K},$.isValid=function(){return this.$d.toString()!==d},$.isSame=function(I,k){var E=le(I);return this.startOf(k)<=E&&E<=this.endOf(k)},$.isAfter=function(I,k){return le(I)<this.startOf(k)},$.isBefore=function(I,k){return this.endOf(k)<le(I)},$.$g=function(I,k,E){return K.u(I)?this[k]:this.set(E,I)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(I,k){var E=this,G=!!K.u(k)||k,W=K.p(I),te=o(function(Qe,be){var Fe=K.w(E.$u?Date.UTC(E.$y,be,Qe):new Date(E.$y,be,Qe),E);return G?Fe:Fe.endOf(s)},"l"),ue=o(function(Qe,be){return K.w(E.toDate()[Qe].apply(E.toDate("s"),(G?[0,0,0,0]:[23,59,59,999]).slice(be)),E)},"$"),me=this.$W,ye=this.$M,Ie=this.$D,nt="set"+(this.$u?"UTC":"");switch(W){case A:return G?te(1,0):te(31,11);case g:return G?te(1,ye):te(0,ye+1);case p:var Xe=this.$locale().weekStart||0,Pt=(me<Xe?me+7:me)-Xe;return te(G?Ie-Pt:Ie+(6-Pt),ye);case s:case x:return ue(nt+"Hours",0);case u:return ue(nt+"Minutes",1);case c:return ue(nt+"Seconds",2);case i:return ue(nt+"Milliseconds",3);default:return this.clone()}},$.endOf=function(I){return this.startOf(I,!1)},$.$set=function(I,k){var E,G=K.p(I),W="set"+(this.$u?"UTC":""),te=(E={},E[s]=W+"Date",E[x]=W+"Date",E[g]=W+"Month",E[A]=W+"FullYear",E[u]=W+"Hours",E[c]=W+"Minutes",E[i]=W+"Seconds",E[t]=W+"Milliseconds",E)[G],ue=G===s?this.$D+(k-this.$W):k;if(G===g||G===A){var me=this.clone().set(x,1);me.$d[te](ue),me.init(),this.$d=me.set(x,Math.min(this.$D,me.daysInMonth())).$d}else te&&this.$d[te](ue);return this.init(),this},$.set=function(I,k){return this.clone().$set(I,k)},$.get=function(I){return this[K.p(I)]()},$.add=function(I,k){var E,G=this;I=Number(I);var W=K.p(k),te=o(function(ye){var Ie=le(G);return K.w(Ie.date(Ie.date()+Math.round(ye*I)),G)},"y");if(W===g)return this.set(g,this.$M+I);if(W===A)return this.set(A,this.$y+I);if(W===s)return te(1);if(W===p)return te(7);var ue=(E={},E[c]=r,E[u]=n,E[i]=e,E)[W]||1,me=this.$d.getTime()+I*ue;return K.w(me,this)},$.subtract=function(I,k){return this.add(-1*I,k)},$.format=function(I){var k=this,E=this.$locale();if(!this.isValid())return E.invalidDate||d;var G=I||"YYYY-MM-DDTHH:mm:ssZ",W=K.z(this),te=this.$H,ue=this.$m,me=this.$M,ye=E.weekdays,Ie=E.months,nt=E.meridiem,Xe=o(function(be,Fe,Tt,Yt){return be&&(be[Fe]||be(k,G))||Tt[Fe].slice(0,Yt)},"h"),Pt=o(function(be){return K.s(te%12||12,be,"0")},"d"),Qe=nt||function(be,Fe,Tt){var Yt=be<12?"AM":"PM";return Tt?Yt.toLowerCase():Yt};return G.replace(P,(function(be,Fe){return Fe||(function(Tt){switch(Tt){case"YY":return String(k.$y).slice(-2);case"YYYY":return K.s(k.$y,4,"0");case"M":return me+1;case"MM":return K.s(me+1,2,"0");case"MMM":return Xe(E.monthsShort,me,Ie,3);case"MMMM":return Xe(Ie,me);case"D":return k.$D;case"DD":return K.s(k.$D,2,"0");case"d":return String(k.$W);case"dd":return Xe(E.weekdaysMin,k.$W,ye,2);case"ddd":return Xe(E.weekdaysShort,k.$W,ye,3);case"dddd":return ye[k.$W];case"H":return String(te);case"HH":return K.s(te,2,"0");case"h":return Pt(1);case"hh":return Pt(2);case"a":return Qe(te,ue,!0);case"A":return Qe(te,ue,!1);case"m":return String(ue);case"mm":return K.s(ue,2,"0");case"s":return String(k.$s);case"ss":return K.s(k.$s,2,"0");case"SSS":return K.s(k.$ms,3,"0");case"Z":return W}return null})(be)||W.replace(":","")}))},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(I,k,E){var G,W=this,te=K.p(k),ue=le(I),me=(ue.utcOffset()-this.utcOffset())*r,ye=this-ue,Ie=o(function(){return K.m(W,ue)},"D");switch(te){case A:G=Ie()/12;break;case g:G=Ie();break;case m:G=Ie()/3;break;case p:G=(ye-me)/6048e5;break;case s:G=(ye-me)/864e5;break;case u:G=ye/n;break;case c:G=ye/r;break;case i:G=ye/e;break;default:G=ye}return E?G:K.a(G)},$.daysInMonth=function(){return this.endOf(g).$D},$.$locale=function(){return se[this.$L]},$.locale=function(I,k){if(!I)return this.$L;var E=this.clone(),G=Te(I,k,!0);return G&&(E.$L=G),E},$.clone=function(){return K.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},U})(),Jt=_e.prototype;return le.prototype=Jt,[["$ms",t],["$s",i],["$m",c],["$H",u],["$W",s],["$M",g],["$y",A],["$D",x]].forEach((function(U){Jt[U[1]]=function($){return this.$g($,U[0],U[1])}})),le.extend=function(U,$){return U.$i||(U($,_e,le),U.$i=!0),le},le.locale=Te,le.isDayjs=he,le.unix=function(U){return le(1e3*U)},le.en=se[Z],le.Ls=se,le.p={},le}))});var Xm={};ti(Xm,{bexio:()=>Ym});module.exports=_c(Xm);var bc=Object.freeze({status:"aborted"});function w(e,r,n){function t(s,p){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:p,constr:u,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),r(s,p);let g=u.prototype,m=Object.keys(g);for(let A=0;A<m.length;A++){let x=m[A];x in s||(s[x]=g[x].bind(s))}}o(t,"init");let i=n?.Parent??Object;class c extends i{static{o(this,"Definition")}}Object.defineProperty(c,"name",{value:e});function u(s){var p;let g=n?.Parent?new c:this;t(g,s),(p=g._zod).deferred??(p.deferred=[]);for(let m of g._zod.deferred)m();return g}return o(u,"_"),Object.defineProperty(u,"init",{value:t}),Object.defineProperty(u,Symbol.hasInstance,{value:o(s=>n?.Parent&&s instanceof n.Parent?!0:s?._zod?.traits?.has(e),"value")}),Object.defineProperty(u,"name",{value:e}),u}o(w,"$constructor");var Ne=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Xt=class extends Error{static{o(this,"$ZodEncodeError")}constructor(r){super(`Encountered unidirectional transform during encode: ${r}`),this.name="ZodEncodeError"}},Vr={};function Ce(e){return e&&Object.assign(Vr,e),Vr}o(Ce,"config");function Hr(e){let r=Object.values(e).filter(t=>typeof t=="number");return Object.entries(e).filter(([t,i])=>r.indexOf(+t)===-1).map(([t,i])=>i)}o(Hr,"getEnumValues");function ii(e,r){return typeof r=="bigint"?r.toString():r}o(ii,"jsonStringifyReplacer");function er(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}o(er,"cached");function oi(e){return e==null}o(oi,"nullish");function tr(e){let r=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(r,n)}o(tr,"cleanRegex");var ni=Symbol("evaluating");function de(e,r,n){let t;Object.defineProperty(e,r,{get(){if(t!==ni)return t===void 0&&(t=ni,t=n()),t},set(i){Object.defineProperty(e,r,{value:i})},configurable:!0})}o(de,"defineLazy");var Gr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function At(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(At,"isObject");var vc=er(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ai(e){if(At(e)===!1)return!1;let r=e.constructor;if(r===void 0||typeof r!="function")return!0;let n=r.prototype;return!(At(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}o(ai,"isPlainObject");var si=new Set(["string","number","symbol"]);function it(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(it,"escapeRegex");function rr(e,r,n){let t=new e._zod.constr(r??e._zod.def);return(!r||n?.parent)&&(t._zod.parent=e),t}o(rr,"clone");function re(e){let r=e;if(!r)return{};if(typeof r=="string")return{error:o(()=>r,"error")};if(r?.message!==void 0){if(r?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");r.error=r.message}return delete r.message,typeof r.error=="string"?{...r,error:o(()=>r.error,"error")}:r}o(re,"normalizeParams");function ui(e){return Object.keys(e).filter(r=>e[r]._zod.optin==="optional"&&e[r]._zod.optout==="optional")}o(ui,"optionalKeys");var ci={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ot(e,r=0){if(e.aborted===!0)return!0;for(let n=r;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}o(ot,"aborted");function Be(e,r){return r.map(n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n})}o(Be,"prefixIssues");function Qt(e){return typeof e=="string"?e:e?.message}o(Qt,"unwrapMessage");function qe(e,r,n){let t={...e,path:e.path??[]};if(!e.message){let i=Qt(e.inst?._zod.def?.error?.(e))??Qt(r?.error?.(e))??Qt(n.customError?.(e))??Qt(n.localeError?.(e))??"Invalid input";t.message=i}return delete t.inst,delete t.continue,r?.reportInput||delete t.input,t}o(qe,"finalizeIssue");function li(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(li,"getLengthableOrigin");function Wr(...e){let[r,n,t]=e;return typeof r=="string"?{message:r,code:"custom",input:n,inst:t}:{...r}}o(Wr,"issue");var di=o((e,r)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:r,enumerable:!1}),e.message=JSON.stringify(r,ii,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),pi=w("$ZodError",di),It=w("$ZodError",di,{Parent:Error});var Pc=o(e=>(r,n,t,i)=>{let c=t?Object.assign(t,{async:!1}):{async:!1},u=r._zod.run({value:n,issues:[]},c);if(u instanceof Promise)throw new Ne;if(u.issues.length){let s=new(i?.Err??e)(u.issues.map(p=>qe(p,c,Ce())));throw Gr(s,i?.callee),s}return u.value},"_parse"),nr=Pc(It),Tc=o(e=>async(r,n,t,i)=>{let c=t?Object.assign(t,{async:!0}):{async:!0},u=r._zod.run({value:n,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){let s=new(i?.Err??e)(u.issues.map(p=>qe(p,c,Ce())));throw Gr(s,i?.callee),s}return u.value},"_parseAsync"),ir=Tc(It),Sc=o(e=>(r,n,t)=>{let i=t?{...t,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},i);if(c instanceof Promise)throw new Ne;return c.issues.length?{success:!1,error:new(e??pi)(c.issues.map(u=>qe(u,i,Ce())))}:{success:!0,data:c.value}},"_safeParse"),Et=Sc(It),Ac=o(e=>async(r,n,t)=>{let i=t?Object.assign(t,{async:!0}):{async:!0},c=r._zod.run({value:n,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(u=>qe(u,i,Ce())))}:{success:!0,data:c.value}},"_safeParseAsync"),$t=Ac(It);var Ic="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ec=new RegExp(`^${Ic}$`);var mi=o(e=>{let r=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${r}$`)},"string"),fi=/^-?\d+n?$/,gi=/^-?\d+$/,Kr=/^-?\d+(?:\.\d+)?$/,yi=/^(?:true|false)$/i;var Ve=w("$ZodCheck",(e,r)=>{var n;e._zod??(e._zod={}),e._zod.def=r,(n=e._zod).onattach??(n.onattach=[])}),$c={number:"number",bigint:"bigint",object:"date"};var hi=w("$ZodCheckGreaterThan",(e,r)=>{Ve.init(e,r);let n=$c[typeof r.value];e._zod.onattach.push(t=>{let i=t._zod.bag,c=(r.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;r.value>c&&(r.inclusive?i.minimum=r.value:i.exclusiveMinimum=r.value)}),e._zod.check=t=>{(r.inclusive?t.value>=r.value:t.value>r.value)||t.issues.push({origin:n,code:"too_small",minimum:typeof r.value=="object"?r.value.getTime():r.value,input:t.value,inclusive:r.inclusive,inst:e,continue:!r.abort})}});var _i=w("$ZodCheckNumberFormat",(e,r)=>{Ve.init(e,r),r.format=r.format||"float64";let n=r.format?.includes("int"),t=n?"int":"number",[i,c]=ci[r.format];e._zod.onattach.push(u=>{let s=u._zod.bag;s.format=r.format,s.minimum=i,s.maximum=c,n&&(s.pattern=gi)}),e._zod.check=u=>{let s=u.value;if(n){if(!Number.isInteger(s)){u.issues.push({expected:t,format:r.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?u.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:t,inclusive:!0,continue:!r.abort}):u.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:t,inclusive:!0,continue:!r.abort});return}}s<i&&u.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!r.abort}),s>c&&u.issues.push({origin:"number",input:s,code:"too_big",maximum:c,inclusive:!0,inst:e,continue:!r.abort})}});var bi=w("$ZodCheckMinLength",(e,r)=>{var n;Ve.init(e,r),(n=e._zod.def).when??(n.when=t=>{let i=t.value;return!oi(i)&&i.length!==void 0}),e._zod.onattach.push(t=>{let i=t._zod.bag.minimum??Number.NEGATIVE_INFINITY;r.minimum>i&&(t._zod.bag.minimum=r.minimum)}),e._zod.check=t=>{let i=t.value;if(i.length>=r.minimum)return;let u=li(i);t.issues.push({origin:u,code:"too_small",minimum:r.minimum,inclusive:!0,input:i,inst:e,continue:!r.abort})}});var Jr=w("$ZodCheckStringFormat",(e,r)=>{var n,t;Ve.init(e,r),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=r.format,r.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(r.pattern))}),r.pattern?(n=e._zod).check??(n.check=i=>{r.pattern.lastIndex=0,!r.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:r.format,input:i.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:e,continue:!r.abort})}):(t=e._zod).check??(t.check=()=>{})}),vi=w("$ZodCheckRegex",(e,r)=>{Jr.init(e,r),e._zod.check=n=>{r.pattern.lastIndex=0,!r.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:r.pattern.toString(),inst:e,continue:!r.abort})}});var Pi={major:4,minor:3,patch:6};var oe=w("$ZodType",(e,r)=>{var n;e??(e={}),e._zod.def=r,e._zod.bag=e._zod.bag||{},e._zod.version=Pi;let t=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&t.unshift(e);for(let i of t)for(let c of i._zod.onattach)c(e);if(t.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=o((u,s,p)=>{let g=ot(u),m;for(let A of s){if(A._zod.def.when){if(!A._zod.def.when(u))continue}else if(g)continue;let x=u.issues.length,d=A._zod.check(u);if(d instanceof Promise&&p?.async===!1)throw new Ne;if(m||d instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await d,u.issues.length!==x&&(g||(g=ot(u,x)))});else{if(u.issues.length===x)continue;g||(g=ot(u,x))}}return m?m.then(()=>u):u},"runChecks"),c=o((u,s,p)=>{if(ot(u))return u.aborted=!0,u;let g=i(s,t,p);if(g instanceof Promise){if(p.async===!1)throw new Ne;return g.then(m=>e._zod.parse(m,p))}return e._zod.parse(g,p)},"handleCanaryResult");e._zod.run=(u,s)=>{if(s.skipChecks)return e._zod.parse(u,s);if(s.direction==="backward"){let g=e._zod.parse({value:u.value,issues:[]},{...s,skipChecks:!0});return g instanceof Promise?g.then(m=>c(m,u,s)):c(g,u,s)}let p=e._zod.parse(u,s);if(p instanceof Promise){if(s.async===!1)throw new Ne;return p.then(g=>i(g,t,s))}return i(p,t,s)}}de(e,"~standard",()=>({validate:o(i=>{try{let c=Et(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return $t(e,i).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},"validate"),vendor:"zod",version:1}))}),sr=w("$ZodString",(e,r)=>{oe.init(e,r),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??mi(e._zod.bag),e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Yr=w("$ZodStringFormat",(e,r)=>{Jr.init(e,r),sr.init(e,r)});var Ei=w("$ZodURL",(e,r)=>{Yr.init(e,r),e._zod.check=n=>{try{let t=n.value.trim(),i=new URL(t);r.hostname&&(r.hostname.lastIndex=0,r.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:n.value,inst:e,continue:!r.abort})),r.protocol&&(r.protocol.lastIndex=0,r.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:n.value,inst:e,continue:!r.abort})),r.normalize?n.value=i.href:n.value=t;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!r.abort})}}});var Xr=w("$ZodNumber",(e,r)=>{oe.init(e,r),e._zod.pattern=e._zod.bag.pattern??Kr,e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;let c=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...c?{received:c}:{}}),n}}),$i=w("$ZodNumberFormat",(e,r)=>{_i.init(e,r),Xr.init(e,r)}),Qr=w("$ZodBoolean",(e,r)=>{oe.init(e,r),e._zod.pattern=yi,e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),wi=w("$ZodBigInt",(e,r)=>{oe.init(e,r),e._zod.pattern=fi,e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}});var ki=w("$ZodAny",(e,r)=>{oe.init(e,r),e._zod.parse=n=>n}),Ni=w("$ZodUnknown",(e,r)=>{oe.init(e,r),e._zod.parse=n=>n});var zi=w("$ZodVoid",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{let i=n.value;return typeof i>"u"||n.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),n}}),Di=w("$ZodDate",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{if(r.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,c=i instanceof Date;return c&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...c?{received:"Invalid Date"}:{},inst:e}),n}});function Ti(e,r,n){e.issues.length&&r.issues.push(...Be(n,e.issues)),r.value[n]=e.value}o(Ti,"handleArrayResult");var Oi=w("$ZodArray",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);let c=[];for(let u=0;u<i.length;u++){let s=i[u],p=r.element._zod.run({value:s,issues:[]},t);p instanceof Promise?c.push(p.then(g=>Ti(g,n,u))):Ti(p,n,u)}return c.length?Promise.all(c).then(()=>n):n}});function ar(e,r,n,t,i){if(e.issues.length){if(i&&!(n in t))return;r.issues.push(...Be(n,e.issues))}e.value===void 0?n in t&&(r.value[n]=void 0):r.value[n]=e.value}o(ar,"handlePropertyResult");function wc(e){let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${t}": expected a Zod schema`);let n=ui(e.shape);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(n)}}o(wc,"normalizeDef");function kc(e,r,n,t,i,c){let u=[],s=i.keySet,p=i.catchall._zod,g=p.def.type,m=p.optout==="optional";for(let A in r){if(s.has(A))continue;if(g==="never"){u.push(A);continue}let x=p.run({value:r[A],issues:[]},t);x instanceof Promise?e.push(x.then(d=>ar(d,n,A,r,m))):ar(x,n,A,r,m)}return u.length&&n.issues.push({code:"unrecognized_keys",keys:u,input:r,inst:c}),e.length?Promise.all(e).then(()=>n):n}o(kc,"handleCatchall");var Ci=w("$ZodObject",(e,r)=>{if(oe.init(e,r),!Object.getOwnPropertyDescriptor(r,"shape")?.get){let s=r.shape;Object.defineProperty(r,"shape",{get:o(()=>{let p={...s};return Object.defineProperty(r,"shape",{value:p}),p},"get")})}let t=er(()=>wc(r));de(e._zod,"propValues",()=>{let s=r.shape,p={};for(let g in s){let m=s[g]._zod;if(m.values){p[g]??(p[g]=new Set);for(let A of m.values)p[g].add(A)}}return p});let i=At,c=r.catchall,u;e._zod.parse=(s,p)=>{u??(u=t.value);let g=s.value;if(!i(g))return s.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),s;s.value={};let m=[],A=u.shape;for(let x of u.keys){let d=A[x],_=d._zod.optout==="optional",P=d._zod.run({value:g[x],issues:[]},p);P instanceof Promise?m.push(P.then(b=>ar(b,s,x,g,_))):ar(P,s,x,g,_)}return c?kc(m,g,s,p,t.value,e):m.length?Promise.all(m).then(()=>s):s}});function Si(e,r,n,t){for(let c of e)if(c.issues.length===0)return r.value=c.value,r;let i=e.filter(c=>!ot(c));return i.length===1?(r.value=i[0].value,i[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:n,errors:e.map(c=>c.issues.map(u=>qe(u,t,Ce())))}),r)}o(Si,"handleUnionResults");var en=w("$ZodUnion",(e,r)=>{oe.init(e,r),de(e._zod,"optin",()=>r.options.some(i=>i._zod.optin==="optional")?"optional":void 0),de(e._zod,"optout",()=>r.options.some(i=>i._zod.optout==="optional")?"optional":void 0),de(e._zod,"values",()=>{if(r.options.every(i=>i._zod.values))return new Set(r.options.flatMap(i=>Array.from(i._zod.values)))}),de(e._zod,"pattern",()=>{if(r.options.every(i=>i._zod.pattern)){let i=r.options.map(c=>c._zod.pattern);return new RegExp(`^(${i.map(c=>tr(c.source)).join("|")})$`)}});let n=r.options.length===1,t=r.options[0]._zod.run;e._zod.parse=(i,c)=>{if(n)return t(i,c);let u=!1,s=[];for(let p of r.options){let g=p._zod.run({value:i.value,issues:[]},c);if(g instanceof Promise)s.push(g),u=!0;else{if(g.issues.length===0)return g;s.push(g)}}return u?Promise.all(s).then(p=>Si(p,i,e,c)):Si(s,i,e,c)}});var Ri=w("$ZodDiscriminatedUnion",(e,r)=>{r.inclusive=!1,en.init(e,r);let n=e._zod.parse;de(e._zod,"propValues",()=>{let i={};for(let c of r.options){let u=c._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${r.options.indexOf(c)}"`);for(let[s,p]of Object.entries(u)){i[s]||(i[s]=new Set);for(let g of p)i[s].add(g)}}return i});let t=er(()=>{let i=r.options,c=new Map;for(let u of i){let s=u._zod.propValues?.[r.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${r.options.indexOf(u)}"`);for(let p of s){if(c.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);c.set(p,u)}}return c});e._zod.parse=(i,c)=>{let u=i.value;if(!At(u))return i.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),i;let s=t.value.get(u?.[r.discriminator]);return s?s._zod.run(i,c):r.unionFallback?n(i,c):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,input:u,path:[r.discriminator],inst:e}),i)}});var Ui=w("$ZodRecord",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{let i=n.value;if(!ai(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let c=[],u=r.keyType._zod.values;if(u){n.value={};let s=new Set;for(let g of u)if(typeof g=="string"||typeof g=="number"||typeof g=="symbol"){s.add(typeof g=="number"?g.toString():g);let m=r.valueType._zod.run({value:i[g],issues:[]},t);m instanceof Promise?c.push(m.then(A=>{A.issues.length&&n.issues.push(...Be(g,A.issues)),n.value[g]=A.value})):(m.issues.length&&n.issues.push(...Be(g,m.issues)),n.value[g]=m.value)}let p;for(let g in i)s.has(g)||(p=p??[],p.push(g));p&&p.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:p})}else{n.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let p=r.keyType._zod.run({value:s,issues:[]},t);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Kr.test(s)&&p.issues.length){let A=r.keyType._zod.run({value:Number(s),issues:[]},t);if(A instanceof Promise)throw new Error("Async schemas not supported in object keys currently");A.issues.length===0&&(p=A)}if(p.issues.length){r.mode==="loose"?n.value[s]=i[s]:n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(A=>qe(A,t,Ce())),input:s,path:[s],inst:e});continue}let m=r.valueType._zod.run({value:i[s],issues:[]},t);m instanceof Promise?c.push(m.then(A=>{A.issues.length&&n.issues.push(...Be(s,A.issues)),n.value[p.value]=A.value})):(m.issues.length&&n.issues.push(...Be(s,m.issues)),n.value[p.value]=m.value)}}return c.length?Promise.all(c).then(()=>n):n}});var Mi=w("$ZodEnum",(e,r)=>{oe.init(e,r);let n=Hr(r.entries),t=new Set(n);e._zod.values=t,e._zod.pattern=new RegExp(`^(${n.filter(i=>si.has(typeof i)).map(i=>typeof i=="string"?it(i):i.toString()).join("|")})$`),e._zod.parse=(i,c)=>{let u=i.value;return t.has(u)||i.issues.push({code:"invalid_value",values:n,input:u,inst:e}),i}}),Li=w("$ZodLiteral",(e,r)=>{if(oe.init(e,r),r.values.length===0)throw new Error("Cannot create literal schema with no valid values");let n=new Set(r.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.values.map(t=>typeof t=="string"?it(t):t?it(t.toString()):String(t)).join("|")})$`),e._zod.parse=(t,i)=>{let c=t.value;return n.has(c)||t.issues.push({code:"invalid_value",values:r.values,input:c,inst:e}),t}});var ji=w("$ZodTransform",(e,r)=>{oe.init(e,r),e._zod.parse=(n,t)=>{if(t.direction==="backward")throw new Xt(e.constructor.name);let i=r.transform(n.value,n);if(t.async)return(i instanceof Promise?i:Promise.resolve(i)).then(u=>(n.value=u,n));if(i instanceof Promise)throw new Ne;return n.value=i,n}});function Ai(e,r){return e.issues.length&&r===void 0?{issues:[],value:void 0}:e}o(Ai,"handleOptionalResult");var Fi=w("$ZodOptional",(e,r)=>{oe.init(e,r),e._zod.optin="optional",e._zod.optout="optional",de(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,void 0]):void 0),de(e._zod,"pattern",()=>{let n=r.innerType._zod.pattern;return n?new RegExp(`^(${tr(n.source)})?$`):void 0}),e._zod.parse=(n,t)=>{if(r.innerType._zod.optin==="optional"){let i=r.innerType._zod.run(n,t);return i instanceof Promise?i.then(c=>Ai(c,n.value)):Ai(i,n.value)}return n.value===void 0?n:r.innerType._zod.run(n,t)}});var Bi=w("$ZodNullable",(e,r)=>{oe.init(e,r),de(e._zod,"optin",()=>r.innerType._zod.optin),de(e._zod,"optout",()=>r.innerType._zod.optout),de(e._zod,"pattern",()=>{let n=r.innerType._zod.pattern;return n?new RegExp(`^(${tr(n.source)}|null)$`):void 0}),de(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,null]):void 0),e._zod.parse=(n,t)=>n.value===null?n:r.innerType._zod.run(n,t)});var qi=w("$ZodPipe",(e,r)=>{oe.init(e,r),de(e._zod,"values",()=>r.in._zod.values),de(e._zod,"optin",()=>r.in._zod.optin),de(e._zod,"optout",()=>r.out._zod.optout),de(e._zod,"propValues",()=>r.in._zod.propValues),e._zod.parse=(n,t)=>{if(t.direction==="backward"){let c=r.out._zod.run(n,t);return c instanceof Promise?c.then(u=>or(u,r.in,t)):or(c,r.in,t)}let i=r.in._zod.run(n,t);return i instanceof Promise?i.then(c=>or(c,r.out,t)):or(i,r.out,t)}});function or(e,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:e.value,issues:e.issues},n)}o(or,"handlePipeResult");var Vi=w("$ZodCustom",(e,r)=>{Ve.init(e,r),oe.init(e,r),e._zod.parse=(n,t)=>n,e._zod.check=n=>{let t=n.value,i=r.fn(t);if(i instanceof Promise)return i.then(c=>Ii(c,n,t,e));Ii(i,n,t,e)}});function Ii(e,r,n,t){if(!e){let i={code:"custom",input:n,inst:t,path:[...t._zod.def.path??[]],continue:!t._zod.def.abort};t._zod.def.params&&(i.params=t._zod.def.params),r.issues.push(Wr(i))}}o(Ii,"handleRefineResult");var Hi;var tn=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(r,...n){let t=n[0];return this._map.set(r,t),t&&typeof t=="object"&&"id"in t&&this._idmap.set(t.id,r),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(r){let n=this._map.get(r);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(r),this}get(r){let n=r._zod.parent;if(n){let t={...this.get(n)??{}};delete t.id;let i={...t,...this._map.get(r)};return Object.keys(i).length?i:void 0}return this._map.get(r)}has(r){return this._map.has(r)}};function Gi(){return new tn}o(Gi,"registry");(Hi=globalThis).__zod_globalRegistry??(Hi.__zod_globalRegistry=Gi());var rn=globalThis.__zod_globalRegistry;function Wi(e,r){return new e({type:"string",...re(r)})}o(Wi,"_string");function Ki(e,r){return new e({type:"string",coerce:!0,...re(r)})}o(Ki,"_coercedString");function Ji(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...re(r)})}o(Ji,"_url");function Yi(e,r){return new e({type:"number",checks:[],...re(r)})}o(Yi,"_number");function Xi(e,r){return new e({type:"number",coerce:!0,checks:[],...re(r)})}o(Xi,"_coercedNumber");function Qi(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...re(r)})}o(Qi,"_int");function eo(e,r){return new e({type:"boolean",...re(r)})}o(eo,"_boolean");function to(e,r){return new e({type:"boolean",coerce:!0,...re(r)})}o(to,"_coercedBoolean");function ro(e,r){return new e({type:"bigint",coerce:!0,...re(r)})}o(ro,"_coercedBigint");function no(e){return new e({type:"any"})}o(no,"_any");function io(e){return new e({type:"unknown"})}o(io,"_unknown");function oo(e,r){return new e({type:"void",...re(r)})}o(oo,"_void");function ao(e,r){return new e({type:"date",coerce:!0,...re(r)})}o(ao,"_coercedDate");function ur(e,r){return new hi({check:"greater_than",...re(r),value:e,inclusive:!0})}o(ur,"_gte");function we(e,r){return new bi({check:"min_length",...re(r),minimum:e})}o(we,"_minLength");function Ze(e,r){return new vi({check:"string_format",format:"regex",...re(r),pattern:e})}o(Ze,"_regex");function so(e,r,n){let t=re(n);return t.abort??(t.abort=!0),new e({type:"custom",check:"custom",fn:r,...t})}o(so,"_custom");var pe=w("ZodMiniType",(e,r)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");oe.init(e,r),e.def=r,e.type=r.type,e.parse=(n,t)=>nr(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>Et(e,n,t),e.parseAsync=async(n,t)=>ir(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>$t(e,n,t),e.check=(...n)=>e.clone({...r,checks:[...r.checks??[],...n.map(t=>typeof t=="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]},{parent:!0}),e.with=e.check,e.clone=(n,t)=>rr(e,n,t),e.brand=()=>e,e.register=((n,t)=>(n.add(e,t),e)),e.apply=n=>n(e)}),lr=w("ZodMiniString",(e,r)=>{sr.init(e,r),pe.init(e,r)});function l(e){return Wi(lr,e)}o(l,"string");var uo=w("ZodMiniStringFormat",(e,r)=>{Yr.init(e,r),lr.init(e,r)});var qc=w("ZodMiniURL",(e,r)=>{Ei.init(e,r),uo.init(e,r)});function co(e){return Ji(qc,e)}o(co,"url");var dr=w("ZodMiniNumber",(e,r)=>{Xr.init(e,r),pe.init(e,r)});function fe(e){return Yi(dr,e)}o(fe,"number");var Vc=w("ZodMiniNumberFormat",(e,r)=>{$i.init(e,r),dr.init(e,r)});function lo(e){return Qi(Vc,e)}o(lo,"int");var nn=w("ZodMiniBoolean",(e,r)=>{Qr.init(e,r),pe.init(e,r)});function Q(e){return eo(nn,e)}o(Q,"boolean");var po=w("ZodMiniBigInt",(e,r)=>{wi.init(e,r),pe.init(e,r)});var Zc=w("ZodMiniAny",(e,r)=>{ki.init(e,r),pe.init(e,r)});function kt(){return no(Zc)}o(kt,"any");var Hc=w("ZodMiniUnknown",(e,r)=>{Ni.init(e,r),pe.init(e,r)});function B(){return io(Hc)}o(B,"unknown");var Gc=w("ZodMiniVoid",(e,r)=>{zi.init(e,r),pe.init(e,r)});function mo(e){return oo(Gc,e)}o(mo,"_void");var fo=w("ZodMiniDate",(e,r)=>{Di.init(e,r),pe.init(e,r)});var Wc=w("ZodMiniArray",(e,r)=>{Oi.init(e,r),pe.init(e,r)});function M(e,r){return new Wc({type:"array",element:e,...re(r)})}o(M,"array");var Kc=w("ZodMiniObject",(e,r)=>{Ci.init(e,r),pe.init(e,r),de(e,"shape",()=>r.shape)});function f(e,r){let n={type:"object",shape:e??{},...re(r)};return new Kc(n)}o(f,"object");var Jc=w("ZodMiniUnion",(e,r)=>{en.init(e,r),pe.init(e,r)});function H(e,r){return new Jc({type:"union",options:e,...re(r)})}o(H,"union");var Yc=w("ZodMiniDiscriminatedUnion",(e,r)=>{Ri.init(e,r),pe.init(e,r)});function He(e,r,n){return new Yc({type:"union",options:r,discriminator:e,...re(n)})}o(He,"discriminatedUnion");var Xc=w("ZodMiniRecord",(e,r)=>{Ui.init(e,r),pe.init(e,r)});function q(e,r,n){return new Xc({type:"record",keyType:e,valueType:r,...re(n)})}o(q,"record");var Qc=w("ZodMiniEnum",(e,r)=>{Mi.init(e,r),pe.init(e,r),e.options=Object.values(r.entries)});function O(e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(t=>[t,t])):e;return new Qc({type:"enum",entries:n,...re(r)})}o(O,"_enum");var el=w("ZodMiniLiteral",(e,r)=>{Li.init(e,r),pe.init(e,r)});function D(e,r){return new el({type:"literal",values:Array.isArray(e)?e:[e],...re(r)})}o(D,"literal");var tl=w("ZodMiniTransform",(e,r)=>{ji.init(e,r),pe.init(e,r)});function Ge(e){return new tl({type:"transform",transform:e})}o(Ge,"transform");var rl=w("ZodMiniOptional",(e,r)=>{Fi.init(e,r),pe.init(e,r)});function v(e){return new rl({type:"optional",innerType:e})}o(v,"optional");var nl=w("ZodMiniNullable",(e,r)=>{Bi.init(e,r),pe.init(e,r)});function Nt(e){return new nl({type:"nullable",innerType:e})}o(Nt,"nullable");var il=w("ZodMiniPipe",(e,r)=>{qi.init(e,r),pe.init(e,r)});function We(e,r){return new il({type:"pipe",in:e,out:r})}o(We,"pipe");var ol=w("ZodMiniCustom",(e,r)=>{Vi.init(e,r),pe.init(e,r)});function pr(e,r){return so(ol,e??(()=>!0),r)}o(pr,"custom");var zt={};ti(zt,{bigint:()=>dl,boolean:()=>ll,date:()=>pl,number:()=>cl,string:()=>ul});function ul(e){return Ki(lr,e)}o(ul,"string");function cl(e){return Xi(dr,e)}o(cl,"number");function ll(e){return to(nn,e)}o(ll,"boolean");function dl(e){return ro(po,e)}o(dl,"bigint");function pl(e){return ao(fo,e)}o(pl,"date");var an=f({retryOnFailure:f({defaultValue:v(Q()),hide:v(Q())}),continueOnFailure:f({defaultValue:v(Q()),hide:v(Q())})}),on=class{constructor(r,n,t,i,c,u,s,p,g,m,A,x,d){this.name=r;this.displayName=n;this.description=t;this.props=i;this.propertyGroups=c;this.run=u;this.test=s;this.requireAuth=p;this.errorHandlingOptions=g;this.outputSchema=m;this.audience=A;this.aiMetadata=x;this.classification=d}static{o(this,"IAction")}},R=o(e=>new on(e.name,e.displayName,e.description,e.props,e.propertyGroups,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata,e.classification),"createAction");var Y=f({displayName:l(),description:v(l()),advanced:v(Q()),width:v(O(["half","full"])),icon:v(l()),placeholder:v(l())}),V=o((e,r)=>f({type:D(r),required:Q(),defaultValue:v(kt())}),"TPropertyValue");var Se=f({...Y.shape,...V(l(),"SHORT_TEXT").shape}),Re=f({...Y.shape,...V(l(),"LONG_TEXT").shape});var yo=f({label:l(),value:B(),description:v(l()),icon:v(l())}),mr=f({disabled:v(Q()),placeholder:v(l()),options:M(yo)});var fl=O(["cards"]),Ae=f({...Y.shape,options:mr,display:v(fl),...V(B(),"STATIC_DROPDOWN").shape}),Ue=f({...Y.shape,options:mr,...V(M(B()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var sn=f({...Y.shape,...V(B(),"DROPDOWN").shape,refreshers:M(l())}),Dt=f({...Y.shape,...V(M(B()),"MULTI_SELECT_DROPDOWN").shape,refreshers:M(l())});var Me=f({...Y.shape,reveals:v(M(l())),...V(Q(),"CHECKBOX").shape});var Le=f({...Y.shape,display:v(O(["stepper"])),min:v(fe()),max:v(fe()),step:v(fe()),...V(fe(),"NUMBER").shape});var Ot=f({...Y.shape,streaming:v(Q()),...V(B(),"FILE").shape});var Ct=f({...Y.shape,...V(l(),"DATE_TIME").shape});var ho=q(l(),H([Se,Re,Ae,Dt,Ue,Me,Le,Ot,Ct])),Rt=f({...Y.shape,properties:ho,...V(M(B()),"ARRAY").shape});var _o=O(["any_time","last_24_hours","last_7_days","last_30_days","last_90_days","this_month","custom"]),bo=f({preset:v(_o),after:v(l()),before:v(l())}),un=f({...Y.shape,display:v(O(["dropdown"])),...V(bo,"DATE_RANGE").shape});var Ut=f({...Y.shape,...V(H([q(l(),B())]),"JSON").shape});var vo=H([Se,Ae,Ut,Rt,Ue]),gl=q(l(),vo),cn=f({refreshers:M(l()),...Y.shape,...V(B(),"DYNAMIC").shape});var fr=f({...Y.shape,...V(mo(),"MARKDOWN").shape});var Mt=(n=>(n.ARCHIVE="ARCHIVE",n.REGISTRY="REGISTRY",n))(Mt||{}),at=(n=>(n.CUSTOM="CUSTOM",n.OFFICIAL="OFFICIAL",n))(at||{}),st=(T=>(T.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",T.COMMUNICATION="COMMUNICATION",T.COMMERCE="COMMERCE",T.CORE="CORE",T.UNIVERSAL_AI="UNIVERSAL_AI",T.FLOW_CONTROL="FLOW_CONTROL",T.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",T.ACCOUNTING="ACCOUNTING",T.PRODUCTIVITY="PRODUCTIVITY",T.CONTENT_AND_FILES="CONTENT_AND_FILES",T.DEVELOPER_TOOLS="DEVELOPER_TOOLS",T.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",T.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",T.HUMAN_RESOURCES="HUMAN_RESOURCES",T.PAYMENT_PROCESSING="PAYMENT_PROCESSING",T.MARKETING="MARKETING",T.SALES_AND_CRM="SALES_AND_CRM",T))(st||{});var Lt=(n=>(n.AUTHORIZATION_CODE="authorization_code",n.CLIENT_CREDENTIALS="client_credentials",n))(Lt||{}),ln="both_client_credentials_and_authorization_code";var ve=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(ve||{}),jt=(c=>(c.NONE="NONE",c.HEADER_PRESENT="HEADER_PRESENT",c.QUERY_PRESENT="QUERY_PRESENT",c.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",c.HEAD_REQUEST="HEAD_REQUEST",c))(jt||{}),yl=f({strategy:O(jt),paramName:v(l())}),Ft=(n=>(n.SIMULATION="SIMULATION",n.TEST_FUNCTION="TEST_FUNCTION",n))(Ft||{});var gr=(n=>(n.WEBSOCKET="WEBSOCKET",n.NONE="NONE",n))(gr||{}),xo=f({status:v(fe()),body:v(B()),headers:v(q(l(),l()))}),Po=f({type:D("DELAY"),resumeDateTime:l(),requestIdToReply:v(l()),handlerId:v(l()),streamStepProgress:v(O(gr))}),To=f({type:D("WEBHOOK"),requestId:l(),requestIdToReply:v(l()),response:xo,handlerId:v(l()),streamStepProgress:v(O(gr))}),hl=H([Po,To]);var _l=f({body:B(),rawBody:v(B()),headers:q(l(),l()),queryParams:q(l(),l())});function ce(e){return e==null}o(ce,"isNil");function Bt(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}o(Bt,"isEmpty");function yr(e,r){if(e==null)throw new Error(`${r} is null or undefined`)}o(yr,"assertNotNullOrUndefined");var dn=Ee(require("crypto"),1);var bl=128,Ke,ut,vl=o(e=>{if(e<0)throw new RangeError("Wrong ID size");try{!Ke||Ke.length<e?(Ke=Buffer.allocUnsafe(e*bl),dn.default.randomFillSync(Ke),ut=0):ut+e>Ke.length&&(dn.default.randomFillSync(Ke),ut=0)}catch(r){throw Ke=void 0,r}ut+=e},"fillPool"),xl=o(e=>(vl(e|=0),Ke.subarray(ut-e,ut)),"random"),Pl=o((e,r,n)=>{let t=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*t*r/e.length);return(c=r)=>{if(c<=0)return"";let u="";for(;;){let s=n(i),p=i;for(;p--;)if(u+=e[s[p]&t]||"",u.length===c)return u}}},"customRandom"),Ao=o((e,r=21)=>Pl(e,r,xl),"customAlphabet");var Tl="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Io=21,UT=l().check(Ze(new RegExp(`^[0-9a-zA-Z]{${Io}}$`))),Sl=Ao(Tl,Io);var Je=We(Ge(e=>e instanceof Date?e.toISOString():e),l()),$e={id:l(),created:Je,updated:Je},ie=o(e=>v(Nt(e)),"Nullable");function pn(e){return v(Nt(O(e)))}o(pn,"NullableEnum");var jT=We(Ge(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),v(Q())),hr=o(e=>We(Ge(r=>Array.isArray(r)?r:r!==void 0?[r]:void 0),v(M(e))),"OptionalArrayFromQuery");var qT=q(l(),B());var qt=(m=>(m.OPENAI="openai",m.OPENROUTER="openrouter",m.ANTHROPIC="anthropic",m.AZURE="azure",m.GOOGLE="google",m.ACTIVEPIECES="activepieces",m.CLOUDFLARE_GATEWAY="cloudflare-gateway",m.CUSTOM="custom",m.BEDROCK="bedrock",m.MISTRAL="mistral",m))(qt||{});var tS=l().check(Ze(/^#[0-9A-Fa-f]{6}$/));var nS=f({filename:l(),data:B(),type:D("file"),mimetype:v(l())});var Al=Ee($o());var lS=f({...$e,name:l(),permissions:M(l()),platformId:ie(l()),type:l(),userCount:v(fe())});var wo=(t=>(t.AGENT_DECIDE="agent-decide",t.CHOOSE_YOURSELF="choose-yourself",t.LEAVE_EMPTY="leave-empty",t))(wo||{}),mn=(n=>(n.FILE="FILE",n.TABLE="TABLE",n))(mn||{}),fn=(t=>(t.SSE="sse",t.STREAMABLE_HTTP="streamable-http",t.SIMPLE_HTTP="http",t))(fn||{});var gn=(t=>(t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t))(gn||{});var yn=(n=>(n.IN_PROGRESS="in-progress",n.COMPLETED="completed",n))(yn||{});var Il=f({mode:O(wo),value:B()}),El=f({auth:v(l()),fields:q(l(),Il)}),$l=f({pieceName:l(),pieceVersion:l(),actionName:l(),predefinedInput:v(El)}),wl=f({type:D("PIECE"),toolName:l().check(we(1)),pieceMetadata:$l}),kl=f({type:D("none")}),Nl=f({type:D("access_token"),accessToken:l()}),zl=f({type:D("api_key"),apiKey:l(),apiKeyHeader:l()}),Dl=f({type:D("headers"),headers:q(l(),l())}),Ol=He("type",[kl,Nl,zl,Dl]),ko=f({type:D("FLOW"),toolName:l().check(we(1)),externalFlowId:l(),flowDisplayName:v(l())}),No=f({type:D("MCP"),toolName:l().check(we(1)),serverUrl:co(),protocol:O(fn),auth:Ol}),zo=f({type:D("KNOWLEDGE_BASE"),toolName:l().check(we(1)),sourceType:O(mn),sourceId:l(),sourceName:l()}),Cl=He("type",[wl,ko,No,zo]),Rl=f({displayName:l(),description:v(l()),type:O(gn)}),Do=f({type:D("MARKDOWN"),markdown:l()}),ct={type:D("TOOL_CALL"),input:ie(q(l(),B())),output:v(B()),toolName:l(),status:O(yn),toolCallId:l(),startTime:l(),endTime:v(l())},FS=f(ct),Oo=He("toolCallType",[f({...ct,toolCallType:D("PIECE"),pieceName:l(),pieceVersion:l(),actionName:l()}),f({...ct,toolCallType:D("FLOW"),displayName:l(),externalFlowId:l()}),f({...ct,toolCallType:D("MCP"),displayName:l(),serverUrl:l()}),f({...ct,toolCallType:D("KNOWLEDGE_BASE"),displayName:l(),sourceType:l()}),f({...ct,toolCallType:D("UNKNOWN"),displayName:l()})]),Ul=H([Do,Oo]);var hn=(n=>(n.IMAGE="image",n.TEXT="text",n))(hn||{}),je=f({apiKey:l()}),Ml=je,Ll=f({apiKey:l(),apiKeyHash:l()}),jl=je,Fl=je,Bl=je,ql=je,Vl=je,Zl=je,Hl=je,Lo=f({accessKeyId:l().check(we(1)),secretAccessKey:l().check(we(1))}),Gl=f({}),Wl=f({}),Kl=f({}),Jl=f({}),Yl=f({}),Xl=f({}),jo=f({modelId:l(),modelName:l(),modelType:O(hn)}),Fo=f({apiKeyHeader:l(),baseUrl:l(),models:M(jo),defaultHeaders:v(q(l(),l()))}),Bo=f({accountId:l(),gatewayId:l(),models:M(jo),vertexProject:v(l()),vertexRegion:v(l())}),qo=f({resourceName:l(),apiVersion:We(Ge(e=>typeof e=="string"&&e.trim().length===0?void 0:e),v(l()))}),Vo=f({region:l().check(we(1))}),Ql=H([Ml,Bl,ql,Vl,Zl,Fl,jl,Ll,Lo,Hl]),Zo=H([Fo,Bo,qo,Vo,Gl,Kl,Jl,Yl,Wl,Xl]),ed=f({id:l(),name:l(),type:O(hn)}),td=f({id:l(),name:l(),provider:O(qt),config:Zo,enabledForChat:Q()}),rd=f({provider:O(qt),config:Zo,auth:Ql,platformId:l()});var ZS={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},Co=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],nd=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],id=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],Ro=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],od=["grok-4.20","grok-4.1-fast"],ad={openai:Co,anthropic:nd,google:Ro,activepieces:[...id.map(e=>`anthropic/${e}`),...Co.map(e=>`openai/${e}`),...Ro.map(e=>`google/${e}`),...od.map(e=>`x-ai/${e}`)]};var Uo=128e3,sd={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function ud({provider:e}){return e?sd[e]??Uo:Uo}o(ud,"getMaxContextTokens");var Mo={openai:"text-embedding-3-small",google:"text-embedding-004",azure:"text-embedding-3-small",activepieces:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"},cd={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},ld=new Set(["anthropic","mistral"]);function ze(e){return{chatModels:ad[e],maxContextTokens:ud({provider:e}),defaultEmbeddingModel:Mo[e],supportsEmbedding:Mo[e]!==void 0,supportsImageGeneration:!ld.has(e),webSearch:cd[e]}}o(ze,"buildProviderCapabilities");var dd={openai:ze("openai"),anthropic:ze("anthropic"),openrouter:ze("openrouter"),azure:ze("azure"),google:ze("google"),"cloudflare-gateway":ze("cloudflare-gateway"),custom:ze("custom"),bedrock:ze("bedrock"),mistral:ze("mistral"),activepieces:ze("activepieces")};var pd=f({base64Url:l(),fileName:l(),extension:v(l())}),md=f({mimeType:l(),url:l(),fileName:v(l())}),_n=H([pd,md]);var fd=H([f({type:D("file"),value:_n}),f({type:D("markdown"),value:l(),files:v(M(_n))})]),gd=f({sessionId:l(),message:l(),files:v(M(l()))});var Go=(n=>(n.ON_NEW_RECORD="ON_NEW_RECORD",n.ON_UPDATE_RECORD="ON_UPDATE_RECORD",n))(Go||{}),Wo=(n=>(n.ENABLED="ENABLED",n.DISABLED="DISABLED",n))(Wo||{}),bn=(t=>(t.RECORD_CREATED="RECORD_CREATED",t.RECORD_UPDATED="RECORD_UPDATED",t.RECORD_DELETED="RECORD_DELETED",t))(bn||{});var yd=H([f({...$e,name:l(),externalId:l(),type:D("STATIC_DROPDOWN"),tableId:l(),projectId:l(),data:f({options:M(f({value:l()}))})}),f({...$e,name:l(),externalId:l(),type:H([D("TEXT"),D("NUMBER"),D("DATE"),D("DATETIME")]),tableId:l(),projectId:l()})]),hd=f({...$e,name:l(),folderId:ie(l()),projectId:l(),externalId:l(),status:pn(Wo),trigger:pn(Go)}),_d=f({...$e,tableId:l(),projectId:l(),cells:q(l(),f({updated:l(),created:l(),value:B(),fieldName:l()}))}),bd=f({events:M(O(bn)),webhookUrl:l(),flowId:l()}),vd=f({fields:M(f({id:l(),name:l()})),rows:M(q(l(),l())),name:l()}),xd=f({projectId:l(),limit:v(zt.number()),cursor:v(l()),name:v(l()),externalIds:hr(l()),folderId:v(l()),folderIds:hr(l())}),Pd=f({records:M(M(f({fieldId:l(),value:Jo()}))),tableId:l()}),Td=f({cells:v(M(f({fieldId:l(),value:Jo()}))),tableId:l(),agentUpdate:v(Q())}),Ko=He("operator",[et("eq"),et("neq"),et("gt"),et("gte"),et("lt"),et("lte"),et("co"),Ho("exists"),Ho("not_exists")]),Sd=f({tableId:l(),limit:v(zt.number()),cursor:v(l()),filters:hr(Ko)});function Jo(){return We(Ge(e=>e==null?e:String(e)),Nt(l()))}o(Jo,"coerceToString");function et(e){return f({fieldId:l(),operator:D(e),value:l()})}o(et,"valueFilter");function Ho(e){return f({fieldId:l(),operator:D(e)})}o(Ho,"existenceFilter");var Ad=f({status:v(fe()),body:v(B()),headers:v(q(l(),l()))}),Id=f({...$e,deleted:ie(Je),ownerId:l(),displayName:l(),platformId:l(),externalId:ie(l())});var Yo=f({name:l(),description:v(l()),type:l(),required:Q()}),Ed=f({pieceName:l(),triggerName:l(),input:f({toolName:l(),toolDescription:l(),inputSchema:M(Yo),returnsResponse:Q()})});var Xo="^[0-9]+\\.[0-9]+\\.[0-9]+$",lA=new RegExp(Xo),wd="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",dA=l().check(Ze(new RegExp(Xo))),pA=l().check(Ze(new RegExp(wd))),kd=f({packageType:D("ARCHIVE"),pieceType:O(at),pieceName:l(),pieceVersion:l(),archiveId:l(),platformId:l()}),Qo=f({packageType:D("REGISTRY"),pieceType:D("OFFICIAL"),pieceName:l(),pieceVersion:l()}),ea=f({packageType:D("REGISTRY"),pieceType:D("CUSTOM"),pieceName:l(),pieceVersion:l(),platformId:l()}),mA=H([Qo,ea]),fA=H([kd,Qo,ea]);var Nd=He("type",[f({type:D("CRON_EXPRESSION"),cronExpression:l(),timezone:l()}),f({type:D("INTERVAL"),intervalMs:lo().check(ur(6e4))})]),gA=f({...$e,type:O(ve),projectId:l(),flowId:l(),triggerName:l(),schedule:ie(Nd),flowVersionId:l(),pieceName:l(),pieceVersion:l(),deleted:ie(l()),simulate:Q()}),ta=(b=>(b.UNKNOWN="UNKNOWN",b.FLOW_RUN_LOG="FLOW_RUN_LOG",b.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",b.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",b.FLOW_STEP_FILE="FLOW_STEP_FILE",b.SAMPLE_DATA="SAMPLE_DATA",b.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",b.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",b.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",b.PROJECT_RELEASE="PROJECT_RELEASE",b.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",b.PLATFORM_ASSET="PLATFORM_ASSET",b.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",b.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",b.KNOWLEDGE_BASE="KNOWLEDGE_BASE",b.FLOW_BUNDLE="FLOW_BUNDLE",b))(ta||{}),ra=(n=>(n.NONE="NONE",n.ZSTD="ZSTD",n))(ra||{}),na=(n=>(n.S3="S3",n.DB="DB",n))(na||{}),yA=f({...$e,projectId:ie(l()),platformId:ie(l()),type:O(ta),compression:O(ra),data:v(B()),location:O(na),size:ie(fe()),fileName:ie(l()),s3Key:ie(l()),metadata:ie(q(l(),l()))}),ia=(t=>(t.ADMIN="ADMIN",t.MEMBER="MEMBER",t.OPERATOR="OPERATOR",t))(ia||{}),oa=(n=>(n.ACTIVE="ACTIVE",n.INACTIVE="INACTIVE",n))(oa||{}),hA=f({id:l(),email:l(),firstName:l(),status:O(oa),externalId:ie(l()),platformId:ie(l()),platformRole:O(ia),lastName:l(),created:Je,updated:Je,lastActiveDate:ie(Je),imageUrl:ie(l())});var vn=f({...Y.shape,...V(q(l(),B()),"OBJECT").shape});var xn=f({...Y.shape,formatProperty:v(l()),...V(l(),"RICH_TEXT").shape});var ca=f({...Y.shape,...V(l(),"COLOR").shape});var Pn=H([Se,Re,xn,fr,Me,Ae,Ue,sn,Dt,cn,Le,Rt,vn,Ut,Ct,un,Ot,ca]),a={ShortText(e){return{...e,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(e){return{...e,valueSchema:void 0,type:"CHECKBOX"}},LongText(e){return{...e,valueSchema:void 0,type:"LONG_TEXT"}},RichText(e){return{...e,valueSchema:void 0,type:"RICH_TEXT"}},MarkDown(e){return{displayName:"Markdown",required:!1,description:e.value,type:"MARKDOWN",valueSchema:void 0,variant:e.variant??"INFO"}},Number(e){return{...e,valueSchema:void 0,type:"NUMBER"}},Json(e){return{...e,valueSchema:void 0,type:"JSON"}},Array(e){return{...e,valueSchema:void 0,type:"ARRAY"}},Object(e){return{...e,valueSchema:void 0,type:"OBJECT"}},Dropdown(e){return{...e,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(e){return{...e,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(e){return{...e,valueSchema:void 0,type:"DATE_TIME"}},DateRange(e){return{...e,valueSchema:void 0,type:"DATE_RANGE"}},File(e){return{...e,valueSchema:void 0,type:"FILE"}},Custom(e){let r=e.code.toString();return{...e,code:r,valueSchema:void 0,type:"CUSTOM"}},Color(e){return{...e,valueSchema:void 0,type:"COLOR"}}};var De=f({displayName:l(),description:v(l()),hasConnectionIdentifier:v(Q())});var la=f({username:l(),password:l()}),Tn=f({...De.shape,username:f({displayName:l(),description:v(l())}),password:f({displayName:l(),description:v(l())}),...V(la,"BASIC_AUTH").shape});var Cd=q(l(),H([Se,Re,Le,Me,Ae])),Sn=f({...De.shape,props:Cd,...V(B(),"CUSTOM_AUTH").shape});var tt=f({...De.shape,...V(f({auth:l()}),"SECRET_TEXT").shape});var Rd=q(l(),H([Se,Re,tt,Le,Me,Ae,Ue,fr])),da=f({...De.shape,props:Rd,...V(B(),"OIDC").shape});var An=(n=>(n.HEADER="HEADER",n.BODY="BODY",n))(An||{}),pa=H([Se,tt,Ae]),ma=q(l(),pa),Ud=f({props:v(q(l(),pa)),authUrl:l(),tokenUrl:l(),scope:M(l()),prompt:v(H([D("none"),D("consent"),D("login"),D("omit")])),pkce:v(Q()),pkceMethod:v(H([D("plain"),D("S256")])),authorizationMethod:v(O(An)),grantType:v(H([O(Lt),D(ln)])),extra:v(q(l(),l()))}),fa=f({access_token:l(),props:v(ma),data:q(l(),kt())}),In=f({...De.shape,...Ud.shape,...V(fa,"OAUTH2").shape});var lt=H([Tn,Sn,da,In,tt]),Vt="Connection",En={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||Vt}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||Vt,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||Vt}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||Vt}},None(){}};var eE={OAUTH2:"OAUTH2",CLOUD_OAUTH2:"OAUTH2",PLATFORM_OAUTH2:"OAUTH2",BASIC_AUTH:"BASIC_AUTH",CUSTOM_AUTH:"CUSTOM_AUTH",OIDC:"OIDC",SECRET_TEXT:"SECRET_TEXT",NO_AUTH:void 0};var Md=f({...Y.shape,...V(B(),"CUSTOM").shape,code:l()});var Ld=H([Pn,lt]),$n=q(l(),Ld),xE=q(l(),Pn);var ga=H([f({strategy:D("CRON"),cronExpression:l()}),f({strategy:D("NONE")})]),dt=class{constructor(r,n,t,i,c,u,s,p,g,m,A,x,d,_,P,b,T,S,Z,se,he){this.name=r;this.displayName=n;this.description=t;this.requireAuth=i;this.props=c;this.type=u;this.handshakeConfiguration=s;this.onHandshake=p;this.renewConfiguration=g;this.onRenew=m;this.onEnable=A;this.onDisable=x;this.onStart=d;this.run=_;this.test=P;this.sampleData=b;this.testStrategy=T;this.outputSchema=S;this.aiMetadata=Z;this.classification=se;this.propertyGroups=he}static{o(this,"ITrigger")}},xe=o(e=>{switch(e.type){case"WEBHOOK":return new dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:"NONE"},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:"NONE"},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?"TEST_FUNCTION":"SIMULATION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"POLLING":return new dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"MANUAL":return new dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"APP_WEBHOOK":return new dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,ce(e.sampleData)&&ce(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups)}},"createTrigger");var ya="2",br="0.82.0";var wn=class{constructor(r,n,t,i,c,u,s,p,g=br,m,A="",x){this.displayName=r;this.logoUrl=n;this.authors=t;this.events=i;this.categories=s;this.auth=p;this.minimumSupportedRelease=g;this.maximumSupportedRelease=m;this.description=A;this.deprecated=x;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:ya}),"getContextInfo");(!Fd(g)||Bd(g,br))&&(this.minimumSupportedRelease=br),c.forEach(d=>this._actions[d.name]=d),u.forEach(d=>this._triggers[d.name]=d)}static{o(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:jd(this.auth),minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(r){return this._actions[r]}getTrigger(r){return this._triggers[r]}actions(){return this._actions}triggers(){return this._triggers}},_a=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((n,t,i)=>t===i.findIndex(c=>c.type===n.type)))throw new Error("Auth properties must be unique by type");return new wn(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description,e.deprecated)},"createPiece");function jd(e){if(e!==void 0)return Array.isArray(e)?e.map(ha):ha(e)}o(jd,"withConnectionIdentifierFlag");function ha(e){return{...e,hasConnectionIdentifier:e.getConnectionIdentifier!==void 0}}o(ha,"flagConnectionIdentifier");function Fd(e){return/^\d+\.\d+\.\d+$/.test(e)}o(Fd,"isValidSimpleSemver");function Bd(e,r){let[n,t,i]=e.split(".").map(Number),[c,u,s]=r.split(".").map(Number);return n!==c?n<c:t!==u?t<u:i<s}o(Bd,"isSemverLessThan");var qd=v(q(l(),q(l(),l()))),ba=f({id:v(l()),name:l(),displayName:l(),logoUrl:l(),description:l(),authors:M(l()),platformId:v(l()),directoryPath:v(l()),auth:v(H([lt,M(lt)])),version:l(),categories:v(M(O(st))),minimumSupportedRelease:v(l()),maximumSupportedRelease:v(l()),deprecated:v(Q()),i18n:qd}),Vd=O(["human","ai","both"]),va=f({description:v(l()),idempotent:v(Q())}),xa=O(["READ","SEARCH","WRITE","DESTRUCTIVE"]);var Zd=O(["tabs","section","summary","builder","footer"]),Pa=f({key:l(),display:Zd,label:v(l()),description:v(l()),icon:v(l()),props:M(l())}),Ta=f({name:l(),displayName:l(),description:l(),props:$n,propertyGroups:v(M(Pa)),requireAuth:Q(),errorHandlingOptions:v(an),outputSchema:v(pr()),audience:v(Vd),aiMetadata:v(va),classification:v(xa)}),Sa=f({name:l(),displayName:l(),description:l(),props:$n,propertyGroups:v(M(Pa)),errorHandlingOptions:v(an),type:O(ve),sampleData:B(),handshakeConfiguration:v(pr()),renewConfiguration:v(ga),testStrategy:O(Ft),outputSchema:v(pr()),aiMetadata:v(va),classification:v(xa)}),Hd=f({...ba.shape,actions:q(l(),Ta),triggers:q(l(),Sa)}),Gd=f({...ba.shape,actions:fe(),triggers:fe(),suggestedActions:v(M(Ta)),suggestedTriggers:v(M(Sa))}),Aa=f({projectUsage:fe(),pieceType:O(at),packageType:O(Mt),platformId:v(l()),archiveId:v(l())}),T$=f({...Hd.shape,...Aa.shape}),S$=f({...Gd.shape,...Aa.shape}),A$=f({name:l(),version:l()});var Wd=Ee(require("path")),Kd=Ee(require("fs/promises"));var pt=require("node:stream");var vr=class{constructor(r,n){this.baseUrl=r;this.authenticationConverter=n}static{o(this,"BaseHttpClient")}getUrl(r){let n=new URL(`${this.baseUrl}${r.url}`),t=`${n.origin}${n.pathname}`,i=new URLSearchParams;return n.searchParams.forEach((c,u)=>{i.append(u,c)}),{urlWithoutQueryParams:t,queryParams:i}}getHeaders(r){let n={Accept:"application/json"};return r.authentication&&this.populateAuthentication(r.authentication,n),r.body&&(r.headers?.["Content-Type"]==="text/csv"?n["Content-Type"]="text/csv":n["Content-Type"]="application/json"),r.headers&&(n={...n,...r.headers}),n}populateAuthentication(r,n){this.authenticationConverter.convert(r,n)}};var xr=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(r=new kn,n=new Nn){this.converters={BEARER_TOKEN:r,BASIC:n}}convert(r,n){return this.converters[r.type].convert(r,n)}},kn=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(r,n){return n.Authorization=`Bearer ${r.token}`,n}},Nn=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(r,n){let t=`${r.username}:${r.password}`,i=Buffer.from(t).toString("base64");return n.Authorization=`Basic ${i}`,n}};var Zt=class extends Error{constructor(n,t){let i=t.status||500,c=Buffer.isBuffer(t.responseBody)?t.responseBody.toString():t.responseBody;super(JSON.stringify({response:{status:i,body:c},request:{body:n}}));this.requestBody=n;this.status=i,this.responseBody=c}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};function Ia({error:e,requestBody:r}){return e instanceof Zt?e.errorMessage():{response:{status:0,body:e instanceof Error?e.message:String(e)},request:{body:r}}}o(Ia,"toFailsafeOutput");var Ht=(u=>(u.GET="GET",u.POST="POST",u.PATCH="PATCH",u.PUT="PUT",u.DELETE="DELETE",u.HEAD="HEAD",u))(Ht||{});var Pr=class extends vr{static{o(this,"FetchHttpClient")}constructor(r="",n=new xr){super(r,n)}async sendRequest(r,n){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:t,queryParams:i}=this.getUrl(r),c=this.getHeaders(r),u=r.queryParams??{};for(let[Z,se]of Object.entries(u))i.append(Z,se);let s=i.toString(),p=s?`${t}?${s}`:t,g=r.responseType??"json",m=r.followRedirects??!0,A=r.retries??0,{body:x,extraHeaders:d,isStream:_}=Jd(r.method)?Yd(r.body,c):{body:void 0,extraHeaders:{},isStream:!1},P=Qd({...c,...d}),b=await Xd(async()=>{let Z=new AbortController,se=r.timeout&&r.timeout>0?setTimeout(()=>Z.abort(),r.timeout):void 0;try{let he={method:r.method.toString(),headers:P,body:x,redirect:m?"follow":"manual",signal:Z.signal};return _&&(he.duplex="half"),n?.dispatcher!==void 0&&(he.dispatcher=n.dispatcher),await fetch(p,he)}finally{se!==void 0&&clearTimeout(se)}},_?0:A),T=m?300:400;if(b.status<200||b.status>=T){let Z=await Ea(b,g==="stream"?"text":g),se=new Zt(r.body,{status:b.status,responseBody:Z});throw console.error("[HttpClient#(sanitized error message)] Request failed:",se),se}let S=await Ea(b,g);return{status:b.status,headers:ep(b.headers),body:S}}};function Jd(e){return e!=="GET"&&e!=="HEAD"}o(Jd,"acceptsRequestBody");function Yd(e,r){if(wa(e))return{body:void 0,extraHeaders:{},isStream:!1};if(tp(e)){let t=new pt.PassThrough;return e.on("error",i=>t.destroy(i)),e.pipe(t),{body:t,extraHeaders:e.getHeaders(),isStream:!0}}return e instanceof pt.Readable?{body:e,extraHeaders:{},isStream:!0}:typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(r["Content-Type"]??r["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}o(Yd,"serializeBody");async function Ea(e,r){switch(r){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"stream":return wa(e.body)?pt.Readable.from([]):pt.Readable.fromWeb(e.body);case"blob":return await e.blob();case"text":return await e.text();default:{let n=await e.text();if(n.length===0)return;try{return JSON.parse(n)}catch{return n}}}}o(Ea,"parseResponseBody");async function Xd(e,r){let n;for(let t=0;t<=r;t++)try{let i=await e();if(i.status>=500&&t<r){await $a(t);continue}return i}catch(i){if(n=i,t<r){await $a(t);continue}throw i}throw n}o(Xd,"sendWithRetries");function $a(e){let r=Math.min(1e3*2**e,3e4);return new Promise(n=>setTimeout(n,r))}o($a,"backoff");function Qd(e){let r={};for(let[n,t]of Object.entries(e))t!==void 0&&(r[n.toLowerCase()]=Array.isArray(t)?t.join(", "):t);return r}o(Qd,"normalizeHeaders");function ep(e){let r={};return e.forEach((n,t)=>{r[t]=n}),r}o(ep,"toHttpHeaders");function tp(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}o(tp,"isNodeFormData");function wa(e){return e==null}o(wa,"isNil");var mt=new Pr;var Bm=Ee(require("fs")),Ou=Ee(Xn());var qm={"application/json":"json","application/pdf":"pdf","application/xml":"xml","text/xml":"xml","application/zip":"zip","application/gzip":"gz","application/x-tar":"tar","application/octet-stream":"bin","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/rtf":"rtf","application/javascript":"js","application/x-www-form-urlencoded":"bin","text/plain":"txt","text/html":"html","text/css":"css","text/csv":"csv","text/calendar":"ics","text/markdown":"md","image/png":"png","image/jpeg":"jpeg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","image/x-icon":"ico","image/vnd.microsoft.icon":"ico","image/heic":"heic","audio/mpeg":"mp3","audio/mp4":"m4a","audio/wav":"wav","audio/x-wav":"wav","audio/ogg":"ogg","audio/webm":"weba","video/mp4":"mp4","video/mpeg":"mpeg","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","font/woff":"woff","font/woff2":"woff2","font/ttf":"ttf","font/otf":"otf"};function Vm(e){let r=e.split(";")[0].trim().toLowerCase();return qm[r]??""}o(Vm,"contentTypeToExtension");var Zm=o(({baseUrl:e,relativePath:r})=>{let n=e.endsWith("/")?e:`${e}/`,t=r.startsWith("/")?r.slice(1):r;return`${n}${t}`},"joinBaseUrlWithRelativePath"),Hm=o((e,r)=>{let n="https://api.example.com";try{let t=r?e(r):void 0;return(t?.endsWith("/")?t.slice(0,-1):t)??n}catch{return n}},"getBaseUrlForDescription");function Cu({auth:e,baseUrl:r,authMapping:n,description:t,displayName:i,name:c,props:u,extraProps:s,authLocation:p="headers",classification:g="WRITE"}){return R({audience:"human",name:c||"custom_api_call",classification:g,displayName:i||"Custom API Call",description:t||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:a.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:o(async({auth:m})=>({url:a.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
3
+ i.e ${Hm(r,m)}/resource or /resource`,required:!0,defaultValue:m?r(m):"",...u?.url??{}})}),"props")}),method:a.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(Ht).map(m=>({label:m,value:m}))},...u?.method??{}}),headers:a.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...u?.headers??{}}),queryParams:a.Object({displayName:"Query Parameters",required:!0,...u?.queryParams??{}}),body_type:a.StaticDropdown({displayName:"Body Type",required:!1,defaultValue:"none",options:{disabled:!1,options:[{label:"None",value:"none"},{label:"JSON",value:"json"},{label:"Form Data",value:"form_data"},{label:"Raw",value:"raw"}]}}),body:a.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:m})=>{if(!m)return{};let A=m,x={};switch(A){case"none":break;case"json":x.data=a.Json({displayName:"JSON Body",required:!0,...u?.body??{}});break;case"raw":x.data=a.LongText({displayName:"Raw Body",required:!0});break;case"form_data":x.data=a.Array({displayName:"Form Data",required:!0,properties:{fieldName:a.ShortText({displayName:"Field Name",required:!0}),fieldType:a.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:a.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:a.File({displayName:"File Field Value",required:!1})}});break}return x},"props")}),response_is_binary:a.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:a.Checkbox({displayName:"No Error on Failure",required:!1,...u?.failsafe??{}}),timeout:a.Number({displayName:"Timeout (in seconds)",required:!1,...u?.timeout??{}}),followRedirects:a.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...s},run:o(async m=>{let{method:A,url:x,headers:d,queryParams:_,body:P,body_type:b,failsafe:T,timeout:S,response_is_binary:Z,followRedirects:se}=m.propsValue;yr(A,"Method"),yr(x,"URL");let he=ce(n)?{}:await n(m.auth,m.propsValue),Te=x.url,le=Te.startsWith("http://")||Te.startsWith("https://")?Te:Zm({baseUrl:r(m.auth),relativePath:Te}),K={method:A,url:le,headers:{...d??{},...p==="headers"||!ce(p)?he:{}},queryParams:{...p==="queryParams"?he:{},..._??{}},timeout:S?S*1e3:0,followRedirects:se};if(Z&&(K.responseType="arraybuffer"),P)if(b&&b!=="none"){let _e=P.data;if(b==="form_data"){let Jt=_e,U=new Ou.default;for(let{fieldName:$,fieldType:I,textFieldValue:k,fileFieldValue:E}of Jt)I==="text"&&!Bt(k)?U.append($,k):I==="file"&&!Bt(E)&&U.append($,E.data,{filename:E?.filename});K.body=U,K.headers={...K.headers,...U.getHeaders()}}else K.body=_e}else b||(K.body=P);try{let _e=await mt.sendRequest(K);return await Gm(m.files,_e.body,_e.status,_e.headers,Z)}catch(_e){if(T)return Ia({error:_e,requestBody:K.body});throw _e}},"run")})}o(Cu,"createCustomApiCallAction");var Gm=o(async(e,r,n,t,i)=>{let c;if(i&&Wm(r)){let u=Array.isArray(t?.["content-type"])?t["content-type"][0]:t?.["content-type"],s=Vm(u??"")||"txt",p;r instanceof ArrayBuffer?p=Buffer.from(new Uint8Array(r)):Buffer.isBuffer(r)?p=r:p=Buffer.from(r),c=await e.write({fileName:`output.${s}`,data:p})}else c=r;return{status:n,headers:t,body:c}},"handleBinaryResponse"),Wm=o(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var X={async poll(e,{store:r,auth:n,propsValue:t,maxItemsToPoll:i,files:c,server:u}){switch(e.strategy){case 0:{let s=await r.get("lastPoll");if(ce(s))throw new Error("lastPoll doesn't exist in the store.");let p=await e.items({store:r,auth:n,propsValue:t,lastFetchEpochMS:s,server:u}),g=p.reduce((m,A)=>Math.max(m,A.epochMilliSeconds),s);return await r.put("lastPoll",g),p.filter(m=>m.epochMilliSeconds>s).map(m=>m.data)}case 1:{let s=await r.get("lastItem"),p=await e.items({store:r,auth:n,propsValue:t,lastItemId:s,files:c,server:u}),g=p.findIndex(x=>x.id===s),m=[];ce(s)||g==-1?m=p??[]:m=p?.slice(0,g)??[],ce(i)||(m=m.slice(-i));let A=m?.[0]?.id;return ce(A)||await r.put("lastItem",A),m.map(x=>x.data)}}},async onEnable(e,{store:r,auth:n,propsValue:t,server:i,isRepublish:c}){switch(e.strategy){case 0:{if(c&&!ce(await r.get("lastPoll")))break;await r.put("lastPoll",Date.now());break}case 1:{if(c&&!ce(await r.get("lastItem")))break;let s=(await e.items({store:r,auth:n,propsValue:t,lastItemId:null,server:i}))?.[0]?.id;ce(s)?await r.delete("lastItem"):await r.put("lastItem",s);break}}},async onDisable(e,r){switch(e.strategy){case 0:case 1:return}},async test(e,{auth:r,propsValue:n,store:t,files:i,server:c}){let u=[];switch(e.strategy){case 0:{u=await e.items({store:t,auth:r,propsValue:n,lastFetchEpochMS:0,server:c});break}case 1:{u=await e.items({store:t,auth:r,propsValue:n,lastItemId:null,files:i,server:c});break}}return Km(u.map(s=>s.data))}};function Km(e){return e.length<=5?e:e.slice(0,5)}o(Km,"getFirstFiveOrAll");var bt={baseUrl:"https://api.bexio.com",api_version:"3.0"};var h=class{constructor(r){this.auth=r}static{o(this,"BexioClient")}async makeRequest(r,n,t,i){let c=n.startsWith("/2.0/")||n.startsWith("/3.0/")?`${bt.baseUrl}${n}`:`${bt.baseUrl}/${bt.api_version}${n}`,u={method:r,url:c,authentication:{type:"BEARER_TOKEN",token:this.auth.access_token},headers:{Accept:"application/json","Content-Type":"application/json"}};return t&&(u.body=t),i&&(u.queryParams=i),(await mt.sendRequest(u)).body}async get(r,n){return this.makeRequest("GET",r,void 0,n)}async post(r,n,t){return this.makeRequest("POST",r,n,t)}async patch(r,n){return this.makeRequest("PATCH",r,n)}async delete(r){return this.makeRequest("DELETE",r)}};var y=En.OAuth2({authUrl:"https://auth.bexio.com/realms/bexio/protocol/openid-connect/auth",tokenUrl:"https://auth.bexio.com/realms/bexio/protocol/openid-connect/token",required:!0,scope:["openid","profile","email","offline_access","contact_show","contact_edit","article_show","article_edit","kb_invoice_show","kb_invoice_edit","kb_offer_show","kb_offer_edit","kb_order_show","kb_order_edit","project_show","project_edit","task_show","monitoring_edit","accounting","file"],validate:o(async({auth:e})=>{try{return await new h(e).get("/users/me"),{valid:!0}}catch{return{valid:!1,error:"Authentication failed. Please check your connection and try again."}}},"validate")});var Ru=R({auth:y,name:"create_manual_entry",classification:"WRITE",displayName:"Create Manual Entry",description:"Create a manual accounting entry (single, compound, or group)",audience:"both",aiMetadata:{description:"Books a manual accounting entry in Bexio in one of three modes: a single debit/credit line, a compound entry distributing a total across several accounts, or a group of multiple complete bookings sharing one reference. Use to post journal entries directly to the ledger; requires a booking date and the entry lines for the chosen mode (account ids resolvable via Find Account). Not idempotent: each call posts new ledger bookings.",idempotent:!1},props:{type:a.StaticDropdown({displayName:"Entry Type",description:"Choose the type of manual entry",required:!0,defaultValue:"manual_single_entry",options:{disabled:!1,options:[{label:"Single Entry - Simple one-line booking",value:"manual_single_entry"},{label:"Compound Entry - Total distributed across multiple accounts",value:"manual_compound_entry"},{label:"Group Entry - Multiple separate bookings with same reference",value:"manual_group_entry"}]}}),date:a.ShortText({displayName:"Booking Date",description:"Date of the booking (YYYY-MM-DD)",required:!0}),reference_nr:a.ShortText({displayName:"Reference Number",description:"Reference number for the booking",required:!1}),entryFields:a.DynamicProperties({auth:y,displayName:"Entry Details",description:"Configure the entry details based on selected type",required:!0,refreshers:["type","auth"],props:o(async({type:e,auth:r},n)=>{let t=e||"manual_single_entry",i=[],c=[],u=[];if(r)try{let m=new h(r);i=await m.get("/accounts"),c=await m.get("/taxes"),u=await m.get("/3.0/currencies")}catch(m){console.warn("Failed to fetch accounts/taxes/currencies:",m)}let s=i.map(m=>({label:`${m.account_no} - ${m.name}`,value:m.id})),p=c.map(m=>({label:`${m.name} (${m.percentage}%)`,value:m.id})),g=u.map(m=>({label:m.name,value:m.id}));if(t==="manual_single_entry")return{debit_account:s.length>0?a.StaticDropdown({displayName:"Debit Account",description:"The account to debit",required:!0,options:{disabled:!1,options:s}}):a.Number({displayName:"Debit Account ID",description:"The account ID to debit",required:!0}),credit_account:s.length>0?a.StaticDropdown({displayName:"Credit Account",description:"The account to credit",required:!0,options:{disabled:!1,options:s}}):a.Number({displayName:"Credit Account ID",description:"The account ID to credit",required:!0}),amount:a.Number({displayName:"Amount",description:"The transaction amount",required:!0}),description:a.ShortText({displayName:"Description",description:"Description of the transaction",required:!1}),tax_id:p.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (optional)",required:!1,options:{disabled:!1,options:p}}):a.Number({displayName:"Tax ID",description:"Tax ID (optional)",required:!1}),tax_account:s.length>0?a.StaticDropdown({displayName:"Tax Account",description:"Account for tax calculation",required:!1,options:{disabled:!1,options:s}}):a.Number({displayName:"Tax Account ID",description:"Account ID for tax calculation",required:!1}),currency_id:g.length>0?a.StaticDropdown({displayName:"Currency",description:"Currency (optional)",required:!1,options:{disabled:!1,options:g}}):a.Number({displayName:"Currency ID",description:"Currency ID (optional)",required:!1}),currency_factor:a.Number({displayName:"Currency Factor",description:"Exchange rate factor (defaults to 1)",required:!1}),helper_info:a.MarkDown({value:""}),entries:a.Array({displayName:"Entries",description:"Not used for single entries",required:!1,properties:{}})};{let m=t==="manual_compound_entry";return{debit_account:a.Number({displayName:"Debit Account",description:"Not used for compound/group entries",required:!1}),credit_account:a.Number({displayName:"Credit Account",description:"Not used for compound/group entries",required:!1}),amount:a.Number({displayName:"Amount",description:"Not used for compound/group entries",required:!1}),description:a.ShortText({displayName:"Description",description:"Not used for compound/group entries",required:!1}),tax_id:a.Number({displayName:"Tax ID",description:"Not used for compound/group entries",required:!1}),tax_account:a.Number({displayName:"Tax Account",description:"Not used for compound/group entries",required:!1}),currency_id:a.Number({displayName:"Currency ID",description:"Not used for compound/group entries",required:!1}),currency_factor:a.Number({displayName:"Currency Factor",description:"Not used for compound/group entries",required:!1}),helper_info:a.MarkDown({value:m?"For compound entries, each entry should have EITHER debit_account_id OR credit_account_id (not both).":"For group entries, each entry must have BOTH debit_account_id and credit_account_id."}),entries:a.Array({displayName:"Entries",description:m?"Multiple entries to distribute the total. Each entry should have either debit_account_id OR credit_account_id (not both).":"Multiple complete bookings. Each entry must have both debit_account_id and credit_account_id.",required:!0,properties:{debit_account_id:s.length>0?a.StaticDropdown({displayName:"Debit Account",description:m?"Account to debit (leave empty if this is a credit entry)":"Account to debit",required:!m,options:{disabled:!1,options:s}}):a.Number({displayName:"Debit Account ID",description:m?"Account ID to debit (leave 0 if this is a credit entry)":"Account ID to debit",required:!m}),credit_account_id:s.length>0?a.StaticDropdown({displayName:"Credit Account",description:m?"Account to credit (leave empty if this is a debit entry)":"Account to credit",required:!m,options:{disabled:!1,options:s}}):a.Number({displayName:"Credit Account ID",description:m?"Account ID to credit (leave 0 if this is a debit entry)":"Account ID to credit",required:!m}),amount:a.Number({displayName:"Amount",description:"The transaction amount",required:!0}),description:a.ShortText({displayName:"Description",description:"Description for this entry",required:!1}),tax_id:p.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (optional)",required:!1,options:{disabled:!1,options:p}}):a.Number({displayName:"Tax ID",description:"Tax ID (optional)",required:!1}),tax_account_id:s.length>0?a.StaticDropdown({displayName:"Tax Account",description:"Account for tax calculation (optional)",required:!1,options:{disabled:!1,options:s}}):a.Number({displayName:"Tax Account ID",description:"Account ID for tax calculation (optional)",required:!1}),currency_id:g.length>0?a.StaticDropdown({displayName:"Currency",description:"Currency (optional)",required:!1,options:{disabled:!1,options:g}}):a.Number({displayName:"Currency ID",description:"Currency ID (optional)",required:!1}),currency_factor:a.Number({displayName:"Currency Factor",description:"Exchange rate factor (defaults to 1)",required:!1})}})}}},"props")})},async run(e){let r=new h(e.auth),n=e.propsValue.type,t=e.propsValue.entryFields,i=[];if(n==="manual_single_entry"){let s={debit_account_id:t.debit_account,credit_account_id:t.credit_account,amount:t.amount};t.description&&(s.description=t.description),t.tax_id&&(s.tax_id=t.tax_id),t.tax_account&&(s.tax_account_id=t.tax_account),t.currency_id&&(s.currency_id=t.currency_id),t.currency_factor&&(s.currency_factor=t.currency_factor),i=[s]}else{let s=t.entries;if(!s||s.length===0)throw new Error("At least one entry is required for compound or group entries");i=s.map(p=>{let g={amount:p.amount},m=p.debit_account_id;m&&m!==0&&(g.debit_account_id=m);let A=p.credit_account_id;A&&A!==0&&(g.credit_account_id=A),p.description&&(g.description=p.description);let x=p.tax_id;x&&x!==0&&(g.tax_id=x);let d=p.tax_account_id;d&&d!==0&&(g.tax_account_id=d);let _=p.currency_id;return _&&_!==0&&(g.currency_id=_),p.currency_factor&&(g.currency_factor=p.currency_factor),g})}let c={type:n,date:e.propsValue.date,reference_nr:e.propsValue.reference_nr,entries:i};return await r.post("/accounts/manual_entries",c)}});var Uu=R({auth:y,name:"create_company",classification:"WRITE",displayName:"Create Company",description:"Create a new company contact",audience:"both",aiMetadata:{description:"Creates a new organization (company-type) contact in Bexio with name, address, communication, and grouping fields. Use to add a company; pick Create Person for an individual or Update Company to modify an existing one. Requires a company name plus an assigned user and owner. Not idempotent: each call creates a separate contact, so search first to avoid duplicates.",idempotent:!1},props:{name_1:a.ShortText({displayName:"Company Name",description:"The name of the company",required:!0}),name_2:a.ShortText({displayName:"Company Addition",description:'Additional company name (e.g., "Ltd.", "Inc.")',required:!1}),nr:a.ShortText({displayName:"Contact Number",description:"Contact number (leave empty to auto-assign)",required:!1}),salutation_id:a.Dropdown({auth:y,displayName:"Salutation",description:"Salutation for the company",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/salutation")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load salutations",options:[]}}},"options")}),title_id:a.Dropdown({auth:y,displayName:"Title",description:"Title for the company",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/title")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load titles",options:[]}}},"options")}),street_name:a.ShortText({displayName:"Street Name",description:"Street name",required:!1}),house_number:a.ShortText({displayName:"House Number",description:"House number",required:!1}),address_addition:a.ShortText({displayName:"Address Addition",description:'Additional address information (e.g., "Building C")',required:!1}),postcode:a.ShortText({displayName:"Postcode",description:"Postal code",required:!1}),city:a.ShortText({displayName:"City",description:"City",required:!1}),country_id:a.Dropdown({auth:y,displayName:"Country",description:"Country",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/country")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load countries",options:[]}}},"options")}),mail:a.ShortText({displayName:"Email",description:"Primary email address",required:!1}),mail_second:a.ShortText({displayName:"Secondary Email",description:"Secondary email address",required:!1}),phone_fixed:a.ShortText({displayName:"Phone",description:"Fixed phone number",required:!1}),phone_fixed_second:a.ShortText({displayName:"Secondary Phone",description:"Secondary fixed phone number",required:!1}),phone_mobile:a.ShortText({displayName:"Mobile Phone",description:"Mobile phone number",required:!1}),fax:a.ShortText({displayName:"Fax",description:"Fax number",required:!1}),url:a.ShortText({displayName:"Website",description:"Company website URL",required:!1}),skype_name:a.ShortText({displayName:"Skype Name",description:"Skype username",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional notes about the company",required:!1}),language_id:a.Dropdown({auth:y,displayName:"Language",description:"Preferred language",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),contact_group_ids:a.MultiSelectDropdown({auth:y,displayName:"Contact Groups",description:"Select contact groups",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_group")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact groups",options:[]}}},"options")}),contact_branch_ids:a.MultiSelectDropdown({auth:y,displayName:"Contact Sectors",description:"Select contact sectors",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_branch")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact sectors",options:[]}}},"options")}),user_id:a.Dropdown({auth:y,displayName:"User",description:"User assigned to this contact",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),owner_id:a.Dropdown({auth:y,displayName:"Owner",description:"Owner of this contact",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={contact_type_id:1,name_1:n.name_1,user_id:n.user_id,owner_id:n.owner_id};return n.name_2&&(t.name_2=n.name_2),n.nr!==void 0&&n.nr!==null&&n.nr!==""?t.nr=n.nr:t.nr=null,n.salutation_id&&(t.salutation_id=n.salutation_id),n.title_id&&(t.title_id=n.title_id),n.street_name&&(t.street_name=n.street_name),n.house_number&&(t.house_number=n.house_number),n.address_addition&&(t.address_addition=n.address_addition),n.postcode&&(t.postcode=n.postcode),n.city&&(t.city=n.city),n.country_id&&(t.country_id=n.country_id),n.mail&&(t.mail=n.mail),n.mail_second&&(t.mail_second=n.mail_second),n.phone_fixed&&(t.phone_fixed=n.phone_fixed),n.phone_fixed_second&&(t.phone_fixed_second=n.phone_fixed_second),n.phone_mobile&&(t.phone_mobile=n.phone_mobile),n.fax&&(t.fax=n.fax),n.url&&(t.url=n.url),n.skype_name&&(t.skype_name=n.skype_name),n.remarks&&(t.remarks=n.remarks),n.language_id&&(t.language_id=n.language_id),n.contact_group_ids&&Array.isArray(n.contact_group_ids)&&n.contact_group_ids.length>0&&(t.contact_group_ids=n.contact_group_ids.join(",")),n.contact_branch_ids&&Array.isArray(n.contact_branch_ids)&&n.contact_branch_ids.length>0&&(t.contact_branch_ids=n.contact_branch_ids.join(",")),await r.post("/2.0/contact",t)}});var Mu=R({auth:y,name:"create_person",classification:"WRITE",displayName:"Create Person",description:"Create a new person contact",audience:"both",aiMetadata:{description:"Creates a new individual (person-type) contact in Bexio with name, address, communication, and grouping fields. Use to add an individual; pick Create Company for an organization or Update Person to modify an existing one. Requires a last name plus an assigned user and owner. Not idempotent: each call creates a separate contact, so search first to avoid duplicates.",idempotent:!1},props:{name_1:a.ShortText({displayName:"Last Name",description:"The last name of the person",required:!0}),name_2:a.ShortText({displayName:"First Name",description:"The first name of the person",required:!1}),nr:a.ShortText({displayName:"Contact Number",description:"Contact number (leave empty to auto-assign)",required:!1}),salutation_id:a.Dropdown({auth:y,displayName:"Salutation",description:"Salutation for the person",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/salutation")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load salutations",options:[]}}},"options")}),salutation_form:a.Number({displayName:"Salutation Form",description:"Salutation form (optional)",required:!1}),title_id:a.Dropdown({auth:y,displayName:"Title",description:"Title for the person (e.g., Dr., Prof.)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/title")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load titles",options:[]}}},"options")}),birthday:a.ShortText({displayName:"Birthday",description:"Birthday date (YYYY-MM-DD)",required:!1}),street_name:a.ShortText({displayName:"Street Name",description:"Street name",required:!1}),house_number:a.ShortText({displayName:"House Number",description:"House number",required:!1}),address_addition:a.ShortText({displayName:"Address Addition",description:'Additional address information (e.g., "Building C")',required:!1}),postcode:a.ShortText({displayName:"Postcode",description:"Postal code",required:!1}),city:a.ShortText({displayName:"City",description:"City",required:!1}),country_id:a.Dropdown({auth:y,displayName:"Country",description:"Country",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/country")).map(t=>({label:`${t.name} (${t.name_short})`,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load countries",options:[]}}},"options")}),mail:a.ShortText({displayName:"Email",description:"Primary email address",required:!1}),mail_second:a.ShortText({displayName:"Secondary Email",description:"Secondary email address",required:!1}),phone_fixed:a.ShortText({displayName:"Phone",description:"Fixed phone number",required:!1}),phone_fixed_second:a.ShortText({displayName:"Secondary Phone",description:"Secondary fixed phone number",required:!1}),phone_mobile:a.ShortText({displayName:"Mobile Phone",description:"Mobile phone number",required:!1}),fax:a.ShortText({displayName:"Fax",description:"Fax number",required:!1}),url:a.ShortText({displayName:"Website",description:"Personal website URL",required:!1}),skype_name:a.ShortText({displayName:"Skype Name",description:"Skype username",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional notes about the person",required:!1}),language_id:a.Dropdown({auth:y,displayName:"Language",description:"Preferred language",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),contact_group_ids:a.MultiSelectDropdown({auth:y,displayName:"Contact Groups",description:"Select contact groups",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_group")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact groups",options:[]}}},"options")}),contact_branch_ids:a.MultiSelectDropdown({auth:y,displayName:"Contact Sectors",description:"Select contact sectors",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_branch")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact sectors",options:[]}}},"options")}),user_id:a.Dropdown({auth:y,displayName:"User",description:"User assigned to this contact",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),owner_id:a.Dropdown({auth:y,displayName:"Owner",description:"Owner of this contact",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={contact_type_id:2,name_1:n.name_1,user_id:n.user_id,owner_id:n.owner_id};return n.name_2&&(t.name_2=n.name_2),n.nr!==void 0&&n.nr!==null&&n.nr!==""?t.nr=n.nr:t.nr=null,n.salutation_id&&(t.salutation_id=n.salutation_id),n.salutation_form&&(t.salutation_form=n.salutation_form),n.title_id&&(t.title_id=n.title_id),n.birthday&&(t.birthday=n.birthday),n.street_name&&(t.street_name=n.street_name),n.house_number&&(t.house_number=n.house_number),n.address_addition&&(t.address_addition=n.address_addition),n.postcode&&(t.postcode=n.postcode),n.city&&(t.city=n.city),n.country_id&&(t.country_id=n.country_id),n.mail&&(t.mail=n.mail),n.mail_second&&(t.mail_second=n.mail_second),n.phone_fixed&&(t.phone_fixed=n.phone_fixed),n.phone_fixed_second&&(t.phone_fixed_second=n.phone_fixed_second),n.phone_mobile&&(t.phone_mobile=n.phone_mobile),n.fax&&(t.fax=n.fax),n.url&&(t.url=n.url),n.skype_name&&(t.skype_name=n.skype_name),n.remarks&&(t.remarks=n.remarks),n.language_id&&(t.language_id=n.language_id),n.contact_group_ids&&Array.isArray(n.contact_group_ids)&&n.contact_group_ids.length>0&&(t.contact_group_ids=n.contact_group_ids.join(",")),n.contact_branch_ids&&Array.isArray(n.contact_branch_ids)&&n.contact_branch_ids.length>0&&(t.contact_branch_ids=n.contact_branch_ids.join(",")),await r.post("/2.0/contact",t)}});var Lu=R({auth:y,name:"update_person",classification:"WRITE",displayName:"Update Person",description:"Update an existing person contact",audience:"both",aiMetadata:{description:"Updates fields on an existing person-type contact in Bexio identified by its contact id; only supplied fields change. Use to modify a known individual; pick Create Person to add a new one or Update Company for an organization. Resolve the contact id with Find Company or a contact lookup first. Idempotent: re-sending the same values converges to the same contact state.",idempotent:!0},props:{contact_id:a.Dropdown({auth:y,displayName:"Person",description:"Select the person to update",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).filter(i=>i.contact_type_id===2).map(i=>{let c=i.name_2?`${i.name_2} ${i.name_1}`:i.name_1;return{label:i.nr?`${c} (#${i.nr})`:c,value:i.id}})}}catch{return{disabled:!0,placeholder:"Failed to load persons",options:[]}}},"options")}),name_1:a.ShortText({displayName:"Last Name",description:"The last name of the person",required:!1}),name_2:a.ShortText({displayName:"First Name",description:"The first name of the person",required:!1}),nr:a.ShortText({displayName:"Contact Number",description:"Contact number (leave empty to keep current or auto-assign)",required:!1}),salutation_id:a.Dropdown({auth:y,displayName:"Salutation",description:"Salutation for the person",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/salutation")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load salutations",options:[]}}},"options")}),salutation_form:a.Number({displayName:"Salutation Form",description:"Salutation form (optional)",required:!1}),title_id:a.Dropdown({auth:y,displayName:"Title",description:"Title for the person (e.g., Dr., Prof.)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/title")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load titles",options:[]}}},"options")}),birthday:a.ShortText({displayName:"Birthday",description:"Birthday date (YYYY-MM-DD)",required:!1}),street_name:a.ShortText({displayName:"Street Name",description:"Street name",required:!1}),house_number:a.ShortText({displayName:"House Number",description:"House number",required:!1}),address_addition:a.ShortText({displayName:"Address Addition",description:"Additional address information",required:!1}),postcode:a.ShortText({displayName:"Postcode",description:"Postal code",required:!1}),city:a.ShortText({displayName:"City",description:"City",required:!1}),country_id:a.Dropdown({auth:y,displayName:"Country",description:"Country",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/country")).map(t=>({label:`${t.name} (${t.name_short})`,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load countries",options:[]}}},"options")}),mail:a.ShortText({displayName:"Email",description:"Primary email address",required:!1}),mail_second:a.ShortText({displayName:"Secondary Email",description:"Secondary email address",required:!1}),phone_fixed:a.ShortText({displayName:"Phone",description:"Fixed phone number",required:!1}),phone_fixed_second:a.ShortText({displayName:"Secondary Phone",description:"Secondary fixed phone number",required:!1}),phone_mobile:a.ShortText({displayName:"Mobile Phone",description:"Mobile phone number",required:!1}),fax:a.ShortText({displayName:"Fax",description:"Fax number",required:!1}),url:a.ShortText({displayName:"Website URL",description:"Personal website URL",required:!1}),skype_name:a.ShortText({displayName:"Skype Name",description:"Skype username",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional notes about the person",required:!1}),language_id:a.Dropdown({auth:y,displayName:"Language",description:"Preferred language",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),contact_group_ids:a.MultiSelectDropdown({auth:y,displayName:"Contact Groups",description:"Select contact groups",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_group")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact groups",options:[]}}},"options")}),contact_branch_ids:a.MultiSelectDropdown({auth:y,displayName:"Contact Sectors",description:"Select contact sectors",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_branch")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact sectors",options:[]}}},"options")}),user_id:a.Dropdown({auth:y,displayName:"User",description:"User assigned to this contact",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),owner_id:a.Dropdown({auth:y,displayName:"Owner",description:"Owner of this contact",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run(e){let r=new h(e.auth),n=e.propsValue.contact_id,t=e.propsValue,i={contact_type_id:2};return t.name_1&&(i.name_1=t.name_1),t.name_2!==void 0&&(i.name_2=t.name_2||null),t.nr!==void 0&&t.nr!==null&&t.nr!==""?i.nr=t.nr:t.nr===""&&(i.nr=null),t.salutation_id&&(i.salutation_id=t.salutation_id),t.salutation_form&&(i.salutation_form=t.salutation_form),t.title_id&&(i.title_id=t.title_id),t.birthday&&(i.birthday=t.birthday),t.street_name&&(i.street_name=t.street_name),t.house_number&&(i.house_number=t.house_number),t.address_addition&&(i.address_addition=t.address_addition),t.postcode&&(i.postcode=t.postcode),t.city&&(i.city=t.city),t.country_id&&(i.country_id=t.country_id),t.mail&&(i.mail=t.mail),t.mail_second&&(i.mail_second=t.mail_second),t.phone_fixed&&(i.phone_fixed=t.phone_fixed),t.phone_fixed_second&&(i.phone_fixed_second=t.phone_fixed_second),t.phone_mobile&&(i.phone_mobile=t.phone_mobile),t.fax&&(i.fax=t.fax),t.url&&(i.url=t.url),t.skype_name&&(i.skype_name=t.skype_name),t.remarks&&(i.remarks=t.remarks),t.language_id&&(i.language_id=t.language_id),t.contact_group_ids&&Array.isArray(t.contact_group_ids)&&t.contact_group_ids.length>0&&(i.contact_group_ids=t.contact_group_ids.join(",")),t.contact_branch_ids&&Array.isArray(t.contact_branch_ids)&&t.contact_branch_ids.length>0&&(i.contact_branch_ids=t.contact_branch_ids.join(",")),t.user_id&&(i.user_id=t.user_id),t.owner_id&&(i.owner_id=t.owner_id),await r.patch(`/2.0/contact/${n}`,i)}});var ju=Ee(Xn()),Fu=R({auth:y,name:"create_file",classification:"WRITE",displayName:"Create File",description:"Upload a new file to Bexio",audience:"both",aiMetadata:{description:"Uploads a file to the Bexio file manager via multipart form data, returning the stored file metadata. Use to add a document or attachment to Bexio storage; requires the file contents. Not idempotent: each call stores another copy of the file.",idempotent:!1},props:{file:a.File({displayName:"File",description:"The file to upload",required:!0})},async run(e){let r=e.propsValue.file,n=new ju.default;return n.append("file",r.data,r.filename),(await mt.sendRequest({url:`${bt.baseUrl}/3.0/files`,method:"POST",authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},headers:{Accept:"application/json",...n.getHeaders()},body:n})).body}});var Oe={account:o(e=>a.Dropdown({auth:y,displayName:e.displayName,description:e.description,required:e.required,refreshers:[],options:o(async({auth:r})=>{if(!r)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(r).get("/accounts")).map(i=>({label:`${i.account_no} - ${i.name}`,value:i.id}))}}catch{return{disabled:!0,placeholder:"Failed to load accounts",options:[]}}},"options")}),"account"),tax:a.Dropdown({auth:y,displayName:"Tax",description:"Select a tax rate",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/taxes")).map(t=>({label:`${t.name} (${t.percentage}%)`,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),currency:o(e=>a.Dropdown({auth:y,displayName:e.displayName,description:e.description,required:e.required,refreshers:[],options:o(async({auth:r})=>{if(!r)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(r).get("/3.0/currencies")).map(i=>({label:i.name,value:i.id}))}}catch{return{disabled:!0,placeholder:"Failed to load currencies",options:[]}}},"options")}),"currency")};var Bu=R({auth:y,name:"create_sales_invoice",classification:"WRITE",displayName:"Create Sales Invoice",description:"Create a new product-based sales invoice",audience:"both",aiMetadata:{description:"Creates a new sales invoice in Bexio from one or more line-item positions (custom, article, text, subtotal, discount, or page-break). Use when billing a customer for products or services; requires a user, language, bank account, currency, payment type, tax handling, and at least one position. Not idempotent: each call creates a separate invoice, so guard against duplicates.",idempotent:!1},props:{document_nr:a.ShortText({displayName:"Document Number",description:"Invoice number (required if automatic numbering is disabled)",required:!1}),title:a.ShortText({displayName:"Title",description:"Invoice title",required:!1}),contact_id:a.Dropdown({auth:y,displayName:"Contact",description:"The contact for this invoice",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),contact_sub_id:a.Dropdown({auth:y,displayName:"Contact Sub",description:"Contact sub-address (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),user_id:a.Dropdown({auth:y,displayName:"User",description:"User assigned to this invoice",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),pr_project_id:a.Dropdown({auth:y,displayName:"Project",description:"Project associated with this invoice",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project")).map(t=>({label:t.nr?`${t.name} (#${t.nr})`:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load projects",options:[]}}},"options")}),language_id:a.Dropdown({auth:y,displayName:"Language",description:"Language for the invoice",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),bank_account_id:a.Dropdown({auth:y,displayName:"Bank Account",description:"Bank account for payment",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/banking/accounts")).map(t=>{let i=t.iban_nr||t.bank_account_nr;return{label:i?`${t.name} (${i})`:t.name,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load bank accounts",options:[]}}},"options")}),currency_id:Oe.currency({displayName:"Currency",required:!0}),payment_type_id:a.Dropdown({auth:y,displayName:"Payment Type",description:"Payment type for this invoice",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/payment_type")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load payment types",options:[]}}},"options")}),header:a.LongText({displayName:"Header",description:"Header text for the invoice",required:!1}),footer:a.LongText({displayName:"Footer",description:"Footer text for the invoice",required:!1}),mwst_type:a.StaticDropdown({displayName:"Tax Type",description:"How taxes are handled",required:!0,defaultValue:0,options:{disabled:!1,options:[{label:"Including taxes",value:0},{label:"Excluding taxes",value:1},{label:"Exempt from taxes",value:2}]}}),mwst_is_net:a.Checkbox({displayName:"Tax is Net",description:"If taxes are included, set to true to add taxes to total, false to include in total",required:!1,defaultValue:!1}),show_position_taxes:a.Checkbox({displayName:"Show Position Taxes",description:"Show taxes for each position",required:!1,defaultValue:!1}),is_valid_from:a.ShortText({displayName:"Valid From",description:"Invoice valid from date (YYYY-MM-DD)",required:!1}),is_valid_to:a.ShortText({displayName:"Valid To",description:"Invoice valid to date (YYYY-MM-DD)",required:!1}),contact_address_manual:a.LongText({displayName:"Manual Contact Address",description:"Override contact address (leave empty to use contact address)",required:!1}),reference:a.ShortText({displayName:"Reference",description:"Reference number",required:!1}),api_reference:a.ShortText({displayName:"API Reference",description:"Reference for API use (can only be edited via API)",required:!1}),template_slug:a.Dropdown({auth:y,displayName:"Document Template",description:"Document template for the invoice",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/document_templates")).map(t=>({label:t.is_default?`${t.name} (Default)`:t.name,value:t.template_slug}))}}catch{return{disabled:!0,placeholder:"Failed to load templates",options:[]}}},"options")}),positionFields:a.DynamicProperties({auth:y,displayName:"Invoice Positions",description:"Configure invoice line items",required:!0,refreshers:["auth"],props:o(async({auth:e})=>{let r=[],n=[],t=[];if(e)try{let s=new h(e);r=await s.get("/2.0/unit").catch(()=>[]),n=await s.get("/accounts").catch(()=>[]),t=(await s.get("/3.0/taxes?types=sales_tax&scope=active").catch(()=>[])).map(g=>({id:g.id,name:g.display_name||g.name,percentage:g.value.toString()}))}catch{}let i=r.map(s=>({label:s.name,value:s.id})),c=n.map(s=>({label:`${s.account_no} - ${s.name}`,value:s.id})),u=t.map(s=>({label:`${s.name} (${s.percentage}%)`,value:s.id}));return{positions:a.Array({displayName:"Positions",description:"Invoice line items",required:!0,properties:{type:a.StaticDropdown({displayName:"Position Type",description:"Type of invoice position",required:!0,defaultValue:"KbPositionCustom",options:{disabled:!1,options:[{label:"Custom Position",value:"KbPositionCustom"},{label:"Article Position",value:"KbPositionArticle"},{label:"Text Position",value:"KbPositionText"},{label:"Subtotal Position",value:"KbPositionSubtotal"},{label:"Page Break Position",value:"KbPositionPagebreak"},{label:"Discount Position",value:"KbPositionDiscount"}]}}),amount:a.ShortText({displayName:"Amount",description:"Quantity/amount",required:!0}),unit_id:i.length>0?a.StaticDropdown({displayName:"Unit",description:"Unit of measurement",required:!1,options:{disabled:!1,options:i}}):a.Number({displayName:"Unit ID",description:"Unit ID (use List Units action to find IDs)",required:!1}),account_id:c.length>0?a.StaticDropdown({displayName:"Account",description:"Account for this position",required:!1,options:{disabled:!1,options:c}}):a.Number({displayName:"Account ID",description:"Account ID (use List Accounts action to find IDs)",required:!1}),tax_id:u.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (only active sales taxes)",required:!1,options:{disabled:!1,options:u}}):a.Number({displayName:"Tax ID",description:"Tax ID (use List Taxes action to find IDs)",required:!1}),text:a.LongText({displayName:"Description",description:"Position description/text",required:!1}),unit_price:a.ShortText({displayName:"Unit Price",description:"Price per unit (max 6 decimals)",required:!1}),discount_in_percent:a.ShortText({displayName:"Discount (%)",description:"Discount percentage (max 6 decimals)",required:!1}),parent_id:a.Number({displayName:"Parent ID",description:"Parent position ID (for grouped positions)",required:!1})}})}},"props")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={};n.user_id&&(t.user_id=n.user_id),n.language_id&&(t.language_id=n.language_id),n.bank_account_id&&(t.bank_account_id=n.bank_account_id),n.currency_id&&(t.currency_id=n.currency_id),n.payment_type_id&&(t.payment_type_id=n.payment_type_id),n.document_nr&&(t.document_nr=n.document_nr),n.title!==void 0&&(t.title=n.title||null),n.contact_id&&(t.contact_id=n.contact_id),n.contact_sub_id&&(t.contact_sub_id=n.contact_sub_id),n.pr_project_id&&(t.pr_project_id=n.pr_project_id),n.header&&(t.header=n.header),n.footer&&(t.footer=n.footer),n.mwst_type!==void 0&&(t.mwst_type=n.mwst_type),n.mwst_is_net!==void 0&&(t.mwst_is_net=n.mwst_is_net),n.show_position_taxes!==void 0&&(t.show_position_taxes=n.show_position_taxes),n.is_valid_from&&(t.is_valid_from=n.is_valid_from),n.is_valid_to&&(t.is_valid_to=n.is_valid_to),n.contact_address_manual&&(t.contact_address_manual=n.contact_address_manual),n.reference&&(t.reference=n.reference),n.api_reference&&(t.api_reference=n.api_reference),n.template_slug&&(t.template_slug=n.template_slug);let i=n.positionFields;return i&&i.positions&&Array.isArray(i.positions)&&(t.positions=i.positions.map(u=>{let s={type:u.type||"KbPositionCustom"};return u.amount&&(s.amount=u.amount),u.unit_id&&(s.unit_id=u.unit_id),u.account_id&&(s.account_id=u.account_id),u.tax_id&&(s.tax_id=u.tax_id),u.text&&(s.text=u.text),u.unit_price&&(s.unit_price=u.unit_price),u.discount_in_percent&&(s.discount_in_percent=u.discount_in_percent),u.parent_id&&(s.parent_id=u.parent_id),s})),await r.post("/2.0/kb_invoice",t)}});var qu=R({auth:y,name:"export_invoice_pdf",classification:"READ",displayName:"Export Invoice to PDF",description:"Export an existing sales invoice as a PDF document",audience:"both",aiMetadata:{description:"Renders an existing Bexio sales invoice as a PDF and returns the downloadable file, keyed by the invoice id. Use when an agent needs the document itself (to attach or store); pick Send Sales Invoice to email it to a recipient instead. Optionally toggle the letterhead. Read-only and idempotent: it generates the file without changing the invoice.",idempotent:!0},props:{invoice_id:a.Dropdown({auth:y,displayName:"Invoice",description:"Select the invoice to export",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/kb_invoice")).map(t=>({label:t.title?`${t.document_nr} - ${t.title}`:t.document_nr,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load invoices",options:[]}}},"options")}),logopaper:a.StaticDropdown({displayName:"Letterhead",description:"Whether to include letterhead in the PDF",required:!1,defaultValue:1,options:{disabled:!1,options:[{label:"With Letterhead",value:1},{label:"Without Letterhead",value:0}]}})},async run({auth:e,propsValue:r,files:n}){let t=new h(e),i=r.invoice_id,c=r.logopaper,u={};c!==void 0&&(u.logopaper=c.toString());let s=await t.get(`/2.0/kb_invoice/${i}/pdf`,u);return{file:await n.write({fileName:s.name||`invoice_${i}.pdf`,data:Buffer.from(s.content,"base64")}),fileName:s.name,size:s.size,mimeType:s.mime}}});var Vu=R({auth:y,name:"send_sales_invoice",classification:"WRITE",displayName:"Send Sales Invoice",description:"Send a sales invoice to an email address",audience:"both",aiMetadata:{description:'Emails an existing Bexio sales invoice to a recipient, with subject and message body, optionally marking the invoice as open and attaching the PDF. Use to deliver an invoice to a customer; pick Export Invoice to PDF if you only need the file. Requires the invoice id and a recipient email, and the message must contain a "[Network Link]" placeholder. Not idempotent: each call sends another email.',idempotent:!1},props:{invoice_id:a.Dropdown({auth:y,displayName:"Invoice",description:"Select the invoice to send",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/kb_invoice")).map(t=>({label:t.title?`${t.document_nr} - ${t.title}`:t.document_nr,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load invoices",options:[]}}},"options")}),recipient_email:a.ShortText({displayName:"Recipient Email",description:"Email address to send the invoice to",required:!0}),subject:a.ShortText({displayName:"Subject",description:"Email subject line",required:!0}),message:a.LongText({displayName:"Message",description:'Email message body. Must include "[Network Link]" placeholder',required:!0}),mark_as_open:a.Checkbox({displayName:"Mark as Open",description:"Mark the invoice as open",required:!1,defaultValue:!1}),attach_pdf:a.Checkbox({displayName:"Attach PDF",description:"Attach PDF directly to the email",required:!1,defaultValue:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.invoice_id,i=r.recipient_email,c=r.subject,u=r.message,s=r.mark_as_open,p=r.attach_pdf,g={recipient_email:i,subject:c,message:u};return s!==void 0&&(g.mark_as_open=s),p!==void 0&&(g.attach_pdf=p),await n.post(`/2.0/kb_invoice/${t}/send`,g)}});var Zu=R({auth:y,name:"create_product",classification:"WRITE",displayName:"Create Product",description:"Create a new product or service",audience:"both",aiMetadata:{description:"Create a new Bexio article (a physical product or a service) with internal code and name, plus optional pricing, taxes, unit, currency, supplier, stock, and dimension details. Not idempotent: each call adds a separate article even if the code repeats, so check for an existing product first to avoid duplicates. Stock-item fields require the stock_edit scope.",idempotent:!1},props:{user_id:a.Dropdown({auth:y,displayName:"User",description:"User associated with this product",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),article_type_id:a.StaticDropdown({displayName:"Product Type",description:"Type of product",required:!0,defaultValue:1,options:{disabled:!1,options:[{label:"Physical Product",value:1},{label:"Service",value:2}]}}),intern_code:a.ShortText({displayName:"Internal Code",description:"Internal product code",required:!0}),intern_name:a.ShortText({displayName:"Internal Name",description:"Internal product name",required:!0}),intern_description:a.LongText({displayName:"Internal Description",description:"Internal product description",required:!1}),contact_id:a.Dropdown({auth:y,displayName:"Contact",description:"Contact associated with this product",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),deliverer_code:a.ShortText({displayName:"Supplier Code",description:"Supplier product code",required:!1}),deliverer_name:a.ShortText({displayName:"Supplier Name",description:"Supplier product name",required:!1}),deliverer_description:a.LongText({displayName:"Supplier Description",description:"Supplier product description",required:!1}),purchase_price:a.ShortText({displayName:"Purchase Price",description:"Purchase price",required:!1}),sale_price:a.ShortText({displayName:"Sale Price",description:"Sale price",required:!1}),purchase_total:a.Number({displayName:"Purchase Total",description:"Total purchase amount",required:!1}),sale_total:a.Number({displayName:"Sale Total",description:"Total sale amount",required:!1}),currency_id:Oe.currency({displayName:"Currency",required:!1}),tax_income_id:a.Dropdown({auth:y,displayName:"Income Tax",description:"Tax for income/sales",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/taxes")).filter(t=>t.type==="sales_tax"||!t.type).map(t=>({label:t.display_name||t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),tax_expense_id:a.Dropdown({auth:y,displayName:"Expense Tax",description:"Tax for expenses/purchases",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/taxes")).filter(t=>t.type==="pre_tax"||!t.type).map(t=>({label:t.display_name||t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),unit_id:a.Dropdown({auth:y,displayName:"Unit",description:"Unit of measurement",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/unit")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load units",options:[]}}},"options")}),is_stock:a.Checkbox({displayName:"Is Stock Item",description:"Whether this is a stock item (requires stock_edit scope)",required:!1,defaultValue:!1}),stock_id:a.Dropdown({auth:y,displayName:"Stock Location",description:"Stock location",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/stock").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load stock locations",options:[]}}},"options")}),stock_place_id:a.Dropdown({auth:y,displayName:"Stock Area",description:"Stock area/place",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/stock_place").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load stock areas",options:[]}}},"options")}),stock_nr:a.Number({displayName:"Stock Number",description:"Current stock quantity",required:!0,defaultValue:0}),stock_min_nr:a.Number({displayName:"Minimum Stock",description:"Minimum stock quantity",required:!0,defaultValue:0}),width:a.Number({displayName:"Width",description:"Product width",required:!1}),height:a.Number({displayName:"Height",description:"Product height",required:!1}),weight:a.Number({displayName:"Weight",description:"Product weight",required:!1}),volume:a.Number({displayName:"Volume",description:"Product volume",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional remarks",required:!1}),delivery_price:a.Number({displayName:"Delivery Price",description:"Delivery price",required:!1}),article_group_id:a.Dropdown({auth:y,displayName:"Article Group",description:"Product group/category",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/article_group").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load article groups",options:[]}}},"options")}),account_id:Oe.account({displayName:"Account",description:"Account for this product",required:!1}),expense_account_id:Oe.account({displayName:"Expense Account",description:"Expense account for this product",required:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r,i={user_id:t.user_id,article_type_id:t.article_type_id,intern_code:t.intern_code,intern_name:t.intern_name,stock_nr:t.stock_nr||0,stock_min_nr:t.stock_min_nr||0};return t.intern_description&&(i.intern_description=t.intern_description),t.contact_id&&(i.contact_id=t.contact_id),t.deliverer_code&&(i.deliverer_code=t.deliverer_code),t.deliverer_name&&(i.deliverer_name=t.deliverer_name),t.deliverer_description&&(i.deliverer_description=t.deliverer_description),t.purchase_price&&(i.purchase_price=t.purchase_price),t.sale_price&&(i.sale_price=t.sale_price),t.purchase_total&&(i.purchase_total=t.purchase_total),t.sale_total&&(i.sale_total=t.sale_total),t.currency_id&&(i.currency_id=t.currency_id),t.tax_income_id&&(i.tax_income_id=t.tax_income_id),t.tax_expense_id&&(i.tax_expense_id=t.tax_expense_id),t.unit_id&&(i.unit_id=t.unit_id),t.is_stock!==void 0&&(i.is_stock=t.is_stock),t.stock_id&&(i.stock_id=t.stock_id),t.stock_place_id&&(i.stock_place_id=t.stock_place_id),t.width&&(i.width=t.width),t.height&&(i.height=t.height),t.weight&&(i.weight=t.weight),t.volume&&(i.volume=t.volume),t.remarks&&(i.remarks=t.remarks),t.delivery_price&&(i.delivery_price=t.delivery_price),t.article_group_id&&(i.article_group_id=t.article_group_id),t.account_id&&(i.account_id=t.account_id),t.expense_account_id&&(i.expense_account_id=t.expense_account_id),await n.post("/2.0/article",i)}});var Hu=R({auth:y,name:"update_product",classification:"WRITE",displayName:"Update Product",description:"Update an existing product or service",audience:"both",aiMetadata:{description:"Updates fields on an existing Bexio product/article (codes, names, prices, tax, unit, stock, dimensions, accounts) identified by its article id; only supplied fields change. Use to modify a known product; locate the article id with Find Product first. Idempotent: re-sending the same values converges to the same product state.",idempotent:!0},props:{article_id:a.Dropdown({auth:y,displayName:"Product",description:"Select the product to update",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/article")).map(t=>({label:t.intern_code?`${t.intern_name} (${t.intern_code})`:t.intern_name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load products",options:[]}}},"options")}),user_id:a.Dropdown({auth:y,displayName:"User",description:"User associated with this product",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),intern_code:a.ShortText({displayName:"Internal Code",description:"Internal product code",required:!1}),intern_name:a.ShortText({displayName:"Internal Name",description:"Internal product name",required:!1}),intern_description:a.LongText({displayName:"Internal Description",description:"Internal product description",required:!1}),contact_id:a.Dropdown({auth:y,displayName:"Contact",description:"Contact associated with this product",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),deliverer_code:a.ShortText({displayName:"Supplier Code",description:"Supplier product code",required:!1}),deliverer_name:a.ShortText({displayName:"Supplier Name",description:"Supplier product name",required:!1}),deliverer_description:a.LongText({displayName:"Supplier Description",description:"Supplier product description",required:!1}),purchase_price:a.ShortText({displayName:"Purchase Price",description:"Purchase price",required:!1}),sale_price:a.ShortText({displayName:"Sale Price",description:"Sale price",required:!1}),purchase_total:a.Number({displayName:"Purchase Total",description:"Total purchase amount",required:!1}),sale_total:a.Number({displayName:"Sale Total",description:"Total sale amount",required:!1}),currency_id:Oe.currency({displayName:"Currency",required:!1}),tax_income_id:a.Dropdown({auth:y,displayName:"Income Tax",description:"Tax for income/sales",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/taxes")).filter(t=>t.type==="sales_tax"||!t.type).map(t=>({label:t.display_name||t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),tax_expense_id:a.Dropdown({auth:y,displayName:"Expense Tax",description:"Tax for expenses/purchases",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/taxes")).filter(t=>t.type==="pre_tax"||!t.type).map(t=>({label:t.display_name||t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load taxes",options:[]}}},"options")}),unit_id:a.Dropdown({auth:y,displayName:"Unit",description:"Unit of measurement",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/unit")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load units",options:[]}}},"options")}),is_stock:a.Checkbox({displayName:"Is Stock Item",description:"Whether this is a stock item (requires stock_edit scope)",required:!1}),stock_id:a.Dropdown({auth:y,displayName:"Stock Location",description:"Stock location",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/stock").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load stock locations",options:[]}}},"options")}),stock_place_id:a.Dropdown({auth:y,displayName:"Stock Area",description:"Stock area/place",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/stock_place").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load stock areas",options:[]}}},"options")}),stock_nr:a.Number({displayName:"Stock Number",description:"Current stock quantity (can only be set if no bookings exist)",required:!1}),stock_min_nr:a.Number({displayName:"Minimum Stock",description:"Minimum stock quantity",required:!1}),width:a.Number({displayName:"Width",description:"Product width",required:!1}),height:a.Number({displayName:"Height",description:"Product height",required:!1}),weight:a.Number({displayName:"Weight",description:"Product weight",required:!1}),volume:a.Number({displayName:"Volume",description:"Product volume",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional remarks",required:!1}),delivery_price:a.Number({displayName:"Delivery Price",description:"Delivery price",required:!1}),article_group_id:a.Dropdown({auth:y,displayName:"Article Group",description:"Product group/category",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/article_group").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load article groups",options:[]}}},"options")}),account_id:Oe.account({displayName:"Account",description:"Account for this product",required:!1}),expense_account_id:Oe.account({displayName:"Expense Account",description:"Expense account for this product",required:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r,i=t.article_id,c={};return t.user_id&&(c.user_id=t.user_id),t.intern_code&&(c.intern_code=t.intern_code),t.intern_name&&(c.intern_name=t.intern_name),t.intern_description&&(c.intern_description=t.intern_description),t.contact_id&&(c.contact_id=t.contact_id),t.deliverer_code&&(c.deliverer_code=t.deliverer_code),t.deliverer_name&&(c.deliverer_name=t.deliverer_name),t.deliverer_description&&(c.deliverer_description=t.deliverer_description),t.purchase_price&&(c.purchase_price=t.purchase_price),t.sale_price&&(c.sale_price=t.sale_price),t.purchase_total&&(c.purchase_total=t.purchase_total),t.sale_total&&(c.sale_total=t.sale_total),t.currency_id&&(c.currency_id=t.currency_id),t.tax_income_id&&(c.tax_income_id=t.tax_income_id),t.tax_expense_id&&(c.tax_expense_id=t.tax_expense_id),t.unit_id&&(c.unit_id=t.unit_id),t.is_stock!==void 0&&(c.is_stock=t.is_stock),t.stock_id&&(c.stock_id=t.stock_id),t.stock_place_id&&(c.stock_place_id=t.stock_place_id),t.stock_nr!==void 0&&(c.stock_nr=t.stock_nr),t.stock_min_nr!==void 0&&(c.stock_min_nr=t.stock_min_nr),t.width&&(c.width=t.width),t.height&&(c.height=t.height),t.weight&&(c.weight=t.weight),t.volume&&(c.volume=t.volume),t.remarks&&(c.remarks=t.remarks),t.delivery_price&&(c.delivery_price=t.delivery_price),t.article_group_id&&(c.article_group_id=t.article_group_id),t.account_id&&(c.account_id=t.account_id),t.expense_account_id&&(c.expense_account_id=t.expense_account_id),await n.post(`/2.0/article/${i}`,c)}});var Gu=R({auth:y,name:"create_sales_order",classification:"WRITE",displayName:"Create Sales Order",description:"Create a new product-based sales order",audience:"both",aiMetadata:{description:"Creates a new sales order in Bexio from one or more line-item positions (custom, article, text, subtotal, discount, or page-break). Use when confirming an order for products or services; pick Create Sales Invoice to bill instead. Requires a contact, user, language, bank account, currency, payment type, tax handling, a valid-from date, and at least one position; supports a separate delivery address. Not idempotent: each call creates a separate order.",idempotent:!1},props:{document_nr:a.ShortText({displayName:"Document Number",description:"Order number (required if automatic numbering is disabled)",required:!1}),title:a.ShortText({displayName:"Title",description:"Order title",required:!1}),contact_id:a.Dropdown({auth:y,displayName:"Contact",description:"The contact for this order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),contact_sub_id:a.Dropdown({auth:y,displayName:"Contact Sub",description:"Contact sub-address (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),user_id:a.Dropdown({auth:y,displayName:"User",description:"User responsible for this order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),pr_project_id:a.Dropdown({auth:y,displayName:"Project",description:"Project associated with this order",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project")).map(t=>({label:t.nr?`${t.name} (#${t.nr})`:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load projects",options:[]}}},"options")}),language_id:a.Dropdown({auth:y,displayName:"Language",description:"Language for the order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),bank_account_id:a.Dropdown({auth:y,displayName:"Bank Account",description:"Bank account for payment",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/banking/accounts")).map(t=>{let i=t.iban_nr||t.bank_account_nr;return{label:i?`${t.name} (${i})`:t.name,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load bank accounts",options:[]}}},"options")}),currency_id:a.Dropdown({auth:y,displayName:"Currency",description:"Currency for this order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/currencies")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load currencies",options:[]}}},"options")}),payment_type_id:a.Dropdown({auth:y,displayName:"Payment Type",description:"Payment type for this order",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/payment_type")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load payment types",options:[]}}},"options")}),header:a.LongText({displayName:"Header",description:"Header text for the order",required:!1}),footer:a.LongText({displayName:"Footer",description:"Footer text for the order",required:!1}),mwst_type:a.StaticDropdown({displayName:"Tax Type",description:"How taxes are handled",required:!0,defaultValue:0,options:{disabled:!1,options:[{label:"Including taxes",value:0},{label:"Excluding taxes",value:1},{label:"Exempt from taxes",value:2}]}}),mwst_is_net:a.Checkbox({displayName:"Tax is Net",description:"If taxes are included, set to true to add taxes to total, false to include in total",required:!1,defaultValue:!1}),show_position_taxes:a.Checkbox({displayName:"Show Position Taxes",description:"Show taxes for each position",required:!1,defaultValue:!1}),is_valid_from:a.ShortText({displayName:"Valid From",description:"Order valid from date (YYYY-MM-DD)",required:!0}),contact_address_manual:a.LongText({displayName:"Manual Contact Address",description:"Override contact address (leave empty to use contact address)",required:!1}),delivery_address_type:a.StaticDropdown({displayName:"Delivery Address Type",description:"Type of delivery address",required:!1,defaultValue:0,options:{disabled:!1,options:[{label:"Use Invoice Address",value:0},{label:"Use Custom Address",value:1}]}}),delivery_address_manual_text:a.LongText({displayName:"Manual Delivery Address",description:"Custom delivery address (only used if delivery address type is set to custom)",required:!1}),api_reference:a.ShortText({displayName:"API Reference",description:"Reference for API use (can only be edited via API)",required:!1}),template_slug:a.Dropdown({auth:y,displayName:"Document Template",description:"Document template for the order",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/document_templates")).map(t=>({label:t.is_default?`${t.name} (Default)`:t.name,value:t.template_slug}))}}catch{return{disabled:!0,placeholder:"Failed to load templates",options:[]}}},"options")}),positionFields:a.DynamicProperties({auth:y,displayName:"Order Positions",description:"Configure order line items",required:!0,refreshers:["auth"],props:o(async({auth:e})=>{let r=[],n=[],t=[];if(e)try{let s=new h(e);r=await s.get("/2.0/unit").catch(()=>[]),n=await s.get("/accounts").catch(()=>[]),t=(await s.get("/3.0/taxes?types=sales_tax&scope=active").catch(()=>[])).map(g=>({id:g.id,name:g.display_name||g.name,percentage:g.value.toString()}))}catch{}let i=r.map(s=>({label:s.name,value:s.id})),c=n.map(s=>({label:`${s.account_no} - ${s.name}`,value:s.id})),u=t.map(s=>({label:`${s.name} (${s.percentage}%)`,value:s.id}));return{positions:a.Array({displayName:"Positions",description:"Order line items",required:!0,properties:{type:a.StaticDropdown({displayName:"Position Type",description:"Type of order position",required:!0,defaultValue:"KbPositionCustom",options:{disabled:!1,options:[{label:"Custom Position",value:"KbPositionCustom"},{label:"Article Position",value:"KbPositionArticle"},{label:"Text Position",value:"KbPositionText"},{label:"Subtotal Position",value:"KbPositionSubtotal"},{label:"Page Break Position",value:"KbPositionPagebreak"},{label:"Discount Position",value:"KbPositionDiscount"}]}}),amount:a.ShortText({displayName:"Amount",description:"Quantity/amount",required:!0}),unit_id:i.length>0?a.StaticDropdown({displayName:"Unit",description:"Unit of measurement",required:!1,options:{disabled:!1,options:i}}):a.Number({displayName:"Unit ID",description:"Unit ID (use List Units action to find IDs)",required:!1}),account_id:c.length>0?a.StaticDropdown({displayName:"Account",description:"Account for this position",required:!1,options:{disabled:!1,options:c}}):a.Number({displayName:"Account ID",description:"Account ID (use List Accounts action to find IDs)",required:!1}),tax_id:u.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (only active sales taxes)",required:!1,options:{disabled:!1,options:u}}):a.Number({displayName:"Tax ID",description:"Tax ID (use List Taxes action to find IDs)",required:!1}),text:a.LongText({displayName:"Description",description:"Position description/text",required:!1}),unit_price:a.ShortText({displayName:"Unit Price",description:"Price per unit (max 6 decimals)",required:!1}),discount_in_percent:a.ShortText({displayName:"Discount (%)",description:"Discount percentage (max 6 decimals)",required:!1}),parent_id:a.Number({displayName:"Parent ID",description:"Parent position ID (for grouped positions)",required:!1})}})}},"props")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={contact_id:n.contact_id,user_id:n.user_id,language_id:n.language_id,bank_account_id:n.bank_account_id,currency_id:n.currency_id,payment_type_id:n.payment_type_id,mwst_type:n.mwst_type,is_valid_from:n.is_valid_from};n.document_nr&&(t.document_nr=n.document_nr),n.title!==void 0&&(t.title=n.title||null),n.contact_sub_id&&(t.contact_sub_id=n.contact_sub_id),n.pr_project_id&&(t.pr_project_id=n.pr_project_id),n.header&&(t.header=n.header),n.footer&&(t.footer=n.footer),n.mwst_is_net!==void 0&&(t.mwst_is_net=n.mwst_is_net),n.show_position_taxes!==void 0&&(t.show_position_taxes=n.show_position_taxes),n.contact_address_manual&&(t.contact_address_manual=n.contact_address_manual),n.delivery_address_type!==void 0&&(t.delivery_address_type=n.delivery_address_type),n.delivery_address_manual_text&&(t.delivery_address_manual=n.delivery_address_manual_text),n.api_reference&&(t.api_reference=n.api_reference),n.template_slug&&(t.template_slug=n.template_slug);let i=n.positionFields;return i&&i.positions&&Array.isArray(i.positions)&&(t.positions=i.positions.map(u=>{let s={type:u.type||"KbPositionCustom"};return u.amount&&(s.amount=u.amount),u.unit_id&&(s.unit_id=u.unit_id),u.account_id&&(s.account_id=u.account_id),u.tax_id&&(s.tax_id=u.tax_id),u.text&&(s.text=u.text),u.unit_price&&(s.unit_price=u.unit_price),u.discount_in_percent&&(s.discount_in_percent=u.discount_in_percent),u.parent_id&&(s.parent_id=u.parent_id),s})),await r.post("/2.0/kb_order",t)}});var Wu=R({auth:y,name:"create_project",classification:"WRITE",displayName:"Create Project",description:"Create a new project",audience:"both",aiMetadata:{description:"Creates a new Bexio project linked to a contact, with status, type, responsible user, optional dates, and optional invoicing/budget settings. Use to set up a project before tracking time or billing against it. Requires a name, project status, project type, contact, and user. Not idempotent: each call creates a separate project.",idempotent:!1},props:{document_nr:a.ShortText({displayName:"Document Number",description:"Project number (required if automatic numbering is disabled)",required:!1}),name:a.ShortText({displayName:"Project Name",description:"Name of the project",required:!0}),start_date:a.DateTime({displayName:"Start Date",description:"Project start date",required:!1}),end_date:a.DateTime({displayName:"End Date",description:"Project end date",required:!1}),comment:a.LongText({displayName:"Comment",description:"Project comment/description",required:!1}),pr_state_id:a.Dropdown({auth:y,displayName:"Project Status",description:"Status of the project",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project_state")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load project statuses",options:[]}}},"options")}),pr_project_type_id:a.Dropdown({auth:y,displayName:"Project Type",description:"Type of project",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project_type")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load project types",options:[]}}},"options")}),contact_id:a.Dropdown({auth:y,displayName:"Contact",description:"Contact associated with this project",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),contact_sub_id:a.Dropdown({auth:y,displayName:"Contact Sub",description:"Contact sub-address (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),pr_invoice_type_id:a.StaticDropdown({displayName:"Invoice Type",description:"Type of invoicing for this project",required:!1,options:{disabled:!1,options:[{label:"Hourly rate for client services",value:1},{label:"Hourly rate for employee",value:2},{label:"Hourly rate for project",value:3},{label:"Fix price for project",value:4}]}}),pr_invoice_type_amount:a.ShortText({displayName:"Invoice Type Amount",description:"Amount for invoice type (only for hourly rate project or fix price)",required:!1}),pr_budget_type_id:a.StaticDropdown({displayName:"Budget Type",description:"Type of budget for this project",required:!1,options:{disabled:!1,options:[{label:"Total budget costs",value:1},{label:"Total budget hours",value:2},{label:"Budget for each client services",value:3},{label:"Budget for each employee",value:4}]}}),pr_budget_type_amount:a.ShortText({displayName:"Budget Type Amount",description:"Amount for budget type (only for total budget costs or total budget hours)",required:!1}),user_id:a.Dropdown({auth:y,displayName:"User",description:"User responsible for this project",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run({auth:e,propsValue:r}){let n=new h(e),t=r,i={name:t.name,pr_state_id:t.pr_state_id,pr_project_type_id:t.pr_project_type_id,contact_id:t.contact_id,user_id:t.user_id};if(t.document_nr&&(i.document_nr=t.document_nr),t.start_date){let u=t.start_date;i.start_date=u}if(t.end_date){let u=t.end_date;i.end_date=u}return t.comment&&(i.comment=t.comment),t.contact_sub_id&&(i.contact_sub_id=t.contact_sub_id),t.pr_invoice_type_id&&(i.pr_invoice_type_id=t.pr_invoice_type_id),t.pr_invoice_type_amount&&(i.pr_invoice_type_amount=t.pr_invoice_type_amount),t.pr_budget_type_id&&(i.pr_budget_type_id=t.pr_budget_type_id),t.pr_budget_type_amount&&(i.pr_budget_type_amount=t.pr_budget_type_amount),await n.post("/2.0/pr_project",i)}});var Ku=R({auth:y,name:"create_sales_quote",classification:"WRITE",displayName:"Create Sales Quote",description:"Create a new product-based sales quote",audience:"both",aiMetadata:{description:"Create a new Bexio sales quote (kb_offer) with required user, language, currency, payment type, bank account, tax handling, validity dates, and at least one line-item position (custom, article, text, subtotal, discount, or page-break). Not idempotent: each call creates a separate quote, so guard against duplicates. Requires resolved IDs for contact, currency, taxes, units, and accounts; look these up first if not known.",idempotent:!1},props:{document_nr:a.ShortText({displayName:"Document Number",description:"Quote number (required if automatic numbering is disabled)",required:!1}),title:a.ShortText({displayName:"Title",description:"Quote title",required:!1}),contact_id:a.Dropdown({auth:y,displayName:"Contact",description:"The contact for this quote",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),contact_sub_id:a.Dropdown({auth:y,displayName:"Contact Sub",description:"Contact sub-address (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),user_id:a.Dropdown({auth:y,displayName:"User",description:"User responsible for this quote",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),pr_project_id:a.Dropdown({auth:y,displayName:"Project",description:"Project associated with this quote",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project")).map(t=>({label:t.nr?`${t.name} (#${t.nr})`:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load projects",options:[]}}},"options")}),language_id:a.Dropdown({auth:y,displayName:"Language",description:"Language for the quote",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),bank_account_id:a.Dropdown({auth:y,displayName:"Bank Account",description:"Bank account for payment",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/banking/accounts")).map(t=>{let i=t.iban_nr||t.bank_account_nr;return{label:i?`${t.name} (${i})`:t.name,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load bank accounts",options:[]}}},"options")}),currency_id:a.Dropdown({auth:y,displayName:"Currency",description:"Currency for this quote",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/currencies")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load currencies",options:[]}}},"options")}),payment_type_id:a.Dropdown({auth:y,displayName:"Payment Type",description:"Payment type for this quote",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/payment_type")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load payment types",options:[]}}},"options")}),header:a.LongText({displayName:"Header",description:"Header text for the quote",required:!1}),footer:a.LongText({displayName:"Footer",description:"Footer text for the quote",required:!1}),mwst_type:a.StaticDropdown({displayName:"Tax Type",description:"How taxes are handled",required:!0,defaultValue:0,options:{disabled:!1,options:[{label:"Including taxes",value:0},{label:"Excluding taxes",value:1},{label:"Exempt from taxes",value:2}]}}),mwst_is_net:a.Checkbox({displayName:"Tax is Net",description:"If taxes are included, set to true to add taxes to total, false to include in total",required:!1,defaultValue:!1}),show_position_taxes:a.Checkbox({displayName:"Show Position Taxes",description:"Show taxes for each position",required:!1,defaultValue:!1}),is_valid_from:a.ShortText({displayName:"Valid From",description:"Quote valid from date (YYYY-MM-DD)",required:!0}),is_valid_until:a.ShortText({displayName:"Valid Until",description:"Quote valid until date (YYYY-MM-DD)",required:!0}),contact_address_manual:a.LongText({displayName:"Manual Contact Address",description:"Override contact address (leave empty to use contact address)",required:!1}),delivery_address_type:a.StaticDropdown({displayName:"Delivery Address Type",description:"Type of delivery address",required:!1,defaultValue:0,options:{disabled:!1,options:[{label:"Use Invoice Address",value:0},{label:"Use Custom Address",value:1}]}}),delivery_address_manual_text:a.LongText({displayName:"Manual Delivery Address",description:"Custom delivery address (only used if delivery address type is set to custom)",required:!1}),api_reference:a.ShortText({displayName:"API Reference",description:"Reference for API use (can only be edited via API)",required:!1}),viewed_by_client_at:a.DateTime({displayName:"Viewed By Client At",description:"Date when the quote was viewed by the client",required:!1}),kb_terms_of_payment_template_id:a.Number({displayName:"Terms of Payment Template ID",description:"Terms of payment template ID",required:!1}),template_slug:a.Dropdown({auth:y,displayName:"Document Template",description:"Document template for the quote",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/document_templates")).map(t=>({label:t.is_default?`${t.name} (Default)`:t.name,value:t.template_slug}))}}catch{return{disabled:!0,placeholder:"Failed to load templates",options:[]}}},"options")}),positionFields:a.DynamicProperties({auth:y,displayName:"Quote Positions",description:"Configure quote line items",required:!0,refreshers:["auth"],props:o(async({auth:e})=>{let r=[],n=[],t=[];if(e)try{let s=new h(e);r=await s.get("/2.0/unit").catch(()=>[]),n=await s.get("/accounts").catch(()=>[]),t=(await s.get("/3.0/taxes?types=sales_tax&scope=active").catch(()=>[])).map(g=>({id:g.id,name:g.display_name||g.name,percentage:g.value.toString()}))}catch{}let i=r.map(s=>({label:s.name,value:s.id})),c=n.map(s=>({label:`${s.account_no} - ${s.name}`,value:s.id})),u=t.map(s=>({label:`${s.name} (${s.percentage}%)`,value:s.id}));return{positions:a.Array({displayName:"Positions",description:"Quote line items",required:!0,properties:{type:a.StaticDropdown({displayName:"Position Type",description:"Type of quote position",required:!0,defaultValue:"KbPositionCustom",options:{disabled:!1,options:[{label:"Custom Position",value:"KbPositionCustom"},{label:"Article Position",value:"KbPositionArticle"},{label:"Text Position",value:"KbPositionText"},{label:"Subtotal Position",value:"KbPositionSubtotal"},{label:"Page Break Position",value:"KbPositionPagebreak"},{label:"Discount Position",value:"KbPositionDiscount"}]}}),amount:a.ShortText({displayName:"Amount",description:"Quantity/amount",required:!0}),unit_id:i.length>0?a.StaticDropdown({displayName:"Unit",description:"Unit of measurement",required:!1,options:{disabled:!1,options:i}}):a.Number({displayName:"Unit ID",description:"Unit ID (use List Units action to find IDs)",required:!1}),account_id:c.length>0?a.StaticDropdown({displayName:"Account",description:"Account for this position",required:!1,options:{disabled:!1,options:c}}):a.Number({displayName:"Account ID",description:"Account ID (use List Accounts action to find IDs)",required:!1}),tax_id:u.length>0?a.StaticDropdown({displayName:"Tax",description:"Tax rate (only active sales taxes)",required:!1,options:{disabled:!1,options:u}}):a.Number({displayName:"Tax ID",description:"Tax ID (use List Taxes action to find IDs)",required:!1}),text:a.LongText({displayName:"Description",description:"Position description/text",required:!1}),unit_price:a.ShortText({displayName:"Unit Price",description:"Price per unit (max 6 decimals)",required:!1}),discount_in_percent:a.ShortText({displayName:"Discount (%)",description:"Discount percentage (max 6 decimals)",required:!1}),parent_id:a.Number({displayName:"Parent ID",description:"Parent position ID (for grouped positions)",required:!1})}})}},"props")})},async run(e){let r=new h(e.auth),n=e.propsValue,t={user_id:n.user_id,language_id:n.language_id,bank_account_id:n.bank_account_id,currency_id:n.currency_id,payment_type_id:n.payment_type_id,mwst_type:n.mwst_type,is_valid_from:n.is_valid_from,is_valid_until:n.is_valid_until};n.document_nr&&(t.document_nr=n.document_nr),n.title!==void 0&&(t.title=n.title||null),n.contact_id&&(t.contact_id=n.contact_id),n.contact_sub_id&&(t.contact_sub_id=n.contact_sub_id),n.pr_project_id&&(t.pr_project_id=n.pr_project_id),n.header&&(t.header=n.header),n.footer&&(t.footer=n.footer),n.mwst_is_net!==void 0&&(t.mwst_is_net=n.mwst_is_net),n.show_position_taxes!==void 0&&(t.show_position_taxes=n.show_position_taxes),n.contact_address_manual&&(t.contact_address_manual=n.contact_address_manual),n.delivery_address_type!==void 0&&(t.delivery_address_type=n.delivery_address_type),n.delivery_address_manual_text&&(t.delivery_address_manual=n.delivery_address_manual_text),n.api_reference&&(t.api_reference=n.api_reference),n.viewed_by_client_at&&(t.viewed_by_client_at=n.viewed_by_client_at),n.kb_terms_of_payment_template_id&&(t.kb_terms_of_payment_template_id=n.kb_terms_of_payment_template_id),n.template_slug&&(t.template_slug=n.template_slug);let i=n.positionFields;return i&&i.positions&&Array.isArray(i.positions)&&(t.positions=i.positions.map(u=>{let s={type:u.type||"KbPositionCustom"};return u.amount&&(s.amount=u.amount),u.unit_id&&(s.unit_id=u.unit_id),u.account_id&&(s.account_id=u.account_id),u.tax_id&&(s.tax_id=u.tax_id),u.text&&(s.text=u.text),u.unit_price&&(s.unit_price=u.unit_price),u.discount_in_percent&&(s.discount_in_percent=u.discount_in_percent),u.parent_id&&(s.parent_id=u.parent_id),s})),await r.post("/2.0/kb_offer",t)}});var Ju=R({auth:y,name:"create_time_tracking",classification:"WRITE",displayName:"Create Time Tracking",description:"Create a new timesheet entry",audience:"both",aiMetadata:{description:"Logs a new timesheet entry in Bexio for a user against a client service/business activity, recording time either as a duration on a date or as a from/to range. Use to record worked or billable hours, optionally tying it to a contact, project, or milestone. Requires a user, client service, billable flag, and the tracking details for the chosen mode. Not idempotent: each call creates a separate entry.",idempotent:!1},props:{user_id:a.Dropdown({auth:y,displayName:"User",description:"User for this timesheet entry",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:t.firstname&&t.lastname?`${t.firstname} ${t.lastname}`:t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),status_id:a.Dropdown({auth:y,displayName:"Status",description:"Timesheet status",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/timesheet_status").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load timesheet statuses",options:[]}}},"options")}),client_service_id:a.Dropdown({auth:y,displayName:"Client Service",description:"Business activity/client service",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/client_service").catch(()=>[])).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load client services",options:[]}}},"options")}),text:a.LongText({displayName:"Description",description:"Description of the work performed",required:!1}),allowable_bill:a.Checkbox({displayName:"Allowable Bill",description:"Whether this time is billable",required:!0,defaultValue:!0}),charge:a.ShortText({displayName:"Charge",description:"Charge amount",required:!1}),contact_id:a.Dropdown({auth:y,displayName:"Contact",description:"Contact associated with this timesheet",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),sub_contact_id:a.Dropdown({auth:y,displayName:"Sub Contact",description:"Sub contact (optional)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).map(t=>{let i=t.name_2?`${t.name_2} ${t.name_1}`:t.name_1;return{label:t.nr?`${i} (#${t.nr})`:i,value:t.id}})}}catch{return{disabled:!0,placeholder:"Failed to load contacts",options:[]}}},"options")}),pr_project_id:a.Dropdown({auth:y,displayName:"Project",description:"Project associated with this timesheet",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/pr_project")).map(t=>({label:t.nr?`${t.name} (#${t.nr})`:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load projects",options:[]}}},"options")}),pr_package_id:a.Number({displayName:"Package ID",description:"Project package ID",required:!1}),pr_milestone_id:a.Number({displayName:"Milestone ID",description:"Project milestone ID",required:!1}),estimated_time:a.ShortText({displayName:"Estimated Time",description:"Estimated time (format: HH:MM)",required:!1}),tracking_type:a.StaticDropdown({displayName:"Tracking Type",description:"Type of time tracking",required:!0,defaultValue:"duration",options:{disabled:!1,options:[{label:"Duration",value:"duration"},{label:"Range",value:"range"}]}}),tracking_details:a.DynamicProperties({auth:y,displayName:"Tracking Details",description:"Time tracking details",required:!0,refreshers:["tracking_type"],props:o(async({tracking_type:e})=>{let r=e||"duration",n={};return r==="duration"?(n.date=a.ShortText({displayName:"Date",description:"Date of the timesheet entry (YYYY-MM-DD)",required:!0}),n.duration=a.ShortText({displayName:"Duration",description:"Duration of time tracked (format: HH:MM)",required:!0})):(n.from=a.DateTime({displayName:"From",description:"Start date and time",required:!0}),n.to=a.DateTime({displayName:"To",description:"End date and time",required:!0})),n},"props")})},async run({auth:e,propsValue:r}){let n=new h(e),t=r,i={user_id:t.user_id,client_service_id:t.client_service_id,allowable_bill:t.allowable_bill};t.status_id&&(i.status_id=t.status_id),t.text&&(i.text=t.text),t.charge&&(i.charge=t.charge),t.contact_id&&(i.contact_id=t.contact_id),t.sub_contact_id&&(i.sub_contact_id=t.sub_contact_id),t.pr_project_id&&(i.pr_project_id=t.pr_project_id),t.pr_package_id&&(i.pr_package_id=t.pr_package_id),t.pr_milestone_id&&(i.pr_milestone_id=t.pr_milestone_id),t.estimated_time&&(i.estimated_time=t.estimated_time);let c=t.tracking_type,u=t.tracking_details,s={type:c};return c==="duration"?(s.date=u.date,s.duration=u.duration):(s.from=u.from,s.to=u.to),i.tracking=s,await n.post("/2.0/timesheet",i)}});var Yu=R({auth:y,name:"update_company",classification:"WRITE",displayName:"Update Company",description:"Update an existing company contact",audience:"both",aiMetadata:{description:"Updates fields on an existing company-type contact in Bexio identified by its contact id; only supplied fields change. Use to modify a known organization; pick Create Company to add a new one or Update Person for an individual. Resolve the contact id with Find Company first. Idempotent: re-sending the same values converges to the same contact state.",idempotent:!0},props:{contact_id:a.Dropdown({auth:y,displayName:"Company",description:"Select the company to update",required:!0,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact")).filter(i=>i.contact_type_id===1).map(i=>({label:i.nr?`${i.name_1} (#${i.nr})`:i.name_1,value:i.id}))}}catch{return{disabled:!0,placeholder:"Failed to load companies",options:[]}}},"options")}),name_1:a.ShortText({displayName:"Company Name",description:"The name of the company",required:!1}),name_2:a.ShortText({displayName:"Company Addition",description:'Additional company name (e.g., "Ltd.", "Inc.")',required:!1}),nr:a.ShortText({displayName:"Contact Number",description:"Contact number (leave empty to keep current or auto-assign)",required:!1}),salutation_id:a.Dropdown({auth:y,displayName:"Salutation",description:"Salutation for the company",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/salutation")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load salutations",options:[]}}},"options")}),title_id:a.Dropdown({auth:y,displayName:"Title",description:"Title for the company",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/title")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load titles",options:[]}}},"options")}),street_name:a.ShortText({displayName:"Street Name",description:"Street name",required:!1}),house_number:a.ShortText({displayName:"House Number",description:"House number",required:!1}),address_addition:a.ShortText({displayName:"Address Addition",description:"Additional address information",required:!1}),postcode:a.ShortText({displayName:"Postcode",description:"Postal code",required:!1}),city:a.ShortText({displayName:"City",description:"City",required:!1}),country_id:a.Dropdown({auth:y,displayName:"Country",description:"Country",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/country")).map(t=>({label:`${t.name} (${t.name_short})`,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load countries",options:[]}}},"options")}),mail:a.ShortText({displayName:"Email",description:"Primary email address",required:!1}),mail_second:a.ShortText({displayName:"Secondary Email",description:"Secondary email address",required:!1}),phone_fixed:a.ShortText({displayName:"Phone",description:"Fixed phone number",required:!1}),phone_fixed_second:a.ShortText({displayName:"Secondary Phone",description:"Secondary fixed phone number",required:!1}),phone_mobile:a.ShortText({displayName:"Mobile Phone",description:"Mobile phone number",required:!1}),fax:a.ShortText({displayName:"Fax",description:"Fax number",required:!1}),url:a.ShortText({displayName:"Website URL",description:"Company website URL",required:!1}),skype_name:a.ShortText({displayName:"Skype Name",description:"Skype username",required:!1}),remarks:a.LongText({displayName:"Remarks",description:"Additional notes about the company",required:!1}),language_id:a.Dropdown({auth:y,displayName:"Language",description:"Preferred language",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/language")).map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load languages",options:[]}}},"options")}),contact_group_ids:a.MultiSelectDropdown({auth:y,displayName:"Contact Groups",description:"Select contact groups",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_group")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact groups",options:[]}}},"options")}),contact_branch_ids:a.MultiSelectDropdown({auth:y,displayName:"Contact Sectors",description:"Select contact sectors",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/2.0/contact_branch")).map(t=>({label:t.name,value:t.id.toString()}))}}catch{return{disabled:!0,placeholder:"Failed to load contact sectors",options:[]}}},"options")}),user_id:a.Dropdown({auth:y,displayName:"User",description:"User assigned to this contact",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")}),owner_id:a.Dropdown({auth:y,displayName:"Owner",description:"Owner of this contact",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{return{disabled:!1,options:(await new h(e).get("/3.0/users")).map(t=>({label:`${t.firstname||""} ${t.lastname||""}`.trim()||t.email,value:t.id}))}}catch{return{disabled:!0,placeholder:"Failed to load users",options:[]}}},"options")})},async run(e){let r=new h(e.auth),n=e.propsValue.contact_id,t=e.propsValue,i={contact_type_id:1};return t.name_1&&(i.name_1=t.name_1),t.name_2!==void 0&&(i.name_2=t.name_2||null),t.nr!==void 0&&t.nr!==null&&t.nr!==""?i.nr=t.nr:t.nr===""&&(i.nr=null),t.salutation_id&&(i.salutation_id=t.salutation_id),t.title_id&&(i.title_id=t.title_id),t.street_name&&(i.street_name=t.street_name),t.house_number&&(i.house_number=t.house_number),t.address_addition&&(i.address_addition=t.address_addition),t.postcode&&(i.postcode=t.postcode),t.city&&(i.city=t.city),t.country_id&&(i.country_id=t.country_id),t.mail&&(i.mail=t.mail),t.mail_second&&(i.mail_second=t.mail_second),t.phone_fixed&&(i.phone_fixed=t.phone_fixed),t.phone_fixed_second&&(i.phone_fixed_second=t.phone_fixed_second),t.phone_mobile&&(i.phone_mobile=t.phone_mobile),t.fax&&(i.fax=t.fax),t.url&&(i.url=t.url),t.skype_name&&(i.skype_name=t.skype_name),t.remarks&&(i.remarks=t.remarks),t.language_id&&(i.language_id=t.language_id),t.contact_group_ids&&Array.isArray(t.contact_group_ids)&&t.contact_group_ids.length>0&&(i.contact_group_ids=t.contact_group_ids.join(",")),t.contact_branch_ids&&Array.isArray(t.contact_branch_ids)&&t.contact_branch_ids.length>0&&(i.contact_branch_ids=t.contact_branch_ids.join(",")),t.user_id&&(i.user_id=t.user_id),t.owner_id&&(i.owner_id=t.owner_id),await r.post(`/2.0/contact/${n}`,i)}});var Xu=R({auth:y,name:"find_account",classification:"SEARCH",displayName:"Find Account",description:"Search for accounts using various criteria",audience:"both",aiMetadata:{description:"Searches the Bexio chart of accounts by number, name, type, or account group with operators such as contains, equals, or comparison, with paging. Use to resolve an account to its id before booking a manual entry or assigning an account on a product/position. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding accounts",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"Account Number",value:"account_no"},{label:"Account Name",value:"name"},{label:"Account Type",value:"account_type"},{label:"Account Group ID",value:"fibu_account_group_id"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"}]}})}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.limit,c=r.offset,u=t.map(g=>({field:g.field,value:g.value,criteria:g.criteria||"like"})),s={};return i!==void 0&&(s.limit=i.toString()),c!==void 0&&(s.offset=c.toString()),await n.post("/2.0/accounts/search",u,s)}});var Qu=R({auth:y,name:"find_company",classification:"SEARCH",displayName:"Find Company",description:"Search for company contacts using various criteria",audience:"both",aiMetadata:{description:"Searches Bexio contacts for companies, matching one or more field criteria (name, number, email, city, country, etc.) with operators such as contains, equals, or comparison; results are automatically filtered to company-type contacts. Use to locate a company before referencing or updating it; pick Find Country/Find Product/Find Account for those object types. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding companies",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Company Name",value:"name_1"},{label:"Company Addition",value:"name_2"},{label:"Contact Number",value:"nr"},{label:"Address",value:"address"},{label:"Email",value:"mail"},{label:"Secondary Email",value:"mail_second"},{label:"Postcode",value:"postcode"},{label:"City",value:"city"},{label:"Country ID",value:"country_id"},{label:"Contact Group IDs",value:"contact_group_ids"},{label:"Contact Type ID",value:"contact_type_id"},{label:"Updated At",value:"updated_at"},{label:"User ID",value:"user_id"},{label:"Phone",value:"phone_fixed"},{label:"Mobile Phone",value:"phone_mobile"},{label:"Fax",value:"fax"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Contact Number",value:"nr"},{label:"Company Name",value:"name_1"},{label:"Updated At",value:"updated_at"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0}),show_archived:a.Checkbox({displayName:"Show Archived",description:"Show archived contacts only",required:!1,defaultValue:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=r.show_archived,p=t.map(x=>({field:x.field,value:x.value,criteria:x.criteria||"like"}));t.some(x=>x.field==="contact_type_id")||p.push({field:"contact_type_id",value:"1",criteria:"="});let m={};return i&&(m.order_by=i),c!==void 0&&(m.limit=c.toString()),u!==void 0&&(m.offset=u.toString()),s!==void 0&&(m.show_archived=s.toString()),await n.post("/2.0/contact/search",p,m)}});var ec=R({auth:y,name:"find_person",classification:"SEARCH",displayName:"Find Person",description:"Search for person contacts using various criteria",audience:"both",aiMetadata:{description:"Search Bexio person contacts (contact_type 2; companies are excluded) by one or more field/operator/value criteria such as name, email, phone, or contact number. Read-only and repeatable; returns matching person records and supports ordering, limit, and offset paging. Use to look up a person before referencing them in another action; for company contacts use the company-oriented lookup instead.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding persons",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"First Name (name_1)",value:"name_1"},{label:"Last Name (name_2)",value:"name_2"},{label:"Contact Number",value:"nr"},{label:"Address",value:"address"},{label:"Email",value:"mail"},{label:"Secondary Email",value:"mail_second"},{label:"Postcode",value:"postcode"},{label:"City",value:"city"},{label:"Country ID",value:"country_id"},{label:"Contact Group IDs",value:"contact_group_ids"},{label:"Contact Type ID",value:"contact_type_id"},{label:"Updated At",value:"updated_at"},{label:"User ID",value:"user_id"},{label:"Fixed Phone",value:"phone_fixed"},{label:"Mobile Phone",value:"phone_mobile"},{label:"Fax",value:"fax"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array of values)",value:"in"},{label:"Not In (array of values)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to sort the results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Contact Number",value:"nr"},{label:"First Name",value:"name_1"},{label:"Updated At",value:"updated_at"}]}}),order_direction:a.StaticDropdown({displayName:"Order Direction",description:"Sort order",required:!1,defaultValue:"asc",options:{disabled:!1,options:[{label:"Ascending",value:"asc"},{label:"Descending",value:"desc"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0}),show_archived:a.Checkbox({displayName:"Show Archived",description:"Include archived contacts in the search results",required:!1,defaultValue:!1})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.order_direction,u=r.limit,s=r.offset,p=r.show_archived,g=[...t],m=g.findIndex(d=>d.field==="contact_type_id");m===-1?g.push({field:"contact_type_id",value:"2",criteria:"="}):g[m].value!=="2"&&(g[m].value="2",g[m].criteria="=");let A={};return i&&(A.order_by=`${i}${c==="desc"?"_desc":""}`),u!==void 0&&(A.limit=u.toString()),s!==void 0&&(A.offset=s.toString()),p!==void 0&&(A.show_archived=p.toString()),await n.post("/2.0/contact/search",g,A)}});var tc=R({auth:y,name:"find_product",classification:"SEARCH",displayName:"Find Product",description:"Search for products by name or code",audience:"both",aiMetadata:{description:"Searches Bexio products/articles by internal name or internal code with operators such as contains or equals, with ordering and paging. Use to resolve a product to its id before referencing it on an invoice/order position or before Update Product. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding products",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"Internal Name",value:"intern_name"},{label:"Internal Code",value:"intern_code"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Internal Name",value:"intern_name"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(m=>({field:m.field,value:m.value,criteria:m.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/article/search",s,p)}});var rc=R({auth:y,name:"find_country",classification:"SEARCH",displayName:"Find Country",description:"Search for countries using various criteria",audience:"both",aiMetadata:{description:"Searches the Bexio country list by name or short code with operators such as contains or equals. Use to resolve a country to its id before setting country_id on a contact or other record. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding countries",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"Country Name",value:"name"},{label:"Country Code (Short)",value:"name_short"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Country Name",value:"name"},{label:"Country Code",value:"name_short"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(m=>({field:m.field,value:m.value,criteria:m.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/country/search",s,p)}});var nc=R({auth:y,name:"search_invoice",classification:"SEARCH",displayName:"Search Invoice",description:"Search for invoices using various criteria",audience:"both",aiMetadata:{description:"Searches Bexio sales invoices by one or more field criteria (document number, contact, status, totals, dates, etc.) with operators such as contains, equals, or comparison, with ordering and paging. Use to locate invoices before exporting, sending, or reconciling them; pick Search Order or Search Quote for those document types. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding invoices",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Status ID",value:"kb_item_status_id"},{label:"Document Number",value:"document_nr"},{label:"Title",value:"title"},{label:"API Reference",value:"api_reference"},{label:"Contact ID",value:"contact_id"},{label:"Sub Contact ID",value:"contact_sub_id"},{label:"User ID",value:"user_id"},{label:"Currency ID",value:"currency_id"},{label:"Total Gross",value:"total_gross"},{label:"Total Net",value:"total_net"},{label:"Total",value:"total"},{label:"Valid From",value:"is_valid_from"},{label:"Valid To",value:"is_valid_to"},{label:"Updated At",value:"updated_at"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Total",value:"total"},{label:"Total Net",value:"total_net"},{label:"Total Gross",value:"total_gross"},{label:"Updated At",value:"updated_at"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(m=>({field:m.field,value:m.value,criteria:m.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/kb_invoice/search",s,p)}});var ic=R({auth:y,name:"search_order",classification:"SEARCH",displayName:"Search Order",description:"Search for orders using various criteria",audience:"both",aiMetadata:{description:"Searches Bexio sales orders by one or more field criteria (document number, contact, status, totals, dates, etc.) with operators such as contains, equals, or comparison, with ordering and paging. Use to locate orders before referencing or processing them; pick Search Invoice or Search Quote for those document types. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding orders",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Status ID",value:"kb_item_status_id"},{label:"Document Number",value:"document_nr"},{label:"Title",value:"title"},{label:"Contact ID",value:"contact_id"},{label:"Sub Contact ID",value:"contact_sub_id"},{label:"User ID",value:"user_id"},{label:"Currency ID",value:"currency_id"},{label:"Total Gross",value:"total_gross"},{label:"Total Net",value:"total_net"},{label:"Total",value:"total"},{label:"Valid From",value:"is_valid_from"},{label:"Valid To",value:"is_valid_to"},{label:"Updated At",value:"updated_at"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Total",value:"total"},{label:"Total Net",value:"total_net"},{label:"Total Gross",value:"total_gross"},{label:"Updated At",value:"updated_at"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(m=>({field:m.field,value:m.value,criteria:m.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/kb_order/search",s,p)}});var oc=R({auth:y,name:"search_quote",classification:"SEARCH",displayName:"Search Quote",description:"Search for quotes using various criteria",audience:"both",aiMetadata:{description:"Searches Bexio quotes (offers) by one or more field criteria (document number, contact, status, totals, dates, valid-until, etc.) with operators such as contains, equals, or comparison, with ordering and paging. Use to locate quotes before referencing or following up on them; pick Search Invoice or Search Order for those document types. Read-only and idempotent.",idempotent:!0},props:{search_criteria:a.Array({displayName:"Search Criteria",description:"Search criteria for finding quotes",required:!0,properties:{field:a.StaticDropdown({displayName:"Search Field",description:"Field to search in",required:!0,options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Status ID",value:"kb_item_status_id"},{label:"Document Number",value:"document_nr"},{label:"Title",value:"title"},{label:"Contact ID",value:"contact_id"},{label:"Sub Contact ID",value:"contact_sub_id"},{label:"User ID",value:"user_id"},{label:"Currency ID",value:"currency_id"},{label:"Total Gross",value:"total_gross"},{label:"Total Net",value:"total_net"},{label:"Total",value:"total"},{label:"Valid From",value:"is_valid_from"},{label:"Valid To",value:"is_valid_to"},{label:"Valid Until",value:"is_valid_until"},{label:"Updated At",value:"updated_at"}]}}),value:a.ShortText({displayName:"Search Value",description:"Value to search for",required:!0}),criteria:a.StaticDropdown({displayName:"Criteria",description:"Search criteria type",required:!1,defaultValue:"like",options:{disabled:!1,options:[{label:"Contains (like)",value:"like"},{label:"Exact match (=)",value:"="},{label:"Exact match (equal)",value:"equal"},{label:"Not equal (!=)",value:"!="},{label:"Not equal (not_equal)",value:"not_equal"},{label:"Greater than (>)",value:">"},{label:"Greater than (greater_than)",value:"greater_than"},{label:"Greater or equal (>=)",value:">="},{label:"Greater or equal (greater_equal)",value:"greater_equal"},{label:"Less than (<)",value:"<"},{label:"Less than (less_than)",value:"less_than"},{label:"Less or equal (<=)",value:"<="},{label:"Less or equal (less_equal)",value:"less_equal"},{label:"Does not contain (not_like)",value:"not_like"},{label:"Is NULL",value:"is_null"},{label:"Is not NULL",value:"not_null"},{label:"In (array)",value:"in"},{label:"Not in (array)",value:"not_in"}]}})}}),order_by:a.StaticDropdown({displayName:"Order By",description:"Field to order results by",required:!1,defaultValue:"id",options:{disabled:!1,options:[{label:"ID",value:"id"},{label:"Total",value:"total"},{label:"Total Net",value:"total_net"},{label:"Total Gross",value:"total_gross"},{label:"Updated At",value:"updated_at"}]}}),limit:a.Number({displayName:"Limit",description:"Maximum number of results to return (max 2000)",required:!1,defaultValue:500}),offset:a.Number({displayName:"Offset",description:"Number of results to skip",required:!1,defaultValue:0})},async run({auth:e,propsValue:r}){let n=new h(e),t=r.search_criteria,i=r.order_by,c=r.limit,u=r.offset,s=t.map(m=>({field:m.field,value:m.value,criteria:m.criteria||"like"})),p={};return i&&(p.order_by=i),c!==void 0&&(p.limit=c.toString()),u!==void 0&&(p.offset=u.toString()),await n.post("/2.0/kb_offer/search",s,p)}});var Dr=Ee(vt());var zr={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r})=>{let n=new h(e),t=r===0,i=t?(0,Dr.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,Dr.default)(r).format("YYYY-MM-DD HH:mm:ss"),c=[{field:"contact_type_id",value:"1",criteria:"="},{field:"updated_at",value:i,criteria:">="}],u={order_by:"updated_at_desc",limit:t?"5":"500"};return(await n.post("/2.0/contact/search",c,u)).map(p=>{let g=p.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,Dr.default)(g).valueOf(),data:p}})},"items")},ac=xe({auth:y,name:"new_updated_company",classification:"READ",displayName:"New/Updated Company",description:"Triggers when a company is added or updated",aiMetadata:{description:"Fires when a company contact is created or its updated timestamp changes in Bexio. Emits each matching company with its name, address, contact details (email, phone), group memberships, and lead status. Use to react to new or modified organization contacts."},type:"POLLING",props:{},sampleData:{id:4,nr:null,contact_type_id:1,name_1:"Example Company",name_2:null,salutation_id:2,salutation_form:null,title_id:null,birthday:null,address:"Smith Street 22",street_name:"Smith Street",house_number:"77",address_addition:"Building C",postcode:"8004",city:"Zurich",country_id:1,mail:"contact@example.org",mail_second:"",phone_fixed:"",phone_fixed_second:"",phone_mobile:"",fax:"",url:"",skype_name:"",remarks:"",language_id:null,is_lead:!1,contact_group_ids:"1,2",contact_branch_ids:null,user_id:1,owner_id:1,updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await X.onEnable(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await X.onDisable(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await X.test(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await X.poll(zr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Cr=Ee(vt());var Or={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r,propsValue:n})=>{let t=new h(e),i=r===0,u=[{field:"updated_at",value:i?(0,Cr.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,Cr.default)(r).format("YYYY-MM-DD HH:mm:ss"),criteria:">="}];n.status_id!==void 0&&n.status_id!==null&&u.push({field:"kb_item_status_id",value:n.status_id.toString(),criteria:"="});let s={order_by:"updated_at_desc",limit:i?"5":"500"};return(await t.post("/2.0/kb_invoice/search",u,s)).map(g=>{let m=g.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,Cr.default)(m).valueOf(),data:g}})},"items")},sc=xe({auth:y,name:"new_sales_invoice",classification:"READ",displayName:"New Sales-Invoice",description:"Triggers when a Sales-Invoice is created or updated with the chosen status",aiMetadata:{description:"Fires when a sales invoice is created or its updated timestamp changes in Bexio, optionally filtered to a chosen invoice status. Emits each matching invoice with its document number, contact, totals (gross, net, taxes), validity dates, and status. Use to react to new or modified customer invoices."},type:"POLLING",props:{status_id:a.Dropdown({auth:y,displayName:"Status",description:"Filter invoices by status (leave empty to trigger for all statuses)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{let n=await new h(e).get("/2.0/kb_invoice_status").catch(()=>[]);return n.length===0?{disabled:!1,placeholder:"Status filter not available - will trigger for all statuses",options:[]}:{disabled:!1,options:n.map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!1,placeholder:"Enter status ID manually or leave empty for all statuses",options:[]}}},"options")})},sampleData:{id:4,document_nr:"RE-00001",title:null,contact_id:14,contact_sub_id:null,user_id:1,project_id:null,language_id:1,bank_account_id:1,currency_id:1,payment_type_id:1,total_gross:"17.800000",total_net:"17.800000",total_taxes:"1.3706",total:"19.150000",kb_item_status_id:3,is_valid_from:"2019-06-24",is_valid_to:"2019-07-24",updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await X.onEnable(Or,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await X.onDisable(Or,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await X.test(Or,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await X.poll(Or,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Ur=Ee(vt());var Rr={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r,propsValue:n})=>{let t=new h(e),i=r===0,u=[{field:"updated_at",value:i?(0,Ur.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,Ur.default)(r).format("YYYY-MM-DD HH:mm:ss"),criteria:">="}];n.status_id!==void 0&&n.status_id!==null&&u.push({field:"kb_item_status_id",value:n.status_id.toString(),criteria:"="});let s={order_by:"updated_at_desc",limit:i?"5":"500"};return(await t.post("/2.0/kb_order/search",u,s)).map(g=>{let m=g.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,Ur.default)(m).valueOf(),data:g}})},"items")},uc=xe({auth:y,name:"new_order",classification:"READ",displayName:"New Order",description:"Triggers when an Order is created or updated with the chosen status",aiMetadata:{description:"Fires when a sales order is created or its updated timestamp changes in Bexio, optionally filtered to a chosen order status. Emits each matching order with its document number, contact, totals (gross, net, taxes), valid-from date, and status. Use to react to new or modified orders."},type:"POLLING",props:{status_id:a.Dropdown({auth:y,displayName:"Status",description:"Filter orders by status (leave empty to trigger for all statuses)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{let n=await new h(e).get("/2.0/kb_order_status").catch(()=>[]);return n.length===0?{disabled:!1,placeholder:"Status filter not available - will trigger for all statuses",options:[]}:{disabled:!1,options:n.map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!1,placeholder:"Enter status ID manually or leave empty for all statuses",options:[]}}},"options")})},sampleData:{id:4,document_nr:"AU-00001",title:null,contact_id:14,contact_sub_id:null,user_id:1,project_id:null,language_id:1,bank_account_id:1,currency_id:1,payment_type_id:1,total_gross:"17.800000",total_net:"17.800000",total_taxes:"1.3706",total:"19.150000",kb_item_status_id:5,is_valid_from:"2019-06-24",updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await X.onEnable(Rr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await X.onDisable(Rr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await X.test(Rr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await X.poll(Rr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Lr=Ee(vt());var Mr={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r})=>{let n=new h(e),t=r===0,i=t?(0,Lr.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,Lr.default)(r).format("YYYY-MM-DD HH:mm:ss"),c=[{field:"contact_type_id",value:"2",criteria:"="},{field:"updated_at",value:i,criteria:">="}],u={order_by:"updated_at_desc",limit:t?"5":"500"};return(await n.post("/2.0/contact/search",c,u)).map(p=>{let g=p.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,Lr.default)(g).valueOf(),data:p}})},"items")},cc=xe({auth:y,name:"new_updated_person",classification:"READ",displayName:"New/Updated Person",description:"Triggers when a person is added or updated",aiMetadata:{description:"Fires when a person contact is created or its updated timestamp changes in Bexio. Emits each matching person with their name, address, contact details (email, phone), birthday, group memberships, and lead status. Use to react to new or modified individual contacts."},type:"POLLING",props:{},sampleData:{id:4,nr:null,contact_type_id:2,name_1:"John",name_2:"Doe",salutation_id:1,salutation_form:null,title_id:null,birthday:"1990-01-01",address:"Smith Street 22",street_name:"Smith Street",house_number:"77",address_addition:"Building C",postcode:"8004",city:"Zurich",country_id:1,mail:"john.doe@example.org",mail_second:"",phone_fixed:"",phone_fixed_second:"",phone_mobile:"",fax:"",url:"",skype_name:"",remarks:"",language_id:null,is_lead:!1,contact_group_ids:"1,2",contact_branch_ids:null,user_id:1,owner_id:1,updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await X.onEnable(Mr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await X.onDisable(Mr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await X.test(Mr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await X.poll(Mr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var jr={strategy:1,items:o(async({auth:e,lastItemId:r})=>{let n=new h(e),t={limit:"500"};return(await n.get("/2.0/article",t)).sort((u,s)=>s.id-u.id).map(u=>({id:u.id,data:u}))},"items")},lc=xe({auth:y,name:"new_product",classification:"READ",displayName:"New Product",description:"Triggers when a new product is created",aiMetadata:{description:"Fires when a new product (article) is created in Bexio. Polls the article list and emits each newly added product, including its codes, names, pricing, stock levels, and accounting references. Use to react to additions to the product catalog."},type:"POLLING",props:{},sampleData:{id:4,user_id:1,article_type_id:1,contact_id:14,deliverer_code:null,deliverer_name:null,deliverer_description:null,intern_code:"wh-2019",intern_name:"Webhosting",intern_description:null,purchase_price:null,sale_price:null,purchase_total:null,sale_total:null,currency_id:null,tax_income_id:null,tax_id:null,tax_expense_id:null,unit_id:null,is_stock:!1,stock_id:null,stock_place_id:null,stock_nr:0,stock_min_nr:0,stock_reserved_nr:0,stock_available_nr:0,stock_picked_nr:0,stock_disposed_nr:0,stock_ordered_nr:0,width:null,height:null,weight:null,volume:null,html_text:null,remarks:null,delivery_price:null,article_group_id:null,account_id:null,expense_account_id:null},onEnable:o(async e=>{await X.onEnable(jr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await X.onDisable(jr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await X.test(jr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await X.poll(jr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Fr={strategy:1,items:o(async({auth:e,lastItemId:r,propsValue:n})=>{let t=new h(e),i=[{field:"name",value:"",criteria:"not_null"}];n.status_id!==void 0&&n.status_id!==null&&i.push({field:"pr_state_id",value:n.status_id.toString(),criteria:"="});let c={order_by:"id_desc",limit:"500"};return(await t.post("/2.0/pr_project/search",i,c)).map(s=>({id:s.id,data:s}))},"items")},dc=xe({auth:y,name:"new_project",classification:"READ",displayName:"New Project",description:"Triggers when a Project is created or updated with the chosen status",aiMetadata:{description:"Fires when a project is created or updated in Bexio, optionally filtered to a chosen project status. Emits each matching project with its number, name, dates, status, type, contact, invoicing and budget settings. Use to track new or changing projects."},type:"POLLING",props:{status_id:a.Dropdown({auth:y,displayName:"Status",description:"Filter projects by status (leave empty to trigger for all statuses)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{let n=await new h(e).get("/2.0/pr_project_state").catch(()=>[]);return n.length===0?{disabled:!1,placeholder:"Status filter not available - will trigger for all statuses",options:[]}:{disabled:!1,options:n.map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!1,placeholder:"Enter status ID manually or leave empty for all statuses",options:[]}}},"options")})},sampleData:{id:2,uuid:"046b6c7f-0b8a-43b9-b35d-6489e6daee91",nr:"000002",name:"Villa Kunterbunt",start_date:"2019-07-12 00:00:00",end_date:null,comment:"",pr_state_id:2,pr_project_type_id:2,contact_id:2,contact_sub_id:null,pr_invoice_type_id:3,pr_invoice_type_amount:"230.00",pr_budget_type_id:1,pr_budget_type_amount:"200.00",user_id:1},onEnable:o(async e=>{await X.onEnable(Fr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await X.onDisable(Fr,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await X.test(Fr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await X.poll(Fr,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var qr=Ee(vt());var Br={strategy:0,items:o(async({auth:e,lastFetchEpochMS:r,propsValue:n})=>{let t=new h(e),i=r===0,u=[{field:"updated_at",value:i?(0,qr.default)().subtract(1,"day").format("YYYY-MM-DD HH:mm:ss"):(0,qr.default)(r).format("YYYY-MM-DD HH:mm:ss"),criteria:">="}];n.status_id!==void 0&&n.status_id!==null&&u.push({field:"kb_item_status_id",value:n.status_id.toString(),criteria:"="});let s={order_by:"updated_at_desc",limit:i?"5":"500"};return(await t.post("/2.0/kb_offer/search",u,s)).map(g=>{let m=g.updated_at||new Date().toISOString();return{epochMilliSeconds:(0,qr.default)(m).valueOf(),data:g}})},"items")},pc=xe({auth:y,name:"new_quote",classification:"READ",displayName:"New Quotes",description:"Triggers when a quote is created or updated with the chosen status",aiMetadata:{description:"Fires when a quote (offer) is created or its updated timestamp changes in Bexio, optionally filtered to a chosen quote status. Emits each matching quote with its document number, contact, totals (gross, net, taxes), validity dates, and status. Use to react to new or modified quotes."},type:"POLLING",props:{status_id:a.Dropdown({auth:y,displayName:"Status",description:"Filter quotes by status (leave empty to trigger for all statuses)",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,placeholder:"Connect your Bexio account first",options:[]};try{let n=await new h(e).get("/2.0/kb_offer_status").catch(()=>[]);return n.length===0?{disabled:!1,placeholder:"Status filter not available - will trigger for all statuses",options:[]}:{disabled:!1,options:n.map(t=>({label:t.name,value:t.id}))}}catch{return{disabled:!1,placeholder:"Enter status ID manually or leave empty for all statuses",options:[]}}},"options")})},sampleData:{id:4,document_nr:"AN-00001",title:null,contact_id:14,contact_sub_id:null,user_id:1,project_id:null,language_id:1,bank_account_id:1,currency_id:1,payment_type_id:1,total_gross:"17.800000",total_net:"17.800000",total_taxes:"1.3706",total:"19.150000",kb_item_status_id:3,is_valid_from:"2019-06-24",is_valid_until:"2019-07-24",updated_at:"2019-04-08 13:17:32"},onEnable:o(async e=>{await X.onEnable(Br,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:o(async e=>{await X.onDisable(Br,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),test:o(async e=>await X.test(Br,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"test"),run:o(async e=>await X.poll(Br,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files}),"run")});var Ym=_a({displayName:"Bexio",description:"Swiss business software for accounting, invoicing, and project management",auth:y,minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/bexio.png",authors:["onyedikachi-david"],categories:["BUSINESS_INTELLIGENCE"],actions:[Ru,Uu,Mu,Lu,Yu,Xu,Qu,ec,tc,rc,nc,ic,oc,Fu,Bu,qu,Vu,Zu,Hu,Gu,Wu,Ku,Ju,Cu({baseUrl:o(()=>"https://api.bexio.com","baseUrl"),auth:y,authMapping:o(async e=>({Authorization:`Bearer ${e.access_token}`}),"authMapping")})],triggers:[ac,cc,lc,dc,sc,uc,pc]});0&&(module.exports={bexio});
4
4
  /*! Bundled license information:
5
5
 
6
6
  mime-types/index.js: