@processfocus/cli 0.1.0-next.0 → 0.1.0-next.2

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.
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- var ti=Object.create;var{getPrototypeOf:ni,defineProperty:yr,getOwnPropertyNames:ri}=Object;var gr=Object.prototype.hasOwnProperty;function oi(e){return this[e]}var ii,si,Q=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var o=t?ii??=new WeakMap:si??=new WeakMap,i=o.get(e);if(i)return i}n=e!=null?ti(ni(e)):{};let s=t||!e||!e.__esModule||!gr.call(e,"default")?yr(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of ri(e))if(!gr.call(s,a))yr(s,a,{get:oi.bind(e,a),enumerable:!0})}if(r)o.set(e,s);return s};var te=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ai=import.meta.require;var $e=te(function(wt,hn){Object.defineProperty(wt,"__esModule",{value:!0});wt.default=di;function di(e){if(e===void 0||e===null)throw TypeError("Expected a string but received a ".concat(e));if(e.constructor.name!=="String")throw TypeError("Expected a string but received a ".concat(e.constructor.name))}hn.exports=wt.default;hn.exports.default=wt.default});var Tn=te(function(Et,Sn){Object.defineProperty(Et,"__esModule",{value:!0});Et.default=li;function ci(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function li(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(e===r||ci(r)&&r.test(e))return!0}return!1}Sn.exports=Et.default;Sn.exports.default=Et.default});var Sr=te(function(kt,xn){Object.defineProperty(kt,"__esModule",{value:!0});kt.default=void 0;var fi=function(t,n){return t.indexOf(n)!==-1},Dc=kt.default=fi;xn.exports=kt.default;xn.exports.default=kt.default});var Rt=te(function(Ot,bn){Object.defineProperty(Ot,"__esModule",{value:!0});Ot.default=mi;function Fn(e){return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fn(e)}function mi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(Fn(e)!=="object"||e===null)e={};for(var n in t)if(typeof e[n]>"u")e[n]=t[n];return e}bn.exports=Ot.default;bn.exports.default=Ot.default});var En=te(function(At,wn){Object.defineProperty(At,"__esModule",{value:!0});At.default=Ti;var gi=Tr($e()),hi=Tr(Rt());function Tr(e){return e&&e.__esModule?e:{default:e}}var Si={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1,allow_wildcard:!1,ignore_max_length:!1};function Ti(e,t){if((0,gi.default)(e),t=(0,hi.default)(t,Si),t.allow_trailing_dot&&e[e.length-1]===".")e=e.substring(0,e.length-1);if(t.allow_wildcard===!0&&e.indexOf("*.")===0)e=e.substring(2);var n=e.split("."),r=n[n.length-1];if(t.require_tld){if(n.length<2)return!1;if(!t.allow_numeric_tld&&!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(r))return!1;if(/\s/.test(r))return!1}if(!t.allow_numeric_tld&&/^\d+$/.test(r))return!1;return n.every(function(o){if(o.length>63&&!t.ignore_max_length)return!1;if(!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(o))return!1;if(/[\uff01-\uff5e]/.test(o))return!1;if(/^-|-$/.test(o))return!1;if(!t.allow_underscores&&/_/.test(o))return!1;return!0})}wn.exports=At.default;wn.exports.default=At.default});var An=te(function(_t,Rn){Object.defineProperty(_t,"__esModule",{value:!0});_t.default=On;var Fi=bi($e());function bi(e){return e&&e.__esModule?e:{default:e}}function kn(e){return kn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kn(e)}var xr="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",Ee="(".concat(xr,"[.]){3}").concat(xr),wi=new RegExp("^".concat(Ee,"$")),j="(?:[0-9a-fA-F]{1,4})",Ei=new RegExp("^("+"(?:".concat(j,":){7}(?:").concat(j,"|:)|")+"(?:".concat(j,":){6}(?:").concat(Ee,"|:").concat(j,"|:)|")+"(?:".concat(j,":){5}(?::").concat(Ee,"|(:").concat(j,"){1,2}|:)|")+"(?:".concat(j,":){4}(?:(:").concat(j,"){0,1}:").concat(Ee,"|(:").concat(j,"){1,3}|:)|")+"(?:".concat(j,":){3}(?:(:").concat(j,"){0,2}:").concat(Ee,"|(:").concat(j,"){1,4}|:)|")+"(?:".concat(j,":){2}(?:(:").concat(j,"){0,3}:").concat(Ee,"|(:").concat(j,"){1,5}|:)|")+"(?:".concat(j,":){1}(?:(:").concat(j,"){0,4}:").concat(Ee,"|(:").concat(j,"){1,6}|:)|")+"(?::((?::".concat(j,"){0,5}:").concat(Ee,"|(?::").concat(j,"){1,7}|:))")+")(%[0-9a-zA-Z.]{1,})?$");function On(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(0,Fi.default)(e);var n=(kn(t)==="object"?t.version:arguments[1])||"";if(!n)return On(e,{version:4})||On(e,{version:6});if(n.toString()==="4")return wi.test(e);if(n.toString()==="6")return Ei.test(e);return!1}Rn.exports=_t.default;Rn.exports.default=_t.default});var Er=te(function(Dt,Dn){Object.defineProperty(Dt,"__esModule",{value:!0});Dt.default=$i;var Oi=Ne($e()),Fr=Ne(Tn()),_n=Ne(Sr()),Ri=Ne(En()),br=Ne(An()),Ai=Ne(Rt());function Ne(e){return e&&e.__esModule?e:{default:e}}function _i(e,t){return Ii(e)||Ci(e,t)||Pi(e,t)||Di()}function Di(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pi(e,t){if(e){if(typeof e=="string")return wr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wr(e,t):void 0}}function wr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ci(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],d=!0,u=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;d=!1}else for(;!(d=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);d=!0);}catch(l){u=!0,o=l}finally{try{if(!d&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}function Ii(e){if(Array.isArray(e))return e}var vi={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,validate_length:!0,max_allowed_length:2084},Mi=/^\[([^\]]+)\](?::([0-9]+))?$/;function $i(e,t){if((0,Oi.default)(e),!e||/[\s<>]/.test(e))return!1;if(e.indexOf("mailto:")===0)return!1;if(t=(0,Ai.default)(t,vi),t.validate_length&&e.length>t.max_allowed_length)return!1;if(!t.allow_fragments&&(0,_n.default)(e,"#"))return!1;if(!t.allow_query_components&&((0,_n.default)(e,"?")||(0,_n.default)(e,"&")))return!1;var n,r,o,i,s,a,d,u;d=e.split("#"),e=d.shift(),d=e.split("?"),e=d.shift();var l=e.match(/^([a-z][a-z0-9+\-.]*):/i),c=!1,g=function(L){if(c=!0,n=L.toLowerCase(),t.require_valid_protocol&&t.protocols.indexOf(n)===-1)return!1;return e.substring(l[0].length)};if(l){var x=l[1],F=e.substring(l[0].length),N=F.slice(0,2)==="//";if(!N){var D=F.indexOf("/"),B=D===-1?F:F.substring(0,D),b=B.indexOf("@");if(b!==-1){var A=B.substring(0,b),p=/^[a-zA-Z0-9\-_.%:]*$/,m=p.test(A),f=/%[0-9a-fA-F]{2}/.test(A);if(m&&!f){if(t.require_protocol)return!1}else if(e=g(x),e===!1)return!1}else{var y=/^[0-9]/.test(F);if(y){if(t.require_protocol)return!1}else if(e=g(x),e===!1)return!1}}else if(e=g(x),e===!1)return!1}else if(t.require_protocol)return!1;if(e.slice(0,2)==="//"){if(!c&&!t.allow_protocol_relative_urls)return!1;e=e.slice(2)}if(e==="")return!1;if(d=e.split("/"),e=d.shift(),e===""&&!t.require_host)return!0;if(d=e.split("@"),d.length>1){if(t.disallow_auth)return!1;if(d[0]==="")return!1;if(r=d.shift(),r.indexOf(":")>=0&&r.split(":").length>2)return!1;var T=r.split(":"),E=_i(T,2),k=E[0],I=E[1];if(k===""&&I==="")return!1}i=d.join("@"),a=null,u=null;var _=i.match(Mi);if(_)o="",u=_[1],a=_[2]||null;else if(d=i.split(":"),o=d.shift(),d.length)a=d.join(":");if(a!==null&&a.length>0){if(s=parseInt(a,10),!/^[0-9]+$/.test(a)||s<=0||s>65535)return!1}else if(t.require_port)return!1;if(t.host_whitelist)return(0,Fr.default)(o,t.host_whitelist);if(o===""&&!t.require_host)return!0;if(!(0,br.default)(o)&&!(0,Ri.default)(o,t)&&(!u||!(0,br.default)(u,6)))return!1;if(o=o||u,t.host_blacklist&&(0,Fr.default)(o,t.host_blacklist))return!1;return!0}Dn.exports=Dt.default;Dn.exports.default=Dt.default});var Pr=te(function(Lt,Mn){Object.defineProperty(Lt,"__esModule",{value:!0});Lt.default=Xi;var Ji=Zi($e());function Zi(e){return e&&e.__esModule?e:{default:e}}function vn(e){return vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vn(e)}function Xi(e,t){(0,Ji.default)(e);var n,r;if(vn(t)==="object")n=t.min||0,r=t.max;else n=arguments[1],r=arguments[2];var o=encodeURI(e).split(/%..|./).length-1;return o>=n&&(typeof r>"u"||o<=r)}Mn.exports=Lt.default;Mn.exports.default=Lt.default});var vr=te(function(Bt,Nn){Object.defineProperty(Bt,"__esModule",{value:!0});Bt.default=fs;var ts=Ue($e()),Cr=Ue(Tn()),$n=Ue(Pr()),ns=Ue(En()),Ir=Ue(An()),rs=Ue(Rt());function Ue(e){return e&&e.__esModule?e:{default:e}}var os={allow_display_name:!1,allow_underscores:!1,require_display_name:!1,allow_utf8_local_part:!0,require_tld:!0,blacklisted_chars:"",ignore_max_length:!1,host_blacklist:[],host_whitelist:[]},is=/^([^\x00-\x1F\x7F-\x9F\cX]+)</i,ss=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,as=/^[a-z\d]+$/,ds=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,us=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,cs=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i,ls=254;function ps(e){var t=e.replace(/^"(.+)"$/,"$1");if(!t.trim())return!1;var n=/[\.";<>]/.test(t);if(n){if(t===e)return!1;var r=t.split('"').length===t.split("\\\"").length;if(!r)return!1}return!0}function fs(e,t){if((0,ts.default)(e),t=(0,rs.default)(t,os),t.require_display_name||t.allow_display_name){var n=e.match(is);if(n){var r=n[1];if(e=e.replace(r,"").replace(/(^<|>$)/g,""),r.endsWith(" "))r=r.slice(0,-1);if(!ps(r))return!1}else if(t.require_display_name)return!1}if(!t.ignore_max_length&&e.length>ls)return!1;var o=e.split("@"),i=o.pop(),s=i.toLowerCase();if(t.host_blacklist.length>0&&(0,Cr.default)(s,t.host_blacklist))return!1;if(t.host_whitelist.length>0&&!(0,Cr.default)(s,t.host_whitelist))return!1;var a=o.join("@");if(t.domain_specific_validation&&(s==="gmail.com"||s==="googlemail.com")){a=a.toLowerCase();var d=a.split("+")[0];if(!(0,$n.default)(d.replace(/\./g,""),{min:6,max:30}))return!1;var u=d.split(".");for(var l=0;l<u.length;l++)if(!as.test(u[l]))return!1}if(t.ignore_max_length===!1&&(!(0,$n.default)(a,{max:64})||!(0,$n.default)(i,{max:254})))return!1;if(!(0,ns.default)(i,{require_tld:t.require_tld,ignore_max_length:t.ignore_max_length,allow_underscores:t.allow_underscores})){if(!t.allow_ip_domain)return!1;if(!(0,Ir.default)(i)){if(!i.startsWith("[")||!i.endsWith("]"))return!1;var c=i.slice(1,-1);if(c.length===0||!(0,Ir.default)(c))return!1}}if(t.blacklisted_chars){if(a.search(new RegExp("[".concat(t.blacklisted_chars,"]+"),"g"))!==-1)return!1}if(a[0]==='"'&&a[a.length-1]==='"')return a=a.slice(1,a.length-1),t.allow_utf8_local_part?cs.test(a):ds.test(a);var g=t.allow_utf8_local_part?us:ss,x=a.split(".");for(var F=0;F<x.length;F++)if(!g.test(x[F]))return!1;return!0}Nn.exports=Bt.default;Nn.exports.default=Bt.default});var jn=te(function(Hr){Object.defineProperty(Hr,"__esModule",{value:!0});Hr.Dependable=Hr.DependencyGroup=void 0;var jr=Symbol.for("jsii.rtti");class Wr{static[jr]={fqn:"constructs.DependencyGroup",version:"10.8.1"};_deps=[];constructor(...e){let t=this;Wt.implement(this,{get dependencyRoots(){let n=[];for(let r of t._deps)n.push(...Wt.of(r).dependencyRoots);return n}}),this.add(...e)}add(...e){this._deps.push(...e)}}Hr.DependencyGroup=Wr;var Ur=Symbol.for("@aws-cdk/core.DependableTrait");class Wt{static[jr]={fqn:"constructs.Dependable",version:"10.8.1"};static implement(e,t){e[Ur]=t}static of(e){let t=e[Ur];if(!t)throw Error(`${e} does not implement IDependable. Use "Dependable.implement()" to implement`);return t}static get(e){return this.of(e)}}Hr.Dependable=Wt});var Kr=te(function(ae){var Ms=ae&&ae.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;var o=Object.getOwnPropertyDescriptor(t,n);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable))o={enumerable:!0,get:function(){return t[n]}};Object.defineProperty(e,r,o)}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),$s=ae&&ae.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ns=ae&&ae.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o))r[r.length]=o;return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null){for(var r=e(t),o=0;o<r.length;o++)if(r[o]!=="default")Ms(n,t,r[o])}return $s(n,t),n}}();Object.defineProperty(ae,"__esModule",{value:!0});ae.ADDR_SEP=void 0;ae.addressOf=Us;var Ls=Ns(ai("crypto")),Bs="Default";ae.ADDR_SEP=`
4
- `;function Us(e){let t=Ls.createHash("sha1");for(let n of e){if(n===Bs)continue;t.update(n),t.update(ae.ADDR_SEP)}return"c8"+t.digest("hex")}});var Yr=te(function(zr){Object.defineProperty(zr,"__esModule",{value:!0});zr.captureStackTrace=Vr;function Vr(e){e=e||Vr;let t={stack:""},n=Error.stackTraceLimit;try{Error.stackTraceLimit=Number.MAX_SAFE_INTEGER,Error.captureStackTrace(t,e)}finally{Error.stackTraceLimit=n}if(!t.stack)return[];return t.stack.split(`
5
- `).slice(1).map((r)=>r.replace(/^\s*at\s+/,""))}});var no=te(function(eo){Object.defineProperty(eo,"__esModule",{value:!0});eo.RootConstruct=eo.ConstructOrder=eo.Construct=eo.Node=void 0;var Wn=Symbol.for("jsii.rtti"),Qr=jn(),Jr=Kr(),Ws=Yr(),Zr=Symbol.for("constructs.Construct");class ot{host;static[Wn]={fqn:"constructs.Node",version:"10.8.1"};static PATH_SEP="/";static of(e){return e.node}scope;id;path;_locked=!1;_children;_context;_metadata;_dependencies;_defaultChild;_validations;_addr;_scopes;constructor(e,t,n){if(this.host=e,n=n??"",this.id=Gr(n),this.scope=t,t&&!this.id)throw Error("Only root constructs may have an empty ID");if(t)t.node.addChild(e,this.id),this.path=t.node.path?`${t.node.path}${ot.PATH_SEP}${this.id}`:this.id,this._scopes=[...t.node._scopes,this.host];else this.path=this.id,this._scopes=[this.host]}get scopes(){return[...this._scopes]}get addr(){if(!this._addr)this._addr=Jr.addressOf(this._scopes.map((e)=>e.node.id));return this._addr}tryFindChild(e){return this._children?.[Gr(e)]}findChild(e){let t=this.tryFindChild(e);if(!t)throw Error(`No child with id: '${e}'`);return t}get defaultChild(){if(this._defaultChild!==void 0)return this._defaultChild;let e=this.tryFindChild("Resource"),t=this.tryFindChild("Default");if(e&&t)throw Error(`Cannot determine default child for ${this.path}. There is both a child with id "Resource" and id "Default"`);return t||e}set defaultChild(e){this._defaultChild=e}get children(){return Object.values(this._children??{})}findAll(e=rt.PREORDER){let t=[];return n(this.host),t;function n(r){if(e===rt.PREORDER)t.push(r);for(let o of r.node.children)n(o);if(e===rt.POSTORDER)t.push(r)}}setContext(e,t){if(this.children.length>0){let n=this.children.map((r)=>r.node.id);throw Error("Cannot set context after children have been added: "+n.join(","))}if(!this._context)this._context={};this._context[e]=t}getContext(e){let t=this._context?.[e];if(t!==void 0)return t;if(t===void 0&&!this.scope?.node)throw Error(`No context value present for ${e} key`);return this.scope&&this.scope.node.getContext(e)}getAllContext(e){let t={...e};for(let n of this._scopes)Object.assign(t,n.node._context);return t}tryGetContext(e){let t=this._context?.[e];if(t!==void 0)return t;return this.scope&&this.scope.node.tryGetContext(e)}get metadata(){return[...this._metadata??[]]}addMetadata(e,t,n={}){if(t==null)return;let r=this;function o(){if(n.stackTraceOverride&&n.stackTraceOverride.length>0)return n.stackTraceOverride;return n.stackTrace??!1?Ws.captureStackTrace(n.traceFromFunction??r.addMetadata):void 0}if(!this._metadata)this._metadata=[];this._metadata.push({type:e,data:t,trace:o()})}get root(){return this._scopes[0]}get locked(){if(this._locked)return!0;if(this.scope&&this.scope.node.locked)return!0;return!1}addDependency(...e){if(!this._dependencies)this._dependencies=new Set;for(let t of e)this._dependencies.add(t)}removeDependency(...e){if(!this._dependencies)this._dependencies=new Set;for(let t of e)this._dependencies.delete(t)}get dependencies(){let e=[];if(this._dependencies)for(let t of this._dependencies)for(let n of Qr.Dependable.of(t).dependencyRoots)e.push(n);return e}tryRemoveChild(e){if(!this._children||!(e in this._children))return!1;return delete this._children[e],!0}addValidation(e){if(!this._validations)this._validations=[];this._validations.push(e)}validate(){return(this._validations??[]).flatMap((e)=>e.validate())}lock(){this._locked=!0}with(...e){let t=this.findAll();for(let n of e)for(let r of t)if(n.supports(r))n.applyTo(r);return this.host}addChild(e,t){if(this.locked){if(!this.path)throw Error("Cannot add children during synthesis");throw Error(`Cannot add children to "${this.path}" during synthesis`)}if(!this._children)this._children={};if(this._children[t]){let n=this.id??"",r=this.host.constructor.name;throw Error(`There is already a Construct with name '${t}' in ${r}${n.length>0?" ["+n+"]":""}`)}this._children[t]=e}}eo.Node=ot;class Ht{static[Wn]={fqn:"constructs.Construct",version:"10.8.1"};static isConstruct(e){return e&&typeof e==="object"&&e[Zr]}node;constructor(e,t){this.node=new ot(this,e,t),Qr.Dependable.implement(this,{dependencyRoots:[this]})}with(...e){return this.node.with(...e)}toString(){return this.node.path||"<root>"}}eo.Construct=Ht;var rt;(function(e){e[e.PREORDER=0]="PREORDER",e[e.POSTORDER=1]="POSTORDER"})(rt||(eo.ConstructOrder=rt={}));var Hs=new RegExp(`[${ot.PATH_SEP}${Jr.ADDR_SEP}]`,"g");function Gr(e){return e.replace(Hs,"--")}Object.defineProperty(Ht.prototype,Zr,{value:!0,enumerable:!1,writable:!1});class Xr extends Ht{static[Wn]={fqn:"constructs.RootConstruct",version:"10.8.1"};constructor(e){super(void 0,e??"")}}eo.RootConstruct=Xr});var ne=te(function(Oe){var zs=Oe&&Oe.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;var o=Object.getOwnPropertyDescriptor(t,n);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable))o={enumerable:!0,get:function(){return t[n]}};Object.defineProperty(e,r,o)}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),ro=Oe&&Oe.__exportStar||function(e,t){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n))zs(t,e,n)};Object.defineProperty(Oe,"__esModule",{value:!0});ro(no(),Oe);ro(jn(),Oe)});import{Effect as Xo}from"effect";import{Data as mr,Effect as C,Schema as xt}from"effect";import{Data as Nr,Effect as Y,Either as hl,Schema as ke,SchemaAST as me}from"effect";import{Schema as Qi,SchemaAST as Dr}from"effect";var et=Symbol.for("pf/form/annotation/ReadOnly");var mn=Symbol.for("pf/form/annotation/Required");var yn=Symbol.for("pf/form/annotation/EmailInput"),gn=Symbol.for("pf/form/annotation/PhoneInput");var Rr=Q(Er(),1);import{Schema as Le}from"effect";var vt=Symbol.for("processfocus:internal-tag/form-schema/flatten"),Te=Symbol.for("processfocus:internal-tag/form-schema/structural-only"),Ar=Symbol.for("processfocus:internal-tag/form-schema/structural-type");var Mt=Symbol.for("processfocus:internal-tag/form-schema/metric-breakdown");var _r=(e,t)=>Le.Undefined.annotations({[Te]:!0,[Ar]:e,...t}),Ic=_r("structural"),vc=_r("divider");var Vi=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e))return!1;return typeof e.label==="string"},zi=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e))return!1;let t=e;return typeof t.label==="string"&&typeof t.value==="string"},Yi=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e))return!1;let t=e;return t.type==="selector"&&typeof t.name==="string"&&(t.urlParameter===void 0||typeof t.urlParameter==="string")&&typeof t.label==="string"&&(t.value===void 0||typeof t.value==="string")&&Array.isArray(t.options)&&t.options.length>0&&t.options.every(zi)},$t=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e))return!1;let t=e,{dataSource:n,controls:r,rendererPluginType:o,rendererPluginData:i}=t;return typeof t.title==="string"&&Array.isArray(t.buckets)&&t.buckets.every(Vi)&&(r===void 0||Array.isArray(r)&&r.every(Yi))&&(n===void 0||n==="item")&&(o===void 0||typeof o==="string")&&(i===void 0||typeof i==="object"&&i!==null&&!Array.isArray(i))};var Gi=(e)=>Rr.default(e,{protocols:["https"],require_protocol:!0,require_tld:!0}),Mc=Le.String.pipe(Le.filter(Gi,{message:()=>"Must be a valid HTTPS URL (e.g. https://example.com/path)"}),Le.annotations({arbitrary:()=>(e)=>e.webUrl({validSchemes:["https"]})}));var $c=Le.Boolean.pipe(Le.filter((e)=>e===!0,{message:()=>"This field is required",jsonSchema:{type:"boolean",enum:[!0]},[mn]:!0}));var Pe=(e,t)=>{let n=e.annotations[t];if(n!==void 0)return n;if(e._tag==="Transformation"||e._tag==="Refinement")return Pe(e.from,t);if(e._tag==="Union")for(let r of e.types){let o=Pe(r,t);if(o!==void 0)return o}return},tt=(e)=>Qi.isPropertySignature(e)?e.ast._tag==="PropertySignatureDeclaration"?Dr.annotations(e.ast.type,e.ast.annotations):Dr.annotations(e.ast.from.type,{...e.ast.from.annotations,...e.ast.to.annotations}):e.ast,Be=(e)=>Pe(tt(e),Te)!==void 0,Nt=(e)=>Pe(tt(e),vt)!==void 0,Ce=(e)=>Pe(tt(e),et)===!0;var Mr=Q(vr(),1);import{Schema as Ln}from"effect";var Vc=Ln.Trim.pipe(Ln.filter((e)=>Mr.default(e,{require_tld:!1,allow_utf8_local_part:!0,allow_ip_domain:!0}),{message:()=>"must be a valid email address"}),Ln.annotations({identifier:"Email",title:"Email address",description:"A valid email address",jsonSchema:{format:"email"},[yn]:!0}));import{Either as Gc,Schema as Qc}from"effect";import{ArrayFormatter as Zc}from"effect/ParseResult";import{Schema as Bn}from"effect";var gs=/^\+?[\d\s\-()]+$/,hs=(e)=>(e.match(/\d/g)||[]).length,Ss=(e)=>{if(!gs.test(e))return!1;let t=hs(e);return t>=7&&t<=15},rl=Bn.Trim.pipe(Bn.filter((e)=>Ss(e),{message:()=>"must be a valid phone number (7-15 digits)"}),Bn.annotations({identifier:"Phone",title:"Phone number",description:"A valid phone number",jsonSchema:{format:"phone"},[gn]:!0}));import{Schema as je}from"effect";var Un=(e,t,n=(r)=>r)=>{let r=e.ast;if(r._tag==="PropertySignatureDeclaration")return je.makePropertySignature(new je.PropertySignatureDeclaration(t(r.type,"input"),r.isOptional,r.isReadonly,n(r.annotations,r.type,"input"),r.defaultValue));let{from:o,to:i}=r;return je.makePropertySignature(new je.PropertySignatureTransformation(new je.FromPropertySignature(t(o.type,"input"),o.isOptional,o.isReadonly,n(o.annotations,o.type,"input"),o.fromKey),new je.ToPropertySignature(t(i.type,"output"),i.isOptional,i.isReadonly,n(i.annotations,o.type,"output"),i.defaultValue),r.decode,r.encode))};class Ut extends Nr.TaggedError("FieldNameCollisionError"){get message(){return`Field name collision: "${this.wrapperField}" is already present as "${this.fieldName}" in its parent struct`}}class Lr extends Nr.TaggedError("InvalidFlattenAnnotationError"){get message(){return`Invalid schema: field "${this.fieldName}" has flatten annotation but is not a struct (AST tag: ${this.astTag}). Only use Wrapper() with Schema.Struct().`}}var Br=(e,t)=>Y.gen(function*(){let n=Nt(e),r=e.ast._tag==="TypeLiteral";if(n&&!r)return yield*new Lr({fieldName:t,astTag:e.ast._tag});return n&&r}),nt=(e)=>Y.gen(function*(){let t={};for(let[n,r]of Object.entries(e.fields)){let o=r;if(Be(o))continue;if(Ce(o))continue;if(yield*Br(o,String(n))){let i=yield*nt(o);for(let[s,a]of Object.entries(i.fields)){if(s in t)return yield*new Ut({fieldName:s,wrapperField:`${n}...${s}`});t[s]=a}}else{if(n in t)return yield*new Ut({fieldName:n,wrapperField:n});t[n]=yield*Ts(r)}}return yield*xs(e.ast),ke.Struct(t)}),Ts=(e)=>Y.gen(function*(){if(!ke.isPropertySignature(e))return ke.make(yield*ye(e.ast));let t=e.ast,n=yield*ye(t._tag==="PropertySignatureDeclaration"?t.type:t.from.type),r=t._tag==="PropertySignatureDeclaration"?n:yield*ye(t.to.type);return Un(e,(o,i)=>i==="input"?n:r)}),ye=(e)=>Y.gen(function*(){if(e._tag==="TypeLiteral"){let t=[],n=new Set;for(let r of e.propertySignatures){let o=ke.make(me.annotations(r.type,r.annotations));if(Be(o)||Ce(o))continue;let i=yield*Br(o,String(r.name)),s=yield*ye(r.type),a=i&&s._tag==="TypeLiteral"?s.propertySignatures:[new me.PropertySignature(r.name,s,r.isOptional,r.isReadonly,r.annotations)];for(let d of a){if(n.has(d.name))return yield*new Ut({fieldName:String(d.name),wrapperField:`${String(r.name)}...${String(d.name)}`});n.add(d.name),t.push(d)}}return new me.TypeLiteral(t,e.indexSignatures,e.annotations)}if(e._tag==="Union")return me.Union.make(yield*Y.forEach(e.types,ye),e.annotations);if(e._tag==="Refinement")return new me.Refinement(yield*ye(e.from),e.filter,e.annotations);if(e._tag==="Transformation"){let t=yield*ye(e.from),n=yield*ye(e.to),r=e.transformation._tag==="TypeLiteralTransformation"&&t._tag==="TypeLiteral"&&n._tag==="TypeLiteral"?new me.TypeLiteralTransformation(e.transformation.propertySignatureTransformations.filter((o)=>t.propertySignatures.some((i)=>i.name===o.from)&&n.propertySignatures.some((i)=>i.name===o.to))):e.transformation;return new me.Transformation(t,n,r,e.annotations)}if(e._tag==="TupleType"){let t=yield*Y.forEach(e.elements,(r)=>ye(r.type).pipe(Y.map((o)=>new me.OptionalType(o,r.isOptional,r.annotations)))),n=yield*Y.forEach(e.rest,(r)=>ye(r.type).pipe(Y.map((o)=>new me.Type(o,r.annotations))));return new me.TupleType(t,n,e.isReadonly,e.annotations)}return e});var $r=new WeakMap,xs=(e)=>Y.gen(function*(){let t=$r.get(e);if(t)return t;let n=e,r=new Map,o=(s)=>Y.gen(function*(){if(s._tag==="Union")r.set(s,yield*Y.forEach(s.types,(a)=>Y.gen(function*(){let d=yield*ye(a);return yield*o(a),{ast:a,matches:ke.is(ke.encodedSchema(ke.make(d)))}})));else if(s._tag==="TypeLiteral")yield*Y.forEach(s.propertySignatures,(a)=>{let d=ke.make(me.annotations(a.type,a.annotations));return Be(d)||Ce(d)?Y.void:o(a.type)});else if(s._tag==="TupleType")yield*Y.forEach([...s.elements,...s.rest],(a)=>o(a.type));else if(s._tag==="Refinement"||s._tag==="Transformation")yield*o(s.from)});yield*o(n);let i={ast:n,members:r};return $r.set(e,i),i});import{Match as Fl}from"effect";import{Data as We,Effect as Kl,Match as Vl,Option as zl}from"effect";import*as Es from"effect/SchemaAST";import{TitleAnnotationId as Al}from"effect/SchemaAST";import{cleanupAllPlugins as Il,getMatchingPlugin as ws,registerWalkerPlugin as vl,unregisterWalkerPlugin as Ml}from"@processfocus/runtime";class ks extends We.TaggedError("UnknownSchemaFieldTypeError"){get message(){return`Cannot create form field "${this.fieldName}": schema type "${this.schemaType}" is not supported`}}class Os extends We.TaggedError("IndexSignaturesNotSupportedError"){get message(){return"Index signatures are not supported in schemas"}}class Rs extends We.TaggedError("UnrecognizedASTNodeError"){get message(){return`AST node type "${this.nodeTag}" is not recognized`}}class As extends We.TaggedError("InvalidPropertyKeyError"){get message(){return`Property keys must be strings or numbers, got: ${String(this.propertyKey)}`}}class _s extends We.TaggedError("InvalidFieldPermissionError"){get message(){return`Cannot apply field permission to "${this.fieldName}": ${this.reason}`}}class Ds extends We.TaggedError("InvalidStaticLinkError"){get message(){return`Cannot create link field "${this.fieldName}": url must use http, https, or mailto and text must be a string`}}var Ys=Q(ne(),1);var qt=(e,t)=>typeof e==="object"&&e!==null&&(t in e)&&e[t]===!0;var it=(e)=>qt(e,"isForm");var Hn=(e)=>qt(e,"isList"),st=(e)=>qt(e,"isOrgUnit");var Ie=(e)=>qt(e,"isProcess");import{Context as Qs,Data as Kt,Effect as Op}from"effect";var de=(e)=>e.split("/").filter((r)=>r.length>0).map((r)=>r.replace(/-/g," ").split(/\s+/).filter((i)=>i.length>0).map((i)=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join("")).join("");class Js extends Kt.TaggedError("SourceStepNotFoundError"){}class Zs extends Kt.TaggedError("EdgeNotFoundError"){}class Xs extends Kt.TaggedError("ConditionFunctionMissingError"){}class ea extends Kt.TaggedError("ConditionEvaluationError"){}class ta extends Qs.Tag("processfocus:internal-tag/process/ConditionEvaluator")(){}var na=Q(ne(),1);var ra=Q(ne(),1);var oa=Q(ne(),1);import{DateTime as Ip}from"effect";import{Context as ua,Data as so,Effect as Zp}from"effect";import{Context as aa,Data as oo,Effect as zp}from"effect";var ia=Q(ne(),1);import{Schema as Up}from"effect";class da extends oo.TaggedError("ForEachStepRequiresItemsError"){}class qn extends oo.TaggedError("NotAForEachStepError"){}class io extends aa.Tag("processfocus:internal-tag/process/CurrentStepJobContext")(){}class ca extends so.TaggedError("ForEachStepNotFoundError"){}class la extends so.TaggedError("ForEachItemsError"){}class pa extends ua.Tag("processfocus:internal-tag/process/ForEachItemsResolver")(){}import{Data as Sa,Effect as Mf,JSONSchema as $f,Option as Nf,Schema as Lf,SchemaAST as Bf}from"effect";import{Schema as gf,SchemaAST as hf}from"effect";import{Data as ma,Effect as nf,Schema as ge,SchemaAST as rf}from"effect";class Kn extends ma.TaggedError("FormDecorationError"){}var sf=ge.Array(ge.Struct({value:ge.String,label:ge.String})),af=ge.Array(ge.Struct({value:ge.String,startsAt:ge.String,endsAt:ge.String,label:ge.optional(ge.String)}));import{Effect as bf,Option as wf,Schema as Ef,SchemaAST as kf}from"effect";class Ta extends Sa.TaggedError("LookupFieldNotFoundError"){}var xa=Q(ne(),1);var Fa=Q(ne(),1);import{Data as He,Effect as tm,String as nm,JSONSchema as rm,Option as om,SchemaAST as im,Schema as sm}from"effect";class ba extends He.TaggedError("ListItemQueryNotDefinedError"){get message(){return`List ${this.listPath} has no itemQuery defined`}}class wa extends He.TaggedError("ListItemUpdateNotDefinedError"){get message(){return`List ${this.listPath} has no update function defined`}}class Ea extends He.TaggedError("ListItemDeleteNotDefinedError"){get message(){return`List ${this.listPath} has no delete function defined`}}class ka extends He.TaggedError("ListCreateError"){}class Oa extends He.TaggedError("ListCreateNotDefinedError"){}class Ra extends He.TaggedError("ListUpdateValidationError"){}var Aa=Q(ne(),1);var Md=Q(ne(),1);import{EventEmitter as _a}from"events";function Da(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++){if(!arguments[t])continue;for(let r in arguments[t])e[r]=arguments[t][r]}return e}var W=Da;if(typeof Object.assign==="function")W=Object.assign;function ce(e,t,n,r){let o=e._nodes.get(t),i=null;if(!o)return i;if(r==="mixed")i=o.out&&o.out[n]||o.undirected&&o.undirected[n];else if(r==="directed")i=o.out&&o.out[n];else i=o.undirected&&o.undirected[n];return i}function V(e){return typeof e==="object"&&e!==null}function fo(e){let t;for(t in e)return!1;return!0}function ue(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function he(e,t,n){let r={enumerable:!0,configurable:!0};if(typeof n==="function")r.get=n;else r.value=n,r.writable=!1;Object.defineProperty(e,t,r)}function co(e){if(!V(e))return!1;if(e.attributes&&!Array.isArray(e.attributes))return!1;return!0}function Pa(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function xe(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function Ke(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Yt extends Error{constructor(e){super();this.name="GraphError",this.message=e}}class S extends Yt{constructor(e){super(e);if(this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,S.prototype.constructor)}}class h extends Yt{constructor(e){super(e);if(this.name="NotFoundGraphError",typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,h.prototype.constructor)}}class w extends Yt{constructor(e){super(e);if(this.name="UsageGraphError",typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,w.prototype.constructor)}}function mo(e,t){this.key=e,this.attributes=t,this.clear()}mo.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function yo(e,t){this.key=e,this.attributes=t,this.clear()}yo.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function go(e,t){this.key=e,this.attributes=t,this.clear()}go.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ve(e,t,n,r,o){this.key=t,this.attributes=o,this.undirected=e,this.source=n,this.target=r}Ve.prototype.attach=function(){let e="out",t="in";if(this.undirected)e=t="undirected";let n=this.source.key,r=this.target.key;if(this.source[e][r]=this,this.undirected&&n===r)return;this.target[t][n]=this};Ve.prototype.attachMulti=function(){let e="out",t="in",n=this.source.key,r=this.target.key;if(this.undirected)e=t="undirected";let o=this.source[e],i=o[r];if(typeof i>"u"){if(o[r]=this,!(this.undirected&&n===r))this.target[t][n]=this;return}i.previous=this,this.next=i,o[r]=this,this.target[t][n]=this};Ve.prototype.detach=function(){let e=this.source.key,t=this.target.key,n="out",r="in";if(this.undirected)n=r="undirected";delete this.source[n][t],delete this.target[r][e]};Ve.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n="out",r="in";if(this.undirected)n=r="undirected";if(this.previous===void 0)if(this.next===void 0)delete this.source[n][t],delete this.target[r][e];else this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next;else if(this.previous.next=this.next,this.next!==void 0)this.next.previous=this.previous};var ho=0,So=1,Ca=2,To=3;function Fe(e,t,n,r,o,i,s){let a,d,u,l;if(r=""+r,n===ho){if(a=e._nodes.get(r),!a)throw new h(`Graph.${t}: could not find the "${r}" node in the graph.`);u=o,l=i}else if(n===To){if(o=""+o,d=e._edges.get(o),!d)throw new h(`Graph.${t}: could not find the "${o}" edge in the graph.`);let c=d.source.key,g=d.target.key;if(r===c)a=d.target;else if(r===g)a=d.source;else throw new h(`Graph.${t}: the "${r}" node is not attached to the "${o}" edge (${c}, ${g}).`);u=i,l=s}else{if(d=e._edges.get(r),!d)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`);if(n===So)a=d.source;else a=d.target;u=o,l=i}return[a,u,l]}function Ia(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);return s.attributes[a]}}function va(e,t,n){e.prototype[t]=function(r,o){let[i]=Fe(this,t,n,r,o);return i.attributes}}function Ma(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);return s.attributes.hasOwnProperty(a)}}function $a(e,t,n){e.prototype[t]=function(r,o,i,s){let[a,d,u]=Fe(this,t,n,r,o,i,s);return a.attributes[d]=u,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:d}),this}}function Na(e,t,n){e.prototype[t]=function(r,o,i,s){let[a,d,u]=Fe(this,t,n,r,o,i,s);if(typeof u!=="function")throw new S(`Graph.${t}: updater should be a function.`);let l=a.attributes,c=u(l[d]);return l[d]=c,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:d}),this}}function La(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);return delete s.attributes[a],this.emit("nodeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:a}),this}}function Ba(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);if(!V(a))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return s.attributes=a,this.emit("nodeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function Ua(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);if(!V(a))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return W(s.attributes,a),this.emit("nodeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:a}),this}}function ja(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);if(typeof a!=="function")throw new S(`Graph.${t}: provided updater is not a function.`);return s.attributes=a(s.attributes),this.emit("nodeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}var Wa=[{name:(e)=>`get${e}Attribute`,attacher:Ia},{name:(e)=>`get${e}Attributes`,attacher:va},{name:(e)=>`has${e}Attribute`,attacher:Ma},{name:(e)=>`set${e}Attribute`,attacher:$a},{name:(e)=>`update${e}Attribute`,attacher:Na},{name:(e)=>`remove${e}Attribute`,attacher:La},{name:(e)=>`replace${e}Attributes`,attacher:Ba},{name:(e)=>`merge${e}Attributes`,attacher:Ua},{name:(e)=>`update${e}Attributes`,attacher:ja}];function Ha(e){Wa.forEach(function({name:t,attacher:n}){n(e,t("Node"),ho),n(e,t("Source"),So),n(e,t("Target"),Ca),n(e,t("Opposite"),To)})}function qa(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return i.attributes[o]}}function Ka(e,t,n){e.prototype[t]=function(r){let o;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let i=""+r,s=""+arguments[1];if(o=ce(this,i,s,n),!o)throw new h(`Graph.${t}: could not find an edge for the given path ("${i}" - "${s}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return o.attributes}}function Va(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return i.attributes.hasOwnProperty(o)}}function za(e,t,n){e.prototype[t]=function(r,o,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=""+r,d=""+o;if(o=arguments[2],i=arguments[3],s=ce(this,a,d,n),!s)throw new h(`Graph.${t}: could not find an edge for the given path ("${a}" - "${d}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return s.attributes[o]=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:o}),this}}function Ya(e,t,n){e.prototype[t]=function(r,o,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=""+r,d=""+o;if(o=arguments[2],i=arguments[3],s=ce(this,a,d,n),!s)throw new h(`Graph.${t}: could not find an edge for the given path ("${a}" - "${d}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(typeof i!=="function")throw new S(`Graph.${t}: updater should be a function.`);return s.attributes[o]=i(s.attributes[o]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:o}),this}}function Ga(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return delete i.attributes[o],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:o}),this}}function Qa(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(!V(o))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=o,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}function Ja(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(!V(o))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return W(i.attributes,o),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:o}),this}}function Za(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(typeof o!=="function")throw new S(`Graph.${t}: provided updater is not a function.`);return i.attributes=o(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}var Xa=[{name:(e)=>`get${e}Attribute`,attacher:qa},{name:(e)=>`get${e}Attributes`,attacher:Ka},{name:(e)=>`has${e}Attribute`,attacher:Va},{name:(e)=>`set${e}Attribute`,attacher:za},{name:(e)=>`update${e}Attribute`,attacher:Ya},{name:(e)=>`remove${e}Attribute`,attacher:Ga},{name:(e)=>`replace${e}Attributes`,attacher:Qa},{name:(e)=>`merge${e}Attributes`,attacher:Ja},{name:(e)=>`update${e}Attributes`,attacher:Za}];function ed(e){Xa.forEach(function({name:t,attacher:n}){n(e,t("Edge"),"mixed"),n(e,t("DirectedEdge"),"directed"),n(e,t("UndirectedEdge"),"undirected")})}var td=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function nd(e,t,n,r){let o=!1;for(let i in t){if(i===r)continue;let s=t[i];if(o=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),e&&o)return s.key}return}function rd(e,t,n,r){let o,i,s,a=!1;for(let d in t){if(d===r)continue;o=t[d];do{if(i=o.source,s=o.target,a=n(o.key,o.attributes,i.key,s.key,i.attributes,s.attributes,o.undirected),e&&a)return o.key;o=o.next}while(o!==void 0)}return}function Vn(e,t){let n=Object.keys(e),r=n.length,o,i=0;return{[Symbol.iterator](){return this},next(){do if(!o){if(i>=r)return{done:!0};let s=n[i++];if(s===t){o=void 0;continue}o=e[s]}else o=o.next;while(!o);return{done:!1,value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected}}}}}function od(e,t,n,r){let o=t[n];if(!o)return;let{source:i,target:s}=o;if(r(o.key,o.attributes,i.key,s.key,i.attributes,s.attributes,o.undirected)&&e)return o.key}function id(e,t,n,r){let o=t[n];if(!o)return;let i=!1;do{if(i=r(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key;o=o.next}while(o!==void 0);return}function zn(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let o={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:o}}};let r=!1;return{[Symbol.iterator](){return this},next(){if(r===!0)return{done:!0};return r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}}}function sd(e,t){if(e.size===0)return[];if(t==="mixed"||t===e.type)return Array.from(e._edges.keys());let n=t==="undirected"?e.undirectedSize:e.directedSize,r=Array(n),o=t==="undirected",i=e._edges.values(),s=0,a,d;while(a=i.next(),a.done!==!0)if(d=a.value,d.undirected===o)r[s++]=d.key;return r}function xo(e,t,n,r){if(t.size===0)return;let o=n!=="mixed"&&n!==t.type,i=n==="undirected",s,a,d=!1,u=t._edges.values();while(s=u.next(),s.done!==!0){if(a=s.value,o&&a.undirected!==i)continue;let{key:l,attributes:c,source:g,target:x}=a;if(d=r(l,c,g.key,x.key,g.attributes,x.attributes,a.undirected),e&&d)return l}return}function ad(e,t){if(e.size===0)return Ke();let n=t!=="mixed"&&t!==e.type,r=t==="undirected",o=e._edges.values();return{[Symbol.iterator](){return this},next(){let i,s;while(!0){if(i=o.next(),i.done)return i;if(s=i.value,n&&s.undirected!==r)continue;break}return{value:{edge:s.key,attributes:s.attributes,source:s.source.key,target:s.target.key,sourceAttributes:s.source.attributes,targetAttributes:s.target.attributes,undirected:s.undirected},done:!1}}}}function Yn(e,t,n,r,o,i){let s=t?rd:nd,a;if(n!=="undirected"){if(r!=="out"){if(a=s(e,o.in,i),e&&a)return a}if(r!=="in"){if(a=s(e,o.out,i,!r?o.key:void 0),e&&a)return a}}if(n!=="directed"){if(a=s(e,o.undirected,i),e&&a)return a}return}function dd(e,t,n,r){let o=[];return Yn(!1,e,t,n,r,function(i){o.push(i)}),o}function ud(e,t,n){let r=Ke();if(e!=="undirected"){if(t!=="out"&&typeof n.in<"u")r=xe(r,Vn(n.in));if(t!=="in"&&typeof n.out<"u")r=xe(r,Vn(n.out,!t?n.key:void 0))}if(e!=="directed"&&typeof n.undirected<"u")r=xe(r,Vn(n.undirected));return r}function Gn(e,t,n,r,o,i,s){let a=n?id:od,d;if(t!=="undirected"){if(typeof o.in<"u"&&r!=="out"){if(d=a(e,o.in,i,s),e&&d)return d}if(typeof o.out<"u"&&r!=="in"&&(r||o.key!==i)){if(d=a(e,o.out,i,s),e&&d)return d}}if(t!=="directed"){if(typeof o.undirected<"u"){if(d=a(e,o.undirected,i,s),e&&d)return d}}return}function cd(e,t,n,r,o){let i=[];return Gn(!1,e,t,n,r,o,function(s){i.push(s)}),i}function ld(e,t,n,r){let o=Ke();if(e!=="undirected"){if(typeof n.in<"u"&&t!=="out"&&r in n.in)o=xe(o,zn(n.in,r));if(typeof n.out<"u"&&t!=="in"&&r in n.out&&(t||n.key!==r))o=xe(o,zn(n.out,r))}if(e!=="directed"){if(typeof n.undirected<"u"&&r in n.undirected)o=xe(o,zn(n.undirected,r))}return o}function pd(e,t){let{name:n,type:r,direction:o}=t;e.prototype[n]=function(i,s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];if(!arguments.length)return sd(this,r);if(arguments.length===1){i=""+i;let a=this._nodes.get(i);if(typeof a>"u")throw new h(`Graph.${n}: could not find the "${i}" node in the graph.`);return dd(this.multi,r==="mixed"?this.type:r,o,a)}if(arguments.length===2){i=""+i,s=""+s;let a=this._nodes.get(i);if(!a)throw new h(`Graph.${n}: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(s))throw new h(`Graph.${n}: could not find the "${s}" target node in the graph.`);return cd(r,this.multi,o,a,s)}throw new S(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function fd(e,t){let{name:n,type:r,direction:o}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(u,l,c){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;if(arguments.length===1)return c=u,xo(!1,this,r,c);if(arguments.length===2){u=""+u,c=l;let g=this._nodes.get(u);if(typeof g>"u")throw new h(`Graph.${i}: could not find the "${u}" node in the graph.`);return Yn(!1,this.multi,r==="mixed"?this.type:r,o,g,c)}if(arguments.length===3){u=""+u,l=""+l;let g=this._nodes.get(u);if(!g)throw new h(`Graph.${i}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(l))throw new h(`Graph.${i}: could not find the "${l}" target node in the graph.`);return Gn(!1,r,this.multi,o,g,l,c)}throw new S(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let s="map"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let u=Array.prototype.slice.call(arguments),l=u.pop(),c;if(u.length===0){let g=0;if(r!=="directed")g+=this.undirectedSize;if(r!=="undirected")g+=this.directedSize;c=Array(g);let x=0;u.push((F,N,D,B,b,A,p)=>{c[x++]=l(F,N,D,B,b,A,p)})}else c=[],u.push((g,x,F,N,D,B,b)=>{c.push(l(g,x,F,N,D,B,b))});return this[i].apply(this,u),c};let a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(){let u=Array.prototype.slice.call(arguments),l=u.pop(),c=[];return u.push((g,x,F,N,D,B,b)=>{if(l(g,x,F,N,D,B,b))c.push(g)}),this[i].apply(this,u),c};let d="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[d]=function(){let u=Array.prototype.slice.call(arguments);if(u.length<2||u.length>4)throw new S(`Graph.${d}: invalid number of arguments (expecting 2, 3 or 4 and got ${u.length}).`);if(typeof u[u.length-1]==="function"&&typeof u[u.length-2]!=="function")throw new S(`Graph.${d}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let l,c;if(u.length===2)l=u[0],c=u[1],u=[];else if(u.length===3)l=u[1],c=u[2],u=[u[0]];else if(u.length===4)l=u[2],c=u[3],u=[u[0],u[1]];let g=c;return u.push((x,F,N,D,B,b,A)=>{g=l(g,x,F,N,D,B,b,A)}),this[i].apply(this,u),g}}function md(e,t){let{name:n,type:r,direction:o}=t,i="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(d,u,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return!1;if(arguments.length===1)return l=d,xo(!0,this,r,l);if(arguments.length===2){d=""+d,l=u;let c=this._nodes.get(d);if(typeof c>"u")throw new h(`Graph.${i}: could not find the "${d}" node in the graph.`);return Yn(!0,this.multi,r==="mixed"?this.type:r,o,c,l)}if(arguments.length===3){d=""+d,u=""+u;let c=this._nodes.get(d);if(!c)throw new h(`Graph.${i}: could not find the "${d}" source node in the graph.`);if(!this._nodes.has(u))throw new h(`Graph.${i}: could not find the "${u}" target node in the graph.`);return Gn(!0,r,this.multi,o,c,u,l)}throw new S(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let s="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let d=Array.prototype.slice.call(arguments),u=d.pop();if(d.push((c,g,x,F,N,D,B)=>u(c,g,x,F,N,D,B)),this[i].apply(this,d))return!0;return!1};let a="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(){let d=Array.prototype.slice.call(arguments),u=d.pop();if(d.push((c,g,x,F,N,D,B)=>!u(c,g,x,F,N,D,B)),this[i].apply(this,d))return!1;return!0}}function yd(e,t){let{name:n,type:r,direction:o}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(s,a){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Ke();if(!arguments.length)return ad(this,r);if(arguments.length===1){s=""+s;let d=this._nodes.get(s);if(!d)throw new h(`Graph.${i}: could not find the "${s}" node in the graph.`);return ud(r,o,d)}if(arguments.length===2){s=""+s,a=""+a;let d=this._nodes.get(s);if(!d)throw new h(`Graph.${i}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(a))throw new h(`Graph.${i}: could not find the "${a}" target node in the graph.`);return ld(r,o,d,a)}throw new S(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function gd(e){td.forEach((t)=>{pd(e,t),fd(e,t),md(e,t),yd(e,t)})}var hd=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function Gt(){this.A=null,this.B=null}Gt.prototype.wrap=function(e){if(this.A===null)this.A=e;else if(this.B===null)this.B=e};Gt.prototype.has=function(e){if(this.A!==null&&e in this.A)return!0;if(this.B!==null&&e in this.B)return!0;return!1};function at(e,t,n,r,o){for(let i in r){let s=r[i],{source:a,target:d}=s,u=a===n?d:a;if(t&&t.has(u.key))continue;let l=o(u.key,u.attributes);if(e&&l)return u.key}return}function Qn(e,t,n,r,o){if(t!=="mixed"){if(t==="undirected")return at(e,null,r,r.undirected,o);if(typeof n==="string")return at(e,null,r,r[n],o)}let i=new Gt,s;if(t!=="undirected"){if(n!=="out"){if(s=at(e,null,r,r.in,o),e&&s)return s;i.wrap(r.in)}if(n!=="in"){if(s=at(e,i,r,r.out,o),e&&s)return s;i.wrap(r.out)}}if(t!=="directed"){if(s=at(e,i,r,r.undirected,o),e&&s)return s}return}function Sd(e,t,n){if(e!=="mixed"){if(e==="undirected")return Object.keys(n.undirected);if(typeof t==="string")return Object.keys(n[t])}let r=[];return Qn(!1,e,t,n,function(o){r.push(o)}),r}function dt(e,t,n){let r=Object.keys(n),o=r.length,i=0;return{[Symbol.iterator](){return this},next(){let s=null;do{if(i>=o){if(e)e.wrap(n);return{done:!0}}let a=n[r[i++]],{source:d,target:u}=a;if(s=d===t?u:d,e&&e.has(s.key)){s=null;continue}}while(s===null);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}}}function Td(e,t,n){if(e!=="mixed"){if(e==="undirected")return dt(null,n,n.undirected);if(typeof t==="string")return dt(null,n,n[t])}let r=Ke(),o=new Gt;if(e!=="undirected"){if(t!=="out")r=xe(r,dt(o,n,n.in));if(t!=="in")r=xe(r,dt(o,n,n.out))}if(e!=="directed")r=xe(r,dt(o,n,n.undirected));return r}function xd(e,t){let{name:n,type:r,direction:o}=t;e.prototype[n]=function(i){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];i=""+i;let s=this._nodes.get(i);if(typeof s>"u")throw new h(`Graph.${n}: could not find the "${i}" node in the graph.`);return Sd(r==="mixed"?this.type:r,o,s)}}function Fd(e,t){let{name:n,type:r,direction:o}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(u,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;u=""+u;let c=this._nodes.get(u);if(typeof c>"u")throw new h(`Graph.${i}: could not find the "${u}" node in the graph.`);Qn(!1,r==="mixed"?this.type:r,o,c,l)};let s="map"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(u,l){let c=[];return this[i](u,(g,x)=>{c.push(l(g,x))}),c};let a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(u,l){let c=[];return this[i](u,(g,x)=>{if(l(g,x))c.push(g)}),c};let d="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[d]=function(u,l,c){if(arguments.length<3)throw new S(`Graph.${d}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let g=c;return this[i](u,(x,F)=>{g=l(g,x,F)}),g}}function bd(e,t){let{name:n,type:r,direction:o}=t,i=n[0].toUpperCase()+n.slice(1,-1),s="find"+i;e.prototype[s]=function(u,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;u=""+u;let c=this._nodes.get(u);if(typeof c>"u")throw new h(`Graph.${s}: could not find the "${u}" node in the graph.`);return Qn(!0,r==="mixed"?this.type:r,o,c,l)};let a="some"+i;e.prototype[a]=function(u,l){if(this[s](u,l))return!0;return!1};let d="every"+i;e.prototype[d]=function(u,l){if(this[s](u,(g,x)=>!l(g,x)))return!1;return!0}}function wd(e,t){let{name:n,type:r,direction:o}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Ke();s=""+s;let a=this._nodes.get(s);if(typeof a>"u")throw new h(`Graph.${i}: could not find the "${s}" node in the graph.`);return Td(r==="mixed"?this.type:r,o,a)}}function Ed(e){hd.forEach((t)=>{xd(e,t),Fd(e,t),bd(e,t),wd(e,t)})}function zt(e,t,n,r,o){let i=r._nodes.values(),s=r.type,a,d,u,l,c,g,x;while(a=i.next(),a.done!==!0){let F=!1;if(d=a.value,s!=="undirected"){l=d.out;for(u in l){c=l[u];do{if(g=c.target,F=!0,x=o(d.key,g.key,d.attributes,g.attributes,c.key,c.attributes,c.undirected),e&&x)return c;c=c.next}while(c)}}if(s!=="directed"){l=d.undirected;for(u in l){if(t&&d.key>u)continue;c=l[u];do{if(g=c.target,g.key!==u)g=c.source;if(F=!0,x=o(d.key,g.key,d.attributes,g.attributes,c.key,c.attributes,c.undirected),e&&x)return c;c=c.next}while(c)}}if(n&&!F){if(x=o(d.key,null,d.attributes,null,null,null,null),e&&x)return null}}return}function kd(e,t){let n={key:e};if(!fo(t.attributes))n.attributes=W({},t.attributes);return n}function Od(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};if(!fo(n.attributes))r.attributes=W({},n.attributes);if(e==="mixed"&&n.undirected)r.undirected=!0;return r}function Rd(e){if(!V(e))throw new S('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new S("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!V(e.attributes)||e.attributes===null))throw new S("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function Ad(e){if(!V(e))throw new S('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new S("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new S("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!V(e.attributes)||e.attributes===null))throw new S("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&typeof e.undirected!=="boolean")throw new S("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}var _d=Pa(),Dd=new Set(["directed","undirected","mixed"]),lo=new Set(["domain","_events","_eventsCount","_maxListeners"]),Pd=[{name:(e)=>`${e}Edge`,generateKey:!0},{name:(e)=>`${e}DirectedEdge`,generateKey:!0,type:"directed"},{name:(e)=>`${e}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:(e)=>`${e}EdgeWithKey`},{name:(e)=>`${e}DirectedEdgeWithKey`,type:"directed"},{name:(e)=>`${e}UndirectedEdgeWithKey`,type:"undirected"}],Cd={allowSelfLoops:!0,multi:!1,type:"mixed"};function Id(e,t,n){if(n&&!V(n))throw new S(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=""+t,n=n||{},e._nodes.has(t))throw new w(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function po(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function Fo(e,t,n,r,o,i,s,a){if(!r&&e.type==="undirected")throw new w(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type==="directed")throw new w(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!V(a))throw new S(`Graph.${t}: invalid attributes. Expecting an object but got "${a}"`);if(i=""+i,s=""+s,a=a||{},!e.allowSelfLoops&&i===s)throw new w(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=e._nodes.get(i),u=e._nodes.get(s);if(!d)throw new h(`Graph.${t}: source node "${i}" not found.`);if(!u)throw new h(`Graph.${t}: target node "${s}" not found.`);let l={key:null,undirected:r,source:i,target:s,attributes:a};if(n)o=e._edgeKeyGenerator();else if(o=""+o,e._edges.has(o))throw new w(`Graph.${t}: the "${o}" edge already exists in the graph.`);if(!e.multi&&(r?typeof d.undirected[s]<"u":typeof d.out[s]<"u"))throw new w(`Graph.${t}: an edge linking "${i}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let c=new Ve(r,o,d,u,a);e._edges.set(o,c);let g=i===s;if(r){if(d.undirectedDegree++,u.undirectedDegree++,g)d.undirectedLoops++,e._undirectedSelfLoopCount++}else if(d.outDegree++,u.inDegree++,g)d.directedLoops++,e._directedSelfLoopCount++;if(e.multi)c.attachMulti();else c.attach();if(r)e._undirectedSize++;else e._directedSize++;return l.key=o,e.emit("edgeAdded",l),o}function vd(e,t,n,r,o,i,s,a,d){if(!r&&e.type==="undirected")throw new w(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type==="directed")throw new w(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a){if(d){if(typeof a!=="function")throw new S(`Graph.${t}: invalid updater function. Expecting a function but got "${a}"`)}else if(!V(a))throw new S(`Graph.${t}: invalid attributes. Expecting an object but got "${a}"`)}i=""+i,s=""+s;let u;if(d)u=a,a=void 0;if(!e.allowSelfLoops&&i===s)throw new w(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let l=e._nodes.get(i),c=e._nodes.get(s),g,x;if(!n){if(g=e._edges.get(o),g){if(g.source.key!==i||g.target.key!==s){if(!r||g.source.key!==s||g.target.key!==i)throw new w(`Graph.${t}: inconsistency detected when attempting to merge the "${o}" edge with "${i}" source & "${s}" target vs. ("${g.source.key}", "${g.target.key}").`)}x=g}}if(!x&&!e.multi&&l)x=r?l.undirected[s]:l.out[s];if(x){let b=[x.key,!1,!1,!1];if(d?!u:!a)return b;if(d){let A=x.attributes;x.attributes=u(A),e.emit("edgeAttributesUpdated",{type:"replace",key:x.key,attributes:x.attributes})}else W(x.attributes,a),e.emit("edgeAttributesUpdated",{type:"merge",key:x.key,attributes:x.attributes,data:a});return b}if(a=a||{},d&&u)a=u(a);let F={key:null,undirected:r,source:i,target:s,attributes:a};if(n)o=e._edgeKeyGenerator();else if(o=""+o,e._edges.has(o))throw new w(`Graph.${t}: the "${o}" edge already exists in the graph.`);let N=!1,D=!1;if(!l){if(l=po(e,i,{}),N=!0,i===s)c=l,D=!0}if(!c)c=po(e,s,{}),D=!0;g=new Ve(r,o,l,c,a),e._edges.set(o,g);let B=i===s;if(r){if(l.undirectedDegree++,c.undirectedDegree++,B)l.undirectedLoops++,e._undirectedSelfLoopCount++}else if(l.outDegree++,c.inDegree++,B)l.directedLoops++,e._directedSelfLoopCount++;if(e.multi)g.attachMulti();else g.attach();if(r)e._undirectedSize++;else e._directedSize++;return F.key=o,e.emit("edgeAdded",F),[o,!0,N,D]}function qe(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:o}=t,i=t.undirected,s=n===r;if(i){if(n.undirectedDegree--,r.undirectedDegree--,s)n.undirectedLoops--,e._undirectedSelfLoopCount--}else if(n.outDegree--,r.inDegree--,s)n.directedLoops--,e._directedSelfLoopCount--;if(e.multi)t.detachMulti();else t.detach();if(i)e._undirectedSize--;else e._directedSize--;e.emit("edgeDropped",{key:t.key,attributes:o,source:n.key,target:r.key,undirected:i})}class P extends _a{constructor(e){super();if(e=W({},Cd,e),typeof e.multi!=="boolean")throw new S(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!Dd.has(e.type))throw new S(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=="boolean")throw new S(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type==="mixed"?mo:e.type==="directed"?yo:go;ue(this,"NodeDataClass",t);let n="geid_"+_d()+"_",r=0,o=()=>{let i;do i=n+r++;while(this._edges.has(i));return i};ue(this,"_attributes",{}),ue(this,"_nodes",new Map),ue(this,"_edges",new Map),ue(this,"_directedSize",0),ue(this,"_undirectedSize",0),ue(this,"_directedSelfLoopCount",0),ue(this,"_undirectedSelfLoopCount",0),ue(this,"_edgeKeyGenerator",o),ue(this,"_options",e),lo.forEach((i)=>ue(this,i,this[i])),he(this,"order",()=>this._nodes.size),he(this,"size",()=>this._edges.size),he(this,"directedSize",()=>this._directedSize),he(this,"undirectedSize",()=>this._undirectedSize),he(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),he(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),he(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),he(this,"multi",this._options.multi),he(this,"type",this._options.type),he(this,"allowSelfLoops",this._options.allowSelfLoops),he(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){let n=""+e,r=this._edges.get(n);return!!r&&!r.undirected}else if(arguments.length===2){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)return!1;return n.out.hasOwnProperty(t)}throw new S(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){let n=""+e,r=this._edges.get(n);return!!r&&r.undirected}else if(arguments.length===2){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)return!1;return n.undirected.hasOwnProperty(t)}throw new S(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let n=""+e;return this._edges.has(n)}else if(arguments.length===2){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)return!1;return typeof n.out<"u"&&n.out.hasOwnProperty(t)||typeof n.undirected<"u"&&n.undirected.hasOwnProperty(t)}throw new S(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new w("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");let n=this._nodes.get(e);if(!n)throw new h(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new w("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");let n=this._nodes.get(e);if(!n)throw new h(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new w("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return!1;return t in n.in||t in n.out}areOutNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return!1;return t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return!1;return t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);if(this.type==="directed")return!1;return t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);if(this.type!=="undirected"){if(t in n.in||t in n.out)return!0}if(this.type!=="directed"){if(t in n.undirected)return!0}return!1}areInboundNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);if(this.type!=="undirected"){if(t in n.in)return!0}if(this.type!=="directed"){if(t in n.undirected)return!0}return!1}areOutboundNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);if(this.type!=="undirected"){if(t in n.out)return!0}if(this.type!=="directed"){if(t in n.undirected)return!0}return!1}inDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inDegree: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.inDegree}outDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outDegree: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.outDegree}directedDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.directedDegree: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);if(this.type==="directed")return 0;return t.undirectedDegree}inboundDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;if(this.type!=="directed")n+=t.undirectedDegree;if(this.type!=="undirected")n+=t.inDegree;return n}outboundDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;if(this.type!=="directed")n+=t.undirectedDegree;if(this.type!=="undirected")n+=t.outDegree;return n}degree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;if(this.type!=="directed")n+=t.undirectedDegree;if(this.type!=="undirected")n+=t.inDegree+t.outDegree;return n}inDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);if(this.type==="directed")return 0;return t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;if(this.type!=="directed")n+=t.undirectedDegree,r+=t.undirectedLoops*2;if(this.type!=="undirected")n+=t.inDegree,r+=t.directedLoops;return n-r}outboundDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;if(this.type!=="directed")n+=t.undirectedDegree,r+=t.undirectedLoops*2;if(this.type!=="undirected")n+=t.outDegree,r+=t.directedLoops;return n-r}degreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;if(this.type!=="directed")n+=t.undirectedDegree,r+=t.undirectedLoops*2;if(this.type!=="undirected")n+=t.inDegree+t.outDegree,r+=t.directedLoops*2;return n-r}source(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;let n=this._edges.get(t);if(!n)throw new h(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,o=n.target.key;if(e===r)return o;if(e===o)return r;throw new h(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${o}).`)}hasExtremity(e,t){e=""+e,t=""+t;let n=this._edges.get(e);if(!n)throw new h(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Id(this,e,t).key}mergeNode(e,t){if(t&&!V(t))throw new S(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);if(n){if(t)W(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t});return[e,!1]}return n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0]}updateNode(e,t){if(t&&typeof t!=="function")throw new S(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){let o=n.attributes;n.attributes=t(o),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!=="undirected"){for(let r in t.out){n=t.out[r];do qe(this,n),n=n.next;while(n)}for(let r in t.in){n=t.in[r];do qe(this,n),n=n.next;while(n)}}if(this.type!=="directed")for(let r in t.undirected){n=t.undirected[r];do qe(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let n=""+arguments[0],r=""+arguments[1];if(t=ce(this,n,r,this.type),!t)throw new h(`Graph.dropEdge: could not find the "${n}" -> "${r}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new h(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return qe(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new w("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new w("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;let n=ce(this,e,t,"directed");if(!n)throw new h(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return qe(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new w("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new w("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");let n=ce(this,e,t,"undirected");if(!n)throw new h(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return qe(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){let e=this._nodes.values(),t;while(t=e.next(),t.done!==!0)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=="function")throw new S("Graph.updateAttribute: updater should be a function.");let n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!V(e))throw new S("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!V(e))throw new S("Graph.mergeAttributes: provided attributes are not a plain object.");return W(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=="function")throw new S("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=="function")throw new S("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!co(t))throw new S("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");let n=this._nodes.values(),r,o;while(r=n.next(),r.done!==!0)o=r.value,o.attributes=e(o.key,o.attributes);this.emit("eachNodeAttributesUpdated",{hints:t?t:null})}updateEachEdgeAttributes(e,t){if(typeof e!=="function")throw new S("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!co(t))throw new S("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");let n=this._edges.values(),r,o,i,s;while(r=n.next(),r.done!==!0)o=r.value,i=o.source,s=o.target,o.attributes=e(o.key,o.attributes,i.key,s.key,i.attributes,s.attributes,o.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t?t:null})}forEachAdjacencyEntry(e){if(typeof e!=="function")throw new S("Graph.forEachAdjacencyEntry: expecting a callback.");zt(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=="function")throw new S("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");zt(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=="function")throw new S("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");zt(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=="function")throw new S("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");zt(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=="function")throw new S("Graph.forEachNode: expecting a callback.");let t=this._nodes.values(),n,r;while(n=t.next(),n.done!==!0)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=="function")throw new S("Graph.findNode: expecting a callback.");let t=this._nodes.values(),n,r;while(n=t.next(),n.done!==!0)if(r=n.value,e(r.key,r.attributes))return r.key;return}mapNodes(e){if(typeof e!=="function")throw new S("Graph.mapNode: expecting a callback.");let t=this._nodes.values(),n,r,o=Array(this.order),i=0;while(n=t.next(),n.done!==!0)r=n.value,o[i++]=e(r.key,r.attributes);return o}someNode(e){if(typeof e!=="function")throw new S("Graph.someNode: expecting a callback.");let t=this._nodes.values(),n,r;while(n=t.next(),n.done!==!0)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=="function")throw new S("Graph.everyNode: expecting a callback.");let t=this._nodes.values(),n,r;while(n=t.next(),n.done!==!0)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=="function")throw new S("Graph.filterNodes: expecting a callback.");let t=this._nodes.values(),n,r,o=[];while(n=t.next(),n.done!==!0)if(r=n.value,e(r.key,r.attributes))o.push(r.key);return o}reduceNodes(e,t){if(typeof e!=="function")throw new S("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new S("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=t,r=this._nodes.values(),o,i;while(o=r.next(),o.done!==!0)i=o.value,n=e(n,i.key,i.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((r,o)=>{e[t++]=kd(o,r)});let n=Array(this._edges.size);return t=0,this._edges.forEach((r,o)=>{n[t++]=Od(this.type,o,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof P)return e.forEachNode((a,d)=>{if(t)this.mergeNode(a,d);else this.addNode(a,d)}),e.forEachEdge((a,d,u,l,c,g,x)=>{if(t)if(x)this.mergeUndirectedEdgeWithKey(a,u,l,d);else this.mergeDirectedEdgeWithKey(a,u,l,d);else if(x)this.addUndirectedEdgeWithKey(a,u,l,d);else this.addDirectedEdgeWithKey(a,u,l,d)}),this;if(!V(e))throw new S("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!V(e.attributes))throw new S("Graph.import: invalid attributes. Expecting a plain object.");if(t)this.mergeAttributes(e.attributes);else this.replaceAttributes(e.attributes)}let n,r,o,i,s;if(e.nodes){if(o=e.nodes,!Array.isArray(o))throw new S("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=o.length;n<r;n++){i=o[n],Rd(i);let{key:a,attributes:d}=i;if(t)this.mergeNode(a,d);else this.addNode(a,d)}}if(e.edges){let a=!1;if(this.type==="undirected")a=!0;if(o=e.edges,!Array.isArray(o))throw new S("Graph.import: invalid edges. Expecting an array.");for(n=0,r=o.length;n<r;n++){s=o[n],Ad(s);let{source:d,target:u,attributes:l,undirected:c=a}=s,g;if("key"in s)g=t?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,g.call(this,s.key,d,u,l);else g=t?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,g.call(this,d,u,l)}}return this}nullCopy(e){let t=new P(W({},this._options,e));return t.replaceAttributes(W({},this.getAttributes())),t}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((n,r)=>{let o=W({},n.attributes);n=new t.NodeDataClass(r,o),t._nodes.set(r,n)}),t}copy(e){if(e=e||{},typeof e.type==="string"&&e.type!==this.type&&e.type!=="mixed")throw new w(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new w("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops==="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new w("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");let t=this.emptyCopy(e),n=this._edges.values(),r,o;while(r=n.next(),r.done!==!0)o=r.value,Fo(t,"copy",!1,o.undirected,o.key,o.source.key,o.target.key,W({},o.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){let e={};this._nodes.forEach((o,i)=>{e[i]=o.attributes});let t={},n={};this._edges.forEach((o,i)=>{let s=o.undirected?"--":"->",a="",d=o.source.key,u=o.target.key,l;if(o.undirected&&d>u)l=d,d=u,u=l;let c=`(${d})${s}(${u})`;if(!i.startsWith("geid_"))a+=`[${i}]: `;else if(this.multi){if(typeof n[c]>"u")n[c]=0;else n[c]++;a+=`${n[c]}. `}a+=c,t[a]=o.attributes});let r={};for(let o in this)if(this.hasOwnProperty(o)&&!lo.has(o)&&typeof this[o]!=="function"&&typeof o!=="symbol")r[o]=this[o];return r.attributes=this._attributes,r.nodes=e,r.edges=t,ue(r,"constructor",this.constructor),r}}if(typeof Symbol<"u")P.prototype[Symbol.for("nodejs.util.inspect.custom")]=P.prototype.inspect;Pd.forEach((e)=>{["add","merge","update"].forEach((t)=>{let n=e.name(t),r=t==="add"?Fo:vd;if(e.generateKey)P.prototype[n]=function(o,i,s){return r(this,n,!0,(e.type||this.type)==="undirected",null,o,i,s,t==="update")};else P.prototype[n]=function(o,i,s,a){return r(this,n,!1,(e.type||this.type)==="undirected",o,i,s,a,t==="update")}})});Ha(P);ed(P);gd(P);Ed(P);class Jn extends P{constructor(e){let t=W({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new S("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new S('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Zn extends P{constructor(e){let t=W({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new S("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new S('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Xn extends P{constructor(e){let t=W({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new S("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class er extends P{constructor(e){let t=W({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new S("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new S('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class tr extends P{constructor(e){let t=W({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new S("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new S('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function ze(e){e.from=function(t,n){let r=W({},t.options,n),o=new e(r);return o.import(t),o}}ze(P);ze(Jn);ze(Zn);ze(Xn);ze(er);ze(tr);P.Graph=P;P.DirectedGraph=Jn;P.UndirectedGraph=Zn;P.MultiGraph=Xn;P.MultiDirectedGraph=er;P.MultiUndirectedGraph=tr;P.InvalidArgumentsGraphError=S;P.NotFoundGraphError=h;P.UsageGraphError=w;var Im=new Set([...Intl.supportedValuesOf("timeZone"),"UTC"]);import{Schema as uu}from"effect";import{Schema as M}from"effect";import{Schema as H}from"effect";import{Schema as U}from"effect";var Re=U.Int.pipe(U.between(0,6),U.brand("DayOfWeek"));var bo=U.Struct({hour:U.Int.pipe(U.between(0,23)),minute:U.Int.pipe(U.between(0,59))}),Qt=U.Struct({open:bo,close:bo}),Ye=U.Struct({day:Re,ranges:U.Array(Qt)}),$m=U.Array(Ye),ut=U.Int.pipe(U.between(1,12),U.brand("Month")),ct=U.Int.pipe(U.between(1,31),U.brand("DayOfMonth")),nr=U.Int.pipe(U.between(1,5),U.brand("NthOccurrence")),v=(e)=>e.hour*60+e.minute,be=(e)=>v(e.close)<v(e.open);var wo=H.Struct({id:H.String,type:H.String,name:H.String,startDate:H.DateTimeUtcFromSelf,endDate:H.DateTimeUtcFromSelf,isActive:H.Boolean,weeklySchedule:H.optional(H.Array(Ye))}),Um=H.Struct({id:H.String,type:H.String,name:H.String,startDate:H.DateTimeUtc,endDate:H.DateTimeUtc,isActive:H.Boolean,weeklySchedule:H.optional(H.Array(Ye))});import{Schema as q}from"effect";var $d=q.TaggedStruct("FixedHoliday",{name:q.String,month:ut,day:ct}),Nd=q.TaggedStruct("NthWeekdayHoliday",{name:q.String,month:ut,weekday:Re,nth:nr}),Ld=q.TaggedStruct("LastWeekdayHoliday",{name:q.String,month:ut,weekday:Re}),Bd=q.TaggedStruct("EasterRelativeHoliday",{name:q.String,daysOffset:q.Int}),rr=q.Union($d,Nd,Ld,Bd),qm=q.Struct({date:q.DateTimeUtcFromSelf,name:q.String,rule:q.optional(rr)}),or=q.decodeSync(ut),Ud=q.decodeSync(ct),Eo=q.decodeSync(Re),jd=q.decodeSync(nr),J=(e,t,n)=>({_tag:"FixedHoliday",name:e,month:or(t),day:Ud(n)}),ve=(e,t,n,r)=>({_tag:"NthWeekdayHoliday",name:e,month:or(t),weekday:Eo(n),nth:jd(r)}),Wd=(e,t,n)=>({_tag:"LastWeekdayHoliday",name:e,month:or(t),weekday:Eo(n)}),Ae=(e,t)=>({_tag:"EasterRelativeHoliday",name:e,daysOffset:t});var Km=[J("New Year's Day",1,1),ve("Martin Luther King Jr. Day",1,1,3),ve("Presidents' Day",2,1,3),Wd("Memorial Day",5,1),J("Independence Day",7,4),ve("Labor Day",9,1,1),ve("Columbus Day",10,1,2),J("Veterans Day",11,11),ve("Thanksgiving",11,4,4),J("Christmas Day",12,25)],Vm=[J("Nieuwjaarsdag",1,1),J("Koningsdag",4,27),J("Bevrijdingsdag",5,5),J("Eerste Kerstdag",12,25),J("Tweede Kerstdag",12,26),Ae("Goede Vrijdag",-2),Ae("Eerste Paasdag",0),Ae("Tweede Paasdag",1),Ae("Hemelvaartsdag",39),Ae("Eerste Pinksterdag",49),Ae("Tweede Pinksterdag",50)],zm=[J("New Year's Day",1,1),J("Day after New Year's Day",1,2),J("Waitangi Day",2,6),Ae("Good Friday",-2),Ae("Easter Monday",1),J("Anzac Day",4,25),ve("Queen's Birthday",6,1,1),ve("Labour Day",10,1,4),J("Christmas Day",12,25),J("Boxing Day",12,26)];var Hd=M.Struct({date:M.DateTimeUtcFromSelf,slots:M.Union(M.Array(Qt),M.Literal("closed")),note:M.optional(M.String)}),sy=M.Struct({date:M.DateTimeUtc,slots:M.Union(M.Array(Qt),M.Literal("closed")),note:M.optional(M.String)}),ay=M.Struct({weeklySchedule:M.Array(Ye),holidays:M.Array(rr),exceptions:M.Array(Hd),nonWorkingDays:M.Array(Re),periods:M.Array(wo),requireActivePeriod:M.optional(M.String),startDayOfWeek:M.optional(Re),timezone:M.optional(M.String)});import{Context as ko,Data as qd}from"effect";class Jt extends qd.TaggedError("BusinessCalendarError"){}class ir extends ko.Tag("processfocus:internal-tag/business-calendar/BusinessCalendarService")(){}class sr extends ko.Tag("processfocus:internal-tag/business-calendar/BusinessCalendarConfigService")(){}import{Cause as _o,DateTime as O,Deferred as tn,Duration as pt,Effect as R,Exit as iu,Layer as su,Option as le,SynchronizedRef as nn}from"effect";import{DateTime as ie,Effect as Z}from"effect";import{Data as Ge}from"effect";class Kd extends Ge.TaggedError("DateOutOfRangeError"){}class Vd extends Ge.TaggedError("NoBusinessHoursError"){}class zd extends Ge.TaggedError("InvalidCalendarConfigError"){}class Zt extends Ge.TaggedError("InvalidDateError"){}class lt extends Ge.TaggedError("InvalidYearError"){}class Yd extends Ge.TaggedError("ValidationError"){}var Oo=1583,Ro=9999,Xt=(e)=>{if(!Number.isInteger(e))return Z.fail(new lt({year:e,message:`Year must be an integer, got ${e}`}));if(e<Oo)return Z.fail(new lt({year:e,message:`Year must be >= ${Oo} for Gregorian calendar, got ${e}`}));if(e>Ro)return Z.fail(new lt({year:e,message:`Year must be <= ${Ro}, got ${e}`}));return Z.succeed(e)},Gd=(e,t)=>new Date(e,t,0).getDate(),Qd=(e,t,n)=>{let r=Gd(e,t);if(n>r)return Z.fail(new Zt({year:e,month:t,day:n,message:`Invalid date: ${e}-${t}-${n}. Month ${t} has only ${r} days in year ${e}`}));return Z.void},en=(e,t,n)=>Z.try({try:()=>ie.unsafeMake({year:e,month:t,day:n,hour:0,minute:0,second:0,millis:0}),catch:(r)=>new Zt({year:e,month:t,day:n,message:`Failed to create date: ${r}`})}),Jd=(e)=>Z.gen(function*(){yield*Xt(e);let t=e%19,n=Math.floor(e/100),r=e%100,o=Math.floor(n/4),i=n%4,s=Math.floor((n+8)/25),a=Math.floor((n-s+1)/3),d=(19*t+n-o-a+15)%30,u=Math.floor(r/4),l=r%4,c=(32+2*i+2*u-d-l)%7,g=Math.floor((t+11*d+22*c)/451),x=Math.floor((d+c-7*g+114)/31),F=(d+c-7*g+114)%31+1;return yield*en(e,x,F)}),Zd=(e,t,n,r)=>Z.gen(function*(){yield*Xt(e);let o=yield*en(e,t,1),s=ie.toParts(o).weekDay,a=n-s;if(a<0)a+=7;if(o=ie.add(o,{days:a}),o=ie.add(o,{days:(r-1)*7}),ie.toParts(o).month!==t)return;return o}),Xd=(e,t,n)=>Z.gen(function*(){yield*Xt(e);let r=t===12?1:t+1,o=t===12?e+1:e,i=yield*en(o,r,1);i=ie.add(i,{days:-1});let d=ie.toParts(i).weekDay-n;if(d<0)d+=7;return ie.add(i,{days:-d})}),eu=(e,t)=>Z.gen(function*(){return yield*Xt(t),yield*Qd(t,e.month,e.day),{date:yield*en(t,e.month,e.day),name:e.name,rule:e}}),tu=(e,t)=>Z.gen(function*(){let n=yield*Zd(t,e.month,e.weekday,e.nth);if(!n)return;return{date:n,name:e.name,rule:e}}),nu=(e,t)=>Z.gen(function*(){return{date:yield*Xd(t,e.month,e.weekday),name:e.name,rule:e}}),ru=(e,t)=>Z.gen(function*(){let n=yield*Jd(t);return{date:ie.add(n,{days:e.daysOffset}),name:e.name,rule:e}}),ou=(e,t)=>{switch(e._tag){case"FixedHoliday":return eu(e,t);case"NthWeekdayHoliday":return tu(e,t);case"LastWeekdayHoliday":return nu(e,t);case"EasterRelativeHoliday":return ru(e,t)}},Ao=(e,t)=>Z.gen(function*(){let n=[];for(let r of e){let o=yield*ou(r,t);if(o)n.push(o)}return n.sort((r,o)=>{let i=ie.toEpochMillis(r.date),s=ie.toEpochMillis(o.date);return i-s})}),ar=(e,t)=>{let n=ie.toParts(e);for(let r of t){let o=ie.toParts(r.date);if(n.year===o.year&&n.month===o.month&&n.day===o.day)return r}return};var dr=1e4,au=1e5,ft=365,du=(e)=>R.gen(function*(){let t=e.timezone?O.zoneUnsafeMakeNamed(e.timezone):O.zoneUnsafeMakeNamed("UTC"),n=(p)=>{let m=O.setZone(p,t);return O.toParts(m)},r=(p,m,f,y,T)=>{let E=O.unsafeMakeZoned({year:p,month:m,day:f,hours:y,minutes:T,seconds:0,millis:0},{timeZone:t,adjustForTimeZone:!0});return O.toUtc(E)},o=yield*nn.make(new Map),i=(p)=>Ao(e.holidays,p).pipe(R.catchAllCause((m)=>{if(_o.isInterrupted(m)||_o.isDie(m))return R.failCause(m);return R.logWarning("Failed to compute holidays for year",m).pipe(R.annotateLogs({year:p}),R.as([]))})),s=(p)=>R.uninterruptibleMask((m)=>R.gen(function*(){let f=yield*nn.modifyEffect(o,(y)=>{let T=y.get(p);if(T!==void 0){if(T._tag==="Done")return R.succeed([{_tag:"hit",holidays:T.holidays},y]);return R.succeed([{_tag:"join",deferred:T.deferred},y])}return tn.make().pipe(R.map((E)=>{let k=new Map(y);return k.set(p,{_tag:"InFlight",deferred:E}),[{_tag:"owner",deferred:E},k]}))});switch(f._tag){case"hit":return f.holidays;case"join":return yield*m(tn.await(f.deferred).pipe(R.catchAll(()=>s(p))));case"owner":{let y=yield*R.exit(m(R.gen(function*(){return yield*R.yieldNow(),yield*i(p)})));if(iu.isSuccess(y))return yield*tn.succeed(f.deferred,y.value),yield*nn.update(o,(T)=>{let E=T.get(p);if(E?._tag==="InFlight"&&E.deferred===f.deferred){let k=new Map(T);return k.set(p,{_tag:"Done",holidays:y.value}),k}return T}),y.value;return yield*nn.update(o,(T)=>{let E=T.get(p);if(E?._tag==="InFlight"&&E.deferred===f.deferred){let k=new Map(T);return k.delete(p),k}return T}),yield*tn.fail(f.deferred,"abandoned"),yield*R.failCause(y.cause)}}})),a=(p)=>{let m=n(p);for(let f of e.exceptions){let y=n(f.date);if(m.year===y.year&&m.month===y.month&&m.day===y.day)return f}return},d=(p)=>{let m=O.toEpochMillis(p);return[...e.periods].filter((f)=>{let y=O.toEpochMillis(f.startDate),T=O.toEpochMillis(f.endDate);return f.isActive&&m>=y&&m<=T})},u=(p)=>{if(!e.requireActivePeriod)return!0;let m=O.toEpochMillis(p);for(let f of e.periods){if(f.type!==e.requireActivePeriod||!f.isActive)continue;let y=O.toEpochMillis(f.startDate),T=O.toEpochMillis(f.endDate);if(m>=y&&m<=T)return!0}return!1},l=(p)=>{let m=d(p);for(let f of m)if(f.weeklySchedule)return f.weeklySchedule;return e.weeklySchedule},c=(p,m)=>p.find((f)=>f.day===m),g=(p,m)=>{let f=v(p),y=v(m.open),T=v(m.close);if(be(m))return f>=y||f<T;return f>=y&&f<T},x=(p,m)=>{let f=v(p),y=v(m.close);if(be(m)){if(f>=v(m.open))return 1440-f+y;return y-f}return y-f},F=1440,N=(p,m,f,y)=>Math.max(0,Math.min(m,y)-Math.max(p,f)),D=(p,m,f)=>{if(f<=m)return 0;let y=v(p.open),T=v(p.close);if(be(p))return N(y,1440,m,f)+N(0,T,m,f);return N(y,T,m,f)},B=(p)=>{let m=a(p);if(m){if(m.slots==="closed")return[];return m.slots}let f=n(p),y=l(p);return c(y,f.weekDay)?.ranges??[]},b=(p,m)=>{let f=n(p),y=n(m);return f.year===y.year&&f.month===y.month&&f.day===y.day},A={isBusinessDay:(p)=>R.gen(function*(){let m=n(p),f=a(p);if(f?.slots==="closed")return!1;if(e.nonWorkingDays.includes(m.weekDay))return!1;let y=yield*s(m.year),T=O.unsafeMake({year:m.year,month:m.month,day:m.day});if(ar(T,y))return!1;if(!u(p))return!1;let E=l(p),k=c(E,m.weekDay);if(f&&typeof f.slots!=="string")return!0;if(!k||k.ranges.length===0)return!1;return!0}),isBusinessHours:(p)=>R.gen(function*(){if(!(yield*A.isBusinessDay(p)))return!1;let f=n(p),y={hour:f.hours,minute:f.minutes},T=a(p);if(T&&typeof T.slots!=="string"){for(let I of T.slots)if(g(y,I))return!0;return!1}let E=l(p),k=c(E,f.weekDay);if(!k)return!1;for(let I of k.ranges)if(g(y,I))return!0;return!1}),addBusinessDays:(p,m)=>R.gen(function*(){if(m===0||!Number.isFinite(m))return p;let f=Math.max(-dr,Math.min(dr,Math.round(m))),y=p,T=Math.abs(f),E=f>0?1:-1,k=0;while(T>0&&k<dr*2)if(k++,y=O.add(y,{days:E}),yield*A.isBusinessDay(y))T--;return y}),addBusinessHours:(p,m)=>R.gen(function*(){if(m<=0||!Number.isFinite(m))return p;let f=Math.min(au,m),y=p,T=Math.round(f*60),E=0,k=T+ft*24*60;while(T>0&&E<k){if(E++,!(yield*A.isBusinessHours(y))){let G=yield*A.nextBusinessDay(y),se=yield*A.businessDayStart(G);if(le.isNone(se)){y=O.add(G,{days:1});continue}y=se.value;continue}let _=n(y),z={hour:_.hours,minute:_.minutes},L=a(y),ee;if(L&&typeof L.slots!=="string")ee=L.slots;else{let G=l(y);ee=c(G,_.weekDay)?.ranges??[]}let oe=0;for(let G of ee)if(g(z,G)){oe=x(z,G);break}if(oe>=T)return O.add(y,{minutes:T});T-=oe,y=O.add(y,{minutes:oe});let Ft=n(y),pn={hour:Ft.hours,minute:Ft.minutes},fn=!1;for(let G of ee){let se=v(G.open),bt=v(pn);if(se>bt&&!be(G)){let ei=se-bt;y=O.add(y,{minutes:ei}),fn=!0;break}}if(!fn){let G=yield*A.nextBusinessDay(y),se=yield*A.businessDayStart(G);if(le.isNone(se)){y=O.add(G,{days:1});continue}y=se.value}}return y}),nextBusinessDay:(p)=>R.gen(function*(){let m=O.add(p,{days:1}),f=n(m);m=r(f.year,f.month,f.day,0,0);let y=0;while(y<ft){if(y++,yield*A.isBusinessDay(m))return m;m=O.add(m,{days:1})}return yield*new Jt({message:`No business day found within ${ft} days of ${O.toUtc(p)}, possible misconfigured calendar`})}),previousBusinessDay:(p)=>R.gen(function*(){let m=n(p),f=r(m.year,m.month,m.day,0,0);f=O.add(f,{days:-1});let y=0;while(y<ft){if(y++,yield*A.isBusinessDay(f))return f;f=O.add(f,{days:-1})}return yield*new Jt({message:`No business day found within ${ft} days of ${O.toUtc(p)}, possible misconfigured calendar`})}),businessDayStart:(p)=>R.gen(function*(){if(!(yield*A.isBusinessDay(p)))return le.none();let f=n(p),y=a(p);if(y&&typeof y.slots!=="string"){let _=y.slots,z=_[0];if(!z)return le.none();let L=z.open;for(let ee of _)if(v(ee.open)<v(L))L=ee.open;return le.some(r(f.year,f.month,f.day,L.hour,L.minute))}let T=l(p),E=c(T,f.weekDay),k=E?.ranges[0];if(!E||!k)return le.none();let I=k.open;for(let _ of E.ranges)if(v(_.open)<v(I))I=_.open;return le.some(r(f.year,f.month,f.day,I.hour,I.minute))}),businessDayEnd:(p)=>R.gen(function*(){if(!(yield*A.isBusinessDay(p)))return le.none();let f=n(p),y=a(p);if(y&&typeof y.slots!=="string"){let _=y.slots,z=_[0];if(!z)return le.none();let L=z.close;for(let ee of _)if(be(ee))L=ee.close;else if(v(ee.close)>v(L)&&!be({open:z.open,close:L}))L=ee.close;return le.some(r(f.year,f.month,f.day,L.hour,L.minute))}let T=l(p),E=c(T,f.weekDay),k=E?.ranges[0];if(!E||!k)return le.none();let I=k.close;for(let _ of E.ranges)if(be(_))I=_.close;else if(v(_.close)>v(I)&&!be({open:k.open,close:I}))I=_.close;return le.some(r(f.year,f.month,f.day,I.hour,I.minute))}),businessHoursRemaining:(p)=>R.gen(function*(){if(!(yield*A.isBusinessHours(p)))return pt.zero;let f=n(p),y={hour:f.hours,minute:f.minutes},T=a(p),E;if(T&&typeof T.slots!=="string")E=T.slots;else{let _=l(p);E=c(_,f.weekDay)?.ranges??[]}let k=0,I=!1;for(let _ of E)if(g(y,_))k+=x(y,_),I=!0;else if(I&&v(_.open)>v(y))k+=v(_.close)-v(_.open);return pt.minutes(k)}),businessDaysBetween:(p,m)=>R.gen(function*(){let f=O.toEpochMillis(p),y=O.toEpochMillis(m);if(f>=y)return 0;let T=0,E=p;while(O.toEpochMillis(E)<y){if(yield*A.isBusinessDay(E))T++;E=O.add(E,{days:1})}return T}),businessHoursBetween:(p,m)=>R.gen(function*(){let f=O.toEpochMillis(p),y=O.toEpochMillis(m);if(f>=y)return pt.zero;let T=(oe,Ft,pn)=>R.gen(function*(){if(!(yield*A.isBusinessDay(oe)))return 0;let G=B(oe),se=0;for(let bt of G)se+=D(bt,Ft,pn);return se}),E=n(p),k=n(m),I=E.hours*60+E.minutes,_=k.hours*60+k.minutes;if(b(p,m)){let oe=yield*T(p,I,_);return pt.minutes(oe)}let z=0;z+=yield*T(p,I,1440);let L=r(E.year,E.month,E.day,12,0);L=O.add(L,{days:1});let ee=r(k.year,k.month,k.day,12,0);while(O.toEpochMillis(L)<O.toEpochMillis(ee)){z+=yield*T(L,0,1440);let oe=n(L);L=O.add(r(oe.year,oe.month,oe.day,12,0),{days:1})}return z+=yield*T(m,0,_),pt.minutes(z)}),isHoliday:(p)=>R.gen(function*(){let m=n(p),f=yield*s(m.year),y=O.unsafeMake({year:m.year,month:m.month,day:m.day});return ar(y,f)!==void 0}),getHolidaysForYear:(p)=>s(p),getActivePeriods:(p)=>R.succeed(d(p)),getActivePeriodsByType:(p,m)=>R.succeed(d(p).filter((f)=>f.type===m)),isWithinPeriodType:(p,m)=>R.succeed(d(p).some((f)=>f.type===m)),getPeriodsForDateRange:(p,m,f)=>R.succeed([...e.periods].filter((y)=>{if(f&&y.type!==f)return!1;let T=O.toEpochMillis(y.startDate),E=O.toEpochMillis(y.endDate),k=O.toEpochMillis(p),I=O.toEpochMillis(m);return T<=I&&E>=k})),getEffectiveSchedule:(p)=>R.sync(()=>{let m=a(p);if(m){if(m.slots==="closed")return[];return[{day:n(p).weekDay,ranges:[...m.slots]}]}return[...l(p)]})};return A}),xy=su.effect(ir,R.flatMap(sr,du));import{DateTime as wy}from"effect";import{DateTime as Oy,Duration as Ry,Effect as Ay}from"effect";var Vy=uu.decodeSync(ct);import{Data as rn,Effect as Qy}from"effect";class cu extends rn.TaggedError("EmbeddedFormNotStartStepError"){}class lu extends rn.TaggedError("UnsupportedEmbeddedFormFieldError"){}class pu extends rn.TaggedError("EmbeddedFormMetadataBuildError"){}class fu extends rn.TaggedError("EmbeddedProcessHasMultipleStartStepsError"){}import{Data as Su,Effect as Og}from"effect";var gu=Q(ne(),1);class Tu extends Su.TaggedError("OrganisationFrontendManifestBuildError"){}import*as _e from"path";import*as ku from"effect/Brand";import*as Ou from"effect/Context";import*as Ru from"effect/Data";import*as ur from"effect/Channel";import*as xu from"effect/Chunk";import{GenericTag as Fu}from"effect/Context";import*as Se from"effect/Effect";import{identity as Bg,pipe as Ug}from"effect/Function";import*as bu from"effect/Layer";import*as wu from"effect/Option";import*as cr from"effect/Sink";import*as on from"effect/Stream";var Do=Fu("@effect/platform/FileSystem");var mt=BigInt(1024),jg=mt*mt*mt*mt*mt;var Po=Do;import{RUNTIME_ARTIFACT_FORMAT as Au,RUNTIME_ARTIFACT_VERSION as _u,Runtime as Io,parseServerPluginRegistrations as Du}from"@processfocus/runtime";import{Config as Pu,Context as Cu,Data as Iu,Effect as re,Either as aS,Layer as vo}from"effect";class Qe extends Iu.TaggedError("processfocus:internal-tag/OrganisationLoadError"){}class yt extends Cu.Tag("processfocus:internal-tag/process/OrganisationProvider")(){}var vu=(e)=>re.gen(function*(){let t=yield*Po,n=_e.resolve(process.cwd(),e),r=_e.join(n,"org.js"),o=_e.join(n,"src/index.ts"),s=(yield*t.exists(r))?r:o;if(!(yield*t.exists(s)))return yield*new Qe({message:`Failed to load organisation from ${e}: Organisation file not found: ${s}`,orgPath:e});let d=yield*re.tryPromise({try:async()=>await import(s),catch:(F)=>new Qe({message:`Failed to load organisation from ${e}: ${F instanceof Error?F.message:String(F)}`,orgPath:e,cause:F})}),u=yield*Io.loadArtifact(re.succeed({format:Au,version:_u,organisation:d.org})).pipe(re.mapError((F)=>new Qe({message:`Failed to load organisation from ${e}: ${F.message}`,orgPath:e}))),{CustomDbLayer:l,CustomGraphqlSchema:c,CustomJobLayer:g}=d,x=yield*Du(d.ServerPlugins).pipe(re.mapError((F)=>new Qe({message:`Failed to load organisation from ${e}: ${F.message}`,orgPath:e,cause:F})));return{org:u.organisation,resolvedPath:n,...l?{customDbLayer:l}:{},...c?{customGraphqlSchema:c}:{},...g?{customJobLayer:g}:{},serverPlugins:x}}),Mu=(e)=>Io.loadOrganisation({load:vu},e),$u=({org:e,orgPath:t,customDbLayer:n,customGraphqlSchema:r,customJobLayer:o,serverPlugins:i=[]})=>re.gen(function*(){let s=yield*Po,a=_e.join(t,"dist/graphql/org.graphql"),d=_e.join(t,"graphql/org.graphql"),l=(yield*s.exists(a))?a:d;return{organisation:e,orgPath:t,schemaPath:l,...n?{customDbLayer:n}:{},...r?{customGraphqlSchema:r}:{},...o?{customJobLayer:o}:{},serverPlugins:i}}),Nu=({org:e,orgPath:t,schemaPath:n,customGraphqlSchema:r,customJobLayer:o,serverPlugins:i=[]})=>{let s=n??_e.join(t,"dist/graphql/org.graphql");return{organisation:e,orgPath:t,schemaPath:s,...r?{customGraphqlSchema:r}:{},...o?{customJobLayer:o}:{},serverPlugins:i}},Lu=({name:e,customDbLayer:t,customJobLayer:n,serverPlugins:r=[]})=>re.gen(function*(){if(yield*re.log(`Loaded organisation: ${e}`),t)yield*re.log("Loaded custom database layer from organisation");if(n)yield*re.log("Loaded custom job layer from organisation");if(r.length>0)yield*re.log(`Loaded ${r.length} server plugin registration(s) from organisation`)}),uS=vo.effect(yt,re.gen(function*(){let e=yield*Pu.string("PF_ORG").pipe(re.mapError(()=>new Qe({message:"PF_ORG environment variable is not set",orgPath:"<env>"})));yield*re.log(`Loading organisation from: ${e}`);let{org:t,resolvedPath:n,customDbLayer:r,customGraphqlSchema:o,customJobLayer:i,serverPlugins:s}=yield*Mu(e);return yield*Lu({name:t.name,customDbLayer:r,customJobLayer:i,serverPlugins:s}),yield*$u({org:t,orgPath:n,customDbLayer:r,customGraphqlSchema:o,customJobLayer:i,serverPlugins:s})}));var Mo=(e,t,n,r,o,i=[])=>vo.succeed(yt,Nu({org:e,orgPath:t??process.cwd(),schemaPath:n,customGraphqlSchema:r,customJobLayer:o,serverPlugins:i}));var Bu=Q(ne(),1);var Uu=Q(ne(),1);import{Duration as mS}from"effect";import{Context as ju,Data as sn,DateTime as SS,Effect as TS,Option as xS,Schema as FS,SchemaAST as bS}from"effect";class Wu extends sn.TaggedError("SourceStepNotFoundForScheduleError"){}class Hu extends sn.TaggedError("EdgeNotFoundForScheduleError"){}class qu extends sn.TaggedError("ScheduleFunctionMissingError"){}class Ku extends sn.TaggedError("ScheduleEvaluationError"){}class Vu extends ju.Tag("processfocus:internal-tag/process/ScheduleEvaluator")(){}var zu=Q(ne(),1);import{Context as lr,Data as gt,Effect as DS,Option as PS,Schema as CS}from"effect";class Yu extends gt.TaggedError("StepNotFoundError"){}class Gu extends gt.TaggedError("NotASystemStepError"){}class Qu extends gt.TaggedError("SystemStepExecutionError"){}class Ju extends gt.TaggedError("OutputValidationError"){}class Zu extends gt.TaggedError("LongDurationDispatchError"){}class Xu extends lr.Tag("processfocus:internal-tag/process/LongDurationDispatcher")(){}class ec extends lr.Tag("processfocus:internal-tag/process/StepProcessStateReader")(){}class tc extends lr.Tag("processfocus:internal-tag/process/SystemStepExecutor")(){}import{Context as nc,Data as rc}from"effect";class oc extends rc.TaggedError("UsageCostError"){}class ic extends nc.Tag("processfocus:internal-tag/process/UsageCostService")(){}import{Data as an,Effect as X,Match as pe,Option as No}from"effect";import*as pr from"effect/SchemaAST";var ht=(e)=>!(e._tag==="Literal"&&e.literal===null),Je=(e)=>{switch(typeof e){case"string":return"String";case"number":return"Float";case"boolean":return"Boolean";default:return}},St=(e)=>{let t=e.map((r)=>r._tag==="Literal"?Je(r.literal):void 0),n=t[0];return n!==void 0&&t.every((r)=>r===n)?n:void 0};class we extends an.TaggedError("UnsupportedOutputSchemaTypeError"){get message(){return`Cannot generate GraphQL output type for field "${this.fieldName}": schema type "${this.schemaType}" is not supported`}}class Lo extends an.TaggedError("OutputIndexSignaturesNotSupportedError"){get message(){return"Index signatures are not supported in GraphQL output types"}}class Bo extends an.TaggedError("UnrecognizedOutputASTNodeError"){get message(){return`AST node type "${this.nodeTag}" is not recognized`}}class Uo extends an.TaggedError("OutputInvalidPropertyKeyError"){get message(){return`Property keys must be strings, got: ${String(this.propertyKey)}`}}var jo=(e)=>{if(typeof e==="symbol"||typeof e==="number")return X.fail(new Uo({propertyKey:e}));return X.succeed(e)},Wo=(e,t)=>{let n=t.charAt(0).toUpperCase()+t.slice(1);return`${e}${n}`},sc=(e)=>{let t=pr.getAnnotation(e,Mt),n=No.getOrUndefined(t);return $t(n)?n:void 0},ac=(e,t,n)=>{let r=Wo(t,e),o=`${r}Field`,i=`${r}Bucket`;return{fieldDefinition:`${e}: ${r}${n?"":"!"}`,auxiliary:[`type ${o} {
2
+ var ni=Object.create;var{getPrototypeOf:ri,defineProperty:yr,getOwnPropertyNames:oi}=Object;var gr=Object.prototype.hasOwnProperty;function ii(e){return this[e]}var si,ai,Q=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var o=t?si??=new WeakMap:ai??=new WeakMap,i=o.get(e);if(i)return i}n=e!=null?ni(ri(e)):{};let s=t||!e||!e.__esModule||!gr.call(e,"default")?yr(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of oi(e))if(!gr.call(s,a))yr(s,a,{get:ii.bind(e,a),enumerable:!0})}if(r)o.set(e,s);return s};var te=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var di=import.meta.require;var $e=te(function(wt,hn){Object.defineProperty(wt,"__esModule",{value:!0});wt.default=ui;function ui(e){if(e===void 0||e===null)throw TypeError("Expected a string but received a ".concat(e));if(e.constructor.name!=="String")throw TypeError("Expected a string but received a ".concat(e.constructor.name))}hn.exports=wt.default;hn.exports.default=wt.default});var Tn=te(function(Et,Sn){Object.defineProperty(Et,"__esModule",{value:!0});Et.default=pi;function li(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function pi(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(e===r||li(r)&&r.test(e))return!0}return!1}Sn.exports=Et.default;Sn.exports.default=Et.default});var Sr=te(function(kt,xn){Object.defineProperty(kt,"__esModule",{value:!0});kt.default=void 0;var mi=function(t,n){return t.indexOf(n)!==-1},Pc=kt.default=mi;xn.exports=kt.default;xn.exports.default=kt.default});var Rt=te(function(Ot,bn){Object.defineProperty(Ot,"__esModule",{value:!0});Ot.default=yi;function Fn(e){return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fn(e)}function yi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(Fn(e)!=="object"||e===null)e={};for(var n in t)if(typeof e[n]>"u")e[n]=t[n];return e}bn.exports=Ot.default;bn.exports.default=Ot.default});var En=te(function(At,wn){Object.defineProperty(At,"__esModule",{value:!0});At.default=xi;var hi=Tr($e()),Si=Tr(Rt());function Tr(e){return e&&e.__esModule?e:{default:e}}var Ti={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1,allow_wildcard:!1,ignore_max_length:!1};function xi(e,t){if((0,hi.default)(e),t=(0,Si.default)(t,Ti),t.allow_trailing_dot&&e[e.length-1]===".")e=e.substring(0,e.length-1);if(t.allow_wildcard===!0&&e.indexOf("*.")===0)e=e.substring(2);var n=e.split("."),r=n[n.length-1];if(t.require_tld){if(n.length<2)return!1;if(!t.allow_numeric_tld&&!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(r))return!1;if(/\s/.test(r))return!1}if(!t.allow_numeric_tld&&/^\d+$/.test(r))return!1;return n.every(function(o){if(o.length>63&&!t.ignore_max_length)return!1;if(!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(o))return!1;if(/[\uff01-\uff5e]/.test(o))return!1;if(/^-|-$/.test(o))return!1;if(!t.allow_underscores&&/_/.test(o))return!1;return!0})}wn.exports=At.default;wn.exports.default=At.default});var An=te(function(_t,Rn){Object.defineProperty(_t,"__esModule",{value:!0});_t.default=On;var bi=wi($e());function wi(e){return e&&e.__esModule?e:{default:e}}function kn(e){return kn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kn(e)}var xr="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",Ee="(".concat(xr,"[.]){3}").concat(xr),Ei=new RegExp("^".concat(Ee,"$")),j="(?:[0-9a-fA-F]{1,4})",ki=new RegExp("^("+"(?:".concat(j,":){7}(?:").concat(j,"|:)|")+"(?:".concat(j,":){6}(?:").concat(Ee,"|:").concat(j,"|:)|")+"(?:".concat(j,":){5}(?::").concat(Ee,"|(:").concat(j,"){1,2}|:)|")+"(?:".concat(j,":){4}(?:(:").concat(j,"){0,1}:").concat(Ee,"|(:").concat(j,"){1,3}|:)|")+"(?:".concat(j,":){3}(?:(:").concat(j,"){0,2}:").concat(Ee,"|(:").concat(j,"){1,4}|:)|")+"(?:".concat(j,":){2}(?:(:").concat(j,"){0,3}:").concat(Ee,"|(:").concat(j,"){1,5}|:)|")+"(?:".concat(j,":){1}(?:(:").concat(j,"){0,4}:").concat(Ee,"|(:").concat(j,"){1,6}|:)|")+"(?::((?::".concat(j,"){0,5}:").concat(Ee,"|(?::").concat(j,"){1,7}|:))")+")(%[0-9a-zA-Z.]{1,})?$");function On(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(0,bi.default)(e);var n=(kn(t)==="object"?t.version:arguments[1])||"";if(!n)return On(e,{version:4})||On(e,{version:6});if(n.toString()==="4")return Ei.test(e);if(n.toString()==="6")return ki.test(e);return!1}Rn.exports=_t.default;Rn.exports.default=_t.default});var Er=te(function(Dt,Dn){Object.defineProperty(Dt,"__esModule",{value:!0});Dt.default=Ni;var Ri=Ne($e()),Fr=Ne(Tn()),_n=Ne(Sr()),Ai=Ne(En()),br=Ne(An()),_i=Ne(Rt());function Ne(e){return e&&e.__esModule?e:{default:e}}function Di(e,t){return vi(e)||Ii(e,t)||Ci(e,t)||Pi()}function Pi(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ci(e,t){if(e){if(typeof e=="string")return wr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wr(e,t):void 0}}function wr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ii(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],d=!0,u=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;d=!1}else for(;!(d=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);d=!0);}catch(l){u=!0,o=l}finally{try{if(!d&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}function vi(e){if(Array.isArray(e))return e}var Mi={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,validate_length:!0,max_allowed_length:2084},$i=/^\[([^\]]+)\](?::([0-9]+))?$/;function Ni(e,t){if((0,Ri.default)(e),!e||/[\s<>]/.test(e))return!1;if(e.indexOf("mailto:")===0)return!1;if(t=(0,_i.default)(t,Mi),t.validate_length&&e.length>t.max_allowed_length)return!1;if(!t.allow_fragments&&(0,_n.default)(e,"#"))return!1;if(!t.allow_query_components&&((0,_n.default)(e,"?")||(0,_n.default)(e,"&")))return!1;var n,r,o,i,s,a,d,u;d=e.split("#"),e=d.shift(),d=e.split("?"),e=d.shift();var l=e.match(/^([a-z][a-z0-9+\-.]*):/i),c=!1,g=function(L){if(c=!0,n=L.toLowerCase(),t.require_valid_protocol&&t.protocols.indexOf(n)===-1)return!1;return e.substring(l[0].length)};if(l){var x=l[1],F=e.substring(l[0].length),N=F.slice(0,2)==="//";if(!N){var D=F.indexOf("/"),B=D===-1?F:F.substring(0,D),b=B.indexOf("@");if(b!==-1){var A=B.substring(0,b),p=/^[a-zA-Z0-9\-_.%:]*$/,m=p.test(A),f=/%[0-9a-fA-F]{2}/.test(A);if(m&&!f){if(t.require_protocol)return!1}else if(e=g(x),e===!1)return!1}else{var y=/^[0-9]/.test(F);if(y){if(t.require_protocol)return!1}else if(e=g(x),e===!1)return!1}}else if(e=g(x),e===!1)return!1}else if(t.require_protocol)return!1;if(e.slice(0,2)==="//"){if(!c&&!t.allow_protocol_relative_urls)return!1;e=e.slice(2)}if(e==="")return!1;if(d=e.split("/"),e=d.shift(),e===""&&!t.require_host)return!0;if(d=e.split("@"),d.length>1){if(t.disallow_auth)return!1;if(d[0]==="")return!1;if(r=d.shift(),r.indexOf(":")>=0&&r.split(":").length>2)return!1;var T=r.split(":"),E=Di(T,2),k=E[0],I=E[1];if(k===""&&I==="")return!1}i=d.join("@"),a=null,u=null;var _=i.match($i);if(_)o="",u=_[1],a=_[2]||null;else if(d=i.split(":"),o=d.shift(),d.length)a=d.join(":");if(a!==null&&a.length>0){if(s=parseInt(a,10),!/^[0-9]+$/.test(a)||s<=0||s>65535)return!1}else if(t.require_port)return!1;if(t.host_whitelist)return(0,Fr.default)(o,t.host_whitelist);if(o===""&&!t.require_host)return!0;if(!(0,br.default)(o)&&!(0,Ai.default)(o,t)&&(!u||!(0,br.default)(u,6)))return!1;if(o=o||u,t.host_blacklist&&(0,Fr.default)(o,t.host_blacklist))return!1;return!0}Dn.exports=Dt.default;Dn.exports.default=Dt.default});var Pr=te(function(Lt,Mn){Object.defineProperty(Lt,"__esModule",{value:!0});Lt.default=es;var Zi=Xi($e());function Xi(e){return e&&e.__esModule?e:{default:e}}function vn(e){return vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vn(e)}function es(e,t){(0,Zi.default)(e);var n,r;if(vn(t)==="object")n=t.min||0,r=t.max;else n=arguments[1],r=arguments[2];var o=encodeURI(e).split(/%..|./).length-1;return o>=n&&(typeof r>"u"||o<=r)}Mn.exports=Lt.default;Mn.exports.default=Lt.default});var vr=te(function(Bt,Nn){Object.defineProperty(Bt,"__esModule",{value:!0});Bt.default=ms;var ns=Ue($e()),Cr=Ue(Tn()),$n=Ue(Pr()),rs=Ue(En()),Ir=Ue(An()),os=Ue(Rt());function Ue(e){return e&&e.__esModule?e:{default:e}}var is={allow_display_name:!1,allow_underscores:!1,require_display_name:!1,allow_utf8_local_part:!0,require_tld:!0,blacklisted_chars:"",ignore_max_length:!1,host_blacklist:[],host_whitelist:[]},ss=/^([^\x00-\x1F\x7F-\x9F\cX]+)</i,as=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,ds=/^[a-z\d]+$/,us=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,cs=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,ls=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i,ps=254;function fs(e){var t=e.replace(/^"(.+)"$/,"$1");if(!t.trim())return!1;var n=/[\.";<>]/.test(t);if(n){if(t===e)return!1;var r=t.split('"').length===t.split("\\\"").length;if(!r)return!1}return!0}function ms(e,t){if((0,ns.default)(e),t=(0,os.default)(t,is),t.require_display_name||t.allow_display_name){var n=e.match(ss);if(n){var r=n[1];if(e=e.replace(r,"").replace(/(^<|>$)/g,""),r.endsWith(" "))r=r.slice(0,-1);if(!fs(r))return!1}else if(t.require_display_name)return!1}if(!t.ignore_max_length&&e.length>ps)return!1;var o=e.split("@"),i=o.pop(),s=i.toLowerCase();if(t.host_blacklist.length>0&&(0,Cr.default)(s,t.host_blacklist))return!1;if(t.host_whitelist.length>0&&!(0,Cr.default)(s,t.host_whitelist))return!1;var a=o.join("@");if(t.domain_specific_validation&&(s==="gmail.com"||s==="googlemail.com")){a=a.toLowerCase();var d=a.split("+")[0];if(!(0,$n.default)(d.replace(/\./g,""),{min:6,max:30}))return!1;var u=d.split(".");for(var l=0;l<u.length;l++)if(!ds.test(u[l]))return!1}if(t.ignore_max_length===!1&&(!(0,$n.default)(a,{max:64})||!(0,$n.default)(i,{max:254})))return!1;if(!(0,rs.default)(i,{require_tld:t.require_tld,ignore_max_length:t.ignore_max_length,allow_underscores:t.allow_underscores})){if(!t.allow_ip_domain)return!1;if(!(0,Ir.default)(i)){if(!i.startsWith("[")||!i.endsWith("]"))return!1;var c=i.slice(1,-1);if(c.length===0||!(0,Ir.default)(c))return!1}}if(t.blacklisted_chars){if(a.search(new RegExp("[".concat(t.blacklisted_chars,"]+"),"g"))!==-1)return!1}if(a[0]==='"'&&a[a.length-1]==='"')return a=a.slice(1,a.length-1),t.allow_utf8_local_part?ls.test(a):us.test(a);var g=t.allow_utf8_local_part?cs:as,x=a.split(".");for(var F=0;F<x.length;F++)if(!g.test(x[F]))return!1;return!0}Nn.exports=Bt.default;Nn.exports.default=Bt.default});var jn=te(function(Hr){Object.defineProperty(Hr,"__esModule",{value:!0});Hr.Dependable=Hr.DependencyGroup=void 0;var jr=Symbol.for("jsii.rtti");class Wr{static[jr]={fqn:"constructs.DependencyGroup",version:"10.8.1"};_deps=[];constructor(...e){let t=this;Wt.implement(this,{get dependencyRoots(){let n=[];for(let r of t._deps)n.push(...Wt.of(r).dependencyRoots);return n}}),this.add(...e)}add(...e){this._deps.push(...e)}}Hr.DependencyGroup=Wr;var Ur=Symbol.for("@aws-cdk/core.DependableTrait");class Wt{static[jr]={fqn:"constructs.Dependable",version:"10.8.1"};static implement(e,t){e[Ur]=t}static of(e){let t=e[Ur];if(!t)throw Error(`${e} does not implement IDependable. Use "Dependable.implement()" to implement`);return t}static get(e){return this.of(e)}}Hr.Dependable=Wt});var Kr=te(function(ae){var $s=ae&&ae.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;var o=Object.getOwnPropertyDescriptor(t,n);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable))o={enumerable:!0,get:function(){return t[n]}};Object.defineProperty(e,r,o)}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),Ns=ae&&ae.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ls=ae&&ae.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o))r[r.length]=o;return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null){for(var r=e(t),o=0;o<r.length;o++)if(r[o]!=="default")$s(n,t,r[o])}return Ns(n,t),n}}();Object.defineProperty(ae,"__esModule",{value:!0});ae.ADDR_SEP=void 0;ae.addressOf=js;var Bs=Ls(di("crypto")),Us="Default";ae.ADDR_SEP=`
4
+ `;function js(e){let t=Bs.createHash("sha1");for(let n of e){if(n===Us)continue;t.update(n),t.update(ae.ADDR_SEP)}return"c8"+t.digest("hex")}});var Yr=te(function(zr){Object.defineProperty(zr,"__esModule",{value:!0});zr.captureStackTrace=Vr;function Vr(e){e=e||Vr;let t={stack:""},n=Error.stackTraceLimit;try{Error.stackTraceLimit=Number.MAX_SAFE_INTEGER,Error.captureStackTrace(t,e)}finally{Error.stackTraceLimit=n}if(!t.stack)return[];return t.stack.split(`
5
+ `).slice(1).map((r)=>r.replace(/^\s*at\s+/,""))}});var no=te(function(eo){Object.defineProperty(eo,"__esModule",{value:!0});eo.RootConstruct=eo.ConstructOrder=eo.Construct=eo.Node=void 0;var Wn=Symbol.for("jsii.rtti"),Qr=jn(),Jr=Kr(),Hs=Yr(),Zr=Symbol.for("constructs.Construct");class it{host;static[Wn]={fqn:"constructs.Node",version:"10.8.1"};static PATH_SEP="/";static of(e){return e.node}scope;id;path;_locked=!1;_children;_context;_metadata;_dependencies;_defaultChild;_validations;_addr;_scopes;constructor(e,t,n){if(this.host=e,n=n??"",this.id=Gr(n),this.scope=t,t&&!this.id)throw Error("Only root constructs may have an empty ID");if(t)t.node.addChild(e,this.id),this.path=t.node.path?`${t.node.path}${it.PATH_SEP}${this.id}`:this.id,this._scopes=[...t.node._scopes,this.host];else this.path=this.id,this._scopes=[this.host]}get scopes(){return[...this._scopes]}get addr(){if(!this._addr)this._addr=Jr.addressOf(this._scopes.map((e)=>e.node.id));return this._addr}tryFindChild(e){return this._children?.[Gr(e)]}findChild(e){let t=this.tryFindChild(e);if(!t)throw Error(`No child with id: '${e}'`);return t}get defaultChild(){if(this._defaultChild!==void 0)return this._defaultChild;let e=this.tryFindChild("Resource"),t=this.tryFindChild("Default");if(e&&t)throw Error(`Cannot determine default child for ${this.path}. There is both a child with id "Resource" and id "Default"`);return t||e}set defaultChild(e){this._defaultChild=e}get children(){return Object.values(this._children??{})}findAll(e=ot.PREORDER){let t=[];return n(this.host),t;function n(r){if(e===ot.PREORDER)t.push(r);for(let o of r.node.children)n(o);if(e===ot.POSTORDER)t.push(r)}}setContext(e,t){if(this.children.length>0){let n=this.children.map((r)=>r.node.id);throw Error("Cannot set context after children have been added: "+n.join(","))}if(!this._context)this._context={};this._context[e]=t}getContext(e){let t=this._context?.[e];if(t!==void 0)return t;if(t===void 0&&!this.scope?.node)throw Error(`No context value present for ${e} key`);return this.scope&&this.scope.node.getContext(e)}getAllContext(e){let t={...e};for(let n of this._scopes)Object.assign(t,n.node._context);return t}tryGetContext(e){let t=this._context?.[e];if(t!==void 0)return t;return this.scope&&this.scope.node.tryGetContext(e)}get metadata(){return[...this._metadata??[]]}addMetadata(e,t,n={}){if(t==null)return;let r=this;function o(){if(n.stackTraceOverride&&n.stackTraceOverride.length>0)return n.stackTraceOverride;return n.stackTrace??!1?Hs.captureStackTrace(n.traceFromFunction??r.addMetadata):void 0}if(!this._metadata)this._metadata=[];this._metadata.push({type:e,data:t,trace:o()})}get root(){return this._scopes[0]}get locked(){if(this._locked)return!0;if(this.scope&&this.scope.node.locked)return!0;return!1}addDependency(...e){if(!this._dependencies)this._dependencies=new Set;for(let t of e)this._dependencies.add(t)}removeDependency(...e){if(!this._dependencies)this._dependencies=new Set;for(let t of e)this._dependencies.delete(t)}get dependencies(){let e=[];if(this._dependencies)for(let t of this._dependencies)for(let n of Qr.Dependable.of(t).dependencyRoots)e.push(n);return e}tryRemoveChild(e){if(!this._children||!(e in this._children))return!1;return delete this._children[e],!0}addValidation(e){if(!this._validations)this._validations=[];this._validations.push(e)}validate(){return(this._validations??[]).flatMap((e)=>e.validate())}lock(){this._locked=!0}with(...e){let t=this.findAll();for(let n of e)for(let r of t)if(n.supports(r))n.applyTo(r);return this.host}addChild(e,t){if(this.locked){if(!this.path)throw Error("Cannot add children during synthesis");throw Error(`Cannot add children to "${this.path}" during synthesis`)}if(!this._children)this._children={};if(this._children[t]){let n=this.id??"",r=this.host.constructor.name;throw Error(`There is already a Construct with name '${t}' in ${r}${n.length>0?" ["+n+"]":""}`)}this._children[t]=e}}eo.Node=it;class Ht{static[Wn]={fqn:"constructs.Construct",version:"10.8.1"};static isConstruct(e){return e&&typeof e==="object"&&e[Zr]}node;constructor(e,t){this.node=new it(this,e,t),Qr.Dependable.implement(this,{dependencyRoots:[this]})}with(...e){return this.node.with(...e)}toString(){return this.node.path||"<root>"}}eo.Construct=Ht;var ot;(function(e){e[e.PREORDER=0]="PREORDER",e[e.POSTORDER=1]="POSTORDER"})(ot||(eo.ConstructOrder=ot={}));var qs=new RegExp(`[${it.PATH_SEP}${Jr.ADDR_SEP}]`,"g");function Gr(e){return e.replace(qs,"--")}Object.defineProperty(Ht.prototype,Zr,{value:!0,enumerable:!1,writable:!1});class Xr extends Ht{static[Wn]={fqn:"constructs.RootConstruct",version:"10.8.1"};constructor(e){super(void 0,e??"")}}eo.RootConstruct=Xr});var ne=te(function(Oe){var Ys=Oe&&Oe.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;var o=Object.getOwnPropertyDescriptor(t,n);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable))o={enumerable:!0,get:function(){return t[n]}};Object.defineProperty(e,r,o)}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),ro=Oe&&Oe.__exportStar||function(e,t){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n))Ys(t,e,n)};Object.defineProperty(Oe,"__esModule",{value:!0});ro(no(),Oe);ro(jn(),Oe)});import{Effect as ei}from"effect";import{Data as mr,Effect as C,Schema as xt}from"effect";import{Data as Nr,Effect as Y,Either as Sl,Schema as ke,SchemaAST as me}from"effect";import{Schema as Ji,SchemaAST as Dr}from"effect";var tt=Symbol.for("pf/form/annotation/ReadOnly");var mn=Symbol.for("pf/form/annotation/Required");var yn=Symbol.for("pf/form/annotation/EmailInput"),gn=Symbol.for("pf/form/annotation/PhoneInput");var Rr=Q(Er(),1);import{Schema as Le}from"effect";var vt=Symbol.for("processfocus:internal-tag/form-schema/flatten"),Te=Symbol.for("processfocus:internal-tag/form-schema/structural-only"),Ar=Symbol.for("processfocus:internal-tag/form-schema/structural-type");var Mt=Symbol.for("processfocus:internal-tag/form-schema/metric-breakdown");var _r=(e,t)=>Le.Undefined.annotations({[Te]:!0,[Ar]:e,...t}),vc=_r("structural"),Mc=_r("divider");var zi=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e))return!1;return typeof e.label==="string"},Yi=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e))return!1;let t=e;return typeof t.label==="string"&&typeof t.value==="string"},Gi=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e))return!1;let t=e;return t.type==="selector"&&typeof t.name==="string"&&(t.urlParameter===void 0||typeof t.urlParameter==="string")&&typeof t.label==="string"&&(t.value===void 0||typeof t.value==="string")&&Array.isArray(t.options)&&t.options.length>0&&t.options.every(Yi)},$t=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e))return!1;let t=e,{dataSource:n,controls:r,rendererPluginType:o,rendererPluginData:i}=t;return typeof t.title==="string"&&Array.isArray(t.buckets)&&t.buckets.every(zi)&&(r===void 0||Array.isArray(r)&&r.every(Gi))&&(n===void 0||n==="item")&&(o===void 0||typeof o==="string")&&(i===void 0||typeof i==="object"&&i!==null&&!Array.isArray(i))};var Qi=(e)=>Rr.default(e,{protocols:["https"],require_protocol:!0,require_tld:!0}),$c=Le.String.pipe(Le.filter(Qi,{message:()=>"Must be a valid HTTPS URL (e.g. https://example.com/path)"}),Le.annotations({arbitrary:()=>(e)=>e.webUrl({validSchemes:["https"]})}));var Nc=Le.Boolean.pipe(Le.filter((e)=>e===!0,{message:()=>"This field is required",jsonSchema:{type:"boolean",enum:[!0]},[mn]:!0}));var Pe=(e,t)=>{let n=e.annotations[t];if(n!==void 0)return n;if(e._tag==="Transformation"||e._tag==="Refinement")return Pe(e.from,t);if(e._tag==="Union")for(let r of e.types){let o=Pe(r,t);if(o!==void 0)return o}return},nt=(e)=>Ji.isPropertySignature(e)?e.ast._tag==="PropertySignatureDeclaration"?Dr.annotations(e.ast.type,e.ast.annotations):Dr.annotations(e.ast.from.type,{...e.ast.from.annotations,...e.ast.to.annotations}):e.ast,Be=(e)=>Pe(nt(e),Te)!==void 0,Nt=(e)=>Pe(nt(e),vt)!==void 0,Ce=(e)=>Pe(nt(e),tt)===!0;var Mr=Q(vr(),1);import{Schema as Ln}from"effect";var zc=Ln.Trim.pipe(Ln.filter((e)=>Mr.default(e,{require_tld:!1,allow_utf8_local_part:!0,allow_ip_domain:!0}),{message:()=>"must be a valid email address"}),Ln.annotations({identifier:"Email",title:"Email address",description:"A valid email address",jsonSchema:{format:"email"},[yn]:!0}));import{Either as Qc,Schema as Jc}from"effect";import{ArrayFormatter as Xc}from"effect/ParseResult";import{Schema as Bn}from"effect";var hs=/^\+?[\d\s\-()]+$/,Ss=(e)=>(e.match(/\d/g)||[]).length,Ts=(e)=>{if(!hs.test(e))return!1;let t=Ss(e);return t>=7&&t<=15},ol=Bn.Trim.pipe(Bn.filter((e)=>Ts(e),{message:()=>"must be a valid phone number (7-15 digits)"}),Bn.annotations({identifier:"Phone",title:"Phone number",description:"A valid phone number",jsonSchema:{format:"phone"},[gn]:!0}));import{Schema as je}from"effect";var Un=(e,t,n=(r)=>r)=>{let r=e.ast;if(r._tag==="PropertySignatureDeclaration")return je.makePropertySignature(new je.PropertySignatureDeclaration(t(r.type,"input"),r.isOptional,r.isReadonly,n(r.annotations,r.type,"input"),r.defaultValue));let{from:o,to:i}=r;return je.makePropertySignature(new je.PropertySignatureTransformation(new je.FromPropertySignature(t(o.type,"input"),o.isOptional,o.isReadonly,n(o.annotations,o.type,"input"),o.fromKey),new je.ToPropertySignature(t(i.type,"output"),i.isOptional,i.isReadonly,n(i.annotations,o.type,"output"),i.defaultValue),r.decode,r.encode))};class Ut extends Nr.TaggedError("FieldNameCollisionError"){get message(){return`Field name collision: "${this.wrapperField}" is already present as "${this.fieldName}" in its parent struct`}}class Lr extends Nr.TaggedError("InvalidFlattenAnnotationError"){get message(){return`Invalid schema: field "${this.fieldName}" has flatten annotation but is not a struct (AST tag: ${this.astTag}). Only use Wrapper() with Schema.Struct().`}}var Br=(e,t)=>Y.gen(function*(){let n=Nt(e),r=e.ast._tag==="TypeLiteral";if(n&&!r)return yield*new Lr({fieldName:t,astTag:e.ast._tag});return n&&r}),rt=(e)=>Y.gen(function*(){let t={};for(let[n,r]of Object.entries(e.fields)){let o=r;if(Be(o))continue;if(Ce(o))continue;if(yield*Br(o,String(n))){let i=yield*rt(o);for(let[s,a]of Object.entries(i.fields)){if(s in t)return yield*new Ut({fieldName:s,wrapperField:`${n}...${s}`});t[s]=a}}else{if(n in t)return yield*new Ut({fieldName:n,wrapperField:n});t[n]=yield*xs(r)}}return yield*Fs(e.ast),ke.Struct(t)}),xs=(e)=>Y.gen(function*(){if(!ke.isPropertySignature(e))return ke.make(yield*ye(e.ast));let t=e.ast,n=yield*ye(t._tag==="PropertySignatureDeclaration"?t.type:t.from.type),r=t._tag==="PropertySignatureDeclaration"?n:yield*ye(t.to.type);return Un(e,(o,i)=>i==="input"?n:r)}),ye=(e)=>Y.gen(function*(){if(e._tag==="TypeLiteral"){let t=[],n=new Set;for(let r of e.propertySignatures){let o=ke.make(me.annotations(r.type,r.annotations));if(Be(o)||Ce(o))continue;let i=yield*Br(o,String(r.name)),s=yield*ye(r.type),a=i&&s._tag==="TypeLiteral"?s.propertySignatures:[new me.PropertySignature(r.name,s,r.isOptional,r.isReadonly,r.annotations)];for(let d of a){if(n.has(d.name))return yield*new Ut({fieldName:String(d.name),wrapperField:`${String(r.name)}...${String(d.name)}`});n.add(d.name),t.push(d)}}return new me.TypeLiteral(t,e.indexSignatures,e.annotations)}if(e._tag==="Union")return me.Union.make(yield*Y.forEach(e.types,ye),e.annotations);if(e._tag==="Refinement")return new me.Refinement(yield*ye(e.from),e.filter,e.annotations);if(e._tag==="Transformation"){let t=yield*ye(e.from),n=yield*ye(e.to),r=e.transformation._tag==="TypeLiteralTransformation"&&t._tag==="TypeLiteral"&&n._tag==="TypeLiteral"?new me.TypeLiteralTransformation(e.transformation.propertySignatureTransformations.filter((o)=>t.propertySignatures.some((i)=>i.name===o.from)&&n.propertySignatures.some((i)=>i.name===o.to))):e.transformation;return new me.Transformation(t,n,r,e.annotations)}if(e._tag==="TupleType"){let t=yield*Y.forEach(e.elements,(r)=>ye(r.type).pipe(Y.map((o)=>new me.OptionalType(o,r.isOptional,r.annotations)))),n=yield*Y.forEach(e.rest,(r)=>ye(r.type).pipe(Y.map((o)=>new me.Type(o,r.annotations))));return new me.TupleType(t,n,e.isReadonly,e.annotations)}return e});var $r=new WeakMap,Fs=(e)=>Y.gen(function*(){let t=$r.get(e);if(t)return t;let n=e,r=new Map,o=(s)=>Y.gen(function*(){if(s._tag==="Union")r.set(s,yield*Y.forEach(s.types,(a)=>Y.gen(function*(){let d=yield*ye(a);return yield*o(a),{ast:a,matches:ke.is(ke.encodedSchema(ke.make(d)))}})));else if(s._tag==="TypeLiteral")yield*Y.forEach(s.propertySignatures,(a)=>{let d=ke.make(me.annotations(a.type,a.annotations));return Be(d)||Ce(d)?Y.void:o(a.type)});else if(s._tag==="TupleType")yield*Y.forEach([...s.elements,...s.rest],(a)=>o(a.type));else if(s._tag==="Refinement"||s._tag==="Transformation")yield*o(s.from)});yield*o(n);let i={ast:n,members:r};return $r.set(e,i),i});import{Match as bl}from"effect";import{Data as We,Effect as Vl,Match as zl,Option as Yl}from"effect";import*as ks from"effect/SchemaAST";import{TitleAnnotationId as _l}from"effect/SchemaAST";import{cleanupAllPlugins as vl,getMatchingPlugin as Es,registerWalkerPlugin as Ml,unregisterWalkerPlugin as $l}from"@processfocus/runtime";class Os extends We.TaggedError("UnknownSchemaFieldTypeError"){get message(){return`Cannot create form field "${this.fieldName}": schema type "${this.schemaType}" is not supported`}}class Rs extends We.TaggedError("IndexSignaturesNotSupportedError"){get message(){return"Index signatures are not supported in schemas"}}class As extends We.TaggedError("UnrecognizedASTNodeError"){get message(){return`AST node type "${this.nodeTag}" is not recognized`}}class _s extends We.TaggedError("InvalidPropertyKeyError"){get message(){return`Property keys must be strings or numbers, got: ${String(this.propertyKey)}`}}class Ds extends We.TaggedError("InvalidFieldPermissionError"){get message(){return`Cannot apply field permission to "${this.fieldName}": ${this.reason}`}}class Ps extends We.TaggedError("InvalidStaticLinkError"){get message(){return`Cannot create link field "${this.fieldName}": url must use http, https, or mailto and text must be a string`}}var Gs=Q(ne(),1);var qt=(e,t)=>typeof e==="object"&&e!==null&&(t in e)&&e[t]===!0;var He=(e)=>qt(e,"isForm");var Hn=(e)=>qt(e,"isList"),st=(e)=>qt(e,"isOrgUnit");var Ie=(e)=>qt(e,"isProcess");import{Context as Js,Data as Kt,Effect as Rp}from"effect";var de=(e)=>e.split("/").filter((r)=>r.length>0).map((r)=>r.replace(/-/g," ").split(/\s+/).filter((i)=>i.length>0).map((i)=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join("")).join("");class Zs extends Kt.TaggedError("SourceStepNotFoundError"){}class Xs extends Kt.TaggedError("EdgeNotFoundError"){}class ea extends Kt.TaggedError("ConditionFunctionMissingError"){}class ta extends Kt.TaggedError("ConditionEvaluationError"){}class na extends Js.Tag("processfocus:internal-tag/process/ConditionEvaluator")(){}var ra=Q(ne(),1);var oa=Q(ne(),1);var ia=Q(ne(),1);import{DateTime as vp}from"effect";import{Context as ca,Data as so,Effect as Xp}from"effect";import{Context as da,Data as oo,Effect as Yp}from"effect";var sa=Q(ne(),1);import{Schema as jp}from"effect";class ua extends oo.TaggedError("ForEachStepRequiresItemsError"){}class qn extends oo.TaggedError("NotAForEachStepError"){}class io extends da.Tag("processfocus:internal-tag/process/CurrentStepJobContext")(){}class la extends so.TaggedError("ForEachStepNotFoundError"){}class pa extends so.TaggedError("ForEachItemsError"){}class fa extends ca.Tag("processfocus:internal-tag/process/ForEachItemsResolver")(){}import{Data as co,Effect as $f,JSONSchema as Nf,Option as Lf,Schema as Bf,SchemaAST as Uf}from"effect";import{Schema as hf,SchemaAST as Sf}from"effect";import{Data as ya,Effect as rf,Schema as ge,SchemaAST as of}from"effect";class Kn extends ya.TaggedError("FormDecorationError"){}var af=ge.Array(ge.Struct({value:ge.String,label:ge.String})),df=ge.Array(ge.Struct({value:ge.String,startsAt:ge.String,endsAt:ge.String,label:ge.optional(ge.String)}));import{Effect as wf,Option as Ef,Schema as kf,SchemaAST as Of}from"effect";class Ta extends co.TaggedError("FormSubmissionError"){}class xa extends co.TaggedError("LookupFieldNotFoundError"){}var Fa=Q(ne(),1);var ba=Q(ne(),1);import{Data as qe,Effect as nm,String as rm,JSONSchema as om,Option as im,SchemaAST as sm,Schema as am}from"effect";class wa extends qe.TaggedError("ListItemQueryNotDefinedError"){get message(){return`List ${this.listPath} has no itemQuery defined`}}class Ea extends qe.TaggedError("ListItemUpdateNotDefinedError"){get message(){return`List ${this.listPath} has no update function defined`}}class ka extends qe.TaggedError("ListItemDeleteNotDefinedError"){get message(){return`List ${this.listPath} has no delete function defined`}}class Oa extends qe.TaggedError("ListCreateError"){}class Ra extends qe.TaggedError("ListCreateNotDefinedError"){}class Aa extends qe.TaggedError("ListUpdateValidationError"){}var _a=Q(ne(),1);var $d=Q(ne(),1);import{EventEmitter as Da}from"events";function Pa(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++){if(!arguments[t])continue;for(let r in arguments[t])e[r]=arguments[t][r]}return e}var W=Pa;if(typeof Object.assign==="function")W=Object.assign;function ce(e,t,n,r){let o=e._nodes.get(t),i=null;if(!o)return i;if(r==="mixed")i=o.out&&o.out[n]||o.undirected&&o.undirected[n];else if(r==="directed")i=o.out&&o.out[n];else i=o.undirected&&o.undirected[n];return i}function V(e){return typeof e==="object"&&e!==null}function mo(e){let t;for(t in e)return!1;return!0}function ue(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function he(e,t,n){let r={enumerable:!0,configurable:!0};if(typeof n==="function")r.get=n;else r.value=n,r.writable=!1;Object.defineProperty(e,t,r)}function lo(e){if(!V(e))return!1;if(e.attributes&&!Array.isArray(e.attributes))return!1;return!0}function Ca(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function xe(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function Ve(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Yt extends Error{constructor(e){super();this.name="GraphError",this.message=e}}class S extends Yt{constructor(e){super(e);if(this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,S.prototype.constructor)}}class h extends Yt{constructor(e){super(e);if(this.name="NotFoundGraphError",typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,h.prototype.constructor)}}class w extends Yt{constructor(e){super(e);if(this.name="UsageGraphError",typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,w.prototype.constructor)}}function yo(e,t){this.key=e,this.attributes=t,this.clear()}yo.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function go(e,t){this.key=e,this.attributes=t,this.clear()}go.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function ho(e,t){this.key=e,this.attributes=t,this.clear()}ho.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function ze(e,t,n,r,o){this.key=t,this.attributes=o,this.undirected=e,this.source=n,this.target=r}ze.prototype.attach=function(){let e="out",t="in";if(this.undirected)e=t="undirected";let n=this.source.key,r=this.target.key;if(this.source[e][r]=this,this.undirected&&n===r)return;this.target[t][n]=this};ze.prototype.attachMulti=function(){let e="out",t="in",n=this.source.key,r=this.target.key;if(this.undirected)e=t="undirected";let o=this.source[e],i=o[r];if(typeof i>"u"){if(o[r]=this,!(this.undirected&&n===r))this.target[t][n]=this;return}i.previous=this,this.next=i,o[r]=this,this.target[t][n]=this};ze.prototype.detach=function(){let e=this.source.key,t=this.target.key,n="out",r="in";if(this.undirected)n=r="undirected";delete this.source[n][t],delete this.target[r][e]};ze.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n="out",r="in";if(this.undirected)n=r="undirected";if(this.previous===void 0)if(this.next===void 0)delete this.source[n][t],delete this.target[r][e];else this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next;else if(this.previous.next=this.next,this.next!==void 0)this.next.previous=this.previous};var So=0,To=1,Ia=2,xo=3;function Fe(e,t,n,r,o,i,s){let a,d,u,l;if(r=""+r,n===So){if(a=e._nodes.get(r),!a)throw new h(`Graph.${t}: could not find the "${r}" node in the graph.`);u=o,l=i}else if(n===xo){if(o=""+o,d=e._edges.get(o),!d)throw new h(`Graph.${t}: could not find the "${o}" edge in the graph.`);let c=d.source.key,g=d.target.key;if(r===c)a=d.target;else if(r===g)a=d.source;else throw new h(`Graph.${t}: the "${r}" node is not attached to the "${o}" edge (${c}, ${g}).`);u=i,l=s}else{if(d=e._edges.get(r),!d)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`);if(n===To)a=d.source;else a=d.target;u=o,l=i}return[a,u,l]}function va(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);return s.attributes[a]}}function Ma(e,t,n){e.prototype[t]=function(r,o){let[i]=Fe(this,t,n,r,o);return i.attributes}}function $a(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);return s.attributes.hasOwnProperty(a)}}function Na(e,t,n){e.prototype[t]=function(r,o,i,s){let[a,d,u]=Fe(this,t,n,r,o,i,s);return a.attributes[d]=u,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:d}),this}}function La(e,t,n){e.prototype[t]=function(r,o,i,s){let[a,d,u]=Fe(this,t,n,r,o,i,s);if(typeof u!=="function")throw new S(`Graph.${t}: updater should be a function.`);let l=a.attributes,c=u(l[d]);return l[d]=c,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:d}),this}}function Ba(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);return delete s.attributes[a],this.emit("nodeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:a}),this}}function Ua(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);if(!V(a))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return s.attributes=a,this.emit("nodeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function ja(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);if(!V(a))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return W(s.attributes,a),this.emit("nodeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:a}),this}}function Wa(e,t,n){e.prototype[t]=function(r,o,i){let[s,a]=Fe(this,t,n,r,o,i);if(typeof a!=="function")throw new S(`Graph.${t}: provided updater is not a function.`);return s.attributes=a(s.attributes),this.emit("nodeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}var Ha=[{name:(e)=>`get${e}Attribute`,attacher:va},{name:(e)=>`get${e}Attributes`,attacher:Ma},{name:(e)=>`has${e}Attribute`,attacher:$a},{name:(e)=>`set${e}Attribute`,attacher:Na},{name:(e)=>`update${e}Attribute`,attacher:La},{name:(e)=>`remove${e}Attribute`,attacher:Ba},{name:(e)=>`replace${e}Attributes`,attacher:Ua},{name:(e)=>`merge${e}Attributes`,attacher:ja},{name:(e)=>`update${e}Attributes`,attacher:Wa}];function qa(e){Ha.forEach(function({name:t,attacher:n}){n(e,t("Node"),So),n(e,t("Source"),To),n(e,t("Target"),Ia),n(e,t("Opposite"),xo)})}function Ka(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return i.attributes[o]}}function Va(e,t,n){e.prototype[t]=function(r){let o;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let i=""+r,s=""+arguments[1];if(o=ce(this,i,s,n),!o)throw new h(`Graph.${t}: could not find an edge for the given path ("${i}" - "${s}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return o.attributes}}function za(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return i.attributes.hasOwnProperty(o)}}function Ya(e,t,n){e.prototype[t]=function(r,o,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=""+r,d=""+o;if(o=arguments[2],i=arguments[3],s=ce(this,a,d,n),!s)throw new h(`Graph.${t}: could not find an edge for the given path ("${a}" - "${d}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return s.attributes[o]=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:o}),this}}function Ga(e,t,n){e.prototype[t]=function(r,o,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=""+r,d=""+o;if(o=arguments[2],i=arguments[3],s=ce(this,a,d,n),!s)throw new h(`Graph.${t}: could not find an edge for the given path ("${a}" - "${d}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(typeof i!=="function")throw new S(`Graph.${t}: updater should be a function.`);return s.attributes[o]=i(s.attributes[o]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:o}),this}}function Qa(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return delete i.attributes[o],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:o}),this}}function Ja(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(!V(o))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=o,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}function Za(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(!V(o))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return W(i.attributes,o),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:o}),this}}function Xa(e,t,n){e.prototype[t]=function(r,o){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=""+r,a=""+o;if(o=arguments[2],i=ce(this,s,a,n),!i)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(n!=="mixed")throw new w(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(typeof o!=="function")throw new S(`Graph.${t}: provided updater is not a function.`);return i.attributes=o(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}var ed=[{name:(e)=>`get${e}Attribute`,attacher:Ka},{name:(e)=>`get${e}Attributes`,attacher:Va},{name:(e)=>`has${e}Attribute`,attacher:za},{name:(e)=>`set${e}Attribute`,attacher:Ya},{name:(e)=>`update${e}Attribute`,attacher:Ga},{name:(e)=>`remove${e}Attribute`,attacher:Qa},{name:(e)=>`replace${e}Attributes`,attacher:Ja},{name:(e)=>`merge${e}Attributes`,attacher:Za},{name:(e)=>`update${e}Attributes`,attacher:Xa}];function td(e){ed.forEach(function({name:t,attacher:n}){n(e,t("Edge"),"mixed"),n(e,t("DirectedEdge"),"directed"),n(e,t("UndirectedEdge"),"undirected")})}var nd=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function rd(e,t,n,r){let o=!1;for(let i in t){if(i===r)continue;let s=t[i];if(o=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),e&&o)return s.key}return}function od(e,t,n,r){let o,i,s,a=!1;for(let d in t){if(d===r)continue;o=t[d];do{if(i=o.source,s=o.target,a=n(o.key,o.attributes,i.key,s.key,i.attributes,s.attributes,o.undirected),e&&a)return o.key;o=o.next}while(o!==void 0)}return}function Vn(e,t){let n=Object.keys(e),r=n.length,o,i=0;return{[Symbol.iterator](){return this},next(){do if(!o){if(i>=r)return{done:!0};let s=n[i++];if(s===t){o=void 0;continue}o=e[s]}else o=o.next;while(!o);return{done:!1,value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected}}}}}function id(e,t,n,r){let o=t[n];if(!o)return;let{source:i,target:s}=o;if(r(o.key,o.attributes,i.key,s.key,i.attributes,s.attributes,o.undirected)&&e)return o.key}function sd(e,t,n,r){let o=t[n];if(!o)return;let i=!1;do{if(i=r(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key;o=o.next}while(o!==void 0);return}function zn(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let o={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:o}}};let r=!1;return{[Symbol.iterator](){return this},next(){if(r===!0)return{done:!0};return r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}}}function ad(e,t){if(e.size===0)return[];if(t==="mixed"||t===e.type)return Array.from(e._edges.keys());let n=t==="undirected"?e.undirectedSize:e.directedSize,r=Array(n),o=t==="undirected",i=e._edges.values(),s=0,a,d;while(a=i.next(),a.done!==!0)if(d=a.value,d.undirected===o)r[s++]=d.key;return r}function Fo(e,t,n,r){if(t.size===0)return;let o=n!=="mixed"&&n!==t.type,i=n==="undirected",s,a,d=!1,u=t._edges.values();while(s=u.next(),s.done!==!0){if(a=s.value,o&&a.undirected!==i)continue;let{key:l,attributes:c,source:g,target:x}=a;if(d=r(l,c,g.key,x.key,g.attributes,x.attributes,a.undirected),e&&d)return l}return}function dd(e,t){if(e.size===0)return Ve();let n=t!=="mixed"&&t!==e.type,r=t==="undirected",o=e._edges.values();return{[Symbol.iterator](){return this},next(){let i,s;while(!0){if(i=o.next(),i.done)return i;if(s=i.value,n&&s.undirected!==r)continue;break}return{value:{edge:s.key,attributes:s.attributes,source:s.source.key,target:s.target.key,sourceAttributes:s.source.attributes,targetAttributes:s.target.attributes,undirected:s.undirected},done:!1}}}}function Yn(e,t,n,r,o,i){let s=t?od:rd,a;if(n!=="undirected"){if(r!=="out"){if(a=s(e,o.in,i),e&&a)return a}if(r!=="in"){if(a=s(e,o.out,i,!r?o.key:void 0),e&&a)return a}}if(n!=="directed"){if(a=s(e,o.undirected,i),e&&a)return a}return}function ud(e,t,n,r){let o=[];return Yn(!1,e,t,n,r,function(i){o.push(i)}),o}function cd(e,t,n){let r=Ve();if(e!=="undirected"){if(t!=="out"&&typeof n.in<"u")r=xe(r,Vn(n.in));if(t!=="in"&&typeof n.out<"u")r=xe(r,Vn(n.out,!t?n.key:void 0))}if(e!=="directed"&&typeof n.undirected<"u")r=xe(r,Vn(n.undirected));return r}function Gn(e,t,n,r,o,i,s){let a=n?sd:id,d;if(t!=="undirected"){if(typeof o.in<"u"&&r!=="out"){if(d=a(e,o.in,i,s),e&&d)return d}if(typeof o.out<"u"&&r!=="in"&&(r||o.key!==i)){if(d=a(e,o.out,i,s),e&&d)return d}}if(t!=="directed"){if(typeof o.undirected<"u"){if(d=a(e,o.undirected,i,s),e&&d)return d}}return}function ld(e,t,n,r,o){let i=[];return Gn(!1,e,t,n,r,o,function(s){i.push(s)}),i}function pd(e,t,n,r){let o=Ve();if(e!=="undirected"){if(typeof n.in<"u"&&t!=="out"&&r in n.in)o=xe(o,zn(n.in,r));if(typeof n.out<"u"&&t!=="in"&&r in n.out&&(t||n.key!==r))o=xe(o,zn(n.out,r))}if(e!=="directed"){if(typeof n.undirected<"u"&&r in n.undirected)o=xe(o,zn(n.undirected,r))}return o}function fd(e,t){let{name:n,type:r,direction:o}=t;e.prototype[n]=function(i,s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];if(!arguments.length)return ad(this,r);if(arguments.length===1){i=""+i;let a=this._nodes.get(i);if(typeof a>"u")throw new h(`Graph.${n}: could not find the "${i}" node in the graph.`);return ud(this.multi,r==="mixed"?this.type:r,o,a)}if(arguments.length===2){i=""+i,s=""+s;let a=this._nodes.get(i);if(!a)throw new h(`Graph.${n}: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(s))throw new h(`Graph.${n}: could not find the "${s}" target node in the graph.`);return ld(r,this.multi,o,a,s)}throw new S(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function md(e,t){let{name:n,type:r,direction:o}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(u,l,c){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;if(arguments.length===1)return c=u,Fo(!1,this,r,c);if(arguments.length===2){u=""+u,c=l;let g=this._nodes.get(u);if(typeof g>"u")throw new h(`Graph.${i}: could not find the "${u}" node in the graph.`);return Yn(!1,this.multi,r==="mixed"?this.type:r,o,g,c)}if(arguments.length===3){u=""+u,l=""+l;let g=this._nodes.get(u);if(!g)throw new h(`Graph.${i}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(l))throw new h(`Graph.${i}: could not find the "${l}" target node in the graph.`);return Gn(!1,r,this.multi,o,g,l,c)}throw new S(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let s="map"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let u=Array.prototype.slice.call(arguments),l=u.pop(),c;if(u.length===0){let g=0;if(r!=="directed")g+=this.undirectedSize;if(r!=="undirected")g+=this.directedSize;c=Array(g);let x=0;u.push((F,N,D,B,b,A,p)=>{c[x++]=l(F,N,D,B,b,A,p)})}else c=[],u.push((g,x,F,N,D,B,b)=>{c.push(l(g,x,F,N,D,B,b))});return this[i].apply(this,u),c};let a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(){let u=Array.prototype.slice.call(arguments),l=u.pop(),c=[];return u.push((g,x,F,N,D,B,b)=>{if(l(g,x,F,N,D,B,b))c.push(g)}),this[i].apply(this,u),c};let d="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[d]=function(){let u=Array.prototype.slice.call(arguments);if(u.length<2||u.length>4)throw new S(`Graph.${d}: invalid number of arguments (expecting 2, 3 or 4 and got ${u.length}).`);if(typeof u[u.length-1]==="function"&&typeof u[u.length-2]!=="function")throw new S(`Graph.${d}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let l,c;if(u.length===2)l=u[0],c=u[1],u=[];else if(u.length===3)l=u[1],c=u[2],u=[u[0]];else if(u.length===4)l=u[2],c=u[3],u=[u[0],u[1]];let g=c;return u.push((x,F,N,D,B,b,A)=>{g=l(g,x,F,N,D,B,b,A)}),this[i].apply(this,u),g}}function yd(e,t){let{name:n,type:r,direction:o}=t,i="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(d,u,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return!1;if(arguments.length===1)return l=d,Fo(!0,this,r,l);if(arguments.length===2){d=""+d,l=u;let c=this._nodes.get(d);if(typeof c>"u")throw new h(`Graph.${i}: could not find the "${d}" node in the graph.`);return Yn(!0,this.multi,r==="mixed"?this.type:r,o,c,l)}if(arguments.length===3){d=""+d,u=""+u;let c=this._nodes.get(d);if(!c)throw new h(`Graph.${i}: could not find the "${d}" source node in the graph.`);if(!this._nodes.has(u))throw new h(`Graph.${i}: could not find the "${u}" target node in the graph.`);return Gn(!0,r,this.multi,o,c,u,l)}throw new S(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let s="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let d=Array.prototype.slice.call(arguments),u=d.pop();if(d.push((c,g,x,F,N,D,B)=>u(c,g,x,F,N,D,B)),this[i].apply(this,d))return!0;return!1};let a="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(){let d=Array.prototype.slice.call(arguments),u=d.pop();if(d.push((c,g,x,F,N,D,B)=>!u(c,g,x,F,N,D,B)),this[i].apply(this,d))return!1;return!0}}function gd(e,t){let{name:n,type:r,direction:o}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(s,a){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Ve();if(!arguments.length)return dd(this,r);if(arguments.length===1){s=""+s;let d=this._nodes.get(s);if(!d)throw new h(`Graph.${i}: could not find the "${s}" node in the graph.`);return cd(r,o,d)}if(arguments.length===2){s=""+s,a=""+a;let d=this._nodes.get(s);if(!d)throw new h(`Graph.${i}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(a))throw new h(`Graph.${i}: could not find the "${a}" target node in the graph.`);return pd(r,o,d,a)}throw new S(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function hd(e){nd.forEach((t)=>{fd(e,t),md(e,t),yd(e,t),gd(e,t)})}var Sd=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function Gt(){this.A=null,this.B=null}Gt.prototype.wrap=function(e){if(this.A===null)this.A=e;else if(this.B===null)this.B=e};Gt.prototype.has=function(e){if(this.A!==null&&e in this.A)return!0;if(this.B!==null&&e in this.B)return!0;return!1};function at(e,t,n,r,o){for(let i in r){let s=r[i],{source:a,target:d}=s,u=a===n?d:a;if(t&&t.has(u.key))continue;let l=o(u.key,u.attributes);if(e&&l)return u.key}return}function Qn(e,t,n,r,o){if(t!=="mixed"){if(t==="undirected")return at(e,null,r,r.undirected,o);if(typeof n==="string")return at(e,null,r,r[n],o)}let i=new Gt,s;if(t!=="undirected"){if(n!=="out"){if(s=at(e,null,r,r.in,o),e&&s)return s;i.wrap(r.in)}if(n!=="in"){if(s=at(e,i,r,r.out,o),e&&s)return s;i.wrap(r.out)}}if(t!=="directed"){if(s=at(e,i,r,r.undirected,o),e&&s)return s}return}function Td(e,t,n){if(e!=="mixed"){if(e==="undirected")return Object.keys(n.undirected);if(typeof t==="string")return Object.keys(n[t])}let r=[];return Qn(!1,e,t,n,function(o){r.push(o)}),r}function dt(e,t,n){let r=Object.keys(n),o=r.length,i=0;return{[Symbol.iterator](){return this},next(){let s=null;do{if(i>=o){if(e)e.wrap(n);return{done:!0}}let a=n[r[i++]],{source:d,target:u}=a;if(s=d===t?u:d,e&&e.has(s.key)){s=null;continue}}while(s===null);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}}}function xd(e,t,n){if(e!=="mixed"){if(e==="undirected")return dt(null,n,n.undirected);if(typeof t==="string")return dt(null,n,n[t])}let r=Ve(),o=new Gt;if(e!=="undirected"){if(t!=="out")r=xe(r,dt(o,n,n.in));if(t!=="in")r=xe(r,dt(o,n,n.out))}if(e!=="directed")r=xe(r,dt(o,n,n.undirected));return r}function Fd(e,t){let{name:n,type:r,direction:o}=t;e.prototype[n]=function(i){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];i=""+i;let s=this._nodes.get(i);if(typeof s>"u")throw new h(`Graph.${n}: could not find the "${i}" node in the graph.`);return Td(r==="mixed"?this.type:r,o,s)}}function bd(e,t){let{name:n,type:r,direction:o}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(u,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;u=""+u;let c=this._nodes.get(u);if(typeof c>"u")throw new h(`Graph.${i}: could not find the "${u}" node in the graph.`);Qn(!1,r==="mixed"?this.type:r,o,c,l)};let s="map"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(u,l){let c=[];return this[i](u,(g,x)=>{c.push(l(g,x))}),c};let a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(u,l){let c=[];return this[i](u,(g,x)=>{if(l(g,x))c.push(g)}),c};let d="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[d]=function(u,l,c){if(arguments.length<3)throw new S(`Graph.${d}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let g=c;return this[i](u,(x,F)=>{g=l(g,x,F)}),g}}function wd(e,t){let{name:n,type:r,direction:o}=t,i=n[0].toUpperCase()+n.slice(1,-1),s="find"+i;e.prototype[s]=function(u,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;u=""+u;let c=this._nodes.get(u);if(typeof c>"u")throw new h(`Graph.${s}: could not find the "${u}" node in the graph.`);return Qn(!0,r==="mixed"?this.type:r,o,c,l)};let a="some"+i;e.prototype[a]=function(u,l){if(this[s](u,l))return!0;return!1};let d="every"+i;e.prototype[d]=function(u,l){if(this[s](u,(g,x)=>!l(g,x)))return!1;return!0}}function Ed(e,t){let{name:n,type:r,direction:o}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Ve();s=""+s;let a=this._nodes.get(s);if(typeof a>"u")throw new h(`Graph.${i}: could not find the "${s}" node in the graph.`);return xd(r==="mixed"?this.type:r,o,a)}}function kd(e){Sd.forEach((t)=>{Fd(e,t),bd(e,t),wd(e,t),Ed(e,t)})}function zt(e,t,n,r,o){let i=r._nodes.values(),s=r.type,a,d,u,l,c,g,x;while(a=i.next(),a.done!==!0){let F=!1;if(d=a.value,s!=="undirected"){l=d.out;for(u in l){c=l[u];do{if(g=c.target,F=!0,x=o(d.key,g.key,d.attributes,g.attributes,c.key,c.attributes,c.undirected),e&&x)return c;c=c.next}while(c)}}if(s!=="directed"){l=d.undirected;for(u in l){if(t&&d.key>u)continue;c=l[u];do{if(g=c.target,g.key!==u)g=c.source;if(F=!0,x=o(d.key,g.key,d.attributes,g.attributes,c.key,c.attributes,c.undirected),e&&x)return c;c=c.next}while(c)}}if(n&&!F){if(x=o(d.key,null,d.attributes,null,null,null,null),e&&x)return null}}return}function Od(e,t){let n={key:e};if(!mo(t.attributes))n.attributes=W({},t.attributes);return n}function Rd(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};if(!mo(n.attributes))r.attributes=W({},n.attributes);if(e==="mixed"&&n.undirected)r.undirected=!0;return r}function Ad(e){if(!V(e))throw new S('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new S("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!V(e.attributes)||e.attributes===null))throw new S("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function _d(e){if(!V(e))throw new S('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new S("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new S("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!V(e.attributes)||e.attributes===null))throw new S("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&typeof e.undirected!=="boolean")throw new S("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}var Dd=Ca(),Pd=new Set(["directed","undirected","mixed"]),po=new Set(["domain","_events","_eventsCount","_maxListeners"]),Cd=[{name:(e)=>`${e}Edge`,generateKey:!0},{name:(e)=>`${e}DirectedEdge`,generateKey:!0,type:"directed"},{name:(e)=>`${e}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:(e)=>`${e}EdgeWithKey`},{name:(e)=>`${e}DirectedEdgeWithKey`,type:"directed"},{name:(e)=>`${e}UndirectedEdgeWithKey`,type:"undirected"}],Id={allowSelfLoops:!0,multi:!1,type:"mixed"};function vd(e,t,n){if(n&&!V(n))throw new S(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=""+t,n=n||{},e._nodes.has(t))throw new w(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function fo(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function bo(e,t,n,r,o,i,s,a){if(!r&&e.type==="undirected")throw new w(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type==="directed")throw new w(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!V(a))throw new S(`Graph.${t}: invalid attributes. Expecting an object but got "${a}"`);if(i=""+i,s=""+s,a=a||{},!e.allowSelfLoops&&i===s)throw new w(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=e._nodes.get(i),u=e._nodes.get(s);if(!d)throw new h(`Graph.${t}: source node "${i}" not found.`);if(!u)throw new h(`Graph.${t}: target node "${s}" not found.`);let l={key:null,undirected:r,source:i,target:s,attributes:a};if(n)o=e._edgeKeyGenerator();else if(o=""+o,e._edges.has(o))throw new w(`Graph.${t}: the "${o}" edge already exists in the graph.`);if(!e.multi&&(r?typeof d.undirected[s]<"u":typeof d.out[s]<"u"))throw new w(`Graph.${t}: an edge linking "${i}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let c=new ze(r,o,d,u,a);e._edges.set(o,c);let g=i===s;if(r){if(d.undirectedDegree++,u.undirectedDegree++,g)d.undirectedLoops++,e._undirectedSelfLoopCount++}else if(d.outDegree++,u.inDegree++,g)d.directedLoops++,e._directedSelfLoopCount++;if(e.multi)c.attachMulti();else c.attach();if(r)e._undirectedSize++;else e._directedSize++;return l.key=o,e.emit("edgeAdded",l),o}function Md(e,t,n,r,o,i,s,a,d){if(!r&&e.type==="undirected")throw new w(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type==="directed")throw new w(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a){if(d){if(typeof a!=="function")throw new S(`Graph.${t}: invalid updater function. Expecting a function but got "${a}"`)}else if(!V(a))throw new S(`Graph.${t}: invalid attributes. Expecting an object but got "${a}"`)}i=""+i,s=""+s;let u;if(d)u=a,a=void 0;if(!e.allowSelfLoops&&i===s)throw new w(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let l=e._nodes.get(i),c=e._nodes.get(s),g,x;if(!n){if(g=e._edges.get(o),g){if(g.source.key!==i||g.target.key!==s){if(!r||g.source.key!==s||g.target.key!==i)throw new w(`Graph.${t}: inconsistency detected when attempting to merge the "${o}" edge with "${i}" source & "${s}" target vs. ("${g.source.key}", "${g.target.key}").`)}x=g}}if(!x&&!e.multi&&l)x=r?l.undirected[s]:l.out[s];if(x){let b=[x.key,!1,!1,!1];if(d?!u:!a)return b;if(d){let A=x.attributes;x.attributes=u(A),e.emit("edgeAttributesUpdated",{type:"replace",key:x.key,attributes:x.attributes})}else W(x.attributes,a),e.emit("edgeAttributesUpdated",{type:"merge",key:x.key,attributes:x.attributes,data:a});return b}if(a=a||{},d&&u)a=u(a);let F={key:null,undirected:r,source:i,target:s,attributes:a};if(n)o=e._edgeKeyGenerator();else if(o=""+o,e._edges.has(o))throw new w(`Graph.${t}: the "${o}" edge already exists in the graph.`);let N=!1,D=!1;if(!l){if(l=fo(e,i,{}),N=!0,i===s)c=l,D=!0}if(!c)c=fo(e,s,{}),D=!0;g=new ze(r,o,l,c,a),e._edges.set(o,g);let B=i===s;if(r){if(l.undirectedDegree++,c.undirectedDegree++,B)l.undirectedLoops++,e._undirectedSelfLoopCount++}else if(l.outDegree++,c.inDegree++,B)l.directedLoops++,e._directedSelfLoopCount++;if(e.multi)g.attachMulti();else g.attach();if(r)e._undirectedSize++;else e._directedSize++;return F.key=o,e.emit("edgeAdded",F),[o,!0,N,D]}function Ke(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:o}=t,i=t.undirected,s=n===r;if(i){if(n.undirectedDegree--,r.undirectedDegree--,s)n.undirectedLoops--,e._undirectedSelfLoopCount--}else if(n.outDegree--,r.inDegree--,s)n.directedLoops--,e._directedSelfLoopCount--;if(e.multi)t.detachMulti();else t.detach();if(i)e._undirectedSize--;else e._directedSize--;e.emit("edgeDropped",{key:t.key,attributes:o,source:n.key,target:r.key,undirected:i})}class P extends Da{constructor(e){super();if(e=W({},Id,e),typeof e.multi!=="boolean")throw new S(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!Pd.has(e.type))throw new S(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=="boolean")throw new S(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type==="mixed"?yo:e.type==="directed"?go:ho;ue(this,"NodeDataClass",t);let n="geid_"+Dd()+"_",r=0,o=()=>{let i;do i=n+r++;while(this._edges.has(i));return i};ue(this,"_attributes",{}),ue(this,"_nodes",new Map),ue(this,"_edges",new Map),ue(this,"_directedSize",0),ue(this,"_undirectedSize",0),ue(this,"_directedSelfLoopCount",0),ue(this,"_undirectedSelfLoopCount",0),ue(this,"_edgeKeyGenerator",o),ue(this,"_options",e),po.forEach((i)=>ue(this,i,this[i])),he(this,"order",()=>this._nodes.size),he(this,"size",()=>this._edges.size),he(this,"directedSize",()=>this._directedSize),he(this,"undirectedSize",()=>this._undirectedSize),he(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),he(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),he(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),he(this,"multi",this._options.multi),he(this,"type",this._options.type),he(this,"allowSelfLoops",this._options.allowSelfLoops),he(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){let n=""+e,r=this._edges.get(n);return!!r&&!r.undirected}else if(arguments.length===2){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)return!1;return n.out.hasOwnProperty(t)}throw new S(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){let n=""+e,r=this._edges.get(n);return!!r&&r.undirected}else if(arguments.length===2){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)return!1;return n.undirected.hasOwnProperty(t)}throw new S(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let n=""+e;return this._edges.has(n)}else if(arguments.length===2){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)return!1;return typeof n.out<"u"&&n.out.hasOwnProperty(t)||typeof n.undirected<"u"&&n.undirected.hasOwnProperty(t)}throw new S(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new w("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");let n=this._nodes.get(e);if(!n)throw new h(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new w("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");let n=this._nodes.get(e);if(!n)throw new h(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new w("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return!1;return t in n.in||t in n.out}areOutNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return!1;return t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return!1;return t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);if(this.type==="directed")return!1;return t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);if(this.type!=="undirected"){if(t in n.in||t in n.out)return!0}if(this.type!=="directed"){if(t in n.undirected)return!0}return!1}areInboundNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);if(this.type!=="undirected"){if(t in n.in)return!0}if(this.type!=="directed"){if(t in n.undirected)return!0}return!1}areOutboundNeighbors(e,t){e=""+e,t=""+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);if(this.type!=="undirected"){if(t in n.out)return!0}if(this.type!=="directed"){if(t in n.undirected)return!0}return!1}inDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inDegree: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.inDegree}outDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outDegree: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.outDegree}directedDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.directedDegree: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);if(this.type==="directed")return 0;return t.undirectedDegree}inboundDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;if(this.type!=="directed")n+=t.undirectedDegree;if(this.type!=="undirected")n+=t.inDegree;return n}outboundDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;if(this.type!=="directed")n+=t.undirectedDegree;if(this.type!=="undirected")n+=t.outDegree;return n}degree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;if(this.type!=="directed")n+=t.undirectedDegree;if(this.type!=="undirected")n+=t.inDegree+t.outDegree;return n}inDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);if(this.type==="undirected")return 0;return t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);if(this.type==="directed")return 0;return t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;if(this.type!=="directed")n+=t.undirectedDegree,r+=t.undirectedLoops*2;if(this.type!=="undirected")n+=t.inDegree,r+=t.directedLoops;return n-r}outboundDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;if(this.type!=="directed")n+=t.undirectedDegree,r+=t.undirectedLoops*2;if(this.type!=="undirected")n+=t.outDegree,r+=t.directedLoops;return n-r}degreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;if(this.type!=="directed")n+=t.undirectedDegree,r+=t.undirectedLoops*2;if(this.type!=="undirected")n+=t.inDegree+t.outDegree,r+=t.directedLoops*2;return n-r}source(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;let n=this._edges.get(t);if(!n)throw new h(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,o=n.target.key;if(e===r)return o;if(e===o)return r;throw new h(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${o}).`)}hasExtremity(e,t){e=""+e,t=""+t;let n=this._edges.get(e);if(!n)throw new h(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return vd(this,e,t).key}mergeNode(e,t){if(t&&!V(t))throw new S(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);if(n){if(t)W(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t});return[e,!1]}return n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0]}updateNode(e,t){if(t&&typeof t!=="function")throw new S(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){let o=n.attributes;n.attributes=t(o),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!=="undirected"){for(let r in t.out){n=t.out[r];do Ke(this,n),n=n.next;while(n)}for(let r in t.in){n=t.in[r];do Ke(this,n),n=n.next;while(n)}}if(this.type!=="directed")for(let r in t.undirected){n=t.undirected[r];do Ke(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let n=""+arguments[0],r=""+arguments[1];if(t=ce(this,n,r,this.type),!t)throw new h(`Graph.dropEdge: could not find the "${n}" -> "${r}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new h(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return Ke(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new w("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new w("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;let n=ce(this,e,t,"directed");if(!n)throw new h(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return Ke(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new w("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new w("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");let n=ce(this,e,t,"undirected");if(!n)throw new h(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return Ke(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){let e=this._nodes.values(),t;while(t=e.next(),t.done!==!0)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=="function")throw new S("Graph.updateAttribute: updater should be a function.");let n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!V(e))throw new S("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!V(e))throw new S("Graph.mergeAttributes: provided attributes are not a plain object.");return W(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=="function")throw new S("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=="function")throw new S("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!lo(t))throw new S("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");let n=this._nodes.values(),r,o;while(r=n.next(),r.done!==!0)o=r.value,o.attributes=e(o.key,o.attributes);this.emit("eachNodeAttributesUpdated",{hints:t?t:null})}updateEachEdgeAttributes(e,t){if(typeof e!=="function")throw new S("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!lo(t))throw new S("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");let n=this._edges.values(),r,o,i,s;while(r=n.next(),r.done!==!0)o=r.value,i=o.source,s=o.target,o.attributes=e(o.key,o.attributes,i.key,s.key,i.attributes,s.attributes,o.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t?t:null})}forEachAdjacencyEntry(e){if(typeof e!=="function")throw new S("Graph.forEachAdjacencyEntry: expecting a callback.");zt(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=="function")throw new S("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");zt(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=="function")throw new S("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");zt(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=="function")throw new S("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");zt(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=="function")throw new S("Graph.forEachNode: expecting a callback.");let t=this._nodes.values(),n,r;while(n=t.next(),n.done!==!0)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=="function")throw new S("Graph.findNode: expecting a callback.");let t=this._nodes.values(),n,r;while(n=t.next(),n.done!==!0)if(r=n.value,e(r.key,r.attributes))return r.key;return}mapNodes(e){if(typeof e!=="function")throw new S("Graph.mapNode: expecting a callback.");let t=this._nodes.values(),n,r,o=Array(this.order),i=0;while(n=t.next(),n.done!==!0)r=n.value,o[i++]=e(r.key,r.attributes);return o}someNode(e){if(typeof e!=="function")throw new S("Graph.someNode: expecting a callback.");let t=this._nodes.values(),n,r;while(n=t.next(),n.done!==!0)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=="function")throw new S("Graph.everyNode: expecting a callback.");let t=this._nodes.values(),n,r;while(n=t.next(),n.done!==!0)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=="function")throw new S("Graph.filterNodes: expecting a callback.");let t=this._nodes.values(),n,r,o=[];while(n=t.next(),n.done!==!0)if(r=n.value,e(r.key,r.attributes))o.push(r.key);return o}reduceNodes(e,t){if(typeof e!=="function")throw new S("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new S("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=t,r=this._nodes.values(),o,i;while(o=r.next(),o.done!==!0)i=o.value,n=e(n,i.key,i.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((r,o)=>{e[t++]=Od(o,r)});let n=Array(this._edges.size);return t=0,this._edges.forEach((r,o)=>{n[t++]=Rd(this.type,o,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof P)return e.forEachNode((a,d)=>{if(t)this.mergeNode(a,d);else this.addNode(a,d)}),e.forEachEdge((a,d,u,l,c,g,x)=>{if(t)if(x)this.mergeUndirectedEdgeWithKey(a,u,l,d);else this.mergeDirectedEdgeWithKey(a,u,l,d);else if(x)this.addUndirectedEdgeWithKey(a,u,l,d);else this.addDirectedEdgeWithKey(a,u,l,d)}),this;if(!V(e))throw new S("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!V(e.attributes))throw new S("Graph.import: invalid attributes. Expecting a plain object.");if(t)this.mergeAttributes(e.attributes);else this.replaceAttributes(e.attributes)}let n,r,o,i,s;if(e.nodes){if(o=e.nodes,!Array.isArray(o))throw new S("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=o.length;n<r;n++){i=o[n],Ad(i);let{key:a,attributes:d}=i;if(t)this.mergeNode(a,d);else this.addNode(a,d)}}if(e.edges){let a=!1;if(this.type==="undirected")a=!0;if(o=e.edges,!Array.isArray(o))throw new S("Graph.import: invalid edges. Expecting an array.");for(n=0,r=o.length;n<r;n++){s=o[n],_d(s);let{source:d,target:u,attributes:l,undirected:c=a}=s,g;if("key"in s)g=t?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,g.call(this,s.key,d,u,l);else g=t?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,g.call(this,d,u,l)}}return this}nullCopy(e){let t=new P(W({},this._options,e));return t.replaceAttributes(W({},this.getAttributes())),t}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((n,r)=>{let o=W({},n.attributes);n=new t.NodeDataClass(r,o),t._nodes.set(r,n)}),t}copy(e){if(e=e||{},typeof e.type==="string"&&e.type!==this.type&&e.type!=="mixed")throw new w(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new w("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops==="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new w("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");let t=this.emptyCopy(e),n=this._edges.values(),r,o;while(r=n.next(),r.done!==!0)o=r.value,bo(t,"copy",!1,o.undirected,o.key,o.source.key,o.target.key,W({},o.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){let e={};this._nodes.forEach((o,i)=>{e[i]=o.attributes});let t={},n={};this._edges.forEach((o,i)=>{let s=o.undirected?"--":"->",a="",d=o.source.key,u=o.target.key,l;if(o.undirected&&d>u)l=d,d=u,u=l;let c=`(${d})${s}(${u})`;if(!i.startsWith("geid_"))a+=`[${i}]: `;else if(this.multi){if(typeof n[c]>"u")n[c]=0;else n[c]++;a+=`${n[c]}. `}a+=c,t[a]=o.attributes});let r={};for(let o in this)if(this.hasOwnProperty(o)&&!po.has(o)&&typeof this[o]!=="function"&&typeof o!=="symbol")r[o]=this[o];return r.attributes=this._attributes,r.nodes=e,r.edges=t,ue(r,"constructor",this.constructor),r}}if(typeof Symbol<"u")P.prototype[Symbol.for("nodejs.util.inspect.custom")]=P.prototype.inspect;Cd.forEach((e)=>{["add","merge","update"].forEach((t)=>{let n=e.name(t),r=t==="add"?bo:Md;if(e.generateKey)P.prototype[n]=function(o,i,s){return r(this,n,!0,(e.type||this.type)==="undirected",null,o,i,s,t==="update")};else P.prototype[n]=function(o,i,s,a){return r(this,n,!1,(e.type||this.type)==="undirected",o,i,s,a,t==="update")}})});qa(P);td(P);hd(P);kd(P);class Jn extends P{constructor(e){let t=W({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new S("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new S('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Zn extends P{constructor(e){let t=W({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new S("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new S('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Xn extends P{constructor(e){let t=W({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new S("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class er extends P{constructor(e){let t=W({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new S("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new S('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class tr extends P{constructor(e){let t=W({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new S("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new S('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Ye(e){e.from=function(t,n){let r=W({},t.options,n),o=new e(r);return o.import(t),o}}Ye(P);Ye(Jn);Ye(Zn);Ye(Xn);Ye(er);Ye(tr);P.Graph=P;P.DirectedGraph=Jn;P.UndirectedGraph=Zn;P.MultiGraph=Xn;P.MultiDirectedGraph=er;P.MultiUndirectedGraph=tr;P.InvalidArgumentsGraphError=S;P.NotFoundGraphError=h;P.UsageGraphError=w;var Mm=new Set([...Intl.supportedValuesOf("timeZone"),"UTC"]);import{Schema as cu}from"effect";import{Schema as M}from"effect";import{Schema as H}from"effect";import{Schema as U}from"effect";var Re=U.Int.pipe(U.between(0,6),U.brand("DayOfWeek"));var wo=U.Struct({hour:U.Int.pipe(U.between(0,23)),minute:U.Int.pipe(U.between(0,59))}),Qt=U.Struct({open:wo,close:wo}),Ge=U.Struct({day:Re,ranges:U.Array(Qt)}),Lm=U.Array(Ge),ut=U.Int.pipe(U.between(1,12),U.brand("Month")),ct=U.Int.pipe(U.between(1,31),U.brand("DayOfMonth")),nr=U.Int.pipe(U.between(1,5),U.brand("NthOccurrence")),v=(e)=>e.hour*60+e.minute,be=(e)=>v(e.close)<v(e.open);var Eo=H.Struct({id:H.String,type:H.String,name:H.String,startDate:H.DateTimeUtcFromSelf,endDate:H.DateTimeUtcFromSelf,isActive:H.Boolean,weeklySchedule:H.optional(H.Array(Ge))}),Wm=H.Struct({id:H.String,type:H.String,name:H.String,startDate:H.DateTimeUtc,endDate:H.DateTimeUtc,isActive:H.Boolean,weeklySchedule:H.optional(H.Array(Ge))});import{Schema as q}from"effect";var Nd=q.TaggedStruct("FixedHoliday",{name:q.String,month:ut,day:ct}),Ld=q.TaggedStruct("NthWeekdayHoliday",{name:q.String,month:ut,weekday:Re,nth:nr}),Bd=q.TaggedStruct("LastWeekdayHoliday",{name:q.String,month:ut,weekday:Re}),Ud=q.TaggedStruct("EasterRelativeHoliday",{name:q.String,daysOffset:q.Int}),rr=q.Union(Nd,Ld,Bd,Ud),Vm=q.Struct({date:q.DateTimeUtcFromSelf,name:q.String,rule:q.optional(rr)}),or=q.decodeSync(ut),jd=q.decodeSync(ct),ko=q.decodeSync(Re),Wd=q.decodeSync(nr),J=(e,t,n)=>({_tag:"FixedHoliday",name:e,month:or(t),day:jd(n)}),ve=(e,t,n,r)=>({_tag:"NthWeekdayHoliday",name:e,month:or(t),weekday:ko(n),nth:Wd(r)}),Hd=(e,t,n)=>({_tag:"LastWeekdayHoliday",name:e,month:or(t),weekday:ko(n)}),Ae=(e,t)=>({_tag:"EasterRelativeHoliday",name:e,daysOffset:t});var zm=[J("New Year's Day",1,1),ve("Martin Luther King Jr. Day",1,1,3),ve("Presidents' Day",2,1,3),Hd("Memorial Day",5,1),J("Independence Day",7,4),ve("Labor Day",9,1,1),ve("Columbus Day",10,1,2),J("Veterans Day",11,11),ve("Thanksgiving",11,4,4),J("Christmas Day",12,25)],Ym=[J("Nieuwjaarsdag",1,1),J("Koningsdag",4,27),J("Bevrijdingsdag",5,5),J("Eerste Kerstdag",12,25),J("Tweede Kerstdag",12,26),Ae("Goede Vrijdag",-2),Ae("Eerste Paasdag",0),Ae("Tweede Paasdag",1),Ae("Hemelvaartsdag",39),Ae("Eerste Pinksterdag",49),Ae("Tweede Pinksterdag",50)],Gm=[J("New Year's Day",1,1),J("Day after New Year's Day",1,2),J("Waitangi Day",2,6),Ae("Good Friday",-2),Ae("Easter Monday",1),J("Anzac Day",4,25),ve("Queen's Birthday",6,1,1),ve("Labour Day",10,1,4),J("Christmas Day",12,25),J("Boxing Day",12,26)];var qd=M.Struct({date:M.DateTimeUtcFromSelf,slots:M.Union(M.Array(Qt),M.Literal("closed")),note:M.optional(M.String)}),dy=M.Struct({date:M.DateTimeUtc,slots:M.Union(M.Array(Qt),M.Literal("closed")),note:M.optional(M.String)}),uy=M.Struct({weeklySchedule:M.Array(Ge),holidays:M.Array(rr),exceptions:M.Array(qd),nonWorkingDays:M.Array(Re),periods:M.Array(Eo),requireActivePeriod:M.optional(M.String),startDayOfWeek:M.optional(Re),timezone:M.optional(M.String)});import{Context as Oo,Data as Kd}from"effect";class Jt extends Kd.TaggedError("BusinessCalendarError"){}class ir extends Oo.Tag("processfocus:internal-tag/business-calendar/BusinessCalendarService")(){}class sr extends Oo.Tag("processfocus:internal-tag/business-calendar/BusinessCalendarConfigService")(){}import{Cause as Do,DateTime as O,Deferred as tn,Duration as pt,Effect as R,Exit as su,Layer as au,Option as le,SynchronizedRef as nn}from"effect";import{DateTime as ie,Effect as Z}from"effect";import{Data as Qe}from"effect";class Vd extends Qe.TaggedError("DateOutOfRangeError"){}class zd extends Qe.TaggedError("NoBusinessHoursError"){}class Yd extends Qe.TaggedError("InvalidCalendarConfigError"){}class Zt extends Qe.TaggedError("InvalidDateError"){}class lt extends Qe.TaggedError("InvalidYearError"){}class Gd extends Qe.TaggedError("ValidationError"){}var Ro=1583,Ao=9999,Xt=(e)=>{if(!Number.isInteger(e))return Z.fail(new lt({year:e,message:`Year must be an integer, got ${e}`}));if(e<Ro)return Z.fail(new lt({year:e,message:`Year must be >= ${Ro} for Gregorian calendar, got ${e}`}));if(e>Ao)return Z.fail(new lt({year:e,message:`Year must be <= ${Ao}, got ${e}`}));return Z.succeed(e)},Qd=(e,t)=>new Date(e,t,0).getDate(),Jd=(e,t,n)=>{let r=Qd(e,t);if(n>r)return Z.fail(new Zt({year:e,month:t,day:n,message:`Invalid date: ${e}-${t}-${n}. Month ${t} has only ${r} days in year ${e}`}));return Z.void},en=(e,t,n)=>Z.try({try:()=>ie.unsafeMake({year:e,month:t,day:n,hour:0,minute:0,second:0,millis:0}),catch:(r)=>new Zt({year:e,month:t,day:n,message:`Failed to create date: ${r}`})}),Zd=(e)=>Z.gen(function*(){yield*Xt(e);let t=e%19,n=Math.floor(e/100),r=e%100,o=Math.floor(n/4),i=n%4,s=Math.floor((n+8)/25),a=Math.floor((n-s+1)/3),d=(19*t+n-o-a+15)%30,u=Math.floor(r/4),l=r%4,c=(32+2*i+2*u-d-l)%7,g=Math.floor((t+11*d+22*c)/451),x=Math.floor((d+c-7*g+114)/31),F=(d+c-7*g+114)%31+1;return yield*en(e,x,F)}),Xd=(e,t,n,r)=>Z.gen(function*(){yield*Xt(e);let o=yield*en(e,t,1),s=ie.toParts(o).weekDay,a=n-s;if(a<0)a+=7;if(o=ie.add(o,{days:a}),o=ie.add(o,{days:(r-1)*7}),ie.toParts(o).month!==t)return;return o}),eu=(e,t,n)=>Z.gen(function*(){yield*Xt(e);let r=t===12?1:t+1,o=t===12?e+1:e,i=yield*en(o,r,1);i=ie.add(i,{days:-1});let d=ie.toParts(i).weekDay-n;if(d<0)d+=7;return ie.add(i,{days:-d})}),tu=(e,t)=>Z.gen(function*(){return yield*Xt(t),yield*Jd(t,e.month,e.day),{date:yield*en(t,e.month,e.day),name:e.name,rule:e}}),nu=(e,t)=>Z.gen(function*(){let n=yield*Xd(t,e.month,e.weekday,e.nth);if(!n)return;return{date:n,name:e.name,rule:e}}),ru=(e,t)=>Z.gen(function*(){return{date:yield*eu(t,e.month,e.weekday),name:e.name,rule:e}}),ou=(e,t)=>Z.gen(function*(){let n=yield*Zd(t);return{date:ie.add(n,{days:e.daysOffset}),name:e.name,rule:e}}),iu=(e,t)=>{switch(e._tag){case"FixedHoliday":return tu(e,t);case"NthWeekdayHoliday":return nu(e,t);case"LastWeekdayHoliday":return ru(e,t);case"EasterRelativeHoliday":return ou(e,t)}},_o=(e,t)=>Z.gen(function*(){let n=[];for(let r of e){let o=yield*iu(r,t);if(o)n.push(o)}return n.sort((r,o)=>{let i=ie.toEpochMillis(r.date),s=ie.toEpochMillis(o.date);return i-s})}),ar=(e,t)=>{let n=ie.toParts(e);for(let r of t){let o=ie.toParts(r.date);if(n.year===o.year&&n.month===o.month&&n.day===o.day)return r}return};var dr=1e4,du=1e5,ft=365,uu=(e)=>R.gen(function*(){let t=e.timezone?O.zoneUnsafeMakeNamed(e.timezone):O.zoneUnsafeMakeNamed("UTC"),n=(p)=>{let m=O.setZone(p,t);return O.toParts(m)},r=(p,m,f,y,T)=>{let E=O.unsafeMakeZoned({year:p,month:m,day:f,hours:y,minutes:T,seconds:0,millis:0},{timeZone:t,adjustForTimeZone:!0});return O.toUtc(E)},o=yield*nn.make(new Map),i=(p)=>_o(e.holidays,p).pipe(R.catchAllCause((m)=>{if(Do.isInterrupted(m)||Do.isDie(m))return R.failCause(m);return R.logWarning("Failed to compute holidays for year",m).pipe(R.annotateLogs({year:p}),R.as([]))})),s=(p)=>R.uninterruptibleMask((m)=>R.gen(function*(){let f=yield*nn.modifyEffect(o,(y)=>{let T=y.get(p);if(T!==void 0){if(T._tag==="Done")return R.succeed([{_tag:"hit",holidays:T.holidays},y]);return R.succeed([{_tag:"join",deferred:T.deferred},y])}return tn.make().pipe(R.map((E)=>{let k=new Map(y);return k.set(p,{_tag:"InFlight",deferred:E}),[{_tag:"owner",deferred:E},k]}))});switch(f._tag){case"hit":return f.holidays;case"join":return yield*m(tn.await(f.deferred).pipe(R.catchAll(()=>s(p))));case"owner":{let y=yield*R.exit(m(R.gen(function*(){return yield*R.yieldNow(),yield*i(p)})));if(su.isSuccess(y))return yield*tn.succeed(f.deferred,y.value),yield*nn.update(o,(T)=>{let E=T.get(p);if(E?._tag==="InFlight"&&E.deferred===f.deferred){let k=new Map(T);return k.set(p,{_tag:"Done",holidays:y.value}),k}return T}),y.value;return yield*nn.update(o,(T)=>{let E=T.get(p);if(E?._tag==="InFlight"&&E.deferred===f.deferred){let k=new Map(T);return k.delete(p),k}return T}),yield*tn.fail(f.deferred,"abandoned"),yield*R.failCause(y.cause)}}})),a=(p)=>{let m=n(p);for(let f of e.exceptions){let y=n(f.date);if(m.year===y.year&&m.month===y.month&&m.day===y.day)return f}return},d=(p)=>{let m=O.toEpochMillis(p);return[...e.periods].filter((f)=>{let y=O.toEpochMillis(f.startDate),T=O.toEpochMillis(f.endDate);return f.isActive&&m>=y&&m<=T})},u=(p)=>{if(!e.requireActivePeriod)return!0;let m=O.toEpochMillis(p);for(let f of e.periods){if(f.type!==e.requireActivePeriod||!f.isActive)continue;let y=O.toEpochMillis(f.startDate),T=O.toEpochMillis(f.endDate);if(m>=y&&m<=T)return!0}return!1},l=(p)=>{let m=d(p);for(let f of m)if(f.weeklySchedule)return f.weeklySchedule;return e.weeklySchedule},c=(p,m)=>p.find((f)=>f.day===m),g=(p,m)=>{let f=v(p),y=v(m.open),T=v(m.close);if(be(m))return f>=y||f<T;return f>=y&&f<T},x=(p,m)=>{let f=v(p),y=v(m.close);if(be(m)){if(f>=v(m.open))return 1440-f+y;return y-f}return y-f},F=1440,N=(p,m,f,y)=>Math.max(0,Math.min(m,y)-Math.max(p,f)),D=(p,m,f)=>{if(f<=m)return 0;let y=v(p.open),T=v(p.close);if(be(p))return N(y,1440,m,f)+N(0,T,m,f);return N(y,T,m,f)},B=(p)=>{let m=a(p);if(m){if(m.slots==="closed")return[];return m.slots}let f=n(p),y=l(p);return c(y,f.weekDay)?.ranges??[]},b=(p,m)=>{let f=n(p),y=n(m);return f.year===y.year&&f.month===y.month&&f.day===y.day},A={isBusinessDay:(p)=>R.gen(function*(){let m=n(p),f=a(p);if(f?.slots==="closed")return!1;if(e.nonWorkingDays.includes(m.weekDay))return!1;let y=yield*s(m.year),T=O.unsafeMake({year:m.year,month:m.month,day:m.day});if(ar(T,y))return!1;if(!u(p))return!1;let E=l(p),k=c(E,m.weekDay);if(f&&typeof f.slots!=="string")return!0;if(!k||k.ranges.length===0)return!1;return!0}),isBusinessHours:(p)=>R.gen(function*(){if(!(yield*A.isBusinessDay(p)))return!1;let f=n(p),y={hour:f.hours,minute:f.minutes},T=a(p);if(T&&typeof T.slots!=="string"){for(let I of T.slots)if(g(y,I))return!0;return!1}let E=l(p),k=c(E,f.weekDay);if(!k)return!1;for(let I of k.ranges)if(g(y,I))return!0;return!1}),addBusinessDays:(p,m)=>R.gen(function*(){if(m===0||!Number.isFinite(m))return p;let f=Math.max(-dr,Math.min(dr,Math.round(m))),y=p,T=Math.abs(f),E=f>0?1:-1,k=0;while(T>0&&k<dr*2)if(k++,y=O.add(y,{days:E}),yield*A.isBusinessDay(y))T--;return y}),addBusinessHours:(p,m)=>R.gen(function*(){if(m<=0||!Number.isFinite(m))return p;let f=Math.min(du,m),y=p,T=Math.round(f*60),E=0,k=T+ft*24*60;while(T>0&&E<k){if(E++,!(yield*A.isBusinessHours(y))){let G=yield*A.nextBusinessDay(y),se=yield*A.businessDayStart(G);if(le.isNone(se)){y=O.add(G,{days:1});continue}y=se.value;continue}let _=n(y),z={hour:_.hours,minute:_.minutes},L=a(y),ee;if(L&&typeof L.slots!=="string")ee=L.slots;else{let G=l(y);ee=c(G,_.weekDay)?.ranges??[]}let oe=0;for(let G of ee)if(g(z,G)){oe=x(z,G);break}if(oe>=T)return O.add(y,{minutes:T});T-=oe,y=O.add(y,{minutes:oe});let Ft=n(y),pn={hour:Ft.hours,minute:Ft.minutes},fn=!1;for(let G of ee){let se=v(G.open),bt=v(pn);if(se>bt&&!be(G)){let ti=se-bt;y=O.add(y,{minutes:ti}),fn=!0;break}}if(!fn){let G=yield*A.nextBusinessDay(y),se=yield*A.businessDayStart(G);if(le.isNone(se)){y=O.add(G,{days:1});continue}y=se.value}}return y}),nextBusinessDay:(p)=>R.gen(function*(){let m=O.add(p,{days:1}),f=n(m);m=r(f.year,f.month,f.day,0,0);let y=0;while(y<ft){if(y++,yield*A.isBusinessDay(m))return m;m=O.add(m,{days:1})}return yield*new Jt({message:`No business day found within ${ft} days of ${O.toUtc(p)}, possible misconfigured calendar`})}),previousBusinessDay:(p)=>R.gen(function*(){let m=n(p),f=r(m.year,m.month,m.day,0,0);f=O.add(f,{days:-1});let y=0;while(y<ft){if(y++,yield*A.isBusinessDay(f))return f;f=O.add(f,{days:-1})}return yield*new Jt({message:`No business day found within ${ft} days of ${O.toUtc(p)}, possible misconfigured calendar`})}),businessDayStart:(p)=>R.gen(function*(){if(!(yield*A.isBusinessDay(p)))return le.none();let f=n(p),y=a(p);if(y&&typeof y.slots!=="string"){let _=y.slots,z=_[0];if(!z)return le.none();let L=z.open;for(let ee of _)if(v(ee.open)<v(L))L=ee.open;return le.some(r(f.year,f.month,f.day,L.hour,L.minute))}let T=l(p),E=c(T,f.weekDay),k=E?.ranges[0];if(!E||!k)return le.none();let I=k.open;for(let _ of E.ranges)if(v(_.open)<v(I))I=_.open;return le.some(r(f.year,f.month,f.day,I.hour,I.minute))}),businessDayEnd:(p)=>R.gen(function*(){if(!(yield*A.isBusinessDay(p)))return le.none();let f=n(p),y=a(p);if(y&&typeof y.slots!=="string"){let _=y.slots,z=_[0];if(!z)return le.none();let L=z.close;for(let ee of _)if(be(ee))L=ee.close;else if(v(ee.close)>v(L)&&!be({open:z.open,close:L}))L=ee.close;return le.some(r(f.year,f.month,f.day,L.hour,L.minute))}let T=l(p),E=c(T,f.weekDay),k=E?.ranges[0];if(!E||!k)return le.none();let I=k.close;for(let _ of E.ranges)if(be(_))I=_.close;else if(v(_.close)>v(I)&&!be({open:k.open,close:I}))I=_.close;return le.some(r(f.year,f.month,f.day,I.hour,I.minute))}),businessHoursRemaining:(p)=>R.gen(function*(){if(!(yield*A.isBusinessHours(p)))return pt.zero;let f=n(p),y={hour:f.hours,minute:f.minutes},T=a(p),E;if(T&&typeof T.slots!=="string")E=T.slots;else{let _=l(p);E=c(_,f.weekDay)?.ranges??[]}let k=0,I=!1;for(let _ of E)if(g(y,_))k+=x(y,_),I=!0;else if(I&&v(_.open)>v(y))k+=v(_.close)-v(_.open);return pt.minutes(k)}),businessDaysBetween:(p,m)=>R.gen(function*(){let f=O.toEpochMillis(p),y=O.toEpochMillis(m);if(f>=y)return 0;let T=0,E=p;while(O.toEpochMillis(E)<y){if(yield*A.isBusinessDay(E))T++;E=O.add(E,{days:1})}return T}),businessHoursBetween:(p,m)=>R.gen(function*(){let f=O.toEpochMillis(p),y=O.toEpochMillis(m);if(f>=y)return pt.zero;let T=(oe,Ft,pn)=>R.gen(function*(){if(!(yield*A.isBusinessDay(oe)))return 0;let G=B(oe),se=0;for(let bt of G)se+=D(bt,Ft,pn);return se}),E=n(p),k=n(m),I=E.hours*60+E.minutes,_=k.hours*60+k.minutes;if(b(p,m)){let oe=yield*T(p,I,_);return pt.minutes(oe)}let z=0;z+=yield*T(p,I,1440);let L=r(E.year,E.month,E.day,12,0);L=O.add(L,{days:1});let ee=r(k.year,k.month,k.day,12,0);while(O.toEpochMillis(L)<O.toEpochMillis(ee)){z+=yield*T(L,0,1440);let oe=n(L);L=O.add(r(oe.year,oe.month,oe.day,12,0),{days:1})}return z+=yield*T(m,0,_),pt.minutes(z)}),isHoliday:(p)=>R.gen(function*(){let m=n(p),f=yield*s(m.year),y=O.unsafeMake({year:m.year,month:m.month,day:m.day});return ar(y,f)!==void 0}),getHolidaysForYear:(p)=>s(p),getActivePeriods:(p)=>R.succeed(d(p)),getActivePeriodsByType:(p,m)=>R.succeed(d(p).filter((f)=>f.type===m)),isWithinPeriodType:(p,m)=>R.succeed(d(p).some((f)=>f.type===m)),getPeriodsForDateRange:(p,m,f)=>R.succeed([...e.periods].filter((y)=>{if(f&&y.type!==f)return!1;let T=O.toEpochMillis(y.startDate),E=O.toEpochMillis(y.endDate),k=O.toEpochMillis(p),I=O.toEpochMillis(m);return T<=I&&E>=k})),getEffectiveSchedule:(p)=>R.sync(()=>{let m=a(p);if(m){if(m.slots==="closed")return[];return[{day:n(p).weekDay,ranges:[...m.slots]}]}return[...l(p)]})};return A}),by=au.effect(ir,R.flatMap(sr,uu));import{DateTime as ky}from"effect";import{DateTime as Ay,Duration as _y,Effect as Dy}from"effect";var Yy=cu.decodeSync(ct);import{Data as rn,Effect as Zy}from"effect";class lu extends rn.TaggedError("EmbeddedFormNotStartStepError"){}class pu extends rn.TaggedError("UnsupportedEmbeddedFormFieldError"){}class fu extends rn.TaggedError("EmbeddedFormMetadataBuildError"){}class mu extends rn.TaggedError("EmbeddedProcessHasMultipleStartStepsError"){}import{Data as Tu,Effect as Ag}from"effect";var hu=Q(ne(),1);class xu extends Tu.TaggedError("OrganisationFrontendManifestBuildError"){}import*as _e from"path";import*as Ou from"effect/Brand";import*as Ru from"effect/Context";import*as Au from"effect/Data";import*as ur from"effect/Channel";import*as Fu from"effect/Chunk";import{GenericTag as bu}from"effect/Context";import*as Se from"effect/Effect";import{identity as jg,pipe as Wg}from"effect/Function";import*as wu from"effect/Layer";import*as Eu from"effect/Option";import*as cr from"effect/Sink";import*as on from"effect/Stream";var Po=bu("@effect/platform/FileSystem");var mt=BigInt(1024),Hg=mt*mt*mt*mt*mt;var Co=Po;import{RUNTIME_ARTIFACT_FORMAT as _u,RUNTIME_ARTIFACT_VERSION as Du,Runtime as vo,parseServerPluginRegistrations as Pu}from"@processfocus/runtime";import{Config as Cu,Context as Iu,Data as vu,Effect as re,Either as uS,Layer as Mo}from"effect";class Je extends vu.TaggedError("processfocus:internal-tag/OrganisationLoadError"){}class yt extends Iu.Tag("processfocus:internal-tag/process/OrganisationProvider")(){}var Mu=(e)=>re.gen(function*(){let t=yield*Co,n=_e.resolve(process.cwd(),e),r=_e.join(n,"org.js"),o=_e.join(n,"src/index.ts"),s=(yield*t.exists(r))?r:o;if(!(yield*t.exists(s)))return yield*new Je({message:`Failed to load organisation from ${e}: Organisation file not found: ${s}`,orgPath:e});let d=yield*re.tryPromise({try:async()=>await import(s),catch:(F)=>new Je({message:`Failed to load organisation from ${e}: ${F instanceof Error?F.message:String(F)}`,orgPath:e,cause:F})}),u=yield*vo.loadArtifact(re.succeed({format:_u,version:Du,organisation:d.org})).pipe(re.mapError((F)=>new Je({message:`Failed to load organisation from ${e}: ${F.message}`,orgPath:e}))),{CustomDbLayer:l,CustomGraphqlSchema:c,CustomJobLayer:g}=d,x=yield*Pu(d.ServerPlugins).pipe(re.mapError((F)=>new Je({message:`Failed to load organisation from ${e}: ${F.message}`,orgPath:e,cause:F})));return{org:u.organisation,resolvedPath:n,...l?{customDbLayer:l}:{},...c?{customGraphqlSchema:c}:{},...g?{customJobLayer:g}:{},serverPlugins:x}}),$u=(e)=>vo.loadOrganisation({load:Mu},e),Nu=({org:e,orgPath:t,customDbLayer:n,customGraphqlSchema:r,customJobLayer:o,serverPlugins:i=[]})=>re.gen(function*(){let s=yield*Co,a=_e.join(t,"dist/graphql/org.graphql"),d=_e.join(t,"graphql/org.graphql"),l=(yield*s.exists(a))?a:d;return{organisation:e,orgPath:t,schemaPath:l,...n?{customDbLayer:n}:{},...r?{customGraphqlSchema:r}:{},...o?{customJobLayer:o}:{},serverPlugins:i}}),Lu=({org:e,orgPath:t,schemaPath:n,customGraphqlSchema:r,customJobLayer:o,serverPlugins:i=[]})=>{let s=n??_e.join(t,"dist/graphql/org.graphql");return{organisation:e,orgPath:t,schemaPath:s,...r?{customGraphqlSchema:r}:{},...o?{customJobLayer:o}:{},serverPlugins:i}},Bu=({name:e,customDbLayer:t,customJobLayer:n,serverPlugins:r=[]})=>re.gen(function*(){if(yield*re.log(`Loaded organisation: ${e}`),t)yield*re.log("Loaded custom database layer from organisation");if(n)yield*re.log("Loaded custom job layer from organisation");if(r.length>0)yield*re.log(`Loaded ${r.length} server plugin registration(s) from organisation`)}),lS=Mo.effect(yt,re.gen(function*(){let e=yield*Cu.string("PF_ORG").pipe(re.mapError(()=>new Je({message:"PF_ORG environment variable is not set",orgPath:"<env>"})));yield*re.log(`Loading organisation from: ${e}`);let{org:t,resolvedPath:n,customDbLayer:r,customGraphqlSchema:o,customJobLayer:i,serverPlugins:s}=yield*$u(e);return yield*Bu({name:t.name,customDbLayer:r,customJobLayer:i,serverPlugins:s}),yield*Nu({org:t,orgPath:n,customDbLayer:r,customGraphqlSchema:o,customJobLayer:i,serverPlugins:s})}));var $o=(e,t,n,r,o,i=[])=>Mo.succeed(yt,Lu({org:e,orgPath:t??process.cwd(),schemaPath:n,customGraphqlSchema:r,customJobLayer:o,serverPlugins:i}));var Uu=Q(ne(),1);var ju=Q(ne(),1);import{Duration as gS}from"effect";import{Context as Wu,Data as sn,DateTime as xS,Effect as FS,Option as bS,Schema as wS,SchemaAST as ES}from"effect";class Hu extends sn.TaggedError("SourceStepNotFoundForScheduleError"){}class qu extends sn.TaggedError("EdgeNotFoundForScheduleError"){}class Ku extends sn.TaggedError("ScheduleFunctionMissingError"){}class Vu extends sn.TaggedError("ScheduleEvaluationError"){}class zu extends Wu.Tag("processfocus:internal-tag/process/ScheduleEvaluator")(){}var Yu=Q(ne(),1);import{Context as lr,Data as gt,Effect as CS,Option as IS,Schema as vS}from"effect";class Gu extends gt.TaggedError("StepNotFoundError"){}class Qu extends gt.TaggedError("NotASystemStepError"){}class Ju extends gt.TaggedError("SystemStepExecutionError"){}class Zu extends gt.TaggedError("OutputValidationError"){}class Xu extends gt.TaggedError("LongDurationDispatchError"){}class ec extends lr.Tag("processfocus:internal-tag/process/LongDurationDispatcher")(){}class tc extends lr.Tag("processfocus:internal-tag/process/StepProcessStateReader")(){}class nc extends lr.Tag("processfocus:internal-tag/process/SystemStepExecutor")(){}import{Context as rc,Data as oc}from"effect";class ic extends oc.TaggedError("UsageCostError"){}class sc extends rc.Tag("processfocus:internal-tag/process/UsageCostService")(){}import{Data as an,Effect as X,Match as pe,Option as Lo}from"effect";import*as pr from"effect/SchemaAST";var ht=(e)=>!(e._tag==="Literal"&&e.literal===null),Ze=(e)=>{switch(typeof e){case"string":return"String";case"number":return"Float";case"boolean":return"Boolean";default:return}},St=(e)=>{let t=e.map((r)=>r._tag==="Literal"?Ze(r.literal):void 0),n=t[0];return n!==void 0&&t.every((r)=>r===n)?n:void 0};class we extends an.TaggedError("UnsupportedOutputSchemaTypeError"){get message(){return`Cannot generate GraphQL output type for field "${this.fieldName}": schema type "${this.schemaType}" is not supported`}}class Bo extends an.TaggedError("OutputIndexSignaturesNotSupportedError"){get message(){return"Index signatures are not supported in GraphQL output types"}}class Uo extends an.TaggedError("UnrecognizedOutputASTNodeError"){get message(){return`AST node type "${this.nodeTag}" is not recognized`}}class jo extends an.TaggedError("OutputInvalidPropertyKeyError"){get message(){return`Property keys must be strings, got: ${String(this.propertyKey)}`}}var Wo=(e)=>{if(typeof e==="symbol"||typeof e==="number")return X.fail(new jo({propertyKey:e}));return X.succeed(e)},Ho=(e,t)=>{let n=t.charAt(0).toUpperCase()+t.slice(1);return`${e}${n}`},ac=(e)=>{let t=pr.getAnnotation(e,Mt),n=Lo.getOrUndefined(t);return $t(n)?n:void 0},dc=(e,t,n)=>{let r=Ho(t,e),o=`${r}Field`,i=`${r}Bucket`;return{fieldDefinition:`${e}: ${r}${n?"":"!"}`,auxiliary:[`type ${o} {
6
6
  label: String!
7
7
  value: String!
8
8
  }`,`type ${i} {
@@ -16,35 +16,35 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
16
16
  badge: String
17
17
  fields: [${o}!]!
18
18
  buckets: [${i}!]!
19
- }`]}},$o=(e)=>{switch(e){case"StringKeyword":return"String";case"NumberKeyword":return"Float";case"BooleanKeyword":return"Boolean";default:return}},dn=(e,t)=>pe.type().pipe(pe.tag("TypeLiteral",(n)=>X.gen(function*(){let r=[],o=[];for(let s of n.propertySignatures){yield*jo(s.name);let a=yield*dc(s,t);if(a)r.push(a.fieldDefinition),o.push(...a.auxiliary)}if(n.indexSignatures.length>0)return yield*new Lo;return{main:`type ${t} {
19
+ }`]}},No=(e)=>{switch(e){case"StringKeyword":return"String";case"NumberKeyword":return"Float";case"BooleanKeyword":return"Boolean";default:return}},dn=(e,t)=>pe.type().pipe(pe.tag("TypeLiteral",(n)=>X.gen(function*(){let r=[],o=[];for(let s of n.propertySignatures){yield*Wo(s.name);let a=yield*uc(s,t);if(a)r.push(a.fieldDefinition),o.push(...a.auxiliary)}if(n.indexSignatures.length>0)return yield*new Bo;return{main:`type ${t} {
20
20
  ${r.map((s)=>` ${s}`).join(`
21
21
  `)}
22
- }`,auxiliary:o}})),pe.orElse((n)=>X.fail(new Bo({nodeTag:n._tag}))))(e),dc=(e,t)=>X.gen(function*(){let n=yield*jo(e.name),r=e.isOptional;if(sc(e.type)?.dataSource==="item")return ac(n,t,r);if(No.isSome(pr.getAnnotation(e.type,Te)))return null;return yield*Tt(e.type,n,t,r)}),Tt=(e,t,n,r)=>pe.type().pipe(pe.when((o)=>$o(o._tag)!==void 0,(o)=>{let i=$o(o._tag);if(!i)return X.fail(new we({fieldName:t,schemaType:o._tag}));let s=r?"":"!";return X.succeed({fieldDefinition:`${t}: ${i}${s}`,auxiliary:[]})}),pe.tag("Literal",(o)=>{let i=Je(o.literal);if(!i)return X.fail(new we({fieldName:t,schemaType:e._tag}));let s=r?"":"!";return X.succeed({fieldDefinition:`${t}: ${i}${s}`,auxiliary:[]})}),pe.tag("TypeLiteral",(o)=>X.gen(function*(){let i=Wo(n,t),s=yield*dn(o,i);return{fieldDefinition:`${t}: ${i}${r?"":"!"}`,auxiliary:[s.main,...s.auxiliary]}})),pe.tag("Refinement",(o)=>Tt(o.from,t,n,r)),pe.tag("Transformation",(o)=>Tt(o.to,t,n,r)),pe.tag("Union",(o)=>{let i=o.types.filter((d)=>d._tag!=="UndefinedKeyword"&&d._tag!=="VoidKeyword"&&ht(d)),s=St(i);if(s){let d=r||i.length!==o.types.length;return X.succeed({fieldDefinition:`${t}: ${s}${d?"":"!"}`,auxiliary:[]})}if(i.length>1)return X.fail(new we({fieldName:t,schemaType:e._tag}));let a=i[0];if(!a)return X.fail(new we({fieldName:t,schemaType:"Union (all undefined)"}));return Tt(a,t,n,r||i.length!==o.types.length)}),pe.tag("TupleType",(o)=>X.gen(function*(){if(o.rest.length===0)return yield*new we({fieldName:t,schemaType:"TupleType (no rest elements)"});let i=o.rest[0];if(!i)return yield*new we({fieldName:t,schemaType:"TupleType (no element type)"});let s=yield*Tt(i.type,`${t}Item`,n,!1),a=s.fieldDefinition.match(/:\s*(.+?)!?\s*$/);if(!a)return yield*new we({fieldName:t,schemaType:"TupleType (could not extract element type)"});let d=a[1]?.replace("!","")??"Unknown";return{fieldDefinition:`${t}: [${d}!]${r?"":"!"}`,auxiliary:s.auxiliary}})),pe.orElse(()=>X.fail(new we({fieldName:t,schemaType:e._tag}))))(e);import{Data as cn,Effect as K,Match as fe}from"effect";class De extends cn.TaggedError("UnsupportedSchemaTypeError"){get message(){return`Cannot generate GraphQL input type for field "${this.fieldName}": schema type "${this.schemaType}" is not supported`}}class qo extends cn.TaggedError("IndexSignaturesNotSupportedError"){get message(){return"Index signatures are not supported in GraphQL input types"}}class Ko extends cn.TaggedError("UnrecognizedASTNodeError"){get message(){return`AST node type "${this.nodeTag}" is not recognized`}}class Vo extends cn.TaggedError("InvalidPropertyKeyError"){get message(){return`Property keys must be strings, got: ${String(this.propertyKey)}`}}var zo=(e)=>{if(typeof e==="symbol"||typeof e==="number")return K.fail(new Vo({propertyKey:e}));return K.succeed(e)},Ho=(e,t)=>{let n=t.charAt(0).toUpperCase()+t.slice(1);return`${e}${n}Input`},fr=(e)=>{switch(e){case"StringKeyword":return"String";case"NumberKeyword":return"Float";case"BooleanKeyword":return"Boolean";default:return}},uc=(e)=>{if(e._tag==="Literal")return Je(e.literal);if(e._tag==="Union")return St(e.types.filter((t)=>t._tag!=="UndefinedKeyword"&&t._tag!=="VoidKeyword"&&ht(t)));return fr(e._tag)},Ze=(e,t)=>fe.type().pipe(fe.tag("TypeLiteral",(n)=>K.gen(function*(){let r=[],o=[];for(let s of n.propertySignatures){if(s.type._tag==="UndefinedKeyword"||s.type._tag==="VoidKeyword")continue;yield*zo(s.name);let a=yield*cc(s,t);r.push(a.fieldDefinition),o.push(...a.auxiliary)}if(n.indexSignatures.length>0)return yield*new qo;return{main:`input ${t} {
22
+ }`,auxiliary:o}})),pe.orElse((n)=>X.fail(new Uo({nodeTag:n._tag}))))(e),uc=(e,t)=>X.gen(function*(){let n=yield*Wo(e.name),r=e.isOptional;if(ac(e.type)?.dataSource==="item")return dc(n,t,r);if(Lo.isSome(pr.getAnnotation(e.type,Te)))return null;return yield*Tt(e.type,n,t,r)}),Tt=(e,t,n,r)=>pe.type().pipe(pe.when((o)=>No(o._tag)!==void 0,(o)=>{let i=No(o._tag);if(!i)return X.fail(new we({fieldName:t,schemaType:o._tag}));let s=r?"":"!";return X.succeed({fieldDefinition:`${t}: ${i}${s}`,auxiliary:[]})}),pe.tag("Literal",(o)=>{let i=Ze(o.literal);if(!i)return X.fail(new we({fieldName:t,schemaType:e._tag}));let s=r?"":"!";return X.succeed({fieldDefinition:`${t}: ${i}${s}`,auxiliary:[]})}),pe.tag("TypeLiteral",(o)=>X.gen(function*(){let i=Ho(n,t),s=yield*dn(o,i);return{fieldDefinition:`${t}: ${i}${r?"":"!"}`,auxiliary:[s.main,...s.auxiliary]}})),pe.tag("Refinement",(o)=>Tt(o.from,t,n,r)),pe.tag("Transformation",(o)=>Tt(o.to,t,n,r)),pe.tag("Union",(o)=>{let i=o.types.filter((d)=>d._tag!=="UndefinedKeyword"&&d._tag!=="VoidKeyword"&&ht(d)),s=St(i);if(s){let d=r||i.length!==o.types.length;return X.succeed({fieldDefinition:`${t}: ${s}${d?"":"!"}`,auxiliary:[]})}if(i.length>1)return X.fail(new we({fieldName:t,schemaType:e._tag}));let a=i[0];if(!a)return X.fail(new we({fieldName:t,schemaType:"Union (all undefined)"}));return Tt(a,t,n,r||i.length!==o.types.length)}),pe.tag("TupleType",(o)=>X.gen(function*(){if(o.rest.length===0)return yield*new we({fieldName:t,schemaType:"TupleType (no rest elements)"});let i=o.rest[0];if(!i)return yield*new we({fieldName:t,schemaType:"TupleType (no element type)"});let s=yield*Tt(i.type,`${t}Item`,n,!1),a=s.fieldDefinition.match(/:\s*(.+?)!?\s*$/);if(!a)return yield*new we({fieldName:t,schemaType:"TupleType (could not extract element type)"});let d=a[1]?.replace("!","")??"Unknown";return{fieldDefinition:`${t}: [${d}!]${r?"":"!"}`,auxiliary:s.auxiliary}})),pe.orElse(()=>X.fail(new we({fieldName:t,schemaType:e._tag}))))(e);import{Data as cn,Effect as K,Match as fe}from"effect";class De extends cn.TaggedError("UnsupportedSchemaTypeError"){get message(){return`Cannot generate GraphQL input type for field "${this.fieldName}": schema type "${this.schemaType}" is not supported`}}class Ko extends cn.TaggedError("IndexSignaturesNotSupportedError"){get message(){return"Index signatures are not supported in GraphQL input types"}}class Vo extends cn.TaggedError("UnrecognizedASTNodeError"){get message(){return`AST node type "${this.nodeTag}" is not recognized`}}class zo extends cn.TaggedError("InvalidPropertyKeyError"){get message(){return`Property keys must be strings, got: ${String(this.propertyKey)}`}}var Yo=(e)=>{if(typeof e==="symbol"||typeof e==="number")return K.fail(new zo({propertyKey:e}));return K.succeed(e)},qo=(e,t)=>{let n=t.charAt(0).toUpperCase()+t.slice(1);return`${e}${n}Input`},fr=(e)=>{switch(e){case"StringKeyword":return"String";case"NumberKeyword":return"Float";case"BooleanKeyword":return"Boolean";default:return}},cc=(e)=>{if(e._tag==="Literal")return Ze(e.literal);if(e._tag==="Union")return St(e.types.filter((t)=>t._tag!=="UndefinedKeyword"&&t._tag!=="VoidKeyword"&&ht(t)));return fr(e._tag)},Xe=(e,t)=>fe.type().pipe(fe.tag("TypeLiteral",(n)=>K.gen(function*(){let r=[],o=[];for(let s of n.propertySignatures){if(s.type._tag==="UndefinedKeyword"||s.type._tag==="VoidKeyword")continue;yield*Yo(s.name);let a=yield*lc(s,t);r.push(a.fieldDefinition),o.push(...a.auxiliary)}if(n.indexSignatures.length>0)return yield*new Ko;return{main:`input ${t} {
23
23
  ${r.map((s)=>` ${s}`).join(`
24
24
  `)}
25
- }`,auxiliary:o}})),fe.orElse((n)=>K.fail(new Ko({nodeTag:n._tag}))))(e),cc=(e,t)=>K.gen(function*(){let n=yield*zo(e.name),r=e.isOptional;return yield*un(e.type,n,t,r)}),un=(e,t,n,r)=>fe.type().pipe(fe.when((o)=>fr(o._tag)!==void 0,(o)=>{let i=fr(o._tag);if(!i)return K.fail(new De({fieldName:t,schemaType:o._tag}));let s=r?"":"!";return K.succeed({fieldDefinition:`${t}: ${i}${s}`,auxiliary:[]})}),fe.tag("Literal",(o)=>{let i=Je(o.literal);if(!i)return K.fail(new De({fieldName:t,schemaType:e._tag}));let s=r?"":"!";return K.succeed({fieldDefinition:`${t}: ${i}${s}`,auxiliary:[]})}),fe.tag("TypeLiteral",(o)=>K.gen(function*(){let i=Ho(n,t),s=yield*Ze(o,i);return{fieldDefinition:`${t}: ${i}${r?"":"!"}`,auxiliary:[s.main,...s.auxiliary]}})),fe.tag("TupleType",(o)=>{let i=o.rest[0];if(!i)return K.fail(new De({fieldName:t,schemaType:"TupleType (empty)"}));let s=i.type,a=r?"":"!";if(s._tag==="TypeLiteral"){let u=Ho(n,`${t}Item`);return Ze(s,u).pipe(K.map((l)=>({fieldDefinition:`${t}: [${u}!]${a}`,auxiliary:[l.main,...l.auxiliary]})))}let d=uc(s);if(d)return K.succeed({fieldDefinition:`${t}: [${d}!]${a}`,auxiliary:[]});return K.fail(new De({fieldName:t,schemaType:`TupleType (item: ${s._tag})`}))}),fe.tag("Refinement",(o)=>un(o.from,t,n,r)),fe.tag("Transformation",(o)=>un(o.from,t,n,r)),fe.tag("Union",(o)=>{let i=o.types.filter((d)=>d._tag!=="UndefinedKeyword"&&d._tag!=="VoidKeyword"&&ht(d)),s=St(i);if(s){let d=r||i.length!==o.types.length;return K.succeed({fieldDefinition:`${t}: ${s}${d?"":"!"}`,auxiliary:[]})}if(i.length>1)return K.fail(new De({fieldName:t,schemaType:e._tag}));let a=i[0];if(!a)return K.fail(new De({fieldName:t,schemaType:"Union (all undefined)"}));return un(a,t,n,r||i.length!==o.types.length)}),fe.orElse(()=>K.fail(new De({fieldName:t,schemaType:e._tag}))))(e);class Xe extends mr.TaggedError("InvalidProcessGraph"){}class Yo extends mr.TaggedError("NoStartNodeError"){get message(){return`Process "${this.processPath}" has no start nodes`}}var ln=de,lc=/^[_A-Za-z][_0-9A-Za-z]*$/,pc=(e)=>C.gen(function*(){let t=e.startNodes();if(t.length===0)return yield*new Yo({processPath:e.node.path});return t[0]}),Go=(e)=>C.gen(function*(){let t=[];for(let n of e.node.children)if(st(n)){let r=yield*Go(n);t.push(...r)}else if(Ie(n)){let r=yield*C.try({try:()=>n.getGraph(),catch:(i)=>new Xe({processPath:n.node.path,cause:i})}),o=r.nodes();for(let i of o){let s=r.getNodeAttributes(i);if(it(s))t.push(s)}}return t}),Qo=(e)=>C.gen(function*(){let t=[];for(let n of e.node.children)if(st(n)){let r=yield*Qo(n);t.push(...r)}else if(Ie(n))t.push(n);return t}),Jo=(e)=>C.gen(function*(){let t=[];for(let n of e.node.children)if(st(n)){let r=yield*Jo(n);t.push(...r)}else if(Hn(n))t.push(n);return t});class Me extends mr.TaggedError("InvalidListSchema"){get message(){let e=this.cause instanceof Error?`: ${this.cause.message}`:"";return`Invalid list schema for ${this.listPath}${e}`}}var fc=(e)=>C.gen(function*(){let t=`${de(e.node.path)}Item`,n=xt.Struct(e.output);return yield*dn(n.ast,t).pipe(C.mapError((o)=>new Me({listPath:e.node.path,cause:o})))}),mc=(e)=>C.gen(function*(){if(!e.hasForm||!e.formFields)return null;let t=`${de(e.node.path)}Detail`,n=xt.Struct(e.formFields);return yield*dn(n.ast,t).pipe(C.mapError((o)=>new Me({listPath:e.node.path,cause:o})))}),yc=(e)=>C.gen(function*(){if(!e.hasForm)return null;let t=de(e.node.path),n=e.itemQueryName(),r=`${t}Detail`,o=[];for(let s of e.itemQueryControls()){if(!lc.test(s.name)||s.name==="id")return yield*C.fail(new Me({listPath:e.node.path,cause:Error(`MetricBreakdown control name "${s.name}" is not a safe GraphQL item query argument name`)}));o.push(`${s.name}: String`)}let i=["id: String!",...o];return` ${n}(${i.join(", ")}): ${r}`}),gc=(e)=>{let t=de(e.node.path),n=`${t}Item`;return`type ${`${t}Page`} {
25
+ }`,auxiliary:o}})),fe.orElse((n)=>K.fail(new Vo({nodeTag:n._tag}))))(e),lc=(e,t)=>K.gen(function*(){let n=yield*Yo(e.name),r=e.isOptional;return yield*un(e.type,n,t,r)}),un=(e,t,n,r)=>fe.type().pipe(fe.when((o)=>fr(o._tag)!==void 0,(o)=>{let i=fr(o._tag);if(!i)return K.fail(new De({fieldName:t,schemaType:o._tag}));let s=r?"":"!";return K.succeed({fieldDefinition:`${t}: ${i}${s}`,auxiliary:[]})}),fe.tag("Literal",(o)=>{let i=Ze(o.literal);if(!i)return K.fail(new De({fieldName:t,schemaType:e._tag}));let s=r?"":"!";return K.succeed({fieldDefinition:`${t}: ${i}${s}`,auxiliary:[]})}),fe.tag("TypeLiteral",(o)=>K.gen(function*(){let i=qo(n,t),s=yield*Xe(o,i);return{fieldDefinition:`${t}: ${i}${r?"":"!"}`,auxiliary:[s.main,...s.auxiliary]}})),fe.tag("TupleType",(o)=>{let i=o.rest[0];if(!i)return K.fail(new De({fieldName:t,schemaType:"TupleType (empty)"}));let s=i.type,a=r?"":"!";if(s._tag==="TypeLiteral"){let u=qo(n,`${t}Item`);return Xe(s,u).pipe(K.map((l)=>({fieldDefinition:`${t}: [${u}!]${a}`,auxiliary:[l.main,...l.auxiliary]})))}let d=cc(s);if(d)return K.succeed({fieldDefinition:`${t}: [${d}!]${a}`,auxiliary:[]});return K.fail(new De({fieldName:t,schemaType:`TupleType (item: ${s._tag})`}))}),fe.tag("Refinement",(o)=>un(o.from,t,n,r)),fe.tag("Transformation",(o)=>un(o.from,t,n,r)),fe.tag("Union",(o)=>{let i=o.types.filter((d)=>d._tag!=="UndefinedKeyword"&&d._tag!=="VoidKeyword"&&ht(d)),s=St(i);if(s){let d=r||i.length!==o.types.length;return K.succeed({fieldDefinition:`${t}: ${s}${d?"":"!"}`,auxiliary:[]})}if(i.length>1)return K.fail(new De({fieldName:t,schemaType:e._tag}));let a=i[0];if(!a)return K.fail(new De({fieldName:t,schemaType:"Union (all undefined)"}));return un(a,t,n,r||i.length!==o.types.length)}),fe.orElse(()=>K.fail(new De({fieldName:t,schemaType:e._tag}))))(e);class et extends mr.TaggedError("InvalidProcessGraph"){}class Go extends mr.TaggedError("NoStartNodeError"){get message(){return`Process "${this.processPath}" has no start nodes`}}var ln=de,pc=/^[_A-Za-z][_0-9A-Za-z]*$/,fc=(e)=>C.gen(function*(){let t=e.startNodes();if(t.length===0)return yield*new Go({processPath:e.node.path});return t[0]}),Qo=(e)=>C.gen(function*(){let t=[];for(let n of e.node.children)if(st(n)){let r=yield*Qo(n);t.push(...r)}else if(Ie(n)){let r=yield*C.try({try:()=>n.getGraph(),catch:(i)=>new et({processPath:n.node.path,cause:i})}),o=r.nodes();for(let i of o){let s=r.getNodeAttributes(i);if(He(s))t.push(s)}}return t}),Jo=(e)=>C.gen(function*(){let t=[];for(let n of e.node.children)if(st(n)){let r=yield*Jo(n);t.push(...r)}else if(Ie(n))t.push(n);return t}),Zo=(e)=>C.gen(function*(){let t=[];for(let n of e.node.children)if(st(n)){let r=yield*Zo(n);t.push(...r)}else if(Hn(n))t.push(n);return t});class Me extends mr.TaggedError("InvalidListSchema"){get message(){let e=this.cause instanceof Error?`: ${this.cause.message}`:"";return`Invalid list schema for ${this.listPath}${e}`}}var mc=(e)=>C.gen(function*(){let t=`${de(e.node.path)}Item`,n=xt.Struct(e.output);return yield*dn(n.ast,t).pipe(C.mapError((o)=>new Me({listPath:e.node.path,cause:o})))}),yc=(e)=>C.gen(function*(){if(!e.hasForm||!e.formFields)return null;let t=`${de(e.node.path)}Detail`,n=xt.Struct(e.formFields);return yield*dn(n.ast,t).pipe(C.mapError((o)=>new Me({listPath:e.node.path,cause:o})))}),gc=(e)=>C.gen(function*(){if(!e.hasForm)return null;let t=de(e.node.path),n=e.itemQueryName(),r=`${t}Detail`,o=[];for(let s of e.itemQueryControls()){if(!pc.test(s.name)||s.name==="id")return yield*C.fail(new Me({listPath:e.node.path,cause:Error(`MetricBreakdown control name "${s.name}" is not a safe GraphQL item query argument name`)}));o.push(`${s.name}: String`)}let i=["id: String!",...o];return` ${n}(${i.join(", ")}): ${r}`}),hc=(e)=>{let t=de(e.node.path),n=`${t}Item`;return`type ${`${t}Page`} {
26
26
  items: [${n}!]!
27
27
  totalCount: Int!
28
28
  page: Int!
29
29
  limit: Int!
30
30
  hasNextPage: Boolean!
31
- }`},hc=(e)=>{let t=de(e.node.path),n=e.queryName(),r=`${t}Page`,i=["page: Int! = 1",`limit: Int! = ${e.defaultPageSize}`,"filter: String","sort: ListSortInput"];return` ${n}(${i.join(", ")}): ${r}!`},Sc=(e)=>C.gen(function*(){if(!e.hasUpdate||!e.hasForm||!e.formFields)return null;let t=e.updateInputTypeName(),n=xt.Struct(e.editableFormFields()),r=yield*nt(n).pipe(C.mapError((i)=>new Me({listPath:e.node.path,cause:i})));return yield*Ze(r.ast,t).pipe(C.mapError((i)=>new Me({listPath:e.node.path,cause:i})))}),Tc=(e)=>{if(!e.hasUpdate||!e.hasForm)return null;let t=de(e.node.path),n=e.updateMutationName(),r=e.updateInputTypeName(),o=`${t}Detail`;return` ${n}(id: String!, input: ${r}!): ${o}`},xc=(e)=>{if(!e.hasDelete)return null;return` ${e.deleteMutationName()}(id: String!): Boolean!`},Fc=(e)=>C.gen(function*(){let t=e.createSubmissionSchema(),n=t?yield*Ze(t.ast,e.createInputTypeName()).pipe(C.mapError((g)=>new Me({listPath:e.node.path,cause:g}))):null,r=e.hasCreate?` ${e.createMutationName()}(input: ${e.createInputTypeName()}!): String!`:null,o=yield*fc(e),i=gc(e),s=hc(e),a=yield*mc(e),d=yield*yc(e),u=yield*Sc(e),l=Tc(e),c=xc(e);return{itemTypes:o,pageType:i,query:s,detailType:a,itemQuery:d,createInputType:n,createMutation:r,updateInputType:u,updateMutation:l,deleteMutation:c}}),bc=(e)=>C.gen(function*(){let t=ln(e.node.path),n=xt.Struct(e.output),r=yield*nt(n).pipe(C.mapError((i)=>new Xe({processPath:e.node.path,cause:i})));if(Object.keys(r.fields).length===0)return{main:`input ${t} {
31
+ }`},Sc=(e)=>{let t=de(e.node.path),n=e.queryName(),r=`${t}Page`,i=["page: Int! = 1",`limit: Int! = ${e.defaultPageSize}`,"filter: String","sort: ListSortInput"];return` ${n}(${i.join(", ")}): ${r}!`},Tc=(e)=>C.gen(function*(){if(!e.hasUpdate||!e.hasForm||!e.formFields)return null;let t=e.updateInputTypeName(),n=xt.Struct(e.editableFormFields()),r=yield*rt(n).pipe(C.mapError((i)=>new Me({listPath:e.node.path,cause:i})));return yield*Xe(r.ast,t).pipe(C.mapError((i)=>new Me({listPath:e.node.path,cause:i})))}),xc=(e)=>{if(!e.hasUpdate||!e.hasForm)return null;let t=de(e.node.path),n=e.updateMutationName(),r=e.updateInputTypeName(),o=`${t}Detail`;return` ${n}(id: String!, input: ${r}!): ${o}`},Fc=(e)=>{if(!e.hasDelete)return null;return` ${e.deleteMutationName()}(id: String!): Boolean!`},bc=(e)=>C.gen(function*(){let t=e.createSubmissionSchema(),n=t?yield*Xe(t.ast,e.createInputTypeName()).pipe(C.mapError((g)=>new Me({listPath:e.node.path,cause:g}))):null,r=e.hasCreate?` ${e.createMutationName()}(input: ${e.createInputTypeName()}!): String!`:null,o=yield*mc(e),i=hc(e),s=Sc(e),a=yield*yc(e),d=yield*gc(e),u=yield*Tc(e),l=xc(e),c=Fc(e);return{itemTypes:o,pageType:i,query:s,detailType:a,itemQuery:d,createInputType:n,createMutation:r,updateInputType:u,updateMutation:l,deleteMutation:c}}),wc=(e)=>C.gen(function*(){let t=ln(e.node.path),n=xt.Struct(e.output),r=yield*rt(n).pipe(C.mapError((i)=>new et({processPath:e.node.path,cause:i})));if(Object.keys(r.fields).length===0)return{main:`input ${t} {
32
32
  _dummy: String
33
- }`,auxiliary:[]};return yield*Ze(r.ast,t).pipe(C.mapError((i)=>new Xe({processPath:e.node.path,cause:i})))}),wc=(e)=>C.gen(function*(){let t=yield*pc(e),n=e.startMutationName(),o=(t.isForm?t:null)?.embed?' @auth(tag: "embed")':e.props.cron&&t.isSystemStep?' @auth(tag: "cron")':"";if(!(t.isForm&&t.output&&Object.keys(t.output).length>0))return[` ${n}(executionId: ID, withoutWaiting: Boolean = false): StartProcessPayload!${o}`];let s=ln(t.node.path);return[` ${n}(input: ${s}!, executionId: ID, withoutWaiting: Boolean = false): StartProcessPayload!${o}`]}),Ec=(e)=>C.gen(function*(){let t=yield*C.try({try:()=>e.getGraph(),catch:(o)=>new Xe({processPath:e.node.path,cause:o})}),n=[],r=t.nodes();for(let o of r){let i=t.getNodeAttributes(o);if(it(i)){let a=`complete${ln(i.node.path)}`,d=xt.Struct(i.output),u=yield*nt(d).pipe(C.mapError((c)=>new Xe({processPath:e.node.path,cause:c})));if(Object.keys(u.fields).length===0)n.push(` ${a}(todoId: ID!): CompleteStepPayload!`);else{let c=ln(i.node.path);n.push(` ${a}(todoId: ID!, input: ${c}!): CompleteStepPayload!`)}}}return n}),kc=(e)=>{let t=[],n=[];for(let{form:r}of e.forms()){let o=r.lookupOverrides();for(let[i,s]of o){if(!s.dependencies||s.dependencies.length===0)continue;let a=r.lookupQueryName(i),d=`${a.charAt(0).toUpperCase()+a.slice(1)}Input`,u=s.dependencies.map((c)=>` ${c}: String!`).join(`
33
+ }`,auxiliary:[]};return yield*Xe(r.ast,t).pipe(C.mapError((i)=>new et({processPath:e.node.path,cause:i})))}),Ec=(e)=>C.gen(function*(){let t=yield*fc(e),n=e.startMutationName(),o=(t.isForm?t:null)?.embed?' @auth(tag: "embed")':e.props.cron&&t.isSystemStep?' @auth(tag: "cron")':"";if(!(t.isForm&&t.output&&Object.keys(t.output).length>0))return[` ${n}(executionId: ID, withoutWaiting: Boolean = false): StartProcessPayload!${o}`];let s=ln(t.node.path);return[` ${n}(input: ${s}!, executionId: ID, withoutWaiting: Boolean = false): StartProcessPayload!${o}`]}),kc=(e)=>C.gen(function*(){let t=yield*C.try({try:()=>e.getGraph(),catch:(o)=>new et({processPath:e.node.path,cause:o})}),n=[],r=t.nodes();for(let o of r){let i=t.getNodeAttributes(o);if(He(i)){let a=`complete${ln(i.node.path)}`,d=xt.Struct(i.output),u=yield*rt(d).pipe(C.mapError((c)=>new et({processPath:e.node.path,cause:c})));if(Object.keys(u.fields).length===0)n.push(` ${a}(todoId: ID!): CompleteStepPayload!`);else{let c=ln(i.node.path);n.push(` ${a}(todoId: ID!, input: ${c}!): CompleteStepPayload!`)}}}return n}),Oc=(e)=>{let t=[],n=[];for(let{form:r}of e.forms()){let o=r.lookupOverrides();for(let[i,s]of o){if(!s.dependencies||s.dependencies.length===0)continue;let a=r.lookupQueryName(i),d=`${a.charAt(0).toUpperCase()+a.slice(1)}Input`,u=s.dependencies.map((c)=>` ${c}: String!`).join(`
34
34
  `);t.push(`input ${d} {
35
35
  filter: String
36
36
  ${u}
37
- }`);let l=r.embed?' @auth(tag: "embed")':"";n.push(` ${a}(input: ${d}!, limit: Int): [LookupItem!]!${l}`)}}return{inputTypes:t,queryFields:n}},Oc=`type StartProcessPayload {
37
+ }`);let l=r.embed?' @auth(tag: "embed")':"";n.push(` ${a}(input: ${d}!, limit: Int): [LookupItem!]!${l}`)}}return{inputTypes:t,queryFields:n}},Rc=`type StartProcessPayload {
38
38
  deduplicated: Boolean!
39
39
  executionId: ID!
40
40
  processId: ID!
41
41
  processPath: String!
42
42
  timestamp: DateTimeISO!
43
- }`,Rc=`type CompleteStepPayload {
43
+ }`,Ac=`type CompleteStepPayload {
44
44
  executionId: ID!
45
45
  stepPath: String!
46
46
  timestamp: DateTimeISO!
47
- }`,Zo=()=>C.gen(function*(){let{organisation:e,customGraphqlSchema:t}=yield*yt,n=yield*Go(e),r=yield*C.forEach(n,(b)=>bc(b)),o=new Set,i=[];for(let b of r){i.push(b.main);for(let A of b.auxiliary)o.add(A)}let s=yield*Qo(e),a=yield*C.forEach(s,(b)=>wc(b)),d=yield*C.forEach(s,(b)=>Ec(b)),u=[...a.flat(),...d.flat()],l=[],c=[];for(let b of s){let{inputTypes:A,queryFields:p}=kc(b);l.push(...A),c.push(...p)}let g=yield*Jo(e),x=yield*C.forEach(g,(b)=>Fc(b)),F=[],N=[];for(let b of x){F.push(b.itemTypes.main);for(let A of b.itemTypes.auxiliary)F.push(A);if(F.push(b.pageType),b.detailType){F.push(b.detailType.main);for(let A of b.detailType.auxiliary)F.push(A)}if(b.createInputType)F.push(b.createInputType.main,...b.createInputType.auxiliary);if(b.createMutation)u.push(b.createMutation);if(b.updateInputType){F.push(b.updateInputType.main);for(let A of b.updateInputType.auxiliary)F.push(A)}if(N.push(b.query),b.itemQuery)N.push(b.itemQuery);if(b.updateMutation)u.push(b.updateMutation);if(b.deleteMutation)u.push(b.deleteMutation)}let D=[];if(D.push(Oc),D.push(Rc),o.size>0)D.push(...o);if(i.length>0)D.push(...i);if(l.length>0)D.push(...l);if(F.length>0)D.push(...F);if(u.length>0){let b=`type Mutation {
47
+ }`,Xo=()=>C.gen(function*(){let{organisation:e,customGraphqlSchema:t}=yield*yt,n=yield*Qo(e),r=yield*C.forEach(n,(b)=>wc(b)),o=new Set,i=[];for(let b of r){i.push(b.main);for(let A of b.auxiliary)o.add(A)}let s=yield*Jo(e),a=yield*C.forEach(s,(b)=>Ec(b)),d=yield*C.forEach(s,(b)=>kc(b)),u=[...a.flat(),...d.flat()],l=[],c=[];for(let b of s){let{inputTypes:A,queryFields:p}=Oc(b);l.push(...A),c.push(...p)}let g=yield*Zo(e),x=yield*C.forEach(g,(b)=>bc(b)),F=[],N=[];for(let b of x){F.push(b.itemTypes.main);for(let A of b.itemTypes.auxiliary)F.push(A);if(F.push(b.pageType),b.detailType){F.push(b.detailType.main);for(let A of b.detailType.auxiliary)F.push(A)}if(b.createInputType)F.push(b.createInputType.main,...b.createInputType.auxiliary);if(b.createMutation)u.push(b.createMutation);if(b.updateInputType){F.push(b.updateInputType.main);for(let A of b.updateInputType.auxiliary)F.push(A)}if(N.push(b.query),b.itemQuery)N.push(b.itemQuery);if(b.updateMutation)u.push(b.updateMutation);if(b.deleteMutation)u.push(b.deleteMutation)}let D=[];if(D.push(Rc),D.push(Ac),o.size>0)D.push(...o);if(i.length>0)D.push(...i);if(l.length>0)D.push(...l);if(F.length>0)D.push(...F);if(u.length>0){let b=`type Mutation {
48
48
  ${u.join(`
49
49
  `)}
50
50
  }`;D.push(b)}let B=[...N,...c];if(B.length>0){let b=`type Query {
@@ -52,4 +52,4 @@ ${B.join(`
52
52
  `)}
53
53
  }`;D.push(b)}if(t?.typeDefs)D.push(t.typeDefs);return D.join(`
54
54
 
55
- `)});var jT=(e,t,n)=>Xo.runPromise(Zo().pipe(Xo.provide(Mo(e,t,void 0,n))));export{jT as buildBundledGraphqlSchema};
55
+ `)});var HT=(e,t,n)=>ei.runPromise(Xo().pipe(ei.provide($o(e,t,void 0,n))));export{HT as buildBundledGraphqlSchema};