@nodegx/mcp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/backend/cli.js +102959 -0
  2. package/dist/cloud-bundle.cjs +35311 -2409
  3. package/dist/kit-extract.cjs +732 -545
  4. package/dist/kit-extract.inputs.json +115 -113
  5. package/dist/node-catalog.json +502 -59
  6. package/dist/noodl-mcp.cjs +44889 -9360
  7. package/dist/package.json +6 -0
  8. package/dist/preset-fonts/dm-sans/OFL.txt +93 -0
  9. package/dist/preset-fonts/dm-sans/dm-sans-latin-ext-wght-normal.woff2 +0 -0
  10. package/dist/preset-fonts/dm-sans/dm-sans-latin-wght-normal.woff2 +0 -0
  11. package/dist/preset-fonts/dm-sans/manifest.json +9 -0
  12. package/dist/preset-fonts/dm-sans/styles.css +25 -0
  13. package/dist/preset-fonts/nunito/OFL.txt +93 -0
  14. package/dist/preset-fonts/nunito/manifest.json +9 -0
  15. package/dist/preset-fonts/nunito/nunito-latin-ext-wght-normal.woff2 +0 -0
  16. package/dist/preset-fonts/nunito/nunito-latin-wght-normal.woff2 +0 -0
  17. package/dist/preset-fonts/nunito/styles.css +25 -0
  18. package/dist/preset-fonts/source-sans-3/OFL.txt +93 -0
  19. package/dist/preset-fonts/source-sans-3/manifest.json +9 -0
  20. package/dist/preset-fonts/source-sans-3/source-sans-3-latin-ext-wght-normal.woff2 +0 -0
  21. package/dist/preset-fonts/source-sans-3/source-sans-3-latin-wght-normal.woff2 +0 -0
  22. package/dist/preset-fonts/source-sans-3/styles.css +25 -0
  23. package/dist/render-harness/data/node-catalog-enriched.json +93650 -0
  24. package/dist/render-harness/data/node-catalog.json +65289 -0
  25. package/dist/render-harness/data/tokens.ts +674 -0
  26. package/dist/render-harness/drive-steps.js +2784 -0
  27. package/dist/render-harness/measure-from-disk.js +2366 -0
  28. package/dist/render-harness/node_modules/ws/LICENSE +20 -0
  29. package/dist/render-harness/node_modules/ws/README.md +548 -0
  30. package/dist/render-harness/node_modules/ws/browser.js +8 -0
  31. package/dist/render-harness/node_modules/ws/index.js +22 -0
  32. package/dist/render-harness/node_modules/ws/lib/buffer-util.js +131 -0
  33. package/dist/render-harness/node_modules/ws/lib/constants.js +19 -0
  34. package/dist/render-harness/node_modules/ws/lib/event-target.js +292 -0
  35. package/dist/render-harness/node_modules/ws/lib/extension.js +203 -0
  36. package/dist/render-harness/node_modules/ws/lib/limiter.js +55 -0
  37. package/dist/render-harness/node_modules/ws/lib/permessage-deflate.js +528 -0
  38. package/dist/render-harness/node_modules/ws/lib/receiver.js +743 -0
  39. package/dist/render-harness/node_modules/ws/lib/sender.js +607 -0
  40. package/dist/render-harness/node_modules/ws/lib/stream.js +161 -0
  41. package/dist/render-harness/node_modules/ws/lib/subprotocol.js +62 -0
  42. package/dist/render-harness/node_modules/ws/lib/validation.js +152 -0
  43. package/dist/render-harness/node_modules/ws/lib/websocket-server.js +562 -0
  44. package/dist/render-harness/node_modules/ws/lib/websocket.js +1407 -0
  45. package/dist/render-harness/node_modules/ws/package.json +74 -0
  46. package/dist/render-harness/node_modules/ws/wrapper.mjs +21 -0
  47. package/dist/render-harness/render-from-disk.js +7306 -0
  48. package/dist/src/external/viewer/global.d.ts.keep +718 -0
  49. package/dist/src/external/viewer/index.html +126 -0
  50. package/dist/src/external/viewer/load_terminator.js +1 -0
  51. package/dist/src/external/viewer/ndl_assets/OpenSans-Bold.ttf +0 -0
  52. package/dist/src/external/viewer/ndl_assets/OpenSans-Regular.ttf +0 -0
  53. package/dist/src/external/viewer/ndl_assets/home-icon.svg +3 -0
  54. package/dist/src/external/viewer/ndl_assets/make-home-instructions@2x.png +0 -0
  55. package/dist/src/external/viewer/ndl_assets/noodl-logo-black.svg +3 -0
  56. package/dist/src/external/viewer/noodl-app.png +0 -0
  57. package/dist/src/external/viewer/noodl.viewer.js +2 -0
  58. package/dist/src/external/viewer/noodl.viewer.js.LICENSE.txt +20 -0
  59. package/dist/src/external/viewer/react-dom.production.min.js +267 -0
  60. package/dist/src/external/viewer/react.production.min.js +31 -0
  61. package/dist/src/external/viewer/react19/VERSION +2 -0
  62. package/dist/src/external/viewer/react19/react-dom.production.min.js +51 -0
  63. package/dist/src/external/viewer/react19/react.production.min.js +21 -0
  64. package/package.json +8 -2
@@ -0,0 +1,2 @@
1
+ /*! For license information please see noodl.viewer.js.LICENSE.txt */
2
+ (()=>{var __webpack_modules__={8454(e){var t=.1,n="function"==typeof Float32Array;function i(e,t){return 1-3*t+3*e}function o(e,t){return 3*t-6*e}function r(e){return 3*e}function s(e,t,n){return((i(t,n)*e+o(t,n))*e+r(t))*e}function a(e,t,n){return 3*i(t,n)*e*e+2*o(t,n)*e+r(t)}function l(e,t,i,o){if(4===arguments.length)return new l([e,t,i,o]);if(!(this instanceof l))return new l(e);if(!e||4!==e.length)throw new Error("BezierEasing: points must contains 4 values");for(var r=0;r<4;++r)if("number"!=typeof e[r]||isNaN(e[r])||!isFinite(e[r]))throw new Error("BezierEasing: points should be integers.");if(e[0]<0||e[0]>1||e[2]<0||e[2]>1)throw new Error("BezierEasing x values must be in [0, 1] range.");this._str="BezierEasing("+e+")",this._css="cubic-bezier("+e+")",this._p=e,this._mSampleValues=n?new Float32Array(11):new Array(11),this._precomputed=!1,this.get=this.get.bind(this)}l.prototype={get:function(e){var t=this._p[0],n=this._p[1],i=this._p[2],o=this._p[3];return this._precomputed||this._precompute(),t===n&&i===o?e:0===e?0:1===e?1:s(this._getTForX(e),n,o)},getPoints:function(){return this._p},toString:function(){return this._str},toCSS:function(){return this._css},_precompute:function(){var e=this._p[0],t=this._p[1],n=this._p[2],i=this._p[3];this._precomputed=!0,e===t&&n===i||this._calcSampleValues()},_calcSampleValues:function(){for(var e=this._p[0],n=this._p[2],i=0;i<11;++i)this._mSampleValues[i]=s(i*t,e,n)},_getTForX:function(e){for(var n=this._p[0],i=this._p[2],o=this._mSampleValues,r=0,l=1;10!==l&&o[l]<=e;++l)r+=t;var u=r+(e-o[--l])/(o[l+1]-o[l])*t,c=a(u,n,i);return c>=.001?function(e,t,n,i){for(var o=0;o<4;++o){var r=a(t,n,i);if(0===r)return t;t-=(s(t,n,i)-e)/r}return t}(e,u,n,i):0===c?u:function(e,t,n,i,o){var r,a,l=0;do{(r=s(a=t+(n-t)/2,i,o)-e)>0?n=a:t=a}while(Math.abs(r)>1e-7&&++l<10);return a}(e,r,r+t,n,i)}},l.css={ease:l.ease=l(.25,.1,.25,1),linear:l.linear=l(0,0,1,1),"ease-in":l.easeIn=l(.42,0,1,1),"ease-out":l.easeOut=l(0,0,.58,1),"ease-in-out":l.easeInOut=l(.42,0,.58,1)},e.exports=l},3705(e){function t(e){var n,i,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(n=0;n<r;n++)e[n]&&(i=t(e[n]))&&(o&&(o+=" "),o+=i)}else for(i in e)e[i]&&(o&&(o+=" "),o+=i);return o}function n(){for(var e,n,i=0,o="",r=arguments.length;i<r;i++)(e=arguments[i])&&(n=t(e))&&(o&&(o+=" "),o+=n);return o}e.exports=n,e.exports.clsx=n},2097(e,t,n){"use strict";var i=n(7087),o=n.n(i),r=n(9571),s=n.n(r)()(o());s.push([e.id,".ndl-visual-text {\n font-weight: 400;\n margin: 0;\n}\n\n.ndl-controls-pointer,\n.ndl-controls-pointer * {\n cursor: pointer;\n}\n\n.ndl-controls-abs-center {\n position: absolute;\n transform: translate(-50%, -50%);\n left: 50%;\n top: 50%;\n}\n\n/** Button **/\n.ndl-controls-button {\n /* 🔴 P78 D18 / phase-80 Track C2. Form controls do NOT inherit `font-family`\n from `body` in any browser — the UA stylesheet sets its own — so every\n button in every app rendered in the browser's default face (Arial) while\n the `Text` beside it correctly used the project's `--font-sans`. Measured\n on the members-area template with `getComputedStyle` across eleven pages.\n\n ⚠️ `font-family` only, deliberately. Size and weight were not measured, and\n adding `font-size: inherit` here would change the metrics of every existing\n button rather than fix a reported defect. */\n font-family: inherit;\n outline: none;\n border: none;\n color: white;\n background-color: black;\n padding: 5px 20px 5px 20px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ndl-controls-button:disabled {\n cursor: default;\n}\n\n/* 🔴 P88 s23 (ruled; the defect P41 ACC-001 names). Every control below sets\n `outline: none` and nothing ever drew a replacement, so a keyboard person\n could not see what held the focus: Rocket School's Next, focused by its Focus\n wire, and an option reached by Tab both matched `:focus-visible` and read\n `outline-style: none`. The ring is drawn for keyboard focus only\n (`:focus-visible`, so a mouse click draws nothing), in the project's own\n `--ring` token (Minimal, Playful, Enterprise and Soft all declare one; so do\n the templates), offset so the ground shows between it and the control.\n ⚠️ Not `outline: auto`: measured first, the platform's thin two-tone ring sat\n on Rocket School's dark border and hard shadow and could hardly be seen.\n 3px, not 2px: at 2px beside a template's 3px border it read as a double border.\n `#101010` is Chromium's own ring colour, for a project with no `--ring`.\n The Text Input keeps `outline: none`: its caret is its focus indicator. */\n.ndl-controls-button:focus-visible,\n.ndl-controls-checkbox:focus-visible,\n.ndl-controls-radiobutton:focus-visible,\n.ndl-controls-select:focus-visible,\n.ndl-controls-range2:focus-visible,\n.ndl-controls-range:focus-visible {\n outline: var(--ring-width, 3px) solid var(--ring, #101010);\n outline-offset: 2px;\n}\n\n/* 🔴 P88 GAM-026 (ruled). The rule above lands on the element that HAS the focus, and for the\n three controls a person places today that element is invisible: the current Checkbox and Radio\n Button put their real `<input>` at `opacity: 0` (below), and the Dropdown does the same inline\n in `Select.tsx` — each is overlaid on a wrapper that draws the box you actually see. So\n `:focus-visible` matched, `outline-style` read `solid`, and the page did not change: measured on\n a deployed page, the checkbox, the radio and the dropdown were all `:focus-visible` with their\n visible box one hop up reading `outline-style: none`, while the Button beside them rang.\n A ring is a visibility claim, so it is drawn on the element a person looks at.\n ⚠️ `outline`, not `box-shadow`: an author's own `Box Shadow` parameter is inline and beats a\n stylesheet shadow, which would delete the ring on exactly the controls somebody had styled.\n ⚠️ The Dropdown's `<select>` carries no control class of its own — `Select.tsx` passes\n `props.className` straight through — so it is matched by element, inside this wrapper only. */\n.ndl-controls-pointer:has(> .ndl-controls-checkbox-2:focus-visible),\n.ndl-controls-pointer:has(> .ndl-controls-radio-2:focus-visible),\n.ndl-controls-pointer:has(> select:focus-visible) {\n outline: var(--ring-width, 3px) solid var(--ring, #101010);\n outline-offset: 2px;\n}\n\n/** Deprecated checkbox **/\n.ndl-controls-checkbox {\n margin: 0;\n border: 1px solid #000000;\n border-radius: 0;\n background-color: transparent;\n -webkit-appearance: none;\n outline: none;\n cursor: pointer;\n}\n\n.ndl-controls-checkbox:checked {\n background-color: #000000;\n}\n\n.ndl-controls-checkbox:disabled {\n cursor: default;\n}\n\n/** Deprecated radio button **/\n.ndl-controls-radiobutton {\n margin: 0;\n border: 1px solid #000000;\n border-radius: 16px;\n background-color: transparent;\n -webkit-appearance: none;\n outline: none;\n width: 32px;\n height: 32px;\n display: block;\n cursor: pointer;\n}\n\n.ndl-controls-radiobutton:checked {\n background-color: #000000;\n}\n\n.ndl-controls-radiobutton:disabled {\n cursor: default;\n}\n\n/** New radio button **/\n.ndl-controls-radio-2 {\n opacity: 0;\n position: absolute;\n margin: 0;\n}\n\n.ndl-controls-radio-2:disabled {\n cursor: default;\n}\n\n/** New checkbox **/\n.ndl-controls-checkbox-2 {\n opacity: 0;\n position: absolute;\n margin: 0;\n}\n\n.ndl-controls-checkbox-2:disabled {\n cursor: default;\n}\n\n/** Options **/\n.ndl-controls-select {\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n border: 1px solid #000000;\n border-radius: 0;\n padding: 0 1em 0 0;\n margin: 0;\n width: 100%;\n font-family: inherit;\n font-size: inherit;\n cursor: inherit;\n line-height: inherit;\n\n /* Stack above custom arrow */\n z-index: 1;\n\n /* Remove dropdown arrow in IE10 & IE11\n @link https://www.filamentgroup.com/lab/select-css.html */\n /* &::-ms-expand {\n display: none;\n }*/\n\n /* Remove focus outline, will add on alternate element */\n outline: none;\n}\n\n.ndl-controls-select:disabled {\n cursor: default;\n}\n\n/** Range **/\n.ndl-controls-range2 {\n margin: 0;\n padding: 0;\n -webkit-appearance: none;\n appearance: none;\n outline: none;\n border: none;\n background: transparent;\n cursor: pointer;\n}\n\n.ndl-controls-range2::-webkit-slider-thumb {\n height: 100%;\n border: 0;\n -webkit-appearance: none;\n appearance: none;\n}\n\n.ndl-controls-range2::-moz-range-thumb {\n height: 100%;\n border: 0;\n -webkit-appearance: none;\n appearance: none;\n}\n\n.ndl-controls-range2::-webkit-slider-runnable-track {\n border: none;\n height: 100%;\n}\n\n.ndl-controls-range2::-moz-range-track {\n border: none;\n height: 100%;\n}\n\n.ndl-controls-range2:disabled {\n cursor: default;\n}\n\n/* Old range */\n\n.ndl-controls-range {\n margin: 0;\n padding: 0;\n -webkit-appearance: none;\n outline: none;\n border: none;\n background-color: transparent;\n cursor: pointer;\n}\n\n.ndl-controls-range::-webkit-slider-thumb {\n width: 16px;\n height: 16px;\n background: #000000;\n border: 0;\n border-radius: 8px;\n cursor: pointer;\n -webkit-appearance: none;\n margin-top: -5px;\n}\n\n.ndl-controls-range::-moz-range-thumb {\n width: 16px;\n height: 16px;\n background: #000000;\n border: none;\n border-radius: 8px;\n cursor: pointer;\n}\n\n.ndl-controls-range::-ms-thumb {\n width: 16px;\n height: 16px;\n background: #000000;\n border: none;\n border-radius: 8px;\n cursor: pointer;\n margin-top: 0px;\n /*Needed to keep the Edge thumb centred*/\n}\n\n.ndl-controls-range::-webkit-slider-runnable-track {\n background: #f0f0f0;\n border: none;\n width: 100%;\n height: 6px;\n cursor: pointer;\n top: 4px;\n margin-top: 5px;\n}\n\n.ndl-controls-range:focus::-webkit-slider-runnable-track {\n background: #f0f0f0;\n}\n\n.ndl-controls-range::-moz-range-track {\n background: #f0f0f0;\n border: none;\n width: 100%;\n height: 6px;\n cursor: pointer;\n}\n\n.ndl-controls-range::-ms-track {\n background: transparent;\n border-color: transparent;\n border-width: 5px 0;\n color: transparent;\n width: 100%;\n height: 6px;\n cursor: pointer;\n}\n\n.ndl-controls-range::-ms-fill-lower {\n background: #f0f0f0;\n border: none;\n}\n.ndl-controls-range::-ms-fill-upper {\n background: #f0f0f0;\n border: none;\n}\n\n/** Field Set **/\n.ndl-controls-fieldset {\n outline: none;\n border: none;\n margin: 0;\n padding: 0;\n}\n\n/** Text Input **/\n.ndl-controls-textinput {\n /* Same defect as `.ndl-controls-button` above, and this class dresses both the\n `<input>` and — with `type: 'textArea'` — the `<textarea>`, which rendered\n in `monospace` rather than Arial because that is the UA default for that\n element specifically. */\n font-family: inherit;\n outline: none;\n border-style: none;\n background-color: transparent;\n}\n\n.ndl-controls-textinput::placeholder {\n color: inherit;\n opacity: 0.5;\n}\n",""]);const a=s;n.d(t,["A",0,a])},9571(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,i,o,r){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var u=0;u<e.length;u++){var c=[].concat(e[u]);i&&s[c[0]]||(void 0!==r&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},7087(e){"use strict";e.exports=function(e){return e[1]}},9405(e){"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function r(){r.init.call(this)}e.exports=r,e.exports.once=function(e,t){return new Promise(function(n,i){function o(n){e.removeListener(t,r),i(n)}function r(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}g(e,t,r,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,o)})},r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var o,r,s,u;if(a(n),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),r=e._events),s=r[t]),void 0===s)s=r[t]=n,++e._eventsCount;else if("function"==typeof s?s=r[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),(o=l(e))>0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,u=c,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=c.bind(i);return o.listener=n,i.wrapFn=o,o}function p(e,t,n){var i=e._events;if(void 0===i)return[];var o=i[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):f(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function f(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function g(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function o(r){i.once&&e.removeEventListener(t,o),n(r)})}}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),r.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},r.prototype.getMaxListeners=function(){return l(this)},r.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var o="error"===e,r=this._events;if(void 0!==r)o=o&&void 0===r.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=r[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=f(l,u);for(n=0;n<u;++n)i(c[n],this,t)}return!0},r.prototype.addListener=function(e,t){return u(this,e,t,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(e,t){return u(this,e,t,!0)},r.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},r.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},r.prototype.removeListener=function(e,t){var n,i,o,r,s;if(a(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,r=n.length-1;r>=0;r--)if(n[r]===t||n[r].listener===t){s=n[r].listener,o=r;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,s||t)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,r=Object.keys(n);for(i=0;i<r.length;++i)"removeListener"!==(o=r[i])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},r.prototype.listeners=function(e){return p(this,e,!0)},r.prototype.rawListeners=function(e){return p(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},r.prototype.listenerCount=h,r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},8116(e,t,n){"use strict";const i=n(524),o=n(2665),r=n(8922);e.exports={XMLParser:o,XMLValidator:i,XMLBuilder:r}},1199(e){e.exports=function(e){return"function"==typeof e?e:Array.isArray(e)?t=>{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1}},5844(e,t){"use strict";const n=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i="["+n+"]["+n+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",o=new RegExp("^"+i+"$");t.isExist=function(e){return void 0!==e},t.isEmptyObject=function(e){return 0===Object.keys(e).length},t.merge=function(e,t,n){if(t){const i=Object.keys(t),o=i.length;for(let r=0;r<o;r++)e[i[r]]="strict"===n?[t[i[r]]]:t[i[r]]}},t.getValue=function(e){return t.isExist(e)?e:""},t.isName=function(e){return!(null==o.exec(e))},t.getAllMatches=function(e,t){const n=[];let i=t.exec(e);for(;i;){const o=[];o.startIndex=t.lastIndex-i[0].length;const r=i.length;for(let e=0;e<r;e++)o.push(i[e]);n.push(o),i=t.exec(e)}return n},t.nameRegexp=i,t.DANGEROUS_PROPERTY_NAMES=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],t.criticalProperties=["__proto__","constructor","prototype"]},524(e,t,n){"use strict";const i=n(5844),o={allowBooleanAttributes:!1,unpairedTags:[]};function r(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function s(e,t){const n=t;for(;t<e.length;t++)if("?"==e[t]||" "==e[t]){const i=e.substr(n,t-n);if(t>5&&"xml"===i)return p("InvalidXml","XML declaration allowed only at the start of the document.",g(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}continue}return t}function a(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t<e.length;t++)if("<"===e[t])n++;else if(">"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}function l(e,t){let n="",i="",o=!1;for(;t<e.length;t++){if('"'===e[t]||"'"===e[t])""===i?i=e[t]:i!==e[t]||(i="");else if(">"===e[t]&&""===i){o=!0;break}n+=e[t]}return""===i&&{value:n,index:t,tagClosed:o}}t.validate=function(e,t){t=Object.assign({},o,t);const n=[];let i=!1,u=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o<e.length;o++)if("<"===e[o]&&"?"===e[o+1]){if(o+=2,o=s(e,o),o.err)return o}else{if("<"!==e[o]){if(r(e[o]))continue;return p("InvalidChar","char '"+e[o]+"' is not expected.",g(e,o))}{let h=o;if(o++,"!"===e[o]){o=a(e,o);continue}{let m=!1;"/"===e[o]&&(m=!0,o++);let y="";for(;o<e.length&&">"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)y+=e[o];if(y=y.trim(),"/"===y[y.length-1]&&(y=y.substring(0,y.length-1),o--),!f(y)){let t;return t=0===y.trim().length?"Invalid space after '<'.":"Tag '"+y+"' is an invalid name.",p("InvalidTag",t,g(e,o))}const v=l(e,o);if(!1===v)return p("InvalidAttr","Attributes for '"+y+"' have open quote.",g(e,o));let b=v.value;if(o=v.index,"/"===b[b.length-1]){const n=o-b.length;b=b.substring(0,b.length-1);const r=c(b,t);if(!0!==r)return p(r.err.code,r.err.msg,g(e,n+r.err.line));i=!0}else if(m){if(!v.tagClosed)return p("InvalidTag","Closing tag '"+y+"' doesn't have proper closing.",g(e,o));if(b.trim().length>0)return p("InvalidTag","Closing tag '"+y+"' can't have attributes or invalid starting.",g(e,h));if(0===n.length)return p("InvalidTag","Closing tag '"+y+"' has not been opened.",g(e,h));{const t=n.pop();if(y!==t.tagName){let n=g(e,t.tagStartPos);return p("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+y+"'.",g(e,h))}0==n.length&&(u=!0)}}else{const r=c(b,t);if(!0!==r)return p(r.err.code,r.err.msg,g(e,o-b.length+r.err.line));if(!0===u)return p("InvalidXml","Multiple possible root nodes found.",g(e,o));-1!==t.unpairedTags.indexOf(y)||n.push({tagName:y,tagStartPos:h}),i=!0}for(o++;o<e.length;o++)if("<"===e[o]){if("!"===e[o+1]){o++,o=a(e,o);continue}if("?"!==e[o+1])break;if(o=s(e,++o),o.err)return o}else if("&"===e[o]){const t=d(e,o);if(-1==t)return p("InvalidChar","char '&' is not expected.",g(e,o));o=t}else if(!0===u&&!r(e[o]))return p("InvalidXml","Extra text at the end",g(e,o));"<"===e[o]&&o--}}}return i?1==n.length?p("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",g(e,n[0].tagStartPos)):!(n.length>0)||p("InvalidXml","Invalid '"+JSON.stringify(n.map(e=>e.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):p("InvalidXml","Start tag expected.",1)};const u=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function c(e,t){const n=i.getAllMatches(e,u),o={};for(let e=0;e<n.length;e++){if(0===n[e][1].length)return p("InvalidAttr","Attribute '"+n[e][2]+"' has no space in starting.",m(n[e]));if(void 0!==n[e][3]&&void 0===n[e][4])return p("InvalidAttr","Attribute '"+n[e][2]+"' is without value.",m(n[e]));if(void 0===n[e][3]&&!t.allowBooleanAttributes)return p("InvalidAttr","boolean attribute '"+n[e][2]+"' is not allowed.",m(n[e]));const i=n[e][2];if(!h(i))return p("InvalidAttr","Attribute '"+i+"' is an invalid name.",m(n[e]));if(o.hasOwnProperty(i))return p("InvalidAttr","Attribute '"+i+"' is repeated.",m(n[e]));o[i]=1}return!0}function d(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let n=/\d/;for("x"===e[t]&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(n))break}return-1}(e,++t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(";"===e[t])break;return-1}return t}function p(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function h(e){return i.isName(e)}function f(e){return i.isName(e)}function g(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function m(e){return e.startIndex+e[1].length}},8922(e,t,n){"use strict";const i=n(7566),o=n(1199),r={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function s(e){this.options=Object.assign({},r,e),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=o(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=u),this.processTextOrObjNode=a,this.options.format?(this.indentate=l,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function a(e,t,n,i){const o=this.j2x(e,n+1,i.concat(t));return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}function l(e){return this.options.indentBy.repeat(e)}function u(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}s.prototype.build=function(e){return this.options.preserveOrder?i(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},s.prototype.j2x=function(e,t,n){let i="",o="";const r=n.join(".");for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(void 0===e[s])this.isAttribute(s)&&(o+="");else if(null===e[s])this.isAttribute(s)||s===this.options.cdataPropName?o+="":"?"===s[0]?o+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)o+=this.buildTextValNode(e[s],s,"",t);else if("object"!=typeof e[s]){const n=this.isAttribute(s);if(n&&!this.ignoreAttributesFn(n,r))i+=this.buildAttrPairStr(n,""+e[s]);else if(!n)if(s===this.options.textNodeName){let t=this.options.tagValueProcessor(s,""+e[s]);o+=this.replaceEntitiesValue(t)}else o+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){const i=e[s].length;let r="",a="";for(let l=0;l<i;l++){const i=e[s][l];if(void 0===i);else if(null===i)"?"===s[0]?o+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if("object"==typeof i)if(this.options.oneListGroup){const e=this.j2x(i,t+1,n.concat(s));r+=e.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(a+=e.attrStr)}else r+=this.processTextOrObjNode(i,s,t,n);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(s,i);e=this.replaceEntitiesValue(e),r+=e}else r+=this.buildTextValNode(i,s,"",t)}this.options.oneListGroup&&(r=this.buildObjectNode(r,s,a,t)),o+=r}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const t=Object.keys(e[s]),n=t.length;for(let o=0;o<n;o++)i+=this.buildAttrPairStr(t[o],""+e[s][t[o]])}else o+=this.processTextOrObjNode(e[s],s,t,n);return{attrStr:i,val:o}},s.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},s.prototype.buildObjectNode=function(e,t,n,i){if(""===e)return"?"===t[0]?this.indentate(i)+"<"+t+n+"?"+this.tagEndChar:this.indentate(i)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,r="";if("?"===t[0]&&(r="?",o=""),!n&&""!==n||-1!==e.indexOf("<")){if(!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===r.length){const t=String(e).replace(/--/g,"- -").replace(/-$/,"- ");return this.indentate(i)+`\x3c!--${t}--\x3e`+this.newLine}return this.indentate(i)+"<"+t+n+r+this.tagEndChar+e+this.indentate(i)+o}return this.indentate(i)+"<"+t+n+r+">"+e+o}},s.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},s.prototype.buildTextValNode=function(e,t,n,i){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName){const t=String(e).replace(/\]\]>/g,"]]]]><![CDATA[>");return this.indentate(i)+`<![CDATA[${t}]]>`+this.newLine}if(!1!==this.options.commentPropName&&t===this.options.commentPropName){const t=String(e).replace(/--/g,"- -").replace(/-$/,"- ");return this.indentate(i)+`\x3c!--${t}--\x3e`+this.newLine}if("?"===t[0])return this.indentate(i)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),""===o?this.indentate(i)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(i)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}},s.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e},e.exports=s},7566(e){function t(e,s,a,l){let u="",c=!1;if(!Array.isArray(e)){if(null!=e){let t=e.toString();return t=r(t,s),t}return""}for(let d=0;d<e.length;d++){const p=e[d],h=n(p);if(void 0===h)continue;let f="";if(f=0===a.length?h:`${a}.${h}`,h===s.textNodeName){let e=p[h];o(f,s)||(e=s.tagValueProcessor(h,e),e=r(e,s)),c&&(u+=l),u+=e,c=!1;continue}if(h===s.cdataPropName){c&&(u+=l),u+=`<![CDATA[${String(p[h][0][s.textNodeName]).replace(/\]\]>/g,"]]]]><![CDATA[>")}]]>`,c=!1;continue}if(h===s.commentPropName){u+=l+`\x3c!--${String(p[h][0][s.textNodeName]).replace(/--/g,"- -").replace(/-$/,"- ")}--\x3e`,c=!0;continue}if("?"===h[0]){const e=i(p[":@"],s),t="?xml"===h?"":l;let n=p[h][0][s.textNodeName];n=0!==n.length?" "+n:"",u+=t+`<${h}${n}${e}?>`,c=!0;continue}let g=l;""!==g&&(g+=s.indentBy);const m=l+`<${h}${i(p[":@"],s)}`,y=t(p[h],s,f,g);-1!==s.unpairedTags.indexOf(h)?s.suppressUnpairedNode?u+=m+">":u+=m+"/>":y&&0!==y.length||!s.suppressEmptyNode?y&&y.endsWith(">")?u+=m+`>${y}${l}</${h}>`:(u+=m+">",y&&""!==l&&(y.includes("/>")||y.includes("</"))?u+=l+s.indentBy+y+l:u+=y,u+=`</${h}>`):u+=m+"/>",c=!0}return u}function n(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const i=t[n];if(Object.prototype.hasOwnProperty.call(e,i)&&":@"!==i)return i}}function i(e,t){let n="";if(e&&!t.ignoreAttributes)for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let o=t.attributeValueProcessor(i,e[i]);o=r(o,t),!0===o&&t.suppressBooleanAttributes?n+=` ${i.substr(t.attributeNamePrefix.length)}`:n+=` ${i.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function o(e,t){let n=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let i in t.stopNodes)if(t.stopNodes[i]===e||t.stopNodes[i]==="*."+n)return!0;return!1}function r(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const i=t.entities[n];e=e.replace(i.regex,i.val)}return e}e.exports=function(e,n){let i="";return n.format&&n.indentBy.length>0&&(i="\n"),t(e,n,"",i)}},9522(e,t,n){const i=n(5844),o=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function r(e,t,n){for(let i=0;i<t.length;i++)if(t[i]!==e[n+i+1])return!1;return!0}function s(e){if(i.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}e.exports=class{constructor(e){this.suppressValidationErr=!e,this.options=e||{}}readDocType(e,t){const n=Object.create(null);let i=0;if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let o=1,s=!1,a=!1,l="";for(;t<e.length;t++)if("<"!==e[t]||a)if(">"===e[t]){if(a?"-"===e[t-1]&&"-"===e[t-2]&&(a=!1,o--):o--,0===o)break}else"["===e[t]?s=!0:l+=e[t];else{if(s&&r(e,"!ENTITY",t)){let o,r;if(t+=7,[o,r,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),-1===r.indexOf("&")){if(!1!==this.options.enabled&&null!=this.options.maxEntityCount&&i>=this.options.maxEntityCount)throw new Error(`Entity count (${i+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n[o]={regx:RegExp(`&${e};`,"g"),val:r},i++}}else if(s&&r(e,"!ELEMENT",t)){t+=8;const{index:n}=this.readElementExp(e,t+1);t=n}else if(s&&r(e,"!ATTLIST",t))t+=8;else if(s&&r(e,"!NOTATION",t)){t+=9;const{index:n}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=n}else{if(!r(e,"!--",t))throw new Error("Invalid DOCTYPE");a=!0}o++,l=""}if(0!==o)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}}readEntityExp(e,t){t=o(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t])&&'"'!==e[t]&&"'"!==e[t];)n+=e[t],t++;if(s(n),t=o(e,t),!this.suppressValidationErr){if("SYSTEM"===e.substring(t,t+6).toUpperCase())throw new Error("External entities are not supported");if("%"===e[t])throw new Error("Parameter entities are not supported")}let i="";if([t,i]=this.readIdentifierVal(e,t,"entity"),!1!==this.options.enabled&&null!=this.options.maxEntitySize&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[n,i,--t]}readNotationExp(e,t){t=o(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;!this.suppressValidationErr&&s(n),t=o(e,t);const i=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==i&&"PUBLIC"!==i)throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);t+=i.length,t=o(e,t);let r=null,a=null;if("PUBLIC"===i)[t,r]=this.readIdentifierVal(e,t,"publicIdentifier"),'"'!==e[t=o(e,t)]&&"'"!==e[t]||([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"));else if("SYSTEM"===i&&([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:r,systemIdentifier:a,index:--t}}readIdentifierVal(e,t,n){let i="";const o=e[t];if('"'!==o&&"'"!==o)throw new Error(`Expected quoted string, found "${o}"`);for(t++;t<e.length&&e[t]!==o;)i+=e[t],t++;if(e[t]!==o)throw new Error(`Unterminated ${n} value`);return[++t,i]}readElementExp(e,t){t=o(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;if(!this.suppressValidationErr&&!i.isName(n))throw new Error(`Invalid element name: "${n}"`);let s="";if("E"===e[t=o(e,t)]&&r(e,"MPTY",t))t+=4;else if("A"===e[t]&&r(e,"NY",t))t+=2;else if("("===e[t]){for(t++;t<e.length&&")"!==e[t];)s+=e[t],t++;if(")"!==e[t])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:n,contentModel:s.trim(),index:t}}readAttlistExp(e,t){t=o(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;s(n),t=o(e,t);let i="";for(;t<e.length&&!/\s/.test(e[t]);)i+=e[t],t++;if(!s(i))throw new Error(`Invalid attribute name: "${i}"`);t=o(e,t);let r="";if("NOTATION"===e.substring(t,t+8).toUpperCase()){if(r="NOTATION","("!==e[t=o(e,t+=8)])throw new Error(`Expected '(', found "${e[t]}"`);t++;let n=[];for(;t<e.length&&")"!==e[t];){let i="";for(;t<e.length&&"|"!==e[t]&&")"!==e[t];)i+=e[t],t++;if(i=i.trim(),!s(i))throw new Error(`Invalid notation name: "${i}"`);n.push(i),"|"===e[t]&&(t++,t=o(e,t))}if(")"!==e[t])throw new Error("Unterminated list of notations");t++,r+=" ("+n.join("|")+")"}else{for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;const n=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!n.includes(r.toUpperCase()))throw new Error(`Invalid attribute type: "${r}"`)}t=o(e,t);let a="";return"#REQUIRED"===e.substring(t,t+8).toUpperCase()?(a="#REQUIRED",t+=8):"#IMPLIED"===e.substring(t,t+7).toUpperCase()?(a="#IMPLIED",t+=7):[t,a]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:n,attributeName:i,attributeType:r,defaultValue:a,index:t}}}},3442(e,t,n){const{DANGEROUS_PROPERTY_NAMES:i,criticalProperties:o}=n(5844),r=e=>i.includes(e)?"__"+e:e,s={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,onDangerousProperty:r};function a(e,t){if("string"!=typeof e)return;const n=e.toLowerCase();if(i.some(e=>n===e.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);if(o.some(e=>n===e.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function l(e){return"boolean"==typeof e?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:"object"==typeof e&&null!==e?{enabled:!1!==e.enabled,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null}:l(!0)}t.buildOptions=function(e){const t=Object.assign({},s,e),n=[{value:t.attributeNamePrefix,name:"attributeNamePrefix"},{value:t.attributesGroupName,name:"attributesGroupName"},{value:t.textNodeName,name:"textNodeName"},{value:t.cdataPropName,name:"cdataPropName"},{value:t.commentPropName,name:"commentPropName"}];for(const{value:e,name:t}of n)e&&a(e,t);return null===t.onDangerousProperty&&(t.onDangerousProperty=r),t.processEntities=l(t.processEntities),t}},2882(e,t,n){"use strict";const i=n(5844),o=n(138),r=n(9522),s=n(3861),a=n(1199);function l(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const i=t[n],o=i.replace(/[.\-+*:]/g,"\\.");this.lastEntities[i]={regex:new RegExp("&"+o+";","g"),val:e[i]}}}function u(e,t,n,i,o,r,s){if(void 0!==e&&(this.options.trimValues&&!i&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e,t,n));const i=this.options.tagValueProcessor(t,e,n,o,r);return null==i?e:typeof i!=typeof e||i!==e?i:this.options.trimValues||e.trim()===e?_(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function c(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const d=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function p(e,t,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const o=i.getAllMatches(e,d),r=o.length,s={};for(let e=0;e<r;e++){const i=this.resolveNameSpace(o[e][1]);if(this.ignoreAttributesFn(i,t))continue;let r=o[e][4],a=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),a=O(a,this.options),void 0!==r){this.options.trimValues&&(r=r.trim()),r=this.replaceEntitiesValue(r,n,t);const e=this.options.attributeValueProcessor(i,r,t);s[a]=null==e?r:typeof e!=typeof r||e!==r?e:_(r,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[a]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=s,e}return s}}const h=function(e){e=e.replace(/\r\n?/g,"\n");const t=new o("!xml");let n=t,i="",s="";this.entityExpansionCount=0,this.currentExpandedLength=0;const a=new r(this.options.processEntities);for(let r=0;r<e.length;r++)if("<"===e[r])if("/"===e[r+1]){const t=v(e,">",r,"Closing Tag is not closed.");let o=e.substring(r+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),n&&(i=this.saveTextToParentTag(i,n,s));const a=s.substring(s.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let l=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(l=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=s.lastIndexOf("."),s=s.substring(0,l),n=this.tagsNodeStack.pop(),i="",r=t}else if("?"===e[r+1]){let t=b(e,r,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,n,s),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new o(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,s,t.tagName)),this.addChild(n,e,s,r)}r=t.closeIndex+1}else if("!--"===e.substr(r+1,3)){const t=v(e,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(r+4,t-2);i=this.saveTextToParentTag(i,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=t}else if("!D"===e.substr(r+1,2)){const t=a.readDocType(e,r);this.docTypeEntities=t.entities,r=t.i}else if("!["===e.substr(r+1,2)){const t=v(e,"]]>",r,"CDATA is not closed.")-2,o=e.substring(r+9,t);i=this.saveTextToParentTag(i,n,s);let a=this.parseTextData(o,n.tagname,s,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):n.add(this.options.textNodeName,a),r=t+2}else{let a=b(e,r,this.options.removeNSPrefix),l=a.tagName;const u=a.rawTagName;let c=a.tagExp,d=a.attrExpPresent,p=a.closeIndex;if(this.options.transformTagName){const e=this.options.transformTagName(l);c===l&&(c=e),l=e}if(this.options.strictReservedNames&&(l===this.options.commentPropName||l===this.options.cdataPropName||l===this.options.textNodeName||l===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${l}`);n&&i&&"!xml"!==n.tagname&&(i=this.saveTextToParentTag(i,n,s,!1));const h=n;h&&-1!==this.options.unpairedTags.indexOf(h.tagname)&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),l!==t.tagname&&(s+=s?"."+l:l);const f=r;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,s,l)){let t="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)"/"===l[l.length-1]?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),c=l):c=c.substr(0,c.length-1),r=a.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(l))r=a.closeIndex;else{const n=this.readStopNodeData(e,u,p+1);if(!n)throw new Error(`Unexpected end of ${u}`);r=n.i,t=n.tagContent}const i=new o(l);l!==c&&d&&(i[":@"]=this.buildAttributesMap(c,s,l)),t&&(t=this.parseTextData(t,l,s,!0,d,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),i.add(this.options.textNodeName,t),this.addChild(n,i,s,f)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){if("/"===l[l.length-1]?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),c=l):c=c.substr(0,c.length-1),this.options.transformTagName){const e=this.options.transformTagName(l);c===l&&(c=e),l=e}const e=new o(l);l!==c&&d&&(e[":@"]=this.buildAttributesMap(c,s,l)),this.addChild(n,e,s,f),s=s.substr(0,s.lastIndexOf("."))}else{if(-1!==this.options.unpairedTags.indexOf(l)){const e=new o(l);l!==c&&d&&(e[":@"]=this.buildAttributesMap(c,s)),this.addChild(n,e,s,f),s=s.substr(0,s.lastIndexOf(".")),r=a.closeIndex;continue}{const e=new o(l);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),l!==c&&d&&(e[":@"]=this.buildAttributesMap(c,s,l)),this.addChild(n,e,s),n=e}}i="",r=p}}else i+=e[r];return t.child};function f(e,t,n,i){this.options.captureMetaData||(i=void 0);const o=this.options.updateTag(t.tagname,n,t[":@"]);!1===o||("string"==typeof o?(t.tagname=o,e.addChild(t,i)):e.addChild(t,i))}const g=function(e,t,n){if(-1===e.indexOf("&"))return e;const i=this.options.processEntities;if(!i.enabled)return e;if(i.allowedTags&&!i.allowedTags.includes(t))return e;if(i.tagFilter&&!i.tagFilter(t,n))return e;for(let t in this.docTypeEntities){const n=this.docTypeEntities[t],o=e.match(n.regx);if(o){if(this.entityExpansionCount+=o.length,i.maxTotalExpansions&&this.entityExpansionCount>i.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${i.maxTotalExpansions}`);const t=e.length;if(e=e.replace(n.regx,n.val),i.maxExpandedLength&&(this.currentExpandedLength+=e.length-t,this.currentExpandedLength>i.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${i.maxExpandedLength}`)}}if(-1===e.indexOf("&"))return e;for(const t of Object.keys(this.lastEntities)){const n=this.lastEntities[t],o=e.match(n.regex);if(o&&(this.entityExpansionCount+=o.length,i.maxTotalExpansions&&this.entityExpansionCount>i.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${i.maxTotalExpansions}`);e=e.replace(n.regex,n.val)}if(-1===e.indexOf("&"))return e;if(this.options.htmlEntities)for(const t of Object.keys(this.htmlEntities)){const n=this.htmlEntities[t],o=e.match(n.regex);if(o&&(this.entityExpansionCount+=o.length,i.maxTotalExpansions&&this.entityExpansionCount>i.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${i.maxTotalExpansions}`);e=e.replace(n.regex,n.val)}return e.replace(this.ampEntity.regex,this.ampEntity.val)};function m(e,t,n,i){return e&&(void 0===i&&(i=0===t.child.length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,i))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function y(e,t,n,i){return!(!t||!t.has(i))||!(!e||!e.has(n))}function v(e,t,n,i){const o=e.indexOf(t,n);if(-1===o)throw new Error(i);return o+t.length-1}function b(e,t,n,i=">"){const o=function(e,t,n=">"){let i,o="";for(let r=t;r<e.length;r++){let t=e[r];if(i)t===i&&(i="");else if('"'===t||"'"===t)i=t;else if(t===n[0]){if(!n[1])return{data:o,index:r};if(e[r+1]===n[1])return{data:o,index:r}}else"\t"===t&&(t=" ");o+=t}}(e,t+1,i);if(!o)return;let r=o.data;const s=o.index,a=r.search(/\s/);let l=r,u=!0;-1!==a&&(l=r.substring(0,a),r=r.substring(a+1).trimStart());const c=l;if(n){const e=l.indexOf(":");-1!==e&&(l=l.substr(e+1),u=l!==o.data.substr(e+1))}return{tagName:l,tagExp:r,closeIndex:s,attrExpPresent:u,rawTagName:c}}function w(e,t,n){const i=n;let o=1;for(;n<e.length;n++)if("<"===e[n])if("/"===e[n+1]){const r=v(e,">",n,`${t} is not closed`);if(e.substring(n+2,r).trim()===t&&(o--,0===o))return{tagContent:e.substring(i,n),i:r};n=r}else if("?"===e[n+1])n=v(e,"?>",n+1,"StopNode is not closed.");else if("!--"===e.substr(n+1,3))n=v(e,"--\x3e",n+3,"StopNode is not closed.");else if("!["===e.substr(n+1,2))n=v(e,"]]>",n,"StopNode is not closed.")-2;else{const i=b(e,n,">");i&&((i&&i.tagName)===t&&"/"!==i.tagExp[i.tagExp.length-1]&&o++,n=i.closeIndex)}}function _(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&s(e,n)}return i.isExist(e)?e:""}function S(e,t,n){const i=Number.parseInt(e,t);return i>=0&&i<=1114111?String.fromCodePoint(i):n+e+";"}function O(e,t){if(i.criticalProperties.includes(e))throw new Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return i.DANGEROUS_PROPERTY_NAMES.includes(e)?t.onDangerousProperty(e):e}e.exports=class{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>S(t,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>S(t,16,"&#x")}},this.addExternalEntities=l,this.parseXml=h,this.parseTextData=u,this.resolveNameSpace=c,this.buildAttributesMap=p,this.isItStopNode=y,this.replaceEntitiesValue=g,this.readStopNodeData=w,this.saveTextToParentTag=m,this.addChild=f,this.ignoreAttributesFn=a(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let e=0;e<this.options.stopNodes.length;e++){const t=this.options.stopNodes[e];"string"==typeof t&&(t.startsWith("*.")?this.stopNodesWildcard.add(t.substring(2)):this.stopNodesExact.add(t))}}}}},2665(e,t,n){const{buildOptions:i}=n(3442),o=n(2882),{prettify:r}=n(395),s=n(524);e.exports=class{constructor(e){this.externalEntities={},this.options=i(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=s.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new o(this.options);n.addExternalEntities(this.externalEntities);const i=n.parseXml(e);return this.options.preserveOrder||void 0===i?i:r(i,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}}},395(e,t){"use strict";function n(e,t,s){let a;const l={};for(let u=0;u<e.length;u++){const c=e[u],d=i(c);let p="";if(p=void 0===s?d:s+"."+d,d===t.textNodeName)void 0===a?a=c[d]:a+=""+c[d];else{if(void 0===d)continue;if(c[d]){let e=n(c[d],t,p);const i=r(e,t);c[":@"]?o(e,c[":@"],p,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==l[d]&&l.hasOwnProperty(d)?(Array.isArray(l[d])||(l[d]=[l[d]]),l[d].push(e)):t.isArray(d,p,i)?l[d]=[e]:l[d]=e}}}return"string"==typeof a?a.length>0&&(l[t.textNodeName]=a):void 0!==a&&(l[t.textNodeName]=a),l}function i(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const n=t[e];if(":@"!==n)return n}}function o(e,t,n,i){if(t){const o=Object.keys(t),r=o.length;for(let s=0;s<r;s++){const r=o[s];i.isArray(r,n+"."+r,!0,!0)?e[r]=[t[r]]:e[r]=t[r]}}}function r(e,t){const{textNodeName:n}=t,i=Object.keys(e).length;return 0===i||!(1!==i||!e[n]&&"boolean"!=typeof e[n]&&0!==e[n])}t.prettify=function(e,t){return n(e,t)}},138(e){"use strict";e.exports=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}},4627(e,t,n){var i="__lodash_hash_undefined__",o=/^\[object .+?Constructor\]$/,r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,s="object"==typeof self&&self&&self.Object===Object&&self,a=r||s||Function("return this")();function l(e,t){return!(!e||!e.length)&&function(e,t){if(t!=t)return function(e,t){for(var n=e.length,i=-1;++i<n;)if(t(e[i],i,e))return i;return-1}(e,d);for(var n=-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t)>-1}function u(e,t,n){for(var i=-1,o=e?e.length:0;++i<o;)if(n(t,e[i]))return!0;return!1}function c(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}function d(e){return e!=e}function p(e,t){return e.has(t)}var h,f=Array.prototype,g=Function.prototype,m=Object.prototype,y=a["__core-js_shared__"],v=(h=/[^.]+$/.exec(y&&y.keys&&y.keys.IE_PROTO||""))?"Symbol(src)_1."+h:"",b=g.toString,w=m.hasOwnProperty,_=m.toString,S=RegExp("^"+b.call(w).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),O=a.Symbol,N=m.propertyIsEnumerable,C=f.splice,x=O?O.isConcatSpreadable:void 0,T=Math.max,k=j(a,"Map"),E=j(Object,"create");function I(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function P(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function R(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function A(e){var t=-1,n=e?e.length:0;for(this.__data__=new R;++t<n;)this.add(e[t])}function D(e,t){for(var n=e.length;n--;)if(W(e[n][0],t))return n;return-1}function F(e,t,n,i,o){var r=-1,s=e.length;for(n||(n=V),o||(o=[]);++r<s;){var a=e[r];t>0&&n(a)?t>1?F(a,t-1,n,i,o):c(o,a):i||(o[o.length]=a)}return o}function M(e,t){var n,i,o=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function j(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){if(!G(e)||v&&v in e)return!1;var t=H(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?S:o;return t.test(function(e){if(null!=e){try{return b.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}(n)?n:void 0}function V(e){return z(e)||function(e){return q(e)&&w.call(e,"callee")&&(!N.call(e,"callee")||"[object Arguments]"==_.call(e))}(e)||!!(x&&e&&e[x])}I.prototype.clear=function(){this.__data__=E?E(null):{}},I.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},I.prototype.get=function(e){var t=this.__data__;if(E){var n=t[e];return n===i?void 0:n}return w.call(t,e)?t[e]:void 0},I.prototype.has=function(e){var t=this.__data__;return E?void 0!==t[e]:w.call(t,e)},I.prototype.set=function(e,t){return this.__data__[e]=E&&void 0===t?i:t,this},P.prototype.clear=function(){this.__data__=[]},P.prototype.delete=function(e){var t=this.__data__,n=D(t,e);return!(n<0||(n==t.length-1?t.pop():C.call(t,n,1),0))},P.prototype.get=function(e){var t=this.__data__,n=D(t,e);return n<0?void 0:t[n][1]},P.prototype.has=function(e){return D(this.__data__,e)>-1},P.prototype.set=function(e,t){var n=this.__data__,i=D(n,e);return i<0?n.push([e,t]):n[i][1]=t,this},R.prototype.clear=function(){this.__data__={hash:new I,map:new(k||P),string:new I}},R.prototype.delete=function(e){return M(this,e).delete(e)},R.prototype.get=function(e){return M(this,e).get(e)},R.prototype.has=function(e){return M(this,e).has(e)},R.prototype.set=function(e,t){return M(this,e).set(e,t),this},A.prototype.add=A.prototype.push=function(e){return this.__data__.set(e,i),this},A.prototype.has=function(e){return this.__data__.has(e)};var L,U,B=(L=function(e,t){return q(e)?function(e,t,n,i){var o,r=-1,s=l,a=!0,c=e.length,d=[],h=t.length;if(!c)return d;n&&(t=function(e,t){for(var n=-1,i=e?e.length:0,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o}(t,(o=n,function(e){return o(e)}))),i?(s=u,a=!1):t.length>=200&&(s=p,a=!1,t=new A(t));e:for(;++r<c;){var f=e[r],g=n?n(f):f;if(f=i||0!==f?f:0,a&&g==g){for(var m=h;m--;)if(t[m]===g)continue e;d.push(f)}else s(t,g,i)||d.push(f)}return d}(e,F(t,1,q,!0)):[]},U=T(void 0===U?L.length-1:U,0),function(){for(var e=arguments,t=-1,n=T(e.length-U,0),i=Array(n);++t<n;)i[t]=e[U+t];t=-1;for(var o=Array(U+1);++t<U;)o[t]=e[t];return o[U]=i,function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(L,this,o)});function W(e,t){return e===t||e!=e&&t!=t}var z=Array.isArray;function q(e){return function(e){return!!e&&"object"==typeof e}(e)&&function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}(e.length)&&!H(e)}(e)}function H(e){var t=G(e)?_.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}function G(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=B},412(e,t,n){e=n.nmd(e);var i="__lodash_hash_undefined__",o=9007199254740991,r="[object Arguments]",s="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",c="[object Function]",d="[object Map]",p="[object Number]",h="[object Object]",f="[object Promise]",g="[object RegExp]",m="[object Set]",y="[object String]",v="[object WeakMap]",b="[object ArrayBuffer]",w="[object DataView]",_=/^\[object .+?Constructor\]$/,S=/^(?:0|[1-9]\d*)$/,O={};O["[object Float32Array]"]=O["[object Float64Array]"]=O["[object Int8Array]"]=O["[object Int16Array]"]=O["[object Int32Array]"]=O["[object Uint8Array]"]=O["[object Uint8ClampedArray]"]=O["[object Uint16Array]"]=O["[object Uint32Array]"]=!0,O[r]=O[s]=O[b]=O[a]=O[w]=O[l]=O[u]=O[c]=O[d]=O[p]=O[h]=O[g]=O[m]=O[y]=O[v]=!1;var N="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,C="object"==typeof self&&self&&self.Object===Object&&self,x=N||C||Function("return this")(),T=t&&!t.nodeType&&t,k=T&&e&&!e.nodeType&&e,E=k&&k.exports===T,I=E&&N.process,P=function(){try{return I&&I.binding&&I.binding("util")}catch(e){}}(),R=P&&P.isTypedArray;function A(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function D(e){var t=-1,n=Array(e.size);return e.forEach(function(e,i){n[++t]=[i,e]}),n}function F(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var M,j,V,L=Array.prototype,U=Function.prototype,B=Object.prototype,W=x["__core-js_shared__"],z=U.toString,q=B.hasOwnProperty,H=(M=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||""))?"Symbol(src)_1."+M:"",G=B.toString,$=RegExp("^"+z.call(q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),X=E?x.Buffer:void 0,Y=x.Symbol,K=x.Uint8Array,J=B.propertyIsEnumerable,Q=L.splice,Z=Y?Y.toStringTag:void 0,ee=Object.getOwnPropertySymbols,te=X?X.isBuffer:void 0,ne=(j=Object.keys,V=Object,function(e){return j(V(e))}),ie=ke(x,"DataView"),oe=ke(x,"Map"),re=ke(x,"Promise"),se=ke(x,"Set"),ae=ke(x,"WeakMap"),le=ke(Object,"create"),ue=Re(ie),ce=Re(oe),de=Re(re),pe=Re(se),he=Re(ae),fe=Y?Y.prototype:void 0,ge=fe?fe.valueOf:void 0;function me(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function ye(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function be(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ve;++t<n;)this.add(e[t])}function we(e){var t=this.__data__=new ye(e);this.size=t.size}function _e(e,t){for(var n=e.length;n--;)if(Ae(e[n][0],t))return n;return-1}function Se(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Z&&Z in Object(e)?function(e){var t=q.call(e,Z),n=e[Z];try{e[Z]=void 0;var i=!0}catch(e){}var o=G.call(e);return i&&(t?e[Z]=n:delete e[Z]),o}(e):function(e){return G.call(e)}(e)}function Oe(e){return Ue(e)&&Se(e)==r}function Ne(e,t,n,i,o){return e===t||(null==e||null==t||!Ue(e)&&!Ue(t)?e!=e&&t!=t:function(e,t,n,i,o,c){var f=Fe(e),v=Fe(t),_=f?s:Ie(e),S=v?s:Ie(t),O=(_=_==r?h:_)==h,N=(S=S==r?h:S)==h,C=_==S;if(C&&Me(e)){if(!Me(t))return!1;f=!0,O=!1}if(C&&!O)return c||(c=new we),f||Be(e)?Ce(e,t,n,i,o,c):function(e,t,n,i,o,r,s){switch(n){case w:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case b:return!(e.byteLength!=t.byteLength||!r(new K(e),new K(t)));case a:case l:case p:return Ae(+e,+t);case u:return e.name==t.name&&e.message==t.message;case g:case y:return e==t+"";case d:var c=D;case m:var h=1&i;if(c||(c=F),e.size!=t.size&&!h)return!1;var f=s.get(e);if(f)return f==t;i|=2,s.set(e,t);var v=Ce(c(e),c(t),i,o,r,s);return s.delete(e),v;case"[object Symbol]":if(ge)return ge.call(e)==ge.call(t)}return!1}(e,t,_,n,i,o,c);if(!(1&n)){var x=O&&q.call(e,"__wrapped__"),T=N&&q.call(t,"__wrapped__");if(x||T){var k=x?e.value():e,E=T?t.value():t;return c||(c=new we),o(k,E,n,i,c)}}return!!C&&(c||(c=new we),function(e,t,n,i,o,r){var s=1&n,a=xe(e),l=a.length;if(l!=xe(t).length&&!s)return!1;for(var u=l;u--;){var c=a[u];if(!(s?c in t:q.call(t,c)))return!1}var d=r.get(e);if(d&&r.get(t))return d==t;var p=!0;r.set(e,t),r.set(t,e);for(var h=s;++u<l;){var f=e[c=a[u]],g=t[c];if(i)var m=s?i(g,f,c,t,e,r):i(f,g,c,e,t,r);if(!(void 0===m?f===g||o(f,g,n,i,r):m)){p=!1;break}h||(h="constructor"==c)}if(p&&!h){var y=e.constructor,v=t.constructor;y==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof v&&v instanceof v||(p=!1)}return r.delete(e),r.delete(t),p}(e,t,n,i,o,c))}(e,t,n,i,Ne,o))}function Ce(e,t,n,i,o,r){var s=1&n,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var u=r.get(e);if(u&&r.get(t))return u==t;var c=-1,d=!0,p=2&n?new be:void 0;for(r.set(e,t),r.set(t,e);++c<a;){var h=e[c],f=t[c];if(i)var g=s?i(f,h,c,t,e,r):i(h,f,c,e,t,r);if(void 0!==g){if(g)continue;d=!1;break}if(p){if(!A(t,function(e,t){if(s=t,!p.has(s)&&(h===e||o(h,e,n,i,r)))return p.push(t);var s})){d=!1;break}}else if(h!==f&&!o(h,f,n,i,r)){d=!1;break}}return r.delete(e),r.delete(t),d}function xe(e){return function(e,t,n){var i=t(e);return Fe(e)?i:function(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}(i,n(e))}(e,We,Ee)}function Te(e,t){var n,i,o=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function ke(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Le(e)||function(e){return!!H&&H in e}(e))&&(je(e)?$:_).test(Re(e))}(n)?n:void 0}me.prototype.clear=function(){this.__data__=le?le(null):{},this.size=0},me.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},me.prototype.get=function(e){var t=this.__data__;if(le){var n=t[e];return n===i?void 0:n}return q.call(t,e)?t[e]:void 0},me.prototype.has=function(e){var t=this.__data__;return le?void 0!==t[e]:q.call(t,e)},me.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=le&&void 0===t?i:t,this},ye.prototype.clear=function(){this.__data__=[],this.size=0},ye.prototype.delete=function(e){var t=this.__data__,n=_e(t,e);return!(n<0||(n==t.length-1?t.pop():Q.call(t,n,1),--this.size,0))},ye.prototype.get=function(e){var t=this.__data__,n=_e(t,e);return n<0?void 0:t[n][1]},ye.prototype.has=function(e){return _e(this.__data__,e)>-1},ye.prototype.set=function(e,t){var n=this.__data__,i=_e(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this},ve.prototype.clear=function(){this.size=0,this.__data__={hash:new me,map:new(oe||ye),string:new me}},ve.prototype.delete=function(e){var t=Te(this,e).delete(e);return this.size-=t?1:0,t},ve.prototype.get=function(e){return Te(this,e).get(e)},ve.prototype.has=function(e){return Te(this,e).has(e)},ve.prototype.set=function(e,t){var n=Te(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this},be.prototype.add=be.prototype.push=function(e){return this.__data__.set(e,i),this},be.prototype.has=function(e){return this.__data__.has(e)},we.prototype.clear=function(){this.__data__=new ye,this.size=0},we.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},we.prototype.get=function(e){return this.__data__.get(e)},we.prototype.has=function(e){return this.__data__.has(e)},we.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ye){var i=n.__data__;if(!oe||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new ve(i)}return n.set(e,t),this.size=n.size,this};var Ee=ee?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,i=null==e?0:e.length,o=0,r=[];++n<i;){var s=e[n];t(s)&&(r[o++]=s)}return r}(ee(e),function(t){return J.call(e,t)}))}:function(){return[]},Ie=Se;function Pe(e,t){return!!(t=t??o)&&("number"==typeof e||S.test(e))&&e>-1&&e%1==0&&e<t}function Re(e){if(null!=e){try{return z.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ae(e,t){return e===t||e!=e&&t!=t}(ie&&Ie(new ie(new ArrayBuffer(1)))!=w||oe&&Ie(new oe)!=d||re&&Ie(re.resolve())!=f||se&&Ie(new se)!=m||ae&&Ie(new ae)!=v)&&(Ie=function(e){var t=Se(e),n=t==h?e.constructor:void 0,i=n?Re(n):"";if(i)switch(i){case ue:return w;case ce:return d;case de:return f;case pe:return m;case he:return v}return t});var De=Oe(function(){return arguments}())?Oe:function(e){return Ue(e)&&q.call(e,"callee")&&!J.call(e,"callee")},Fe=Array.isArray,Me=te||function(){return!1};function je(e){if(!Le(e))return!1;var t=Se(e);return t==c||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ve(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function Le(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ue(e){return null!=e&&"object"==typeof e}var Be=R?function(e){return function(t){return e(t)}}(R):function(e){return Ue(e)&&Ve(e.length)&&!!O[Se(e)]};function We(e){return null!=(t=e)&&Ve(t.length)&&!je(t)?function(e,t){var n=Fe(e),i=!n&&De(e),o=!n&&!i&&Me(e),r=!n&&!i&&!o&&Be(e),s=n||i||o||r,a=s?function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}(e.length,String):[],l=a.length;for(var u in e)!t&&!q.call(e,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||r&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Pe(u,l))||a.push(u);return a}(e):function(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||B))return ne(e);var t,n,i=[];for(var o in Object(e))q.call(e,o)&&"constructor"!=o&&i.push(o);return i}(e);var t}e.exports=function(e,t){return Ne(e,t)}},360(e,t,n){"use strict";var i=n(8495);function o(){}function r(){}r.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,r,s){if(s!==i){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r,resetWarningCache:o};return n.PropTypes=n,n}},9422(e,t,n){e.exports=n(360)()},8495(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9833(e,t,n){"use strict";Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return c.default}}),t.default=void 0;var i=function(e){if("function"==typeof WeakMap){var t=new WeakMap;new WeakMap}return function(e){if(e&&e.__esModule)return e;var n,i,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(n=t){if(n.has(e))return n.get(e);n.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?n(o,t,i):o[t]=e[t]);return o}(e)}(n(1594)),o=p(n(9422)),r=p(n(5206)),s=n(3705),a=n(5435),l=n(187),u=n(590),c=p(n(2522)),d=p(n(7390));function p(e){return e&&e.__esModule?e:{default:e}}function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},h.apply(null,arguments)}function f(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class g extends i.Component{static getDerivedStateFromProps(e,t){let{position:n}=e,{prevPropsPosition:i}=t;return!n||i&&n.x===i.x&&n.y===i.y?null:((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:n,prevPropsPosition:i}),{x:n.x,y:n.y,prevPropsPosition:{...n}})}constructor(e){super(e),f(this,"onDragStart",(e,t)=>{if((0,d.default)("Draggable: onDragStart: %j",t),!1===this.props.onStart(e,(0,l.createDraggableData)(this,t)))return!1;this.setState({dragging:!0,dragged:!0})}),f(this,"onDrag",(e,t)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",t);const n=(0,l.createDraggableData)(this,t),i={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){const{x:e,y:t}=i;i.x+=this.state.slackX,i.y+=this.state.slackY;const[o,r]=(0,l.getBoundPosition)(this,i.x,i.y);i.x=o,i.y=r,i.slackX=this.state.slackX+(e-i.x),i.slackY=this.state.slackY+(t-i.y),n.x=i.x,n.y=i.y,n.deltaX=i.x-this.state.x,n.deltaY=i.y-this.state.y}if(!1===this.props.onDrag(e,n))return!1;this.setState(i)}),f(this,"onDragStop",(e,t)=>{if(!this.state.dragging)return!1;if(!1===this.props.onStop(e,(0,l.createDraggableData)(this,t)))return!1;(0,d.default)("Draggable: onDragStop: %j",t);const n={dragging:!1,slackX:0,slackY:0};if(Boolean(this.props.position)){const{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)}),this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},!e.position||e.onDrag||e.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??r.default.findDOMNode(this)}render(){const{axis:e,bounds:t,children:n,defaultPosition:o,defaultClassName:r,defaultClassNameDragging:u,defaultClassNameDragged:d,position:p,positionOffset:f,scale:g,...m}=this.props;let y={},v=null;const b=!Boolean(p)||this.state.dragging,w=p||o,_={x:(0,l.canDragX)(this)&&b?this.state.x:w.x,y:(0,l.canDragY)(this)&&b?this.state.y:w.y};this.state.isElementSVG?v=(0,a.createSVGTransform)(_,f):y=(0,a.createCSSTransform)(_,f);const S=(0,s.clsx)(n.props.className||"",r,{[u]:this.state.dragging,[d]:this.state.dragged});return i.createElement(c.default,h({},m,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),i.cloneElement(i.Children.only(n),{className:S,style:{...n.props.style,...y},transform:v}))}}t.default=g,f(g,"displayName","Draggable"),f(g,"propTypes",{...c.default.propTypes,axis:o.default.oneOf(["both","x","y","none"]),bounds:o.default.oneOfType([o.default.shape({left:o.default.number,right:o.default.number,top:o.default.number,bottom:o.default.number}),o.default.string,o.default.oneOf([!1])]),defaultClassName:o.default.string,defaultClassNameDragging:o.default.string,defaultClassNameDragged:o.default.string,defaultPosition:o.default.shape({x:o.default.number,y:o.default.number}),positionOffset:o.default.shape({x:o.default.oneOfType([o.default.number,o.default.string]),y:o.default.oneOfType([o.default.number,o.default.string])}),position:o.default.shape({x:o.default.number,y:o.default.number}),className:u.dontSetMe,style:u.dontSetMe,transform:u.dontSetMe}),f(g,"defaultProps",{...c.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})},2522(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=function(e){if("function"==typeof WeakMap){var t=new WeakMap;new WeakMap}return function(e){if(e&&e.__esModule)return e;var n,i,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(n=t){if(n.has(e))return n.get(e);n.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?n(o,t,i):o[t]=e[t]);return o}(e)}(n(1594)),o=c(n(9422)),r=c(n(5206)),s=n(5435),a=n(187),l=n(590),u=c(n(7390));function c(e){return e&&e.__esModule?e:{default:e}}function d(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const p={start:"touchstart",move:"touchmove",stop:"touchend"},h={start:"mousedown",move:"mousemove",stop:"mouseup"};let f=h;class g extends i.Component{constructor(){super(...arguments),d(this,"dragging",!1),d(this,"lastX",NaN),d(this,"lastY",NaN),d(this,"touchIdentifier",null),d(this,"mounted",!1),d(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!(0,s.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,s.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;"touchstart"!==e.type||this.props.allowMobileScroll||e.preventDefault();const i=(0,s.getTouchIdentifier)(e);this.touchIdentifier=i;const o=(0,a.getControlPosition)(e,i,this);if(null==o)return;const{x:r,y:l}=o,c=(0,a.createCoreData)(this,r,l);(0,u.default)("DraggableCore: handleDragStart: %j",c),(0,u.default)("calling",this.props.onStart),!1!==this.props.onStart(e,c)&&!1!==this.mounted&&(this.props.enableUserSelectHack&&(0,s.addUserSelectStyles)(n),this.dragging=!0,this.lastX=r,this.lastY=l,(0,s.addEvent)(n,f.move,this.handleDrag),(0,s.addEvent)(n,f.stop,this.handleDragStop))}),d(this,"handleDrag",e=>{const t=(0,a.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:i}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=i-this.lastY;if([e,t]=(0,a.snapToGrid)(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,i=this.lastY+t}const o=(0,a.createCoreData)(this,n,i);if((0,u.default)("DraggableCore: handleDrag: %j",o),!1!==this.props.onDrag(e,o)&&!1!==this.mounted)this.lastX=n,this.lastY=i;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch(e){const t=document.createEvent("MouseEvents");t.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(t)}}),d(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,a.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:i}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=i-this.lastY||0;[e,t]=(0,a.snapToGrid)(this.props.grid,e,t),n=this.lastX+e,i=this.lastY+t}const o=(0,a.createCoreData)(this,n,i);if(!1===this.props.onStop(e,o)||!1===this.mounted)return!1;const r=this.findDOMNode();r&&this.props.enableUserSelectHack&&(0,s.scheduleRemoveUserSelectStyles)(r.ownerDocument),(0,u.default)("DraggableCore: handleDragStop: %j",o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,r&&((0,u.default)("DraggableCore: Removing handlers"),(0,s.removeEvent)(r.ownerDocument,f.move,this.handleDrag),(0,s.removeEvent)(r.ownerDocument,f.stop,this.handleDragStop))}),d(this,"onMouseDown",e=>(f=h,this.handleDragStart(e))),d(this,"onMouseUp",e=>(f=h,this.handleDragStop(e))),d(this,"onTouchStart",e=>(f=p,this.handleDragStart(e))),d(this,"onTouchEnd",e=>(f=p,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,s.addEvent)(e,p.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,s.removeEvent)(t,h.move,this.handleDrag),(0,s.removeEvent)(t,p.move,this.handleDrag),(0,s.removeEvent)(t,h.stop,this.handleDragStop),(0,s.removeEvent)(t,p.stop,this.handleDragStop),(0,s.removeEvent)(e,p.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,s.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:r.default.findDOMNode(this)}render(){return i.cloneElement(i.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}t.default=g,d(g,"displayName","DraggableCore"),d(g,"propTypes",{allowAnyClick:o.default.bool,allowMobileScroll:o.default.bool,children:o.default.node.isRequired,disabled:o.default.bool,enableUserSelectHack:o.default.bool,offsetParent:function(e,t){if(e[t]&&1!==e[t].nodeType)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:o.default.arrayOf(o.default.number),handle:o.default.string,cancel:o.default.string,nodeRef:o.default.object,onStart:o.default.func,onDrag:o.default.func,onStop:o.default.func,onMouseDown:o.default.func,scale:o.default.number,className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),d(g,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})},5412(e,t,n){"use strict";const{default:i,DraggableCore:o}=n(9833);e.exports=i,e.exports.default=i,e.exports.DraggableCore=o},5435(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addClassName=u,t.addEvent=function(e,t,n,i){if(!e)return;const o={capture:!0,...i};e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},t.addUserSelectStyles=function(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",t.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",e.getElementsByTagName("head")[0].appendChild(t)),e.body&&u(e.body,"react-draggable-transparent-selection")},t.createCSSTransform=function(e,t){const n=a(e,t,"px");return{[(0,o.browserPrefixToKey)("transform",o.default)]:n}},t.createSVGTransform=function(e,t){return a(e,t,"")},t.getTouch=function(e,t){return e.targetTouches&&(0,i.findInArray)(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&(0,i.findInArray)(e.changedTouches,e=>t===e.identifier)},t.getTouchIdentifier=function(e){return e.targetTouches&&e.targetTouches[0]?e.targetTouches[0].identifier:e.changedTouches&&e.changedTouches[0]?e.changedTouches[0].identifier:void 0},t.getTranslation=a,t.innerHeight=function(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,i.int)(n.paddingTop),t-=(0,i.int)(n.paddingBottom),t},t.innerWidth=function(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,i.int)(n.paddingLeft),t-=(0,i.int)(n.paddingRight),t},t.matchesSelector=s,t.matchesSelectorAndParentsTo=function(e,t,n){let i=e;do{if(s(i,t))return!0;if(i===n)return!1;i=i.parentNode}while(i);return!1},t.offsetXYFromParent=function(e,t,n){const i=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-i.left)/n,y:(e.clientY+t.scrollTop-i.top)/n}},t.outerHeight=function(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,i.int)(n.borderTopWidth),t+=(0,i.int)(n.borderBottomWidth),t},t.outerWidth=function(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,i.int)(n.borderLeftWidth),t+=(0,i.int)(n.borderRightWidth),t},t.removeClassName=c,t.removeEvent=function(e,t,n,i){if(!e)return;const o={capture:!0,...i};e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},t.scheduleRemoveUserSelectStyles=function(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{l(e)}):l(e)};var i=n(590),o=function(e){if("function"==typeof WeakMap){var t=new WeakMap;new WeakMap}return function(e){if(e&&e.__esModule)return e;var n,i,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(n=t){if(n.has(e))return n.get(e);n.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?n(o,t,i):o[t]=e[t]);return o}(e)}(n(9188));let r="";function s(e,t){return r||(r=(0,i.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,i.isFunction)(e[t])})),!!(0,i.isFunction)(e[r])&&e[r](t)}function a(e,t,n){let{x:i,y:o}=e,r=`translate(${i}${n},${o}${n})`;return t&&(r=`translate(${"string"==typeof t.x?t.x:t.x+n}, ${"string"==typeof t.y?t.y:t.y+n})`+r),r}function l(e){if(e)try{if(e.body&&c(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&"Caret"!==t.type&&t.removeAllRanges()}}catch(e){}}function u(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function c(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(`(?:^|\\s)${t}(?!\\S)`,"g"),"")}},9188(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.browserPrefixToKey=o,t.browserPrefixToStyle=function(e,t){return t?`-${t.toLowerCase()}-${e}`:e},t.default=void 0,t.getPrefix=i;const n=["Moz","Webkit","O","ms"];function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";const t=window.document?.documentElement?.style;if(!t)return"";if(e in t)return"";for(let i=0;i<n.length;i++)if(o(e,n[i])in t)return n[i];return""}function o(e,t){return t?`${t}${function(e){let t="",n=!0;for(let i=0;i<e.length;i++)n?(t+=e[i].toUpperCase(),n=!1):"-"===e[i]?n=!0:t+=e[i];return t}(e)}`:e}t.default=i()},7390(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){}},187(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canDragX=function(e){return"both"===e.props.axis||"x"===e.props.axis},t.canDragY=function(e){return"both"===e.props.axis||"y"===e.props.axis},t.createCoreData=function(e,t,n){const o=!(0,i.isNum)(e.lastX),s=r(e);return o?{node:s,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:s,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}},t.createDraggableData=function(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}},t.getBoundPosition=function(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:s}=e.props;s="string"==typeof s?s:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(s);const a=r(e);if("string"==typeof s){const{ownerDocument:e}=a,t=e.defaultView;let n;if(n="parent"===s?a.parentNode:a.getRootNode().querySelector(s),!(n instanceof t.HTMLElement))throw new Error('Bounds selector "'+s+'" could not find an element.');const r=n,l=t.getComputedStyle(a),u=t.getComputedStyle(r);s={left:-a.offsetLeft+(0,i.int)(u.paddingLeft)+(0,i.int)(l.marginLeft),top:-a.offsetTop+(0,i.int)(u.paddingTop)+(0,i.int)(l.marginTop),right:(0,o.innerWidth)(r)-(0,o.outerWidth)(a)-a.offsetLeft+(0,i.int)(u.paddingRight)-(0,i.int)(l.marginRight),bottom:(0,o.innerHeight)(r)-(0,o.outerHeight)(a)-a.offsetTop+(0,i.int)(u.paddingBottom)-(0,i.int)(l.marginBottom)}}return(0,i.isNum)(s.right)&&(t=Math.min(t,s.right)),(0,i.isNum)(s.bottom)&&(n=Math.min(n,s.bottom)),(0,i.isNum)(s.left)&&(t=Math.max(t,s.left)),(0,i.isNum)(s.top)&&(n=Math.max(n,s.top)),[t,n]},t.getControlPosition=function(e,t,n){const i="number"==typeof t?(0,o.getTouch)(e,t):null;if("number"==typeof t&&!i)return null;const s=r(n),a=n.props.offsetParent||s.offsetParent||s.ownerDocument.body;return(0,o.offsetXYFromParent)(i||e,a,n.props.scale)},t.snapToGrid=function(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]};var i=n(590),o=n(5435);function r(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}},590(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dontSetMe=function(e,t,n){if(e[t])return new Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)},t.findInArray=function(e,t){for(let n=0,i=e.length;n<i;n++)if(t.apply(t,[e[n],n,e]))return e[n]},t.int=function(e){return parseInt(e,10)},t.isFunction=function(e){return"function"==typeof e||"[object Function]"===Object.prototype.toString.call(e)},t.isNum=function(e){return"number"==typeof e&&!isNaN(e)}},3861(e){const t=/^[-+]?0x[a-fA-F0-9]+$/,n=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,i={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};e.exports=function(e,o={}){if(o=Object.assign({},i,o),!e||"string"!=typeof e)return e;let r=e.trim();if(void 0!==o.skipLike&&o.skipLike.test(r))return e;if("0"===e)return 0;if(o.hex&&t.test(r))return function(e){if(parseInt)return parseInt(e,16);if(Number.parseInt)return Number.parseInt(e,16);if(window&&window.parseInt)return window.parseInt(e,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(r);if(-1!==r.search(/[eE]/)){const t=r.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(t){if(o.leadingZeros)r=(t[1]||"")+t[3];else if("0"!==t[2]||"."!==t[3][0])return e;return o.eNotation?Number(r):e}return e}{const t=n.exec(r);if(t){const n=t[1],i=t[2];let a=(s=t[3])&&-1!==s.indexOf(".")?("."===(s=s.replace(/0+$/,""))?s="0":"."===s[0]?s="0"+s:"."===s[s.length-1]&&(s=s.substr(0,s.length-1)),s):s;if(!o.leadingZeros&&i.length>0&&n&&"."!==r[2])return e;if(!o.leadingZeros&&i.length>0&&!n&&"."!==r[1])return e;if(o.leadingZeros&&i===e)return 0;{const t=Number(r),s=""+t;return-1!==s.search(/[eE]/)?o.eNotation?t:e:-1!==r.indexOf(".")?"0"===s&&""===a||s===a||n&&s==="-"+a?t:e:i?a===s||n+a===s?t:e:r===s||r===n+s?t:e}}return e}var s}},9638(e){"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var r={},s=[],a=0;a<e.length;a++){var l=e[a],u=i.base?l[0]+i.base:l[0],c=r[u]||0,d="".concat(u," ").concat(c);r[u]=c+1;var p=n(d),h={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)t[p].references++,t[p].updater(h);else{var f=o(h,i);i.byIndex=a,t.splice(a,0,{identifier:d,updater:f,references:1})}s.push(d)}return s}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var r=i(e=e||[],o=o||{});return function(e){e=e||[];for(var s=0;s<r.length;s++){var a=n(r[s]);t[a].references--}for(var l=i(e,o),u=0;u<r.length;u++){var c=n(r[u]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}r=l}}},1797(e){"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},6306(e){"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},8134(e,t,n){"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},8911(e){"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},215(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},8586(e,t,n){"use strict";n.d(t,{REALTIME_FAILURE_KINDS:()=>i.tO,REALTIME_TIMING:()=>i.Vl,nextReconnectDelay:()=>i.oV});var i=n(9733)},606(e,t,n){"use strict";function i(e){return"supported"===e.state||"degraded"===e.state}n.d(t,{Ng:()=>i,bZ:()=>o}),Object.freeze(["data.query","data.count","data.distinct","data.aggregate","data.fetch","data.create","data.save","data.increment","data.delete","data.acl","data.search","relations.pointerRead","relations.relatedTo","relations.addRemove","files.upload","files.sign","files.delete","files.private","files.progress","auth.password","auth.signUp","auth.signUpProperties","auth.emailVerify","auth.passwordReset","auth.oauth","auth.magicLink","realtime.subscribe"]);var o=3e5},862(e,t,n){"use strict";n.d(t,{RZ:()=>I}),n(606);var i=n(742),o=function(e){return{state:"supported",evidence:e}},r=function(e,t){return{state:"unsupported",reason:e,evidence:t}},s=function(e,t){return{state:"degraded",reason:e,evidence:t}},a=function(e,t,n){return{state:"conditional",reason:e,probe:t,evidence:n}};function l(e,t){for(var n,o={},r=0,s=i.Dj;r<s.length;r++){var a=s[r];o[a]=null!==(n=t[a])&&void 0!==n?n:e}return Object.freeze(o)}var u,c,d,p=function(e){return"NodeGX doesn't know whether your API can ".concat(e,". Tell it in the backend's Capabilities tab, and this will work.")},h="Default floor for an undeclared custom backend. The user overrides this per instance.",f={type:"custom",tokenLifecycle:{kind:"eternal"},declarable:!0,capabilities:Object.freeze({"data.query":o("the list endpoint is required by the custom preset form"),"data.fetch":o("the get endpoint is required by the custom preset form"),"data.create":o("the create endpoint is required by the custom preset form"),"data.save":o("the update endpoint is required by the custom preset form"),"data.delete":o("the delete endpoint is required by the custom preset form"),"data.count":r(p("count records"),h),"data.distinct":r(p("list distinct values"),h),"data.aggregate":r(p("total or average records"),h),"data.increment":r(p("add to a number in one step"),h),"data.acl":r(p("set permissions per record"),h),"data.search":r(p("search"),h),"relations.pointerRead":r(p("resolve related records"),h),"relations.relatedTo":r(p("filter by related records"),h),"relations.addRemove":r(p("add and remove related records"),h),"files.upload":r(p("store files"),h),"files.sign":r(p("make temporary file links"),h),"files.delete":r(p("delete files"),h),"files.private":r(p("keep files private"),h),"files.progress":r(p("report upload progress"),h),"auth.password":r(p("sign people in"),h),"auth.signUp":r(p("let people sign up"),h),"auth.signUpProperties":r(p("save profile details at sign-up"),h),"auth.emailVerify":r(p("verify email addresses"),h),"auth.passwordReset":r(p("reset passwords"),h),"auth.oauth":r(p("sign people in with Google or GitHub"),h),"auth.magicLink":r(p("send magic-link logins"),h),"realtime.subscribe":r(p("push live updates"),h)}),filters:l(r(p("filter this way"),h),{equalTo:o("the custom preset form configures query-parameter equality"),idEqualTo:o("the get endpoint takes an id by definition")})},g=function(){return g=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},g.apply(this,arguments)},m=(c="".concat(u="The characters % and _ act as wildcards here, so searching for text containing one will match more than you asked for."," Matching also ignores capitals."),{contains:s(c,d='BCN-003 live: LIKE with no ESCAPE clause; contains "100%" also returned "1000 words"'),notContains:s(c,d),containsIgnoreCase:s(u,d),startsWith:s(c,d),notStartsWith:s(c,d),startsWithIgnoreCase:s(u,d),endsWith:s(c,d),notEndsWith:s(c,d),endsWithIgnoreCase:s(u,d)}),y={type:"directus",tokenLifecycle:{kind:"refresh",accessTtlSeconds:900,refreshEndpoint:"/auth/refresh",refreshBeforeExpirySeconds:60},capabilities:Object.freeze({"data.query":o("RUN-003: GET /items/articles with a filter returned 4 records"),"data.count":o('BCN-001: aggregate[count]=* returned {"count":4}'),"data.distinct":o("BCN-001: groupBy alone returns one row per distinct value"),"data.aggregate":o("BCN-001: count/sum/avg, groupBy, and a composed filter all answered — no opt-in"),"data.fetch":o("RUN-003: GET /items/{collection}/{id}"),"data.create":o("RUN-003: POST /items/articles returned 200, id=4"),"data.save":o("PATCH /items/{collection}/{id} — byob-update-record.ts ships against it"),"data.delete":o("DELETE /items/{collection}/{id} — byob-delete-record.ts ships against it"),"data.increment":s("Directus has no way to add to a number in one step, so NodeGX reads the value and writes it back. If two people increment the same record at the same moment, one of the changes can be lost.","No atomic increment in the Directus items API; read-modify-write is the only route."),"data.acl":r("Directus controls access with roles and permissions, set up in your Directus admin — not per record from here.","Directus permissions are role-scoped policy, not a per-record ACL field."),"data.search":s("Directus searches every field in the record, not just the text ones, and does not rank the results. Expect matches you did not intend. For ranked search, use the built-in backend.","BCN-001: ?search=Published returned three articles matched on their status field, unranked"),"relations.pointerRead":o("BCN-005 live: ?fields=*,author.* nests the author. An M2M needs two hops (tags.tag_id.*) because one hop returns junction rows; the adapter emits the two-hop path and flattens the result"),"relations.relatedTo":r('Filtering by "records related to this one" is not available on Directus. Filter on a field of the related record instead, such as author → name.',"BCN-005 live: filtering across a relation works via a nested path ({author:{city:{_eq}}}) and across an M2M via the junction, but Parse's $relatedTo asks for members of one record's relation set, which has no Directus spelling. The dotted-path filter is the replacement and it is measured working"),"relations.addRemove":s("Adding a related record writes a row in a join table, and Directus join tables allow the same pair twice. NodeGX checks first so you will not get duplicates, but if two people add the same one at the same moment you can.",'BCN-005 live: POST junction row 200; the same pair posted twice creates a second row, so addRelation reads before it writes. DELETE of a pair that never existed answers 204, so a remove cannot report "was not there"'),"files.upload":o("BCN-007 live: POST /files multipart answers 200 (not 201) with the stored file; the field map is filename_download / type / filesize and `id` is the handle"),"files.sign":s("A Directus file link carries your own sign-in rather than a signature, so it works for you and not for anyone you send it to — and it stops working when you sign out. The Sign File URL node reports this on its URL Kind output.","BCN-007 live: Directus has no per-asset token to mint. /assets/{id} answers 403 with no credential and 200 with ?access_token=<the session JWT>; a tampered token is 403. The JWT declares a 900s life, which is the SESSION's expiry, not the link's"),"files.delete":o("BCN-007 live: DELETE /files/{id} answers 204. ⚠️ The spec's claim that Directus refuses to delete a REFERENCED file is FALSE — measured with a real directus_files relation created via POST /relations, the delete succeeds and the referencing row's field becomes null. Reading a deleted file is 403, the same answer as for a file that never existed, so an adapter cannot report which happened"),"files.private":s("Files on Directus are only as private as the role permissions on directus_files, which NodeGX does not set for you. A file uploaded through NodeGX is readable by whoever your Directus roles say it is.","BCN-007 live: /assets/{id} is 403 for an anonymous caller on a default install, so files are NOT public by default — but there is no per-file privacy flag for an upload to set, unlike the X-NodeGX-File-Private header ours takes"),"files.progress":s("The upload works but the progress bar will not move on this backend.",'⚠️ CORRECTED by BCN-007. This cell read `supported` with the evidence "XHR upload path is client-side", which was written before RestDataAdapter existed — that adapter is built on `fetch`, and `fetch` has no upload-progress event. Nothing synthetic is emitted: a bar that jumps 0→100 tells an author their instrumentation works when it does not'),"auth.password":o("POST /auth/login"),"auth.signUp":a("Letting people sign themselves up needs public registration turned on in your Directus settings. It is off by default.",{method:"POST",path:"/users/register",expect:"anything other than 403 FORBIDDEN"},"Directus public registration is opt-in per project."),"auth.signUpProperties":s("Directus stores the login and the profile separately, so signing up takes two steps. If the second one fails the account still exists, without the profile details.","directus_users holds credentials; profile fields typically live in a separate collection."),"auth.emailVerify":a("Verification emails need email set up in your Directus instance.",{method:"GET",path:"/server/info",expect:"a project mail configuration"},"Directus EMAIL_TRANSPORT is deployment configuration."),"auth.passwordReset":a("Password reset emails need email set up in your Directus instance.",{method:"POST",path:"/auth/password/request",expect:"anything other than a mail-transport error"},"Same EMAIL_TRANSPORT dependency."),"auth.oauth":r("NodeGX cannot complete a Directus single sign-on yet. Directus returns the session as a browser cookie rather than in the response, which needs a different kind of session than NodeGX stores. Use email and password on this backend.",'MEASURED 2026-08-01 on Directus 11: GET /auth -> {"data":[],"disableDefault":false}; GET /auth/login/google -> 404 ROUTE_NOT_FOUND. The blocker is the cookie-carried session, not the provider list — GET /auth is still read by listAuthProviders so a builder can see what the instance offers.'),"auth.magicLink":r("Directus has no magic-link login. Use email and password, or an OAuth provider.","No passwordless flow in the Directus auth API."),"realtime.subscribe":a("Live updates need WebSockets enabled on your Directus instance. They are off by default.",{method:"GET",kind:"websocket",path:"/websocket",expect:"a 101 upgrade. Nothing else settles it — /server/info says nothing about websockets even when they are on. Give up after a deadline: a Directus server that does not upgrade a path fires NEITHER error NOR close (measured silent for 20s)."},'BCN-008, live against Directus 11 with WEBSOCKETS_ENABLED=true: open in single-digit ms, auth ok, subscribe confirmed by an `init` frame. A delete on an INTEGER primary key arrives as data:["1"] — keys only, coerced to string. Server pings every 30s and closes a client that does not pong (measured at 60s, code 1005).')}),filters:l(o("native Directus filter operator"),g(g({matchesRegex:r('Directus cannot match text with regular expressions. Use "contains", "starts with" or "ends with" instead.','BCN-003 live: 400 — "string field type does not contain the _regex filter operator"')},m),{isEmpty:s('On Directus, "is empty" also matches records where the field was never set.',"BCN-003 live: _empty returned both the empty-string row and the NULL row"),isNotEmpty:s('On Directus, "is not empty" also excludes records where the field was never set.',"BCN-003 live: the complement of the above"),path:r("Following several links in one request is not available on Directus yet. Filter one link at a time with a nested field.","BCN-005 live: one hop works as a nested path ({author:{city:{_eq}}}); deeper paths not driven, no translator"),relatedTo:r('Filtering by "records related to this one" is not available on Directus yet.',"Needs a junction-table query. BCN-005."),textSearch:s("Directus searches every field in the record and does not rank the results.","BCN-001: ?search= is substring-across-all-fields"),nearSphere:r("Location filters aren't available on Directus.","No geo operators in the Directus filter syntax."),withinBox:r("Location filters aren't available on Directus.","No geo operators."),withinPolygon:r("Location filters aren't available on Directus.","No geo operators.")}))},v="nodegx-backend/src/server/parse-wire.ts",b="noodl-runtime/src/api/adapters/local-sql/QueryBuilder.ts",w="; driven live in BCN-002",_={type:"nodegx",tokenLifecycle:{kind:"eternal"},capabilities:Object.freeze({"data.query":o("POST/GET /classes/:c — ".concat(v,":6").concat(w,", including a $gt filter")),"data.count":o("GET /classes/:c with count=1 — ".concat(v,":7").concat(w)),"data.distinct":o("GET /aggregate/:c — ".concat(v,":246-284, ACL-governed, no master key").concat(w," with the app id alone, where upstream Parse refuses")),"data.aggregate":o("GET /aggregate/:c — ".concat(v,":246-284, ACL-governed, no master key").concat(w," with the app id alone, where upstream Parse refuses")),"data.fetch":o("GET /classes/:c/:id — ".concat(v,":8").concat(w)),"data.create":o("POST /classes/:c — ".concat(v,":6").concat(w)),"data.save":o("PUT /classes/:c/:id — ".concat(v,":9").concat(w)),"data.increment":o("PUT with __op: 'Increment' — ".concat(v,":88, atomic").concat(w)),"data.delete":o("DELETE /classes/:c/:id — ".concat(v,":10").concat(w)),"data.acl":o("BAK-003: CLP + row-level ACL, filtered in SQL"),"data.search":o("BAK-008: FTS5 ranking on a dedicated `search` parameter — parse-wire.ts:126"),"relations.pointerRead":o("Pointer columns resolve via include"),"relations.relatedTo":o("junction-table subquery on _Join_<key>_<class> — ".concat(b,":254")),"relations.addRemove":o("PUT with __op AddRelation/RemoveRelation — ".concat(v,":90").concat(w,", both directions")),"files.upload":o("BAK-006 file storage v2".concat(w," with the app id alone, where a stock Parse Server refuses outright")),"files.sign":o("BAK-006: SigV4 presign, or a local signed URL".concat(w,", returning a url with exp and sig. BCN-007 live: the signature really expires (403 after the ttl) and a tampered one is refused — but on a file that was never private, an expired link still serves")),"files.delete":o("BAK-006".concat(w," with the app id alone, where upstream Parse needs the master key. Permanent (blob + _Files row + cached thumbnails), idempotent on an unknown name (200, not 404), and leaves File-typed record properties pointing at a URL that now 404s — files.ts delete()")),"files.private":s("A private upload is locked to the person who made it, so a file uploaded by anything other than a signed-in user — an admin tool, a cloud function — ends up private with no owner, and stays readable by everyone.","BCN-007 live, security enforced: uploaded as a signed-in user, the plain URL is 403 for anonymous AND for a second signed-in user. Uploaded with the master key, the identical request with X-NodeGX-File-Private: true serves 200 to anonymous — files.ts::upload sets owner=null for a non-user principal"),"files.progress":o("XHR upload path reports progress"),"auth.password":o("nodegx-backend/src/server/users.ts"),"auth.signUp":o("nodegx-backend/src/server/users.ts"),"auth.signUpProperties":o("the user is a record in a collection, so profile fields write in the same call"),"auth.emailVerify":o("BAK-002: SMTP + templates"),"auth.passwordReset":o("BAK-002"),"auth.oauth":o("BAK-004"),"auth.magicLink":o("BAK-004 passwordless"),"realtime.subscribe":o('BAK-001: SSE at GET /realtime, not Parse LiveQuery. BCN-008 measured it live: `connected` frame carries a server-minted clientId, POST /realtime/subscriptions answers 200 {accepted:[…]}, create/update/delete all arrive as `change` frames carrying the WHOLE record (a delete included). Heartbeat is a `: heartbeat` comment every 25s, which the client owes nothing back. A Last-Event-ID reconnect answers `connected` with a fresh clientId then `resync{reason:"reconnect"}`.')}),filters:l(o("translated to SQL — ".concat(b)),{matchesRegex:o("".concat(b,' — a registered SQL function evaluating a real RegExp; probed live in BCN-003, where ^Ada$ matched "Ada" and not "Adam"')),textSearch:s("Full-text search in a filter falls back to a plain contains match. For ranked search use the Search input on the Query node instead.","".concat(b," — $text lowers to LIKE; the ranked path is BAK-008's separate 'search' parameter")),nearSphere:s("Distance filters work, but the results are not ordered by how close they are, and the whole collection is checked — so a large collection will be slow.","".concat(b," — nodegx_distance_km(), haversine; Parse reads a bare $nearSphere as a proximity *sort*, and sorting is out of BCN-003's scope")),withinBox:o("".concat(b," — two range comparisons on json_extract'd coordinates; exact, but unindexed")),path:o("".concat(b," buildPathPredicate — conformance/cases/paths.ts on SQLite and PostgreSQL: a membership business's four paths (depth 1, 2, 4 and 5), a repeated hop bounded at 3, dedupe, the ACL at every hop, and five refusals by name; ceiling ").concat("8"," hops")),withinPolygon:o("".concat(b," — nodegx_point_in_polygon(), ray casting. Planar, which is what Mongo's legacy $polygon is too, so this agrees with Parse rather than diverging from it"))})},S="cloudstore.js has spoken this wire since Noodl; documented, not probed",O="BCN-002 live pass against parse-server 7.3.0, app id only",N={type:"parse",tokenLifecycle:{kind:"eternal"},capabilities:Object.freeze({"data.query":o("".concat(O,"; filtered read with $gt returned the matching row only")),"data.count":o(O),"data.aggregate":r("Parse Server only allows totals and averages from a trusted server, not from your app. Query the records and calculate in your app, or switch this node to the built-in backend.","".concat(O,': 403 "unauthorized: master key is required"; the same call with the master key returns 200 and the total')),"data.distinct":r("Parse Server only allows distinct values from a trusted server, not from your app.","".concat(O,": /aggregate?distinct= is refused without the master key and answers 200 with it")),"data.fetch":o(O),"data.create":o(O),"data.save":o(O),"data.increment":o("__op: 'Increment' is atomic on Parse. ".concat(O,", and the response carried the new value")),"data.delete":o(O),"data.acl":o("Parse ACLs are the model BAK-003 was built to match. ".concat(S)),"data.search":r('Parse Server has no ranked search. Use a "contains" filter on the field you want to search, or switch this node to the built-in backend.',"The search parameter is BAK-008, ours. Parse offers $text as a filter operator only."),"relations.pointerRead":o(S),"relations.relatedTo":o("$relatedTo is Parse's own operator. ".concat(S)),"relations.addRemove":o("__op AddRelation/RemoveRelation. ".concat(O,", both directions, app id only")),"files.upload":a("Whether your Parse Server accepts uploads depends on how it was set up — new servers turn file uploads off. Ask whoever hosts yours to enable them.",{method:"POST",path:"/files/probe.txt",expect:'a 201 with a name and url, rather than error code 130 "File upload by public is disabled"'},"".concat(O,": a server started with Parse's defaults answers 400 code 130; the same server with fileUpload.enableForPublic accepts it")),"files.sign":r("Parse Server has no way to mint a temporary link to a file. Store files on the built-in backend if you need links that expire.","".concat(O,": GET /files/:name/sign answers 403 code 119 with the master key as well as without — the route is BAK-006's, not Parse's")),"files.delete":r("Parse Server only allows a file to be deleted from a trusted server, not from your app.","".concat(O,': DELETE /files/:name answers 403 "unauthorized: master key is required", and 200 with the master key')),"files.private":r("Parse Server files are public to anyone with the link. To keep a file private, store it on the built-in backend instead.","The private flag is the X-NodeGX-File-Private header — ours, not Parse's."),"files.progress":o("the XHR upload path is client-side and works against any wire"),"auth.password":o(S),"auth.signUp":o(S),"auth.signUpProperties":o("the Parse user is a row in _User, so profile fields write in the same call. ".concat(S)),"auth.emailVerify":a("Email verification needs your Parse Server to have an email adapter configured. Many do not.",{method:"POST",path:"/verificationEmailRequest",expect:'anything other than a "no email adapter" error'},"Parse Server verifyUserEmails requires a configured mail adapter. Documented, not probed."),"auth.passwordReset":a("Password reset emails need your Parse Server to have an email adapter configured. Many do not.",{method:"POST",path:"/requestPasswordReset",expect:'anything other than a "no email adapter" error'},"Same mail-adapter dependency as verification. Documented, not probed."),"auth.oauth":a("Signing in with Google, GitHub and the rest depends on which providers your Parse Server was set up with.",{method:"GET",path:"/serverInfo",expect:"an auth section listing configured providers"},"Parse authDataManager providers are server configuration. Documented, not probed."),"auth.magicLink":r("Parse Server has no magic-link login. Use email and password, or an OAuth provider.","No passwordless flow exists in the Parse REST API."),"realtime.subscribe":a("Live updates need a Parse LiveQuery server, which most Parse setups do not run. Check with whoever hosts yours.",{method:"GET",kind:"websocket",path:"/",expect:'a 101 upgrade on the ws:// endpoint, followed by a {"op":"connected"} reply to a connect op. The HTTP API cannot answer this question. Deadline the attempt — an absent LiveQuery server is SILENT in every place a client would look.'},'BCN-008, live against Parse Server 7.3.0: /parse/serverInfo advertises no liveQuery of any kind; ws://…/parse errors in 20ms with "Received network error or non-101 status code" and `close` never fires. That is a measurement that LiveQuery is ABSENT here, not that the protocol was exercised — no NodeGX code has ever spoken to a running LiveQuery server.')}),filters:l(o(S),{path:r('Following several links in one request is not available on Parse yet. Filter one link at a time with "points to" or "related to".',"Not driven. Parse spells it as nested $inQuery / $select; no translator writes that yet"),contains:o("lowered to $regex"),notContains:o("lowered to an anchored $regex with a negative lookahead — Parse has no $not"),containsIgnoreCase:o("lowered to $regex with the i option"),startsWith:o("lowered to an anchored $regex"),notStartsWith:o("lowered to an anchored $regex with a negative lookahead"),startsWithIgnoreCase:o("lowered to an anchored $regex with the i option"),endsWith:o("lowered to an anchored $regex"),notEndsWith:o("lowered to an anchored $regex with a negative lookahead"),endsWithIgnoreCase:o("lowered to an anchored $regex with the i option"),between:o("lowered to $gte + $lte on one field, which Parse allows"),notBetween:o("lowered to $lt + $gt under $or"),isEmpty:r('Parse Server can\'t tell an empty value from a missing one. Use "is not set" instead, or compare the field to an empty string.',"No $empty equivalent; $exists answers presence only."),isNotEmpty:r('Parse Server can\'t tell an empty value from a missing one. Use "is set" instead.',"No $nempty equivalent."),textSearch:a("Full-text search on Parse needs a text index on the field, created in your database.",{method:"GET",path:"/classes/{collection}",expect:"a $text query returning without an index error"},"Parse $text requires a MongoDB text index. Documented, not probed.")})},C=function(){return C=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},C.apply(this,arguments)},x=function(){var e="The characters % and _ act as wildcards here, so searching for text containing one will match more than you asked for.",t="".concat(e," Matching also ignores capitals."),n="BCN-003 live: ~ is LIKE with no ESCAPE clause; a backslash is matched literally";return{contains:s(t,n),notContains:s(t,n),containsIgnoreCase:s(e,n),startsWith:s(t,n),notStartsWith:s(t,n),startsWithIgnoreCase:s(e,n),endsWith:s(t,n),notEndsWith:s(t,n),endsWithIgnoreCase:s(e,n)}}(),T={type:"pocketbase",tokenLifecycle:{kind:"refresh",accessTtlSeconds:1209600,refreshEndpoint:"/api/collections/{collection}/auth-refresh",refreshBeforeExpirySeconds:3600},capabilities:Object.freeze({"data.query":o("GET /api/collections/{c}/records with filter/sort/expand"),"data.count":o("BCN-001 probe: totalItems and totalPages on every list response"),"data.aggregate":r("PocketBase can't total or average records on the server. Query the records and calculate in your app, or make a view collection in the PocketBase admin that does the grouping.","BCN-001 probe: PocketBase returns 200 and un-aggregated rows for every spelling tried; an invented parameter behaves identically. Nothing fails at runtime. A `view` collection wrapping a GROUP BY query does work and was verified — but that is schema authored by hand in the admin UI, not something a node can express."),"data.distinct":r("PocketBase can't list the distinct values of a field. Query the records and reduce them in your app.","BCN-001 probe: ?distinct=status silently returned all seven rows — the same ignore-the-parameter behaviour."),"data.fetch":o("GET /api/collections/{c}/records/{id}"),"data.create":o("POST /api/collections/{c}/records"),"data.save":o("PATCH /api/collections/{c}/records/{id}"),"data.delete":o("DELETE /api/collections/{c}/records/{id}"),"data.increment":o("PocketBase has the +/- field modifier: {'rating+': 1} is applied server-side"),"data.acl":r("PocketBase controls access with API rules, written per collection in the PocketBase admin — not per record from here.","API rules are collection-level filter expressions, not a per-record ACL field."),"data.search":s("PocketBase has no ranked search. NodeGX searches by looking for your text inside each field, which finds matches but cannot order them by relevance.","Lowered to a filter of ORed ~ (contains) conditions. No FTS index exists."),"relations.pointerRead":o('BCN-005 live: ?expand=author,tags nests both under `expand`. Filtering across a relation that can hold several records needs the "any of" form of the operator, which the adapter emits from the schema'),"relations.relatedTo":r('Filtering by "records related to this one" is not available on PocketBase. Filter on a field of the related record instead, such as author → name.',"BCN-005 live: dotted-path filters work (author.city='London', tags.label?='algebra'), but Parse's $relatedTo has no PocketBase spelling"),"relations.addRemove":o('BCN-005 live: PATCH {"tags+": id} and {"tags-": id} are applied server-side in one request and are set-shaped — appending a value already present leaves the list unchanged. ⚠️ On a relation that holds only one record, "+" replaces what is there and "-" clears it whichever id you name'),"files.upload":s("On PocketBase a file is a field on a record, not a thing of its own — so the Upload File node needs a Collection and a Field, and a Record ID if it should attach to a record that already exists rather than creating one. Leave them blank and the upload has nowhere to go.","BCN-007 live: a multipart POST to the RECORD endpoint answers 200 and the field holds a bare filename string. The handle is (collection, record id, filename) and FileRef.target carries it — the contract expresses it rather than approximating it, and this cell is degraded because the target is something the app author has to supply and cannot be guessed"),"files.sign":s("A PocketBase file link carries a token rather than a signature. It expires quickly (about three minutes on a default install) and it works for whoever holds it until then, so treat it as short-lived rather than shareable.","BCN-007 live: POST /api/files/token answers 200 with a JWT whose exp is 180s ahead, and ?token= serves a protected file. The token is per-CALLER, not per-file — its payload names a collection and an auth-record id, not the file"),"files.delete":s("Deleting a file on PocketBase edits the record it belongs to — the file goes and the record stays. Deleting the record instead takes its files with it.",'BCN-007 live: PATCH {field: null} answers 200, the field reads "" afterwards, and the file URL becomes 404. DELETE of the record also 404s the file. Neither is symmetric with our own DELETE /files/{name}, which removes a file and leaves records pointing at it'),"files.private":s('PocketBase files are protected by the same rule as the record they belong to, so a file is private only if its record is. Marking a field "protected" on a collection anyone can read does nothing.',"⚠️ BCN-007 live, and stronger than this cell previously claimed: a field created with protected:true — confirmed round-tripped as true by reading the collection back — SERVED WITH NO CREDENTIAL AT ALL when the collection's view rule was public. The same field on an admin-only collection answered 404. So `protected` defers to the record rule rather than being an independent file-level control"),"files.progress":s("The upload works but the progress bar will not move on this backend.",'⚠️ CORRECTED by BCN-007. This cell read `supported` with the evidence "multipart upload goes over the XHR path". It does not: RestDataAdapter is built on `fetch`, which has no upload-progress event'),"auth.password":o("POST /api/collections/{c}/auth-with-password"),"auth.signUp":o("POST /api/collections/{c}/records on an auth collection"),"auth.signUpProperties":o("the PocketBase user is a record in an auth collection, so profile fields write in the same call"),"auth.emailVerify":a("Verification emails need SMTP set up in your PocketBase admin. Without it PocketBase only logs the mail.",{method:"GET",path:"/api/settings",expect:"an smtp section with enabled: true"},"PocketBase falls back to logging mail rather than erroring, so a missing SMTP setup looks like success."),"auth.passwordReset":a("Password reset emails need SMTP set up in your PocketBase admin.",{method:"GET",path:"/api/settings",expect:"an smtp section with enabled: true"},"Same silent-log fallback as verification."),"auth.oauth":a("Signing in with Google, GitHub and the rest depends on which providers you have set up in your PocketBase admin.",{method:"GET",path:"/api/collections/{collection}/auth-methods",expect:"oauth2.enabled true, with at least one entry in oauth2.providers"},'MEASURED 2026-08-01 against PocketBase 0.30.0: with a provider configured, auth-methods returns oauth2.providers[] carrying a per-attempt state, codeVerifier and an authURL ending in a bare `redirect_uri=`; POST /api/collections/{c}/auth-with-oauth2 {provider, code, codeVerifier, redirectURL} answers 200 with {token, record, meta.isNew}. With OAuth off the same POST answers 403 "The collection is not configured to allow OAuth2 authentication."'),"auth.magicLink":r("PocketBase has no magic-link login. Use email and password, or an OAuth provider.","OTP exists in recent versions but is a code-entry flow, not a link. Revisit if BCN-006 adds an OTP node."),"realtime.subscribe":o('GET /api/realtime is Server-Sent Events, on by default — the same transport shape as BAK-001. BCN-008 measured it live against 0.30.0, anonymously and with no token anywhere: `PB_CONNECT` carries a clientId, POST /api/realtime {clientId, subscriptions:["coll"]} answers 204, and events arrive under an SSE event name that is the COLLECTION NAME rather than "change", with data {action, record}. A delete carries the whole record. Nothing at all arrived on an idle stream in 130s, so there is no observed keepalive. ⚠️ Subscribing to a collection the caller cannot list is ALSO 204 — acceptance is not gated, delivery is, so a wrong subscription is silent rather than refused.')}),filters:l(o("native PocketBase filter expression"),C(C({matchesRegex:r('PocketBase can\'t match text with regular expressions. Use "contains", "starts with" or "ends with" instead.',"The filter language has ~ (contains) but no regex operator."),isEmpty:s('PocketBase stores an empty value rather than a missing one, so "is empty" also matches records that were never given a value.','BCN-003 live: = "" returned both the empty-string row and the row seeded without a value'),isNotEmpty:s('PocketBase stores an empty value rather than a missing one, so "is not empty" also excludes records that were never given a value.',"BCN-003 live: the complement of the above"),exists:s('PocketBase stores an empty value rather than a missing one, so "is set" and "is not empty" are the same question here.',"BCN-003 live: = null also matched the empty-string row")},x),{path:r("Following several links in one request is not available on PocketBase yet. Filter one link at a time with a dotted field.","BCN-005 live: one hop works (author.city='London', tags.label?='algebra'); deeper paths not driven, no translator"),relatedTo:r('Filtering by "records related to this one" is not available on PocketBase yet.',"BCN-005."),textSearch:s("PocketBase has no ranked search — this looks for your text inside the field instead.","Lowered to ~ (contains)."),nearSphere:r("Location filters aren't available on PocketBase.","No geo types or operators in the records API."),withinBox:r("Location filters aren't available on PocketBase.","No geo operators."),withinPolygon:r("Location filters aren't available on PocketBase.","No geo operators.")}))},k={type:"supabase",tokenLifecycle:{kind:"refresh",accessTtlSeconds:3600,refreshEndpoint:"/auth/v1/token?grant_type=refresh_token",refreshBeforeExpirySeconds:120},capabilities:Object.freeze({"data.query":o("RUN-003 drove the real parser against a live PostgREST OpenAPI spec"),"data.count":o("BCN-001: Prefer: count=exact + Range: 0-0 returned content-range 0-0/7 with aggregates OFF"),"data.aggregate":a("Totals and averages have to be switched on for your Supabase project. If this stays unavailable after connecting, enable aggregate functions in your project settings.",{method:"GET",path:"/{collection}?select=count()",expect:'200 with [{"count":N}] — a 400 carrying code PGRST123 means it is off'},'BCN-001: stock PostgREST 12.2.3 answers PGRST123 "Use of aggregate functions is not allowed"; the same binary with db-aggregates-enabled=true answers count/sum/avg, groupBy and composed filters. Per-instance setting, and Supabase sets it independently of the PostgREST default.'),"data.distinct":r("Supabase has no way to list the distinct values of a column from here. Make a database view for it, or fetch the records and reduce them in your app.","BCN-001: no query-string form. Both plausible spellings are PGRST100 parse errors."),"data.fetch":o("GET /{table}?{pk}=eq.{id}"),"data.create":o("POST /{table} with Prefer: return=representation"),"data.save":o("PATCH /{table}?{pk}=eq.{id}"),"data.delete":o("DELETE /{table}?{pk}=eq.{id}"),"data.increment":s("Supabase has no way to add to a number in one step from here, so NodeGX reads the value and writes it back. If two people increment the same record at the same moment, one of the changes can be lost. A database function would avoid this.","PostgREST can only do this atomically through an RPC the user has to author. BCN-004 may offer to detect one."),"data.acl":r("Supabase controls access with Row Level Security, set up in your Supabase dashboard — not per record from here.","RLS is database policy; there is no per-record ACL field on the wire."),"data.search":a("Ranked search needs a text-search index on the table in your Supabase database.",{method:"GET",path:"/{collection}?select={pk}&{field}=fts.test",expect:"200 rather than a missing-index or unknown-operator error"},"PostgREST exposes Postgres full-text search via fts/plfts/phfts operators, which need a tsvector column or index to be useful."),"relations.pointerRead":o("BCN-005 live: ?select=*,author:authors(*) nests the author under the name you asked for. A filter on the related record needs the embed marked !inner or the parent rows are not narrowed — measured both ways, and the adapter emits it"),"relations.relatedTo":r('Filtering by "records related to this one" is not available on Supabase. Filter on a field of the related record instead, such as author → name.',"BCN-005 live: a dotted filter with an !inner embed narrows the parent correctly, but Parse's $relatedTo has no PostgREST spelling"),"relations.addRemove":s("Adding a many-to-many relation needs the join table to use both of its links as its key. Where it uses a separate id column instead, Supabase cannot see the relation at all and NodeGX will say so rather than write to the wrong place.",'BCN-005 live: with PRIMARY KEY (article_id, tag_id) the M2M embed answers 200 and POST with Prefer: resolution=merge-duplicates makes the add idempotent; with a surrogate id primary key the identical two tables answer PGRST200 "no matches were found" and no request recovers the relation'),"files.upload":s("Supabase keeps files in a Storage bucket, so the Upload File node needs a Bucket and a Path. There is no default bucket, and a bucket name that does not exist fails with a message that does not say so.","BCN-007 live: POST /storage/v1/object/{bucket}/{path} answers 200 with {Key, Id} — and NOTHING ELSE. No url, no size, no content type; those exist only on a second call to POST /object/list/{bucket}, so an upload reports them absent rather than making a round trip to dress the answer up"),"files.sign":o('BCN-007 live: POST /storage/v1/object/sign/{bucket}/{path} with {expiresIn} answers 200 and the link EXPIRES — verified by waiting it out, after which it answers 400 InvalidJWT "jwt expired". ⚠️ The signedURL it returns is RELATIVE (/object/sign/…), so it resolves against the app\'s own origin and 404s there unless the adapter puts the origin and the /storage/v1 mount back'),"files.delete":s("Deleting a file that is not there is an error on Supabase rather than a no-op, so a Delete File node that runs twice reports a failure the second time.",'BCN-007 live: DELETE /storage/v1/object/{bucket}/{path} answers 200 {"message":"Successfully deleted"} and the public URL then 400s. A path that never existed answers 400 with statusCode 404 "Object not found" — NOT idempotent, unlike nodegx-backend, which answers 200 for an unknown name by design'),"files.private":o("BCN-007 live: a bucket created public:false serves 400 on /object/public/{bucket}/{path} while an identical public:true bucket serves 200 with the bytes. Privacy is the bucket's, not the file's, and row-level security applies on top — an upload with the anon key was refused with \"new row violates row-level security policy\""),"files.progress":s("Upload progress isn't reported by Supabase — the file still uploads, the bar just won't move.","The Storage endpoint is consumed over fetch, which has no upload-progress event."),"auth.password":a("Signing in with an email and password needs Supabase Auth, and NodeGX does not support it on this backend yet.",{method:"GET",path:"/auth/v1/settings",expect:"a settings document rather than a 404"},"DOCUMENTED, NOT PROBED — BCN-006 confirmed only that no GoTrue exists in this rig to probe (every /auth/v1/* is a 404 from PostgREST), and RestAuthAdapter implements Directus and PocketBase only."),"auth.signUp":a("Creating accounts needs Supabase Auth, and NodeGX does not support it on this backend yet.",{method:"GET",path:"/auth/v1/settings",expect:"a settings document rather than a 404"},"DOCUMENTED, NOT PROBED — same as auth.password. POST /auth/v1/signup is read from documentation."),"auth.signUpProperties":s("Supabase keeps the login and the profile separately, so signing up takes two steps. If the second one fails the account still exists, without the profile details.","auth.users is not writable from the client; profile rows live in a public table. DOCUMENTED, NOT PROBED — and moot while auth.signUp is conditional."),"auth.emailVerify":a("Confirming an email address needs Supabase Auth, and NodeGX does not support it on this backend yet.",{method:"GET",path:"/auth/v1/settings",expect:"a settings document rather than a 404"},"DOCUMENTED, NOT PROBED. Email confirmation being on by default for new projects is a fact about Supabase, not about whether we can reach it."),"auth.passwordReset":a("Resetting a password needs Supabase Auth, and NodeGX does not support it on this backend yet.",{method:"GET",path:"/auth/v1/settings",expect:"a settings document rather than a 404"},"DOCUMENTED, NOT PROBED — POST /auth/v1/recover is read from documentation."),"auth.oauth":a("Signing in with a provider needs Supabase Auth, and NodeGX does not support it on this backend yet.",{method:"GET",path:"/auth/v1/settings",expect:"an external section listing enabled providers"},"DOCUMENTED, NOT PROBED — same as auth.password. Which providers a project has enabled is per-project configuration, but that is moot while nothing here can reach GoTrue at all."),"auth.magicLink":a("Sending a magic-link sign-in needs Supabase Auth, and NodeGX does not support it on this backend yet.",{method:"GET",path:"/auth/v1/settings",expect:"a settings document rather than a 404"},"DOCUMENTED, NOT PROBED — POST /auth/v1/otp is read from documentation. Magic links being first-class in Supabase is a fact about Supabase, not about whether we can reach them: every /auth/v1/* answers 404 in this rig and RestAuthAdapter issues no Supabase request at all."),"realtime.subscribe":r("NodeGX cannot subscribe to Supabase Realtime yet — it speaks Phoenix channels and no transport has been written for it (BCN-008). Turning Realtime on in your Supabase dashboard will not make this work.","Realtime is per-table opt-in via the publication, not a project-wide switch. DOCUMENTED, NOT PROBED — BCN-008 confirmed only that no Realtime service exists in this rig to probe. The delete payload in particular (postgres_changes sends old_record with the primary key alone unless the table is REPLICA IDENTITY FULL) is unmeasured, and that is exactly the field RUN-003 got wrong on Directus by reading rather than asking. BCN-010 moved this from `conditional` to `unsupported` so that no probe can enable a port with no transport behind it; the probe it used to carry was GET /realtime/v1/api/tenants/realtime/health.")}),filters:l(o("native PostgREST operator"),{matchesRegex:o("PostgREST match/imatch operators"),isEmpty:r('Supabase can\'t tell an empty value from a missing one from here. Use "is not set" instead, or compare the field to an empty string.',"No _empty equivalent; is.null answers presence only."),isNotEmpty:r('Supabase can\'t tell an empty value from a missing one from here. Use "is set" instead.',"No _nempty equivalent."),path:r("Following several links in one request is not available on Supabase yet. Filter one link at a time with an embedded field.","BCN-005 live: one hop works as a dotted filter with an !inner embed; deeper paths not driven, no translator"),relatedTo:r('Filtering by "records related to this one" is not available on Supabase yet.',"BCN-005."),textSearch:a("Full-text search needs a text-search index on the table in your Supabase database.",{method:"GET",path:"/{collection}?{field}=fts.test",expect:"200 rather than a missing-index error"},"PostgREST fts/plfts/phfts operators."),nearSphere:r("Location filters aren't available on Supabase from here. Even with PostGIS installed, a distance search has to be written as a database function.","PostgREST exposes no geo operator in its filter grammar; PostGIS reaches the query only through /rpc. BCN-003."),withinBox:r("Location filters aren't available on Supabase from here. Compare latitude and longitude as numbers instead.","PostgREST exposes no geo operator in its filter grammar. BCN-003."),withinPolygon:r("Location filters aren't available on Supabase from here. Even with PostGIS installed, a polygon search has to be written as a database function.","PostgREST exposes no geo operator in its filter grammar. BCN-003.")})},E=Object.freeze({nodegx:_,parse:N,directus:y,supabase:k,pocketbase:T,custom:f});function I(e){return E[e]}},742(e,t,n){"use strict";n.d(t,{Dj:()=>i,z9:()=>r});var i=Object.freeze(["equalTo","notEqualTo","lessThan","greaterThan","lessThanOrEqualTo","greaterThanOrEqualTo","containedIn","notContainedIn","exists","matchesRegex","contains","notContains","containsIgnoreCase","startsWith","notStartsWith","startsWithIgnoreCase","endsWith","notEndsWith","endsWithIgnoreCase","between","notBetween","isEmpty","isNotEmpty","textSearch","pointsTo","relatedTo","path","idEqualTo","idContainedIn","nearSphere","withinBox","withinPolygon"]),o=(Object.freeze(["contains","notContains","containsIgnoreCase","startsWith","notStartsWith","startsWithIgnoreCase","endsWith","notEndsWith","endsWithIgnoreCase","between","notBetween"]),/^[A-Za-z_][A-Za-z0-9_]*$/);function r(e){if(!e||"object"!=typeof e||Array.isArray(e))return"a path must be an object with from, hops and maxDepth";for(var t=e,n=0,i=Object.keys(t);n<i.length;n++)if("from"!==(y=i[n])&&"hops"!==y&&"maxDepth"!==y)return'a path has no "'.concat(y,'"');var r=t.from;if(!r||"object"!=typeof r||Array.isArray(r))return'a path needs "from": { collection, where? }';if("string"!=typeof r.collection||!o.test(r.collection))return'the path\'s "from.collection" must name a collection';for(var a=0,l=Object.keys(r);a<l.length;a++)if("collection"!==(y=l[a])&&"where"!==y)return'"from" has no "'.concat(y,'"');if(void 0!==r.where&&(!r.where||"object"!=typeof r.where||Array.isArray(r.where)))return'"from.where" must be a filter object';if(r.where&&s(r.where))return"a path inside a path is not allowed";if(!Number.isInteger(t.maxDepth)||t.maxDepth<1||t.maxDepth>8)return'"maxDepth" must be a whole number from 1 to '.concat(8);if(!Array.isArray(t.hops)||0===t.hops.length)return"a path needs at least one hop";if(t.hops.length>t.maxDepth)return"the path has ".concat(t.hops.length,' hops and "maxDepth" allows ').concat(t.maxDepth);for(var u=0,c=0;c<t.hops.length;c++){var d=t.hops[c],p="hop ".concat(c+1);if(!d||"object"!=typeof d||Array.isArray(d))return"".concat(p," must be an object");var h="follow"in d;if(h===("from"in d||"by"in d))return"".concat(p," must be { follow } or { from, by }, not both and not neither");for(var f=h?["follow","to","where","repeat"]:["from","by","where","repeat"],g=0,m=Object.keys(d);g<m.length;g++){var y=m[g];if(!f.includes(y))return"".concat(p,' has no "').concat(y,'"')}if(h&&("string"!=typeof d.follow||!o.test(d.follow)))return"".concat(p,': "follow" must name a field');if(h&&void 0!==d.to&&("string"!=typeof d.to||!o.test(d.to)))return"".concat(p,': "to" must name a collection');if(!(h||"string"==typeof d.from&&o.test(d.from)))return"".concat(p,': "from" must name a collection');if(!(h||"string"==typeof d.by&&o.test(d.by)))return"".concat(p,': "by" must name a field');if(void 0!==d.where&&(!d.where||"object"!=typeof d.where||Array.isArray(d.where)))return"".concat(p,': "where" must be a filter object');if(d.where&&s(d.where))return"a path inside a path is not allowed";if(void 0!==d.repeat&&!0!==d.repeat)return"".concat(p,': "repeat" is true or absent');!0===d.repeat&&(u+=1)}return u>1?"only one hop of a path may repeat":null}function s(e){for(var t=0,n=Object.entries(e);t<n.length;t++){var i=n[t],o=i[0],r=i[1];if("path"===o||"$path"===o)return!0;if(Array.isArray(r))for(var a=0,l=r;a<l.length;a++){var u=l[a];if(u&&"object"==typeof u&&s(u))return!0}else if(r&&"object"==typeof r&&s(r))return!0}return!1}Object.freeze({_eq:{operator:"equalTo"},_neq:{operator:"notEqualTo"},_gt:{operator:"greaterThan"},_gte:{operator:"greaterThanOrEqualTo"},_lt:{operator:"lessThan"},_lte:{operator:"lessThanOrEqualTo"},_contains:{operator:"contains"},_ncontains:{operator:"notContains"},_icontains:{operator:"containsIgnoreCase"},_starts_with:{operator:"startsWith"},_nstarts_with:{operator:"notStartsWith"},_istarts_with:{operator:"startsWithIgnoreCase"},_ends_with:{operator:"endsWith"},_nends_with:{operator:"notEndsWith"},_iends_with:{operator:"endsWithIgnoreCase"},_in:{operator:"containedIn"},_nin:{operator:"notContainedIn"},_null:{operator:"exists",value:"false"},_nnull:{operator:"exists",value:"true"},_between:{operator:"between"},_nbetween:{operator:"notBetween"},_empty:{operator:"isEmpty"},_nempty:{operator:"isNotEmpty"},_regex:{operator:"matchesRegex"}})},8995(e,t,n){"use strict";n.d(t,{descriptorFor:()=>l.RZ,findRelation:()=>r,paginationParams:()=>d,readRecord:()=>f,readRows:()=>h,readTotalCount:()=>p,relationTarget:()=>o,relationsFromCachedCollections:()=>a,restWireProfileFor:()=>c}),Object.freeze(["nodegx","parse","directus","supabase","pocketbase","custom"]),Object.freeze({nodegx:"Built-in",parse:"Parse Server",directus:"Directus",supabase:"Supabase",pocketbase:"PocketBase",custom:"Custom API"});var i=n(606);function o(e){return e.targetCollection||e.targetClass||void 0}function r(e,t,n){return(null!=e?e:[]).find(function(e){return e.collection===t&&e.field===n})}Object.freeze(["signed","token","public"]),Object.freeze(["query","count","distinct","aggregate","fetch","create","save","increment","delete","addRelation","removeRelation","uploadFile","signFileUrl","deleteFile"]),Object.freeze(["logIn","logOut","signUp","fetchCurrentUser","verifyEmail","sendEmailVerification","resetPassword","requestPasswordReset","signInWithProvider","requestMagicLink"]),Object.freeze(["loggedIn","loggedOut","sessionGained","sessionLost","sessionChanged"]);var s=["one-to-many","many-to-many"];function a(e){for(var t,n,i=(null!=e?e:[]).filter(function(e){return e.name}),o=[],r=0,a=i;r<a.length;r++){var l=a[r],u=l.name,c=null!==(t=l.fields)&&void 0!==t?t:[],d=c.filter(function(e){var t;return e.name&&e.relationTarget&&!s.includes(null!==(t=e.relationType)&&void 0!==t?t:"")}),p=c.filter(function(e){return!e.primaryKey&&!e.relationTarget});if(2!==d.length||0!==p.length)for(var h=0,f=c;h<f.length;h++){var g=f[h];g.name&&g.relationTarget&&(s.includes(null!==(n=g.relationType)&&void 0!==n?n:"")||(o.push({collection:u,field:g.name,target:g.relationTarget,cardinality:"one",write:{kind:"foreignKey",field:g.name,on:"source"}}),o.push({collection:g.relationTarget,field:u,target:u,cardinality:"many",write:{kind:"foreignKey",field:g.name,on:"target"}})))}else for(var m=d[0],y=d[1],v=0,b=[[m,y],[y,m]];v<b.length;v++){var w=b[v],_=w[0],S=w[1];o.push({collection:_.relationTarget,field:S.relationTarget,target:S.relationTarget,cardinality:"many",write:{kind:"junction",collection:u,sourceField:_.name,targetField:S.name,idempotent:!1}})}}return o}n(9733),n(742);var l=n(862),u=Object.freeze({directus:{type:"directus",listPath:"/items/{collection}",recordPath:"/items/{collection}/{id}",createPath:"/items/{collection}",auth:"bearer",dataPath:"data",recordDataPath:"data",totalCount:{kind:"body-path",path:"meta.filter_count"},pagination:{kind:"offset",offsetParam:"offset",limitParam:"limit"},createResponse:{kind:"record"},idField:"id"},supabase:{type:"supabase",listPath:"/rest/v1/{collection}",recordPath:"/rest/v1/{collection}",createPath:"/rest/v1/{collection}",auth:"bearer",tokenHeaders:["apikey"],dataPath:"",recordDataPath:"",totalCount:{kind:"content-range"},countRequestHeaders:{Prefer:"count=exact"},pagination:{kind:"offset",offsetParam:"offset",limitParam:"limit"},createResponse:{kind:"array-of-one"},createRequestHeaders:{Prefer:"return=representation"},idField:"id"},pocketbase:{type:"pocketbase",listPath:"/api/collections/{collection}/records",recordPath:"/api/collections/{collection}/records/{id}",createPath:"/api/collections/{collection}/records",auth:"bearer",dataPath:"items",recordDataPath:"",totalCount:{kind:"body-path",path:"totalItems"},pagination:{kind:"page",pageParam:"page",perPageParam:"perPage",firstPage:1},createResponse:{kind:"record"},idField:"id"}});function c(e){return u[e]}function d(e,t,n){var i={};if("offset"===e.pagination.kind)return void 0!==t&&(i[e.pagination.limitParam]=String(t)),n&&(i[e.pagination.offsetParam]=String(n)),{params:i,inexact:!1};var o=e.pagination,r=o.pageParam,s=o.perPageParam,a=o.firstPage,l=t;return void 0!==l&&(i[s]=String(l)),n?l?(i[r]=String(Math.floor(n/l)+a),{params:i,inexact:n%l!==0}):{params:i,inexact:!0}:{params:i,inexact:!1}}function p(e,t,n,i){switch(e.totalCount.kind){case"page-length":return i;case"content-range":var o=null==n?void 0:n.get("content-range");if(!o)return;var r=o.split("/")[1];if(!r||"*"===r)return;var s=Number(r);return Number.isFinite(s)?s:void 0;case"body-path":for(var a=t,l=0,u=e.totalCount.path.split(".");l<u.length;l++){var c=u[l];if(null===a||"object"!=typeof a)return;a=a[c]}return"number"==typeof a?a:void 0}}function h(e,t){if(""===e.dataPath)return Array.isArray(t)?t:[];for(var n=t,i=0,o=e.dataPath.split(".");i<o.length;i++){var r=o[i];if(null===n||"object"!=typeof n)return[];n=n[r]}return Array.isArray(n)?n:[]}function f(e,t){if(null!=t&&""!==t){if("array-of-one"===e.createResponse.kind){var n=(Array.isArray(t)?t:h(e,t))[0];return n&&"object"==typeof n?n:void 0}var i=t;if(""!==e.recordDataPath)for(var o=0,r=e.recordDataPath.split(".");o<r.length;o++){var s=r[o];if(null===i||"object"!=typeof i)return;i=i[s]}return i&&"object"==typeof i&&!Array.isArray(i)?i:void 0}}Object.freeze({"noodl.cloud.aggregate":Object.freeze({node:"data.aggregate"}),DbCollection2:Object.freeze({ports:Object.freeze({realtime:"realtime.subscribe"})}),SubscribeToChanges:Object.freeze({node:"realtime.subscribe"}),NewDbModelProperties:Object.freeze({ports:Object.freeze({accessControl:"data.acl"})}),SetDbModelProperties:Object.freeze({ports:Object.freeze({accessControl:"data.acl"})}),AddDbModelRelation:Object.freeze({node:"relations.addRemove"}),RemoveDbModelRelation:Object.freeze({node:"relations.addRemove"}),"Upload File":Object.freeze({node:"files.upload"}),"Sign File URL":Object.freeze({node:"files.sign"}),"net.noodl.user.LogIn":Object.freeze({node:"auth.password"}),"net.noodl.user.SignUp":Object.freeze({node:"auth.signUp"}),"net.noodl.user.RequestMagicLink":Object.freeze({node:"auth.magicLink"}),"net.noodl.user.SignInWith":Object.freeze({node:"auth.oauth"}),"net.noodl.user.VerifyEmail":Object.freeze({node:"auth.emailVerify"}),"net.noodl.user.SendEmailVerification":Object.freeze({node:"auth.emailVerify"}),"net.noodl.user.ResetPassword":Object.freeze({node:"auth.passwordReset"}),"net.noodl.user.RequestPasswordReset":Object.freeze({node:"auth.passwordReset"})}),Object.freeze({"Cloud File":"It holds a file reference and reads its url. It does not upload, sign or delete, so no cell describes what it needs.","net.noodl.user.LogOut":"Ending a session is not a descriptor cell, and every backend with auth can do it.","net.noodl.user.User":'Reports who is signed in — including "no one", which is the state a gate must stay readable from.',"net.noodl.user.SetUserProperties":"Writes user columns through the same save path as any record; `auth.signUpProperties` is about sign-up, not later edits.",DbModel2:"Fetch and save are `data.fetch`/`data.save`, supported on every backend in the descriptor.",DeleteDbModelProperties:"`data.delete` is supported on every backend in the descriptor.",FilterDBModels:"Filters an in-memory collection; its per-operator gating is BCN-003b's, on the filter port."});var g,m,y=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})},v=function(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},b=(function(){function e(e){var t;this._results=new Map,this._inFlight=new Map,this._listeners=new Set,this._runner=e.runner,this._now=e.now||function(){return Date.now()},this._positiveTtlMs=null!==(t=e.positiveTtlMs)&&void 0!==t?t:i.bZ}e.prototype.results=function(e){return this._results.get(e)||{}},Object.defineProperty(e.prototype,"positiveTtlMs",{get:function(){return this._positiveTtlMs},enumerable:!1,configurable:!0}),e.prototype.nowMs=function(){return this._now()},e.prototype.invalidate=function(e){if(this._results.delete(e)){for(var t=0,n=Array.from(this._inFlight.keys());t<n.length;t++){var i=n[t];i.startsWith("".concat(e,"\0"))&&this._inFlight.delete(i)}this._notify(e)}},e.prototype.clear=function(){var e=this,t=Array.from(this._results.keys());this._results.clear(),this._inFlight.clear(),t.forEach(function(t){return e._notify(t)})},e.prototype.onChange=function(e){var t=this;return this._listeners.add(e),function(){return t._listeners.delete(e)}},e.prototype.ensure=function(e,t,n,i){return y(this,void 0,void 0,function(){var o,r,s,a,u,c,d=this;return v(this,function(p){return(o=(0,l.RZ)(t))&&(r=o.capabilities[i])&&"conditional"===r.state?this._believable(e,i)?[2,void 0]:(s="".concat(e,"\0").concat(i),(a=this._inFlight.get(s))?[2,a]:(u={key:i,probe:r.probe,url:n.replace(/\/+$/,""),type:t},c=this._runner(u).then(function(t){return d._record(e,i,t),t}).catch(function(){}).finally(function(){d._inFlight.delete(s)}),this._inFlight.set(s,c),[2,c])):[2,void 0]})})},e.prototype.ensureAll=function(e,t,n,i){return y(this,void 0,void 0,function(){var o=this;return v(this,function(r){switch(r.label){case 0:return[4,Promise.all(i.map(function(i){return o.ensure(e,t,n,i)}))];case 1:return r.sent(),[2]}})})},e.prototype.record=function(e,t,n){this._record(e,t,n)},e.prototype._record=function(e,t,n){var i=this._results.get(e)||{};i[t]=n,this._results.set(e,i),this._notify(e)},e.prototype._believable=function(e,t){var n,i=null===(n=this._results.get(e))||void 0===n?void 0:n[t];return!!i&&("unsupported"===i.verdict||this._now()-i.at<=this._positiveTtlMs)},e.prototype._notify=function(e){this._listeners.forEach(function(t){try{t(e)}catch(e){}})}}(),g=function(e,t){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},g(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.freeze(["goes-too","stays-unlinked","blocks"]),Object.freeze({nodegx:{state:"supported",evidence:"kept at delete time above both engines (`AdapterFacade.rawDelete` → `deleteKeepingLinks`); graded on SQLite and PostgreSQL by nodegx-backend tests/ont-003-claims and tests/ont-003-target-goes"},parse:{state:"unsupported",reason:"Parse keeps a pointer to a deleted object and has no rule for it; a Cloud Code beforeDelete trigger written for this app is the only way, and NodeGX does not write one."},directus:{state:"unsupported",reason:"Directus keeps this in its own relation settings (on delete: nullify, cascade or prevent), which NodeGX does not write; set it there."},supabase:{state:"unsupported",reason:"NodeGX does not write a foreign key for a link on Supabase; an ON DELETE rule written in the database itself is kept by Postgres, not by NodeGX."},pocketbase:{state:"unsupported",reason:"PocketBase keeps this as a relation field’s own option (cascade delete), which NodeGX does not write; set it there."},custom:{state:"unsupported",reason:"A backend NodeGX did not ship says for itself what happens to a link when its record goes; NodeGX cannot keep it there."}}),m=Error,b(function(e,t,n){var i=m.call(this,"This ".concat(e," record cannot be deleted: ")+n.map(function(t){return"".concat(t.count," ").concat(t.collection," record").concat(1===t.count?"":"s"," link").concat(1===t.count?"s":""," to ").concat(t.target===e?"it":"a ".concat(t.target," record that would go with it"),' by "').concat(t.field,'"')}).join("; ")+". Nothing was deleted.")||this;return i.collection=e,i.objectId=t,i.linked=n,i.code="STILL_LINKED",i.name="StillLinked",i},m)},9733(e,t,n){"use strict";n.d(t,{Vl:()=>o,oV:()=>r,tO:()=>i}),Object.freeze(["init","create","update","delete","resync"]);var i=Object.freeze({TRANSPORT_UNAVAILABLE:"fatal",CONNECT_FAILED:"retryable",CONNECT_TIMEOUT:"retryable",AUTH_FAILED:"fatal",SUBSCRIPTION_REJECTED:"retryable",HEARTBEAT_MISSED:"retryable",CAPABILITY_UNAVAILABLE:"fatal"}),o=Object.freeze({reconnectBaseMs:1e3,reconnectMaxMs:3e4,connectTimeoutMs:15e3});function r(e,t){void 0===t&&(t=o);var n=Number.isFinite(e)&&e>0?Math.floor(e):0;return Math.min(t.reconnectMaxMs,t.reconnectBaseMs*Math.pow(2,Math.min(n,30)))}Object.freeze(["subscribe"]);var s="bcn-008-realtime-probe.mjs, 2026-07-31",a="bcn-008-realtime-driver.ts + bcn-008-node-driver.ts, 2026-08-01",l={type:"directus",transport:"websocket",streamPath:"/websocket",subscribe:"{type:'auth',access_token} → {type:'auth',status:'ok'} → {type:'subscribe',collection,uid}",confirmation:"{type:'subscription',event:'init',data:[…rows],uid}",deleteEvent:{carries:"keys-only",wireKeyType:"string",coercedFromRest:!0},keepalive:{rule:"server-ping-client-pong",intervalMs:3e4,observedForMs:45e3,disconnectsSilentClientAfterMs:6e4},connectFailure:"open in single-digit ms on success; a bad token gives {type:'auth',status:'error',error:{code:'AUTH_FAILED'}} ~10ms after the send, then close ~2ms later",measured:!0,evidence:"".concat(s,': numeric pk 2 arrived as data:["2"]; ping at 30016ms; silent client closed at 60035ms, code 1005. ')+"".concat(a,": `docker restart uba-e2e-directus-1` under a live subscription → interrupted → subscribed → a row ")+"written AFTER the restart was delivered, at the transport AND through a real Query Records node. 72s of client silence did NOT drop the subscription (removing the pong makes exactly that check fail)."},u={type:"pocketbase",transport:"sse",streamPath:"/api/realtime",subscribe:"GET the stream → PB_CONNECT gives clientId → POST /api/realtime {clientId, subscriptions:['coll']} → 204",confirmation:"204 on the subscription POST (delivery is gated separately, at event time)",deleteEvent:{carries:"full-record",wireKeyType:"string",coercedFromRest:!1},keepalive:{rule:"none-observed",intervalMs:null,observedForMs:13e4},connectFailure:'the stream is plain fetch/EventSource: a dead host rejects the request. An unknown clientId on the subscription POST is 404 {"message":"Missing or invalid client id."}',measured:!0,evidence:"".concat(s,': SSE event name is the COLLECTION name, not "change"; data is {record,action}; a superuser-only ')+"collection accepted an anonymous subscription with 204 and then delivered nothing. "+"".concat(a,": `docker restart uba-e2e-pocketbase-1` under a live subscription → reconnected, re-POSTed the ")+"subscription set with the fresh clientId, and delivered a row written after the restart. The accepted-then-silent case was re-measured through the shipped transport: it reports `subscribed` and receives nothing."},c={type:"nodegx",transport:"sse",streamPath:"/realtime",subscribe:"GET the stream → 'connected' gives clientId → POST /realtime/subscriptions {clientId, subscriptions:[{collection, filter?}]}",confirmation:"200 with a non-empty `accepted[]` — the body, not the status: a rejection also answers 200",deleteEvent:{carries:"full-record",wireKeyType:"string",coercedFromRest:!1},keepalive:{rule:"server-comment",intervalMs:25e3,observedForMs:3e4},connectFailure:"fetch rejects for an unreachable host; an unknown clientId is 404; an unsupported filter is 200 with rejected[].reason",measured:!0,evidence:"".concat(s,': heartbeat comment ": heartbeat" at 25026ms; a Last-Event-ID reconnect answers connected then ')+'resync{reason:"reconnect"} with a FRESH clientId. '+"".concat(a,": the backend process killed and relaunched under a live subscription (the rig has no nodegx-backend ")+"container) → reconnected, re-registered, delivered a row written after the restart, and raised 2 resync frames. Also confirmed live that a 200 carrying rejected[] is NOT a subscription."},d={type:"supabase",transport:"phoenix-channel",streamPath:"/realtime/v1/websocket",subscribe:"phx_join on a topic, with a postgres_changes config — DOCUMENTED, NOT PROBED",confirmation:"phx_reply with status 'ok' — DOCUMENTED, NOT PROBED",deleteEvent:{carries:"keys-only",wireKeyType:"unknown",coercedFromRest:!1},keepalive:null,connectFailure:"unknown — nothing was listening to fail against",measured:!1,evidence:"".concat(s,": ws://localhost:8056/realtime/v1/websocket → error@5ms; /realtime/v1/api/tenants/realtime/health → 404; ports 4000 and 54321 silent. No Supabase Realtime exists in this rig.")},p={type:"parse",transport:"none",streamPath:null,subscribe:"{op:'connect',applicationId,…} then {op:'subscribe',requestId,query} — on a LiveQuery server, if one is running",confirmation:"{op:'connected'} then {op:'subscribed'} — never reached here",deleteEvent:null,keepalive:null,connectFailure:'error at 20ms, "Received network error or non-101 status code"; `close` never fires',measured:!0,evidence:"".concat(s,": /parse/serverInfo advertises no liveQuery; ws://localhost:8092/parse errors in 20ms and a raw upgrade request is answered 403 by the ordinary Express app. This is a measurement that LiveQuery is ABSENT, not that it works.")};Object.freeze({nodegx:c,parse:p,directus:l,supabase:d,pocketbase:u})},9972(e,t,n){"use strict";n.d(t,{FilterTranslationError:()=>d,bindPocketBaseFilter:()=>V,isSavedGroup:()=>U,isVisualQueryFormat:()=>q,savedFilterToNeutral:()=>B,toDirectusFilter:()=>S,toParseWhere:()=>v,toPocketBaseFilter:()=>j,toPostgrest:()=>R,visualQueryToNeutral:()=>z});var i=n(742);function o(e,t){var n=String(null!=t?t:""),i=function(e,t,i){return{value:n,anchor:e,negated:t,insensitive:i}};switch(e){case"contains":return i("contains",!1,!1);case"containsIgnoreCase":return i("contains",!1,!0);case"notContains":return i("contains",!0,!1);case"startsWith":return i("startsWith",!1,!1);case"startsWithIgnoreCase":return i("startsWith",!1,!0);case"notStartsWith":return i("startsWith",!0,!1);case"endsWith":return i("endsWith",!1,!1);case"endsWithIgnoreCase":return i("endsWith",!1,!0);case"notEndsWith":return i("endsWith",!0,!1);default:return}}function r(e,t,n){switch(e){case"contains":return"".concat(n).concat(t).concat(n);case"startsWith":return"".concat(t).concat(n);case"endsWith":return"".concat(n).concat(t)}}function s(e){if(Array.isArray(e)&&2===e.length)return[e[0],e[1]]}var a,l=n(606),u=n(862),c=(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},a(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),d=function(e){function t(t,n){void 0===n&&(n={});var i=e.call(this,t)||this;return i.name="FilterTranslationError",i.operator=n.operator,i.field=n.field,i.reason=n.reason,i}return c(t,e),t}(Error),p=new Set(i.Dj),h=new Set(["options"]);function f(e){return null===e?"null":Array.isArray(e)?"an array":typeof e}function g(e,t,n){var o,r,s="string"==typeof(r=n.backend)?(0,u.RZ)(r):r,a=null!==(o=n.probed)&&void 0!==o?o:[],c={schema:n.schema,fail:function(e,t){throw new d(e,t)},translate:function(e){return m(e)}},g=function(e,t){var n=function(e,t,n){void 0===n&&(n=[]);var i=e.filters[t];return i?"conditional"===i.state?{usable:n.includes(t),capability:i}:{usable:(0,l.Ng)(i),capability:i}:{usable:!1,capability:{state:"unsupported",reason:'"'.concat(t,'" is not declared for ').concat(e.type,".")}}}(s,e,a),i=n.usable,o=n.capability;if(!i){var r="supported"===o.state?void 0:o.reason,u=t?' on "'.concat(t,'"'):"";throw new d("".concat(s.type,' cannot apply the "').concat(e,'" filter').concat(u,". ").concat(null!=r?r:"").trim(),{operator:e,field:t,reason:r})}},m=function(t){var n=function(e){if(null==e)return{kind:"empty"};if("object"!=typeof e||Array.isArray(e))throw new d("A filter must be an object, found ".concat(f(e)));var t=e,n=Object.keys(t);if(0===n.length)return{kind:"empty"};if(1!==n.length)throw new d("A filter must have exactly one key, found ".concat(n.length,": ").concat(n.join(", "),". ")+"Combine conditions with { and: [ … ] } or { or: [ … ] }.");var o=n[0],r=t[o];if(("and"===o||"or"===o)&&Array.isArray(r))return{kind:"group",combinator:o,children:r};if("idEqualTo"===o||"idContainedIn"===o)return{kind:"id",operator:o,value:r};if("relatedTo"===o){var s=r;if(!s||"object"!=typeof s)throw new d("A relatedTo filter must be an object with id and key",{operator:"relatedTo"});if(void 0===s.id)throw new d("Must provide id in relatedTo filter",{operator:"relatedTo"});if(void 0===s.key)throw new d("Must provide key in relatedTo filter",{operator:"relatedTo"});return{kind:"relatedTo",value:s}}if("path"===o){var a=(0,i.z9)(r);if(a)throw new d("A path filter is malformed: ".concat(a),{operator:"path"});return{kind:"path",value:r}}if(null===r||"object"!=typeof r||Array.isArray(r))throw new d('The condition on "'.concat(o,'" must be an object like { equalTo: … }, found ').concat(f(r)),{field:o});var l=r,u=Object.keys(l).filter(function(e){return!h.has(e)});if(1===u.length&&"text"===u[0]){var c=l.text;if(!c||"object"!=typeof c||void 0===c.search)throw new d('The text filter on "'.concat(o,'" needs a search value'),{field:o,operator:"textSearch"});return{kind:"condition",field:o,operator:"textSearch",value:c.search}}if(0===u.length)throw new d('The condition on "'.concat(o,'" has no operator. Expected one of: ').concat(i.Dj.join(", "),"."),{field:o});if(u.length>1)throw new d('The condition on "'.concat(o,'" has ').concat(u.length," operators (").concat(u.join(", "),"), ")+'and only one can be applied. Use "between", or combine two conditions with { and: [ … ] }.',{field:o});var g=u[0];if(!p.has(g))throw new d('"'.concat(g,'" is not a filter operator. Expected one of: ').concat(i.Dj.join(", "),"."),{field:o});var m={kind:"condition",field:o,operator:g,value:l[g]};return"matchesRegex"===g&&"string"==typeof l.options&&(m.regexOptions=l.options),m}(t);switch(n.kind){case"empty":return e.empty();case"group":var o=n.children.map(m).filter(function(t){return!e.isEmpty(t)});return 0===o.length?e.empty():1===o.length?o[0]:e.group(n.combinator,o,c);case"id":return g(n.operator),e.id(n,c);case"relatedTo":return g("relatedTo"),e.relatedTo(n,c);case"path":return g("path"),e.path(n,c);case"condition":return g(n.operator,n.field),e.condition(n,c)}};return m(t)}var m=function(){return m=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},m.apply(this,arguments)};function y(e){return{__type:"GeoPoint",latitude:e.latitude,longitude:e.longitude}}function v(e,t){return g({name:"parse",identityField:"objectId",empty:function(){return{}},isEmpty:function(e){return 0===Object.keys(e).length},group:function(e,t){var n;return(n={})["$".concat(e)]=t,n},id:function(e){return"idEqualTo"===e.operator?{objectId:{$eq:e.value}}:{objectId:{$in:e.value}}},relatedTo:function(e,t){var n=e.value,i=n.id,o=n.key,r=n.className;return r?{$relatedTo:{object:{__type:"Pointer",objectId:i,className:r},key:o}}:t.fail("Must preload the Pointer or include className",{operator:"relatedTo"})},path:function(e,t){var n=e.value,i=n.hops.map(function(e){var n=m({},e);return e.where&&(n.where=t.translate(e.where)),n}),o={collection:n.from.collection};return n.from.where&&(o.where=t.translate(n.from.where)),{$path:{from:o,hops:i,maxDepth:n.maxDepth}}},condition:function(e,t){var n;return(n={})[e.field]=function(e,t){var n,i=e.field,o=e.operator,r=e.value,a=t.schema,l=function(e){return function(e,t,n){var i,o;if(e instanceof Date&&"function"==typeof e.toISOString)return{__type:"Date",iso:e.toISOString()};if("Date"===(null===(o=null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i[t])||void 0===o?void 0:o.type)&&null!=e){var r=e instanceof Date?e:new Date(String(e));if(!Number.isNaN(r.getTime()))return{__type:"Date",iso:r.toISOString()}}return e}(e,i,a)};switch(o){case"equalTo":return{$eq:l(r)};case"notEqualTo":return{$ne:l(r)};case"lessThan":return{$lt:l(r)};case"greaterThan":return{$gt:l(r)};case"lessThanOrEqualTo":return{$lte:l(r)};case"greaterThanOrEqualTo":return{$gte:l(r)};case"containedIn":return{$in:Array.isArray(r)?r.map(l):[l(r)]};case"notContainedIn":return{$nin:Array.isArray(r)?r.map(l):[l(r)]};case"exists":return!1===r?{$eq:null}:{$ne:null};case"matchesRegex":return void 0===e.regexOptions?{$regex:r}:{$regex:r,$options:e.regexOptions};case"contains":case"notContains":case"containsIgnoreCase":case"startsWith":case"notStartsWith":case"startsWithIgnoreCase":case"endsWith":case"notEndsWith":case"endsWithIgnoreCase":var u=function(e,t){var n=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(String(t));switch(e){case"contains":return{pattern:n};case"containsIgnoreCase":return{pattern:n,options:"i"};case"notContains":return{pattern:"^(?![\\s\\S]*".concat(n,")")};case"startsWith":return{pattern:"^".concat(n)};case"startsWithIgnoreCase":return{pattern:"^".concat(n),options:"i"};case"notStartsWith":return{pattern:"^(?!".concat(n,")")};case"endsWith":return{pattern:"".concat(n,"$")};case"endsWithIgnoreCase":return{pattern:"".concat(n,"$"),options:"i"};case"notEndsWith":return{pattern:"^(?![\\s\\S]*".concat(n,"$)")};default:return}}(o,r);return u?void 0===u.options?{$regex:u.pattern}:{$regex:u.pattern,$options:u.options}:t.fail('Cannot express "'.concat(o,'"'),{operator:o,field:i});case"between":var c=s(r);return c?{$gte:l(c[0]),$lte:l(c[1])}:t.fail('A "between" filter needs a two-element array [from, to]',{operator:o,field:i});case"notBetween":return t.fail('A "not between" filter needs a two-element array [from, to]',{operator:o,field:i});case"isEmpty":return{$eq:""};case"isNotEmpty":return{$ne:""};case"textSearch":if("string"==typeof r)return{$text:{$search:{$term:r,$caseSensitive:!1}}};var d=r;return{$text:{$search:{$term:d.term,$language:d.language,$caseSensitive:d.caseSensitive,$diacriticSensitive:d.diacriticSensitive}}};case"pointsTo":var p=null===(n=null==a?void 0:a.properties)||void 0===n?void 0:n[i];if(!(null==p?void 0:p.targetClass))return t.fail('Filtering "'.concat(i,'" by the record it points to needs the collection schema, ')+"so that the related collection is known.",{operator:o,field:i});var h=p.targetClass;return"Relation"===p.type?{__type:"Pointer",objectId:r,className:h}:Array.isArray(r)?{$in:r.map(function(e){return{__type:"Pointer",objectId:e,className:h}})}:{$eq:{__type:"Pointer",objectId:r,className:h}};case"nearSphere":var f=r,g={$nearSphere:y(f)};return void 0!==f.maxDistanceInMiles&&(g.$maxDistanceInMiles=f.maxDistanceInMiles),void 0!==f.maxDistanceInKilometers&&(g.$maxDistanceInKilometers=f.maxDistanceInKilometers),void 0!==f.maxDistanceInRadians&&(g.$maxDistanceInRadians=f.maxDistanceInRadians),g;case"withinBox":return Array.isArray(r)&&2===r.length?{$within:{$box:r.map(y)}}:t.fail('A "within box" filter needs two corner points [southwest, northeast]',{operator:o,field:i});case"withinPolygon":return!Array.isArray(r)||r.length<3?t.fail('A "within polygon" filter needs at least three points',{operator:o,field:i}):{$geoWithin:{$polygon:r.map(y)}};default:return t.fail('The Parse dialect cannot express "'.concat(o,'"'),{operator:o,field:i})}}(e,t),n}},b(e),t)}function b(e){var t,n,i;if(!e||"object"!=typeof e)return e;var o=e,r=Object.keys(o);if(1!==r.length)return e;var a=r[0],l=o[a];if(("and"===a||"or"===a)&&Array.isArray(l))return(t={})[a]=l.map(function(e){return b(e)}),t;if(l&&"object"==typeof l&&!Array.isArray(l)){var u=s(l.notBetween);if(u)return{or:[(n={},n[a]={lessThan:u[0]},n),(i={},i[a]={greaterThan:u[1]},i)]}}return e}var w=Object.freeze({equalTo:"_eq",notEqualTo:"_neq",greaterThan:"_gt",greaterThanOrEqualTo:"_gte",lessThan:"_lt",lessThanOrEqualTo:"_lte",contains:"_contains",notContains:"_ncontains",containsIgnoreCase:"_icontains",startsWith:"_starts_with",notStartsWith:"_nstarts_with",startsWithIgnoreCase:"_istarts_with",endsWith:"_ends_with",notEndsWith:"_nends_with",endsWithIgnoreCase:"_iends_with",containedIn:"_in",notContainedIn:"_nin",between:"_between",notBetween:"_nbetween",isEmpty:"_empty",isNotEmpty:"_nempty",matchesRegex:"_regex"});function _(e,t){for(var n,i=e.split("."),o=t,r=i.length-1;r>=0;r--)(n={})[i[r]]=o,o=n;return o}function S(e,t){return g({name:"directus",identityField:"id",empty:function(){return{}},isEmpty:function(e){return 0===Object.keys(e).length},group:function(e,t){var n;return(n={})["_".concat(e)]=t,n},id:function(e){return"idEqualTo"===e.operator?{id:{_eq:e.value}}:{id:{_in:e.value}}},relatedTo:function(e,t){return t.fail("Directus cannot filter by Parse-style relations",{operator:"relatedTo"})},path:function(e,t){return t.fail("Directus cannot follow a path through several links in one request",{operator:"path"})},condition:function(e,t){var n,i,o,r,a=e.operator,l=e.value,u=function(e,t){var n,i,o,r=e.indexOf(".");if(r<0)return e;var s=e.slice(0,r),a=null===(o=null===(i=null===(n=t.schema)||void 0===n?void 0:n.properties)||void 0===i?void 0:i[s])||void 0===o?void 0:o.path;return a?a+e.slice(r):e}(e.field,t);if("exists"===a)return _(u,!1===l?{_null:!0}:{_nnull:!0});if("isEmpty"===a)return _(u,{_empty:!0});if("isNotEmpty"===a)return _(u,{_nempty:!0});if("between"===a||"notBetween"===a){var c=s(l);return c?_(u,((n={})[w[a]]=c,n)):t.fail('A "'.concat(a,'" filter needs a two-element array [from, to]'),{operator:a,field:u})}if("containedIn"===a||"notContainedIn"===a)return _(u,((i={})[w[a]]=Array.isArray(l)?l:[l],i));if("textSearch"===a)return _(u,{_contains:"string"==typeof l?l:String(null!==(r=null==l?void 0:l.term)&&void 0!==r?r:"")});if("pointsTo"===a)return Array.isArray(l)?_(u,{_in:l}):_(u,{_eq:l});var d=w[a];return d?_(u,((o={})[d]=l,o)):t.fail('The Directus dialect cannot express "'.concat(a,'"'),{operator:a,field:u})}},e,t)}var O=function(){return O=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},O.apply(this,arguments)};function N(e){return null==e?"null":"boolean"==typeof e||"number"==typeof e?String(e):e instanceof Date?e.toISOString():String(e)}function C(e){return N(e)}function x(e){var t=N(e);return null==e||"boolean"==typeof e||"number"==typeof e?t:/[,.:()"\\\s]/.test(t)||""===t?'"'.concat(t.replace(/(["\\])/g,"\\$1"),'"'):t}function T(e){var t=Array.isArray(e)?e:[e];return"(".concat(t.map(function(e){return x(e)}).join(","),")")}function k(e,t,n){var i=function(e){var t=e.split(".");return t.length>1?t.slice(0,-1).join("."):void 0}(e);return{params:[[e,t]],expression:i?void 0:"".concat(e,".").concat(n),embeds:i?[i]:[]}}var E=Object.freeze({lessThan:"lt",greaterThan:"gt",lessThanOrEqualTo:"lte",greaterThanOrEqualTo:"gte"});function I(e,t,n){var i,s=e.field,a=e.operator,l=e.value;switch(a){case"equalTo":return null===l?"is.null":"eq.".concat(n(l));case"notEqualTo":return null===l?"not.is.null":"neq.".concat(n(l));case"lessThan":case"greaterThan":case"lessThanOrEqualTo":case"greaterThanOrEqualTo":return"".concat(E[a],".").concat(n(l));case"containedIn":return"in.".concat(T(l));case"notContainedIn":return"not.in.".concat(T(l));case"exists":return!1===l?"is.null":"not.is.null";case"matchesRegex":return"".concat((null===(i=e.regexOptions)||void 0===i?void 0:i.includes("i"))?"imatch":"match",".").concat(n(l));case"contains":case"notContains":case"containsIgnoreCase":case"startsWith":case"notStartsWith":case"startsWithIgnoreCase":case"endsWith":case"notEndsWith":case"endsWithIgnoreCase":var u=o(a,l);if(!u)return t.fail('Cannot express "'.concat(a,'"'),{operator:a,field:s});var c=u.insensitive?"ilike":"like",d=r(u.anchor,function(e){return e.replace(/[\\%_*]/g,"\\$&")}(u.value),"*");return"".concat(u.negated?"not.":"").concat(c,".").concat(n(d));case"between":case"notBetween":return t.fail('A "'.concat(a,'" filter needs a two-element array [from, to]'),{operator:a,field:s});case"textSearch":return"fts.".concat(n("string"==typeof l?l:null==l?void 0:l.term));case"pointsTo":return Array.isArray(l)?"in.".concat(T(l)):"eq.".concat(n(l));case"nearSphere":case"withinBox":case"withinPolygon":return t.fail("PostgREST has no location filter, even with PostGIS installed — a distance query has to be a database function.",{operator:a,field:s});default:return t.fail('The PostgREST dialect cannot express "'.concat(a,'"'),{operator:a,field:s})}}function P(e){var t,n,i,o,r;if(!e||"object"!=typeof e)return e;var a=e,l=Object.keys(a);if(1!==l.length)return e;var u=l[0],c=a[u];if(("and"===u||"or"===u)&&Array.isArray(c))return(t={})[u]=c.map(function(e){return P(e)}),t;if(c&&"object"==typeof c&&!Array.isArray(c)){var d=c,p=s(d.between);if(p)return{and:[(n={},n[u]={greaterThanOrEqualTo:p[0]},n),(i={},i[u]={lessThanOrEqualTo:p[1]},i)]};var h=s(d.notBetween);if(h)return{or:[(o={},o[u]={lessThan:h[0]},o),(r={},r[u]={greaterThan:h[1]},r)]}}return e}function R(e,t){var n=g({name:"postgrest",identityField:"id",empty:function(){return{params:[],embeds:[]}},isEmpty:function(e){return 0===e.params.length},group:function(e,t,n){var i=A(t.flatMap(function(e){return e.embeds}));if("and"===e){var o=t.map(function(e){return e.expression});return{params:t.flatMap(function(e){return e.params}),expression:o.every(D)?"and(".concat(o.join(","),")"):void 0,embeds:i}}var r=t.map(function(e){return e.expression});if(!r.every(D))return n.fail('PostgREST cannot combine a filter on a related record with "or". Move the condition on the related field out of the "any of" group, or filter on this collection only.');var s="(".concat(r.join(","),")");return{params:[["or",s]],expression:"or".concat(s),embeds:i}},id:function(e){if("idContainedIn"===e.operator){var t="in.".concat(T(e.value));return k("id",t,t)}return k("id","eq.".concat(C(e.value)),"eq.".concat(x(e.value)))},relatedTo:function(e,t){return t.fail("PostgREST cannot filter by Parse-style relations",{operator:"relatedTo"})},path:function(e,t){return t.fail("PostgREST cannot follow a path through several links in one request",{operator:"path"})},condition:function(e,t){return k(e.field,I(e,t,C),I(e,t,x))}},P(e),t);return O(O({},n),{embeds:A(n.embeds)})}function A(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function D(e){return void 0!==e}var F=Object.freeze({equalTo:"=",notEqualTo:"!=",lessThan:"<",greaterThan:">",lessThanOrEqualTo:"<=",greaterThanOrEqualTo:">="});function M(e){return String(null!=e?e:"")}function j(e,t){return g((n=0,i={},a=function(e){var t="p".concat(n++);return i[t]=e,"{:".concat(t,"}")},l=function(e){return{expression:e,params:i}},{name:"pocketbase",identityField:"id",empty:function(){return l("")},isEmpty:function(e){return""===e.expression},group:function(e,t){var n="and"===e?" && ":" || ";return l("(".concat(t.map(function(e){return e.expression}).join(n),")"))},id:function(e){if("idEqualTo"===e.operator)return l("id = ".concat(a(e.value)));var t=Array.isArray(e.value)?e.value:[e.value];return l("(".concat(t.map(function(e){return"id = ".concat(a(e))}).join(" || "),")"))},relatedTo:function(e,t){return t.fail("PocketBase cannot filter by Parse-style relations",{operator:"relatedTo"})},path:function(e,t){return t.fail("PocketBase cannot follow a path through several links in one request",{operator:"path"})},condition:function(e,t){return l(function(e,t,n){var i=e.field,a=e.operator,l=e.value,u=function(e,t){var n,i,o,r=e.indexOf(".");if(r<0)return"";var s=e.slice(0,r);return"many"===(null===(o=null===(i=null===(n=t.schema)||void 0===n?void 0:n.properties)||void 0===i?void 0:i[s])||void 0===o?void 0:o.cardinality)?"?":""}(i,t),c=F[a];if(c)return"".concat(i," ").concat(u).concat(c," ").concat(n(l));switch(a){case"containedIn":case"notContainedIn":if(0===(m=Array.isArray(l)?l:[l]).length)return"containedIn"===a?"1 = 2":"1 = 1";var d="containedIn"===a?"=":"!=",p="containedIn"===a?" || ":" && ";return"(".concat(m.map(function(e){return"".concat(i," ").concat(u).concat(d," ").concat(n(e))}).join(p),")");case"exists":return!1===l?"".concat(i," ").concat(u,"= null"):"".concat(i," ").concat(u,"!= null");case"contains":case"containsIgnoreCase":case"notContains":case"startsWith":case"startsWithIgnoreCase":case"notStartsWith":case"endsWith":case"endsWithIgnoreCase":case"notEndsWith":var h=o(a,l);if(!h)return t.fail('Cannot express "'.concat(a,'"'),{operator:a,field:i});var f=r(h.anchor,M(h.value),"%");return"".concat(i," ").concat(u).concat(h.negated?"!~":"~"," ").concat(n(f));case"between":case"notBetween":var g=s(l);return g?"between"===a?"(".concat(i," ").concat(u,">= ").concat(n(g[0])," && ").concat(i," ").concat(u,"<= ").concat(n(g[1]),")"):"(".concat(i," ").concat(u,"< ").concat(n(g[0])," || ").concat(i," ").concat(u,"> ").concat(n(g[1]),")"):t.fail('A "'.concat(a,'" filter needs a two-element array [from, to]'),{operator:a,field:i});case"isEmpty":return"".concat(i," ").concat(u,"= ").concat(n(""));case"isNotEmpty":return"".concat(i," ").concat(u,"!= ").concat(n(""));case"textSearch":return"".concat(i," ").concat(u,"~ ").concat(n("%".concat(M("string"==typeof l?l:null==l?void 0:l.term),"%")));case"pointsTo":var m;return 1===(m=Array.isArray(l)?l:[l]).length?"".concat(i," ").concat(u,"= ").concat(n(m[0])):"(".concat(m.map(function(e){return"".concat(i," ").concat(u,"= ").concat(n(e))}).join(" || "),")");default:return t.fail('The PocketBase dialect cannot express "'.concat(a,'"'),{operator:a,field:i})}}(e,t,a))}}),e,t);var n,i,a,l}function V(e){for(var t=e.expression,n=0,i=Object.entries(e.params);n<i.length;n++){var o=i[n],r=o[0],s=o[1];t=t.split("{:".concat(r,"}")).join(L(s))}return t}function L(e){return null==e?"null":"boolean"==typeof e||"number"==typeof e?String(e):e instanceof Date?JSON.stringify(e.toISOString().replace("T"," ").replace("Z","Z")):JSON.stringify(String(e))}function U(e){return"and"===e.type||"or"===e.type}function B(e,t,n){var i;if(void 0===n&&(n={}),!e||!Array.isArray(e.conditions))return null;var o=e.conditions.map(function(e){return function(e,t,n){var i,o,r,s,a;if(U(e))return B(e,t,n);var l=e,u="connected"===l.valueSource&&!!l.valuePortName,c=u&&t?t(l.valuePortName):void 0,d=u&&(void 0!==c||n.dropUnresolvedConnected)?c:l.value;if("relation"===l.kind)return null==d||""===d?null:{relatedTo:{id:String(d),key:null!==(a=l.relationProperty)&&void 0!==a?a:"",className:l.relationClass}};if(!l.field||!l.operator)return null;var p=l.operator;return"isEmpty"===p||"isNotEmpty"===p?((i={})[l.field]=((o={})[p]=!0,o),i):"exists"!==p&&u&&void 0===d&&n.dropUnresolvedConnected?null:((r={})[l.field]=((s={})[p]=d,s),r)}(e,t,n)}).filter(function(e){return null!==e});return 0===o.length?null:1===o.length?o[0]:((i={})[e.type]=o,i)}var W=Object.freeze({"equal to":"equalTo","not equal to":"notEqualTo","greater than":"greaterThan","greater than or equal to":"greaterThanOrEqualTo","less than":"lessThan","less than or equal to":"lessThanOrEqualTo","points to":"pointsTo",contain:"containsIgnoreCase"});function z(e,t){var n,i,o,r,s,a,l;if(void 0===t&&(t={}),!e)return null;if(void 0!==e.combinator&&Array.isArray(e.rules)){var u=e.rules.map(function(e){return z(e,t)}).filter(function(e){return null!==e});return 0===u.length?null:1===u.length?u[0]:((n={})["or"===e.combinator?"or":"and"]=u,n)}var c=void 0!==e.input?t[e.input]:e.value;if("related to"===e.operator)return void 0===c?null:{relatedTo:{id:String(c),key:null!==(a=e.relationProperty)&&void 0!==a?a:"",className:e.relatedTo}};if(!e.property)return null;if("exist"===e.operator)return(i={})[e.property]={exists:!0},i;if("not exist"===e.operator)return(o={})[e.property]={exists:!1},o;if(void 0===c)return null;var d=W[null!==(l=e.operator)&&void 0!==l?l:""];return d?((r={})[e.property]=((s={})[d]=c,s),r):null}function q(e){if(!e||"object"!=typeof e)return!1;var t=e;return!Array.isArray(e.conditions)&&(void 0!==t.combinator||void 0!==t.property||void 0!==t.operator)}},9935(e,t,n){"use strict";n.d(t,{functionScriptPortNames:()=>a});var i=[/Inputs\.([A-Za-z0-9_]+)/g,/Inputs\s*\[\s*(?:'([^'\n]*)'|"([^"\n]*)")\s*\]/g],o=[/Outputs\.([A-Za-z0-9_]+)\s*\(\s*\)/g,/Outputs\s*\[\s*(?:'([^'\n]*)'|"([^"\n]*)")\s*\]\(\s*\)/g],r=[/Outputs\.([A-Za-z0-9_]+)/g,/Outputs\s*\[\s*"([^"]*)"\s*\]/g];function s(e,t,n,i){for(var o,r=0,s=t;r<s.length;r++)for(var a=s[r],l=new RegExp(a.source,a.flags),u=l.exec(e);u;u=l.exec(e)){var c=null!==(o=u[1])&&void 0!==o?o:u[2];!c||n.includes(c)||i&&i.includes(c)||n.push(c)}}function a(e){var t={inputs:[],signals:[],outputs:[]};if("string"!=typeof e||0===e.length)return t;var n=function(e){for(var t="",n=0,i=e.length,o=[];n<i;){var r=e[n],s=e[n+1];if(o.length>0&&"`"===o[o.length-1])"\\"===r?(t+=e.slice(n,n+2),n+=2):"`"===r?(o.pop(),t+=r,n++):"$"===r&&"{"===s?(o.push("{"),t+="${",n+=2):(t+=r,n++);else if('"'===r||"'"===r){for(var a=n+1;a<i&&e[a]!==r&&"\n"!==e[a];)a+="\\"===e[a]?2:1;t+=e.slice(n,a+1),n=a+1}else if("`"===r)o.push("`"),t+=r,n++;else if("{"===r&&o.length>0)o.push("{"),t+=r,n++;else if("}"===r&&o.length>0&&"{"===o[o.length-1])o.pop(),t+=r,n++;else if("/"===r&&"/"===s)for(;n<i&&"\n"!==e[n];)n++;else if("/"===r&&"*"===s){var l=e.indexOf("*/",n+2),u=-1===l?i:l+2;t+=e.slice(n,u).replace(/[^\n]/g," "),n=u}else if("/"===r&&c(t)){a=n+1;for(var d=!1;a<i&&"\n"!==e[a];)if("\\"!==e[a]){if("["===e[a])d=!0;else if("]"===e[a])d=!1;else if("/"===e[a]&&!d)break;a++}else a+=2;t+=e.slice(n,a+1),n=a+1}else t+=r,n++}return t}(e);return s(n,i,t.inputs),s(n,o,t.signals),s(n,r,t.outputs,t.signals),t}var l=new Set(["(",",","=",":","[","!","&","|","?","{","}",";","+","-","*","%","<",">","~","^"]),u=/(?:^|[^\w$])(?:return|typeof|instanceof|in|of|new|delete|void|throw|case|do|else|yield|await)$/;function c(e){var t=e.replace(/\s+$/,"");return 0===t.length||l.has(t[t.length-1])||u.test(t)}},4069(e,t,n){"use strict";n.r(t),n.d(t,{CALL_PORTS_STATE_KEY:()=>a,DEFAULT_HAT_SIGNAL:()=>l,DEFAULT_SIGNAL_OUTPUT:()=>d,HAT_BLOCK_TYPE:()=>i,MY_BLOCKS_CALL_STATEMENT:()=>r,MY_BLOCKS_CALL_TYPES:()=>s,MY_BLOCKS_CALL_VALUE:()=>o,RESERVED_INPUTS:()=>u,RESERVED_OUTPUTS:()=>c,detectIO:()=>p,detectInterface:()=>h,typeOfPort:()=>v});var i="noodl_when_signal",o="myblocks_call_value",r="myblocks_call_statement",s=[o,r],a="ports",l="run",u=["workspace","generatedCode","run"],c=["error","success","failure","done","unchanged","completed"],d="Output1";function p(e){var t=f(e);return{inputs:g(t,"input"),outputs:g(t,"output"),signalInputs:m(t,"input"),signalOutputs:m(t,"output")}}function h(e){var t=f(e);return{inputs:y(t,"input"),outputs:y(t,"output")}}function f(e){var t,n=[];if(!e)return n;try{t="string"==typeof e?JSON.parse(e):e}catch(e){return n}var i=t&&t.blocks&&t.blocks.blocks;if(!Array.isArray(i))return n;for(var o=0,r=i;o<r.length;o++)w(r[o],n);return n}function g(e,t){for(var n=[],i=new Set,o=0,r=e;o<r.length;o++){var s=r[o];s.plug!==t||"value"!==s.kind||i.has(s.name)||(i.add(s.name),n.push({name:s.name,type:s.declaredType||"*"}))}return n}function m(e,t){for(var n=[],i=new Set,o=0,r=e;o<r.length;o++){var s=r[o];s.plug!==t||"signal"!==s.kind||i.has(s.name)||(i.add(s.name),n.push(s.name))}return n}function y(e,t){for(var n=[],i=new Map,o=0,r=e;o<r.length;o++){var s=r[o];if(s.plug===t){var a=i.get(s.name);if(a)a.declared=a.declared||null!==s.declaredType,"signal"===s.kind&&"value"===a.kind&&(a.kind="signal",a.type="signal");else{var l={name:s.name,kind:s.kind,type:"signal"===s.kind?"signal":s.declaredType||"*",declared:null!==s.declaredType};i.set(s.name,l),n.push(l)}}}return n}function v(e,t,n){var i=("input"===t?e.inputs:e.outputs).find(function(e){return e.name===n});return i?i.type:"*"}function b(e,t,n){if(Array.isArray(e))for(var i=0,o=e;i<o.length;i++){var r=o[i];if(r&&"object"==typeof r){var s=r;if("string"==typeof s.name&&""!==s.name){var a="signal"===s.kind?"signal":"value",l=s.declared?"signal"===a?"signal":"string"==typeof s.type&&""!==s.type?s.type:"*":null;n.push({name:s.name,plug:t,kind:a,declaredType:l})}}}}function w(e,t){if(e&&e.type){var n=e.fields||{},o=n.NAME;if(o)switch(e.type){case"noodl_define_input":t.push({name:o,plug:"input",kind:"value",declaredType:n.TYPE||"*"});break;case"noodl_get_input":t.push({name:o,plug:"input",kind:"value",declaredType:null});break;case"noodl_define_output":t.push({name:o,plug:"output",kind:"value",declaredType:n.TYPE||"*"});break;case"noodl_set_output":t.push({name:o,plug:"output",kind:"value",declaredType:null});break;case"noodl_define_signal_input":case i:t.push({name:o,plug:"input",kind:"signal",declaredType:"signal"});break;case"noodl_define_signal_output":t.push({name:o,plug:"output",kind:"signal",declaredType:"signal"});break;case"noodl_send_signal":t.push({name:o,plug:"output",kind:"signal",declaredType:null})}if(-1!==s.indexOf(e.type)&&function(e,t){var n=e.extraState;if(n&&"object"==typeof n){var i=n[a];i&&"object"==typeof i&&(b(i.inputs,"input",t),b(i.outputs,"output",t))}}(e,t),e.inputs)for(var r=0,l=Object.keys(e.inputs);r<l.length;r++){var u=l[r],c=e.inputs[u];c&&(w(c.block,t),w(c.shadow,t))}e.next&&w(e.next.block,t)}}},280(e,t,n){"use strict";n.d(t,{TYPECASTS:()=>i});var i=[{from:"string",to:["number","boolean","image","color","enum","textStyle","dimension","array","object"]},{from:"boolean",to:["number","string","signal"]},{from:"number",to:["boolean","string","dimension"]},{from:"date",to:["string"]},{from:"signal",to:["boolean","number"]},{from:"image",to:[]},{from:"cloudfile",to:["string","image"]},{from:"color",to:["string"]},{from:"enum",to:["string"]},{from:"object",to:["string"]},{from:"domelement",to:[]},{from:"reference",to:[]},{from:"font",to:[]},{from:"textStyle",to:["string"]},{from:"collection",to:["array"]},{from:"array",to:["collection","string","optionslist"]}]},2793(e,t,n){"use strict";n.d(t,{Z7:()=>u,qS:()=>l});var i=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,o=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?/i,r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+)(%?))?/i,s=/^var\(\s*(--[^,)\s]+)\s*(?:,([\s\S]*))?\)$/;function a(e,t,n){return Math.max(e,Math.min(t,n))}function l(e,t){if(void 0===t&&(t=0),"string"!=typeof e)return null;var n=e.trim();if(!n)return null;var u=s.exec(n);if(u){if(t>=8)return null;var c=function(e){if("undefined"==typeof document||!document.documentElement)return"";if("function"!=typeof getComputedStyle)return"";try{return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}catch(e){return""}}(u[1]);return c?l(c,t+1):void 0!==u[2]?l(u[2],t+1):null}var d=i.exec(n);if(d)return[parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16),parseInt(d[3]+d[3],16),255];var p=o.exec(n);if(p)return[parseInt(p[1],16),parseInt(p[2],16),parseInt(p[3],16),void 0===p[4]?255:parseInt(p[4],16)];var h=r.exec(n);if(h){var f=255;if(void 0!==h[4]){var g=Number(h[4]);f=a(0,255,Math.round(255*("%"===h[5]?g/100:g)))}return[a(0,255,Math.round(Number(h[1]))),a(0,255,Math.round(Number(h[2]))),a(0,255,Math.round(Number(h[3]))),f]}return null}function u(e){if("undefined"!=typeof CSS&&"function"==typeof CSS.supports)try{return!CSS.supports("color",e)}catch(e){return}}},4038(e,t,n){"use strict";var i={easeOutQuartic:function(e,t,n){return-(t-e)*(--n*n*n*n-1)+e},easeInQuartic:function(e,t,n){return n*n*n*n*(t-e)+e},easeInOutQuartic:function(e,t,n){return(n*=2)<1?(t-e)/2*n*n*n*n+e:-(t-e)/2*((n-=2)*n*n*n-2)+e},easeOutCubic:function(e,t,n){return(t-e)*(--n*n*n+1)+e},easeInCubic:function(e,t,n){return n*n*n*(t-e)+e},easeInOutCubic:function(e,t,n){return(n*=2)<1?(t-e)/2*n*n*n+e:(t-e)/2*((n-=2)*n*n+2)+e},easeOutQuadratic:function(e,t,n){return-(t-e)*n*(n-2)+e},easeInQuadratic:function(e,t,n){return n*n*(t-e)+e},easeInOutQuadratic:function(e,t,n){return(n*=2)<1?(t-e)/2*n*n+e:-(t-e)/2*((n-=1)*(n-2)-1)+e},linear:function(e,t,n){return e+(t-e)*n}};i.easeIn=i.easeInCubic,i.easeOut=i.easeOutCubic,i.easeInOut=i.easeInOutCubic;const o=i;n.d(t,["A",0,o])},1173(e,t,n){"use strict";n.d(t,["A",0,function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}])},4e3(e,t,n){"use strict";n.r(t);var i=n(8454),o=n.n(i),r=n(4038);function s(e){this.name=e.name,this.startValue=0,this.endValue=0,this.currentValue=void 0,this.startMode="implicit",this.ease=e.ease,this.node=e.node,this.hasSampledStartValue=!1;var t=this;this.animation=e.node.context.timerScheduler.createTimer({startValue:0,endValue:0,onRunning:function(e){var n=t.ease(this.startValue,this.endValue,e);t.setCurrentValue(n)}}),this.animation.startValue=0,this.animation.endValue=0}Object.defineProperties(s.prototype,{setCurrentValue:{value:function(e){this.currentValue=e,this.node.flagOutputDirty(this.name)}},play:{value:function(e,t){if(void 0===e&&(console.log("Animation warning, start value is undefined"),e=0),void 0!==t){var n=this.animation;n.startValue=e,this.setCurrentValue(e),n.endValue=t,n.duration=this.node._internal.duration,n.start()}else console.error("Animation error, start:",e,"end:",t)}},playToEnd:{value:function(){!1!==this.hasConnections()&&(this.updateStartValue(),this.play(this.getTargetsCurrentValue(),this.endValue))}},playToStart:{value:function(){!1!==this.hasConnections()&&(this.updateStartValue(),this.play(this.getTargetsCurrentValue(),this.startValue))}},replayToEnd:{value:function(){!1!==this.hasConnections()&&(this.updateStartValue(),this.play(this.startValue,this.endValue))}},replayToStart:{value:function(){!1!==this.hasConnections()&&this.play(this.endValue,this.startValue)}},hasConnections:{value:function(){return this.node.getOutput(this.name).hasConnections()}},getTargetsCurrentValue:{value:function(){var e=this.node.getOutput(this.name).connections,t=e[0].node.getInputValue(e[0].inputPortName);return t instanceof Object&&t.hasOwnProperty("value")?t.value:t}},updateStartValue:{value:function(){"implicit"!==this.startMode||this.hasSampledStartValue||(this.hasSampledStartValue=!0,this.startValue=this.getTargetsCurrentValue())}},stop:{value:function(){this.animation.stop(),this.setCurrentValue(void 0)}},jumpToStart:{value:function(){this.animation.stop(),this.setCurrentValue(this.startValue)}},jumpToEnd:{value:function(){this.animation.stop(),this.setCurrentValue(this.endValue)}}});const a={node:{name:"Animation",docs:"https://docs.noodl.net/nodes/animation/animation",category:"Animation",deprecated:!0,ssr:{compat:"partial",note:"The scheduler clock is frozen during server render; animations do not run or complete there."},initialize:function(){var e=this._internal;e.duration=300,e.ease=r.A.easeOut,e._isPlayingToEnd=!1,e.animations=[],e.cubicBezierPoints=[0,0,0,0],e.cubicBezierFunction=void 0;var t=this;e.animation=this.context.timerScheduler.createTimer({onFinish:function(){!1===e._isPlayingToEnd?t.sendSignalOnOutput("hasReachedStart"):t.sendSignalOnOutput("hasReachedEnd")}}),this.addDeleteListener(function(){e.animation.stop();for(var t=0,n=e.animations;t<n.length;t++)n[t].animation.stop()})},inputs:{duration:{index:0,type:"number",displayName:"Duration (ms)",group:"Animation Properties",description:"How long a play takes, in milliseconds",default:300,set:function(e){this._internal.duration=e}},easingCurve:{index:10,type:{name:"enum",enums:[{value:"easeOut",label:"Ease Out"},{value:"easeIn",label:"Ease In"},{value:"linear",label:"Linear"},{value:"easeInOut",label:"Ease In Out"},{value:"cubicBezier",label:"Cubic Bezier"}]},group:"Animation Properties",displayName:"Easing Curve",description:"Shape of the movement between each value's start and end",default:"easeOut",set:function(e){var t;"cubicBezier"===e?(this.updateCubicBezierFunction(),t=this._internal.cubicBezierFunction):t=r.A[e],this._internal.ease=t}},playToEnd:{index:20,group:"Play",displayName:"To End",description:"Animates every value from where it is now to its end value",editorName:"Play To End",valueChangedToTrue:function(){this._internal._isPlayingToEnd=!0;var e=this._internal.animation,t=this._internal.animations,n=this;this.scheduleAfterInputsHaveUpdated(function(){e.duration=n._internal.duration,e.start();for(var i=0;i<t.length;i++)t[i].ease=n._internal.ease,t[i].playToEnd()})}},playToStart:{index:21,group:"Play",displayName:"To Start",description:"Animates every value from where it is now to its start value",editorName:"Play To Start",valueChangedToTrue:function(){this._internal._isPlayingToEnd=!1;var e=this._internal.animation,t=this._internal.animations,n=this;this.scheduleAfterInputsHaveUpdated(function(){e.duration=n._internal.duration,e.start();for(var i=0;i<t.length;i++)t[i].ease=n._internal.ease,t[i].playToStart()})}},replayToEnd:{index:22,group:"Play",displayName:"From Start To End",description:"Animates every value from its start value to its end value, wherever it is now",editorName:"Play From Start To End",valueChangedToTrue:function(){var e=this._internal.animation,t=this._internal.animations,n=this;this._internal._isPlayingToEnd=!0,this.scheduleAfterInputsHaveUpdated(function(){e.duration=n._internal.duration,e.start();for(var i=0;i<t.length;i++)t[i].ease=n._internal.ease,t[i].replayToEnd()})}},replayToStart:{index:23,group:"Play",displayName:"From End To Start",description:"Animates every value from its end value to its start value, wherever it is now",editorName:"Play From End To Start",valueChangedToTrue:function(){this._internal._isPlayingToEnd=!1;var e=this._internal.animation,t=this._internal.animations,n=this;this.scheduleAfterInputsHaveUpdated(function(){e.duration=n._internal.duration,e.start();for(var i=0;i<t.length;i++)t[i].ease=n._internal.ease,t[i].replayToStart()})}},stop:{index:60,group:"Instant Actions",displayName:"Stop",description:"Abandons the play in progress, leaving every animated output unset",valueChangedToTrue:function(){var e=this._internal.animation,t=this._internal.animations;e.stop();for(var n=0;n<t.length;n++)t[n].stop()}},jumpToStart:{index:61,group:"Instant Actions",displayName:"Jump To Start",description:"Sets every value to its start value with no animation",valueChangedToTrue:function(){for(var e=this._internal.animations,t=0;t<e.length;t++)e[t].jumpToStart();this.sendSignalOnOutput("hasReachedStart")}},jumpToEnd:{index:62,group:"Instant Actions",displayName:"Jump To End",description:"Sets every value to its end value with no animation",valueChangedToTrue:function(){for(var e=this._internal.animations,t=0;t<e.length;t++)e[t].jumpToEnd();this.sendSignalOnOutput("hasReachedEnd")}},cubicBezierP1X:{displayName:"P1 X",group:"Cubic Bezier",description:"First control point along the time axis, clamped between 0 and 1; used only when Easing Curve is Cubic Bezier",type:{name:"number"},index:11,set:function(e){this._internal.cubicBezierPoints[0]=Math.min(1,Math.max(0,e)),this.updateCubicBezierFunction()}},cubicBezierP1Y:{displayName:"P1 Y",group:"Cubic Bezier",description:"First control point along the value axis, where beyond 0 and 1 overshoots; used only when Easing Curve is Cubic Bezier",type:{name:"number"},index:12,set:function(e){this._internal.cubicBezierPoints[1]=e,this.updateCubicBezierFunction()}},cubicBezierP2X:{displayName:"P2 X",group:"Cubic Bezier",description:"Second control point along the time axis, clamped between 0 and 1; used only when Easing Curve is Cubic Bezier",type:{name:"number"},index:13,set:function(e){this._internal.cubicBezierPoints[2]=Math.min(1,Math.max(0,e)),this.updateCubicBezierFunction()}},cubicBezierP2Y:{displayName:"P2 Y",group:"Cubic Bezier",description:"Second control point along the value axis, where beyond 0 and 1 overshoots; used only when Easing Curve is Cubic Bezier",type:{name:"number"},index:14,set:function(e){this._internal.cubicBezierPoints[3]=e,this.updateCubicBezierFunction()}}},outputs:{hasReachedStart:{type:"signal",group:"Events",displayName:"Has Reached Start",description:"Fires when a play towards the start values has finished"},hasReachedEnd:{type:"signal",group:"Events",displayName:"Has Reached End",description:"Fires when a play towards the end values has finished"}},dynamicports:[{condition:"easingCurve = cubicBezier",inputs:["cubicBezierP1X","cubicBezierP1Y","cubicBezierP2X","cubicBezierP2Y"]},{name:"expand/basic",indexStep:100,template:[{name:"{{portname}}.startMode",type:{name:"enum",enums:[{value:"explicit",label:"Explicit"},{value:"implicit",label:"Implicit"}],allowEditOnly:!0},plug:"input",group:"{{portname}} Animation",displayName:"Start Mode",default:"implicit",index:1e3},{name:"{{portname}}.endValue",type:"number",plug:"input",group:"{{portname}} Animation",displayName:"End Value",editorName:"End Value | {{portname}} ",default:0,index:1002}]},{name:"expand/basic",condition:"'{{portname}}.startMode' = explicit",indexStep:100,template:[{name:"{{portname}}.startValue",plug:"input",type:"number",displayName:"Start Value",editorName:"Start Value | {{portname}}",group:"{{portname}} Animation",default:0,index:1001}]}],panels:[{name:"PortEditor",title:"Animations",plug:"output",type:{name:"number"},group:"Animation Values"}],prototypeExtensions:{updateCubicBezierFunction:{value:function(){var e=this._internal.cubicBezierPoints,t=o()(e);this._internal.cubicBezierFunction=function(e,n,i){return r.A.linear(e,n,t.get(i))},this._internal.ease=this._internal.cubicBezierFunction}},_registerAnimationGroup:{value:function(e){var t=new s({node:this,ease:this._internal.ease,name:e});this._internal.animations.push(t);var n={};n[e+".startMode"]={set:function(e){t.startMode=e}},n[e+".startValue"]={default:0,set:function(e){t.startValue=e}},n[e+".endValue"]={default:0,set:function(e){t.endValue=e}},this.registerInputs(n),this.registerOutput(e,{getter:function(){return t.currentValue}})}},registerInputIfNeeded:{value:function(e){if(!this.hasInput(e)){var t=e.indexOf("."),n=e.substr(0,t);this.hasOutput(n)||this._registerAnimationGroup(n)}}},registerOutputIfNeeded:{value:function(e){this.hasOutput(e)||this._registerAnimationGroup(e)}}}}};n.d(t,["default",0,a])},5768(e,t,n){"use strict";n.r(t);var i=n(3538),o=n(6835),r=n.n(o);function s(e,t,n){var i=[];if(t.properties){var o=t.properties.split(",");for(var r in o){var s=o[r];i.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:"value-"+s,displayName:s}),i.push({type:"signal",plug:"output",group:"Events",displayName:s+" Changed",name:"changed-"+s})}}n.sendDynamicPorts(e,i,{detectRenamed:{plug:"input/output"}})}const a={node:{name:"Component State",displayNodeName:"Component Object",category:"Component Utilities",color:"component",docs:"https://docs.noodl.net/nodes/component-utilities/component-object",deprecated:!0,replacedBy:"net.noodl.ComponentObject",initialize:function(){var e=this;this._internal.inputValues={},this._internal.onModelChangedCallback=function(t){!1===e.isInputConnected("fetch")&&(e.hasOutput("value-"+t.name)&&e.flagOutputDirty("value-"+t.name),e.hasOutput("changed-"+t.name)&&e.sendSignalOnOutput("changed-"+t.name),e.sendSignalOnOutput("changed"))};var t=r().get("componentState"+this.nodeScope.componentOwner.getInstanceId());this._internal.model=t,t.on("change",this._internal.onModelChangedCallback)},getInspectInfo:function(){var e=this._internal.model.data;return Object.keys(e).map(function(t){return{type:"text",value:t+": "+e[t]}})},inputs:{properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",description:"Names of the values this component keeps, each becoming a matching input and output",set:function(){}},store:{displayName:"Set",group:"Actions",description:"Writes the supplied property values into the component object",valueChangedToTrue:function(){this.scheduleStore()}},fetch:{displayName:"Fetch",group:"Actions",description:"Republishes every property; connecting this stops the outputs updating on their own",valueChangedToTrue:function(){this.scheduleFetch()}}},outputs:{changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires when any property is written, unless Fetch is connected"},fetched:{type:"signal",displayName:"Fetched",group:"Events",description:"Fires once Fetch has republished every property"},stored:{type:"signal",displayName:"Stored",group:"Events",description:"Fires once Set has written every property"}},methods:{scheduleStore:function(){var e=this;if(!this.hasScheduledStore){this.hasScheduledStore=!0;var t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){for(var n in e.hasScheduledStore=!1,t.inputValues)t.model.set(n,t.inputValues[n],{resolve:!0});e.sendSignalOnOutput("stored")})}},scheduleFetch:function(){var e=this;this.hasScheduledFetch||(this.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated(function(){e.hasScheduledFetch=!1,e.fetch()}))},fetch:function(){for(var e in this._internal.model.data)this.hasOutput("value-"+e)&&(this.flagOutputDirty("value-"+e),this.hasOutput("changed-"+e)&&this.sendSignalOnOutput("changed-"+e));this.sendSignalOnOutput("fetched")},_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this),this._internal.model.off("change",this._internal.onModelChangedCallback)},registerOutputIfNeeded:function(e){if(!this.hasOutput(e)){var t=e.split("-"),n=t[t.length-1];this.registerOutput(e,{get:function(){return this._internal.model.get(n,{resolve:!0})}})}},registerInputIfNeeded:function(e){if(!this.hasInput(e)){var t=e.split("-"),n=t[t.length-1];e.startsWith("value-")&&this.registerInput(e,{set:function(e){this._internal.inputValues[n]=e,!1===this.isInputConnected("store")&&this.scheduleStore()}})}}}},setup:function(e,t){var n=e.editorConnection;n&&n.isRunningLocally()&&t.on("nodeAdded.Component State",function(e){s(e.id,e.parameters,n),e.on("parameterUpdated",function(t){("properties"===t.name||t.name.startsWith("type-"))&&s(e.id,e.parameters,n)})})}};n.d(t,["default",0,a])},2623(e,t,n){"use strict";n.r(t);var i=n(3538),o=n(1656),r=n.n(o),s=n(6835),a=n.n(s);const l={node:{name:"Collection",docs:"https://docs.noodl.net/nodes/data/array",displayNodeName:"Array",category:"Data",usePortAsLabel:"collectionId",color:"data",deprecated:!0,replacedBy:"Collection2",initialize:function(){var e=this,t=!1;this._internal.collectionChangedCallback=function(){!0!==e.isInputConnected("fetch")&&(t||(t=!0,e.scheduleAfterInputsHaveUpdated(function(){e.sendSignalOnOutput("changed"),e.flagOutputDirty("count"),t=!1})))},this._internal.sourceCollectionChangedCallback=function(){!0!==e.isInputConnected("store")&&e.scheduleCopyItems()}},getInspectInfo:function(){if(this._internal.collection)return"Count: "+this._internal.collection.size()},inputs:{collectionId:{type:{name:"string",identifierOf:"CollectionName",identifierDisplayName:"Array Ids"},displayName:"Id",group:"General",set:function(e){var t=e instanceof r()?e.getId():e;this._internal.collectionId=t,!1===this.isInputConnected("fetch")?this.setCollectionID(t):this.flagOutputDirty("id")}},items:{type:"array",group:"General",displayName:"Items",set:function(e){var t=this;void 0!==e&&e!==this._internal.collection&&(this._internal.pendingSourceCollection=e,!1===this.isInputConnected("store")&&this.scheduleAfterInputsHaveUpdated(function(){t.setSourceCollection(e)}))}},modifyId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Item Id",group:"Modify",set:function(e){this._internal.modifyId=e}},store:{displayName:"Set",group:"Actions",valueChangedToTrue:function(){this.scheduleStore()}},add:{displayName:"Add",group:"Modify",valueChangedToTrue:function(){var e=this,t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){if(void 0!==t.modifyId&&(void 0===t.collection&&!1===this.isInputConnected("fetch")&&e.setCollection(r().get()),void 0!==t.collection)){var n=a().get(t.modifyId);t.collection.add(n),e.sendSignalOnOutput("modified")}})}},remove:{displayName:"Remove",group:"Modify",valueChangedToTrue:function(){var e=this,t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){if(void 0!==t.modifyId&&(void 0===t.collection&&!1===this.isInputConnected("fetch")&&e.setCollection(r().get()),void 0!==t.collection)){var n=a().get(t.modifyId);t.collection.remove(n),e.sendSignalOnOutput("modified")}})}},clear:{displayName:"Clear",group:"Modify",valueChangedToTrue:function(){var e=this,t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){void 0===t.collection&&!1===this.isInputConnected("fetch")&&e.setCollection(r().get()),void 0!==t.collection&&(t.collection.set([]),e.sendSignalOnOutput("modified"),e.sendSignalOnOutput("count"))})}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue:function(){this.scheduleSetCollection()}},new:{displayName:"New",group:"Actions",valueChangedToTrue:function(){this.scheduleNew()}}},outputs:{id:{type:"string",displayName:"Id",group:"General",getter:function(){return this._internal.collection?this._internal.collection.getId():this._internal.collectionId}},items:{type:"array",displayName:"Items",group:"General",getter:function(){return this._internal.collection}},count:{type:"number",displayName:"Count",group:"General",getter:function(){return this._internal.collection?this._internal.collection.size():0}},modified:{group:"Events",type:"signal",displayName:"Modified"},changed:{group:"Events",type:"signal",displayName:"Changed"},stored:{group:"Events",type:"signal",displayName:"Stored"},fetched:{group:"Events",type:"signal",displayName:"Fetched"},created:{group:"Events",type:"signal",displayName:"Created"}},prototypeExtensions:{setCollectionID:function(e){this.setCollection(r().get(e))},setCollection:function(e){this._internal.collection&&this._internal.collection.off("change",this._internal.collectionChangedCallback),this._internal.collection=e,this.flagOutputDirty("id"),e.on("change",this._internal.collectionChangedCallback),this.flagOutputDirty("items"),this.flagOutputDirty("count")},setSourceCollection:function(e){var t=this._internal;t.sourceCollection&&t.sourceCollection instanceof r()&&t.sourceCollection.off("change",t.sourceCollectionChangedCallback),t.sourceCollection=e,t.sourceCollection instanceof r()&&t.sourceCollection.on("change",t.sourceCollectionChangedCallback),this._copySourceItems()},scheduleSetCollection:function(){var e=this;this.hasScheduledSetCollection||(this.hasScheduledSetCollection=!0,this.scheduleAfterInputsHaveUpdated(function(){e.hasScheduledSetCollection=!1,e.setCollectionID(e._internal.collectionId),e.sendSignalOnOutput("fetched")}))},scheduleStore:function(){var e=this;if(!this.hasScheduledStore){this.hasScheduledStore=!0;var t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){e.hasScheduledStore=!1,e.setSourceCollection(t.pendingSourceCollection),e.sendSignalOnOutput("stored")})}},_copySourceItems:function(){var e=this._internal;void 0===e.collection&&!1===this.isInputConnected("fetch")&&this.setCollection(r().get()),e.collection&&e.collection.set(e.sourceCollection)},scheduleCopyItems:function(){var e=this;this.hasScheduledCopyItems||(this.hasScheduledCopyItems=!0,this.scheduleAfterInputsHaveUpdated(function(){e.hasScheduledCopyItems=!1,e._copySourceItems()}))},scheduleNew:function(){var e=this;if(!this.hasScheduledNew){this.hasScheduledNew=!0;var t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){e.hasScheduledNew=!1,e.setCollection(r().get()),t.sourceCollection&&t.collection.set(t.sourceCollection),e.sendSignalOnOutput("created")})}},_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this),this._internal.collection&&this._internal.collection.off("change",this._internal.collectionChangedCallback)}}}};n.d(t,["default",0,l])},6241(e,t,n){"use strict";n.r(t);var i=n(3538),o=n(7011),r=n.n(o),s=n(1656),a=n.n(s),l=n(8600),u=n.n(l),c=n(6835),d=n.n(c);function p(e,t){var n=Object.keys(e);if(0===n.length)return{};if(1===n.length){var i={},o=n[0];if(void 0!==e.and&&Array.isArray(e.and))i.$and=e.and.map(function(e){return p(e,t)});else if(void 0!==e.or&&Array.isArray(e.or))i.$or=e.or.map(function(e){return p(e,t)});else if(void 0!==e.idEqualTo)i.objectId={$eq:e.idEqualTo};else if(void 0!==e.idContainedIn)i.objectId={$in:e.idContainedIn};else if(void 0!==e.relatedTo){var s=e.relatedTo.id;if(void 0===s)return void t.error("Must provide id in relatedTo filter");var a=e.relatedTo.key;if(void 0===a)return void t.error("Must provide key in relatedTo filter");var l=d().get(s);i.$relatedTo={object:{__type:"Pointer",objectId:s,className:l._class},key:a}}else if("object"==typeof e[o]){var u=e[o];if(void 0!==u.equalTo)i[o]={$eq:u.equalTo};else if(void 0!==u.notEqualTo)i[o]={$ne:u.notEqualTo};else if(void 0!==u.lessThan)i[o]={$lt:u.lessThan};else if(void 0!==u.greaterThan)i[o]={$gt:u.greaterThan};else if(void 0!==u.lessThanOrEqualTo)i[o]={$lte:u.lessThanOrEqualTo};else if(void 0!==u.greaterThanOrEqualTo)i[o]={$gte:u.greaterThanOrEqualTo};else if(void 0!==u.exists)i[o]={$exists:u.exists};else if(void 0!==u.containedIn)i[o]={$in:u.containedIn};else if(void 0!==u.notContainedIn)i[o]={$nin:u.notContainedIn};else if(void 0!==u.pointsTo){var c=void 0;r()._collections[t.collectionName]&&(c=r()._collections[t.collectionName].schema);var h=c&&c.properties&&c.properties[o]?c.properties[o].targetClass:void 0;"Relation"===(c&&c.properties&&c.properties[o]?c.properties[o].type:void 0)?i[o]={__type:"Pointer",objectId:u.pointsTo,className:h}:Array.isArray(u.pointsTo)?i[o]={$in:u.pointsTo.map(function(e){return{__type:"Pointer",objectId:e,className:h}})}:i[o]={$eq:{__type:"Pointer",objectId:u.pointsTo,className:h}}}else if(void 0!==u.matchesRegex)i[o]={$regex:u.matchesRegex,$options:u.options};else if(void 0!==u.text&&void 0!==u.text.search){var f=u.text.search;i[o]="string"==typeof f?{$text:{$search:{$term:f,$caseSensitive:!1}}}:{$text:{$search:{$term:f.term,$language:f.language,$caseSensitive:f.caseSensitive,$diacriticSensitive:f.diacriticSensitive}}}}}else t.error("Unrecognized filter keys "+n.join(","));return i}t.error("Filter must only have one key found "+n.join(","))}function h(e){return this._internal.storageSettings[e]}function f(e,t){this._internal.storageSettings[e]=t}function g(e,t,n,i){var o=[];if(o.push({name:"collectionName",type:{name:"enum",enums:void 0!==i?i.map(function(e){return{value:e.name,label:e.name}}):[],allowEditOnly:!0},displayName:"Collecton Name",plug:"input",group:"General"}),o.push({name:"storageFilterType",type:{name:"enum",allowEditOnly:!0,enums:[{value:"simple",label:"Simple"},{value:"json",label:"Advanced"}]},displayName:"Filter",default:"simple",plug:"input",group:"General"}),o.push({type:"boolean",plug:"input",group:"Limit",name:"storageEnableLimit",displayName:"Use limit"}),t.storageEnableLimit&&(o.push({type:"number",default:10,plug:"input",group:"Limit",name:"storageLimit",displayName:"Limit"}),o.push({type:"number",default:0,plug:"input",group:"Limit",name:"storageSkip",displayName:"Skip"})),o.push({type:"signal",plug:"input",group:"Storage",name:"storageFetch",displayName:"Fetch"}),void 0===t.storageFilterType||"simple"===t.storageFilterType){o.push({type:{name:"stringlist",allowEditOnly:!0},plug:"input",group:"Filter",name:"storageFilter",displayName:"Filter"});var r={string:[{value:"eq",label:"Equals"},{value:"ne",label:"Not Equals"}],boolean:[{value:"eq",label:"Equals"},{value:"ne",label:"Not Equals"}],number:[{value:"eq",label:"Equals"},{value:"ne",label:"Not Equals"},{value:"lt",label:"Less than"},{value:"gt",label:"Greater than"},{value:"gte",label:"Greater than or equal"},{value:"lte",label:"Less than or equal"}]};t.storageFilter&&t.storageFilter.split(",").forEach(function(e){o.push({type:{name:"enum",enums:[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"boolean",label:"Boolean"}]},default:"string",plug:"input",group:e+" filter",displayName:"Type",editorName:e+" filter | Type",name:"storageFilterType-"+e});var n=t["storageFilterType-"+e];o.push({type:{name:"enum",enums:r[n||"string"]},default:"eq",plug:"input",group:e+" filter",displayName:"Op",editorName:e+" filter| Op",name:"storageFilterOp-"+e}),o.push({type:n||"string",plug:"input",group:e+" filter",displayName:"Value",editorName:e+" Filter Value",name:"storageFilterValue-"+e})}),o.push({type:{name:"stringlist",allowEditOnly:!0},plug:"input",group:"Sort",name:"storageSort",displayName:"Sort"}),t.storageSort&&t.storageSort.split(",").forEach(function(e){o.push({type:{name:"enum",enums:[{value:"ascending",label:"Ascending"},{value:"descending",label:"Descending"}]},default:"ascending",plug:"input",group:e+" sort",displayName:"Sort",editorName:e+" sorting",name:"storageSort-"+e})})}else if("json"===t.storageFilterType){o.push({type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},plug:"input",group:"Filter",name:"storageJSONFilter",default:"// Write your query script here, check out the reference documentation for examples\nwhere({ })\n",displayName:"Filter"});var s=t.storageJSONFilter;if(s){var a=(s=s.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"")).match(/\$[A-Za-z0-9]+/g);if(a){var l={};a.forEach(function(e){l[e]=!0}),Object.keys(l).forEach(function(e){o.push({name:"storageFilterValue-"+e.substring(1),displayName:e.substring(1),group:"Filter Values",plug:"input",type:{name:"*",allowConnectionsOnly:!0}})})}u().parseAndAddPortsFromScript(s,o,{inputPrefix:"storageFilterValue-",inputGroup:"Filter Values",inputType:{name:"*",allowConnectionsOnly:!0},skipOutputs:!0})}}n.sendDynamicPorts(e,o)}const m={node:{name:"DbCollection",docs:"https://docs.noodl.net/nodes/cloud-services/collection",displayNodeName:"Query Collection",category:"Cloud Services",usePortAsLabel:"collectionName",color:"data",deprecated:!0,replacedBy:"DbCollection2",initialize:function(){var e=this,t=!1;this._internal.collectionChangedCallback=function(){t||(t=!0,e.scheduleAfterInputsHaveUpdated(function(){e.sendSignalOnOutput("modified"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),t=!1}))},this._internal.storageSettings={}},inputs:{},outputs:{id:{description:"Name of the class being queried",type:"string",displayName:"Name",group:"General",getter:function(){return this._internal.name}},items:{description:"Records the query matched; empty before the first query has run",type:"array",displayName:"Result",group:"General",getter:function(){return this._internal.collection}},firstItemId:{description:"Id of the first matched record",type:"string",displayName:"First Item Id",group:"General",getter:function(){if(this._internal.collection){var e=this._internal.collection.get(0);if(void 0!==e)return e.getId()}}},count:{description:"How many records are in Result",type:"number",displayName:"Count",group:"General",getter:function(){return this._internal.collection?this._internal.collection.size():0}},modified:{description:"Fires when a record joins or leaves Result after the query has run",group:"Events",type:"signal",displayName:"Modified"},fetched:{description:"Fires once the query has returned and Result is up to date",group:"Events",type:"signal",displayName:"Fetched"},failure:{description:"Fires when the query could not be run, after the reason has been reported on the error channel",group:"Events",type:"signal",displayName:"Failure"},error:{description:"Why the last query failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}},prototypeExtensions:{setCollectionName:function(e){this._internal.name=e,this.flagOutputDirty("id")},setCollection:function(e){this.bindCollection(e),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("items"),this.flagOutputDirty("count")},unbindCurrentCollection:function(){var e=this._internal.collection;e&&(e.off("change",this._internal.collectionChangedCallback),this._internal.collection=void 0)},bindCollection:function(e){this.unbindCurrentCollection(),this._internal.collection=e,e&&e.on("change",this._internal.collectionChangedCallback)},_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection()},setError:function(e){this._internal.err=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.raiseRuntimeError("query-records/query-failed",e)},fetch:function(){var e=this,t=this._internal;this.context.editorConnection&&(void 0===this._internal.name?this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"query-collection",{message:"No collection specified for query"}):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"query-collection")),t.fetchScheduled||(t.fetchScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){t.fetchScheduled=!1;var n=a().get(),i=e.getStorageFilter();r().instance.query({collection:e._internal.name,where:i.where,sort:i.sort,limit:e.getStorageLimit(),skip:e.getStorageSkip(),success:function(t){void 0!==t&&n.set(t.map(function(t){var i=r()._fromJSON(t,e._internal.name);return i.on("delete",function(){return n.remove(i)}),i})),e.setCollection(n),e.sendSignalOnOutput("fetched")},error:function(t){e.setCollection(n),e.setError(t||"Failed to fetch.")}})}))},getStorageFilter:function(){var e=this._internal.storageSettings;if(void 0===e.storageFilterType||"simple"===e.storageFilterType){var t=void 0,n=void 0;if(e.storageFilter){var i=e.storageFilter.split(","),o=[];i.forEach(function(t){var n={},i="$"+(e["storageFilterOp-"+t]||"eq");n[t]={},n[t][i]=e["storageFilterValue-"+t],o.push(n)}),t=o.length>1?{$and:o}:o[0]}if(e.storageSort){var r=e.storageSort.split(","),s=[];r.forEach(function(t){s.push(("descending"===e["storageSort-"+t]?"-":"")+t)}),n=s}return{where:t,sort:n}}if("json"===e.storageFilterType){if(!this._internal.filterFunc)try{var a=e.storageJSONFilter;a=a.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""),this._internal.filterVariables=a.match(/\$[A-Za-z0-9]+/g)||[];var l=["filter","where","sort","Inputs"].concat(this._internal.filterVariables).concat([a]);this._internal.filterFunc=Function.apply(null,l)}catch(e){this._internal.filterFunc=void 0,console.log("Error while parsing filter script: "+e)}if(!this._internal.filterFunc)return;var u={},c=[],d=this,h=function(e){u=p(e,{collectionName:d._internal.name,error:function(e){d.context.editorConnection.sendWarning(d.nodeScope.componentOwner.name,d.id,"query-collection-filter",{message:e})}})},f={};for(var g in e)g.startsWith("storageFilterValue-")&&(f[g.substring(19)]=e[g]);var m=[h,h,function(e){c=e},f];this._internal.filterVariables.forEach(function(t){m.push(e["storageFilterValue-"+t.substring(1)])});try{this._internal.filterFunc.apply(this,m)}catch(e){console.log("Error while running filter script: "+e)}return{where:u,sort:c}}},getStorageLimit:function(){var e=this._internal.storageSettings;return e.storageEnableLimit?e.storageLimit||10:void 0},getStorageSkip:function(){var e=this._internal.storageSettings;return e.storageEnableLimit?e.storageSkip||0:void 0},registerOutputIfNeeded:function(e){this.hasOutput(e)||this.registerOutput(e,{getter:h.bind(this,e)})},registerInputIfNeeded:function(e){if(!this.hasInput(e)){var t={storageFetch:this.fetch.bind(this)};if(t[e])return this.registerInput(e,{set:i.EdgeTriggeredInput.createSetter({valueChangedToTrue:t[e]})});var n={collectionName:this.setCollectionName.bind(this)};if(n[e])return this.registerInput(e,{set:n[e]});this.registerInput(e,{set:f.bind(this,e)})}}}},setup:function(e,t){var n=e.editorConnection;function i(e){g(e.id,e.parameters,n,t.getMetaData("dbCollections")),e.on("parameterUpdated",function(i){i.name.startsWith("storage")&&g(e.id,e.parameters,n,t.getMetaData("dbCollections"))}),t.on("metadataChanged.dbCollections",function(t){r().invalidateCollections(),g(e.id,e.parameters,n,t)}),t.on("metadataChanged.cloudservices",function(){r().instance._initCloudServices()})}n&&n.isRunningLocally()&&t.on("editorImportComplete",function(){t.on("nodeAdded.DbCollection",function(e){i(e)});for(var e=0,n=t.getNodesWithType("DbCollection");e<n.length;e++)i(n[e])})}};n.d(t,["default",0,m])},6196(e,t,n){"use strict";n.r(t);var i=n(412),o=n.n(i),r=n(3538),s=n(7011),a=n.n(s),l=n(6835),u=n.n(l),c={},d={},p="record/storage-op-failed";function h(e){return this._internal.model?this._internal.model.get(e,{resolve:!0}):void 0}function f(e,t){this._internal.inputValues[e]=t}function g(e,t,n,i){var o,r=[],s=t.properties;if(s){var a=s.split(",");for(var l in a){var u=a[l];r.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:u}),r.push({type:"signal",plug:"output",group:"Events",displayName:"Changed "+u,name:"changed-"+u})}var p=function(e,t){if(e&&t&&e.length===t.length){for(var n={},i=0;i<e.length;i++){if(-1===t.indexOf(e[i])){if(n.before)return;n.before=e[i]}if(-1===e.indexOf(t[i])){if(n.after)return;n.after=t[i]}}return n.before&&n.after?n:void 0}}(d[e],a);d[e]=a,p&&(o={plug:"input/output",patterns:["{{*}}"],before:p.before,after:p.after})}if(r.push({name:"$ndlCollectionName",displayName:"Class",group:"General",type:{name:"enum",enums:void 0!==i?i.map(function(e){return{value:e.name,label:e.name}}):[],allowEditOnly:!0},plug:"input"}),t.$ndlCollectionName&&i){var h=i.find(function(e){return e.name===t.$ndlCollectionName});if(h&&h.schema&&h.schema.properties){var f=h.schema.properties,g=function(e){var t=f[e];if(r.find(function(t){return t.name===e}))return"continue";"Relation"===t.type?(r.push({type:"signal",plug:"input",group:e+" Relation",name:"$relation-add-"+e,displayName:"Add",editorName:e+" | Add"}),r.push({type:"signal",plug:"input",group:e+" Relation",name:"$relation-remove-"+e,displayName:"Remove",editorName:e+" | Remove"}),r.push({type:{name:"string",allowConnectionsOnly:!0},plug:"input",group:e+" Relation",name:"$relation-modelid-"+e,displayName:"Model Id",editorName:e+" | Model Id"}),r.push({type:"signal",plug:"output",group:e+" Relation",name:"$relation-removed-"+e,displayName:"Removed",editorName:e+" | Removed"}),r.push({type:"signal",plug:"output",group:e+" Relation",name:"$relation-added-"+e,displayName:"Added",editorName:e+" | Added"})):(r.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:e}),r.push({type:"signal",plug:"output",group:"Events",displayName:"Changed "+e,name:"changed-"+e}))};for(var m in f)g(m)}}r.push({name:"$ndlModelInitCode",displayName:"Initialize",group:"Scripts",type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},default:"initialize({\n\t// Here you can initialize new models\n\t//myProperty:'Some init value',\n\t//anotherProperty:function() { return 'Some other value' }\n})\n",plug:"input"});var y=JSON.stringify(r);c[e]!==y&&(c[e]=y,n.sendDynamicPorts(e,r,{renamed:o}))}const m={node:{name:"DbModel",docs:"https://docs.noodl.net/nodes/cloud-services/model",displayNodeName:"Model",category:"Cloud Services",usePortAsLabel:"$ndlCollectionName",color:"data",deprecated:!0,replacedBy:"DbModel2",initialize:function(){var e=this._internal;e.inputValues={},e.relationModelIds={};var t=this;this._internal.onModelChangedCallback=function(e){t.isInputConnected("fetch")||(t.hasOutput(e.name)&&t.flagOutputDirty(e.name),t.hasOutput("changed-"+e.name)&&t.sendSignalOnOutput("changed-"+e.name),t.sendSignalOnOutput("changed"))}},getInspectInfo:function(){var e=this._internal.model;return e?[{type:"text",value:"Id: "+e.getId()},{type:"value",value:e.data}]:"[No Model]"},outputs:{id:{description:"Id of the record this node is bound to, whether or not it has been read yet",type:"string",displayName:"Id",group:"General",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}},saved:{description:"Fires once the record has been written to the backend",type:"signal",displayName:"Saved",group:"Events"},stored:{description:"Fires once the property inputs have been copied onto the record held in memory",type:"signal",displayName:"Stored",group:"Events"},created:{description:"Fires once a new record has been created in the backend",type:"signal",displayName:"Created",group:"Events"},fetched:{description:"Fires once the record has been read and the property outputs are up to date",type:"signal",displayName:"Fetched",group:"Events"},changed:{description:"Fires when a property of the bound record changes, including a change another node made",type:"signal",displayName:"Changed",group:"Events"},deleted:{description:"Fires once the record has been deleted from the backend",type:"signal",displayName:"Deleted",group:"Events"},failure:{description:"Fires when the last action could not be completed, after the reason has been reported on the error channel",type:"signal",displayName:"Failure",group:"Events"},error:{description:"Why the last action failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}},inputs:{modelId:{description:"Id of the record to read and write",type:{name:"string",allowConnectionsOnly:!0},displayName:"Id",group:"General",set:function(e){var t=e instanceof u()?e.getId():e;this._internal.modelId=t,!1===this.isInputConnected("fetch")?this.setModelID(t):this.flagOutputDirty("id")}},properties:{description:"Names of the record properties to expose, each of which becomes an input and an output port",type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",set:function(){}},fetch:{description:"Re-reads the record from the backend, replacing the copy held in memory",displayName:"Fetch",group:"Actions",valueChangedToTrue:function(){this.scheduleFetch()}},store:{description:"Copies the property inputs onto the record held in memory without saving it",displayName:"Set",group:"Actions",valueChangedToTrue:function(){this.scheduleStore()}},save:{description:"Writes the record's current values to the backend",displayName:"Save",group:"Actions",valueChangedToTrue:function(){this.storageSave()}},delete:{description:"Deletes the record from the backend",displayName:"Delete",group:"Actions",valueChangedToTrue:function(){this.storageDelete()}},new:{description:"Creates a record in memory from the property inputs, without saving it",displayName:"New",group:"Actions",valueChangedToTrue:function(){this.storageNew()}},insert:{description:"Creates the record in the backend from the property inputs",displayName:"Insert",group:"Actions",valueChangedToTrue:function(){this.storageInsert()}}},methods:{setCollectionID:function(e){this._internal.collectionId=e,this.clearWarnings()},setModelID:function(e){var t=u().get(e);this.setModel(t)},setModel:function(e){for(var t in this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),this._internal.model=e,this.flagOutputDirty("id"),e.on("change",this._internal.onModelChangedCallback),e.data)this.hasOutput(t)&&this.flagOutputDirty(t);this.sendSignalOnOutput("fetched")},_onNodeDeleted:function(){r.Node.prototype._onNodeDeleted.call(this),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},scheduleOnce:function(e,t){var n=this,i="hasScheduled"+e;this._internal[i]||(this._internal[i]=!0,this.scheduleAfterInputsHaveUpdated(function(){n._internal[i]=!1,t()}))},_hasChangesPending:function(){var e=this._internal,t=e.model;for(var n in e.inputValues)if(o()(t.data[n],e.inputValues[n]))return!0;return!1},scheduleFetch:function(){var e=this,t=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("Fetch",function(){void 0!==t.modelId&&""!==t.modelId&&a().instance.fetch({collection:t.collectionId,objectId:t.modelId,success:function(n){var i=a()._fromJSON(n,t.collectionId);for(var o in t.model!==i&&(t.model&&t.model.off("change",t.onModelChangedCallback),t.model=i,i.on("change",t.onModelChangedCallback)),e.flagOutputDirty("id"),delete n.objectId,n)e.hasOutput(o)&&e.flagOutputDirty(o);e.sendSignalOnOutput("fetched")},error:function(t){e.setError(t||"Failed to fetch.")}})})},scheduleStore:function(){var e=this,t=this._internal;t.model&&this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("Store",function(){for(var n in t.inputValues)t.model.set(n,t.inputValues[n],{resolve:!0});e.sendSignalOnOutput("stored")})},storageNew:function(){var e=this,t=this._internal;this.scheduleOnce("StorageNew",function(){var n=u().get();for(var i in t.inputValues)n.set(i,t.inputValues[i],{resolve:!0});e.setModel(n),e.sendSignalOnOutput("created"),e.sendSignalOnOutput("stored")})},storageSave:function(){var e=this,t=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("StorageSave",function(){if(t.model){var n=t.model;for(var i in t.inputValues)n.set(i,t.inputValues[i],{resolve:!0});a().instance.save({collection:t.collectionId,objectId:n.getId(),data:n.data,success:function(t){for(var i in t)n.set(i,t[i]);e.sendSignalOnOutput("saved")},error:function(t){e.setError(t||"Failed to save.")}})}})},storageDelete:function(){var e=this;if(this._internal.model){var t=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("StorageDelete",function(){a().instance.delete({collection:t.collectionId,objectId:t.model.getId(),success:function(){t.model.notify("delete"),e.sendSignalOnOutput("deleted")},error:function(t){e.setError(t||"Failed to delete.")}})})}},storageInsert:function(){var e=this,t=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("StorageInsert",function(){var n=e._getModelInitData();a().instance.create({collection:t.collectionId,data:n,success:function(n){var i=a()._fromJSON(n,t.collectionId);e.setModel(i),e.sendSignalOnOutput("created"),e.sendSignalOnOutput("saved")},error:function(t){e.setError(t||"Failed to insert.")}})})},checkWarningsBeforeCloudOp:function(){return this.clearWarnings(),!!this._internal.collectionId||(this.setError("No collection name specified"),!1)},setError:function(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.raiseRuntimeError(p,e)},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,p),this.context.editorConnection.clearWarning(e,this.id,"storage-op-warning")}},onRelationAdd:function(e){var t=this,n=this._internal;this.scheduleOnce("StorageAddRelation",function(){if(n.model){var i=n.model,o=n.relationModelIds[e];void 0!==o&&a().instance.addRelation({collection:n.collectionId,objectId:i.getId(),key:e,targetObjectId:o,targetClass:u().get(o)._class,success:function(n){for(var o in n)i.set(o,n[o]);t.sendSignalOnOutput("$relation-added-"+e)},error:function(e){t.setError(e||"Failed to add relation.")}})}})},onRelationRemove:function(e){var t=this,n=this._internal;this.scheduleOnce("StorageRemoveRelation",function(){if(n.model){var i=n.model,o=n.relationModelIds[e];void 0!==o&&a().instance.removeRelation({collection:n.collectionId,objectId:i.getId(),key:e,targetObjectId:o,targetClass:u().get(o)._class,success:function(n){for(var o in n)i.set(o,n[o]);t.sendSignalOnOutput("$relation-removed-"+e)},error:function(e){t.setError(e||"Failed to remove relation.")}})}})},setRelationModelId:function(e,t){this._internal.relationModelIds[e]=t},registerOutputIfNeeded:function(e){if(!this.hasOutput(e))return e.startsWith("$relation-added-")||e.startsWith("$relation-removed-")?this.registerOutput(e,{getter:function(){}}):void this.registerOutput(e,{getter:h.bind(this,e)})},_getModelInitData:function(){var e=this._internal,t={};for(var n in e.inputValues)t[n]=e.inputValues[n];if(this._internal.modelInitCode)try{new Function("initialize",this._internal.modelInitCode)(function(e){for(var n in e)"function"==typeof e[n]?t[n]=e[n]():t[n]=e[n]})}catch(e){console.log("Error while initializing model: "+e)}return t},setModelInitCode:function(e){this._internal.modelInitCode=e},registerInputIfNeeded:function(e){if(!this.hasInput(e)){if(e.startsWith("$relation-add-"))return this.registerInput(e,{set:r.EdgeTriggeredInput.createSetter({valueChangedToTrue:this.onRelationAdd.bind(this,e.substring(14))})});if(e.startsWith("$relation-remove-"))return this.registerInput(e,{set:r.EdgeTriggeredInput.createSetter({valueChangedToTrue:this.onRelationRemove.bind(this,e.substring(17))})});if(e.startsWith("$relation-modelid-"))return this.registerInput(e,{set:this.setRelationModelId.bind(this,e.substring(18))});var t={};if(t[e])return this.registerInput(e,{set:r.EdgeTriggeredInput.createSetter({valueChangedToTrue:t[e]})});var n={$ndlCollectionName:this.setCollectionID.bind(this),$ndlModelInitCode:this.setModelInitCode.bind(this)};if(n[e])return this.registerInput(e,{set:n[e]});this.registerInput(e,{set:f.bind(this,e)})}}}},setup:function(e,t){var n=e.editorConnection;function i(e){g(e.id,e.parameters,n,t.getMetaData("dbCollections")),e.on("parameterUpdated",function(){g(e.id,e.parameters,n,t.getMetaData("dbCollections"))}),t.on("metadataChanged.dbCollections",function(t){a().invalidateCollections(),g(e.id,e.parameters,n,t)})}n&&n.isRunningLocally()&&t.on("editorImportComplete",function(){t.on("nodeAdded.DbModel",function(e){i(e)});for(var e=0,n=t.getNodesWithType("DbModel");e<n.length;e++)i(n[e])})}};n.d(t,["default",0,m])},7646(e,t,n){"use strict";n.r(t);var i=n(3538),o=n(6835),r=n.n(o);function s(e){return this._internal.model?this._internal.model.get(e,{resolve:!0}):void 0}function a(e,t){if(this._internal.inputValues[e]=t,!1===this.isInputConnected("store")&&!1===this.isInputConnected("new")){var n=this._internal.model;(!n||n.get(e)!==t)&&this.scheduleStore()}}function l(e,t,n){var i=[],o=t.properties;if(o){var r=o.split(",");for(var s in r){var a=r[s];i.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:a}),i.push({type:"signal",plug:"output",group:"Events",displayName:a+" Changed",name:"changed-"+a})}}n.sendDynamicPorts(e,i,{detectRenamed:{plug:"input/output"}})}const u={node:{name:"Model",docs:"https://docs.noodl.net/nodes/data/object",displayNodeName:"Object",category:"Data",usePortAsLabel:"modelId",color:"data",deprecated:!0,replacedBy:"Model2",initialize:function(){this._internal.inputValues={};var e=this;this._internal.onModelChangedCallback=function(t){!0!==e.isInputConnected("fetch")&&(e.hasOutput(t.name)&&e.flagOutputDirty(t.name),e.hasOutput("changed-"+t.name)&&e.sendSignalOnOutput("changed-"+t.name),e.sendSignalOnOutput("changed"))}},getInspectInfo:function(){var e=this._internal.model;if(!e)return"[No Object]";var t=[{type:"text",value:"Id: "+e.getId()}],n=this._internal.model.data;return t.concat(Object.keys(n).map(function(e){return{type:"text",value:e+": "+n[e]}}))},outputs:{id:{type:"string",displayName:"Id",group:"General",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}},stored:{type:"signal",displayName:"Stored",group:"Events"},changed:{type:"signal",displayName:"Changed",group:"Events"},fetched:{type:"signal",displayName:"Fetched",group:"Events"},created:{type:"signal",displayName:"Created",group:"Events"}},inputs:{modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",set:function(e){var t=e instanceof r()?e.getId():e;this._internal.modelId=t,!1===this.isInputConnected("fetch")?this.setModelID(t):this.flagOutputDirty("id")}},properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",set:function(){}},new:{displayName:"New",group:"Actions",valueChangedToTrue:function(){this.scheduleNew()}},store:{displayName:"Set",group:"Actions",valueChangedToTrue:function(){this.scheduleStore()}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue:function(){this.scheduleSetModel()}},clear:{displayName:"Clear",group:"Actions",valueChangedToTrue:function(){var e=this._internal;if(e.model)for(var t in e.inputValues)e.model.set(t,void 0,{resolve:!0})}}},prototypeExtensions:{scheduleStore:function(){var e=this;if(!this.hasScheduledStore){this.hasScheduledStore=!0;var t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){if(e.hasScheduledStore=!1,t.model){for(var n in t.inputValues)t.model.set(n,t.inputValues[n],{resolve:!0});e.sendSignalOnOutput("stored")}})}},scheduleNew:function(){var e=this;if(!this.hasScheduledNew){this.hasScheduledNew=!0;var t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){e.hasScheduledNew=!1;var n=r().get();for(var i in t.inputValues)n.set(i,t.inputValues[i],{resolve:!0});e.setModel(n),e.sendSignalOnOutput("created"),e.sendSignalOnOutput("stored")})}},scheduleSetModel:function(){var e=this;this.hasScheduledSetModel||(this.hasScheduledSetModel=!0,this.scheduleAfterInputsHaveUpdated(function(){e.hasScheduledSetModel=!1,e.setModelID(e._internal.modelId)}))},setModelID:function(e){var t=r().get(e);this.setModel(t),this.sendSignalOnOutput("fetched")},setModel:function(e){for(var t in this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),this._internal.model=e,this.flagOutputDirty("id"),e.on("change",this._internal.onModelChangedCallback),e.data)this.hasOutput(t)&&this.flagOutputDirty(t)},_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},registerOutputIfNeeded:function(e){this.hasOutput(e)||this.registerOutput(e,{getter:s.bind(this,e)})},registerInputIfNeeded:function(e){this.hasInput(e)||this.registerInput(e,{set:a.bind(this,e)})}}},setup:function(e,t){var n=e.editorConnection;n&&n.isRunningLocally()&&t.on("nodeAdded.Model",function(e){l(e.id,e.parameters,n),e.on("parameterUpdated",function(){l(e.id,e.parameters,n)})})}};n.d(t,["default",0,u])},7123(e,t,n){"use strict";n.r(t);var i=n(3538),o=n(6835),r=n.n(o);const s={node:{name:"Variable",docs:"https://docs.noodl.net/nodes/data/variable",category:"Data",usePortAsLabel:"name",color:"data",deprecated:!0,replacedBy:"Variable2",initialize:function(){var e=this,t=this._internal;this._internal.onModelChangedCallback=function(n){e.isInputConnected("fetch")||n.name!==t.name||(e.sendSignalOnOutput("changed"),e.flagOutputDirty("value"))},t.variablesModel=r().get("--ndl--global-variables"),t.variablesModel.on("change",this._internal.onModelChangedCallback)},getInspectInfo:function(){return this._internal.name?[{type:"value",value:this._internal.variablesModel.get(this._internal.name)}]:"[No value set]"},outputs:{name:{type:"string",displayName:"Name",group:"General",getter:function(){return this._internal.name}},stored:{type:"signal",displayName:"Stored",group:"Events"},changed:{type:"signal",displayName:"Changed",group:"Events"},fetched:{type:"signal",displayName:"Fetched",group:"Events"},value:{type:"*",displayName:"Value",group:"General",getter:function(){var e=this._internal;if(e.name)return e.variablesModel.get(e.name)}}},inputs:{name:{type:{name:"string",identifierOf:"VariableName",identifierDisplayName:"Variable names"},displayName:"Name",group:"General",set:function(e){!1===this.isInputConnected("fetch")?this.setVariableName(e):(this._internal.name=e,this.flagOutputDirty("name"))}},store:{displayName:"Set",group:"Actions",valueChangedToTrue:function(){this.scheduleStore()}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue:function(){this.setVariableName(this._internal.name)}},value:{type:"*",displayName:"Value",group:"General",set:function(e){this._internal.value=e,!1===this.isInputConnected("store")&&this.scheduleStore()}}},prototypeExtensions:{scheduleStore:function(){if(!this.hasScheduledStore){this.hasScheduledStore=!0;var e=this._internal;this.scheduleAfterInputsHaveUpdated(function(){this.hasScheduledStore=!1,e.variablesModel.set(e.name,e.value),this.sendSignalOnOutput("stored")})}},setVariableName:function(e){this._internal.name=e,this.flagOutputDirty("name"),this.flagOutputDirty("value"),this.sendSignalOnOutput("fetched")},_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this),this._internal.variablesModel.off("change",this._internal.onModelChangedCallback)}}}};n.d(t,["default",0,s])},8338(e,t,n){"use strict";n.r(t);var i=n(3538);const o={node:{name:"Globals",category:"Utilities",color:"component",deprecated:!0,initialize:function(){this._internal.listeners=[]},panels:[{name:"PortEditor",context:["select","connectTo","connectFrom"],title:"Globals",plug:"input/output",type:{name:"*"}}],prototypeExtensions:{_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this);for(var e=this.context.globalsEventEmitter,t=0;t<this._internal.listeners.length;t++){var n=this._internal.listeners[t];e.removeListener(n.name,n.listener)}this._internal.listeners=[]},_newOutputValueReceived:{value:function(e){this.flagOutputDirty(e)}},registerInputIfNeeded:{value:function(e){this.hasInput(e)||this.registerInput(e,{set:this.context.setGlobalValue.bind(this.context,e)})}},registerOutputIfNeeded:{value:function(e){if(!this.hasOutput(e)){var t=this._newOutputValueReceived.bind(this,e),n=this.context.globalsEventEmitter;this._internal.listeners.push({name:e,listener:t}),n.on(e,t),this.registerOutput(e,{getter:function(){return this.context.globalValues[e]}})}}}}}};n.d(t,["default",0,o])},4959(e,t,n){"use strict";function i(e){e.alpha!==this._internal.alpha&&(this._internal.alpha=e.alpha,this.flagOutputDirty("rotationZ")),e.beta!==this._internal.beta&&(this._internal.beta=e.beta,this.flagOutputDirty("rotationX")),e.gamma!==this._internal.gamma&&(this._internal.gamma=e.gamma,this.flagOutputDirty("rotationY"))}n.r(t);const o={node:{name:"Gyroscope",docs:"https://docs.noodl.net/nodes/sensors/device-orientation",displayNodeName:"Device Orientation",category:"Sensors",deprecated:!0,ssr:{compat:"client-only",note:"Device sensors only exist in the browser."},initialize:function(){this._internal.alpha=0,this._internal.beta=0,this._internal.gamma=0;var e=i.bind(this);window.addEventListener("deviceorientation",e),this.context.eventEmitter.once("applicationDataReloaded",function(){window.removeEventListener("deviceorientation",e)})},outputs:{rotationX:{group:"Values",type:"number",displayName:"Rotation X",description:"Front-to-back tilt in degrees; it never updates on iOS, which requires a permission this node does not request",getter:function(){return-this._internal.beta}},rotationY:{group:"Values",type:"number",displayName:"Rotation Y",description:"Left-to-right tilt in degrees; it never updates on iOS, which requires a permission this node does not request",getter:function(){return this._internal.gamma}},rotationZ:{group:"Values",type:"number",displayName:"Rotation Z",description:"Compass heading in degrees; it never updates on iOS, which requires a permission this node does not request",getter:function(){return-this._internal.alpha}}}}};n.d(t,["default",0,o])},1270(e,t,n){"use strict";n.r(t);var i=n(4038);const o={node:{name:"Number Blend",docs:"https://docs.noodl.net/nodes/interpolation/number-blend",category:"Interpolation",deprecated:!0,initialize:function(){var e=this._internal;e.inputs=[],e.blendValue=0,e.result=0,e.clamp=!1},getInspectInfo:function(){return[{type:"value",value:this._internal.result}]},prototypeExtensions:{updateResult:function(){var e=this._internal.inputs;if(0===e.length)return 0;var t=Math.floor(this._internal.blendValue),n=this._internal.blendValue-t;t>=e.length-1?this._internal.clamp?(t=e.length-1,n=0):(n+=t-(e.length-1),t=e.length-1):t<=0&&(this._internal.clamp?(t=0,n=0):(n+=t,t=0)),0===n||1===e.length?this._internal.result=e[t]:t===e.length-1&&n>0?this._internal.result=i.A.linear(e[t-1],e[t],n+1):this._internal.result=i.A.linear(e[t],e[t+1],n),this.flagOutputDirty("result")}},numberedInputs:{input:{type:"number",displayPrefix:"Number",createSetter:function(e){return function(t){var n=this._internal.inputs;n[e]!==t&&(n[e]=t||0,this.updateResult())}}}},inputs:{blendValue:{group:"Values",type:"number",displayName:"Blend Value",description:"Position along the number list, where 1 is exactly Number 1 and 1.5 is halfway to Number 2",default:0,set:function(e){this._internal.blendValue=e,this.updateResult()}},clamp:{group:"Values",type:"boolean",displayName:"Clamp",description:"Holds Blend Value inside the list rather than extrapolating past either end",default:!1,set:function(e){this._internal.clamp=!!e,this.updateResult()}}},outputs:{result:{group:"Values",type:"number",displayName:"Result",description:"The interpolated number",getter:function(){return this._internal.result}}}}};n.d(t,["default",0,o])},7064(e,t,n){"use strict";n.r(t);var i=n(9405),o=n(3538),r=n(6835),s=n.n(r),a=n(1608),l=new i.EventEmitter;function u(e,t,n){var i=[],o=t.properties&&t.properties.split(",");for(var r in o){var s=o[r];i.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:s,displayName:s}),i.push({type:"signal",plug:"output",group:"Events",displayName:s+" Changed",name:"changed-"+s})}n.sendDynamicPorts(e,i,{detectRenamed:{plug:"input/output"}})}l.setMaxListeners(1e6);const c={node:{name:"Parent Component State",displayNodeName:"Parent Component Object",category:"Component Utilities",color:"component",docs:"https://docs.noodl.net/nodes/component-utilities/parent-component-object",deprecated:!0,replacedBy:"net.noodl.ParentComponentObject",initialize:function(){var e=this;this._internal.inputValues={},this._internal.onModelChangedCallback=function(t){!0!==e.isInputConnected("fetch")&&(e.hasOutput(t.name)&&e.flagOutputDirty(t.name),e.hasOutput("changed-"+t.name)&&e.sendSignalOnOutput("changed-"+t.name),e.sendSignalOnOutput("changed"))},this.onComponentStateNodesChanged=function(){var t=e.findParentComponentStateModelId();e._internal.modelId!==t&&(e._internal.modelId=t,!1===e.isInputConnected("fetch")&&e.setModelId(e._internal.modelId))},l.on("componentStateNodesChanged",this.onComponentStateNodesChanged),this.updateComponentState()},nodeScopeDidInitialize:function(){var e=this;this._internal.modelId||this.context.scheduleAfterUpdate(function(){e.updateComponentState()})},getInspectInfo:function(){if(!this._internal.model)return"No parent component state found";var e=[{type:"text",value:this._internal.parentComponentName}],t=this._internal.model.data;return e.concat(Object.keys(t).map(function(e){return{type:"text",value:e+": "+t[e]}}))},inputs:{properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",description:"Names of the parent values to expose, each becoming a matching input and output",set:function(){}},store:{displayName:"Set",group:"Actions",description:"Writes the supplied property values into the parent component object",valueChangedToTrue:function(){this.scheduleStore()}},fetch:{displayName:"Fetch",group:"Actions",description:"Republishes every property from the parent; connecting this stops the outputs updating on their own",valueChangedToTrue:function(){this.setModelId(this._internal.modelId)}}},outputs:{changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires when a property on the resolved parent is written, unless Fetch is connected"},fetched:{type:"signal",displayName:"Fetched",group:"Events",description:"Fires once Fetch has republished every property"},stored:{type:"signal",displayName:"Stored",group:"Events",description:"Fires once Set has written every property"}},methods:{updateComponentState:function(){this._internal.modelId=this.findParentComponentStateModelId(),!1===this.isInputConnected("fetch")&&this.setModelId(this._internal.modelId)},findParentComponentStateModelId:function(){var e=(0,a.f4)(this.nodeScope.componentOwner,["Component State"]);if(e)return this._internal.parentComponentName=e.name,"componentState"+e.getInstanceId()},setModelId:function(e){if(this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),this._internal.model=void 0,e){var t=s().get(e);for(var n in this._internal.model=t,t.on("change",this._internal.onModelChangedCallback),t.data)this.hasOutput(n)&&this.flagOutputDirty(n),this.hasOutput("changed-"+n)&&this.sendSignalOnOutput("changed-"+n);this.sendSignalOnOutput("changed"),this.sendSignalOnOutput("fetched")}},scheduleStore:function(){var e=this;if(!this.hasScheduledStore){this.hasScheduledStore=!0;var t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){if(e.hasScheduledStore=!1,t.model){for(var n in t.inputValues)t.model.set(n,t.inputValues[n],{resolve:!0});e.sendSignalOnOutput("stored")}})}},_onNodeDeleted:function(){o.Node.prototype._onNodeDeleted.call(this),l.off("componentStateNodesChanged",this.onComponentStateNodesChanged),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},registerOutputIfNeeded:function(e){this.hasOutput(e)||this.registerOutput(e,{get:function(){if(this._internal.model)return this._internal.model.get(e,{resolve:!0})}})},registerInputIfNeeded:function(e){this.hasInput(e)||this.registerInput(e,{set:function(t){this._internal.inputValues[e]=t,!1===this.isInputConnected("store")&&this.scheduleStore()}})}}},setup:function(e,t){var n=e.editorConnection;n&&n.isRunningLocally()&&(t.on("nodeAdded.Parent Component State",function(e){u(e.id,e.parameters,n),e.on("parameterUpdated",function(){u(e.id,e.parameters,n)})}),t.on("nodeAdded.Component State",function(){setTimeout(function(){l.emit("componentStateNodesChanged")},0)}),t.on("nodeRemoved.Component State",function(){setTimeout(function(){l.emit("componentStateNodesChanged")})}))}};n.d(t,["default",0,c])},568(e,t,n){"use strict";n.r(t);const i={node:{name:"Script Downloader",docs:"https://docs.noodl.net/nodes/javascript/script-downloader",category:"Javascript",color:"javascript",deprecated:!0,ssr:{compat:"client-only",note:"Scripts are injected into the browser DOM; they load after hydration."},initialize:function(){var e=this._internal;e.loaded=!1,e.scripts=[],e.loadedScripts={},e.startLoad=!0},inputs:{startLoad:{type:"boolean",default:!0,displayName:"Load on start",description:"Whether the scripts are fetched as soon as the node appears, rather than waiting for Load",group:"General",set:function(e){this._internal.startLoad=e}},load:{displayName:"Load",description:"Fetches every script that is not already in the page",group:"Actions",valueChangedToTrue:function(){this.scheduleUpdateScripts()}}},outputs:{loaded:{group:"Events",type:"signal",displayName:"Loaded",description:"Fires once every script has finished loading; a script that fails to load reports nothing and this never fires"}},numberedInputs:{input:{displayPrefix:"Script",group:"External scripts",type:"string",index:3008,createSetter:function(e){return function(t){this._internal.scripts[e]=String(t),this._internal.loadStarted||(this._internal.loadStarted=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.loadStarted=!1,this._internal.startLoad&&this.updateScripts()}))}}}},methods:{removeLoadTerminator:function(){var e="sentinel_"+this.id,t=document.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)},scheduleUpdateScripts:function(){var e=this;this._internal.updateScriptsScheduled||(this._internal.updateScriptsScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e._internal.updateScriptsScheduled=!1,e.updateScripts()}))},updateScripts:function(){var e="sentinel_"+this.id;this.removeLoadTerminator();var t=this._internal.scripts;t=t.filter(function(e){return""!==e});for(var n=document.head.getElementsByTagName("script"),i={},o=0;o<n.length;o++){var r=n[o];void 0!==r.src&&""!==r.src&&(i[r.src]=r)}for(o=0;o<t.length;o++){var s=t[o].trim();if(!this._internal.loadedScripts.hasOwnProperty(s)){if(i.hasOwnProperty(s))continue;var a=document.createElement("script");a.src=s,a.async=!1,document.head.appendChild(a)}}var l=this,u=document.createElement("script");u.onload=u.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(l._internal.loaded=!0,l.sendSignalOnOutput("loaded"),l.removeLoadTerminator())},u.id=e,u.src="load_terminator.js",u.async=!1,document.head.appendChild(u)}}},setup:function(e){e.editorConnection&&e.editorConnection.isRunningLocally()}};n.d(t,["default",0,i])},6825(e,t,n){"use strict";n.r(t);var i=n(3538);const o={node:{name:"Signal To Index",docs:"https://docs.noodl.net/nodes/logic/signal-to-index",category:"Logic",deprecated:!0,initialize:function(){this._internal.currentIndex=0},getInspectInfo:function(){return"Index: "+this._internal.currentIndex},numberedInputs:{input:{type:"boolean",displayPrefix:"Signal",createSetter:function(e){return i.EdgeTriggeredInput.createSetter({valueChangedToTrue:this.onValueChangedToTrue.bind(this,e)})},selectors:{startIndex:{displayName:"Start Index",set:function(e){this._internal.currentIndex=e,this.flagOutputDirty("index")}}}}},outputs:{index:{group:"Values",displayName:"Index",type:"number",description:"Number of the signal input that last fired, counting from zero",getter:function(){return this._internal.currentIndex}},signalTriggered:{group:"Events",displayName:"Signal Triggered",type:"signal",description:"Fires when any signal input fires, once Index holds the number of the input that fired"}},prototypeExtensions:{onValueChangedToTrue:function(e){this._internal.currentIndex!==e&&(this._internal.currentIndex=e,this.flagOutputDirty("index")),this.sendSignalOnOutput("signalTriggered")}}}};n.d(t,["default",0,o])},9472(e,t,n){"use strict";n.r(t);const i={node:{name:"String Selector",displayNodeName:"Index To String",category:"Utilities",deprecated:!0,initialize:function(){this._internal.inputs=[],this._internal.currentSelectedIndex=0,this._internal.indexChanged=!1},getInspectInfo:function(){return this._internal.inputs[this._internal.currentSelectedIndex]},numberedInputs:{input:{type:"string",displayPrefix:"String for ",group:"Inputs",createSetter:function(e){return function(t){var n=t?String(t):"";this._internal.inputs[e]=n,this._internal.currentSelectedIndex===e&&this.flagOutputDirty("currentValue")}}}},inputs:{index:{group:"Values",type:{name:"number"},displayName:"Index",default:0,description:"Which of the numbered strings to publish, counting from zero and truncated to a whole number",set:function(e){e|=0,this._internal.currentSelectedIndex=e,this.flagOutputDirty("currentValue"),this.sendSignalOnOutput("indexChanged")}}},outputs:{currentValue:{type:"string",displayName:"Current Value",group:"Values",description:"The numbered string sitting at Index, or nothing when there is none",getter:function(){return this._internal.inputs[this._internal.currentSelectedIndex]}},indexChanged:{type:"signal",displayName:"Index Changed",group:"Events",description:"Fires when Index changes, after Current Value has been updated"}}}};n.d(t,["default",0,i])},4111(e,t,n){"use strict";n.r(t);var i=n(4038);function o(e){var t=this._internal._animation;t.stop(),t.startValue=e,this.scheduleAfterInputsHaveUpdated(function(){t.endValue!==e&&t.start()}),this._internal.currentNumber=e,this.flagOutputDirty("currentValue")}const r={node:{name:"Transition",docs:"https://docs.noodl.net/nodes/animation/transition",category:"Animation",deprecated:!0,ssr:{compat:"partial",note:"The scheduler clock is frozen during server render; the transition does not animate or complete there."},initialize:function(){var e=this,t=this,n=this._internal;n.currentNumber=0,n.numberInitialized=!1,n.animationStarted=!1,n.setCurrentNumberEnabled=!1,n.overrideValue=0,n._animation=this.context.timerScheduler.createTimer({duration:300,startValue:0,endValue:0,ease:i.A.easeOut,onStart:function(){n.animationStarted=!0},onRunning:function(e){n.currentNumber=this.ease(this.startValue,this.endValue,e),t.flagOutputDirty("currentValue")},onFinish:function(){t.sendSignalOnOutput("atTargetValue")}}),this.addDeleteListener(function(){e._internal._animation.stop()})},inputs:{targetValue:{type:{name:"number"},displayName:"Target Value",group:"Target Value",description:"Value to move towards; the first one to arrive is adopted outright rather than animated to",default:void 0,set:function(e){var t;if(t=!0===e?1:!1===e?0:Number(e),!isNaN(t)){var n=this._internal;if(!1===n.numberInitialized)return n.currentNumber=t,n.numberInitialized=!0,n._animation.endValue=t,void this.flagOutputDirty("currentValue");t!==n._animation.endValue&&(n._animation.startValue=n.currentNumber,n._animation.endValue=t,n._animation.start())}}},"overrideCurrentValue.value":{type:{name:"number"},group:"Override Value",displayName:"Override Value",description:"Value to jump straight to when Do fires, without animating",editorName:"Value|Override Value",set:function(e){this._internal.overrideValue=e}},"overrideCurrentValue.do":{group:"Override Value",displayName:"Do",description:"Jumps Current Value to Override Value and carries on towards Target Value from there",editorName:"Do|Override Value",valueChangedToTrue:function(){o.call(this,this._internal.overrideValue)}},duration:{type:"number",group:"Parameters",displayName:"Duration",description:"How long the move takes, in milliseconds",default:300,set:function(e){this._internal._animation.duration=e}},delay:{type:"number",group:"Parameters",displayName:"Delay",description:"How long to wait before the move begins, in milliseconds",default:0,set:function(e){this._internal._animation.delay=e}},easingCurve:{type:{name:"enum",enums:[{value:"easeOut",label:"Ease Out"},{value:"easeIn",label:"Ease In"},{value:"linear",label:"Linear"},{value:"easeInOut",label:"Ease In Out"}]},default:"easeOut",displayName:"Easing Curve",group:"Parameters",description:"Shape of the movement between where the value is and Target Value",set:function(e){this._internal._animation.ease=i.A[e]}}},outputs:{currentValue:{type:"number",displayName:"Current Value",group:"Current State",description:"Where the move has got to, updated every frame while it runs",getter:function(){return this._internal.currentNumber}},atTargetValue:{type:"signal",displayName:"At Target Value",group:"Events",description:"Fires when the value settles on Target Value, and not at all if a new target interrupted it"}}}};n.d(t,["default",0,r])},1033(e,t,n){"use strict";n.r(t);var i=n(3538),o=n(1608),r=n(5162),s=n(9849),a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)},l=new s.ResolvedTargetReporter;const u={node:{name:"NavigationClosePopup",displayNodeName:"Close Popup",category:"Navigation",docs:"https://docs.noodl.net/nodes/popups/close-popup",initialize:function(){this._internal.resultValues={}},nodeScopeDidInitialize:function(){var e=this;this.context.scheduleAfterUpdate(function(){e.reportResolution()})},inputs:{targetComponent:{type:"component",displayName:"Popup",group:"General",description:"Which popup to close when popups are nested; leave blank to close the nearest enclosing one",set:function(e){this._internal.targetComponent=e||void 0,this.reportResolution()}},results:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Results",group:"Results",description:"Names of values to hand back to the Show Popup node that opened this popup, one input port each",set:function(e){this._internal.results=e}},closeActions:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Close Actions",group:"Close Actions",description:"Names of the ways this popup can be closed, one signal input each; the matching signal fires on the Show Popup node",set:function(e){this._internal.closeActions=e}},close:{type:"signal",displayName:"Close",group:"Actions",description:"Closes the popup and hands back any Results",valueChangedToTrue:function(){this.scheduleClose(this.beginOutcome())}}},outputs:a(a({},(0,r.outcomeOutputs)({done:"Fires once the popup has been closed and any Results have been handed back",failure:"Fires when this node is not inside an open popup, or Popup names one it is not inside"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Why the popup was not closed, set just before Failure fires",getter:function(){return this._internal.lastError}}}),methods:{setResultValue:function(e,t){this._internal.resultValues[e]=t},_setCloseCallback:function(e){this._internal.closeCallback=e,this.reportResolution()},_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this),l.forget(this)},scheduleClose:function(e){var t=this,n=this._internal;e&&(n.pendingCloseOutcomes||(n.pendingCloseOutcomes=[]),n.pendingCloseOutcomes.push(e)),n.hasScheduledClose||(n.hasScheduledClose=!0,this.scheduleAfterInputsHaveUpdated(function(){n.hasScheduledClose=!1,t.close()}))},resolvePopup:function(){var e=function(e){for(var t=[],n=e,i=0;n&&i<100;i++){for(var r=[n].concat((0,o.KX)(n)),s=-1,a=0;a<r.length&&-1===s;a++)r[a].popupParent&&(s=a);if(-1===s)return t.concat(r);t=t.concat(r.slice(0,s+1)),n=r[s].popupParent}return t}(this.nodeScope&&this.nodeScope.componentOwner).filter(function(e){return"function"==typeof e._popupCloseHandler}),t=e.map(function(e){return e.name}),n=this._internal.targetComponent;if(n){var i=e.find(function(e){return e.name===n});return i?{popup:i,close:i._popupCloseHandler,candidates:t}:{candidates:t,missCode:"close-popup/target-not-found",missMessage:'This node is not inside a popup named "'+n+'"'+(t.length?" — it is inside: "+t.join(", "):"")}}return this._internal.closeCallback?{popup:e[0],close:this._internal.closeCallback,candidates:t}:0===e.length?{candidates:t,missCode:"close-popup/no-popup-in-scope",missMessage:"No popup in scope to close — this node only works inside a component opened as a popup"}:{popup:e[0],close:e[0]._popupCloseHandler,candidates:t}},reportResolution:function(){var e=this.resolvePopup();l.report(this,e.popup?e.popup.name:void 0)},close:function(){var e=this._internal.closeAction;this._internal.closeAction=void 0;var t=this._internal.pendingCloseOutcomes||[];this._internal.pendingCloseOutcomes=void 0;var n=this.resolvePopup();if(l.report(this,n.popup?n.popup.name:void 0),!n.close)return this._internal.lastError=n.missMessage,this.flagOutputDirty("error"),void(0,r.reportOutcomes)(this,t,"failure",{code:n.missCode,message:n.missMessage,detail:{target:this._internal.targetComponent,popupsInScope:n.candidates}});n.close(e,this._internal.resultValues),(0,r.reportOutcomes)(this,t,"done")},closeActionTriggered:function(e){this._internal.closeAction=e,this.scheduleClose(this.beginOutcome())},registerInputIfNeeded:function(e){if(!this.hasInput(e))return e.startsWith("result-")?this.registerInput(e,{set:this.setResultValue.bind(this,e.substring(7))}):e.startsWith("closeAction-")?this.registerInput(e,{set:i.EdgeTriggeredInput.createSetter({valueChangedToTrue:this.closeActionTriggered.bind(this,e)})}):void 0}}},setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.NavigationClosePopup",function(e){i(e)});for(var e=0,n=t.getNodesWithType("NavigationClosePopup");e<n.length;e++)i(n[e])})}function i(e){function t(){var t=[],i=e.parameters.results;if(i){var o=i.split(",");for(var r in o){var s=o[r];t.push({type:{name:"*"},plug:"input",group:"Results",name:"result-"+s,displayName:s})}}var a=e.parameters.closeActions;if(a)for(var r in o=a.split(","))s=o[r],t.push({type:"signal",plug:"input",group:"Close Actions",name:"closeAction-"+s,displayName:s});n.sendDynamicPorts(e.id,t)}t(),e.on("parameterUpdated",function(e){"results"!==e.name&&"closeActions"!==e.name||t()})}}};n.d(t,["default",0,u])},4942(e,t,n){"use strict";n.r(t);var i=n(3538),o=n(5162),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};const s={node:{name:"PageStackNavigateBack",displayNodeName:"Pop Component Stack",category:"Navigation",docs:"https://docs.noodl.net/nodes/component-stack/pop-component",inputs:{navigate:{displayName:"Navigate",group:"Actions",description:"Pops the enclosing Component Stack back to the component underneath",valueChangedToTrue:function(){this.scheduleNavigate(this.beginOutcome())}},results:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Results",group:"Results",description:"Names of values to hand back to the node that pushed this component, one input port each",set:function(e){this._internal.results=e}},backActions:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Back Actions",group:"Back Actions",description:"Names of the ways this component can be closed, one signal input each; the matching signal fires on the node that pushed it",set:function(e){this._internal.backActions=e}}},outputs:r(r({},(0,o.outcomeOutputs)({done:"Fires once the stack has popped this component. ⚠️ This node is destroyed with the component it pops, so sequence anything that must survive the pop from the node that pushed it",unchanged:"Fires when the Component Stack is already showing its first component, so there was nothing to pop",failure:"Fires when this node is not inside a pushed component, or a navigation is still animating"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Why the stack did not pop, set just before Failure fires",getter:function(){return this._internal.lastError}}}),initialize:function(){this._internal.resultValues={}},methods:{scheduleNavigate:function(e){var t=this,n=this._internal;void 0===n.pendingOutcomes&&(n.pendingOutcomes=[]),n.pendingOutcomes.push(e),n.hasScheduledNavigate||(n.hasScheduledNavigate=!0,this.scheduleAfterInputsHaveUpdated(function(){n.hasScheduledNavigate=!1;var e=n.pendingOutcomes||[];n.pendingOutcomes=void 0;for(var i=0,o=e;i<o.length;i++){var r=o[i];t.navigate(r)}}))},_setBackCallback:function(e){this._internal.backCallback=e},navigate:function(e){var t=this._internal.backAction;if(this._internal.backAction=void 0,void 0===this._internal.backCallback)return this.reportFailure(e,"pop-component-stack/no-stack-in-scope","No Component Stack to pop — this node only works inside a component that a Component Stack pushed");var n=this._internal.backCallback({backAction:t,results:this._internal.resultValues});if(n&&!1===n.ok)return"unchanged"in n?this.reportOutcome(e,"unchanged"):this.reportFailure(e,n.code,n.message);this.reportOutcome(e,"done")},reportFailure:function(e,t,n){this._internal.lastError=n,this.flagOutputDirty("error"),this.reportOutcome(e,"failure",{code:t,message:n})},setResultValue:function(e,t){this._internal.resultValues[e]=t},backActionTriggered:function(e){this._internal.backAction=e,this.scheduleNavigate(this.beginOutcome())},registerInputIfNeeded:function(e){if(!this.hasInput(e))return e.startsWith("result-")?this.registerInput(e,{set:this.setResultValue.bind(this,e.substring(7))}):e.startsWith("backAction-")?this.registerInput(e,{set:i.EdgeTriggeredInput.createSetter({valueChangedToTrue:this.backActionTriggered.bind(this,e)})}):void 0}}},setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.PageStackNavigateBack",function(e){i(e)});for(var e=0,n=t.getNodesWithType("PageStackNavigateBack");e<n.length;e++)i(n[e])})}function i(e){function t(){var t=[],i=e.parameters.results;if(i){var o=i.split(",");for(var r in o){var s=o[r];t.push({type:{name:"*"},plug:"input",group:"Results",name:"result-"+s,displayName:s})}}var a=e.parameters.backActions;if(a)for(var r in o=a.split(","))s=o[r],t.push({type:"signal",plug:"input",group:"Back Actions",name:"backAction-"+s,displayName:s});n.sendDynamicPorts(e.id,t)}t(),e.on("parameterUpdated",function(e){"results"!==e.name&&"backActions"!==e.name||t()})}}};n.d(t,["default",0,s])},3766(e,t,n){"use strict";n.r(t);var i=n(3538),o=n.n(i),r=n(5162),s=function(){return s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};const a={node:{name:"PageStackNavigateToPath",displayNodeName:"Navigate To Path",category:"Navigation",docs:"https://docs.noodl.net/nodes/navigation/navigate-to-path",initialize:function(){var e=this._internal;e.params={},e.query={},e.openInNewTab=!1},inputs:{path:{type:{name:"string"},displayName:"Path",group:"General",description:"Path to navigate to; wrap a segment in braces, as in /product/{id}, to get an input port for it",set:function(e){this._internal.path=e}},queryNames:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Query",group:"Query",description:"Names of query-string parameters to append, one input port each; a parameter left unset is omitted from the URL",set:function(e){this._internal.queryNames=e}},openInNewTab:{index:10,displayName:"Open in new tab",group:"General",default:!1,type:"boolean",description:"Opens the path in a new browser tab instead of navigating this one",set:function(e){this._internal.openInNewTab=!!e}},navigate:{displayName:"Navigate",group:"Actions",description:"Navigates to Path, filling in any brace placeholders from their input ports",valueChangedToTrue:function(){this.scheduleNavigate(this.beginOutcome())}}},outputs:s(s({},(0,r.outcomeOutputs)({done:"Fires once the new path has been pushed to the browser history. Navigating in this window replaces the page, so nothing downstream of this may still exist",unchanged:"Fires when there is no browser history to push to — a server-side render, where there is nothing to do and nothing to fail at",failure:"Fires when no Path is set, or the browser blocked the new tab"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Why the navigation did not happen, set just before Failure fires",getter:function(){return this._internal.lastError}}}),methods:{scheduleNavigate:function(e){var t=this,n=this._internal;e&&(n.pendingNavigateOutcomes||(n.pendingNavigateOutcomes=[]),n.pendingNavigateOutcomes.push(e)),n.hasScheduledNavigate||(n.hasScheduledNavigate=!0,this.scheduleAfterInputsHaveUpdated(function(){n.hasScheduledNavigate=!1,t.navigate()}))},navigate:function(){var e=this._internal,t=e.pendingNavigateOutcomes||[];e.pendingNavigateOutcomes=void 0;var n=e.path;if("string"!=typeof n)return e.lastError="No path to navigate to",this.flagOutputDirty("error"),void(0,r.reportOutcomes)(this,t,"failure",{code:"navigate-to-path/no-path",message:"No path to navigate to"});var i,s,a=e.path.match(/\{[A-Za-z0-9_]*\}/g),l=[];a&&(l=a.map(function(e){return e.replace("{","").replace("}","")})),l.forEach(function(t){var i=e.params[t],o=void 0!==i?String(i):"";n=n.replace("{"+t+"}",function(){return o})});var u=o().instance.getProjectSettings().navigationPathType;void 0===u||"hash"===u?s=n:i=n;var c=[];void 0!==e.queryNames&&e.queryNames.split(",").forEach(function(t){var n=e.query[t];null!=n&&c.push(encodeURIComponent(t)+"="+encodeURIComponent(String(n)))});var d=(void 0!==i?i:"")+(c.length>=1?"?"+c.join("&"):"")+(void 0!==s?"#"+s:"");if("undefined"!=typeof window){if(this._internal.openInNewTab){if(!window.open(d,"_blank"))return e.lastError="The browser blocked opening a new tab",this.flagOutputDirty("error"),void(0,r.reportOutcomes)(this,t,"failure",{code:"navigate-to-path/blocked",message:"The browser blocked opening a new tab — this usually means the navigation was not triggered directly by a user action",detail:{url:d}})}else{try{window.history.pushState({},"",d)}catch(n){return e.lastError="The browser refused to navigate to this path",this.flagOutputDirty("error"),void(0,r.reportOutcomes)(this,t,"failure",{code:"navigate-to-path/refused",message:"The browser refused to navigate to this path",detail:{url:d,reason:n instanceof Error?n.message:String(n)}})}dispatchEvent(new PopStateEvent("popstate",{}))}(0,r.reportOutcomes)(this,t,"done")}else(0,r.reportOutcomes)(this,t,"unchanged")},setParam:function(e,t){this._internal.params[e]=t},setQuery:function(e,t){this._internal.query[e]=t},registerInputIfNeeded:function(e){if(!this.hasInput(e))return e.startsWith("p-")?this.registerInput(e,{set:this.setParam.bind(this,e.substring(2))}):e.startsWith("q-")?this.registerInput(e,{set:this.setQuery.bind(this,e.substring(2))}):void 0}}},setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.PageStackNavigateToPath",function(e){i(e)});for(var e=0,n=t.getNodesWithType("PageStackNavigateToPath");e<n.length;e++)i(n[e])})}function i(e){function t(){var t=[];if(void 0!==e.parameters.path){var i=(e.parameters.path.match(/\{[A-Za-z0-9_]*\}/g)||[]).map(function(e){return e.replace("{","").replace("}","")});t=i.filter(function(e,t,n){return n.indexOf(e)===t}).map(function(e){return{name:"p-"+e,displayName:e,group:"Parameter",type:"*",plug:"input"}})}void 0!==e.parameters.queryNames&&e.parameters.queryNames.split(",").forEach(function(e){t.push({name:"q-"+e,displayName:e,group:"Query",plug:"input",type:"*"})}),n.sendDynamicPorts(e.id,t)}t(),e.on("parameterUpdated",function(){t()})}}};n.d(t,["default",0,a])},7600(e,t,n){"use strict";n.r(t);var i=n(5162),o=n(5104),r=n(4231),s=function(){return s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};const a={node:{name:"PageStackNavigate",displayNodeName:"Push Component To Stack",category:"Navigation",docs:"https://docs.noodl.net/nodes/component-stack/push-component",initialize:function(){this._internal.transitionParams={},this._internal.pageParams={},this._internal.backResults={}},inputs:{stack:{type:{name:"string",identifierOf:"PackStack"},displayName:"Stack",group:"General",default:"Main",description:"Name of the Component Stack to navigate; leave blank for the one named Main",set:function(e){this._internal.stack=e}},mode:{type:{name:"enum",enums:[{label:"Push",value:"push"},{label:"Replace",value:"replace"}]},displayName:"Mode",default:"push",group:"General",description:"Push adds the target on top of the stack, Replace swaps it for the component currently showing",set:function(e){this._internal.navigationMode=e}},navigate:{displayName:"Navigate",group:"Actions",description:"Navigates the Component Stack to Target Page",valueChangedToTrue:function(){this.scheduleNavigate(this.beginOutcome())}}},outputs:s(s({},(0,i.outcomeOutputs)({done:"Fires once the stack has switched to the target component. ⚠️ If this node lives on the component being replaced it is destroyed with it, so sequence anything that must survive the navigation from a node outside the stack",unchanged:"Fires when the stack is already showing that component with those parameters, so it was not pushed again",failure:"Fires when no Target Page is set, the stack has no components configured, or a navigation is still animating"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Why the navigation did not happen, set just before Failure fires",getter:function(){return this._internal.lastError}}}),methods:{settle:function(e,t,n){if(!e.settled){e.settled=!0;for(var i=0,o=e.tokens;i<o.length;i++){var r=o[i];this.reportOutcome(r,t,n)}}},reportFailure:function(e,t,n){this._internal.lastError=n,this.flagOutputDirty("error"),this.settle(e,"failure",{code:t,message:n})},scheduleNavigate:function(e){var t=this,n=this._internal;void 0===n.pendingOutcomes&&(n.pendingOutcomes=[]),n.pendingOutcomes.push(e),n.hasScheduledNavigate||(n.hasScheduledNavigate=!0,this.scheduleAfterInputsHaveUpdated(function(){n.hasScheduledNavigate=!1;var e={tokens:n.pendingOutcomes||[],settled:!1};n.pendingOutcomes=void 0,t.navigate(e)}))},navigate:function(e){var t=this;"push"===this._internal.navigationMode||void 0===this._internal.navigationMode?o.A.instance.navigate(this._internal.stack,{target:this._internal.target,transition:s({type:this._internal.transition},this._internal.transitionParams),params:s({},this._internal.pageParams),backCallback:function(e,n){for(var i in t._internal.backResults=n,n)t.hasOutput("backResult-"+i)&&t.flagOutputDirty("backResult-"+i);void 0!==e&&t.sendSignalOnOutput(e)},hasNavigated:function(){t.settle(e,"done")},hasUnchanged:function(){t.settle(e,"unchanged")},hasFailed:function(n,i){t.reportFailure(e,n,i)}}):"replace"===this._internal.navigationMode?o.A.instance.replace(this._internal.stack,{target:this._internal.target,transition:s({type:this._internal.transition||"None"},this._internal.transitionParams),params:s({},this._internal.pageParams),hasNavigated:function(){t.scheduleAfterInputsHaveUpdated(function(){t.settle(e,"done")})},hasUnchanged:function(){t.scheduleAfterInputsHaveUpdated(function(){t.settle(e,"unchanged")})},hasFailed:function(n,i){t.reportFailure(e,n,i)}}):this.reportFailure(e,"push-component-stack/unknown-mode","Unknown mode '".concat(String(this._internal.navigationMode),"' — Mode must be push or replace"))},setTransitionParam:function(e,t){this._internal.transitionParams[e]=t},setPageParam:function(e,t){this._internal.pageParams[e]=t},getBackResult:function(e){return this._internal.backResults[e]},setTargetPageId:function(e){this._internal.target=e},setTransition:function(e){this._internal.transition=e},registerInputIfNeeded:function(e){if(!this.hasInput(e))return"target"===e?this.registerInput(e,{set:this.setTargetPageId.bind(this)}):"transition"===e?this.registerInput(e,{set:this.setTransition.bind(this)}):e.startsWith("tr-")?this.registerInput(e,{set:this.setTransitionParam.bind(this,e.substring(3))}):e.startsWith("pm-")?this.registerInput(e,{set:this.setPageParam.bind(this,e.substring(3))}):void 0},registerOutputIfNeeded:function(e){if(!this.hasOutput(e))return e.startsWith("backResult-")?this.registerOutput(e,{getter:this.getBackResult.bind(this,e.substring(11))}):e.startsWith("backAction-")?this.registerOutput(e,{getter:function(){}}):void 0}}},setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.PageStackNavigate",function(e){i(e)});for(var e=0,n=t.getNodesWithType("PageStackNavigate");e<n.length;e++)i(n[e])})}function i(e){function i(){var i=[],o="replace"===e.parameters.mode?"None":"Push";i.push({name:"transition",plug:"input",type:{name:"enum",enums:Object.keys(r.A)},default:o,displayName:"Transition",group:"Transition"});var s=e.parameters.transition||o;r.A[s]&&(i=i.concat(r.A[s].ports(e.parameters)));var a=t.getNodesWithType("Page Stack").find(function(t){return(t.parameters.name||"Main")===(e.parameters.stack||"Main")});if(void 0!==a){var l=a.parameters.pages;if(void 0!==l&&l.length>0){i.push({plug:"input",type:{name:"enum",enums:l.map(function(e){return{label:e.label,value:e.id}})},group:"General",displayName:"Target Page",name:"target",default:l[0].id});var u=e.parameters.target||l[0].id,c=a.parameters["pageComp-"+u];if(void 0!==c){var d=t.components[c];if(void 0!==d){for(var p in d.inputPorts)i.push({name:"pm-"+p,displayName:p,type:"*",plug:"input",group:"Parameters"});for(var h=0,f=d.getNodesWithType("PageStackNavigateBack");h<f.length;h++){var g=f[h];void 0!==g.parameters.backActions&&g.parameters.backActions.split(",").forEach(function(e){i.find(function(t){return t.name==="backAction-"+e})||i.push({name:"backAction-"+e,displayName:e,type:"signal",plug:"output",group:"Back Actions"})}),g.parameters.results&&g.parameters.results.split(",").forEach(function(e){i.find(function(t){return t.name==="backResult-"+e})||i.push({name:"backResult-"+e,displayName:e,type:"*",plug:"output",group:"Back Results"})})}}}}}n.sendDynamicPorts(e.id,i)}function o(){var n=t.getNodesWithType("Page Stack").find(function(t){return t.parameters.name===e.parameters.stack});if(void 0!==n){var o=n.parameters.pages;if(void 0!==o&&0!==o.length){var r=n.parameters["pageComp-"+(e.parameters.target||o[0].id)];if(void 0!==r){var s=t.components[r];if(void 0!==s){s.on("inputPortAdded",i),s.on("inputPortRemoved",i);for(var a=0,l=s.getNodesWithType("PageStackNavigateBack");a<l.length;a++)l[a].on("parameterUpdated",i);s.on("nodeAdded",function(e){"PageStackNavigateBack"===e.type&&(e.on("parameterUpdated",i),i())}),s.on("nodeWasRemoved",function(e){"PageStackNavigateBack"===e.type&&i()})}}}}}function s(e){e.on("parameterUpdated",function(e){"pages"!==e.name&&"name"!==e.name||i()})}i(),o(),e.on("parameterUpdated",function(e){"target"===e.name?(o(),i()):("stack"===e.name||"mode"===e.name||"transition"===e.name||e.name.startsWith("tr-"))&&i()}),t.on("nodeAdded.Page Stack",s),t.on("nodeWasRemoved.Page Stack",i);for(var a=0,l=t.getNodesWithType("Page Stack");a<l.length;a++)s(l[a])}}};n.d(t,["default",0,a])},5104(e,t,n){"use strict";var i=function(){function e(){this._pageStacks={},this._navigationQueue=[]}return e.prototype._performNavigation=function(e,t,n){if(e=e||"Main",this._pageStacks[e])for(var i=0,o=this._pageStacks[e];i<o.length;i++){var r=o[i];"navigate"===n?r.navigate(t):r.replace(t)}else this._navigationQueue.push({name:e,args:t,type:n})},e.prototype.navigate=function(e,t){e=e||"Main",this._performNavigation(e,t,"navigate")},e.prototype.replace=function(e,t){e=e||"Main",this._performNavigation(e,t,"replace")},e.prototype.registerPageStack=function(e,t){e=e||"Main",this._pageStacks[e]||(this._pageStacks[e]=[]),this._pageStacks[e].push(t);for(var n=!1,i=!1,o=0;o<this._navigationQueue.length;){var r=this._navigationQueue[o];r.name===e?("navigate"===r.type?(n||(t.reset(),n=!0),t.navigate(r.args)):t.replace(r.args),i=!0,this._navigationQueue.splice(o,1)):o++}i||t.reset()},e.prototype.deregisterPageStack=function(e,t){if(e=e||"Main",this._pageStacks[e]){var n=this._pageStacks[e].indexOf(t);-1!==n&&(this._pageStacks[e].splice(n,1),0===this._pageStacks[e].length&&delete this._pageStacks[e])}},e}();i.instance=new i;const o=i;n.d(t,["A",0,o])},2400(e,t,n){"use strict";n.r(t);const i={node:{name:"PageInputs",displayNodeName:"Page Inputs",category:"Navigation",docs:"https://docs.noodl.net/nodes/navigation/page-inputs",color:"component",initialize:function(){this._internal.params={}},inputs:{pathParams:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Path Parameters",group:"Path Parameters",description:"Names of the braced segments in this page’s route, one output port each",set:function(e){this._internal.pathParams=e}},queryParams:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Query Parameters",group:"Query Parameters",description:"Names of query-string parameters to read from the URL, one output port each",set:function(e){this._internal.queryParams=e}}},outputs:{},methods:{_setPageParams:function(e){for(var t in e)this._internal.params[t]=e[t],this.hasOutput("pm-"+t)&&this.flagOutputDirty("pm-"+t)},getPageParam:function(e){return this._internal.params[e]},registerOutputIfNeeded:function(e){if(!this.hasOutput(e))return e.startsWith("pm-")?this.registerOutput(e,{getter:this.getPageParam.bind(this,e.substring(3))}):void 0}}},setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.PageInputs",function(e){i(e)});for(var e=0,n=t.getNodesWithType("PageInputs");e<n.length;e++)i(n[e])})}function i(e){function t(){for(var t=new Set,i=0,o=["pathParams","queryParams"];i<o.length;i++){var r=o[i],s=e.parameters[r];if(void 0!==s)for(var a=0,l=s.split(",");a<l.length;a++){var u=l[a];""!==u&&t.add(u)}}var c=Array.from(t).map(function(e){return{name:"pm-"+e,displayName:e,type:"*",plug:"output",group:"Parameters"}});n.sendDynamicPorts(e.id,c)}t(),e.on("parameterUpdated",function(e){"pathParams"!==e.name&&"queryParams"!==e.name||t()})}}};n.d(t,["default",0,i])},907(e,t,n){"use strict";n.d(t,{u:()=>s});var i=n(3538),o=n.n(i),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},s=function(){function e(){this._routers={},this._navigationQueue=[]}return e.prototype.navigate=function(e,t){var n=this;setTimeout(function(){e=e||"Main";var i=Object.keys(n._routers);if(1===i.length&&(e=i[0]),n._routers[e])for(var o=0,r=n._routers[e];o<r.length;o++)r[o].navigate(t);else n._navigationQueue.push({name:e,args:t})},1)},e.prototype.registerRouter=function(e,t){e=e||"Main",this._routers[e]||(this._routers[e]=[]),this._routers[e].push(t);for(var n=!1,i=0;i<this._navigationQueue.length;){var o=this._navigationQueue[i];o.name===e?(t.navigate(o.args),n=!0,this._navigationQueue.splice(i,1)):i++}n||t.reset()},e.prototype.deregisterRouter=function(e,t){if(e=e||"Main",this._routers[e]){var n=this._routers[e].indexOf(t);-1!==n&&(this._routers[e].splice(n,1),0===this._routers[e].length&&delete this._routers[e])}},e.prototype.getPagesForRouter=function(e){var t=this,n=o().instance.graphModel.routerIndex.routers;if(void 0===n||0===n.length)return[];var i=e||"Main",r=n.filter(function(e){return e.name===i}),s=new Set;return r.forEach(function(e){var t=e.pages;void 0!==t&&void 0!==t.routes&&t.routes.forEach(function(e){s.add(e)})}),Array.from(s).map(function(e){return t.getPageInfoForComponent(String(e))}).filter(function(e){return!!e})},e.prototype.getPageInfoForComponent=function(e){return o().instance.graphModel.routerIndex.pages.find(function(t){return t.component===e})},e.prototype.onNavigated=function(e,t){var n=globalThis.Noodl;n&&n.Events.emit("NoodlApp_Navigated",r({routerName:e},t))},e.instance=new e,e}()},5496(e,t,n){"use strict";n.r(t);var i=n(5162),o=n(907),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};const s={node:{name:"RouterNavigate",displayNodeName:"Navigate",category:"Navigation",docs:"https://docs.noodl.net/nodes/navigation/navigate",initialize:function(){this._internal.pageParams={},this._internal.openInNewTab=!1},inputs:{navigate:{displayName:"Navigate",group:"Actions",description:"Navigates the Router to Target Page",valueChangedToTrue:function(){this.scheduleNavigate(this.beginOutcome())}},openInNewTab:{index:10,displayName:"Open in new tab",group:"General",default:!1,type:"boolean",description:"Opens the target page in a new browser tab instead of navigating this one",set:function(e){this._internal.openInNewTab=!!e}}},outputs:r(r({},(0,i.outcomeOutputs)({done:"Fires once the Router has switched to the target page. ⚠️ If this node lives on the page being left it is destroyed with that page, so sequence anything that must survive the navigation from a node outside the Router",unchanged:"Fires when the Router is already showing that page with those parameters, so it was not rebuilt",failure:"Fires when no Target Page is set, or the Router does not serve that page"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Why the navigation did not happen, set just before Failure fires",getter:function(){return this._internal.lastError}}}),methods:{settle:function(e,t,n){if(!e.settled){e.settled=!0;for(var i=0,o=e.tokens;i<o.length;i++){var r=o[i];this.reportOutcome(r,t,n)}}},reportFailure:function(e,t,n){this._internal.lastError=n,this.flagOutputDirty("error"),this.settle(e,"failure",{code:t,message:n})},scheduleNavigate:function(e){var t=this,n=this._internal;void 0===n.pendingOutcomes&&(n.pendingOutcomes=[]),n.pendingOutcomes.push(e),n.hasScheduledNavigate||(n.hasScheduledNavigate=!0,this.scheduleAfterInputsHaveUpdated(function(){n.hasScheduledNavigate=!1;var e={tokens:n.pendingOutcomes||[],settled:!1};n.pendingOutcomes=void 0,t.navigate(e)}))},navigate:function(e){var t=this;o.u.instance.navigate(this._internal.router,{target:this._internal.target,params:r({},this._internal.pageParams),openInNewTab:this._internal.openInNewTab,hasNavigated:function(){t.scheduleAfterInputsHaveUpdated(function(){t.settle(e,"done")})},hasUnchanged:function(){t.scheduleAfterInputsHaveUpdated(function(){t.settle(e,"unchanged")})},hasFailed:function(n,i){t.reportFailure(e,n,i)}})},setPageParam:function(e,t){this._internal.pageParams[e]=t},setTargetPage:function(e){this._internal.target=e},setRouter:function(e){this._internal.router=e},registerInputIfNeeded:function(e){if(!this.hasInput(e))return"target"===e?this.registerInput(e,{set:this.setTargetPage.bind(this)}):"router"===e?this.registerInput(e,{set:this.setRouter.bind(this)}):e.startsWith("pm-")?this.registerInput(e,{set:this.setPageParam.bind(this,e.substring(3))}):void 0}}}};n.d(t,["default",0,s])},5230(e,t,n){"use strict";n.r(t);var i=n(5162),o=function(){return o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};const r={node:{name:"NavigationShowPopup",displayNodeName:"Show Popup",category:"Navigation",docs:"https://docs.noodl.net/nodes/popups/show-popup",initialize:function(){this._internal.popupParams={},this._internal.closeResults={}},inputs:{target:{type:"component",displayName:"Target",group:"General",description:"Component to open as a popup; its Component Inputs become input ports on this node",set:function(e){this._internal.target=e}},stackPolicy:{type:{name:"enum",enums:[{label:"Replace It",value:"replace"},{label:"Show On Top",value:"stack"}]},displayName:"When A Popup Is Open",group:"General",default:"replace",description:"Replace It closes the popup already showing, Show On Top opens this one over it",set:function(e){this._internal.stackPolicy="stack"===e?"stack":"replace"}},closeOnEscape:{type:"boolean",displayName:"Close On Escape",group:"General",default:!0,description:"Lets the person close the popup with the Escape key, which fires Cancelled. Turn off for a popup that must be finished or closed by its own buttons",set:function(e){this._internal.closeOnEscape=!1!==e}},modal:{type:"boolean",displayName:"Modal",group:"General",default:!0,description:"A modal popup is a dialog: the page behind it cannot be used, focus moves into it and Escape closes it. Turn off for an overlay that is not a dialog, such as a toast",set:function(e){this._internal.modal=!1!==e}},accessibleName:{type:"string",displayName:"Accessible Name",group:"General",description:"What a screen reader announces when the popup opens. Leave empty to use the first heading inside the popup",set:function(e){this._internal.accessibleName="string"==typeof e?e:void 0}},show:{type:"signal",displayName:"Show",group:"Actions",description:"Opens Target as a popup",valueChangedToTrue:function(){this.scheduleShow(this.beginOutcome())}}},outputs:o(o({Closed:{type:"signal",displayName:"Closed",group:"Events",description:"Fires when the popup was closed without a close action, after Close Results are up to date"},Dismissed:{type:"signal",displayName:"Dismissed",group:"Events",description:"Fires when another popup replaced this one before the user closed it, so there are no Close Results"},Cancelled:{type:"signal",displayName:"Cancelled",group:"Events",description:"Fires when the person closed the popup with the Escape key, so there are no Close Results"}},(0,i.outcomeOutputs)({done:"Fires once the popup has been opened. Closed and Dismissed are later events about the same popup, not this signal",failure:"Fires when no Target is set, or the component could not be opened"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Why the popup did not open, set just before Failure fires",getter:function(){return this._internal.lastError}}}),methods:{reportFailure:function(e,t,n){this._internal.lastError=t,this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,n,"failure",{code:e,message:t})},setPopupParam:function(e,t){this._internal.popupParams[e]=t},getCloseResult:function(e){return this._internal.closeResults[e]},scheduleShow:function(e){var t=this,n=this._internal;e&&(n.pendingShowOutcomes||(n.pendingShowOutcomes=[]),n.pendingShowOutcomes.push(e)),n.hasScheduledShow||(n.hasScheduledShow=!0,this.scheduleAfterInputsHaveUpdated(function(){n.hasScheduledShow=!1,t.show()}))},show:function(){var e,t=this,n=this._internal.pendingShowOutcomes||[];if(this._internal.pendingShowOutcomes=void 0,null==this._internal.target)return this.reportFailure("show-popup/no-target","No Target component is set on this Show Popup node",n);var o=this.context.showPopup(this._internal.target,this._internal.popupParams,{senderNode:this.nodeScope.componentOwner,stackPolicy:null!==(e=this._internal.stackPolicy)&&void 0!==e?e:"replace",closeOnEscape:!1!==this._internal.closeOnEscape,modal:!1!==this._internal.modal,accessibleName:this._internal.accessibleName,onCancelPopup:function(){t.sendSignalOnOutput("Cancelled")},onDismissPopup:function(){t.sendSignalOnOutput("Dismissed")},onClosePopup:function(e,n){for(var i in t._internal.closeResults=n,n)t.hasOutput("closeResult-"+i)&&t.flagOutputDirty("closeResult-"+i);e?t.sendSignalOnOutput(e):t.sendSignalOnOutput("Closed")}});o&&o.then?o.then(function(e){"dismissed"!==e&&(0,i.reportOutcomes)(t,n,"done")},function(e){t.reportFailure("show-popup/target-failed",'The popup "'+t._internal.target+'" could not be opened: '+((null==e?void 0:e.message)||String(e)),n)}):(0,i.reportOutcomes)(this,n,"done")},registerInputIfNeeded:function(e){if(!this.hasInput(e))return e.startsWith("popupParam-")?this.registerInput(e,{set:this.setPopupParam.bind(this,e.substring(11))}):void 0},registerOutputIfNeeded:function(e){if(!this.hasOutput(e))return e.startsWith("closeResult-")?this.registerOutput(e,{getter:this.getCloseResult.bind(this,e.substring(12))}):e.startsWith("closeAction-")?this.registerOutput(e,{getter:function(){}}):void 0}}},setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.NavigationShowPopup",function(e){i(e)});for(var e=0,n=t.getNodesWithType("NavigationShowPopup");e<n.length;e++)i(n[e])})}function i(e){function i(){var i=[],o=e.parameters.target;if(void 0!==o){var r=t.components[o];if(r){for(var s in r.inputPorts){var a=r.inputPorts[s];i.push({name:"popupParam-"+s,displayName:s,type:a.type||"*",plug:"input",group:"Params"})}for(var l=0,u=r.getNodesWithType("NavigationClosePopup");l<u.length;l++){var c=u[l];void 0!==c.parameters.closeActions&&c.parameters.closeActions.split(",").forEach(function(e){i.find(function(t){return t.name==="closeAction-"+e})||i.push({name:"closeAction-"+e,displayName:e,type:"signal",plug:"output",group:"Close Actions"})}),void 0!==c.parameters.results&&c.parameters.results.split(",").forEach(function(e){if(!i.find(function(t){return t.name==="closeResult-"+e})){var t=r.outputPorts&&r.outputPorts[e];i.push({name:"closeResult-"+e,displayName:e,type:t&&t.type||"*",plug:"output",group:"Close Results"})}})}}}n.sendDynamicPorts(e.id,i)}function o(e){if(void 0!==e){var n=t.components[e];if(void 0!==n){n.on("inputPortAdded",i),n.on("inputPortRemoved",i),n.on("outputPortAdded",i),n.on("outputPortRemoved",i);for(var o=0,r=n.getNodesWithType("NavigationClosePopup");o<r.length;o++)r[o].on("parameterUpdated",i);n.on("nodeAdded",function(e){"NavigationClosePopup"===e.type&&(e.on("parameterUpdated",i),i())}),n.on("nodeWasRemoved",function(e){"NavigationClosePopup"===e.type&&i()})}}}i(),o(e.parameters.target),e.on("parameterUpdated",function(t){"target"===t.name&&(i(),o(e.parameters.target))})}}};n.d(t,["default",0,r])},4231(e,t,n){"use strict";n.d(t,{A:()=>p});const i=function(){function e(){this._frame=this.frame.bind(this)}return e.prototype.start=function(e){this.cb=e.end,this.timing.delay+this.timing.dur!==0&&"undefined"!=typeof window&&window.performance?(this.transitionForward=!e.back,this.startTime=window.performance.now(),requestAnimationFrame(this._frame)):this.end()},e.prototype.frame=function(){var e=(window.performance.now()-(this.startTime+this.timing.delay))/this.timing.dur,t=Math.max(0,Math.min(e,1));this.transitionForward?this.forward(t):this.back(t),window.performance.now()<=this.startTime+this.timing.dur+this.timing.delay?requestAnimationFrame(this._frame):this.end()},e.prototype.end=function(){this.cb&&this.cb()},e}();var o,r=(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});const s=function(e){function t(t,n){var i=e.call(this)||this;return i.from=t,i.to=n,i.timing={dur:0,delay:0},i}return r(t,e),t.prototype.update=function(){},t.prototype.forward=function(){},t.prototype.back=function(){},t.ports=function(){return[]},t}(i);var a=n(8454),l=n.n(a),u=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();const c=function(e){function t(t,n,i){var o=e.call(this)||this;o.from=t,o.to=n,o.timing=i.timing||{curve:[0,0,.58,1],dur:300,delay:0};var r=i.shift||{value:25,unit:"%"};o.distance="number"==typeof r?{value:r,unit:"%"}:r,o.direction=i.direction||"Right",o.timing.curve[0]=Math.min(1,Math.max(0,o.timing.curve[0])),o.timing.curve[2]=Math.min(1,Math.max(0,o.timing.curve[2])),o.ease=l().apply(void 0,o.timing.curve).get,o.fadein=void 0!==i.fadein&&i.fadein;var s=i.zoom||{value:25,unit:"%"};return o.zoom="number"==typeof s?{value:s,unit:"%"}:s,o}return u(t,e),t.prototype.update=function(e){if("In"===this.direction||"Out"===this.direction){var t=this.zoom.value/100;t="Out"===this.direction?-t:t,this.to.setStyle({transform:"scale("+(1-t*(1-e))+")",opacity:this.fadein?e:1})}else{var n=this.distance.value,i=this.distance.unit,o={Up:{x:0,y:-1},Down:{x:0,y:1},Left:{x:-1,y:0},Right:{x:1,y:0}},r={x:o[this.direction].x*n,y:o[this.direction].y*n};this.to.setStyle({transform:"translate("+r.x*(e-1)+i+","+r.y*(e-1)+i+")",opacity:this.fadein?e:1})}},t.prototype.forward=function(e){var t=this.ease(e);this.update(t)},t.prototype.back=function(e){var t=this.ease(e);this.update(1-t)},t.ports=function(e){var t=[];return t.push({name:"tr-direction",displayName:"Direction",group:"Transition",type:{name:"enum",enums:["Right","Left","Up","Down","In","Out"]},default:"Right",plug:"input"}),"In"===e["tr-direction"]||"Out"===e["tr-direction"]?t.push({name:"tr-zoom",displayName:"Zoom",group:"Transition",type:{name:"number",units:["%"]},default:{value:25,unit:"%"},plug:"input"}):t.push({name:"tr-shift",displayName:"Shift Distance",group:"Transition",type:{name:"number",units:["%","px"]},default:{value:25,unit:"%"},plug:"input"}),t.push({name:"tr-fadein",displayName:"Fade In",group:"Transition",type:"boolean",default:!1,plug:"input"}),t.push({name:"tr-timing",displayName:"Timing",group:"Transition",type:"curve",plug:"input"}),t},t}(i);var d=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();const p={None:s,Push:function(e){function t(t,n,i){var o=e.call(this)||this;o.from=t,o.to=n,o.timing=i.timing||{curve:[0,0,.58,1],dur:300,delay:0};var r=i.shift||{value:25,unit:"%"};o.distance="number"==typeof r?{value:r,unit:"%"}:r,o.direction=i.direction||"Left",o.timing.curve[0]=Math.min(1,Math.max(0,o.timing.curve[0])),o.timing.curve[2]=Math.min(1,Math.max(0,o.timing.curve[2])),o.ease=l().apply(void 0,o.timing.curve).get,o.crossfade=void 0!==i.crossfade&&i.crossfade,o.darkOverlay=void 0===i.darkoverlay||i.darkoverlay,o.darkOverlayAmount=void 0===i.darkoverlayamount?.5:i.darkoverlayamount;var s=i.zoom||{value:25,unit:"%"};return o.zoom="number"==typeof s?{value:s,unit:"%"}:s,o.darkOverlay&&(o.darkOverlay=t.nodeScope.createPrimitiveNode("Group"),o.darkOverlay.setInputValue("position","absolute"),o.darkOverlay.setInputValue("sizeMode","explicit"),o.darkOverlay.setInputValue("width",{value:100,unit:"%"}),o.darkOverlay.setInputValue("height",{value:100,unit:"%"}),o.darkOverlay.setInputValue("backgroundColor","#000000"),o.darkOverlay.setInputValue("opacity",0)),o}return d(t,e),t.prototype.update=function(e){if("In"===this.direction||"Out"===this.direction){var t=this.zoom.value/100;t="Out"===this.direction?-t:t,this.from.setStyle({transform:"scale("+(1+t*e)+")",opacity:this.crossfade?1-e:1}),this.to.setStyle({transform:"scale("+(1-t*(1-e))+")",opacity:this.crossfade?e:1})}else{var n=this.distance.value,i=this.distance.unit,o={Up:{x:0,y:-1},Down:{x:0,y:1},Left:{x:-1,y:0},Right:{x:1,y:0}},r={x:o[this.direction].x*n,y:o[this.direction].y*n},s={x:100*o[this.direction].x,y:100*o[this.direction].y};this.from.setStyle({transform:"translate("+r.x*e+i+","+r.y*e+i+")",opacity:this.crossfade?1-e:1}),this.to.setStyle({transform:"translate("+s.x*(e-1)+i+","+s.y*(e-1)+"%)",opacity:this.crossfade?e:1})}this.darkOverlay&&this.darkOverlay.setStyle({opacity:e*this.darkOverlayAmount})},t.prototype.forward=function(e){var t=this.ease(e);this.update(t)},t.prototype.back=function(e){var t=this.ease(e);this.update(1-t)},t.prototype.start=function(t){e.prototype.start.call(this,t),this.darkOverlay&&this.from.addChild(this.darkOverlay)},t.prototype.end=function(){this.darkOverlay&&this.from.removeChild(this.darkOverlay),e.prototype.end.call(this)},t.ports=function(e){var t=[];return t.push({name:"tr-direction",displayName:"Direction",group:"Transition",type:{name:"enum",enums:["Right","Left","Up","Down","In","Out"]},default:"Left",plug:"input"}),"In"===e["tr-direction"]||"Out"===e["tr-direction"]?t.push({name:"tr-zoom",displayName:"Zoom",group:"Transition",type:{name:"number",units:["%"]},default:{value:25,unit:"%"},plug:"input"}):t.push({name:"tr-shift",displayName:"Shift Distance",group:"Transition",type:{name:"number",units:["%","px"]},default:{value:25,unit:"%"},plug:"input"}),t.push({name:"tr-crossfade",displayName:"Crossfade",group:"Transition",type:"boolean",default:!1,plug:"input"}),t.push({name:"tr-darkoverlay",displayName:"Dark Overlay",group:"Transition",type:"boolean",default:!0,plug:"input"}),t.push({name:"tr-darkoverlayamount",displayName:"Dark Overlay Amount",group:"Transition",type:"number",default:.5,plug:"input"}),t.push({name:"tr-timing",displayName:"Timing",group:"Transition",type:"curve",plug:"input"}),t},t}(i),Popup:c}},4229(e,t,n){"use strict";n.r(t);var i=n(4038);function o(e){return!0===e?1:!1===e?0:Number(e)}function r(e){var t=o(e);if(!isNaN(t)){var n=this._internal,i=n._animation;i.stop(),!1===n.numberInitialized&&(n.numberInitialized=!0,i.endValue=t),n.currentNumber=t,this.flagOutputDirty("currentValue"),this.scheduleAfterInputsHaveUpdated(function(){i.endValue!==n.currentNumber&&(i.startValue=n.currentNumber,i.start())})}}const s={node:{name:"net.noodl.animatetovalue",docs:"https://docs.noodl.net/nodes/logic/animate-to-value",displayName:"Animate To Value",category:"Animation",ssr:{compat:"partial",note:"The scheduler clock is frozen during server render; the value stays at its start and Finished never fires there."},initialize:function(){var e=this,t=this,n=this._internal;n.currentNumber=0,n.numberInitialized=!1,n.animationStarted=!1,n.setCurrentNumberEnabled=!1,n.overrideValue=0,n._animation=this.context.timerScheduler.createTimer({duration:300,startValue:0,endValue:0,ease:i.A.easeOut,onStart:function(){n.animationStarted=!0},onRunning:function(e){n.currentNumber=this.ease(this.startValue,this.endValue,e),t.flagOutputDirty("currentValue")},onFinish:function(){t.sendSignalOnOutput("atTargetValue")}}),this.addDeleteListener(function(){e._internal._animation.stop()})},getInspectInfo:function(){return[{type:"value",value:this._internal.currentNumber}]},inputs:{targetValue:{type:{name:"number"},displayName:"Target Value",group:"Target Value",description:"Value to move towards; the first one to arrive is adopted outright rather than animated to. Two targets in one update make one move, from wherever the value is: to jump first, use Jump To",default:void 0,set:function(e){var t=o(e);if(!isNaN(t)){var n=this._internal;if(!1===n.numberInitialized)return n.currentNumber=t,n.numberInitialized=!0,n._animation.endValue=t,void this.flagOutputDirty("currentValue");t!==n._animation.endValue&&(n._animation.startValue=n.currentNumber,n._animation.endValue=t,n._animation.start())}}},jumpValue:{type:{name:"number"},displayName:"Jump Value",group:"Jump",description:"Where Jump To puts Current Value",set:function(e){this._internal.jumpValue=e}},jumpTo:{displayName:"Jump To",group:"Jump",description:"Puts Current Value at Jump Value at once, then carries on towards Target Value; a jump is not an arrival, so At Target Value does not fire for it",valueChangedToTrue:function(){r.call(this,this._internal.jumpValue)}},duration:{type:"number",group:"Parameters",displayName:"Duration",description:"How long the move takes, in milliseconds",default:300,set:function(e){this._internal._animation.duration=e}},delay:{type:"number",group:"Parameters",displayName:"Delay",description:"How long to wait before the move begins, in milliseconds",default:0,set:function(e){this._internal._animation.delay=Number(e)||0}},easingCurve:{type:{name:"enum",enums:[{value:"easeOut",label:"Ease Out"},{value:"easeIn",label:"Ease In"},{value:"linear",label:"Linear"},{value:"easeInOut",label:"Ease In Out"}]},default:"easeOut",displayName:"Easing Curve",group:"Parameters",description:"Shape of the movement between where the value is and Target Value",set:function(e){this._internal._animation.ease=Object.prototype.hasOwnProperty.call(i.A,e)?i.A[e]:i.A.easeOut}}},outputs:{currentValue:{type:"number",displayName:"Current Value",group:"Current State",description:"Where the move has got to, updated every frame while it runs",getter:function(){return this._internal.currentNumber}},atTargetValue:{type:"signal",displayName:"At Target Value",group:"Events",description:"Fires when the value settles on Target Value, and not at all if a new target interrupted it"}}}};n.d(t,["default",0,s])},9469(e,t,n){"use strict";function i(e){if(!Array.isArray(e))return!1;var t=e.on,n=e.off;return"function"==typeof t&&"function"==typeof n}n.r(t);const o={node:{name:"net.noodl.ArrayChanged",displayName:"Array Changed",category:"Logic",initialize:function(){var e=this;this._internal.array=void 0,this._internal.index=null,this._internal.item=null,this._internal.key=null,this._internal.count=0,this._internal.changeCount=0,this._internal.watched=[],this._internal.watchers=[];var t=function(t,n,i){var o;e._internal.changeCount++,e._internal.index=t,e._internal.item=void 0===(o=n)?null:o,e._internal.key=i,e._internal.count=Array.isArray(e._internal.array)?e._internal.array.length:0,e.flagOutputDirty("index"),e.flagOutputDirty("item"),e.flagOutputDirty("key"),e.flagOutputDirty("count")};this._onArrayAdd=function(n){if(null!==n&&"object"==typeof n){var i=n;e._watchItem(i.item),t(i.index,i.item,null),e.sendSignalOnOutput("itemAdded")}},this._onArrayRemove=function(n){if(null!==n&&"object"==typeof n){var i=n;e._unwatchItem(i.item),t(i.index,i.item,null),e.sendSignalOnOutput("itemRemoved")}},this._onArrayChanged=function(){var t=e._internal.array,n=Array.isArray(t)?t.length:0;n!==e._internal.count&&(e._internal.count=n,e.flagOutputDirty("count"))},this._onItemChanged=function(n,i){var o=e._internal.array;if(Array.isArray(o)){var r=o.indexOf(n);-1!==r&&(t(r,n,i.name),e.sendSignalOnOutput("itemChanged"))}},this._watchItem=function(t){if(function(e){if(null==e)return!1;if(Array.isArray(e))return!1;if("object"!=typeof e&&"function"!=typeof e)return!1;var t=e.on,n=e.off;return"function"==typeof t&&"function"==typeof n}(t)&&-1===e._internal.watched.indexOf(t)){var n=function(n){null!==n&&"object"==typeof n&&e._onItemChanged(t,n)};e._internal.watched.push(t),e._internal.watchers.push(n),t.on("change",n)}},this._unwatchItem=function(t){var n=e._internal.array;if(!Array.isArray(n)||-1===n.indexOf(t)){var i=e._internal.watched.indexOf(t);if(-1!==i){var o=e._internal.watchers[i];e._internal.watched.splice(i,1),e._internal.watchers.splice(i,1),t.off("change",o)}}},this._unwatchAllItems=function(){for(var t=e._internal.watched,n=e._internal.watchers,i=0;i<t.length;i++)t[i].off("change",n[i]);e._internal.watched=[],e._internal.watchers=[]},this._unbindArray=function(){var t=e._internal.array;if(i(t)){var n=t;n.off("add",e._onArrayAdd),n.off("remove",e._onArrayRemove),n.off("change",e._onArrayChanged)}e._unwatchAllItems()},this.addDeleteListener(function(){e._unbindArray(),e._internal.array=void 0})},getInspectInfo:function(){return this._internal.changeCount?"Reported "+this._internal.changeCount+(1===this._internal.changeCount?" change":" changes")+", "+this._internal.count+" items, watching "+this._internal.watched.length:"No changes reported"},inputs:{array:{group:"Values",type:"array",displayName:"Array",description:"The Array to watch. Items arriving and leaving are reported as they happen, and edits to the Objects inside it are reported as Item Changed; sending a different Array reports Array Replaced",set:function(e){if(void 0!==e&&this._internal.array!==e){if(this._unbindArray(),this._internal.array=e,i(e)){var t=e;t.on("add",this._onArrayAdd),t.on("remove",this._onArrayRemove),t.on("change",this._onArrayChanged);for(var n=e,o=0;o<n.length;o++)this._watchItem(n[o])}this._internal.changeCount++,this._internal.index=null,this._internal.item=null,this._internal.key=null,this._internal.count=Array.isArray(e)?e.length:0,this.flagOutputDirty("index"),this.flagOutputDirty("item"),this.flagOutputDirty("key"),this.flagOutputDirty("count"),this.sendSignalOnOutput("arrayReplaced")}}}},outputs:{itemAdded:{group:"Events",type:"signal",displayName:"Item Added",description:"Fires when an item is added to the watched Array; Index and Item describe it"},itemRemoved:{group:"Events",type:"signal",displayName:"Item Removed",description:"Fires when an item is removed from the watched Array; Index is the position it occupied"},itemChanged:{group:"Events",type:"signal",displayName:"Item Changed",description:"Fires when one of the Objects inside the watched Array is edited in place; Key names the property that changed. Items that are not Noodl Objects cannot be watched"},arrayReplaced:{group:"Events",type:"signal",displayName:"Array Replaced",description:"Fires when a different Array arrives on the input, including the first one and including an explicit clear; Index, Item and Key are empty and Count is the new length"},index:{type:"number",displayName:"Index",group:"Change",description:"The position the last signal was about; empty after Array Replaced, which is about no single item",getter:function(){return this._internal.index}},item:{type:"*",displayName:"Item",group:"Change",description:"The item the last signal was about; empty after Array Replaced",getter:function(){return this._internal.item}},key:{type:"string",displayName:"Key",group:"Change",description:"The property of Item that changed, after Item Changed; empty after the other signals, which are about the item as a whole",getter:function(){return this._internal.key}},count:{type:"number",displayName:"Count",group:"Array",description:"How many items the watched Array holds now. Kept accurate through reordering and length changes, which send no signal because they add and remove nothing",getter:function(){return this._internal.count}}}}};n.d(t,["default",0,o])},1952(e,t,n){"use strict";n.r(t);var i=n(2793),o=n(4038);function r(e){var t=(0,i.qS)(e);return t?[t[0],t[1],t[2]]:null}function s(e){var t=e.toString(16);return 1==t.length?"0"+t:t}function a(e,t){e[0]=t[0],e[1]=t[1],e[2]=t[2]}var l=[0,0,0],u=[0,0,0],c=[0,0,0];const d={node:{name:"Color Blend",docs:"https://docs.noodl.net/nodes/utilities/color-blend",category:"Interpolation",getInspectInfo:function(){return[{type:"color",value:this._internal.resultColor}]},initialize:function(){var e=this._internal;e.resultColor="#000000",e.blendValue=0,e.colors=[]},numberedInputs:{color:{type:"color",displayPrefix:"Color",createSetter:function(e){return function(t){this._internal.colors[e]=t,this.updateColor()}}}},inputs:{blendValue:{group:"Values",type:"number",displayName:"Blend Value",description:"Position along the colour list, where 1 is exactly Color 1 and 1.5 is halfway to Color 2; values outside the list are clamped",default:0,set:function(e){this._internal.blendValue=e,this.updateColor()}}},outputs:{result:{group:"Values",type:"color",displayName:"Result",description:"The blended colour. Inputs may be #RGB, #RRGGBB, rgb()/rgba() or var(--token); a colour it cannot read is reported and the nearest input is shown unblended",getter:function(){return this._internal.resultColor}}},methods:{warnUnreadableColor:function(e){if(this._internal.warnedAbout!==e){this._internal.warnedAbout=e;var t=this.raiseRuntimeError;"function"==typeof t&&t.call(this,"color-blend/unreadable-color","Color Blend cannot read the colour ".concat(JSON.stringify(e),", so it is showing the nearest ")+"colour unblended. It understands #RGB, #RRGGBB, rgb()/rgba() and var(--token) when the token is defined on the page.")}},warnUnreadableBlend:function(e){var t="string"==typeof e?JSON.stringify(e):String(e);if(this._internal.warnedBlend!==t){this._internal.warnedBlend=t;var n=this.raiseRuntimeError;"function"==typeof n&&n.call(this,"color-blend/unreadable-blend-value","Color Blend cannot read the Blend Value ".concat(t," as a number, so it is keeping the colour it last showed."))}},updateColor:function(){var e=this._internal.colors;if(0!==e.length){var t=Number(this._internal.blendValue);if(Number.isNaN(t))this.warnUnreadableBlend(this._internal.blendValue);else{this._internal.warnedBlend=void 0;var n,i,d,p=(n=e.length-1,i=t,Math.max(0,Math.min(n,i))),h=Math.floor(p),f=p-h;if(0===f)this._internal.resultColor=y(h);else{var g=r(y(h)),m=r(y(h+1));g&&m?(a(l,g),a(u,m),c[0]=Math.floor(o.A.linear(l[0],u[0],f)),c[1]=Math.floor(o.A.linear(l[1],u[1],f)),c[2]=Math.floor(o.A.linear(l[2],u[2],f)),this._internal.resultColor="#"+s((d=c)[0])+s(d[1])+s(d[2])):(this._internal.resultColor=y(f<.5?h:h+1),this.warnUnreadableColor(y(g?h+1:h)))}this.flagOutputDirty("result")}}function y(t){return e[t]?e[t]:"#000000"}}}}};n.d(t,["default",0,d])},4361(e,t,n){"use strict";n.r(t);var i=n(9405),o=n(3538),r=n(1608),s=n(6835),a=n.n(s),l=n(5162),u=n(9849),c=function(){return c=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},c.apply(this,arguments)},d=new i.EventEmitter;d.setMaxListeners(1e6);var p=new u.ResolvedTargetReporter;function h(e,t,n){for(var i=[],o=t.properties,r=0,s=o&&o.split(",")||[];r<s.length;r++){var a=s[r];i.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:"value-"+a,displayName:a}),i.push({type:"signal",plug:"output",group:"Events",displayName:a+" Changed",name:"changed-"+a})}n.sendDynamicPorts(e,i,{detectRenamed:{plug:"input/output"}})}const f={node:{name:"net.noodl.ParentComponentObject",displayNodeName:"Parent Component Object",category:"Component Utilities",color:"component",docs:"https://docs.noodl.net/nodes/component-utilities/parent-component-object",runOnValueChange:{controlSignal:"fetch",sources:[{name:"object",displayName:"Parent object"}]},initialize:function(){var e=this;this._internal.inputValues={},this._internal.onModelChangedCallback=function(t){e.shouldRunOnValueChange("object")&&(e.hasOutput("value-"+t.name)&&e.flagOutputDirty("value-"+t.name),e.hasOutput("changed-"+t.name)&&e.sendSignalOnOutput("changed-"+t.name),e.sendSignalOnOutput("changed"))},this.onComponentStateNodesChanged=function(){var t=e.findParentComponentStateModelId();e._internal.modelId!==t&&(e._internal.modelId=t,e.shouldRunOnValueChange("object")&&e.setModelId(e._internal.modelId))},d.on("componentStateNodesChanged",this.onComponentStateNodesChanged),this.updateComponentState()},nodeScopeDidInitialize:function(){var e=this;this.context.scheduleAfterUpdate(function(){e._internal.resolutionIsLoud=!0,e.onComponentStateNodesChanged()})},getInspectInfo:function(){if(!this._internal.model)return"No parent component state found";var e=[{type:"text",value:this._internal.parentComponentName}],t=this._internal.model.data;return e.concat(Object.keys(t).map(function(e){return{type:"text",value:e+": "+t[e]}}))},inputs:{targetComponent:{type:"component",displayName:"Parent Component",group:"General",description:"Which ancestor to read from; leave blank for the nearest one that has a Component Object",set:function(e){this._internal.targetComponent=e||void 0,this._internal.lastMissCode=void 0,this.updateComponentState()}},properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",description:"Names of the parent values to expose, each becoming a matching input and output",set:function(){}},fetch:{displayName:"Fetch",group:"Actions",description:"Republishes every property from the parent now. This is additional to the outputs updating on their own; untick Parent object under Run On Value Change to stop that",valueChangedToTrue:function(){this.setModelId(this._internal.modelId,this.beginOutcome())}}},outputs:c(c({changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires when a property on the resolved parent is written, unless Fetch is connected"},fetched:{type:"signal",displayName:"Fetched",group:"Events",description:"Fires whenever every property is republished, whether by Fetch or by the parent being re-resolved"}},(0,l.outcomeOutputs)({done:"Fires once a Fetch you triggered has republished every property, after Fetched",failure:"Fires when no parent Component Object could be found, so there is nothing to read"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Which ancestor was looked for and why it was not found",getter:function(){return this._internal.lastError}}}),methods:{updateComponentState:function(){this._internal.modelId=this.findParentComponentStateModelId(),this.shouldRunOnValueChange("object")&&this.setModelId(this._internal.modelId)},findParentComponentStateModelId:function(){var e=this.nodeScope.componentOwner,t=this._internal.targetComponent;if(t){var n=(0,r.GM)(e,t);return n?r.Gk.some(function(e){return n.nodeScope.getNodesWithType(e).length>0})?(this._internal.parentComponentName=n.name,this._internal.lastMissCode=void 0,this._internal.lastError=void 0,p.report(this,n.name),"componentState"+n.getInstanceId()):(this._internal.parentComponentName=void 0,p.report(this,void 0),void this.reportMiss("parent-component-object/target-has-no-object",'The component "'+t+'" has no Component Object node',{target:t})):(this._internal.parentComponentName=void 0,p.report(this,void 0),void this.reportMiss("parent-component-object/target-not-found",'No ancestor component named "'+t+'"',{target:t,ancestors:(0,r.n6)(e)}))}var i=(0,r.findAncestorWithComponentObject)(e);return i?(this._internal.parentComponentName=i.name,this._internal.lastMissCode=void 0,this._internal.lastError=void 0,p.report(this,i.name),"componentState"+i.getInstanceId()):(this._internal.parentComponentName=void 0,p.report(this,void 0),void this.reportMiss("parent-component-object/no-ancestor","No ancestor component has a Component Object node",{ancestors:(0,r.n6)(e)}))},reportMiss:function(e,t,n){this._internal.resolutionIsLoud&&this._internal.lastMissCode!==e&&(this._internal.lastMissCode=e,this._internal.lastError=t,this.raiseRuntimeError(e,t,n),this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"))},setModelId:function(e,t){if(this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),this._internal.model=void 0,e){var n=a().get(e);for(var i in this._internal.model=n,n.on("change",this._internal.onModelChangedCallback),n.data)this.hasOutput("value-"+i)&&this.flagOutputDirty("value-"+i),this.hasOutput("changed-"+i)&&this.sendSignalOnOutput("changed-"+i);this.sendSignalOnOutput("changed"),this.sendSignalOnOutput("fetched"),t&&this.reportOutcome(t,"done")}else if(t){var o="Fetch was triggered but no parent Component Object is bound, so there is nothing to republish";this._internal.lastError=o,this.flagOutputDirty("error"),this.reportOutcome(t,"failure",{code:"parent-component-object/fetch-no-parent",message:o,detail:{target:this._internal.targetComponent}})}},scheduleStore:function(){var e=this;if(!this.hasScheduledStore){this.hasScheduledStore=!0;var t=this._internal;this.scheduleAfterInputsHaveUpdated(function(){if(e.hasScheduledStore=!1,t.model)for(var n in t.inputValues)t.model.set(n,t.inputValues[n],{resolve:!0})})}},_onNodeDeleted:function(){o.Node.prototype._onNodeDeleted.call(this),d.off("componentStateNodesChanged",this.onComponentStateNodesChanged),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),p.forget(this)},registerOutputIfNeeded:function(e){if(!this.hasOutput(e)){var t=e.substring(6);this.registerOutput(e,{get:function(){if(this._internal.model)return this._internal.model.get(t,{resolve:!0})}})}},registerInputIfNeeded:function(e){if(!this.hasInput(e)&&e.startsWith("value-")){var t=e.substring(6);this.registerInput(e,{set:function(e){this._internal.inputValues[t]=e,this.scheduleStore()}})}}}},setup:function(e,t){var n=e.editorConnection;n&&n.isRunningLocally()&&(t.on("nodeAdded.net.noodl.ParentComponentObject",function(e){h(e.id,e.parameters,n),e.on("parameterUpdated",function(){h(e.id,e.parameters,n)})}),t.on("nodeAdded.net.noodl.ComponentObject",function(){setTimeout(function(){d.emit("componentStateNodesChanged")},0)}),t.on("nodeRemoved.net.noodl.ComponentObject",function(){setTimeout(function(){d.emit("componentStateNodesChanged")})}))}};n.d(t,["default",0,f])},2620(e,t,n){"use strict";n.r(t);var i=n(1608);const o=(0,n(1848).extendSetComponentObjectProperties)({name:"net.noodl.SetParentComponentObjectProperties",displayName:"Set Parent Component Object Properties",docs:"https://docs.noodl.net/nodes/component-utilities/set-parent-component-object-properties",canFailToResolve:!0,inputs:{targetComponent:{type:"component",displayName:"Parent Component",group:"General",description:"Which ancestor to write to; leave blank for the nearest one that has a Component Object",set:function(e){this._internal.targetComponent=e||void 0,this.reportResolution()}}},resolveComponentObject:function(){var e=this.nodeScope.componentOwner,t=this._internal.targetComponent;if(t){var n=(0,i.GM)(e,t);return n?i.Gk.some(function(e){return n.nodeScope.getNodesWithType(e).length>0})?{id:"componentState"+n.getInstanceId(),name:n.name}:{missCode:"set-parent-component-object-properties/target-has-no-object",missMessage:'The component "'+t+'" has no Component Object node',missDetail:{target:t}}:{missCode:"set-parent-component-object-properties/target-not-found",missMessage:'No ancestor component named "'+t+'"',missDetail:{target:t,ancestors:(0,i.n6)(e)}}}var o=(0,i.findAncestorWithComponentObject)(e);return o?{id:"componentState"+o.getInstanceId(),name:o.name}:{missCode:"set-parent-component-object-properties/no-ancestor",missMessage:"No ancestor component has a Component Object node — nothing was written",missDetail:{ancestors:(0,i.n6)(e)}}}});n.d(t,["default",0,o])},1136(e,t,n){"use strict";n.r(t);var i=n(3538),o=n.n(i),r=n(7011),s=n.n(r),a=n(3518);const l={node:{name:"Cloud Function",category:"Cloud Services",color:"data",usePortAsLabel:"functionName",docs:"https://docs.noodl.net/nodes/data/cloud-data/cloud-function",deprecated:!0,replacedBy:"CloudFunction2",initialize:function(){this._internal.paramsValues={}},getInspectInfo:function(){var e=this._internal.lastCallResult;return e?[{type:"value",value:e}]:"[Not executed yet]"},inputs:{functionName:{description:"Name of the cloud function to run",type:"string",displayName:"Function Name",group:"General",set:function(e){this._internal.functionName=e}},params:{description:"Names of the parameters to send, each of which becomes an input port",group:"Parameters",type:{name:"stringlist",allowEditOnly:!0},set:function(e){this._internal.params=e}},call:{description:"Runs the named cloud function with the current parameter values",type:"signal",displayName:"Call",group:"Actions",valueChangedToTrue:function(){this.scheduleCall()}}},outputs:{success:{description:"Fires once the function has returned and Result is up to date",type:"signal",displayName:"Success",group:"Events"},failure:{description:"Fires when the call failed, and also when it succeeded without returning a result; this node carries no reason for either",type:"signal",displayName:"Failure",group:"Events"},result:{description:"Whatever the function returned, with records and arrays deserialised where they can be",type:"*",displayName:"Result",group:"Output",getter:function(){return this._internal.result}}},methods:{registerOutputIfNeeded:function(e){this.hasOutput(e)},setParamsValue:function(e,t){this._internal.paramsValues[e]=t},registerInputIfNeeded:function(e){this.hasInput(e)||e.startsWith("pm-")&&this.registerInput(e,{set:this.setParamsValue.bind(this,e.substring(3))})},scheduleCall:function(){var e=this._internal;e.hasScheduledCall||(e.hasScheduledCall=!0,this.scheduleAfterInputsHaveUpdated(this.doCall.bind(this)))},doCall:function(){var e=this;this._internal.hasScheduledCall=!1;var t=o().instance.getMetaData("cloudservices");if(void 0===t)return console.log("No cloud services defined in this project."),this._internal.lastCallResult={status:"failure",res:"No active cloud services in this project"},void this.sendSignalOnOutput("failure");var n=t.appId,i=t.endpoint;!function(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){var e=void 0;try{e=JSON.parse(n.response)}catch(e){}200===n.status||201===n.status?t.success(e):t.error(e)}},n.open(t.method||"GET",t.endpoint+e,!0),n.setRequestHeader("X-Parse-Application-Id",t.appId),n.setRequestHeader("Content-Type","application/json");var i=(0,a.parseSessionStore)(t.appId).read();void 0!==i&&n.setRequestHeader("X-Parse-Session-Token",i.sessionToken),n.send(JSON.stringify(t.content))}("/functions/"+encodeURIComponent(this._internal.functionName),{appId:n,endpoint:i,content:this._internal.paramsValues,method:"POST",success:function(t){var n=t.result;void 0!==n?(e._internal.result=s()._deserializeJSON(n),e.flagOutputDirty("result"),e._internal.lastCallResult={status:"success",result:e._internal.result},e.sendSignalOnOutput("success")):e.sendSignalOnOutput("failure")},error:function(t){e._internal.lastCallResult={status:"failure",res:t},e.sendSignalOnOutput("failure")}})}}},setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.Cloud Function",function(e){i(e)});for(var e=0,n=t.getNodesWithType("Cloud Function");e<n.length;e++)i(n[e])})}function i(e){function t(){var t=[],i=e.parameters.params;if(void 0!==i)for(var o=0,r=i.split(",");o<r.length;o++){var s=r[o];t.push({type:"*",plug:"input",group:"Parameters",name:"pm-"+s,displayName:s})}n.sendDynamicPorts(e.id,t)}t(),e.on("parameterUpdated",function(e){"params"===e.name&&t()})}}};n.d(t,["default",0,l])},3272(e,t,n){"use strict";n.r(t);var i=n(3538),o=n.n(i),r=n(3518),s=n(5162),a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};const l={node:{name:"CloudFunction2",displayName:"Cloud Function",category:"Cloud Services",color:"data",usePortAsLabel:"function",docs:"https://docs.noodl.net/nodes/data/cloud-data/cloud-function",initialize:function(){this._internal.paramsValues={},this._internal.resultsValues={}},getInspectInfo:function(){var e=this._internal.lastCallResult;return e?[{type:"value",value:e}]:"[Not executed yet]"},inputs:{call:{description:"Runs the selected cloud function with the current input values",type:"signal",displayName:"Call",group:"Actions",valueChangedToTrue:function(){this.scheduleCall()}}},outputs:a(a({},(0,s.outcomeOutputs)({group:"Events",done:"Fires once the function has returned and its result outputs are up to date",failure:"Fires when the function could not be reached or answered with an error, after the reason has been reported on the error channel"})),{error:{description:"Why the last call failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}}),methods:{setError:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,s.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:"cloud-function/call-failed",message:e})},getResultsValue:function(e){return this._internal.resultsValues[e]},registerOutputIfNeeded:function(e){this.hasOutput(e)||e.startsWith("out-")&&this.registerOutput(e,{getter:this.getResultsValue.bind(this,e.substring(4))})},setParamsValue:function(e,t){this._internal.paramsValues[e]=t},setFunctionName:function(e){this._internal.functionName=e},registerInputIfNeeded:function(e){this.hasInput(e)||("function"===e&&this.registerInput(e,{set:this.setFunctionName.bind(this)}),e.startsWith("in-")&&this.registerInput(e,{set:this.setParamsValue.bind(this,e.substring(3))}))},scheduleCall:function(){var e=this._internal;(e.pendingCall||(e.pendingCall=[])).push(this.beginOutcome()),e.hasScheduledCall||(e.hasScheduledCall=!0,this.scheduleAfterInputsHaveUpdated(this.doCall.bind(this)))},doCall:function(){var e=this;this._internal.hasScheduledCall=!1;var t=this._internal.pendingCall||[];this._internal.pendingCall=[];var n=o().instance.getMetaData("cloudservices");if(this.context.editorConnection&&(void 0===n||void 0===n.endpoint?this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"cloud-function-2",{message:"No cloud services defined in this project."}):void 0===this._internal.functionName?this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"cloud-function-2",{message:"No function specified"}):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"cloud-function-2")),void 0===n||void 0===n.endpoint){var i="No cloud services defined in this project.";return this._internal.lastCallResult={status:"failure",error:i},void this.setError(i,t)}var a=n.appId,l=n.endpoint;!function(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){var e=void 0;try{e=JSON.parse(n.response)}catch(e){}200===n.status||201===n.status?t.success(e):t.error(e,n.status)}},n.open(t.method||"GET",t.endpoint+e,!0),n.setRequestHeader("X-Parse-Application-Id",t.appId),n.setRequestHeader("Content-Type","application/json");var i=o().instance.getMetaData("cloudservices");i&&i.deployVersion&&n.setRequestHeader("x-noodl-cloud-version",i.deployVersion);var s=(0,r.parseSessionStore)(t.appId).read();void 0!==s&&n.setRequestHeader("X-Parse-Session-Token",s.sessionToken),n.send(JSON.stringify(t.content))}("/functions/"+encodeURIComponent(this._internal.functionName),{appId:a,endpoint:l,content:this._internal.paramsValues,method:"POST",success:function(n){if(null==n)e._internal.lastCallResult={status:"success",parameters:e._internal.paramsValues,results:"empty"};else{var i=n.result||{};for(var o in i)e._internal.resultsValues[o]=i[o],e.hasOutput("out-"+o)&&e.flagOutputDirty("out-"+o);e._internal.lastCallResult={status:"success",parameters:e._internal.paramsValues,results:e._internal.resultsValues}}(0,s.reportOutcomes)(e,t,"done")},error:function(n,i){var o=function(e){if("string"==typeof e)return e;if(null!==e&&"object"==typeof e){var t=e.message;if("string"==typeof t&&""!==t)return t;try{return JSON.stringify(e)}catch(t){return String(e)}}return String(e)}("string"==typeof n?n:n&&n.error||(0===i?"Could not reach the backend at "+l:"Failed running cloud function."));e._internal.lastCallResult={status:"failure",error:o},e.setError(o,t)}})}}},setup:function(){}};n.d(t,["default",0,l])},2889(e,t,n){"use strict";n.r(t),n.d(t,{ForEachComponent:()=>y});var i=n(1594),o=n.n(i),r=n(3538),s=n.n(r),a=n(1656),l=n.n(a),u=n(6835),c=n.n(u),d=n(1550),p=n(5162),h=n(1173),f=function(){return f=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},f.apply(this,arguments)},g=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})},m=function(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};function y(e){var t=e.didMount,n=e.willUnmount;return(0,i.useEffect)(function(){return t(),function(){n()}},[]),null}var v={name:"For Each",displayNodeName:"Repeater",docs:"https://docs.noodl.net/nodes/ui-controls/repeater",color:"visual",category:"Visual",dynamicports:[{name:"conditionalports/extended",condition:"templateType = explicit OR templateType NOT SET",inputs:["template"]},{name:"conditionalports/extended",condition:"templateType = dynamic",inputs:["templateScript"]}],initialize:function(){var e=this;this._internal.itemNodes=[],this._internal.itemOutputSignals={},this._internal.itemOutputs={},this._internal.collection=l().get(),l().keepPlainRowsApart(this._internal.collection),this._internal.queuedOperations=[],this._internal.pendingRefreshOutcomes=[],this._internal.mountedOperations=[],this._internal.collection.on("add",function(t){return g(e,void 0,void 0,function(){var e=this;return m(this,function(n){return this._internal.target?(this._queueOperation(function(){return g(e,void 0,void 0,function(){return m(this,function(e){switch(e.label){case 0:return[4,this.addItem(t.item,this._childIndexFor(t.index))];case 1:return e.sent(),[2]}})})}),[2]):[2]})})}),this._internal.collection.on("remove",function(t){e._queueOperation(function(){e.removeItem(t.item)})}),this._internal.onItemsCollectionChanged=function(){s().instance.getProjectSettings().repeaterDisabledWhenUnmounted&&!e.isMounted?e._internal.mountedOperations.push(function(){e._copyItems()}):e._queueOperation(function(){e._copyItems()})},this.addDeleteListener(function(){e._deleteAllItemNodes()})},inputs:{items:{group:"Data",displayName:"Items",type:"array",description:"The array or query result to repeat over; an empty value clears the list, including null and an empty array",set:function(e){this.setDiagnostic("repeater/items-not-a-collection",function(e){return null==e||Array.isArray(e)||l().instanceOf(e)?null:c().instanceOf(e)?"Items expects an array of records, received a single record. Nothing will render — wire a query or collection here, or an array containing this record.":"Items expects an array, received ".concat((0,d.bp)(e),". ")+"Nothing will render — a Repeater indexes its input by position, and this value has no length."}(e)),e!==this._internal.items&&this.bindCollection(e)}},templateType:{group:"Appearance",displayName:"Template Type",description:"Explicit uses one component for every item; Dynamic picks one per item by running Script",type:{name:"enum",enums:[{label:"Explicit",value:"explicit"},{label:"Dynamic",value:"dynamic"}]},default:"explicit",set:function(e){this._internal.templateType=e,this.scheduleRefresh()}},template:{type:"component",displayName:"Template",description:"Component to create once per item, with the item available to it as its Component Object",group:"Appearance",set:function(e){this._internal.template=e,this.scheduleRefresh()}},templateScript:{type:{name:"string",codeeditor:"javascript",allowEditOnly:!0},displayName:"Script",description:"JavaScript run per item that sets `component` to a component path; the item is available as `item`",group:"Appearance",default:"// Set the 'component' variable to the name of the desired component for this item.\n// Component name must start with a '/'.\n// A component in a sheet is referred to by '/#Sheet Name/Comopnent Name'.\n// The data for each item is available in a variable called 'item'\ncomponent = '/MyComponent';",set:function(e){var t="repeater/template-script-syntax-error";try{this._internal.templateFunction=new Function("item","var component;"+e+";return component;"),this.context.editorConnection&&this.context.editorConnection.clearWarning&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,t)}catch(e){this._internal.templateFunction=void 0,this.raiseRuntimeError(t,"The Repeater's Script does not compile: ".concat(e.message),e)}this.scheduleRefresh()}},refresh:{group:"Appearance",displayName:"Refresh",description:"Rebuilds every item from the current Items, discarding any state the item components held",type:"signal",valueChangedToTrue:function(){this._internal.pendingRefreshOutcomes.push(this.beginOutcome()),this.scheduleRefresh()}}},outputs:f({itemActionItemId:{type:"string",group:"Values",displayName:"Item Id",description:"Id of the item whose Repeater Item node last raised an action",getter:function(){return this._internal.itemActionItemId}},itemsRendered:{type:"signal",group:"Events",displayName:"Items Rendered",description:"Fires when rows were added or removed, once every item component exists; item creation is spread across frames, so this is the only honest moment to measure or scroll the list"}},(0,p.outcomeOutputs)({done:"Fires once a Refresh has torn the list down and rebuilt it from the current Items, including when that leaves the list empty",failure:"Fires when the Repeater could not rebuild: no Items bound, no Template set, or nothing to render into"})),prototypeExtensions:{updateTarget:function(e){this._internal.target=e?this.nodeScope.getNodeWithId(e):void 0,this.scheduleRefresh()},setNodeModel:function(e){var t=this;r.Node.prototype.setNodeModel.call(this,e),e.parent&&this.updateTarget(e.parent.id),e.on("parentUpdated",function(e){t.updateTarget(e?e.id:void 0)},this)},scheduleRefresh:function(){var e=this,t=this._internal;t.hasScheduledRefresh||(t.hasScheduledRefresh=!0,this.scheduleAfterInputsHaveUpdated(function(){e._queueOperation(function(){return e.refresh()})}))},unbindCurrentCollection:function(){var e=this._internal.items;e&&(l().instanceOf(e)&&e.off("change",this._internal.onItemsCollectionChanged),this._internal.items=void 0)},bindCollection:function(e){var t=this._internal;this.unbindCurrentCollection(),l().instanceOf(e)&&e.on("change",this._internal.onItemsCollectionChanged),t.items=e,this.scheduleCopyItems()},reportTemplateProblem:function(e,t){var n=this._internal.reportedTemplateProblems;if(n){if(n.has(t))return;n.add(t)}this.raiseRuntimeError(e,t)},getTemplateForModel:function(e){var t,n=this._internal;if(void 0===n.templateType||"explicit"===n.templateType)return n.template;if(n.templateFunction){var i;try{i=n.templateFunction(e)}catch(e){this.raiseRuntimeError("repeater/template-script-threw","The Repeater's Script threw while choosing a component for an item, so that item has no row: ".concat(e.message),e)}if(!i||"string"==typeof i){if(i&&(i.startsWith("./")&&(i=this.model.component.name+i.substring(1)),i.startsWith("../"))){var o=this.model.component.name.split("/");i=o.slice(0,o.length-1).join("/")+i.substring(2)}return i}this.raiseRuntimeError("repeater/template-script-threw","The Repeater's Script set component to ".concat(null!==(t=JSON.stringify(i))&&void 0!==t?t:String(i),", which is not a component path, so that item has no row"))}},_mapInputs:function(e,t){var n;if(void 0!==this._internal.inputMapFunc)try{this._internal.inputMapFunc(function(n){for(var i in n)if(e.hasInput(i)){var o=n[i];"function"==typeof o?e.setInputValue(i,o(t)):"string"==typeof o&&e.setInputValue(i,t.get(o))}},t)}catch(e){this.raiseRuntimeError("repeater/input-mapping-threw","The Repeater's input mapping threw for the item ".concat(JSON.stringify(t.getId()),", so its row keeps the inputs it had: ").concat(null!==(n=null==e?void 0:e.message)&&void 0!==n?n:String(e)),e)}},addItem:function(e,t){return g(this,void 0,void 0,function(){var n,i,o,r,s,a,l,u,c=this;return m(this,function(d){switch(d.label){case 0:if(n=this._internal,!(i=this.getTemplateForModel(e)))return this.reportTemplateProblem("repeater/no-template-for-item","dynamic"===n.templateType?"The Repeater's Script returned no component for an item, so that item has no row — set `component` to a component path in the Script":"The Repeater has no Template, so its items have no rows — pick the component to repeat on the Template input"),[2];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.nodeScope.createNode(i,(0,h.A)(),{_forEachModel:e,_forEachNode:this})];case 2:return o=d.sent(),[3,4];case 3:return r=d.sent(),this.context.hasComponentModelWithName(i)?this.reportTemplateProblem("repeater/row-build-failed","The Repeater could not build a row from ".concat(JSON.stringify(i),", so its items have no rows: ").concat(null!==(u=null==r?void 0:r.message)&&void 0!==u?u:String(r))):this.reportTemplateProblem("repeater/template-component-not-found","The Repeater cannot find the component ".concat(JSON.stringify(i),", so its items have no rows — it may have been renamed or deleted")),[2];case 4:if(void 0===this._internal.inputMapFunc){for(s in o.hasInput("Id")&&o.setInputValue("Id",e.getId()),o.hasInput("id")&&o.setInputValue("id",e.getId()),o._inputs)void 0!==e.data[s]&&o.setInputValue(s,e.data[s]);o._forEachModelChangeListener=function(e){o._inputs[e.name]&&o.setInputValue(e.name,e.value)},e.on("change",o._forEachModelChangeListener),o.componentModel.on("inputPortAdded",function(t){"id"===t.name&&o.setInputValue("id",e.getId()),"Id"===t.name&&o.setInputValue("Id",e.getId()),void 0!==e.data[t.name]&&o.setInputValue(t.name,e.data[t.name])},this)}else this._mapInputs(o,e),o._forEachModelChangeListener=function(){return c._mapInputs(o,e)},e.on("change",o._forEachModelChangeListener);for(o._internal.creatorCallbacks={onOutputChanged:function(t,i,r){!1!==r&&void 0!==r||!0!==i||!n.itemOutputSignals[t]||c.itemOutputSignalTriggered(t,e,o)}},a=o.nodeScope.getNodesWithType("For Each Actions"),l=0;l<a.length;l++)a[l].signalAdded();return n.itemNodes.push(o),n.target.addChild(o,t),n.rowsChanged=!0,[2]}})})},removeItem:function(e){var t=this,n=this._internal;if(n.target){var i=function(){for(var t=0,i=n.target.getChildren();t<i.length;t++){var o=i[t];if(o._forEachModel===e&&!o._forEachRemoveInProgress)return o}}();if(i){n.rowsChanged=!0;var o=i.nodeScope.getNodesWithType("For Each Actions");o&&o.length>0?(i._forEachRemoveInProgress=!0,o[0].tryRemove(function(){return t._deleteItem(i)})):this._deleteItem(i);var r=n.itemNodes.indexOf(i);-1!==r&&n.itemNodes.splice(r,1)}}},_deleteItem:function(e){e._forEachModel.off("change",e._forEachModelChangeListener),e.model&&e.model.removeListenersWithRef(this),e.componentModel&&e.componentModel.removeListenersWithRef(this);var t=e.parent;!e._deleted&&t&&(t.removeChild(e),this.nodeScope.deleteNode(e))},_deleteAllItemNodes:function(){if(this._internal.itemNodes){for(var e=0,t=this._internal.itemNodes;e<t.length;e++){var n=t[e];this._deleteItem(n)}this._internal.itemNodes=[]}},refresh:function(){return g(this,void 0,void 0,function(){var e,t,n,i,o,r,s,a,l=this;return m(this,function(u){switch(u.label){case 0:if((e=this._internal).hasScheduledRefresh=!1,t=e.pendingRefreshOutcomes,e.pendingRefreshOutcomes=[],n=function(e,n,i){for(var o=0,r=t;o<r.length;o++){var s=r[o];l.reportOutcome(s,e,"failure"===e?{code:n,message:i}:void 0)}},e.reportedTemplateProblems=new Set,(i=void 0===e.templateType||"explicit"===e.templateType)?!e.template:!e.templateFunction)return n("failure","repeater/no-template",i?"The Repeater has no Template, so there is nothing to build each item from":"The Repeater picks each component with its Script, and it has no Script that compiles, so there is nothing to build each item from"),[2];if(!e.items)return n("failure","repeater/no-items","The Repeater has no Items bound, so there is no list to rebuild"),[2];o=e.queuedOperations.length;try{this._copyItems()}catch(t){return e.queuedOperations.length=o,n("failure","repeater/items-copy-threw","The Repeater could not copy its Items, so it did not rebuild: ".concat(null!==(a=null==t?void 0:t.message)&&void 0!==a?a:String(t))),[2]}if(e.queuedOperations.length=o,e.itemNodes.length>0&&(e.rowsChanged=!0),this._deleteAllItemNodes(),!e.target)return n("failure","repeater/no-target","The Repeater is not inside anything that can hold its items, so there is nowhere to render them"),[2];for(r=[],s=0;s<e.collection.size();s++)r.push(e.collection.get(s));s=0,u.label=1;case 1:return s<r.length?[4,this.addItem(r[s],this._childIndexFor(s))]:[3,4];case 2:u.sent(),u.label=3;case 3:return s++,[3,1];case 4:return n("done"),[2]}})})},_queueOperation:function(e){this._internal.queuedOperations.push(e),this._runQueueOperations()},_runQueueOperations:function(){return g(this,void 0,void 0,function(){var e,t,n,i,o=this;return m(this,function(r){switch(r.label){case 0:return this.runningOperations?[2]:(this.runningOperations=!0,e=s().instance.getProjectSettings().repeaterCreateComponentsAsync,this._internal.rowsChanged=!1,e?(t=function(){return g(o,void 0,void 0,function(){var e,n,i;return m(this,function(o){switch(o.label){case 0:e=performance.now(),o.label=1;case 1:if(!(this._internal.queuedOperations.length&&performance.now()-e<25))return[3,6];n=this._internal.queuedOperations.shift(),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,n()];case 3:return o.sent(),[3,5];case 4:return i=o.sent(),this._operationThrew(i),[3,5];case 5:return[3,1];case 6:return this._internal.queuedOperations.length?setTimeout(t,0):(this.runningOperations=!1,this._signalItemsRendered()),[2]}})})},t(),[3,7]):[3,1]);case 1:if(!this._internal.queuedOperations.length)return[3,6];n=this._internal.queuedOperations.shift(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,n()];case 3:return r.sent(),[3,5];case 4:return i=r.sent(),this._operationThrew(i),[3,5];case 5:return[3,1];case 6:this.runningOperations=!1,this._signalItemsRendered(),r.label=7;case 7:return[2]}})})},_operationThrew:function(e){var t;this.raiseRuntimeError("repeater/operation-threw","The Repeater could not change its rows: ".concat(null!==(t=null==e?void 0:e.message)&&void 0!==t?t:String(e)),e)},_signalItemsRendered:function(){this._internal.rowsChanged&&!this._deleted&&this.sendSignalOnOutput("itemsRendered")},_onNodeDeleted:function(){r.Node.prototype._onNodeDeleted.call(this),this._internal.queuedOperations.length=0,this.unbindCurrentCollection()},render:function(){var e=this;return o().createElement(y,{key:this.id,didMount:function(){return e.didMount()},willUnmount:function(){return e.willUnmount()}})},didMount:function(){this.isMounted=!0;for(var e=0,t=this._internal.mountedOperations;e<t.length;e++){var n=t[e];this._queueOperation(n)}this._internal.mountedOperations=[]},willUnmount:function(){this.isMounted=!1},getItemActionParameter:function(e){if(this._internal.itemActionParameters)return this._internal.itemActionParameters[e]},scheduleCopyItems:function(){var e=this;this._internal.hasScheduledCopyItems||(this._internal.hasScheduledCopyItems=!0,this.scheduleAfterInputsHaveUpdated(function(){if(e._internal.hasScheduledCopyItems=!1,s().instance.getProjectSettings().repeaterDisabledWhenUnmounted&&!e.isMounted)e._internal.mountedOperations.push(function(){e._copyItems()});else try{e._copyItems()}catch(t){e._operationThrew(t)}}))},_childIndexFor:function(e){for(var t=this._internal,n=t.target.getChildren(),i=n.indexOf(this)+1,o=0,r=i;r<n.length;r++)if(-1!==t.itemNodes.indexOf(n[r])){if(o===e)return r;o++,i=r+1}return i},_copyItems:function(){var e=this._internal,t=e.items,n=0;if(t&&"number"==typeof t.length)for(var i=0;i<t.length;i++)null!==t[i]&&void 0!==t[i]||n++;0!==n?(e.reportedEmptyEntriesIn!==t&&(e.reportedEmptyEntriesIn=t,this.raiseRuntimeError("repeater/items-empty-entry",1===n?"The Repeater's Items has an empty entry (null or undefined), so it has no row":"The Repeater's Items has ".concat(n," empty entries (null or undefined), so they have no rows"))),e.collection.set(Array.prototype.filter.call(t,function(e){return null!=e}))):e.collection.set(e.items)},itemOutputSignalTriggered:function(e,t,n){var i,o,r=this;(null!==(i=(o=this._internal).pendingItemSignals)&&void 0!==i?i:o.pendingItemSignals=[]).push({name:e,model:t,itemNode:n}),this._internal.hasScheduledTriggerItemOutputSignal||(this._internal.hasScheduledTriggerItemOutputSignal=!0,this.context.scheduleAfterUpdate(function(){var e;r._internal.hasScheduledTriggerItemOutputSignal=!1;var t=null!==(e=r._internal.pendingItemSignals)&&void 0!==e?e:[];r._internal.pendingItemSignals=[];for(var n=0,i=t;n<i.length;n++){var o=i[n],s=o.name,a=o.model,l=o.itemNode;for(var u in r._internal.itemActionItemId=a.getId(),r.flagOutputDirty("itemActionItemId"),l._outputs){var c="itemOutput-"+u;r.hasOutput(c)&&(r._internal.itemOutputs[u]=l._outputs[u].value,r.flagOutputDirty(c))}r.sendSignalOnOutput("itemOutputSignal-"+s)}}))},getItemOutput:function(e){return this._internal.itemOutputs[e]},registerOutputIfNeeded:function(e){this.hasOutput(e)||(e.startsWith("itemOutputSignal-")?(this._internal.itemOutputSignals[e.substring(17)]=!0,this.registerOutput(e,{getter:function(){}})):e.startsWith("itemOutput-")&&this.registerOutput(e,{getter:this.getItemOutput.bind(this,e.substring(11))}))},setInputMappingScript:function(e){var t="repeater/input-mapping-syntax-error";if(this.context.editorConnection&&this.context.editorConnection.clearWarning&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,t),this._internal.inputMappingScript=e,this._internal.inputMappingScript)try{this._internal.inputMapFunc=new Function("map","object",this._internal.inputMappingScript)}catch(e){this._internal.inputMapFunc=void 0,this.raiseRuntimeError(t,"The Repeater's input mapping script does not compile, so no item inputs are mapped: ".concat(e.message),e)}else this._internal.inputMapFunc=void 0;this.scheduleRefresh()},registerInputIfNeeded:function(e){if(!this.hasInput(e))return"inputMappingScript"===e?this.registerInput(e,{set:this.setInputMappingScript.bind(this)}):void 0}}};function b(e){return"object"==typeof e?e.name:e}const w={node:v,setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.For Each",function(e){i(e)});for(var e=0,n=t.getNodesWithType("For Each");e<n.length;e++)i(n[e])})}function i(e){function i(){var i=e.parameters.template;if(void 0!==i){var o=[],r=t.components[i];if(void 0!==r){for(var s in r.outputPorts)"signal"===b((u=r.outputPorts[s]).type)?o.push({name:"itemOutputSignal-"+s,displayName:s,type:"signal",plug:"output",group:"Item Signals"}):o.push({name:"itemOutput-"+s,displayName:s,type:u.type,plug:"output",group:"Item Outputs"});var a="";for(var l in r.inputPorts){var u;"signal"!==b((u=r.inputPorts[l]).type)&&(a+="\t'"+l+"': '"+l+"',\n")}o.push({name:"inputMappingScript",type:{name:"string",codeeditor:"javascript"},displayName:"Script",group:"Input Mapping",default:"// Here you add mappings between the properties of the item objects and the inputs of the components.\n// 'myComponentInput': 'myObjectProperty',\n// 'anotherComponentInput': function () { return object.get('someProperty') + ' ' + object.get('otherProp') }\n// These are the default mappings based on the selected template component.\nmap({\n{{#mappings}}})\n".replace("{{#mappings}}",a),plug:"input"}),n.sendDynamicPorts(e.id,o,{detectRenamed:{plug:"output",prefix:"itemOutput"}})}}}function o(e){if(void 0!==e){var n=t.components[e];void 0!==n&&(n.on("outputPortAdded",i),n.on("outputPortRemoved",i),n.on("outputPortTypesUpdated",i),n.on("inputPortTypesUpdated",i),n.on("inputPortAdded",i),n.on("inputPortRemoved",i))}}i(),o(e.parameters.template),e.on("parameterUpdated",function(t){"template"===t.name&&(i(),o(e.parameters.template))})}}};n.d(t,["default",0,w])},3952(e,t,n){"use strict";n.r(t);var i=n(3538),o=n(3099),r=n(5162),s=function(){return s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};const a={node:{name:"For Each Actions",docs:"https://docs.noodl.net/nodes/ui-controls/repeater-item",displayNodeName:"Repeater Item",category:"Data",color:"data",inputs:{removeCompleted:{type:{name:"boolean",allowConnectionsOnly:!0},displayName:"Remove Completed",description:"Tells the Repeater the exit work is finished and this item may now be destroyed; needed only when Try Remove is connected",group:"Actions",valueChangedToTrue:function(){var e=this.beginOutcome(),t=this._internal.removeCompletedCallback;this._internal.removeCompletedCallback=void 0,t&&t(),this.reportOutcome(e,t?"done":"unchanged")}}},outputs:s({added:{type:"signal",displayName:"Added",description:"Fires once this repeated item has been created and Item Id is available",group:"Events"},tryRemove:{type:"signal",displayName:"Try Remove",description:"Fires before the Repeater destroys this item, and holds the removal until Remove Completed is pulsed — connect it only if something must run first",group:"Events"},itemId:{type:"string",displayName:"Item Id",description:"Id of the record this repeated item was created for",group:"General",get:function(){return this.getItemId()}}},(0,r.outcomeOutputs)({done:"Fires when a removal really was waiting on this handshake and has now been released",unchanged:"Fires when no removal was waiting — Try Remove had not been raised, or this handshake was already completed"})),prototypeExtensions:{getItemId:function(){var e=(0,o.resolveForEachItem)(this);return e&&e.getId()},_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this),(0,o.forgetForEachItem)(this)},signalAdded:function(){this.sendSignalOnOutput("added")},tryRemove:function(e){this.getOutput("tryRemove").hasConnections()?(this._internal.removeCompletedCallback=e,this.sendSignalOnOutput("tryRemove")):this.scheduleAfterInputsHaveUpdated(function(){e()})}}},setup:function(){}};n.d(t,["default",0,a])},8477(e,t,n){"use strict";n.r(t);var i=n(3538);const o={node:{name:"Event Receiver",docs:"https://docs.noodl.net/nodes/events/receive-event",displayNodeName:"Receive Event",category:"Events",usePortAsLabel:"channelName",color:"component",initialize:function(){var e=this._internal;e.outputValues={},e.outputNames=[],e.eventReceived=!1,e._isEnabled=!0,e.channelName=""},inputs:{enabled:{group:"Values",displayName:"Enabled",type:"boolean",default:!0,description:"Whether events on this channel are acted on; while off they are ignored and not passed to another receiver either",set:function(e){this._internal._isEnabled=!!e}},consume:{group:"Values",displayName:"Consume",type:{name:"enum",enums:[{label:"Never",value:"never"},{label:"Always",value:"always"}]},default:"never",description:"Whether receiving an event stops it reaching other receivers on the same channel. Applies to Parent, Children and Siblings events; a Global event reaches every receiver",set:function(e){this._internal.consume=e}},channelName:{group:"Values",type:{name:"string",identifierOf:"EventChannelName"},displayName:"Channel",description:"Name to listen on, which must match a Send Event exactly; nothing reports a name no sender uses",set:function(e){this._internal.onEventReceivedCallback&&(this.context.eventSenderEmitter.removeListener(this._internal.channelName,this._internal.onEventReceivedCallback),this._internal.onEventReceivedCallback=null),this._internal.channelName=e,this.registerListenersForChannel(e)}}},outputs:{eventReceived:{group:"Events",displayName:"Received",type:"signal",description:"Fires when an event arrives on Channel, once the payload outputs carry that event's values"}},prototypeExtensions:{registerOutputIfNeeded:function(e){if(!this.hasOutput(e)){var t=this;this._internal.outputNames.push(e),this.registerOutput(e,{getter:function(){return t._internal.outputValues[e]}})}},handleEvent:function(e){if(!1!==this._internal._isEnabled){for(var t in e)this.hasOutput(t)&&(this._internal.outputValues[t]=e[t],this.flagOutputDirty(t));return this.sendSignalOnOutput("eventReceived"),"always"===this._internal.consume}},onEventReceived:function(e){this.handleEvent(e)},_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this),this._internal.onEventReceivedCallback&&this.context.eventSenderEmitter.removeListener(this._internal.channelName,this._internal.onEventReceivedCallback)},registerListenersForChannel:function(e){var t=this.context.eventSenderEmitter;this._internal.onEventReceivedCallback=this.onEventReceived.bind(this),t.on(e,this._internal.onEventReceivedCallback);var n=this;this.context.eventEmitter.once("applicationDataReloaded",function(){n._internal.onEventReceivedCallback&&t.removeListener(e,n._internal.onEventReceivedCallback)})},getChannelName:function(){return this._internal.channelName}}},setup:function(e,t){var n=e.editorConnection;function i(e){var i=e.parameters.channelName;function o(){var o=t.getNodesWithType("Event Sender").filter(function(e){return e.parameters.channelName===i}),r={};o.forEach(function(e){for(var t=e.parameters.payload,n=0,i=t?t.split(","):[];n<i.length;n++){var o=i[n];r[o]=!0}});var s=[];for(var a in r)s.push({name:a,type:"*",plug:"output",group:"Values",displayName:a});n.sendDynamicPorts(e.id,s,{detectRenamed:{plug:"output"}})}function r(e){e.on("inputPortAdded",function(){o()}),e.on("inputPortRemoved",function(){o()}),e.on("parameterUpdated",function(e){"channelName"===e.name&&o()})}o(),e.on("parameterUpdated",function(e){"channelName"===e.name&&(i=e.value,o())}),t.getNodesWithType("Event Sender").forEach(r),t.on("nodeAdded.Event Sender",r),t.on("nodeRemoved.Event Sender",function(){o()})}n&&n.isRunningLocally()&&t.on("editorImportComplete",function(){t.on("nodeAdded.Event Receiver",function(e){return i(e)}),t.getNodesWithType("Event Receiver").forEach(function(e){return i(e)})})}};n.d(t,["default",0,o])},7089(e,t,n){"use strict";n.r(t);var i=n(5162),o=function(){return o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function r(e,t,n){var i=[],o=t.payload;if(o)for(var r=0,s=o.split(",");r<s.length;r++){var a=s[r];i.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input",group:"Payload",name:a,displayName:a})}n.sendDynamicPorts(e,i,{detectRenamed:{plug:"input"}})}const s={node:{name:"Event Sender",docs:"https://docs.noodl.net/nodes/events/send-event",displayNodeName:"Send Event",category:"Events",usePortAsLabel:"channelName",color:"component",exportDynamicPorts:!0,initialize:function(){this._internal.inputValues={},this._internal.channelName="",this._internal.propagation="global"},inputs:{sendEvent:{group:"Actions",displayName:"Send",description:"Sends one event on Channel Name, after every payload input has settled",valueChangedToTrue:function(){var e=this,t=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(function(){if(!e._internal.channelName){var n="No channel name, so the event was not sent";return e._internal.lastError=n,e.flagOutputDirty("error"),void e.reportOutcome(t,"failure",{code:"event-sender/no-channel",message:n})}"global"===e._internal.propagation?e.context.sendGlobalEventFromEventSender(e._internal.channelName,e._internal.inputValues):e.nodeScope.sendEventFromThisScope(e._internal.channelName,e._internal.inputValues,e._internal.propagation),e.reportOutcome(t,"done")})}},channelName:{type:{name:"string",allowEditOnly:!0,identifierOf:"EventChannelName",identifierDisplayName:"Event Channels"},default:"",group:"Settings",displayName:"Channel Name",description:"Name every Receive Event must match to hear this; nothing reports a name no receiver listens on",set:function(e){this._internal.channelName=e,this._internal.inputValues._channelName=e}},propagation:{type:{name:"enum",enums:[{value:"global",label:"Global"},{value:"parent",label:"Parent"},{value:"children",label:"Children"},{value:"siblings",label:"Siblings"}]},default:"global",group:"Settings",displayName:"Send to",description:"How far the event travels: the whole app, or only the receivers above, below or beside this node",set:function(e){this._internal.propagation=e}},payload:{type:{name:"stringlist",allowEditOnly:!0},description:"Names of the values to carry with the event; each becomes an input here and an output on every matching Receive Event",group:"Payload"}},outputs:o(o({},(0,i.outcomeOutputs)({done:"Fires once the event has been dispatched to every matching receiver",failure:"Fires when the event could not be sent, which today means Channel Name was left empty"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Why the last send failed, empty when the last send succeeded",getter:function(){return this._internal.lastError}}}),prototypeExtensions:{registerInputIfNeeded:{value:function(e){if(!this.hasInput(e)){var t=this;this.registerInput(e,{set:function(n){t._internal.inputValues[e]=n}})}}}}},setup:function(e,t){var n=e.editorConnection;n&&n.isRunningLocally()&&t.on("nodeAdded.Event Sender",function(e){r(e.id,e.parameters,n),e.on("parameterUpdated",function(){r(e.id,e.parameters,n)})})}};n.d(t,["default",0,s])},5533(e,t,n){"use strict";n.r(t);var i=n(3538),o=n(8600),r=n.n(o),s=n(7831),a=n(1173),l=function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))};function u(e){if(e&&e.message)return String(e.message);try{return String(e)}catch(t){return typeof e}}function c(e,t){var n=null!==t&&"object"==typeof t?Object.getPrototypeOf(t):null,i=n&&n.constructor&&n.constructor.name?n.constructor.name+": ":"";console.log("Error in JS node "+e+" code.",i+u(t))}function d(){this._internal.setupScheduled||(this._internal.setupScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.killed||(this._callSetupFunction(),this._internal.setupScheduled=!1)}))}function p(){this._internal.runScheduled||this._internal.killed||(this._internal.runScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.killed||(this._callRunFunction(),this._internal.changedInputs={},this._internal.runScheduled=!1)}))}function h(e){this._internal.signalScheduled[e]||this._internal.killed||(this._internal.signalScheduled[e]=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.killed||(this._callSignalFunction(e),this._internal.signalScheduled[e]=!1)}))}function f(){this._internal.runNextFrame=!1,p.call(this)}function g(e){return"string"==typeof e?e:e.name}function m(e,t,n){var i=("input"===t?e.model.inputPorts:e.model.outputPorts)[n],o=void 0!==i?i.type:e._internal.codePorts[t][n];return void 0!==o&&"signal"===g(o)}function y(e,t){!0===this._internal.hasParsedCode?m(this,"input",e)?this._internal.definedObject&&"function"==typeof this._internal.definedObject[e]&&t&&h.call(this,e):(this._internal.inputValues[e]=t,this._internal.changedInputs[e]=!0,p.call(this)):this._internal.inputQueue.push({name:e,value:t})}function v(e){return this._internal.outputValues[e]}const b={node:{name:"Javascript2",docs:"https://docs.noodl.net/nodes/javascript/script",displayNodeName:"Script",category:"CustomCode",color:"javascript",ssr:{compat:"partial",note:"Runs user code server-side; code touching window/document fails there (error logged, outputs unchanged)."},nodeDoubleClickAction:{focusPort:"Code"},searchTags:["javascript"],exportDynamicPorts:!0,initialize:function(){var e=this._internal;e.inputValues={},e.outputValues={},e.outputProperties={},e.runScheduled=!1,e.setupScheduled=!1,e.runNextFrameScheduled=!1,e.isWaitingForExternalFileToLoad=!1,e.useExternalFile=!1,e.runFunction=void 0,e.destroyFunction=void 0,e.setupFunction=void 0,e.hasParsedCode=!1,e.codePorts={input:{},output:{}},e.changedInputs={},e.signalScheduled={},e.killed=!1,e.inputQueue=[];var t=this;e.userFunctionScope={createComponent:function(e){return e&&e.length>0&&"/"!==e[0]&&(e="/"+e),t.nodeScope.createNode(e,(0,a.A)())},deleteComponent:function(e){t.nodeScope.deleteNode(e)},flagOutputDirty:function(e){if(!e)throw new Error("Output port name must be specified");t.flagOutputDirty(e)},runNextFrame:function(){e.runNextFrameScheduled||(e.runNextFrameScheduled=!0,t.context.scheduleNextFrame(function(){e.runNextFrameScheduled=!1,e.killed||p.call(t)}))},sendSignalOnOutput:function(e){t.sendSignalOnOutput(e)}},e.onFrameStart=f.bind(this)},dynamicports:[{condition:"useExternalFile = no OR useExternalFile NOT SET",inputs:["code"]},{condition:"useExternalFile = yes",inputs:["externalFile"]}],inputs:{scriptInputs:{type:{name:"proplist",allowEditOnly:!0},group:"Script Inputs",description:"Names of the values the script reads, each becoming an input port",set:function(){}},scriptOutputs:{type:{name:"proplist",allowEditOnly:!0},group:"Script Outputs",description:"Names of the values the script writes, each becoming an output port",set:function(){}},useExternalFile:{type:{name:"enum",enums:[{value:"yes",label:"Yes"},{value:"no",label:"No"}],allowEditOnly:!0},default:"no",displayName:"Use External File",group:"Code",description:"Whether the code is loaded from File Path instead of being typed into Code",set:function(e){this._internal.isWaitingForExternalFileToLoad="yes"===e,this._internal.useExternalFile="yes"===e}},code:{displayName:"Code",group:"Code",description:"The script, which declares its own ports through the define API",type:{name:"string",allowEditOnly:!0,codeeditor:"javascript",codenotation:"script"},default:"",set:function(e){if(e){var t=this;this.scheduleAfterInputsHaveUpdated(function(){if(!1===this._internal.useExternalFile){this._callDestroyFunction();var n=r().createFromCode(e,{node:this});t._onCodeParsed(n)}})}}},externalFile:{displayName:"File Path",group:"Code",description:"Where to load the script from; used only when Use External File is Yes",type:{name:"source",allowEditOnly:!0},set:function(e){if(!1!==this._internal.useExternalFile){var t=this;r().createFromURL(e,function(e){t._internal.isWaitingForExternalFileToLoad=!1,t._onCodeParsed(e)},{node:this})}}}},prototypeExtensions:{_onNodeDeleted:function(){i.Node.prototype._onNodeDeleted.call(this),this._internal.killed=!0,this._callDestroyFunction()},update:function(){!0===this._internal.isWaitingForExternalFileToLoad?this._dirty=!1:i.Node.prototype.update.call(this)},_onCodeParsed:function(e){var t=this,n=this.context.editorConnection;if(n)for(var i=0,o=["js-parse-waring","js-destroy-waring","js-run-waring","js-setup-waring"];i<o.length;i++){var r=o[i];n.clearWarning(this.nodeScope.componentOwner.name,this.id,r)}if(e.error)return n&&this.context.isWarningTypeEnabled("javascriptExecution")&&n.sendWarning(this.nodeScope.componentOwner.name,this.id,"js-parse-waring",{showGlobally:!0,message:e.error}),void this.raiseRuntimeError("script/source-failed","The script could not be loaded: "+e.error,{error:e.error});Object.keys(this.model.inputPorts).forEach(function(e){var n=t.model.inputPorts[e].type;"color"!==n&&"color"!==n.name||(t._internal.inputValues[e]=void 0,t.hasInput(e)?t.getInput(e).type="color":t.registerInput(e,{type:"color",set:y.bind(t,e)}))});for(var s={input:{},output:{}},a=0,u=e.getPorts();a<u.length;a++){var c=u[a];"input"!==c.plug&&"output"!==c.plug||void 0===c.type||(s[c.plug][c.name]=c.type)}this._internal.codePorts=s;var h=Object.keys(s.output).filter(function(e){return"signal"===g(s.output[e])});if(new Set(l(l([],Object.keys(this.model.outputPorts),!0),h,!0)).forEach(function(e){t.registerOutputIfNeeded(e)}),this._internal.setupFunction=e.setup,this._internal.runFunction=e.change,this._internal.destroyFunction=e.destroy,this._internal.definedObject=e.definedObject,this._internal.setupFunction&&d.call(this),this._internal.runFunction&&p.call(this),this._internal.hasParsedCode=!0,this._internal.inputQueue){for(var f=0,m=this._internal.inputQueue;f<m.length;f++){var v=m[f],b=v.name,w=v.value;this.setInputValue(b,w)}this._internal.inputQueue=void 0}e.apis.Node.Inputs=this._internal.inputValues,e.apis.Node.Outputs=this._internal.outputProperties},registerInputIfNeeded:function(e){this.hasInput(e)||(this._internal.inputValues[e]=void 0,this.registerInput(e,{set:y.bind(this,e)}))},registerOutputIfNeeded:function(e){if(!this.hasOutput(e)){var t=this,n=function(){return m(t,"output",e)};Object.defineProperty(this._internal.outputProperties,e,{set:function(i){n()||(t._internal.outputValues[e]=i,t.flagOutputDirty(e))},get:function(){return n()?function(){t.hasOutput(e)&&t.sendSignalOnOutput(e)}:t._internal.outputValues[e]}}),this.registerOutput(e,{getter:v.bind(this,e)})}},_callRunFunction:function(){var e=this._internal;if(e.runFunction&&!e.killed)try{e.runFunction.call(e.userFunctionScope,e.inputValues,e.outputProperties,e.changedInputs)}catch(e){(0,s.logJavaScriptNodeError)(e),this.context.editorConnection&&this.context.isWarningTypeEnabled("javascriptExecution")&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"js-run-waring",{showGlobally:!0,message:"<strong>run</strong>: "+u(e)})}},_callSignalFunction:function(e){var t=this._internal;if(t.definedObject&&!t.killed&&t.definedObject[e]&&"function"==typeof t.definedObject[e])try{t.definedObject[e].call(t.userFunctionScope,t.inputValues,t.outputProperties)}catch(e){c("signal function",e),this.context.editorConnection&&this.context.isWarningTypeEnabled("javascriptExecution")&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"js-run-waring",{showGlobally:!0,message:"<strong>run</strong>: "+u(e)})}},_callDestroyFunction:function(){var e=this._internal;if(e.destroyFunction)try{e.destroyFunction.call(e.userFunctionScope,e.inputValues,e.outputProperties)}catch(e){c("destroy",e),this.context.editorConnection&&this.context.isWarningTypeEnabled("javascriptExecution")&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"js-destroy-waring",{showGlobally:!0,message:"<strong>setup</strong>: "+u(e)})}},_callSetupFunction:function(){var e=this._internal;if(e.setupFunction&&!e.killed)try{e.setupFunction.call(e.userFunctionScope,e.inputValues,e.outputProperties)}catch(e){c("setup",e),this.context.editorConnection&&this.context.isWarningTypeEnabled("javascriptExecution")&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"js-setup-waring",{showGlobally:!0,message:"<strong>setup</strong>: "+u(e)})}}}},setup:function(e,t){var n=e.editorConnection;function i(t){function i(){var i=[],o=[{value:"string",label:"String"},{value:"boolean",label:"Boolean"},{value:"number",label:"Number"},{value:"object",label:"Object"},{value:"array",label:"Array"}],s=[{value:"*",label:"Any"},{value:"string",label:"String"},{value:"boolean",label:"Boolean"},{value:"number",label:"Number"},{value:"object",label:"Object"},{value:"array",label:"Array"},{value:"signal",label:"Signal"}],a=t.parameters.scriptOutputs,l=t.parameters.scriptInputs;void 0!==a&&a.length>0&&a.forEach(function(e){i.push({name:"outtype-"+e.label,displayName:"Type",plug:"input",type:{name:"enum",enums:s,allowEditOnly:!0},default:"*",parent:"scriptOutputs",parentItemId:e.id}),i.push({name:e.label,plug:"output",type:t.parameters["outtype-"+e.label]||"*",group:"Outputs"})}),void 0!==l&&l.length>0&&l.forEach(function(e){i.push({name:"intype-"+e.label,displayName:"Type",plug:"input",type:{name:"enum",enums:o,allowEditOnly:!0},default:"string",parent:"scriptInputs",parentItemId:e.id}),i.push({name:e.label,plug:"input",type:t.parameters["intype-"+e.label]||"string",group:"Inputs"})}),function(e,t,n){var i=t.editorConnection;if(e.parameters)if(e.parameters.externalFile&&"yes"===e.parameters.useExternalFile){var o=e.parameters.externalFile;r().createFromURL(o,a)}else e.parameters.code?a(r().createFromCode(e.parameters.code)):(s(),n([]));function s(){for(var t=0,n=["js-parse-waring","js-destroy-waring","js-run-waring","js-setup-waring"];t<n.length;t++){var o=n[t];i.clearWarning(e.component.name,e.id,o)}}function a(t){t.error?i.sendWarning(e.component.name,e.id,"js-parse-waring",{showGlobally:!0,message:t.error}):s(),n(t.getPorts())}}(t,e,function(e){e.forEach(function(e){i.find(function(t){return t.name===e.name&&t.plug===e.plug})||i.push(e)}),n.sendDynamicPorts(t.id,i)})}i(),t.on("parameterUpdated",function(){i()})}n&&n.isRunningLocally()&&t.on("editorImportComplete",function(){t.on("nodeAdded.Javascript2",function(e){i(e)});for(var e=0,n=t.getNodesWithType("Javascript2");e<n.length;e++)i(n[e])})}};n.d(t,["default",0,b])},2045(e,t,n){"use strict";function i(e){return void 0===e?null:e}function o(e){if(null==e)return!1;if(Array.isArray(e))return!1;if("object"!=typeof e&&"function"!=typeof e)return!1;var t=e.on,n=e.off;return"function"==typeof t&&"function"==typeof n}n.r(t);const r={node:{name:"net.noodl.ObjectChanged",displayName:"Object Changed",category:"Logic",initialize:function(){var e=this;this._internal.object=void 0,this._internal.key=null,this._internal.value=null,this._internal.previousValue=null,this._internal.changeCount=0,this._onModelChanged=function(t){if(null!==t&&"object"==typeof t){var n=t,o=void 0===n.old;e._internal.changeCount++,e._internal.key=n.name,e._internal.value=i(n.value),e._internal.previousValue=i(n.old),e.flagOutputDirty("key"),e.flagOutputDirty("value"),e.flagOutputDirty("previousValue"),e.sendSignalOnOutput(o?"keyAdded":"keyChanged")}},this._unbindObject=function(){var t=e._internal.object;o(t)&&t.off("change",e._onModelChanged)},this.addDeleteListener(function(){e._unbindObject(),e._internal.object=void 0})},getInspectInfo:function(){return this._internal.changeCount?"Reported "+this._internal.changeCount+(1===this._internal.changeCount?" change":" changes")+(null===this._internal.key?"":", last key: "+this._internal.key):"No changes reported"},inputs:{object:{group:"Values",type:"object",displayName:"Object",description:"The Object to watch. Changes to its keys are reported as they happen; sending a different Object reports Object Replaced. A plain JavaScript object that is not a Noodl Object cannot be watched key-by-key — only its replacement is reported",set:function(e){if(void 0!==e&&this._internal.object!==e){var t=this._internal.object;this._unbindObject(),this._internal.object=e,o(e)&&e.on("change",this._onModelChanged),this._internal.changeCount++,this._internal.key=null,this._internal.value=i(e),this._internal.previousValue=i(t),this.flagOutputDirty("key"),this.flagOutputDirty("value"),this.flagOutputDirty("previousValue"),this.sendSignalOnOutput("objectReplaced")}}}},outputs:{keyAdded:{group:"Events",type:"signal",displayName:"Key Added",description:"Fires when a key that did not exist on the watched Object now does"},keyChanged:{group:"Events",type:"signal",displayName:"Key Changed",description:"Fires when a key that already existed on the watched Object is given a different value"},objectReplaced:{group:"Events",type:"signal",displayName:"Object Replaced",description:"Fires when a different Object arrives on the input, including the first one and including an explicit clear; Key is empty and Value / Previous Value carry the Objects themselves"},key:{type:"string",displayName:"Key",group:"Change",description:"The key the last Key Added or Key Changed was about; empty after Object Replaced, which is about no single key",getter:function(){return this._internal.key}},value:{type:"*",displayName:"Value",group:"Change",description:"The new value of that key — or, after Object Replaced, the Object that just arrived",getter:function(){return this._internal.value}},previousValue:{type:"*",displayName:"Previous Value",group:"Change",description:"The value that key held before — empty when the key has just been added — or, after Object Replaced, the Object that was being watched before",getter:function(){return this._internal.previousValue}}}}};n.d(t,["default",0,r])},6074(e,t,n){"use strict";n.r(t);var i=n(5162),o=function(){return o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};const r={node:{name:"Open File Picker",docs:"https://docs.noodl.net/nodes/utilities/open-file-picker",category:"Utilities",ssr:{compat:"client-only",note:"File dialogs only exist in the browser."},getInspectInfo:function(){if(this._internal.file)return this._internal.file.path},initialize:function(){var e=document.createElement("input");e.type="file",this._internal.inputElement=e},inputs:{open:{type:"signal",displayName:"Open",group:"Actions",description:"Opens the browser file dialog",valueChangedToTrue:function(){var e=this,t=this._internal.inputElement,n=this._internal.pendingOpen;n&&(this._internal.pendingOpen=void 0,this.reportOutcome(n,"unchanged"));var i=this.beginOutcome();this._internal.pendingOpen=i;var o=function(t,n){e._internal.pendingOpen=void 0,e.reportOutcome(i,t,n)},r=this._internal.acceptedFileTypes;null!=r&&""!==r?t.accept=r:t.removeAttribute("accept"),this._internal.capture?t.capture=this._internal.capture:t.removeAttribute("capture"),t.onchange=function(n){e._detachHandlers();var i=n.target.files,r=i&&i[0];t.value="",r?(e._internal.file=r,e.flagOutputDirty("file"),e.flagOutputDirty("path"),e.flagOutputDirty("name"),e.flagOutputDirty("sizeInBytes"),e.flagOutputDirty("type"),o("done")):o("unchanged")},t.oncancel=function(){e._detachHandlers(),o("unchanged")};try{t.click()}catch(e){this._detachHandlers();var s="Could not open the file picker: "+(e&&e.message?e.message:e);this._internal.error=s,this.flagOutputDirty("error"),o("failure",{code:"open-file-picker/open-failed",message:s})}}},acceptedFileTypes:{group:"General",type:"string",displayName:"Accepted file types",description:"Comma-separated extensions or MIME types the dialog offers; leave blank to offer every file",set:function(e){this._internal.acceptedFileTypes=e}},capture:{group:"General",type:"string",displayName:"Capture",description:'Asks a mobile browser to open a camera or microphone instead of the file list — "user" for the front camera, "environment" for the rear',set:function(e){this._internal.capture=e}}},outputs:o(o({file:{type:"*",displayName:"File",group:"General",description:"The chosen file itself, for passing on to an upload node",get:function(){return this._internal.file}},path:{displayName:"Path",group:"Metadata",type:"string",description:"Absolute path of the chosen file, which only the desktop app can supply — blank in a browser",get:function(){return this._internal.file&&this._internal.file.path}},name:{displayName:"Name",group:"Metadata",type:"string",description:"File name as the user chose it, extension included",get:function(){return this._internal.file&&this._internal.file.name}},sizeInBytes:{displayName:"Size in bytes",group:"Metadata",type:"number",description:"Size of the chosen file, in bytes",get:function(){return this._internal.file&&this._internal.file.size}},type:{displayName:"Type",group:"Metadata",type:"string",description:"MIME type the browser reports, which is blank for an extension it does not recognise",get:function(){return this._internal.file&&this._internal.file.type}}},(0,i.outcomeOutputs)({done:"Fires once a file has been chosen and every metadata output is up to date",unchanged:"Fires when the dialog closed with nothing chosen, or when a later Open superseded this one — a legitimate outcome rather than a failure",failure:"Fires when the dialog could not be opened at all, for example inside a sandboxed frame"})),{error:{type:"string",group:"Error",displayName:"Error",description:"Why the dialog could not be opened",get:function(){return this._internal.error}}}),methods:{_detachHandlers:function(){var e=this._internal.inputElement;e.onchange=null,e.oncancel=null}}}};n.d(t,["default",0,r])},5749(e,t,n){"use strict";n.r(t);var i=n(5162),o=function(){return o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function r(e){return e.context.currentFrameTime}function s(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}const a={node:{name:"Repeat",displayName:"Repeat",category:"Utilities",searchTags:["interval","every","tick","ticker","clock","loop","timer","poll","countdown"],ssr:{compat:"client-only",note:"Does nothing during a server render: it never ticks there and Count reads empty. It starts in the browser after hydration."},nodeDoubleClickAction:{focusPort:"interval"},initialize:function(){var e=this,t=this;this._internal.running=!1,this._internal.count=0,this._internal.interval=1e3,this._internal.beat=1e3,this._internal.nextAt=0,this._internal.timer=this.context.timerScheduler.createTimer({duration:1e3,onFinish:function(){t._tick()}}),this.addDeleteListener(function(){e._internal.running=!1,e._internal.timer.stop()})},getInspectInfo:function(){return(this._internal.running?"Running":"Stopped")+", count "+this._internal.count},inputs:{interval:{group:"Values",type:"number",displayName:"Interval",default:1e3,description:"Time between ticks, in milliseconds. A change takes effect from the next tick. Must be above zero",set:function(e){this._internal.interval=e}},start:{group:"Actions",displayName:"Start",description:"Starts ticking from a Count of 0: the first Tick fires one Interval later. Fires Unchanged while already running",valueChangedToTrue:function(){var e=this.beginOutcome(),t=this._internal;t.running?this.reportOutcome(e,"unchanged"):s(t.interval)?(t.running=!0,t.beat=t.interval,t.nextAt=r(this)+t.beat,0!==t.count&&(t.count=0,this.flagOutputDirty("count")),t.timer.duration=t.beat,t.timer.start(),this.reportOutcome(e,"done")):this.reportOutcome(e,"failure",{code:"repeat/interval-not-positive",message:"Interval is ".concat(String(t.interval),", and Repeat needs a number of milliseconds above zero")})}},stop:{group:"Actions",displayName:"Stop",description:"Stops ticking. Count keeps its value until the next Start",valueChangedToTrue:function(){var e=this.beginOutcome();this._internal.running?(this._internal.running=!1,this._internal.pausedLeft=void 0,this._internal.timer.stop(),this.reportOutcome(e,"done")):this.reportOutcome(e,"unchanged")}}},outputs:o({tick:{group:"Events",type:"signal",displayName:"Tick",description:"Fires once every Interval while running"},count:{group:"Values",type:"number",displayName:"Count",description:"How many times Tick has fired since the last Start",getter:function(){return this._internal.count}}},(0,i.outcomeOutputs)({done:"Fires when Start began ticking or Stop stopped it",unchanged:"Fires on a Start while already running, or a Stop with nothing running",failure:"Fires on a Start whose Interval is not a number of milliseconds above zero"})),methods:{_onPageHidden:function(){var e=this._internal;e.running&&void 0===e.pausedLeft&&(e.pausedLeft=Math.max(0,e.nextAt-r(this)),e.timer.stop())},_onPageShown:function(){var e=this._internal;if(void 0!==e.pausedLeft){var t=e.pausedLeft;e.pausedLeft=void 0,e.running&&(e.nextAt=r(this)+t,e.timer.duration=t,e.timer.start())}},_tick:function(){var e=this._internal;if(e.running&&(e.count+=1,this.flagOutputDirty("count"),this.sendSignalOnOutput("tick"),e.running)){s(e.interval)&&(e.beat=e.interval);var t=r(this);e.nextAt+=e.beat,e.nextAt<=t&&(e.nextAt+=Math.ceil((t-e.nextAt)/e.beat+Number.EPSILON)*e.beat),e.timer.duration=e.nextAt-t,e.timer.start()}}}}};n.d(t,["default",0,a])},2324(e,t,n){"use strict";n.r(t);const i={node:{name:"Screen Resolution",docs:"https://docs.noodl.net/nodes/utilities/screen-resolution",category:"Utilities",ssr:{compat:"client-only",note:"The viewport size is unknowable server-side; width/height stay unset until the browser runs."},initialize:function(){var e=this;if("undefined"!=typeof window){var t=function(){e._viewportSizeChanged()};window.addEventListener("resize",t),this.addDeleteListener(function(){window.removeEventListener("resize",t)}),this._viewportSizeChanged()}},getInspectInfo:function(){return this._internal.width+" x "+this._internal.height},outputs:{width:{group:"Values",type:"number",displayName:"Width",description:"Width of the browser viewport, in pixels",get:function(){return this._internal.width}},height:{group:"Values",type:"number",displayName:"Height",description:"Height of the browser viewport, in pixels",get:function(){return this._internal.height}},aspectRatio:{group:"Values",type:"number",displayName:"Aspect Ratio",description:"Width divided by Height, so anything wider than it is tall is greater than one",get:function(){return this._internal.width/this._internal.height}}},methods:{_viewportSizeChanged:function(){this._internal.width=window.innerWidth,this._internal.height=window.innerHeight,this.flagAllOutputsDirty()}}}};n.d(t,["default",0,i])},1964(e,t,n){"use strict";n.r(t);var i=n(8454),o=n.n(i),r=n(3538),s=n(1550),a=n(5162),l=n(2793),u=n(4038),c=function(){return c=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},c.apply(this,arguments)},d={curve:[0,0,.58,1],dur:300,delay:0};function p(e){return!(!Array.isArray(e)||4!==e.length)&&!!e.every(function(e){return"number"==typeof e&&isFinite(e)})&&e[0]>=0&&e[0]<=1&&e[2]>=0&&e[2]<=1}function h(e,t){return"boolean"===e?{value:void 0!==t&&!!t}:"string"===e?{value:void 0===t?"":t}:"textStyle"===e?{value:t}:void 0}var f={},g={};function m(e,t){if("transparent"===t||!t)return e[3]=0,!0;var n=(0,l.qS)(t);return!!n&&(e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],!0)}function y(e){var t=e.toString(16);return 1==t.length?"0"+t:t}function v(e){return"#"+y(e[0])+y(e[1])+y(e[2])+y(e[3])}var b=["failure","stateChanged","done","unchanged","completed"],w="states/unknown-state";function _(e,t){if(e&&t&&e.length===t.length){for(var n={},i=0;i<e.length;i++){if(-1===t.indexOf(e[i])){if(n.before)return;n.before=e[i]}if(-1===e.indexOf(t[i])){if(n.after)return;n.after=t[i]}}return n.before&&n.after?n:void 0}}function S(e,t,n){var i=t.states,o=t.values,r=[];for(var s in o=o?o.split(","):void 0){var a=o[s];r.push({type:{name:t["type-"+a]||"number",allowConnectionsOnly:!0},plug:"output",group:"Values",name:a}),r.push({type:{name:"enum",enums:[{label:"Number",value:"number"},{label:"String",value:"string"},{label:"Boolean",value:"boolean"},{label:"Color",value:"color"},{label:"Text Style",value:"textStyle"}],allowEditOnly:!0},default:"number",plug:"input",group:"Types",displayName:a,name:"type-"+a})}(i=i?i.split(","):void 0)&&i.forEach(function(e){o&&o.forEach(function(n){r.push({plug:"input",type:t["type-"+n]||"number",group:e+" Values",name:"value-"+e+"-"+n,displayName:n,editorName:e+"|"+n})}),o&&!1!==t.useTransitions&&(r.push({plug:"input",type:"curve",displayName:"Default",default:{curve:[0,0,.58,1],dur:300,delay:0},group:e+" Transitions",name:"transitiondef-"+e}),o.forEach(function(n){void 0!==t["type-"+n]&&"number"!==t["type-"+n]&&"color"!==t["type-"+n]||r.push({plug:"input",type:{name:"curve"},default:t["transitiondef-"+e]||{curve:[0,0,.58,1],dur:300,delay:0},group:e+" Transitions",name:"transition-"+e+"-"+n,displayName:n,editorName:"Transition "+e+"|"+n})})),r.push({plug:"input",type:{name:"signal",allowConnectionsOnly:!0},displayName:"To "+e,name:"to-"+e,group:"Go to state"}),r.push({plug:"output",type:"boolean",displayName:"At "+e,name:"at-"+e,group:"Current state"}),r.push({plug:"output",type:"signal",displayName:"Has Reached "+e,name:"reached-"+e,group:"Current state"})}),i&&r.push({plug:"input",type:{name:"enum",enums:i},group:"States",displayName:"State",name:"currentState",default:t.startState||i[0]});var l=_(f[e],i);f[e]=i;var u,c=_(g[e],o);if(g[e]=o,l){var d={plug:"input",before:l.before,after:l.after,patterns:["transition-{{*}}","to-{{*}}","at-{{*}}","reached-{{*}}"]};u=d,o&&o.forEach(function(e){d.patterns.push("value-{{*}}-"+e)})}else c&&(u=[{plug:"output",before:c.before,after:c.after,patterns:["{{*}}"]},{plug:"input",before:c.before,after:c.after,patterns:["type-{{*}}"]},{plug:"input",before:c.before,after:c.after,patterns:i?i.map(function(e){return"value-"+e+"-{{*}}"}):void 0}]);n.sendDynamicPorts(e,r,{renamed:u})}const O={node:{name:"States",docs:"https://docs.noodl.net/nodes/utilities/logic/states",category:"Animation",ssr:{compat:"partial",note:"The scheduler clock is frozen during server render; state transitions do not animate or complete there."},initialize:function(){var e=this,t=this._internal;t.useTransitions=!0,t.currentValues={},t.stateParameters={},t.stateParameterTypes={},t.startValues={},t.bezierEaseCurves={},t.transitionFuncs={},t.valuesAreInitialised=!1,t.animation=this.context.timerScheduler.createTimer({duration:300,ease:u.A.easeOut,onStart:function(){var n=t.startValues,i=t.stateParameters,o=t.stateParameterTypes,r="value-"+t.state+"-";for(var s in this.targetValues={},this.startValues={},this.valueTypes={},this.unreadable={},this.transitionCurves)if("number"===o["type-"+s]||void 0===o["type-"+s])this.valueTypes[s]="number",this.startValues[s]=n[s],this.targetValues[s]=i[r+s]||0;else if("color"===o["type-"+s]){this.valueTypes[s]="color";var a=e.context.styles.resolveColor(n[s]||"#000000"),l=e.context.styles.resolveColor(i[r+s]||"#000000");this.startValues[s]=[0,0,0,255],this.targetValues[s]=[0,0,0,255];var u=m(this.startValues[s],a),c=m(this.targetValues[s],l);u||e.warnUnreadableColor(s,a),c||e.warnUnreadableColor(s,l),u&&c||(this.unreadable[s]=u?l:a)}},onRunning:function(n){var i=n*this.duration,o=t.currentValues,r=[0,0,0,255];for(var s in this.transitionCurves){var a=this.transitionCurves[s];if(i<a.delay||"color"===this.valueTypes[s]&&void 0!==this.unreadable[s]&&i<a.delay+a.dur){var l=t.startValues[s];o[s]="color"!==this.valueTypes[s]?this.startValues[s]:"string"==typeof l&&""!==l?l:v(this.startValues[s])}else if(i>=a.delay+a.dur){var c=t.stateParameters["value-"+t.state+"-"+s];o[s]="color"!==this.valueTypes[s]?this.targetValues[s]:null!=c&&""!==c?c:v(this.targetValues[s])}else{var d=t.transitionFuncs[s].get((i-a.delay)/a.dur);if("number"===this.valueTypes[s])o[s]=u.A.linear(Number(this.startValues[s]),Number(this.targetValues[s]),d);else if("color"===this.valueTypes[s]){var p=this.startValues[s],h=this.targetValues[s];r[0]=Math.floor(u.A.linear(p[0],h[0],d)),r[1]=Math.floor(u.A.linear(p[1],h[1],d)),r[2]=Math.floor(u.A.linear(p[2],h[2],d)),r[3]=Math.floor(u.A.linear(p[3],h[3],d)),o[s]=v(r)}}e.flagOutputDirty(s)}},onFinish:function(){var n="reached-"+t.state;e.hasOutput(n)&&e.sendSignalOnOutput(n)}}),this.addDeleteListener(function(){t.animation.stop()})},getInspectInfo:function(){return"Current state: ".concat(this._internal.state)},inputs:{states:{type:{name:"stringlist",allowEditOnly:!0},displayName:"States",group:"States",description:"Names of the states this node can be in; the node starts in the first",set:function(e){if(this._internal.states=e?e.split(","):[],this._internal.states.length>0){var t=this;t._internal.state||this.scheduleGoToState(t._internal.startState||t._internal.states[0])}}},values:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Values",group:"Values",description:"Names of the values that differ between states, each becoming an output",set:function(e){var t=this._internal;for(var n in t.values=e?e.split(","):[],t.values){var i=t.values[n];-1===b.indexOf(i)?this.registerOutputIfNeeded(i):this.raiseRuntimeError("states/reserved-port-name",'"'.concat(i,"\" is one of the node's own output ports and cannot also be a value — rename the value"),{name:i})}}},toggle:{group:"Go to state",displayName:"Toggle",description:"Moves to the next state in the list, wrapping round after the last",valueChangedToTrue:function(){var e=this._internal,t=this.beginOutcome();if(e.states&&0!==e.states.length){var n=(e.states.indexOf(e.state)+1)%e.states.length;this.scheduleGoToState(e.states[n],t)}else this._failNoStates(t)}},useTransitions:{type:"boolean",displayName:"Use Transitions",group:"General",description:"Whether a state change animates its values or jumps straight to them",default:!0,set:function(e){this._internal.useTransitions=e}}},outputs:c({currentState:{type:"string",displayName:"State",group:"Current State",description:"Which state the node is in now",getter:function(){return this._internal.state}},stateChanged:{type:"signal",displayName:"State Changed",group:"Current State",description:"Fires on every state change except entering the first, which is where the node starts"},error:{type:"string",displayName:"Error",group:"Error",description:"Which state was asked for and which ones this node actually has",getter:function(){return this._internal.error}}},(0,a.outcomeOutputs)({done:"Fires once a Toggle or To <state> you triggered has moved the node, after State Changed",unchanged:"Fires when the node is already in the state you asked for, or already heading there in this pass",failure:"Fires when a state was asked for that this node does not have, leaving it where it was"})),prototypeExtensions:{registerOutputIfNeeded:function(e){var t=this._internal;this.hasOutput(e)||this.registerOutput(e,{getter:function(){return t.currentValues[e]}})},registerInputIfNeeded:function(e){var t=this,n=this._internal;if(!this.hasInput(e))if(0===e.indexOf("to-")){var i=e.substring(3);this.registerInput(e,{set:r.EdgeTriggeredInput.createSetter({valueChangedToTrue:function(){this.scheduleGoToState(i,this.beginOutcome())}})})}else if("startState"===e)this.registerInput(e,{set:function(e){this._internal.startState=e,this.scheduleGoToState(e)}});else if("currentState"===e)this.registerInput(e,{set:this.scheduleGoToState.bind(this)});else if(0===e.indexOf("type-"))this.registerInput(e,{set:function(t){n.stateParameterTypes[e]=t}});else if(0===e.indexOf("value-")){var o=e.split("-"),s=o[1],a=o[2];this.registerInput(e,{set:function(i){n.stateParameters[e]=i,n.state===s&&(n.currentValues[a]=i,t.flagOutputDirty(a))}})}else(0===e.search(/duration-/g)||0===e.search(/transition/g))&&this.registerInput(e,{set:function(t){n.stateParameters[e]=t}})},setCurrentState:function(e){this.scheduleGoToState(e)},warnUnreadableColor:function(e,t){if(!0===(0,l.Z7)(t)){var n=this._internal,i=n.warnedUnreadableColors||(n.warnedUnreadableColors={});i[t]||(i[t]=!0,"function"==typeof this.raiseRuntimeError&&this.raiseRuntimeError("states/unreadable-color",'The value "'.concat(e,'" is set to ').concat(JSON.stringify(t),", which is not a colour the browser accepts, ")+"so it is never drawn. Use #RRGGBB, rgb() or var(--token).",{value:e,color:t}))}},warnUnreadableTransition:function(e,t){var n,i=this._internal,o=i.warnedUnreadableTransitions||(i.warnedUnreadableTransitions={});try{n=JSON.stringify(t)}catch(e){n=String(t)}var r=e+":"+n;o[r]||(o[r]=!0,"function"==typeof this.raiseRuntimeError&&this.raiseRuntimeError("states/unreadable-transition",'The transition "'.concat(e,'" is set to ').concat(n,", which is not a curve, so moves into that state use ")+"the state's Default transition instead. Set it in the curve editor, or as { curve: [x1, y1, x2, y2], dur, delay } with both x between 0 and 1.",{port:e,transition:t}))},jumpToState:function(e){var t=this._internal;if(t.states&&(e||(e=t.states[0]),t.state!==e)){t.animation.stop();var n="value-"+e+"-";for(var i in t.values){var o=t.values[i],r=h(t.stateParameterTypes["type-"+o],t.stateParameters[n+o]);t.currentValues[o]=r?r.value:t.stateParameters[n+o]||0,this.flagOutputDirty(o)}t.state=e,this.flagOutputDirty("currentState"),t.valuesAreInitialised&&this.sendSignalOnOutput("stateChanged"),t.valuesAreInitialised=!0,this.updateAtStatePorts()}},_failNoStates:function(e){var t="This States node has no states defined, so there is nowhere to go";this._internal.error=t,this.flagOutputDirty("error"),this.reportOutcome(e,"failure",{code:"states/no-states",message:t})},scheduleGoToState:function(e,t){var n=this,i=this._internal;e&&i.states&&-1!==i.states.indexOf(e)&&this.setDiagnostic(w,null),i.goToStateQueue||(i.goToStateQueue=[]);var o=i.goToStateQueue,r=o.length>0?o[o.length-1].state:i.state;e&&r===e?t&&this.reportOutcome(t,"unchanged"):(o.push({state:e,token:t}),this._internal.goToState=e,this.hasScheduledGoToState||(this.hasScheduledGoToState=!0,this.scheduleAfterInputsHaveUpdated(function(){n.hasScheduledGoToState=!1;for(var e=o.splice(0,o.length),t=0;t<e.length;t++)n.goToState(e[t].state,t<e.length-1,e[t].token)})))},_failUnknownState:function(e,t){var n=this._internal.states||[],i=(0,s.qb)(e,n),o='Cannot go to state "'+e+'" — this node has no such state. Its states are: '+(n.length>0?n.join(", "):"(none defined)")+"."+(i?' Did you mean "'+i+'"?':"");this._internal.error=o,this.flagOutputDirty("error"),this.raiseRuntimeError(w,o,{requested:e,states:n.slice()}),t?this.reportOutcome(t,"failure",{code:w,message:o,raise:!1}):this.sendSignalOnOutput("failure")},goToState:function(e,t,n){var i=this._internal;if(i.states)if(e||(e=i.states[0]),i.state!==e)if(-1!==i.states.indexOf(e))if(i.valuesAreInitialised){i.animation.stop();var r=0,s=0,a={};for(var l in i.values){var u=i.values[l];i.startValues[u]=i.currentValues[u];var c=h(i.stateParameterTypes["type-"+u],i.stateParameters["value-"+e+"-"+u]);if(c)i.currentValues[u]=c.value,this.flagOutputDirty(u);else{var f="transition-"+e+"-"+u,g="transitiondef-"+e,m=i.stateParameters[f],y=f;m||(m=i.stateParameters[g]||d,y=g);var v=function(e){return 0===e.dur&&0===e.delay||!i.useTransitions||t};if(!v(m)&&!p(m.curve)){this.warnUnreadableTransition(y,m);var b=i.stateParameters[g];m=y===f&&b&&(v(b)||p(b.curve))?b:d}v(m)?(i.currentValues[u]=i.stateParameters["value-"+e+"-"+u],this.flagOutputDirty(u)):(i.transitionFuncs[u]=o()(m.curve),a[u]=m,r=Math.min(r,m.delay),s=Math.max(s,m.dur+m.delay))}}if((s>0||r>0)&&(i.animation.transitionCurves=a,i.animation.duration=s,i.animation.delay=r,i.animation.start()),i.state=e,this.flagOutputDirty("currentState"),this.sendSignalOnOutput("stateChanged"),this.updateAtStatePorts(),0==s&&0==r){var w="reached-"+i.state;this.hasOutput(w)&&this.sendSignalOnOutput(w)}n&&this.reportOutcome(n,"done")}else this.jumpToState(e),n&&this.reportOutcome(n,"done");else this._failUnknownState(e,n);else n&&this.reportOutcome(n,"unchanged");else n&&this._failNoStates(n)},updateAtStatePorts:function(){var e=this._internal,t=e.states;for(var n in t){var i=t[n],o="at-"+i;e.currentValues[o]=e.state===i,this.hasOutput(o)&&this.flagOutputDirty(o)}}}},setup:function(e,t){var n=e.editorConnection;n&&n.isRunningLocally()&&t.on("nodeAdded.States",function(e){e.parameters.states&&S(e.id,e.parameters,n),e.on("parameterUpdated",function(t){("useTransitions"===t.name||"states"===t.name||"values"===t.name||t.name.startsWith("transition")||t.name.startsWith("type-"))&&S(e.id,e.parameters,n)})})}};n.d(t,["default",0,O])},3497(e,t,n){"use strict";n.r(t);var i=n(5162),o=function(){return o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};const r={node:{name:"Timer",docs:"https://docs.noodl.net/nodes/utilities/delay",displayName:"Delay",category:"Utilities",ssr:{compat:"partial",note:"The scheduler clock is frozen during server render, so Started/Finished never fire there; do not gate Page Ready on a Delay."},nodeDoubleClickAction:{focusPort:"duration"},initialize:function(){var e=this,t=this;this._internal._animation=this.context.timerScheduler.createTimer({duration:0,onStart:function(){t._internal.resumed||t.sendSignalOnOutput("timerStarted")},onFinish:function(){t._restoreAfterResume(),t.sendSignalOnOutput("timerFinished")}}),this.addDeleteListener(function(){e._internal._animation.stop()})},getInspectInfo:function(){return this._internal._animation.isRunning()?Math.floor(this._internal._animation.durationLeft()/10)/100+" seconds":"Not running"},inputs:{start:{group:"Actions",displayName:"Start",description:"Starts the countdown, or fires Unchanged while one is already running — use Restart to begin again",valueChangedToTrue:function(){var e=this.beginOutcome();!1===this._internal._animation._isRunning?(this._internal._animation.start(),this.reportOutcome(e,"done")):this.reportOutcome(e,"unchanged")}},restart:{group:"Actions",displayName:"Restart",description:"Begins the countdown again from zero, whether or not one is already running",valueChangedToTrue:function(){var e=this.beginOutcome();this._internal._animation.start(),this.reportOutcome(e,"done")}},duration:{group:"Values",type:"number",displayName:"Duration",default:0,description:"How long the countdown runs before Finished fires, in milliseconds",set:function(e){this._internal._animation.duration=e}},startDelay:{group:"Values",type:"number",displayName:"Start Delay",default:0,description:"How long to wait after Start before the countdown begins, in milliseconds",set:function(e){this._internal._animation.delay=e}},stop:{group:"Actions",displayName:"Stop",description:"Abandons the countdown, so Finished never fires for it",valueChangedToTrue:function(){var e=this.beginOutcome(),t=this._internal._animation,n=!!t.scheduler&&!!t.scheduler.newTimers&&-1!==t.scheduler.newTimers.indexOf(t),i=!1!==t._isRunning||n;t.stop(),this._internal.paused=void 0,this._restoreAfterResume(),this.reportOutcome(e,i?"done":"unchanged")}}},outputs:o({timerStarted:{group:"Events",type:"signal",displayName:"Started",description:"Fires when the countdown begins, once Start Delay has elapsed"},timerFinished:{group:"Events",type:"signal",displayName:"Finished",description:"Fires once Duration has elapsed, and not at all for a countdown that was stopped"}},(0,i.outcomeOutputs)({done:"Fires when the action changed what the timer was doing",unchanged:"Fires on a Start while one is already running, or a Stop with nothing running"})),methods:{_onPageHidden:function(){var e=this._internal._animation;if(!0===e._isRunning&&!this._internal.paused){var t=e.durationLeft(),n=this._internal.resumed||{duration:e.duration,delay:e.delay};this._internal.paused=o({left:"number"==typeof t&&t>=0?t:e.duration},n),e.stop()}},_onPageShown:function(){var e=this._internal.paused;if(e){this._internal.paused=void 0;var t=this._internal._animation;this._internal.resumed={duration:e.duration,delay:e.delay},t.duration=e.left,t.delay=0,t.start()}},_restoreAfterResume:function(){var e=this._internal.resumed;e&&(this._internal.resumed=void 0,this._internal._animation.duration=e.duration,this._internal._animation.delay=e.delay)}}}};n.d(t,["default",0,r])},3745(e,t,n){"use strict";n.r(t);var i=n(822),o=n.n(i),r=n(7011),s=n.n(r),a=n(2114),l=n(1711),u=n(5600),c=n(5162),d=function(){return d=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},d.apply(this,arguments)},p={name:"Upload File",docs:"https://docs.noodl.net/nodes/data/cloud-data/upload-file",category:"Cloud Services",color:"data",getInspectInfo:function(){return this._internal.cloudFile?[{type:"value",value:this._internal.cloudFile}]:"[Not uploaded yet]"},inputs:{file:{group:"General",displayName:"File",type:"*",description:"The file to upload, as an Open File Picker node produces it",set:function(e){this._internal.file=e}},private:{group:"General",displayName:"Private",type:"boolean",default:!1,description:"Restricts the stored file to whoever uploaded it, so reading it later needs a Sign File URL node",set:function(e){this._internal.private=e}},bucket:{group:"File Location",displayName:"Bucket (Supabase)",type:"string",description:"Supabase Storage bucket to upload into. Supabase only; there is no default, and a bucket that does not exist fails with an error that does not say so",set:function(e){this._internal.bucket=e}},path:{group:"File Location",displayName:"Path (Supabase)",type:"string",description:"Object path inside the bucket, such as avatars/me.png. Supabase only. Leave blank to use the file's own name",set:function(e){this._internal.path=e}},collection:{group:"File Location",displayName:"Collection (PocketBase)",type:"string",description:"PocketBase collection holding the record the file attaches to. PocketBase only",set:function(e){this._internal.collection=e}},recordId:{group:"File Location",displayName:"Record ID (PocketBase)",type:"string",description:"Existing record to attach the file to. PocketBase only. Leave blank to create a new record as part of the upload",set:function(e){this._internal.recordId=e}},field:{group:"File Location",displayName:"Field (PocketBase)",type:"string",description:"The file-typed field on that record. PocketBase only",set:function(e){this._internal.field=e}},upload:{type:"signal",displayName:"Upload",group:"Actions",description:"Starts uploading File, and fails straight away when no file has been set",valueChangedToTrue:function(){var e=this,t=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(function(){var n=e._internal.file;if(n){var i=e.cloudStore([t]);i&&i.uploadFile({file:n,private:e._internal.private,target:e.fileTarget(),onUploadProgress:function(t){e._internal.progressTotal=t.total,e._internal.progressLoaded=t.loaded,e.flagOutputDirty("progressTotalBytes"),e.flagOutputDirty("progressLoadedBytes"),e.flagOutputDirty("progressLoadedPercent"),e.sendSignalOnOutput("progressChanged")},success:function(i){var r=n&&"string"==typeof n.name?n.name:void 0,s=void 0!==i.filename?i.filename:r;e._internal.cloudFile=new(o())(void 0!==s?Object.assign({},i,{filename:s}):i),e.flagOutputDirty("cloudFile"),e.reportOutcome(t,"done")},error:function(n){return e.setError(n,[t])}})}else e.setError("No file specified",[t])})}}},outputs:d(d({cloudFile:{group:"General",displayName:"Cloud File",type:"cloudfile",description:"The stored file, for wiring into a record property or a Cloud File node",get:function(){return this._internal.cloudFile}}},(0,c.outcomeOutputs)({done:"Fires once the file is stored and Cloud File is up to date",failure:"Fires when the file could not be stored, after the reason has been reported on the error channel"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Why the last upload failed; empty until one does",get:function(){return this._internal.error}},errorStatus:{type:"number",displayName:"Error Status Code",group:"Error",description:"HTTP status the backend refused with, or 0 when the request never left the app",get:function(){return this._internal.errorStatus}},progressChanged:{type:"signal",displayName:"Progress Changed",group:"Events",description:"Fires each time the byte counts below move during an upload"},progressTotalBytes:{type:"number",displayName:"Total Bytes",group:"Progress",description:"Size of the file being uploaded, in bytes",get:function(){return this._internal.progressTotal}},progressLoadedBytes:{type:"number",displayName:"Uploaded Bytes",group:"Progress",description:"How much of the file has been sent so far, in bytes",get:function(){return this._internal.progressLoaded}},progressLoadedPercent:{type:"number",displayName:"Uploaded Percent",group:"Progress",description:"How much of the file has been sent so far, from 0 to 100",get:function(){return this._internal.progressTotal?this._internal.progressLoaded/this._internal.progressTotal*100:0}}}),methods:{registerInputIfNeeded:function(e){var t=this;this.hasInput(e)||"backendId"===e&&this.registerInput(e,{set:function(e){t._internal.backendId=e}})},cloudStore:function(e){var t=s().forBackend(this.nodeScope?this.nodeScope.modelScope:void 0,this._internal.backendId);return t||this.setError('The backend this node is set to ("'.concat(this._internal.backendId,'") is not configured in this project.'),e),t},fileTarget:function(){var e=this._internal,t=e.bucket,n=e.path,i=e.collection,o=e.recordId,r=e.field,s=e.file;return t?{kind:"bucket",bucket:t,path:n||(null==s?void 0:s.name)||""}:i&&r?o?{kind:"record",collection:i,field:r,recordId:o}:{kind:"record",collection:i,field:r}:void 0},setError:function(e,t){var n=(0,u.fileFailureOf)(e);this._internal.error=n.message,this._internal.errorStatus=n.status,this.flagOutputDirty("error"),this.flagOutputDirty("errorStatus"),(0,c.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:"upload-file/upload-failed",message:String(this._internal.error),detail:{status:this._internal.errorStatus}})}}};function h(e,t,n,i){var o=(0,a.recordSchemaContext)(i,t);(0,l.sendSchemaPorts)(n,e,(0,a.recordBackendPickerPorts)(o),{staticPorts:(0,l.staticPortNames)(p)})}const f={node:p,setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){t.on("nodeAdded.Upload File",o);for(var n=0,i=t.getNodesWithType("Upload File");n<i.length;n++)o(i[n])}function o(n){h(n.id,n.parameters,e.editorConnection,t),n.on("parameterUpdated",function(){return h(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.backendServices",function(){return h(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.cloudservices",function(){return h(n.id,n.parameters,e.editorConnection,t)})}}};n.d(t,["default",0,f])},3395(e,t,n){"use strict";n.r(t);var i=n(5162),o=n(2568),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},s="user/log-in-failed";const a={node:{name:"net.noodl.user.LogIn",docs:"https://docs.noodl.net/nodes/data/user/log-in",displayNodeName:"Log In",category:"Cloud Services",color:"data",outputs:r(r({},(0,i.outcomeOutputs)({done:"Fires once the sign-in succeeded and a session has been stored",failure:"Fires when the sign-in was refused, after the reason has been reported on the error channel"})),{error:{description:"Why the last sign-in failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}}),inputs:{login:{description:"Attempts to sign in with Username and Password",displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleLogIn()}},username:{description:"Username to sign in as",displayName:"Username",type:"string",group:"General",set:function(e){this._internal.username=e}},password:{description:"Password to sign in with",displayName:"Password",type:"string",group:"General",set:function(e){this._internal.password=e}}},methods:{setError:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:s,message:e})},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,s),this.context.editorConnection.clearWarning(e,this.id,"user-login-warning")}},scheduleLogIn:function(){var e=this;(this._internal.pendingLogIn||(this._internal.pendingLogIn=[])).push(this.beginOutcome()),!0!==this.logInScheduled&&(this.logInScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.logInScheduled=!1;var t=e._internal.pendingLogIn||[];e._internal.pendingLogIn=[],o.A.instance.logIn({username:e._internal.username,password:e._internal.password,success:function(){(0,i.reportOutcomes)(e,t,"done")},error:function(n){e.setError(n,t)}})}))}}},setup:function(){}};n.d(t,["default",0,a])},2394(e,t,n){"use strict";n.r(t);var i=n(5162),o=n(2568),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},s="user/log-out-failed";const a={node:{name:"net.noodl.user.LogOut",docs:"https://docs.noodl.net/nodes/data/user/log-out",displayNodeName:"Log Out",category:"Cloud Services",color:"data",outputs:r(r({},(0,i.outcomeOutputs)({done:"Fires once the session has been ended",failure:"Fires when the sign-out was refused, after the reason has been reported on the error channel"})),{error:{description:"Why the last sign-out failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}}),inputs:{login:{description:"Signs the current user out and clears the stored session",displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleLogOut()}}},methods:{setError:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:s,message:e})},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,s),this.context.editorConnection.clearWarning(e,this.id,"user-login-warning")}},scheduleLogOut:function(){var e=this;(this._internal.pendingLogOut||(this._internal.pendingLogOut=[])).push(this.beginOutcome()),!0!==this.logOutScheduled&&(this.logOutScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.logOutScheduled=!1;var t=e._internal.pendingLogOut||[];e._internal.pendingLogOut=[],o.A.instance.logOut({success:function(){(0,i.reportOutcomes)(e,t,"done")},error:function(n){e.setError(n,t)}})}))}}},setup:function(){}};n.d(t,["default",0,a])},1340(e,t,n){"use strict";n.r(t);var i=n(5162),o=n(2568),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},s="user/request-magic-link-failed";const a={node:{name:"net.noodl.user.RequestMagicLink",displayNodeName:"Request Magic Link",category:"Cloud Services",color:"data",ssr:{compat:"partial",note:"Sends a request from the browser; a server render never triggers it."},initialize:function(){},getInspectInfo:function(){if(this._internal.error)return[{type:"text",value:"Error: ".concat(this._internal.error)}]},outputs:r(r({},(0,i.outcomeOutputs)({done:"Fires once the request has been accepted, which never means an account exists for that address",failure:"Fires when the request itself failed — no backend, no network, or rate limited — never because the address is unknown"})),{error:{description:"Why the last request failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}}),inputs:{send:{description:"Asks the backend to email a one-click sign-in link to Email",displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleSend()}},email:{description:"Address to send the sign-in link to",type:"string",displayName:"Email",group:"General",set:function(e){this._internal.email=e}},redirect:{description:"Page the link should return to; leave blank to come back to the page the request was made from",type:"string",displayName:"Redirect",group:"General",set:function(e){this._internal.redirect=e}}},methods:{setError:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:s,message:e})},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,s),this.context.editorConnection.clearWarning(e,this.id,"user-magiclink-warning")}},scheduleSend:function(){var e=this;(this._internal.pendingSend||(this._internal.pendingSend=[])).push(this.beginOutcome()),!0!==this.sendScheduled&&(this.sendScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.sendScheduled=!1;var t=e._internal.pendingSend||[];e._internal.pendingSend=[],o.A.instance.requestMagicLink({email:e._internal.email,redirect:e._internal.redirect,success:function(){e._internal.error="",e.flagOutputDirty("error"),(0,i.reportOutcomes)(e,t,"done")},error:function(n){return e.setError(n,t)}})}))}}},setup:function(){}};n.d(t,["default",0,a])},3231(e,t,n){"use strict";n.r(t);var i=n(2568),o="user/request-password-reset-failed";const r={node:{name:"net.noodl.user.RequestPasswordReset",docs:"https://docs.noodl.net/nodes/data/user/request-password-reset",displayNodeName:"Request Password Reset",category:"Cloud Services",color:"data",deprecated:!0,initialize:function(){},getInspectInfo:function(){},outputs:{success:{description:"Fires once the request has been accepted, which does not mean an account exists for that address",type:"signal",displayName:"Success",group:"Events"},failure:{description:"Fires when the request could not be made, after the reason has been reported on the error channel",type:"signal",displayName:"Failure",group:"Events"},error:{description:"Why the last request failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}},inputs:{send:{description:"Asks the backend to email a password-reset link to Email",displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleRequestPasswordReset()}},email:{description:"Address to send the reset link to",type:"string",displayName:"Email",group:"General",set:function(e){this._internal.email=e}}},methods:{setError:function(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.raiseRuntimeError(o,e)},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,o),this.context.editorConnection.clearWarning(e,this.id,"user-request-password-reset-warning")}},scheduleRequestPasswordReset:function(){var e=this;!0!==this.sendScheduled&&(this.sendScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.sendScheduled=!1,i.A.instance.requestPasswordReset({email:e._internal.email,success:function(){e.sendSignalOnOutput("success")},error:function(t){e.setError(t)}})}))}}},setup:function(){}};n.d(t,["default",0,r])},6328(e,t,n){"use strict";n.r(t);var i=n(2568),o="user/reset-password-failed";const r={node:{name:"net.noodl.user.ResetPassword",docs:"https://docs.noodl.net/nodes/data/user/reset-password",displayNodeName:"Reset Password",category:"Cloud Services",color:"data",deprecated:!0,initialize:function(){},getInspectInfo:function(){},outputs:{success:{description:"Fires once the password has been changed",type:"signal",displayName:"Success",group:"Events"},failure:{description:"Fires when the token was rejected or the request could not be made, after the reason has been reported on the error channel",type:"signal",displayName:"Failure",group:"Events"},error:{description:"Why the last attempt failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}},inputs:{reset:{description:"Sets the account password to New Password using the token from the reset email",displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleResetPassword()}},token:{description:"Reset token taken from the link in the email",type:"string",displayName:"Token",group:"General",set:function(e){this._internal.token=e}},username:{description:"Username the reset link was issued for",type:"string",displayName:"Username",group:"General",set:function(e){this._internal.username=e}},newPassword:{description:"Password to set on the account",type:"string",displayName:"New Password",group:"General",set:function(e){this._internal.newPassword=e}}},methods:{setError:function(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.raiseRuntimeError(o,e)},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,o),this.context.editorConnection.clearWarning(e,this.id,"user-reset-password-warning")}},scheduleResetPassword:function(){var e=this;!0!==this.resetPasswordScheduled&&(this.resetPasswordScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.resetPasswordScheduled=!1,i.A.instance.resetPassword({token:e._internal.token,username:e._internal.username,newPassword:e._internal.newPassword,success:function(){e.sendSignalOnOutput("success")},error:function(t){e.setError(t)}})}))}}},setup:function(){}};n.d(t,["default",0,r])},295(e,t,n){"use strict";n.r(t);var i=n(2568),o="user/send-email-verification-failed";const r={node:{name:"net.noodl.user.SendEmailVerification",docs:"https://docs.noodl.net/nodes/data/user/send-email-verification",displayNodeName:"Send Email Verification",category:"Cloud Services",color:"data",deprecated:!0,initialize:function(){},getInspectInfo:function(){},outputs:{success:{description:"Fires once the request has been accepted, which does not mean the address exists",type:"signal",displayName:"Success",group:"Events"},failure:{description:"Fires when the request could not be made, after the reason has been reported on the error channel",type:"signal",displayName:"Failure",group:"Events"},error:{description:"Why the last request failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}},inputs:{send:{description:"Asks the backend to email a verification link to Email",displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleSendEmailVerification()}},email:{description:"Address to send the verification link to",type:"string",displayName:"Email",group:"General",set:function(e){this._internal.email=e}}},methods:{setError:function(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.raiseRuntimeError(o,e)},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,o),this.context.editorConnection.clearWarning(e,this.id,"user-send-email-verification-warning")}},scheduleSendEmailVerification:function(){var e=this;!0!==this.sendScheduled&&(this.sendScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.sendScheduled=!1,i.A.instance.sendEmailVerification({email:e._internal.email,success:function(){e.sendSignalOnOutput("success")},error:function(t){e.setError(t)}})}))}}},setup:function(){}};n.d(t,["default",0,r])},5954(e,t,n){"use strict";n.r(t);var i=n(5162),o=n(2568),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},s="user/sign-in-with-failed";const a={node:{name:"net.noodl.user.SignInWith",displayNodeName:"Sign In With",category:"Cloud Services",color:"data",ssr:{compat:"partial",note:"Sign-in is a browser redirect; a server render can lay the button out but never completes a flow."},initialize:function(){var e=this;this._internal.signingIn=!1;var t=o.A.instance;t.on("oauthReturn",function(t){return e.applyReturn(t)}),t.oauthReturn&&(t.oauthReturn.inProgress||void 0!==t.oauthReturn.succeeded)&&this.applyReturn(t.oauthReturn)},getInspectInfo:function(){return this._internal.signingIn?"[Signing in…]":this._internal.error?[{type:"text",value:"Error: ".concat(this._internal.error)}]:void 0},outputs:r(r({},(0,i.outcomeOutputs)({done:"Fires on the page the provider returned to, once the session has been established",failure:"Fires when the sign-in did not complete, after the reason has been reported on the error channel"})),{signingIn:{description:"True while a sign-in started on an earlier page load is still being exchanged",type:"boolean",displayName:"Signing In",group:"States",getter:function(){return this._internal.signingIn}},error:{description:"Why the last sign-in failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}},notice:{description:"Something the user should be told about a sign-in that nevertheless succeeded, such as an old password having been revoked",type:"string",displayName:"Notice",group:"General",getter:function(){return this._internal.notice}}}),inputs:{signIn:{description:"Hands over to the provider, which navigates the browser away — nothing downstream of this runs",displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleSignIn()}},provider:{description:"Id of the sign-in provider to use, as the backend lists it",type:"string",displayName:"Provider",group:"General",set:function(e){this._internal.provider=e}},redirect:{description:"Page the provider should return to; leave blank to come back to the page sign-in started from",type:"string",displayName:"Redirect",group:"General",set:function(e){this._internal.redirect=e}}},methods:{setError:function(e,t){this._internal.error=e,this._internal.signingIn=!1,this.flagOutputDirty("error"),this.flagOutputDirty("signingIn"),(0,i.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:s,message:e})},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,s),this.context.editorConnection.clearWarning(e,this.id,"user-signinwith-warning")}},applyReturn:function(e){if(e.inProgress)return this._internal.signingIn=!0,void this.flagOutputDirty("signingIn");if(!this._internal.returnReported){this._internal.returnReported=!0,this._internal.signingIn=!1,this.flagOutputDirty("signingIn");var t=[this.beginOutcome()];if(e.succeeded)return this._internal.notice=e.notice,this._internal.error=void 0,this.flagOutputDirty("notice"),this.flagOutputDirty("error"),void(0,i.reportOutcomes)(this,t,"done");this.setError(e.error||"Sign-in could not be completed.",t)}},scheduleSignIn:function(){var e=this;(this._internal.pendingSignIn||(this._internal.pendingSignIn=[])).push(this.beginOutcome()),!0!==this.signInScheduled&&(this.signInScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.signInScheduled=!1,e._internal.signingIn=!0,e.flagOutputDirty("signingIn");var t=e._internal.pendingSignIn||[];e._internal.pendingSignIn=[],o.A.instance.signInWithProvider({provider:e._internal.provider,redirect:e._internal.redirect,error:function(n){return e.setError(n,t)}})}))}}},setup:function(){}};n.d(t,["default",0,a])},3752(e,t,n){"use strict";n.r(t);var i=n(5162),o=n(2568),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},s="user/sign-up-failed";function a(e,t,n,i){var o=[];if(i){var r=i.find(function(e){return"_User"===e.name});if(r&&r.schema&&r.schema.properties){var s=r.schema.properties,a=["authData","password","username","createdAt","updatedAt","emailVerified","email","ACL"],l=function(e){if(-1!==a.indexOf(e))return"continue";var t=s[e];if(o.find(function(t){return t.name===e}))return"continue";if("Relation"===t.type);else{var n={String:"string",Boolean:"boolean",Number:"number",Date:"date"};o.push({type:{name:n[t.type]?n[t.type]:"*"},plug:"input",group:"Properties",name:"prop-"+e,displayName:e})}};for(var u in s)l(u)}}n.sendDynamicPorts(e,o)}const l={node:{name:"net.noodl.user.SignUp",docs:"https://docs.noodl.net/nodes/data/user/sign-up",displayNodeName:"Sign Up",category:"Cloud Services",color:"data",initialize:function(){this._internal.userProperties={}},outputs:r(r({},(0,i.outcomeOutputs)({done:"Fires once the account has been created and signed in",failure:"Fires when the account could not be created, after the reason has been reported on the error channel"})),{error:{description:"Why the last sign-up failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}}),inputs:{signup:{description:"Creates an account from the values below and signs it in",displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleSignUp()}},username:{description:"Username for the new account",displayName:"Username",type:"string",group:"General",set:function(e){this._internal.username=e}},password:{description:"Password for the new account",displayName:"Password",type:"string",group:"General",set:function(e){this._internal.password=e}},email:{description:"Email address for the new account; leave blank if the project does not ask for one",displayName:"Email",type:"string",group:"General",set:function(e){this._internal.email=e}}},methods:{setError:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:s,message:e})},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,s),this.context.editorConnection.clearWarning(e,this.id,"user-login-warning")}},scheduleSignUp:function(){var e=this,t=this._internal;(t.pendingSignUp||(t.pendingSignUp=[])).push(this.beginOutcome()),!0!==this.signUpScheduled&&(this.signUpScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.signUpScheduled=!1;var n=t.pendingSignUp||[];t.pendingSignUp=[],o.A.instance.signUp({username:e._internal.username,password:e._internal.password,email:e._internal.email,properties:t.userProperties,success:function(){(0,i.reportOutcomes)(e,n,"done")},error:function(t){e.setError(t,n)}})}))},setUserProperty:function(e,t){this._internal.userProperties[e]=t},registerInputIfNeeded:function(e){if(!this.hasInput(e))return e.startsWith("prop-")?this.registerInput(e,{set:this.setUserProperty.bind(this,e.substring(5))}):void 0}}},setup:function(e,t){var n=e.editorConnection;function i(e){a(e.id,e.parameters,n,t.getMetaData("systemCollections")),e.on("parameterUpdated",function(){a(e.id,e.parameters,n,t.getMetaData("systemCollections"))}),t.on("metadataChanged.systemCollections",function(t){a(e.id,e.parameters,n,t)})}n&&n.isRunningLocally()&&t.on("editorImportComplete",function(){t.on("nodeAdded.net.noodl.user.SignUp",function(e){i(e)});for(var e=0,n=t.getNodesWithType("net.noodl.user.SignUp");e<n.length;e++)i(n[e])})}};n.d(t,["default",0,l])},2568(e,t,n){"use strict";var i,o=n(9405),r=n(3538),s=n.n(r),a=n(319),l=n(3972),u=n(8479),c=n(7011),d=n.n(c),p=function(){function e(){this._initCloudServices(),this.events=new o.EventEmitter,this.events.setMaxListeners(1e5),this.adapter=new a.z({serializeObject:function(e,t){return d()._serializeObject(e,t)}}),this._bridge(this.adapter),this._consumeAuthReturn()||this.getUserFromLocalStorage()&&(this.current=this.getUserModel(),this.fetchCurrentUser({success:function(){},error:function(){}}))}return e.prototype._handle=function(e){if(e&&e!==u.ACTIVE_BACKEND){var t=(0,u.resolveBackendFromRuntime)(e);return t?t.handle:void 0}if(!this.endpoint){var n=(0,u.resolveBackendFromRuntime)(u.ACTIVE_BACKEND);if(n)return n.handle}return{id:"_active_",type:"nodegx",name:"Built-in",url:this.endpoint,publicToken:this.appId}},e.prototype._defaultHandle=function(){return this._handle()},e.prototype._unknownBackend=function(e){return'The backend this node is set to ("'.concat(e,'") is not configured in this project.')},e.prototype._adapter=function(e){return"directus"===e.type||"supabase"===e.type||"pocketbase"===e.type?(void 0===this.restAdapter&&(this.restAdapter=new l.cf,this._bridge(this.restAdapter)),this.restAdapter):this.adapter},e.prototype._active=function(e){var t=this._handle(e);if(t)return{handle:t,adapter:this._adapter(t)}},e.prototype._resolved=function(e,t){var n=this._active(e);return!n&&t&&t(this._unknownBackend(e)),n},e.prototype._bridge=function(e){var t=this;e.on("sessionChanged",function(){void 0===e.getCurrentUser(t._defaultHandle())?delete t.current:t.current=t.getUserModel()}),e.on("loggedIn",function(){return t.events.emit("loggedIn")}),e.on("loggedOut",function(){return t.events.emit("loggedOut")}),e.on("sessionGained",function(){return t.events.emit("sessionGained")}),e.on("sessionLost",function(){void 0===e.getCurrentUser(t._defaultHandle())&&delete t.current,t.events.emit("sessionLost")}),e.events.on("oauthReturn",function(e){return t.events.emit("oauthReturn",e)})},Object.defineProperty(e.prototype,"oauthReturn",{get:function(){return this.adapter.oauthReturn&&this.adapter.oauthReturn.inProgress||this.adapter.oauthReturn&&void 0!==this.adapter.oauthReturn.succeeded?this.adapter.oauthReturn:this.restAdapter&&this.restAdapter.oauthReturn?this.restAdapter.oauthReturn:this.adapter.oauthReturn},enumerable:!1,configurable:!0}),e.prototype.getUserFromLocalStorage=function(){var e=this._active();if(e)return e.adapter.getCurrentUser(e.handle)},e.prototype._initCloudServices=function(){var e=s().instance.getMetaData("cloudservices");e&&(this.appId=e.appId,this.endpoint=e.endpoint)},e.prototype.on=function(e,t){this.events.on(e,t)},e.prototype.off=function(e,t){this.events.off(e,t)},e.prototype._makeRequest=function(e,t){this.adapter._makeRequest(this._defaultHandle(),e,t)},e.prototype.logIn=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.logIn(t.handle,e)},e.prototype.logOut=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.logOut(t.handle,e)},e.prototype.signUp=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.signUp(t.handle,e)},e.prototype.fetchCurrentUser=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.fetchCurrentUser(t.handle,e)},e.prototype.verifyEmail=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.verifyEmail(t.handle,e)},e.prototype.sendEmailVerification=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.sendEmailVerification(t.handle,e)},e.prototype.resetPassword=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.resetPassword(t.handle,e)},e.prototype.requestPasswordReset=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.requestPasswordReset(t.handle,e)},e.prototype.signInWithProvider=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.signInWithProvider(t.handle,e)},e.prototype.requestMagicLink=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.requestMagicLink(t.handle,e)},e.prototype.setUserProperties=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.setUserProperties(t.handle,e)},e.prototype.listAuthProviders=function(e){var t=this._resolved(e.backendId,e.error);t&&t.adapter.listAuthProviders(t.handle,e)},e.prototype._consumeAuthReturn=function(){if(this.adapter.consumeAuthReturn(this._defaultHandle()))return!0;var e=this._active();return!(!e||e.adapter===this.adapter)&&e.adapter.consumeAuthReturn(e.handle)},e.prototype.getCurrentUser=function(){return this.getUserFromLocalStorage()},e.prototype.getUserModel=function(){return this.currentFor(void 0)},e.prototype.currentFor=function(e){var t=this._active(e);if(t){var n=t.adapter.getCurrentUser(t.handle);if(void 0!==n){var i=Object.assign({},n);return delete i.sessionToken,delete i.refreshToken,delete i.expiresAt,delete i.ACL,delete i.className,delete i.__type,d()._fromJSON(i,"_User")}}},e}();p.forScope=function(){return p.instance},Object.defineProperty(p,"instance",{get:function(){return void 0===i&&(i=new p),i}}),s().Services.UserService=p;const h=p;n.d(t,["A",0,h])},1829(e,t,n){"use strict";n.r(t);var i=n(2568),o="user/verify-email-failed";const r={node:{name:"net.noodl.user.VerifyEmail",docs:"https://docs.noodl.net/nodes/data/user/verify-email",displayNodeName:"Verify Email",category:"Cloud Services",color:"data",deprecated:!0,initialize:function(){},getInspectInfo:function(){},outputs:{success:{description:"Fires once the address has been confirmed",type:"signal",displayName:"Success",group:"Events"},failure:{description:"Fires when the token was rejected or the request could not be made, after the reason has been reported on the error channel",type:"signal",displayName:"Failure",group:"Events"},error:{description:"Why the last attempt failed; empty until one does",type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}},inputs:{verify:{description:"Confirms the address using the token from the verification email",displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleVerifyEmail()}},token:{description:"Verification token taken from the link in the email",type:"string",displayName:"Token",group:"General",set:function(e){this._internal.token=e}},username:{description:"Username the verification link was issued for",type:"string",displayName:"Username",group:"General",set:function(e){this._internal.username=e}}},methods:{setError:function(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.raiseRuntimeError(o,e)},clearWarnings:function(){if(this.context.editorConnection){var e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,o),this.context.editorConnection.clearWarning(e,this.id,"user-verify-email-warning")}},scheduleVerifyEmail:function(){var e=this;!0!==this.verifyEmailScheduled&&(this.verifyEmailScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.verifyEmailScheduled=!1,i.A.instance.verifyEmail({token:e._internal.token,username:e._internal.username,success:function(){e.sendSignalOnOutput("success")},error:function(t){e.setError(t)}})}))}}},setup:function(){}};n.d(t,["default",0,r])},6645(e,t,n){"use strict";n.r(t);n.d(t,["default",0,{node:{name:"Value Changed",docs:"https://docs.noodl.net/nodes/logic/value-changed",category:"Logic",initialize:function(){this._internal.lastValue=void 0,this._internal.changeCount=0},getInspectInfo:function(){return this._internal.changeCount?"Triggered "+this._internal.changeCount+(1===this._internal.changeCount?" time":" times"):"Not triggered"},inputs:{value:{group:"Values",type:"*",displayName:"Input",description:"Value to watch; changes are detected by identity, so editing an Object or Array in place is not a change here",set:function(e){this._internal.lastValue!==e&&(this._internal.changeCount++,this.sendSignalOnOutput("valueChanged"),this._internal.lastValue=e)}}},outputs:{valueChanged:{group:"Events",type:"signal",displayName:"Value Changed",description:"Fires when Input becomes a different value, including the first time a value arrives"}}}}])},7269(e,t,n){"use strict";n.r(t);const i={node:n(6141).default.createDefinition({name:"Color",docs:"https://docs.noodl.net/nodes/data/color",startValue:"#f1f2f4",nodeDoubleClickAction:{focusPort:"value"},type:{name:"color"},cast:function(e){return e},emptyOptions:[{value:"null",label:"Null (default)",coerce:null},{value:"empty-string",label:'Empty string ("")',coerce:""}]})};n.d(t,["default",0,i])},3538(e,t,n){"use strict";const i=n(2069),o=n(1185),r=n(8503),s=n(8818),a=n(7492),l=n(6569),u=n(7268),c=n(9209),d=n(9771),p=n(4830),h=n(5293),f=n(6989),g=function e(t){if((t=t||{}).platform=t.platform||{},e.instance=this,this.type=t.type||"browser",this.noodlModules=[],this.eventEmitter=new h,this.updateScheduled=!1,this.rootComponent=null,this._currentLoadedData=null,this.isWaitingForExport=!0,this.graphModel=new a,this.errorHandlers=[],this.frameNumber=0,this.dontCreateRootComponent=!!t.dontCreateRootComponent,this.componentFilter=t.componentFilter,this.runningInEditor=!t.runDeployed,this.platform={requestUpdate:t.platform.requestUpdate,getCurrentTime:t.platform.getCurrentTime,webSocketOptions:t.platform.webSocketOptions,objectToString:t.platform.objectToString,isSSRServer:t.platform.isSSRServer},!t.platform.requestUpdate)throw new Error("platform.requestUpdate must be set");if(!t.platform.getCurrentTime)throw new Error("platform.getCurrentTime must be set");var r;this.editorConnection=new o({platform:this.platform,runtimeType:this.type,clientId:t.editorClientId}),this.context=new i({runningInEditor:!t.runDeployed,editorConnection:this.editorConnection,platform:this.platform,graphModel:this.graphModel}),this.context.eventEmitter.on("scheduleUpdate",this.scheduleUpdate.bind(this)),t.runDeployed||this._setupEditorCommunication(t),this.registerGraphModelListeners(),r=this,[n(7438),n(1609),n(6055),n(2103),n(84),n(4087),n(8576),n(4089),n(7146),n(599),n(4674),n(7697),n(3516),n(5759),n(2371),n(3192),n(973),n(6854),n(7179),n(8562),n(2675),n(2990),n(4629),n(6483),n(3887),n(659),n(4567),n(8257),n(6649),n(8812),n(2546),n(2117),n(8165),n(1157),n(6154),n(4397),n(1341),n(3155),n(200),n(5434),n(5638),n(1305),n(7171),n(3316),n(2772),n(7452),n(9222),n(7746),n(9013),n(5673),n(2694),n(6150),n(6042),n(943),n(6996),n(2430),n(2345),n(3046),n(7426),n(9346),n(2399),n(5856),n(3548),n(4427),n(8865),n(1691),n(5148),n(3579),n(3613),n(4955)].forEach(e=>r.registerNode(e)),"cloud"!==r.type&&[n(8918),n(1988),n(2848),n(7736),n(707),n(774),n(4255),n(7003),n(8520),n(8523)].forEach(e=>r.registerNode(e))};g.prototype.prefetchBundles=async function(e,t){await f(t,e,async e=>{await this.context.fetchComponentBundle(e)})},g.prototype._setupEditorCommunication=function(e){function t(e,n){if(null==e||null==n)return e===n;if(e===n)return!0;if(Array.isArray(e)&&e.length!==n.length)return!1;if(!(e instanceof Object))return!1;if(!(n instanceof Object))return!1;const i=e,o=n;var r=Object.keys(i);return Object.keys(o).every(function(e){return-1!==r.indexOf(e)})&&r.every(function(e){return t(i[e],o[e])})}this.editorConnection.on("exportDataFull",async e=>{if(!1!==this.graphModel.isEmpty()){if(this.isWaitingForExport=!1,!1===t(this._currentLoadedData,e)){if(this.componentFilter&&(e.components=e.components.filter(e=>this.componentFilter(e))),await this.setData(e),e.componentIndex){const t=Object.keys(e.componentIndex);await this.prefetchBundles(t,2)}this.graphModel.emit("editorImportComplete")}}else this.reload()}),this.editorConnection.on("reload",this.reload.bind(this)),this.editorConnection.on("modelUpdate",this.onModelUpdateReceived.bind(this)),this.editorConnection.on("connected",()=>{this.sendNodeLibrary()})},g.prototype.setDebugInspectorsEnabled=function(e){this.context.setDebugInspectorsEnabled(e)},g.prototype.setTraceEnabled=function(e){this.context.setTraceEnabled(e)},g.prototype.registerModule=function(e){if(e.nodes){const t=e.name||"Unknown Module",n=[],i=()=>{for(let e=n.length-1;e>=0;e--)this.context.nodeRegister.restore(n[e].name,n[e].previous)};for(let o=0;o<e.nodes.length;o++){const r=e.nodes[o],s="node"in r&&r.node?r:{node:r};s.node.module=t;const a=s.node&&"string"==typeof s.node.name?s.node.name:void 0;void 0!==a&&n.push({name:a,previous:this.context.nodeRegister.peek(a)});try{this.registerNode(s)}catch(e){i();const n=e&&e.message?e.message:String(e),r=s.node&&s.node.name?`"${s.node.name}"`:`at index ${o}`;if(-1!==n.indexOf(`kit "${t}"`)){if(s.node&&s.node.name)throw e;const t=new Error(`${n} It is the definition at index ${o} in the kit's \`nodes\` list.`);throw t.cause=e,t}const a=new Error(`Kit "${t}" failed to register its node ${r}: ${n}`);throw a.cause=e,a}}}this.noodlModules.push(e)},g.prototype.registerGraphModelListeners=function(){var e=this;this.graphModel.on("componentAdded",function(t){e.context.registerComponentModel(t)},this),this.graphModel.on("componentRemoved",function(t){e.context.deregisterComponentModel(t)},this)},g.prototype.reload=function(){location.reload()},g.prototype.registerNode=function(e){if(e.node){const t=l.defineNode(e.node);this.context.nodeRegister.register(t),t.setupNumberedInputDynamicPorts&&t.setupNumberedInputDynamicPorts(this.context,this.graphModel)}else this.context.nodeRegister.register(e);e.setup&&e.setup(this.context,this.graphModel)},g.prototype._setRootComponent=async function(e){this.rootComponent&&this.rootComponent.name===e||(this.rootComponent&&(this.rootComponent.model&&this.rootComponent.model.removeListenersWithRef(this),this.rootComponent=void 0),e&&(this.rootComponent=await this.context.createComponentInstanceNode(e,"rootComponent"),this.rootComponent.componentModel.on("rootAdded",()=>this.eventEmitter.emit("rootComponentUpdated"),this),this.rootComponent.componentModel.on("rootRemoved",()=>this.eventEmitter.emit("rootComponentUpdated"),this),this.context.setRootComponent(this.rootComponent)),this.eventEmitter.emit("rootComponentUpdated"))},g.prototype.setData=async function(e){if(!this._disableLoad){this._currentLoadedData=e,await this.graphModel.importEditorData(e);for(const e of this.noodlModules)"function"==typeof e.setup&&e.setup.apply(e);!0!==this.dontCreateRootComponent&&(await this._setRootComponent(this.graphModel.rootComponent),this.graphModel.on("rootComponentNameUpdated",e=>{this._setRootComponent(e)}),this.graphModel.on("componentRemoved",e=>{this.rootComponent&&this.rootComponent.name===e.name&&this._setRootComponent(null)}),this.graphModel.on("componentAdded",e=>{setTimeout(()=>{this.rootComponent||this.graphModel.rootComponent!==e.name||this._setRootComponent(e.name)},1)})),this.scheduleUpdate()}},g.prototype.scheduleUpdate=function(){this.updateScheduled||(this.updateScheduled=!0,this.platform.requestUpdate(g.prototype._doUpdate.bind(this)))},g.prototype._doUpdate=function(){this.updateScheduled=!1,this.context.currentFrameTime=this.platform.getCurrentTime(),this.context.eventEmitter.emit("frameStart"),this.context.update(),this.context.eventEmitter.emit("frameEnd"),this.frameNumber++},g.prototype.setProjectSettings=function(e){this.projectSettings=e},g.prototype.setModuleFailures=function(e){this.moduleFailures=Array.isArray(e)?e:void 0},g.prototype.getNodeLibrary=function(){var e=s.generateProjectSettings(this.graphModel.getSettings(),this.noodlModules);this.projectSettings&&(this.projectSettings.ports&&(e.ports=e.ports.concat(this.projectSettings.ports)),this.projectSettings.dynamicports&&(e.dynamicports=e.ports.concat(this.projectSettings.dynamicports)));const t=r(this.context.nodeRegister,{runtimeType:this.type});return t.projectsettings=e,this.moduleFailures&&this.moduleFailures.length&&(t.modulefailures=this.moduleFailures),JSON.stringify(t,null,3)},g.prototype.sendNodeLibrary=function(){const e=this.getNodeLibrary();this.lastSentNodeLibrary!==e&&(this.lastSentNodeLibrary=e,this.editorConnection.sendNodeLibrary(e))},g.prototype.connectToEditor=function(e){this.editorConnection.connect(e)},g.prototype.onModelUpdateReceived=async function(e){this.isWaitingForExport||("projectInstanceChanged"===e.type?this.reload():!1===this.graphModel.isEmpty()&&await c.handleEvent(this.context,this.graphModel,e))},g.prototype.addErrorHandler=function(e){this.errorHandlers.push(e)},g.prototype.reportError=function(e){this.errorHandlers.forEach(function(t){t(e)})},g.prototype.getProjectSettings=function(){return this.graphModel.getSettings()},g.prototype.getMetaData=function(e){return this.graphModel.getMetaData(e)},g.Services=d,g.Node=u,g.NodeDefinition=l,g.EdgeTriggeredInput=p,e.exports=g},7161(e,t,n){"use strict";t.AdapterEvents=void 0;const i=n(5293);t.AdapterEvents=class{constructor(){this.events=new i,this.events.setMaxListeners(1e4)}on(e,t,n){this.events.on.apply(this.events,arguments)}off(e,t,n){this.events.off.apply(this.events,arguments)}emitAdapterEvent(e){this.events.emit(e.type,e)}}},3584(e,t,n){"use strict";t.AuthEvents=void 0;const i=n(5293);t.AuthEvents=class{constructor(){this.events=new i,this.events.setMaxListeners(1e5)}on(e,t,n){this.events.on.apply(this.events,arguments)}off(e,t,n){this.events.off.apply(this.events,arguments)}emitAuthEvent(e,t){this.events.emit(e,t)}}},319(e,t,n){"use strict";t.z=void 0;const i=n(3584),o=n(3518),r=n(9328),s=n(2845),a="nodegx_auth",l="nodegx_auth_error";function u(e,t){return"string"==typeof e&&-1!==e.indexOf(t)}function c(e,t,n,i){return"string"!=typeof e||-1===e.indexOf("<")?e||i:-1!==e.indexOf(t)?n:i}class d extends i.AuthEvents{constructor(e){super(),this.oauthReturn={inProgress:!1},this.stores=new Map,this.controllers=new Map,this.serializeObject=e.serializeObject,this.createStore=e.createStore||o.parseSessionStore,this.lifecycle=e.lifecycle||{kind:"eternal"}}sessionStore(e){const t=e.publicToken,n=String(t);let i=this.stores.get(n);return void 0===i&&(i=this.createStore(t),this.stores.set(n,i)),i}lifecycleController(e){const t=String(e.publicToken);let n=this.controllers.get(t);return void 0===n&&(n=new r.TokenLifecycleController({lifecycle:this.lifecycle,store:this.sessionStore(e),onSessionLost:e=>{this.emitAuthEvent("sessionChanged",void 0),this.emitAuthEvent("sessionLost",e)},onSessionClearedElsewhere:()=>{this.emitAuthEvent("sessionChanged",void 0),this.emitAuthEvent("loggedOut")}}),n.start(),this.controllers.set(t,n)),n}getCurrentUser(e){return this.sessionStore(e).read()}setSession(e,t){this.sessionStore(e).write(t),this.lifecycleController(e).sessionChanged(),this.emitAuthEvent("sessionChanged",t)}clearSession(e){this.sessionStore(e).clear(),this.lifecycleController(e).sessionChanged(),this.emitAuthEvent("sessionChanged",void 0)}_makeRequest(e,t,n){if(!e.url)return void(n.error&&n.error({error:"No active cloud service",status:0}));const i=this.sessionStore(e);this.lifecycleController(e).withSession(r=>{const a=new XMLHttpRequest;a.onreadystatechange=function(){if(4===a.readyState){let e;try{e=JSON.parse(a.response)}catch(e){}200===a.status||201===a.status?n.success(e||a.response):n.error(e||{error:a.responseText,status:a.status})}},a.open(n.method||"GET",e.url+t,!0),a.setRequestHeader("X-Parse-Application-Id",e.publicToken);const l=(0,o.parseInstallationIdKey)(e.publicToken);let u=i.readKey(l);void 0===u&&(u=s(),i.writeKey(l,u)),a.setRequestHeader("X-Parse-Installation-Id",u),n.sessionToken?a.setRequestHeader("X-Parse-Session-Token",n.sessionToken):void 0!==r&&a.setRequestHeader("X-Parse-Session-Token",r.sessionToken),a.setRequestHeader("Content-Type","application/json"),a.send(JSON.stringify(n.content))})}logIn(e,t){this._makeRequest(e,"/login",{method:"POST",content:{username:t.username,password:t.password,_method:"GET"},success:n=>{this.setSession(e,n),t.success(n),this.emitAuthEvent("loggedIn",n)},error:e=>{t.error(e.error)}})}logOut(e,t){this._makeRequest(e,"/logout",{method:"POST",content:{},success:()=>{this.clearSession(e),t.success(),this.emitAuthEvent("loggedOut")},error:e=>{t.error(e.error)}})}signUp(e,t){const n=t.properties?this.serializeObject({...t.properties},"_User"):{};this._makeRequest(e,"/users",{method:"POST",content:Object.assign({},n,{username:t.username,password:t.password,email:t.email}),success:n=>{const i={username:t.username};void 0!==t.email&&(i.email=t.email);const o=Object.assign(n,i,t.properties);void 0===o.emailVerified&&(o.emailVerified=!1),this.setSession(e,o),t.success(n),this.emitAuthEvent("loggedIn",o)},error:e=>{t.error(e.error)}})}fetchCurrentUser(e,t){this._makeRequest(e,"/users/me",{method:"GET",sessionToken:t.sessionToken,success:n=>{this.setSession(e,n),this.emitAuthEvent("sessionGained",n),t.success(n)},error:n=>{209===n.code&&(this.sessionStore(e).clear(),this.emitAuthEvent("sessionLost")),t.error(n.error)}})}verifyEmail(e,t){this._makeRequest(e,"/apps/"+e.publicToken+"/verify_email?username="+t.username+"&token="+t.token,{method:"GET",success:e=>{u(e,"Successfully verified your email")?t.success():u(e,"Invalid Verification Link")?t.error("Invalid verification token"):t.error("Failed to verify email")},error:e=>{t.error(c(e.error,"Invalid Verification Link","Invalid verification token","Failed to verify email"))}})}sendEmailVerification(e,t){this._makeRequest(e,"/verificationEmailRequest",{method:"POST",content:{email:t.email},success:()=>{t.success()},error:e=>{t.error(e.error)}})}resetPassword(e,t){this._makeRequest(e,"/apps/"+e.publicToken+"/request_password_reset",{method:"POST",content:{username:t.username,token:t.token,new_password:t.newPassword},success:e=>{u(e,"Password successfully reset")||u(e,"Successfully updated your password")?t.success():u(e,"Invalid Link")?t.error("Invalid or expired reset link"):t.error("Failed to reset password")},error:e=>{t.error(c(e.error,"Invalid Link","Invalid or expired reset link","Failed to reset password"))}})}requestPasswordReset(e,t){this._makeRequest(e,"/requestPasswordReset",{method:"POST",content:{email:t.email},success:()=>{t.success()},error:e=>{t.error(e.error)}})}signInWithProvider(e,t){if(!e.url)return void(t.error&&t.error("No active cloud service"));if(!t.provider)return void(t.error&&t.error("Sign In With: no provider was set."));const n=t.redirect||this._currentUrlWithoutAuthParams(),i=`${e.url}/oauth/${encodeURIComponent(t.provider)}/start?redirect=${encodeURIComponent(n)}`;window.location.href=i}requestMagicLink(e,t){this._makeRequest(e,"/auth/magic-link",{method:"POST",content:{email:t.email,redirect:t.redirect||this._currentUrlWithoutAuthParams()},success:()=>t.success(),error:e=>t.error(e.error)})}setUserProperties(e,t){const n=this.getCurrentUser(e);if(void 0!==n){const i=this.serializeObject({...t.properties},"_User"),o=Object.assign({},{email:t.email,username:t.username},i);delete o.emailVerified,delete o.createdAt,delete o.updatedAt,this._makeRequest(e,"/users/"+n.objectId,{method:"PUT",content:o,success:i=>{Object.assign(n,o),this.setSession(e,n),t.success(i)},error:e=>{t.error(e.error)}})}else t.error("Nobody is signed in.")}listAuthProviders(e,t){this._makeRequest(e,"/auth/providers",{method:"GET",success:e=>t.success(e),error:e=>t.error(e.error)})}consumeAuthReturn(e){if("undefined"==typeof window||!window.location)return!1;let t;try{t=new URLSearchParams(window.location.search)}catch(e){return!1}const n=t.get(a),i=t.get(l);return!(!n&&!i||(t.delete(a),t.delete(l),this._stripAuthParamsFromUrl(t),i?(this.oauthReturn={inProgress:!1,succeeded:!1,error:i},setTimeout(()=>this.emitAuthEvent("oauthReturn",this.oauthReturn),0),0):(this.oauthReturn={inProgress:!0},this._makeRequest(e,"/oauth/exchange",{method:"POST",content:{code:n},success:t=>{this.setSession(e,t),this.oauthReturn={inProgress:!1,succeeded:!0,outcome:t.authOutcome,notice:t.authNotice||void 0},this.emitAuthEvent("oauthReturn",this.oauthReturn),this.emitAuthEvent("loggedIn",t)},error:e=>{this.oauthReturn={inProgress:!1,succeeded:!1,error:e&&e.error||"Sign-in could not be completed."},this.emitAuthEvent("oauthReturn",this.oauthReturn)}}),0)))}_stripAuthParamsFromUrl(e){if(!window.history||"function"!=typeof window.history.replaceState)return;const t=e.toString(),n=window.location.pathname+(t?`?${t}`:"")+window.location.hash;try{window.history.replaceState(window.history.state,"",n)}catch(e){}}_currentUrlWithoutAuthParams(){const e=new URL(window.location.href);return e.searchParams.delete(a),e.searchParams.delete(l),e.toString()}}t.z=d},6342(e,t,n){"use strict";t.ParseWireAdapter=t.o=void 0;const i=n(8995),o=n(7161),r=n(3518),s=n(5600),a=n(8464);function l(e,t){const n=Object.assign({},e);return void 0!==t&&t>0&&(n.status=t),n}t.o="This project has no backend configured. Add one in the Backend panel.";const u={_common:["_createdAt","_updatedAt","objectId"],_User:["_email_verify_token"]};function c(e,t){const n=Object.assign({},e);return u._common.forEach(e=>delete n[e]),t&&u[t]&&u[t].forEach(e=>delete n[e]),n}class d extends o.AdapterEvents{constructor(e){super(),this.serializeObject=e.serializeObject,this.getServerVersionMajor=e.getServerVersionMajor}normalize(e){return(0,a.normalizeRecordIdentity)(e,d.wireIdField)}normalizeAll(e){return(0,a.normalizeRecordIdentities)(e,d.wireIdField)}_makeRequest(e,n,i){if("undefined"!=typeof _noodl_cloud_runtime_version&&"undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.endpoint:e.url)if("undefined"==typeof _noodl_cloud_runtime_version){var o=new XMLHttpRequest;if(o.onreadystatechange=function(){if(4===o.readyState){var e;try{e=JSON.parse(o.response||o.responseText)}catch(e){}200===o.status||201===o.status?i.success(e):i.error(e||{error:o.responseText,status:o.status},o.status)}},o.open(i.method||"GET",e.url+n,!0),o.setRequestHeader("X-Parse-Application-Id",e.publicToken),"undefined"!=typeof _noodl_cloudservices&&void 0!==_noodl_cloudservices.masterKey&&o.setRequestHeader("X-Parse-Master-Key",_noodl_cloudservices.masterKey),void 0!==e.sessionToken)o.setRequestHeader("X-Parse-Session-Token",e.sessionToken);else{var r=p(e);void 0!==r&&o.setRequestHeader("X-Parse-Session-Token",r.sessionToken)}if(i.headers)for(var s in i.headers)void 0!==i.headers[s]&&o.setRequestHeader(s,i.headers[s]);i.onUploadProgress&&(o.upload.onprogress=e=>i.onUploadProgress(e)),i.content instanceof File?o.send(i.content):(o.setRequestHeader("Content-Type","application/json"),o.send(JSON.stringify(i.content)))}else{const t="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.endpoint:e.url,o="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.appId:e.publicToken,r="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.masterKey:void 0,s="undefined"!=typeof _noodl_cloudservices&&_noodl_cloudservices.currentRunId?_noodl_cloudservices.currentRunId():void 0,a=Object.assign({"X-Parse-Application-Id":o,"Content-Type":"application/json"},void 0!==r?{"X-Parse-Master-Key":r}:{},void 0!==s?{"X-NodeGX-Run":s}:{},i.headers||{});fetch(t+n,{method:i.method||"GET",headers:a,body:JSON.stringify(i.content)}).then(e=>{200===e.status||201===e.status?"DELETE"===i.method?i.success(void 0):e.json().then(e=>i.success(e)).catch(e=>i.error({error:"CloudStore: Failed to get json result."})):"DELETE"===i.method?i.error({error:"Failed to delete."},e.status):e.json().then(t=>i.error(t,e.status)).catch(t=>i.error({error:"Failed to fetch."},e.status))}).catch(e=>{i.error({error:e.message})})}else i.error({error:t.o})}query(e,t){const n=this;this._makeRequest(e,"/classes/"+t.collection,{method:"POST",content:{_method:"GET",where:t.where,limit:t.limit,skip:t.skip,include:Array.isArray(t.include)?t.include.join(","):t.include,keys:Array.isArray(t.select)?t.select.join(","):t.select,order:Array.isArray(t.sort)?t.sort.join(","):t.sort,count:t.count,search:t.search||void 0},success:function(e){t.success(n.normalizeAll(e.results),e.count)},error:function(e){t.error(e&&e.error)}})}aggregate(e,t){const n=[];if(!t.group)return void t.error("You need to provide group option.");t.limit&&n.push("limit="+t.limit),t.skip&&n.push("skip="+t.skip);const i={};Object.keys(t.group).forEach(e=>{const n={},o=t.group[e];void 0!==o.avg?n.$avg="$"+o.avg:void 0!==o.sum?n.$sum="$"+o.sum:void 0!==o.max?n.$max="$"+o.max:void 0!==o.min?n.$min="$"+o.min:void 0!==o.distinct&&(n.$addToSet="$"+o.distinct),i[e]=n});const o=this.getServerVersionMajor();o&&o>4?(i._id=null,t.where&&n.push("$match="+encodeURIComponent(JSON.stringify(t.where))),n.push("$group="+JSON.stringify(i))):(i.objectId=null,t.where&&n.push("match="+encodeURIComponent(JSON.stringify(t.where))),n.push("group="+JSON.stringify(i))),this._makeRequest(e,"/aggregate/"+t.collection+(n.length>0?"?"+n.join("&"):""),{success:function(e){const n={};e.results&&1===e.results.length?(Object.keys(t.group).forEach(t=>{n[t]=e.results[0][t]}),t.success(n)):t.success({})},error:function(e){t.error(e&&e.error)}})}count(e,t){const n=[];t.where&&n.push("where="+encodeURIComponent(JSON.stringify(t.where))),n.push("limit=0"),n.push("count=1"),this._makeRequest(e,"/classes/"+t.collection+(n.length>0?"?"+n.join("&"):""),{success:function(e){t.success(e.count)},error:function(e){t.error(e&&e.error)}})}distinct(e,t){const n=[];t.where&&n.push("where="+encodeURIComponent(JSON.stringify(t.where))),n.push("distinct="+t.property),this._makeRequest(e,"/aggregate/"+t.collection+(n.length>0?"?"+n.join("&"):""),{success:function(e){t.success(e.results)},error:function(e){t.error(e&&e.error)}})}fetch(e,t){const n=[];t.include&&n.push("include="+(Array.isArray(t.include)?t.include.join(","):t.include)),this._makeRequest(e,"/classes/"+t.collection+"/"+t.objectId+(n.length>0?"?"+n.join("&"):""),{method:"GET",success:e=>{const n=this.normalize(e);t.success(n),this.emitAdapterEvent({type:"fetch",objectId:t.objectId,object:n,collection:t.collection})},error:function(e){t.error(e.error)}})}create(e,t){this._makeRequest(e,"/classes/"+t.collection,{method:"POST",headers:t.upsertOn?{"X-NodeGX-Upsert":t.upsertOn}:void 0,content:Object.assign(c(this.serializeObject(t.data,t.collection),t.collection),{ACL:t.acl}),success:e=>{const n=this.normalize(Object.assign({},t.data,e));t.success(n),this.emitAdapterEvent({type:"create",objectId:t.objectId,object:n,collection:t.collection})},error:function(e){t.error(e.error)}})}increment(e,t){const n={};for(let e in t.properties)n[e]={__op:"Increment",amount:t.properties[e]};this._makeRequest(e,"/classes/"+t.collection+"/"+t.objectId,{method:"PUT",content:n,success:e=>{t.success(this.normalize(e))},error:function(e){t.error(e.error)}})}save(e,t){const n=Object.assign({},t.data);delete n.createdAt,delete n.updatedAt,this._makeRequest(e,"/classes/"+t.collection+"/"+t.objectId,{method:"PUT",content:Object.assign(c(this.serializeObject(n,t.collection),t.collection),{ACL:t.acl}),headers:t.ifMatch?{"X-NodeGX-If":JSON.stringify(t.ifMatch)}:void 0,success:e=>{t.success(this.normalize(e)),this.emitAdapterEvent({type:"save",objectId:t.objectId,object:this.normalize(Object.assign({},t.data,e)),collection:t.collection})},error:function(e){t.error(e.error,e)}})}delete(e,t){this._makeRequest(e,"/classes/"+t.collection+"/"+t.objectId,{method:"DELETE",success:()=>{t.success(),this.emitAdapterEvent({type:"delete",objectId:t.objectId,collection:t.collection})},error:function(e){t.error(e.error)}})}addRelation(e,t){const n={};n[t.key]={__op:"AddRelation",objects:[{__type:"Pointer",objectId:t.targetObjectId,className:(0,i.relationTarget)(t)}]},this._makeRequest(e,"/classes/"+t.collection+"/"+t.objectId,{method:"PUT",content:n,success:e=>{t.success(this.normalize(e))},error:function(e){t.error(e.error)}})}removeRelation(e,t){const n={};n[t.key]={__op:"RemoveRelation",objects:[{__type:"Pointer",objectId:t.targetObjectId,className:(0,i.relationTarget)(t)}]},this._makeRequest(e,"/classes/"+t.collection+"/"+t.objectId,{method:"PUT",content:n,success:e=>{t.success(this.normalize(e))},error:function(e){t.error(e.error)}})}uploadFile(e,t){this._makeRequest(e,"/files/"+t.file.name,{method:"POST",content:t.file,contentType:t.file.type,headers:t.private?{"X-NodeGX-File-Private":"true"}:void 0,success:e=>t.success((0,s.normalizeFileRef)(e,s.PARSE_FILE_FIELDS)),error:(e,n)=>t.error(l(e,n)),onUploadProgress:t.onUploadProgress})}signFileUrl(e,t){this._makeRequest(e,"/files/"+t.name+"/sign",{method:"GET",success:e=>t.success((0,s.normalizeSignedFileUrl)(e,"signed")),error:(e,n)=>t.error(l(e,n))})}currentUserId(e){const t=p(e);return void 0!==t?t.objectId:void 0}deleteFile(e,t){this._makeRequest(e,"/files/"+t.file.name,{method:"DELETE",success:e=>t.success(Object.assign({},t.data,e)),error:(e,n)=>t.error(l(e,n))})}}function p(e){return(0,r.parseSessionStore)(e.publicToken).read()}t.ParseWireAdapter=d,d.wireIdField="objectId"},3972(e,t,n){"use strict";t.S6=t.cf=t.OL=t.REST_USER_READONLY_FIELDS=t.xh=void 0,t.restSessionKey=f;const i=n(8995),o=n(3584),r=n(3518),s=n(9328);t.xh="users";const a=Object.freeze({directus:{type:"directus",login:"/auth/login",logout:"/auth/logout",signUp:"/users/register",me:"/users/me",refresh:"/auth/refresh",requestPasswordReset:"/auth/password/request",resetPassword:"/auth/password/reset",verifyEmail:"/users/register/verify-email",authMethods:"/auth",oauthStart:"/auth/login/{provider}",idField:"id",refreshNeedsRefreshToken:!0},pocketbase:{type:"pocketbase",login:"/api/collections/{collection}/auth-with-password",signUp:"/api/collections/{collection}/records",me:"/api/collections/{collection}/auth-refresh",refresh:"/api/collections/{collection}/auth-refresh",requestPasswordReset:"/api/collections/{collection}/request-password-reset",resetPassword:"/api/collections/{collection}/confirm-password-reset",sendEmailVerification:"/api/collections/{collection}/request-verification",verifyEmail:"/api/collections/{collection}/confirm-verification",authMethods:"/api/collections/{collection}/auth-methods",oauthExchange:"/api/collections/{collection}/auth-with-oauth2",idField:"id",refreshNeedsRefreshToken:!1}});function l(e){return a[e]}function u(e){const t=(e||{}).meta;return!!t&&!0===t.isNew}function c(e){return`The "${e}" backend is not served by the REST auth adapter. Directus and PocketBase are; the Parse-wire backends use ParseAuthAdapter.`}function d(e){if(!e||"string"!=typeof e)return;const t=e.split(".");if(!(t.length<2))try{const e=t[1].replace(/-/g,"+").replace(/_/g,"/"),n="function"==typeof atob?atob(e):Buffer.from(e,"base64").toString("binary"),i=JSON.parse(n);if("number"!=typeof i.exp||!isFinite(i.exp))return;return 1e3*i.exp}catch(e){return}}function p(e,t,n){const i=t;if(i&&Array.isArray(i.errors)&&i.errors.length>0){const e=i.errors[0];if("string"==typeof(null==e?void 0:e.message))return e.message}return i&&"string"==typeof i.message&&i.message.length>0?i.message:n&&n.length>0&&n.length<400?`HTTP ${e}: ${n}`:`HTTP ${e}`}t.REST_USER_READONLY_FIELDS=Object.freeze(["objectId","id","emailVerified","verified","createdAt","updatedAt","created","updated","collectionId","collectionName","expand","password","passwordConfirm","tokenKey","sessionToken","refreshToken","expiresAt"]),t.OL="NodeGX cannot sign users in to Supabase yet. Supabase authentication is served by a separate service (GoTrue) that has never been tested against, so it is switched off rather than shipped untested. Supabase data nodes work normally.";class h extends o.AuthEvents{constructor(e={}){var n,i,o,s,a;super(),this.stores=new Map,this.controllers=new Map,this.oauthReturn={inProgress:!1},this.fetchImpl=null!==(n=e.fetchImpl)&&void 0!==n?n:(e,t)=>fetch(e,t),this.userCollection=null!==(i=e.userCollection)&&void 0!==i?i:t.xh,this.probedCapabilities=null!==(o=e.probedCapabilities)&&void 0!==o?o:[],this.lifecycleOverride=e.lifecycle,this.now=null!==(s=e.now)&&void 0!==s?s:Date.now,this.isBrowserTabImpl=e.isBrowserTab,this.createStore=null!==(a=e.createStore)&&void 0!==a?a:e=>new r.SessionStore({key:f(e)})}sessionStore(e){const t=String(e.id)+"|"+String(e.url);let n=this.stores.get(t);return void 0===n&&(n=this.createStore(e),this.stores.set(t,n)),n}getCurrentUser(e){return this.sessionStore(e).read()}lifecycleFor(e){if(this.lifecycleOverride)return this.lifecycleOverride;try{return(0,i.descriptorFor)(e.type).tokenLifecycle}catch(e){return{kind:"eternal"}}}lifecycleController(e){const t=String(e.id)+"|"+String(e.url);let n=this.controllers.get(t);if(void 0===n){const i=l(e.type);n=new s.TokenLifecycleController({lifecycle:this.lifecycleFor(e),store:this.sessionStore(e),now:this.now,isBrowserTab:this.isBrowserTabImpl,refreshTokenRequired:!i||i.refreshNeedsRefreshToken,performRefresh:i&&i.refresh?t=>this.performRefresh(e,i,t):void 0,onSessionLost:e=>{this.emitAuthEvent("sessionChanged",void 0),this.emitAuthEvent("sessionLost",e)},onSessionClearedElsewhere:()=>{this.emitAuthEvent("sessionChanged",void 0),this.emitAuthEvent("loggedOut")}}),n.start(),this.controllers.set(t,n)}return n}dispose(){this.controllers.forEach(e=>e.stop()),this.controllers.clear()}setSession(e,t){this.sessionStore(e).write(t),this.lifecycleController(e).sessionChanged(),this.emitAuthEvent("sessionChanged",t)}clearSession(e){this.sessionStore(e).clear(),this.lifecycleController(e).sessionChanged(),this.emitAuthEvent("sessionChanged",void 0)}capability(e,t){try{return(0,i.descriptorFor)(e.type).capabilities[t]}catch(e){return}}allows(e,t){const n=this.capability(e,t);return!!n&&("supported"===n.state||"degraded"===n.state||"conditional"===n.state&&this.probedCapabilities.includes(t))}resolveProfile(e,n){if("supabase"===e.type)return void n(t.OL);const i=l(e.type);if(i){if(e.url)return i;n("No backend URL is configured.")}else n(c(e.type))}begin(e,t,n){const i=this.resolveProfile(e,n);if(!i)return;const o=this.capability(e,t);if(this.allows(e,t))return i;n((o&&"supported"!==o.state?o.reason:void 0)||`${e.name||e.type} does not support ${t}.`)}path(e,t,n){let i=t.replace("{collection}",encodeURIComponent(this.userCollection));for(const[e,t]of Object.entries(n||{}))i=i.replace("{"+e+"}",encodeURIComponent(t));return i}url(e,t){return(e.url||"").replace(/\/$/,"")+t}request(e,t,n){const i={"Content-Type":"application/json"};t.token&&(i.Authorization=`Bearer ${t.token}`),this.fetchImpl(this.url(e,t.path),{method:t.method||"GET",headers:i,body:void 0===t.body?void 0:JSON.stringify(t.body)}).then(e=>e.text().then(t=>{let i;try{i=""===t?void 0:JSON.parse(t)}catch(e){i=void 0}e.status>=200&&e.status<300?n.ok(i):n.fail({error:p(e.status,i,t),status:e.status})})).catch(e=>{n.fail({error:e instanceof Error?e.message:String(e),status:0})})}authed(e,t,n){this.lifecycleController(e).withSession((i,o)=>{o?n.fail({error:o,status:401}):this.request(e,{...t,token:null==i?void 0:i.sessionToken},n)})}readSession(e,t,n){var i;const o=t||{};switch(e.type){case"directus":{const e=o.data||o,t=e.access_token;if(!t)return;return Object.assign({},n,{sessionToken:t,refreshToken:null!==(i=e.refresh_token)&&void 0!==i?i:null==n?void 0:n.refreshToken,expiresAt:this.directusExpiry(t,e.expires)})}case"pocketbase":{const t=o.token;if(!t)return;const i=o.record||{};return Object.assign({},n,this.normalizeUser(e,i),{sessionToken:t,expiresAt:d(t)})}default:return}}directusExpiry(e,t){const n=d(e);return void 0!==n?n:"number"==typeof t&&isFinite(t)&&t>0?this.now()+t:void 0}normalizeUser(e,t){const n=Object.assign({},t),i=t[e.idField];return null!=i&&(n.objectId=String(i)),"objectId"!==e.idField&&delete n[e.idField],"pocketbase"===e.type&&"verified"in t&&(n.emailVerified=!0===t.verified),delete n.password,delete n.tfa_secret,n}readUser(e,t){const n=t||{};switch(e.type){case"directus":return this.normalizeUser(e,n.data||n);case"pocketbase":return this.normalizeUser(e,n.record||n);default:return{}}}performRefresh(e,t,n){return new Promise((i,o)=>{const r=this.path(t,t.refresh),s="directus"===t.type?{method:"POST",path:r,body:{refresh_token:n.refreshToken,mode:"json"}}:{method:"POST",path:r,token:n.sessionToken,body:{}};this.request(e,s,{ok:e=>{const r=this.readSession(t,e,n);r&&r.sessionToken?i(r):o({error:"The backend did not return a new session token.",fatal:!0})},fail:e=>o(e)})})}logIn(e,t){const n=this.begin(e,"auth.password",t.error);if(!n)return;const i="directus"===n.type?{email:t.username,password:t.password}:{identity:t.username,password:t.password};this.request(e,{method:"POST",path:this.path(n,n.login),body:i},{ok:i=>{const o=this.readSession(n,i,void 0);o?(this.setSession(e,o),"directus"!==n.type?(t.success(o),this.emitAuthEvent("loggedIn",o)):this.fetchUserInto(e,n,o,e=>{t.success(e),this.emitAuthEvent("loggedIn",e)},t.error)):t.error("Sign-in did not return a session.")},fail:e=>t.error(e.error)})}fetchUserInto(e,t,n,i,o){this.request(e,{method:"GET",path:this.path(t,t.me),token:n.sessionToken},{ok:o=>{const r=Object.assign({},n,this.readUser(t,o));this.setSession(e,r),i(r)},fail:e=>o(e.error)})}logOut(e,t){const n=l(e.type),i=this.getCurrentUser(e),o=()=>{this.clearSession(e),t.success(),this.emitAuthEvent("loggedOut")};n&&n.logout&&e.url&&i?this.request(e,{method:"POST",path:this.path(n,n.logout),token:i.sessionToken,body:"directus"===n.type?{refresh_token:i.refreshToken,mode:"json"}:{}},{ok:o,fail:o}):o()}signUp(e,t){const n=this.begin(e,"auth.signUp",t.error);n&&n.signUp&&("directus"!==n.type?this.request(e,{method:"POST",path:this.path(n,n.signUp),body:Object.assign({},t.properties,{email:t.email||t.username,password:t.password,passwordConfirm:t.password})},{ok:()=>this.logIn(e,{username:t.email||t.username,password:t.password,success:t.success,error:t.error}),fail:e=>t.error(e.error)}):this.request(e,{method:"POST",path:this.path(n,n.signUp),body:Object.assign({},t.properties,{email:t.email||t.username,password:t.password})},{ok:()=>this.logIn(e,{username:t.username,password:t.password,success:t.success,error:t.error}),fail:e=>t.error(e.error)}))}fetchCurrentUser(e,n){const i=l(e.type);if(!i)return void n.error("supabase"===e.type?t.OL:c(e.type));const o=this.getCurrentUser(e),r=n.sessionToken||(null==o?void 0:o.sessionToken);if(!r)return void n.error("Nobody is signed in.");const s="pocketbase"===i.type?"POST":"GET";this.request(e,{method:s,path:this.path(i,i.me),token:r,body:"POST"===s?{}:void 0},{ok:t=>{var s;const a=null!==(s=this.readSession(i,t,Object.assign({},o,{sessionToken:r})))&&void 0!==s?s:Object.assign({},o,this.readUser(i,t),{sessionToken:r});this.setSession(e,a),this.emitAuthEvent("sessionGained",a),n.success(a)},fail:t=>{401!==t.status&&403!==t.status||(this.sessionStore(e).clear(),this.emitAuthEvent("sessionLost",t.error)),n.error(t.error)}})}verifyEmail(e,t){const n=this.begin(e,"auth.emailVerify",t.error);if(!n)return;if(!n.verifyEmail)return void t.error(`${e.name||e.type} has no way to confirm an email address from an app.`);const i="directus"===n.type?{method:"GET",path:`${this.path(n,n.verifyEmail)}?token=${encodeURIComponent(t.token)}`}:{method:"POST",path:this.path(n,n.verifyEmail),body:{token:t.token}};this.request(e,i,{ok:()=>t.success(),fail:e=>t.error(e.error)})}sendEmailVerification(e,t){const n=this.begin(e,"auth.emailVerify",t.error);n&&(n.sendEmailVerification?this.request(e,{method:"POST",path:this.path(n,n.sendEmailVerification),body:{email:t.email}},{ok:()=>t.success(),fail:e=>t.error(e.error)}):t.error(`${e.name||e.type} cannot re-send a verification email from an app. Re-send it from your Directus admin instead.`))}requestPasswordReset(e,t){const n=this.begin(e,"auth.passwordReset",t.error);n&&n.requestPasswordReset&&this.request(e,{method:"POST",path:this.path(n,n.requestPasswordReset),body:{email:t.email}},{ok:()=>t.success(),fail:e=>t.error(e.error)})}resetPassword(e,t){const n=this.begin(e,"auth.passwordReset",t.error);if(!n||!n.resetPassword)return;const i="directus"===n.type?{token:t.token,password:t.newPassword}:{token:t.token,password:t.newPassword,passwordConfirm:t.newPassword};this.request(e,{method:"POST",path:this.path(n,n.resetPassword),body:i},{ok:()=>t.success(),fail:e=>t.error(e.error)})}pendingKey(e){return f(e)+".oauth-pending"}readPending(e){const t=this.sessionStore(e).readKey(this.pendingKey(e));if(void 0!==t)try{const e=JSON.parse(t);return e&&"string"==typeof e.provider?e:void 0}catch(e){return}}clearPending(e){this.sessionStore(e).writeKey(this.pendingKey(e),"")}listAuthProviders(e,t){const n=this.resolveProfile(e,t.error);n&&n.authMethods?this.request(e,{method:"GET",path:this.path(n,n.authMethods)},{ok:e=>t.success(function(e,t){const n=t||{};if("pocketbase"===e.type){const e=n.oauth2||{},t=n.otp||{};return{providers:(!0===e.enabled&&Array.isArray(e.providers)?e.providers:[]).filter(e=>e&&"string"==typeof e.name).map(e=>({id:e.name,displayName:e.displayName||e.name,raw:Object.assign({},e,{authURL:e.authURL||e.authUrl})})),magicLink:{enabled:!1},otp:{enabled:!0===t.enabled}}}return{providers:(Array.isArray(n.data)?n.data:[]).map(e=>{if("string"==typeof e)return{id:e,displayName:e};const t=e||{};return t.name?{id:t.name,displayName:t.label||t.name}:void 0}).filter(e=>void 0!==e),magicLink:{enabled:!1}}}(n,e)),fail:e=>t.error(e.error)}):n&&t.error(`${e.name||e.type} does not publish a list of sign-in providers.`)}signInWithProvider(e,t){const n=e=>{t.error&&t.error(e)},i=this.resolveProfile(e,n);if(!i)return;if(!t.provider)return void n("Sign In With: no provider was set.");if(!i.oauthExchange)return void n(`NodeGX cannot complete a ${e.name||e.type} single sign-on yet. Directus returns the session as a browser cookie rather than in the response, which needs a different kind of session than NodeGX stores. Use email and password on this backend.`);if("undefined"==typeof window||!window.location)return void n("Signing in with a provider needs a browser.");const o=t.redirect||function(){const e=new URL(window.location.href);return e.searchParams.delete("code"),e.searchParams.delete("state"),e.searchParams.delete("error"),e.searchParams.delete("error_description"),e.toString()}();this.listAuthProviders(e,{success:i=>{const r=(null==i?void 0:i.providers)||[],s=r.find(e=>e.id===t.provider);if(!s)return void n(0===r.length?`${e.name||e.type} has no sign-in providers configured. Add one in its admin panel first.`:`"${t.provider}" is not one of the sign-in providers ${e.name||e.type} offers (${r.map(e=>e.id).join(", ")}).`);const a=s.raw;if(!a||!a.authURL)return void n(`${e.name||e.type} did not return a sign-in URL for "${t.provider}".`);const l=a.authURL+encodeURIComponent(o),u={provider:t.provider,codeVerifier:a.codeVerifier,state:a.state,redirectURL:o,startedAt:this.now()};this.sessionStore(e).writeKey(this.pendingKey(e),JSON.stringify(u)),window.location.href=l},error:e=>n(e||"Could not ask the backend which sign-in providers it offers.")})}consumeAuthReturn(e){if("undefined"==typeof window||!window.location)return!1;const t=l(e.type);if(!t||!t.oauthExchange)return!1;const n=this.readPending(e);if(!n)return!1;let i;try{i=new URLSearchParams(window.location.search)}catch(e){return!1}const o=i.get("code"),r=i.get("state"),s=i.get("error_description")||i.get("error");return!(!o&&!s||(i.delete("code"),i.delete("state"),i.delete("error"),i.delete("error_description"),function(e){if(!window.history||"function"!=typeof window.history.replaceState)return;const t=e.toString(),n=window.location.pathname+(t?`?${t}`:"")+window.location.hash;try{window.history.replaceState(window.history.state,"",n)}catch(e){}}(i),this.clearPending(e),s?(this.oauthReturn={inProgress:!1,succeeded:!1,error:s},setTimeout(()=>this.emitAuthEvent("oauthReturn",this.oauthReturn),0),0):n.state&&r!==n.state?(this.oauthReturn={inProgress:!1,succeeded:!1,error:"This sign-in could not be verified as the one you started. Please try again."},setTimeout(()=>this.emitAuthEvent("oauthReturn",this.oauthReturn),0),0):(this.oauthReturn={inProgress:!0},this.request(e,{method:"POST",path:this.path(t,t.oauthExchange),body:{provider:n.provider,code:o,codeVerifier:n.codeVerifier,redirectURL:n.redirectURL}},{ok:n=>{const i=this.readSession(t,n,void 0);if(!i)return this.oauthReturn={inProgress:!1,succeeded:!1,error:"Sign-in did not return a session."},void this.emitAuthEvent("oauthReturn",this.oauthReturn);this.setSession(e,i),this.oauthReturn={inProgress:!1,succeeded:!0,outcome:u(n)?"created":"signed-in"},this.emitAuthEvent("oauthReturn",this.oauthReturn),this.emitAuthEvent("loggedIn",i)},fail:e=>{this.oauthReturn={inProgress:!1,succeeded:!1,error:e.error||"Sign-in could not be completed."},this.emitAuthEvent("oauthReturn",this.oauthReturn)}}),0)))}requestMagicLink(e,t){const n=this.begin(e,"auth.magicLink",t.error);n&&n.magicLink||n&&t.error(`${e.name||e.type} has no magic-link login.`)}setUserProperties(e,n){const i=l(e.type);if(!i)return void n.error("supabase"===e.type?t.OL:c(e.type));const o=this.getCurrentUser(e);if(!o||!o.objectId)return void n.error("Nobody is signed in.");if(void 0!==n.username&&null!==n.username&&""!==n.username)return void n.error(t.S6);const r=Object.assign({},n.properties);void 0!==n.email&&(r.email=n.email);for(const e of t.REST_USER_READONLY_FIELDS)delete r[e];const s="directus"===i.type?`/users/${encodeURIComponent(o.objectId)}`:`${this.path(i,"/api/collections/{collection}/records")}/${encodeURIComponent(o.objectId)}`;this.authed(e,{method:"PATCH",path:s,body:r},{ok:t=>{const s=Object.assign({},o,this.readUser(i,t),r);this.setSession(e,s),n.success(t)},fail:e=>n.error(e.error)})}}function f(e){return"NodeGX/"+(e.id||e.type)+"/session"}t.cf=h,t.S6="This backend has no usernames, so Username cannot be set. Leave Username blank, or change Email instead."},4758(e,t,n){"use strict";t.RestDataAdapter=void 0;const i=n(8995),o=n(9972),r=n(7161),s=n(4979),a=n(5600),l=n(8464),u=n(3972),c=n(3518),d=Object.freeze({directus:["date_created","date_updated","user_created","user_updated"],supabase:[],pocketbase:["collectionId","collectionName","expand","created","updated"]});function p(e){return null==e?[]:(Array.isArray(e)?e:String(e).split(",")).map(e=>String(e).trim()).filter(e=>e.length>0)}class h extends r.AdapterEvents{constructor(e={}){var t,n,i,o;super(),this.fetchImpl=null!==(t=e.fetchImpl)&&void 0!==t?t:(e,t)=>fetch(e,t),this.probedCapabilities=null!==(n=e.probedCapabilities)&&void 0!==n?n:[],this.probedFilterOperators=null!==(i=e.probedFilterOperators)&&void 0!==i?i:[],this.schemaFor=e.schemaFor,this.serializeObject=null!==(o=e.serializeObject)&&void 0!==o?o:e=>e,this.relationsFor=e.relationsFor}relation(e,t,n){var o;return(0,i.findRelation)(null===(o=this.relationsFor)||void 0===o?void 0:o.call(this,e),t,n)}profileFor(e){return(0,i.restWireProfileFor)(e.type)}capability(e,t){return(0,i.descriptorFor)(e.type).capabilities[t]}allows(e,t){const n=this.capability(e,t);return"supported"===n.state||"degraded"===n.state||"conditional"===n.state&&this.probedCapabilities.includes(t)}begin(e,t,n){const i=this.profileFor(e);if(!i)return void n(`The "${e.type}" backend is not served by the REST adapter. Directus, Supabase and PocketBase are; the Parse-wire backends use their own adapter.`);const o=this.capability(e,t);if(this.allows(e,t))return i;n(("supported"===o.state?"":o.reason)||`${e.type} does not support ${t}.`)}path(e,t,n){const i=e.startsWith("/items/")?(0,s.directusPathOverride)(t):void 0;return(void 0===i?e:i+(e.includes("{id}")?"/{id}":"")).replace("{collection}",encodeURIComponent(t)).replace("{id}",encodeURIComponent(null!=n?n:""))}recordTarget(e,t,n){return e.recordPath.includes("{id}")?{path:this.path(e.recordPath,t,n),params:[]}:{path:this.path(e.recordPath,t),params:[[e.idField,`eq.${n}`]]}}headers(e,t,n){var i;const o={"Content-Type":"application/json"},r=t.sessionToken||t.publicToken;if(r){o.Authorization="bearer"===e.auth?`Bearer ${r}`:r;for(const t of null!==(i=e.tokenHeaders)&&void 0!==i?i:[])o[t]=r}return Object.assign(o,n||{})}url(e,t,n){const i=(e.url||"").replace(/\/$/,""),o=new URLSearchParams;for(const[e,t]of n)o.append(e,t);const r=o.toString();return i+t+(r?"?"+r:"")}request(e,t,n){var i;const o=this.url(e,t.path,null!==(i=t.params)&&void 0!==i?i:[]);this.fetchImpl(o,{method:t.method||"GET",headers:t.headers,body:void 0===t.body?void 0:t.raw?t.body:JSON.stringify(t.body)}).then(e=>e.text().then(t=>{let i;try{i=""===t?void 0:JSON.parse(t)}catch{i=void 0}e.status>=200&&e.status<300?n.ok(i,e.headers):n.fail(function(e,t,n){const i=t;if(i&&Array.isArray(i.errors)&&i.errors.length>0){const e=i.errors[0];if("string"==typeof(null==e?void 0:e.message))return e.message}if(i&&"string"==typeof i.message&&i.message.length>0){const e="string"==typeof i.hint&&i.hint?` (${i.hint})`:"";return i.message+e}return n&&n.length>0&&n.length<400?`HTTP ${e}: ${n}`:`HTTP ${e}`}(e.status,i,t),e.status)})).catch(e=>n.fail(e instanceof Error?e.message:String(e)))}normalize(e,t){return(0,l.normalizeRecordIdentity)(t,e.idField)}normalizeAll(e,t){return(0,l.normalizeRecordIdentities)(t,e.idField)}translateOptions(e,t){return{backend:e.type,schema:this.filterSchema(e,t),probed:this.probedFilterOperators}}filterSchema(e,t){var n,i,o;const r=this.schemaFor?this.schemaFor(t,e):void 0,s=(null!==(i=null===(n=this.relationsFor)||void 0===n?void 0:n.call(this,e))&&void 0!==i?i:[]).filter(e=>e.collection===t);if(0===s.length)return r;const a=Object.assign({},null==r?void 0:r.properties);for(const e of s)a[e.field]=Object.assign({},a[e.field],{targetClass:e.target,cardinality:e.cardinality,...e.readPath?{path:e.readPath}:{}});return{collection:null!==(o=null==r?void 0:r.collection)&&void 0!==o?o:t,properties:a}}query(e,t){const n=this.begin(e,"data.query",t.error);if(!n)return;let o,r;try{const i=this.buildQuery(n,e,t);o=i.params,r=i.headers}catch(e){return void t.error(e instanceof Error?e.message:String(e))}this.request(e,{path:this.path(n.listPath,t.collection),params:o,headers:this.headers(n,e,r)},{ok:(o,r)=>{const s=(0,i.readRows)(n,o),a=this.normalizeAll(n,s).map(n=>this.unwrapIncludes(e,t.collection,p(t.include),n)),l=t.count?(0,i.readTotalCount)(n,o,r,s.length):void 0;t.success(a,l)},fail:e=>t.error(e)})}buildQuery(e,t,n){const i=[];let r;const s=p(n.select),a=p(n.include),l=p(n.sort),u=this.translateOptions(t,n.collection);switch(e.type){case"directus":{const e=(0,o.toDirectusFilter)(n.where,u);Object.keys(e).length>0&&i.push(["filter",JSON.stringify(e)]);const r=s.length>0?s.slice():a.length>0?["*"]:[];for(const e of a){const i=`${this.includePath(t,n.collection,e)}.*`;r.includes(i)||r.push(i)}r.length>0&&i.push(["fields",r.join(",")]),l.length>0&&i.push(["sort",l.join(",")]),n.search&&i.push(["search",n.search]),n.count&&i.push(["meta","total_count,filter_count"]);break}case"supabase":{const c=(0,o.toPostgrest)(n.where,u);for(const e of c.params)i.push([e[0],e[1]]);const d=s.length>0?s.slice():["*"];for(const e of c.embeds)d.push(`${e}!inner(*)`);for(const e of a)c.embeds.includes(e)||d.push(this.postgrestEmbed(t,n.collection,e));if(i.push(["select",d.join(",")]),l.length>0&&i.push(["order",l.map(e=>{const{field:t,descending:n}=function(e){const t=e.trim();return t.startsWith("-")?{field:t.slice(1),descending:!0}:{field:t,descending:!1}}(e);return`${t}.${n?"desc":"asc"}`}).join(",")]),n.search)throw new Error("Supabase has no whole-record search. Add a text-search filter on a specific column instead, or use the built-in backend for ranked search.");n.count&&(r=Object.assign({},e.countRequestHeaders));break}case"pocketbase":{const e=(0,o.toPocketBaseFilter)(n.where,u);if(e.expression&&i.push(["filter",(0,o.bindPocketBaseFilter)(e)]),s.length>0&&i.push(["fields",s.join(",")]),l.length>0&&i.push(["sort",l.join(",")]),a.length>0&&i.push(["expand",a.join(",")]),n.search)throw new Error('PocketBase has no search parameter. NodeGX cannot search every field without the collection schema — filter on a specific field with "contains" instead.');break}}for(const t of this.paginationFor(e,n.limit,n.skip))i.push(t);return{params:i,headers:r}}paginationFor(e,t,n){const{params:o,inexact:r}=(0,i.paginationParams)(e,t,n);if(r)throw new Error(`${e.type} pages results rather than taking a row offset, so it cannot start at row ${n} with a page size of ${null!=t?t:"none"}. Use an offset that is a whole number of pages (0, ${null!=t?t:"n"}, ${2*(null!=t?t:1)}, …), or set a page size.`);return Object.keys(o).map(e=>[e,o[e]])}count(e,t){const n=this.begin(e,"data.count",t.error);if(!n)return;let o;try{o=this.buildQuery(n,e,{collection:t.collection,where:t.where,count:!0,limit:"page"===n.pagination.kind?1:0,success:()=>{},error:()=>{}})}catch(e){return void t.error(e instanceof Error?e.message:String(e))}this.request(e,{path:this.path(n.listPath,t.collection),params:o.params,headers:this.headers(n,e,o.headers)},{ok:(o,r)=>{const s=(0,i.readRows)(n,o),a=(0,i.readTotalCount)(n,o,r,s.length);void 0!==a?t.success(a):t.error(`${e.type} did not report a total for this query.`)},fail:e=>t.error(e)})}distinct(e,t){const n=this.begin(e,"data.distinct",t.error);if(!n)return;if("directus"!==n.type)return void t.error(`${e.type} cannot list the distinct values of a field.`);const r=[["groupBy",t.property],["limit","-1"]];try{const n=(0,o.toDirectusFilter)(t.where,this.translateOptions(e,t.collection));Object.keys(n).length>0&&r.push(["filter",JSON.stringify(n)])}catch(e){return void t.error(e instanceof Error?e.message:String(e))}this.request(e,{path:this.path(n.listPath,t.collection),params:r,headers:this.headers(n,e)},{ok:e=>{const o=(0,i.readRows)(n,e);t.success(o.map(e=>e[t.property]))},fail:e=>t.error(e)})}aggregate(e,t){const n=this.begin(e,"data.aggregate",t.error);if(!n)return;if(!t.group||0===Object.keys(t.group).length)return void t.error("You need to provide group option.");const r=[],s=Object.keys(t.group);try{if("directus"===n.type){for(const e of s){const{fn:n,field:i}=O(t.group[e],e);r.push([`aggregate[${n}]`,i])}const n=(0,o.toDirectusFilter)(t.where,this.translateOptions(e,t.collection));Object.keys(n).length>0&&r.push(["filter",JSON.stringify(n)]),t.limit&&r.push(["limit",String(t.limit)])}else{if("supabase"!==n.type)return void t.error(`${e.type} cannot total or average records on the server.`);{const n=s.map(e=>{const{fn:n,field:i}=O(t.group[e],e);return"*"===i?`${e}:count()`:`${e}:${i}.${n}()`});r.push(["select",n.join(",")]);const i=(0,o.toPostgrest)(t.where,this.translateOptions(e,t.collection));for(const e of i.params)r.push([e[0],e[1]])}}}catch(e){return void t.error(e instanceof Error?e.message:String(e))}this.request(e,{path:this.path(n.listPath,t.collection),params:r,headers:this.headers(n,e)},{ok:e=>{const o=(0,i.readRows)(n,e);if(1!==o.length)return void t.success({});const r={};for(const e of s){const{fn:i,field:s}=O(t.group[e],e);r[e]="directus"===n.type?N(o[0],i,s):o[0][e]}t.success(r)},fail:e=>t.error(e)})}fetch(e,t){const n=this.begin(e,"data.fetch",t.error);if(!n)return;const o=this.recordTarget(n,t.collection,t.objectId),r=o.params.slice(),s=p(t.include);if("supabase"===n.type){const n=["*"];for(const i of s)n.push(this.postgrestEmbed(e,t.collection,i));r.push(["select",n.join(",")])}else"directus"===n.type&&s.length>0?r.push(["fields",["*"].concat(s.map(n=>`${this.includePath(e,t.collection,n)}.*`)).join(",")]):"pocketbase"===n.type&&s.length>0&&r.push(["expand",s.join(",")]);this.request(e,{path:o.path,params:r,headers:this.headers(n,e)},{ok:o=>{const r=(0,i.readRecord)(n,o);if(!r)return void t.error(`No record with id ${t.objectId} in ${t.collection}.`);const a=this.unwrapIncludes(e,t.collection,s,this.normalize(n,r));t.success(a),this.emitAdapterEvent({type:"fetch",objectId:t.objectId,object:a,collection:t.collection})},fail:e=>t.error(e)})}create(e,t){const n=this.begin(e,"data.create",t.error);if(!n)return;if(t.upsertOn)return void t.error(`Upsert is not supported on ${e.type}: "Upsert On" needs a unique index declared on a NodeGX backend collection. Remove the input, or use the backend's own conflict handling.`);if(t.acl&&!this.allows(e,"data.acl")){const t=this.capability(e,"data.acl");console.warn(`[RestDataAdapter] ACL ignored on ${e.type}. ${"supported"===t.state?"":t.reason}`)}const o=this.serializeObject(t.data,t.collection,e);this.request(e,{method:"POST",path:this.path(n.createPath,t.collection),headers:this.headers(n,e,C(n)),body:o},{ok:o=>{const r=(0,i.readRecord)(n,o);if(!r)return void t.error(`${e.type} created the record but returned nothing to identify it. The record may exist; reload the collection to see it.`);const s=this.normalize(n,Object.assign({},t.data,r));t.success(s),this.emitAdapterEvent({type:"create",objectId:s.objectId,object:s,collection:t.collection})},fail:e=>t.error(e)})}save(e,t){const n=this.begin(e,"data.save",t.error);if(!n)return;if(t.ifMatch)return void t.error(`"Only if unchanged" is not supported on ${e.type}: it needs a NodeGX backend. Remove it, or use the backend's own version check.`);const o=this.recordTarget(n,t.collection,t.objectId),r=function(e,t){var n;const i=Object.assign({},t);delete i.objectId,delete i[e.idField];for(const t of null!==(n=d[e.type])&&void 0!==n?n:[])delete i[t];return i}(n,this.serializeObject(t.data,t.collection,e));this.request(e,{method:"PATCH",path:o.path,params:o.params,headers:this.headers(n,e,C(n)),body:r},{ok:o=>{const r=(0,i.readRecord)(n,o);if(!r)return void t.error(`${e.type} saved the record but returned nothing back.`);const s=this.normalize(n,r);t.success(s),this.emitAdapterEvent({type:"save",objectId:t.objectId,object:s,collection:t.collection})},fail:e=>t.error(e)})}increment(e,t){const n=this.begin(e,"data.increment",t.error);if(n){if("pocketbase"===n.type){const o={};for(const e of Object.keys(t.properties))o[`${e}+`]=t.properties[e];const r=this.recordTarget(n,t.collection,t.objectId);return void this.request(e,{method:"PATCH",path:r.path,params:r.params,headers:this.headers(n,e),body:o},{ok:o=>{const r=(0,i.readRecord)(n,o);r?t.success(this.normalize(n,r)):t.error(`${e.type} incremented the record but returned nothing back.`)},fail:e=>t.error(e)})}this.fetch(e,{collection:t.collection,objectId:t.objectId,success:n=>{var i;const o={};for(const e of Object.keys(t.properties)){const r=Number(null!==(i=n[e])&&void 0!==i?i:0);o[e]=(Number.isFinite(r)?r:0)+t.properties[e]}this.save(e,{collection:t.collection,objectId:t.objectId,data:o,success:t.success,error:t.error})},error:t.error})}}delete(e,t){const n=this.begin(e,"data.delete",t.error);if(!n)return;const i=this.recordTarget(n,t.collection,t.objectId);this.request(e,{method:"DELETE",path:i.path,params:i.params,headers:this.headers(n,e)},{ok:()=>{t.success(),this.emitAdapterEvent({type:"delete",objectId:t.objectId,collection:t.collection})},fail:e=>t.error(e)})}addRelation(e,t){this.mutateRelation(e,t,"add")}removeRelation(e,t){this.mutateRelation(e,t,"remove")}mutateRelation(e,t,n){const o=this.begin(e,"relations.addRemove",t.error);if(!o)return;const r=this.relation(e,t.collection,t.key);if(!r)return void t.error(function(e,t){const n=(0,i.relationTarget)(t);return`NodeGX does not know how "${t.key}" relates ${t.collection} to ${n?`"${n}"`:"another collection"} on this ${e.type} backend. Refresh the backend schema in the Backend Services panel — relation details are only readable with admin credentials, so they are read when you connect and not while the app runs.`}(e,t));const s=r.write;"op"!==s.kind?"arrayField"!==s.kind?"foreignKey"!==s.kind?this.relationViaJunction(e,o,t,s,n):this.relationViaForeignKey(e,t,r,s,n):this.relationViaArrayField(e,o,t,s.field,n):t.error(`"${t.key}" on ${t.collection} is a Parse-style relation, which the ${e.type} adapter cannot write. This is a wiring mistake rather than a missing feature.`)}relationViaArrayField(e,t,n,o,r){const s=this.recordTarget(t,n.collection,n.objectId),a={[`${o}${"add"===r?"+":"-"}`]:n.targetObjectId};this.request(e,{method:"PATCH",path:s.path,params:s.params,headers:this.headers(t,e),body:a},{ok:o=>{const s=(0,i.readRecord)(t,o);s?this.relationChanged(e,n,this.normalize(t,s),r):n.error(`${e.type} changed the relation but returned nothing back.`)},fail:e=>n.error(e)})}relationViaForeignKey(e,t,n,i,o){const r="source"===i.on,s=r?t.collection:n.target,a=r?t.objectId:t.targetObjectId,l="add"===o?r?t.targetObjectId:t.objectId:null;this.save(e,{collection:s,objectId:a,data:{[i.field]:l},success:n=>this.relationChanged(e,t,n,o),error:t.error})}relationViaJunction(e,t,n,i,o){const r={[i.sourceField]:n.objectId,[i.targetField]:n.targetObjectId};if("remove"===o)return void this.deleteJunctionRows(e,t,i,r,n);const s=()=>{const s=this.headers(t,e,i.idempotent&&t.createRequestHeaders?Object.assign({},t.createRequestHeaders,{Prefer:[t.createRequestHeaders.Prefer,"resolution=merge-duplicates"].filter(Boolean).join(",")}):C(t));this.request(e,{method:"POST",path:this.path(t.createPath,i.collection),headers:s,body:r},{ok:()=>this.relationChanged(e,n,this.relationResult(n),o),fail:e=>n.error(e)})};i.idempotent?s():this.findJunctionRows(e,t,i,r,{ok:t=>{t.length>0?this.relationChanged(e,n,this.relationResult(n),o):s()},fail:e=>n.error(e)})}junctionParams(e,t){if("supabase"===e.type)return Object.keys(t).map(e=>[e,`eq.${t[e]}`]);if("pocketbase"===e.type)return[["filter",Object.keys(t).map(e=>`${e} = ${JSON.stringify(t[e])}`).join(" && ")]];const n={};for(const e of Object.keys(t))n[e]={_eq:t[e]};return[["filter",JSON.stringify(n)]]}findJunctionRows(e,t,n,o,r){this.request(e,{path:this.path(t.listPath,n.collection),params:this.junctionParams(t,o),headers:this.headers(t,e)},{ok:e=>r.ok(this.normalizeAll(t,(0,i.readRows)(t,e))),fail:r.fail})}deleteJunctionRows(e,t,n,i,o){const r=()=>this.relationChanged(e,o,this.relationResult(o),"remove");"supabase"!==t.type?this.findJunctionRows(e,t,n,i,{ok:i=>{if(0===i.length)return void r();let s=i.length,a=!1;for(const l of i){const i=this.recordTarget(t,n.collection,String(l.objectId));this.request(e,{method:"DELETE",path:i.path,params:i.params,headers:this.headers(t,e)},{ok:()=>{a||0===--s&&r()},fail:e=>{a||(a=!0,o.error(e))}})}},fail:e=>o.error(e)}):this.request(e,{method:"DELETE",path:this.path(t.recordPath,n.collection),params:this.junctionParams(t,i),headers:this.headers(t,e)},{ok:r,fail:e=>o.error(e)})}relationResult(e){return{objectId:e.objectId}}relationChanged(e,t,n,i){t.success(n),this.emitAdapterEvent({type:"save",objectId:t.objectId,object:n,collection:t.collection})}includePath(e,t,n){var i,o;return null!==(o=null===(i=this.relation(e,t,n))||void 0===i?void 0:i.readPath)&&void 0!==o?o:n}postgrestEmbed(e,t,n){const i=this.relation(e,t,n);return i&&i.target!==n?`${n}:${i.target}(*)`:`${n}(*)`}unwrapIncludes(e,t,n,i){if(0===n.length)return i;let o=i;const r=()=>(o===i&&(o=Object.assign({},i)),o),s=i.expand;if(s&&"object"==typeof s)for(const e of n)e in s&&(r()[e]=s[e]);for(const i of n){const n=this.relation(e,t,i),s=null==n?void 0:n.readUnwrapKey;if(!s)continue;const a=o[i];Array.isArray(a)&&(r()[i]=a.map(e=>e&&"object"==typeof e&&s in e?e[s]:e))}return o}beginFile(e,t,n){return this.begin(e,t,e=>n({error:e}))}uploadFile(e,t){const n=this.beginFile(e,"files.upload",t.error);if(!n)return;const i=t.file;if("function"!=typeof(null==i?void 0:i.arrayBuffer)&&"undefined"!=typeof Blob&&!(i instanceof Blob))return void t.error({error:"Upload File was given something that is not a file. Wire the File output of an Open File Picker node into it."});const o=t.file.type||"application/octet-stream";switch(n.type){case"directus":return this.uploadDirectus(e,n,t,i);case"supabase":return this.uploadSupabase(e,n,t,i,o);case"pocketbase":return this.uploadPocketBase(e,n,t,i)}}uploadDirectus(e,t,n,o){const r=new FormData;r.append("file",o,n.file.name),this.request(e,{method:"POST",path:"/files",headers:S(this.headers(t,e)),body:r,raw:!0},{ok:o=>{const r=(0,i.readRecord)(t,o);r?n.success((0,a.normalizeFileRef)(r,a.DIRECTUS_FILE_FIELDS,t=>t?`${b(e)}/assets/${t}`:void 0)):n.error({error:"Directus accepted the upload but did not describe the stored file."})},fail:(e,t)=>n.error(x(e,t))})}uploadSupabase(e,t,n,i,o){const r=n.target;"bucket"===(null==r?void 0:r.kind)?this.request(e,{method:"POST",path:`${f}/object/${w(r.bucket,r.path)}`,headers:Object.assign(this.headers(t,e),{"Content-Type":o}),body:i,raw:!0},{ok:t=>{const i=null!=t?t:{};n.success((0,a.normalizeFileRef)(i,a.SUPABASE_FILE_FIELDS,t=>t?`${b(e)}${f}/object/public/${_(t)}`:void 0,r))},fail:(e,t)=>n.error(x(e,t))}):n.error({error:m})}uploadPocketBase(e,t,n,o){const r=n.target;if("record"!==(null==r?void 0:r.kind))return void n.error({error:y});const s=new FormData;s.append(r.field,o,n.file.name);const l=!r.recordId,u=l?this.path(t.createPath,r.collection):this.path(t.recordPath,r.collection,r.recordId);this.request(e,{method:l?"POST":"PATCH",path:u,headers:S(this.headers(t,e)),body:s,raw:!0},{ok:o=>{const s=(0,i.readRecord)(t,o),l=function(e,t){const n=null==e?void 0:e[t];if("string"==typeof n)return n.length>0?n:void 0;if(Array.isArray(n)&&n.length>0){const e=n[n.length-1];return"string"==typeof e&&e.length>0?e:void 0}}(s,r.field),u="string"==typeof(null==s?void 0:s.id)?s.id:void 0;s&&l&&u?n.success((0,a.normalizeFileRef)({name:l},a.POCKETBASE_FILE_FIELDS,()=>`${b(e)}/api/files/${encodeURIComponent(r.collection)}/${encodeURIComponent(u)}/${encodeURIComponent(l)}`,{kind:"record",collection:r.collection,recordId:u,field:r.field})):n.error({error:`PocketBase accepted the upload but "${r.field}" on the saved record does not name a file. Check that it is a file-typed field.`})},fail:(e,t)=>n.error(x(e,t))})}signFileUrl(e,t){const n=this.beginFile(e,"files.sign",t.error);if(!n)return;const i=e.sessionToken||e.publicToken;switch(n.type){case"directus":{if(!i)return void t.error({error:"A Directus asset link needs a signed-in session or a public token — the backend has neither right now."});const n=(0,a.jwtExpiry)(i);return void t.success({url:`${b(e)}/assets/${encodeURIComponent(t.name)}?access_token=${encodeURIComponent(i)}`,kind:"token",...null!=n?n:{}})}case"supabase":{const i=t.target;return"bucket"!==(null==i?void 0:i.kind)?void t.error({error:v}):void this.request(e,{method:"POST",path:`${f}/object/sign/${w(i.bucket,i.path)}`,headers:this.headers(n,e),body:{expiresIn:g}},{ok:n=>{const i=null==n?void 0:n.signedURL;if("string"!=typeof i||0===i.length)return void t.error({error:"Supabase Storage signed the file but did not return a URL."});const o=`${b(e)}${f}${i}`,r=(0,a.jwtExpiry)(function(e){const t=e.split("?")[1];if(t)for(const e of t.split("&")){const[t,n]=e.split("=");if("token"===t&&n)return decodeURIComponent(n)}}(o));t.success({url:o,kind:"signed",...null!=r?r:{}})},fail:(e,n)=>t.error(x(e,n))})}case"pocketbase":{const i=t.target;return"record"!==(null==i?void 0:i.kind)?void t.error({error:v}):void this.request(e,{method:"POST",path:"/api/files/token",headers:this.headers(n,e)},{ok:n=>{var o;const r=null==n?void 0:n.token;if("string"!=typeof r||0===r.length)return void t.error({error:"PocketBase did not return a file token."});const s=`${b(e)}/api/files/${encodeURIComponent(i.collection)}/${encodeURIComponent(null!==(o=i.recordId)&&void 0!==o?o:"")}/${encodeURIComponent(t.name)}`,l=(0,a.jwtExpiry)(r);t.success({url:`${s}?token=${encodeURIComponent(r)}`,kind:"token",...null!=l?l:{}})},fail:(e,n)=>t.error(x(e,n))})}}}currentUserId(e){const t=new c.SessionStore({key:(0,u.restSessionKey)(e),tabId:"current-user-reader"}).read();return void 0!==t?t.objectId:void 0}deleteFile(e,t){const n=this.beginFile(e,"files.delete",t.error);if(n)switch(n.type){case"directus":return void this.request(e,{method:"DELETE",path:`/files/${encodeURIComponent(t.file.name)}`,headers:this.headers(n,e)},{ok:e=>t.success(null!=e?e:{}),fail:(e,n)=>t.error(x(e,n))});case"supabase":{const i=t.target;return"bucket"!==(null==i?void 0:i.kind)?void t.error({error:v}):void this.request(e,{method:"DELETE",path:`${f}/object/${w(i.bucket,i.path)}`,headers:this.headers(n,e)},{ok:e=>t.success(null!=e?e:{}),fail:(e,n)=>t.error(x(e,n))})}case"pocketbase":{const i=t.target;return"record"===(null==i?void 0:i.kind)&&i.recordId?void this.request(e,{method:"PATCH",path:this.path(n.recordPath,i.collection,i.recordId),headers:this.headers(n,e),body:{[i.field]:null}},{ok:e=>t.success(null!=e?e:{}),fail:(e,n)=>t.error(x(e,n))}):void t.error({error:v})}}}}t.RestDataAdapter=h;const f="/storage/v1",g=300,m="Supabase keeps files in a Storage bucket. Set Bucket and Path on the node — there is no default, and a guessed bucket name fails with an error that does not say so.",y="On PocketBase a file is a field on a record. Set Collection and Field on the node (and Record ID to attach to an existing record rather than create a new one) — a file with no record has nowhere to live.",v="This file came from a saved record, and on this backend a record only stores the file's name — not the bucket or collection it lives in, which is what a link or a delete needs. Wire the Cloud File straight from the Upload File node that produced it, or use a cloud function that knows where the file is.";function b(e){return(e.url||"").replace(/\/$/,"")}function w(e,t){return`${encodeURIComponent(e)}/${_(t)}`}function _(e){return String(e).split("/").filter(e=>e.length>0).map(encodeURIComponent).join("/")}function S(e){const t=Object.assign({},e);return delete t["Content-Type"],t}function O(e,t){const n=e;for(const e of["count","sum","avg","min","max"]){const t=null==n?void 0:n[e];if("string"==typeof t&&t.length>0)return{fn:e,field:t}}if(n&&"string"==typeof n.distinct)throw new Error(`"${t}" asks for the distinct values of "${n.distinct}" inside an aggregate, which these backends cannot do. Use the Distinct operation instead.`);throw new Error(`"${t}" needs one of count, sum, avg, min or max.`)}function N(e,t,n){const i=e[t];return null===i||"object"!=typeof i||Array.isArray(i)?i:i[n]}function C(e){return e.createRequestHeaders?Object.assign({},e.createRequestHeaders):void 0}function x(e,t){return void 0===t?{error:e}:{error:e,status:t}}},3518(e,t){"use strict";t.SessionStore=void 0,t.parseSessionKey=o,t.parseInstallationIdKey=function(e){return"Parse/"+e+"/installationId"},t.parseSessionStore=function(e){const t=String(e);let n=r.get(t);return void 0===n&&(n=new i({key:o(e)}),r.set(t,n)),n};let n=0;class i{constructor(e){this.key=e.key,this.lockKey=e.key+".refresh-lock",this.injectedStorage=e.storage,this.injectedBroadcaster=e.broadcaster,this.lockTtlMs=void 0!==e.lockTtlMs?e.lockTtlMs:1e4,this.now=e.now||Date.now,this.tabId=e.tabId||"tab-"+ ++n+"-"+Math.random().toString(36).slice(2)}get storage(){return void 0!==this.injectedStorage?this.injectedStorage||void 0:function(){if("undefined"!=typeof localStorage)return localStorage}()}get broadcaster(){return void 0!==this.injectedBroadcaster?this.injectedBroadcaster||void 0:function(){if("undefined"!=typeof window&&window&&"function"==typeof window.addEventListener)return window}()}get available(){return void 0!==this.storage}readRaw(){const e=this.storage;if(!e)return;const t=e[this.key];return null==t?void 0:String(t)}read(){const e=this.readRaw();if(void 0!==e)try{return JSON.parse(e)}catch(e){return}}write(e){const t=this.storage;t&&(t[this.key]=JSON.stringify(e))}clear(){const e=this.storage;e&&delete e[this.key]}readKey(e){const t=this.storage;if(!t)return;const n=t[e];return null==n?void 0:String(n)}writeKey(e,t){const n=this.storage;n&&(n[e]=t)}onExternalChange(e){const t=this.broadcaster;if(!t)return()=>{};const n=t=>{t&&null!==t.key&&t.key!==this.key||e(this.read())};return t.addEventListener("storage",n),()=>t.removeEventListener("storage",n)}tryAcquireRefreshLock(){const e=this.storage;if(!e)return!1;const t=this.now(),n=this.readLock();if(n&&n.owner!==this.tabId&&n.expiresAt>t)return!1;e[this.lockKey]=JSON.stringify({owner:this.tabId,expiresAt:t+this.lockTtlMs});const i=this.readLock();return void 0!==i&&i.owner===this.tabId}releaseRefreshLock(){const e=this.storage;if(!e)return;const t=this.readLock();t&&t.owner!==this.tabId||delete e[this.lockKey]}readLock(){const e=this.readKey(this.lockKey);if(void 0!==e)try{const t=JSON.parse(e);if(!t||"string"!=typeof t.owner||"number"!=typeof t.expiresAt)return;return t}catch(e){return}}}function o(e){return"Parse/"+e+"/currentUser"}t.SessionStore=i;const r=new Map},9328(e,t){"use strict";t.TokenLifecycleController=void 0;const n=2147483647;function i(){return!("undefined"==typeof window||!window)&&"undefined"==typeof _noodl_cloud_runtime_version}t.TokenLifecycleController=class{constructor(e){this.started=!1,this.refreshing=!1,this.holdsLock=!1,this.retries=0,this.queue=[],this.lastRefreshAt=0;const t=function(e){if(!e)return"No token lifecycle was declared.";if("eternal"===e.kind)return;if("refresh"!==e.kind)return`Unknown token lifecycle "${e.kind}".`;const t=e.accessTtlSeconds;if("number"!=typeof t||!isFinite(t)||t<=0)return"The access token lifetime must be a number of seconds greater than zero.";const n=e.refreshBeforeExpirySeconds;return"number"!=typeof n||!isFinite(n)||n<0?"The refresh margin must be a number of seconds, and cannot be negative.":n>=t?"The refresh margin has to be shorter than the access token lifetime.":"string"!=typeof e.refreshEndpoint||0===e.refreshEndpoint.length?"A refreshing backend needs the address to send the refresh to.":void 0}(e.lifecycle);t?(this.lifecycle={kind:"eternal"},this.lifecycleError=t,e.onInvalidLifecycle&&e.onInvalidLifecycle(t)):this.lifecycle=e.lifecycle,this.store=e.store,this.performRefresh=e.performRefresh,this.refreshTokenRequired=!1!==e.refreshTokenRequired,this.onSessionRefreshed=e.onSessionRefreshed,this.onSessionLost=e.onSessionLost,this.onSessionClearedElsewhere=e.onSessionClearedElsewhere,this.now=e.now||Date.now,this.setTimeoutImpl=e.setTimeoutImpl||((e,t)=>setTimeout(e,t)),this.clearTimeoutImpl=e.clearTimeoutImpl||(e=>clearTimeout(e)),this.isBrowserTab=e.isBrowserTab||i}get isRefreshing(){return"refresh"===this.lifecycle.kind}get queuedCount(){return this.queue.length}start(){this.started||(this.started=!0,"eternal"!==this.lifecycle.kind&&this.isBrowserTab()&&this.store.available&&(this.unsubscribe=this.store.onExternalChange(e=>this.adoptFromOtherTab(e)),this.sessionChanged()))}stop(){this.started=!1,this.clearTimer(),this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0),this.holdsLock&&(this.store.releaseRefreshLock(),this.holdsLock=!1),this.queue=[],this.refreshing=!1,this.retries=0}sessionChanged(){if("eternal"===this.lifecycle.kind)return;this.retries=0,this.clearTimer();const e=this.store.read();e&&e.sessionToken&&("number"==typeof e.expiresAt&&isFinite(e.expiresAt)||(e.expiresAt=this.now()+1e3*this.lifecycle.accessTtlSeconds,this.store.write(e)),this.arm(e))}withSession(e){const t=this.store.read();if("eternal"===this.lifecycle.kind||!t||!t.sessionToken)return void e(t);const n="number"==typeof t.expiresAt?t.expiresAt:void 0,i=this.now();if(void 0===n||i<n)return void 0!==n&&i>=this.refreshAt(n)&&this.beginRefresh(),void e(t);this.queue.push(e),this.beginRefresh()}refreshAt(e){return"refresh"!==this.lifecycle.kind?e:e-1e3*this.lifecycle.refreshBeforeExpirySeconds}arm(e){const t=e.expiresAt,i=Math.max(this.refreshAt(t),this.lastRefreshAt+5e3)-this.now();this.timer=i<=0?this.setTimeoutImpl(()=>{this.timer=void 0,this.beginRefresh()},0):i>n?this.setTimeoutImpl(()=>{this.timer=void 0,this.sessionChanged()},n):this.setTimeoutImpl(()=>{this.timer=void 0;const e=this.store.read();e&&e.sessionToken&&("number"==typeof e.expiresAt&&this.now()<this.refreshAt(e.expiresAt)?this.arm(e):this.beginRefresh())},i)}clearTimer(){void 0!==this.timer&&(this.clearTimeoutImpl(this.timer),this.timer=void 0)}beginRefresh(){if("refresh"!==this.lifecycle.kind)return;if(this.refreshing)return;if(!this.isBrowserTab())return;if(!this.store.available)return;const e=this.store.read();e&&e.sessionToken&&this.performRefresh&&(!this.refreshTokenRequired||e.refreshToken?this.store.tryAcquireRefreshLock()?(this.holdsLock=!0,this.refreshing=!0,this.clearTimer(),this.performRefresh(e).then(t=>this.onRefreshSucceeded(e,t),e=>this.onRefreshFailed(e))):this.waitForOtherTab():this.failFatally("This sign-in cannot be renewed. Please sign in again."))}onRefreshSucceeded(e,t){if(this.refreshing=!1,this.releaseLock(),this.retries=0,this.lastRefreshAt=this.now(),"refresh"!==this.lifecycle.kind)return;const n=Object.assign({},e,t);"number"==typeof t.expiresAt&&isFinite(t.expiresAt)||(n.expiresAt=this.now()+1e3*this.lifecycle.accessTtlSeconds),this.store.write(n),this.flush(n),this.arm(n),this.onSessionRefreshed&&this.onSessionRefreshed(n)}onRefreshFailed(e){this.refreshing=!1,this.releaseLock();const t=function(e){const t=e||{};return t.error||t.message||void 0}(e);if("rejected"===function(e){const t=e||{};if(!0===t.fatal)return"rejected";if(!1===t.fatal)return"undelivered";const n=t.status;return"number"==typeof n&&n>=400&&n<500?408===n||429===n?"undelivered":"rejected":"undelivered"}(e))return void this.failFatally(t||"Your session has ended. Please sign in again.");const n=this.store.read(),i=n&&"number"==typeof n.expiresAt?n.expiresAt:void 0;if(void 0!==i&&this.now()<i&&this.retries<5){n&&this.flush(n);const e=Math.min(1e3*Math.pow(2,this.retries),3e4);return this.retries++,this.clearTimer(),void(this.timer=this.setTimeoutImpl(()=>{this.timer=void 0,this.beginRefresh()},e))}this.failFatally(t?"Your session could not be renewed: "+t:"Your session could not be renewed because the backend could not be reached.")}failFatally(e){this.clearTimer(),this.retries=0,this.store.clear(),this.flush(void 0,e),this.onSessionLost&&this.onSessionLost(e)}releaseLock(){this.holdsLock&&(this.store.releaseRefreshLock(),this.holdsLock=!1)}flush(e,t){const n=this.queue;this.queue=[];for(const i of n)i(e,t)}waitForOtherTab(){this.clearTimer(),this.timer=this.setTimeoutImpl(()=>{this.timer=void 0,this.beginRefresh()},this.store.lockTtlMs)}adoptFromOtherTab(e){if(!e||!e.sessionToken)return this.clearTimer(),this.flush(void 0,"Signed out in another tab."),void(this.onSessionClearedElsewhere&&this.onSessionClearedElsewhere());this.flush(e),this.sessionChanged()}}},4979(e,t){"use strict";t.vP=void 0,t.directusPathOverride=function(e){if(!function(e){return"string"==typeof e&&e.startsWith("directus_")}(e))return;const n=t.vP[e];return void 0===n?void 0:`/${n}`},t.vP=Object.freeze({directus_users:"users",directus_files:"files",directus_roles:"roles",directus_folders:"folders",directus_activity:"activity",directus_permissions:"permissions",directus_settings:"settings",directus_webhooks:"webhooks",directus_flows:"flows",directus_operations:"operations",directus_panels:"panels",directus_dashboards:"dashboards",directus_notifications:"notifications",directus_shares:"shares",directus_presets:"presets",directus_revisions:"revisions",directus_translations:"translations"})},5600(e,t){"use strict";function n(e,t){if(!e||void 0===t)return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function i(e,t){if(!e||void 0===t)return;const n=e[t];return"number"==typeof n?Number.isFinite(n)?n:void 0:"string"==typeof n&&/^\d+$/.test(n)?Number(n):void 0}t.POCKETBASE_FILE_FIELDS=t.SUPABASE_FILE_FIELDS=t.DIRECTUS_FILE_FIELDS=t.PARSE_FILE_FIELDS=void 0,t.jwtExpiry=function(e){if("string"!=typeof e)return;const t=e.split(".");if(3!==t.length)return;let n;try{const e="function"==typeof atob?atob(function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/");return t+"=".repeat((4-t.length%4)%4)}(t[1])):(i=t[1],Buffer.from(i,"base64").toString("utf-8"));n=JSON.parse(e)}catch{return}var i;const o=n.exp;if("number"!=typeof o||!Number.isFinite(o))return;const r=Math.round(o-Date.now()/1e3);return{expiresAt:new Date(1e3*o).toISOString(),ttlSeconds:r}},t.normalizeFileRef=function(e,t,o,r){const s=n(e,t.name),a={name:s,url:o?o(s,e):n(e,t.url)},l=n(e,t.id);void 0!==l&&(a.id=l);const u=n(e,t.filename);void 0!==u&&(a.filename=u);const c=n(e,t.contentType);void 0!==c&&(a.contentType=c);const d=i(e,t.size);return void 0!==d&&(a.size=d),void 0!==r&&(a.target=r),a},t.normalizeSignedFileUrl=function(e,t){const o={url:n(e,"url"),kind:t},r=n(e,"expiresAt");void 0!==r&&(o.expiresAt=r);const s=i(e,"ttlSeconds");return void 0!==s&&(o.ttlSeconds=s),o},t.fileFailureOf=function(e){if("string"==typeof e)return{message:e,status:0};const t=null!==e&&"object"==typeof e?e:{},n="number"==typeof t.status&&t.status>0?t.status:0;return"string"==typeof t.error&&""!==t.error?{message:t.error,status:n}:{message:n>0?`The backend refused the request with HTTP ${n} and gave no reason`:"The request failed and the backend gave no reason",status:n}},t.PARSE_FILE_FIELDS=Object.freeze({name:"name",url:"url",contentType:"contentType",size:"size"}),t.DIRECTUS_FILE_FIELDS=Object.freeze({name:"id",url:"url",id:"id",filename:"filename_download",contentType:"type",size:"filesize"}),t.SUPABASE_FILE_FIELDS=Object.freeze({name:"Key",url:"url",id:"Id"}),t.POCKETBASE_FILE_FIELDS=Object.freeze({name:"name",url:"url"})},4576(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DirectusWebSocketTransport=void 0;const i=n(3673);class o extends i.RealtimeSubscription{constructor(){super(...arguments),this.transport="websocket",this._socket=null,this._heartbeatTimer=null}openTransport(e){const t=this.resolveWebSocket();if(!t)return void this.fail("TRANSPORT_UNAVAILABLE","WebSocket is not available in this environment.");const n=(0,i.webSocketBase)(this.handle.url);if(!n)return void this.fail("CONNECT_FAILED",`Backend URL is not a valid http(s) URL: ${this.handle.url}`,"fatal");const o=new t(n+"/websocket");this._socket=o,o.onopen=()=>{this._socket===o&&(this.token?this._send({type:"auth",access_token:this.token}):this._subscribe())},o.onmessage=t=>{if(this._socket!==o)return;let n;this._touchHeartbeat(e);try{n=JSON.parse(t.data)}catch(e){return}this._handleFrame(e,n)},o.onclose=()=>this.transportDownFrom(e,"closed"),o.onerror=()=>this.transportDownFrom(e,"errored")}closeTransport(){this._clearHeartbeat();const e=this._socket;e&&(this._socket=null,e.onopen=e.onmessage=e.onclose=e.onerror=null,e.close())}onTransportDown(e){this._clearHeartbeat()}_handleFrame(e,t){var n,o;if("ping"!==t.type)if("auth"!==t.type){if("subscription"===t.type){const n=Array.isArray(t.data)?t.data:[];return"init"===t.event?(this.confirmed(),this._touchHeartbeat(e),void this.emitChange({type:"init",collection:this.collection,ids:(0,i.idsFromRecords)(n,this.primaryKey),records:n,recordsComplete:!0})):"delete"===t.event?void this.emitChange({type:"delete",collection:this.collection,ids:n.map(e=>String(e)),records:[],recordsComplete:!1}):void("create"!==t.event&&"update"!==t.event||this.emitChange({type:t.event,collection:this.collection,ids:(0,i.idsFromRecords)(n,this.primaryKey),records:n,recordsComplete:!0}))}"error"===t.status&&this.fail("SUBSCRIPTION_REJECTED",(null===(o=t.error)||void 0===o?void 0:o.message)||"The subscription was rejected.")}else"ok"===t.status?this._subscribe():"error"===t.status&&this.fail("AUTH_FAILED",(null===(n=t.error)||void 0===n?void 0:n.message)||"Authentication failed.");else this._send({type:"pong"})}_subscribe(){this._send({type:"subscribe",collection:this.collection,uid:"nodegx-realtime"})}_send(e){try{this._socket&&this._socket.send(JSON.stringify(e))}catch(e){}}_touchHeartbeat(e){this._clearHeartbeat(),this._heartbeatTimer=this._setTimeout(()=>{this._heartbeatTimer=null,this.fail("HEARTBEAT_MISSED","No frame from Directus for 90000ms; reconnecting."),this.transportDownFrom(e,"heartbeat-missed")},9e4)}_clearHeartbeat(){if(null===this._heartbeatTimer||void 0===this._heartbeatTimer)return;const e=this._heartbeatTimer;this._heartbeatTimer=null,this._clearTimeout(e)}}t.DirectusWebSocketTransport=o},6661(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParseLiveQueryTransport=void 0;const i=n(3673);class o extends i.RealtimeSubscription{constructor(){super(...arguments),this.transport="none",this._socket=null,this._probeTimer=null,this._startedAt=0,this.lastProbe=null}openTransport(e){const t=this.resolveWebSocket();if(!t)return void this._report({available:!1,reason:"no-websocket",detail:"WebSocket is not available in this environment, so LiveQuery cannot even be asked about.",elapsedMs:0});const n=(0,i.webSocketBase)(this.handle.url);if(!n)return void this._report({available:!1,reason:"absent",detail:`Backend URL is not a valid http(s) URL: ${this.handle.url}`,elapsedMs:0});let o;this._startedAt=Date.now();try{o=new t(n)}catch(e){return void this._report({available:!1,reason:"absent",detail:"The LiveQuery socket could not be opened at all.",elapsedMs:Date.now()-this._startedAt})}this._socket=o;const r=e=>{this._socket===o&&this._report(e)};o.onopen=()=>{r({available:!0,reason:"unimplemented",detail:"A socket at this address accepted a connection, so a LiveQuery server may be running — but NodeGX has never spoken the LiveQuery protocol and BCN-008 declined to write a decoder from documentation. Realtime stays off for Parse backends.",elapsedMs:Date.now()-this._startedAt})},o.onerror=()=>r({available:!1,reason:"absent",detail:"No LiveQuery server answered. Parse LiveQuery runs as a separate server and most deployments do not start one; `/serverInfo` never mentions it either way, so the socket is the only thing that can say.",elapsedMs:Date.now()-this._startedAt}),o.onclose=()=>r({available:!1,reason:"absent",detail:"The LiveQuery socket closed before answering.",elapsedMs:Date.now()-this._startedAt}),this._probeTimer=this._setTimeout(()=>{this._probeTimer=null,r({available:!1,reason:"absent",detail:"Nothing answered on the LiveQuery socket within 2000ms. A socket that fires neither `error` nor `close` is a measured failure mode (BCN-008 §2), not an impossibility.",elapsedMs:Date.now()-this._startedAt})},2e3)}closeTransport(){if(null!==this._probeTimer&&void 0!==this._probeTimer){const e=this._probeTimer;this._probeTimer=null,this._clearTimeout(e)}const e=this._socket;e&&(this._socket=null,e.onopen=e.onmessage=e.onclose=e.onerror=null,e.close())}_report(e){this.lastProbe=e,this.fail("CAPABILITY_UNAVAILABLE",e.detail)}}t.ParseLiveQueryTransport=o},3673(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RealtimeSubscription=void 0,t.errorMessage=a,t.normalizedHttpBase=l,t.webSocketBase=function(e){const t=l(e);return t?t.replace(/^http/i,e=>"HTTP"===e?"WS":"ws"):null},t.idsFromRecords=function(e,t){const n=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e=i[t];null!=e&&n.push(String(e))}return n};const i=n(5527),o=n(8586),r=o.REALTIME_TIMING,s={};function a(e){return String(e&&"object"==typeof e&&"message"in e?e.message:e)}function l(e){if(!e||"string"!=typeof e)return null;const t=e.trim().replace(/\/+$/,"");return/^https?:\/\//i.test(t)?t:null}t.RealtimeSubscription=class{constructor(e,t){this._status="connecting",this._attempt=0,this._generation=0,this._downGeneration=-1,this._confirmedGeneration=-1,this._reportedGeneration=-1,this._reconnectTimer=null,this._deadlineTimer=null,this._disposed=!1,this.handle=e,this.collection=t.collection,this.where=t.where,this.primaryKey=t.primaryKey||"id",this.timing=t.timing||r,this._deps=t.deps||{},this._hostKey=t.deps||s,this._onEvent=t.onEvent,this._onStatus=t.onStatus,this._onError=t.onError}get status(){return this._status}connect(){if(this._disposed||"stopped"===this._status)return;this._clearTimer("_reconnectTimer");const e=++this._generation;this._setStatus(0===this._attempt?"connecting":"interrupted"),this._armDeadline(e);try{this.openTransport(e)}catch(t){this.fail("CONNECT_FAILED","Could not open a realtime connection: "+a(t)),this.transportDownFrom(e,"errored")}}confirmed(){this._disposed||"stopped"===this._status||(this._clearTimer("_deadlineTimer"),this._attempt=0,this._confirmedGeneration=this._generation,this._setStatus("subscribed"))}transportDown(e){this.transportDownFrom(this._generation,e)}transportDownFrom(e,t){if(e!==this._generation)return;if(this._downGeneration===e)return;if(this._downGeneration=e,this._clearTimer("_deadlineTimer"),this._safeClose(),this._disposed||"stopped"===this._status)return;if(this._setStatus("interrupted"),this.onTransportDown(t),this._confirmedGeneration!==e&&this._reportedGeneration!==e&&("errored"===t||"closed"===t)&&this.fail("CONNECT_FAILED",`The realtime connection to "${this.collection}" went down before it was confirmed (${t}).`))return;const n=(0,o.nextReconnectDelay)(this._attempt++,this.timing);this._reconnectTimer=this._setTimeout(()=>{this._reconnectTimer=null,this.connect()},n)}fail(e,t,n){const i={message:t,code:e,kind:n||o.REALTIME_FAILURE_KINDS[e]};return this._reportedGeneration=this._generation,this._notify("onError",()=>this._onError&&this._onError(i)),"fatal"===i.kind&&(this._clearTimer("_deadlineTimer"),this._clearTimer("_reconnectTimer"),this._safeClose(),this._setStatus("stopped"),!0)}interrupted(e){e===this._generation&&(this._disposed||"stopped"===this._status||(this._setStatus("interrupted"),null===this._deadlineTimer&&this._armDeadline(e)))}emitChange(e){this._disposed||this._notify("onEvent",()=>this._onEvent&&this._onEvent(e))}_notify(e,t){try{t()}catch(t){console.error(`[realtime] a ${e} handler for "${this.collection}" threw; the subscription is unaffected.`,t)}}dispose(){this._disposed||(this._disposed=!0,this._clearTimer("_deadlineTimer"),this._clearTimer("_reconnectTimer"),this._safeClose(),this._status="stopped")}onTransportDown(e){}get hostKey(){return this._hostKey}resolveWebSocket(){return"WebSocketImpl"in this._deps?this._deps.WebSocketImpl||null:"undefined"!=typeof WebSocket?WebSocket:null}resolveEventSource(){return"EventSourceImpl"in this._deps?this._deps.EventSourceImpl||null:"undefined"!=typeof EventSource?EventSource:null}resolveFetch(){return this._deps.fetchImpl?this._deps.fetchImpl:"undefined"!=typeof fetch?fetch.bind(globalThis):null}_setTimeout(e,t){return(this._deps.setTimeoutImpl||setTimeout.bind(globalThis))(e,t)}_clearTimeout(e){(this._deps.clearTimeoutImpl||clearTimeout.bind(globalThis))(e)}get token(){return(0,i.isParseWireType)(this.handle.type)?this.handle.sessionToken||"":this.handle.sessionToken||this.handle.publicToken||""}_armDeadline(e){this._clearTimer("_deadlineTimer"),this._deadlineTimer=this._setTimeout(()=>{this._deadlineTimer=null,this.fail("CONNECT_TIMEOUT",`The realtime subscription to "${this.collection}" was not confirmed within ${this.timing.connectTimeoutMs}ms.`),this.transportDownFrom(e,"connect-timeout")},this.timing.connectTimeoutMs)}_clearTimer(e){const t=this[e];null!=t&&(this[e]=null,this._clearTimeout(t))}_safeClose(){try{this.closeTransport()}catch(e){}}_setStatus(e){this._status!==e&&(this._status=e,this._notify("onStatus",()=>this._onStatus&&this._onStatus(e)))}}},6790(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SharedSseConnection=void 0,t.filterKey=o,t.connectionKey=r,t.connectionFor=function(e){const t=e.host||l;let n=a.get(t);n||(n=new Map,a.set(t,n));const i=r(e.dialect.name,e.base,e.token,e.where),o=n.get(i);if(o)return o;const u=new s(e.dialect,e.base,e.token,e.EventSourceImpl,e.fetchImpl,()=>{const e=a.get(t);e&&e.get(i)===u&&e.delete(i)});return n.set(i,u),u},t.openConnectionCount=function(e){const t=a.get(e||l);return t?t.size:0};const i=n(3673);function o(e){if(null==e)return"";try{return JSON.stringify(e)}catch(e){return" uncomparable "}}function r(e,t,n,i){const r=o(i);return e+" "+t+" "+n+(r?" #"+r:"")}class s{constructor(e,t,n,i,o,r){this._dialect=e,this._base=t,this._token=n,this._EventSourceImpl=i,this._fetchImpl=o,this._onEmpty=r,this._es=null,this._clientId=null,this._members=new Set,this._listening=new Set,this._revision=0,this._postedRevision=-1,this._inFlight=!1}get size(){return this._members.size}get clientId(){return this._clientId}join(e){this._members.has(e)||(this._members.add(e),this._revision++,this._es?(this._listen(e.collection),this._post()):this._open())}leave(e){if(this._members.delete(e)){if(this._revision++,0===this._members.size)return this._closeStream(),void this._onEmpty();this._post()}}_open(){const e=this._dialect,t=new this._EventSourceImpl(e.streamUrl(this._base,this._token));this._es=t,this._clientId=null,this._listening.clear();for(const e of this._members)this._listen(e.collection);t.addEventListener(e.helloEvent,e=>{if(this._es!==t)return;let n;try{n=JSON.parse(e.data).clientId}catch(e){return}n&&(this._clientId=n,this._postedRevision=-1,this._post())}),e.resyncEvent&&t.addEventListener(e.resyncEvent,()=>{if(this._es===t)for(const e of[...this._members])e.receiveResync()}),t.onerror=()=>{if(this._es===t)for(const e of[...this._members])e.interrupt()}}_listen(e){if(this._listening.has(e))return;this._listening.add(e);const t=this._es;if(t)for(const n of this._dialect.changeEvents(e))t.addEventListener(n,n=>{if(this._es!==t)return;let i;try{i=JSON.parse(n.data)}catch(e){return}for(const t of[...this._members])t.collection===e&&t.receiveFrame(i)})}_closeStream(){const e=this._es;this._es=null,this._clientId=null,this._listening.clear(),this._postedRevision=-1,e&&(e.onerror=null,e.close())}close(){this._closeStream()}static _memberKey(e){return e.collection+" "+o(e.where)}_requested(){const e=new Set,t=[];for(const n of this._members){const i=s._memberKey(n);e.has(i)||(e.add(i),t.push(void 0===n.where?{collection:n.collection}:{collection:n.collection,where:n.where}))}return{entries:t,keys:e}}_post(){const e=this._clientId;if(!e)return;if(this._inFlight)return;if(this._postedRevision===this._revision)return;if(0===this._members.size)return;const t=this._revision;this._inFlight=!0;const{entries:n,keys:o}=this._requested(),{url:r,init:a}=this._dialect.subscribeRequest(this._base,this._token,e,n);this._fetchImpl(r,a).then(e=>{const t=e?e.status:void 0;return(e&&"function"==typeof e.json?e.json():Promise.resolve(null)).catch(()=>null).then(e=>({status:t,body:e}))}).then(({status:n,body:i})=>{if(this._clientId!==e)return this._inFlight=!1,void this._post();this._postedRevision=t;for(const e of[...this._members])o.has(s._memberKey(e))&&e.settle(this._dialect.readVerdict(n,i,e.collection));this._inFlight=!1,this._post()}).catch(t=>{const n="Could not register the realtime subscription: "+(0,i.errorMessage)(t);if(this._clientId!==e)return this._inFlight=!1,void this._post();for(const e of[...this._members])o.has(s._memberKey(e))&&e.abort(n);this._inFlight=!1,this._post()})}}t.SharedSseConnection=s;const a=new WeakMap,l={}},4827(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SseTransport=t.POCKETBASE_SSE=t.NODEGX_SSE=void 0;const i=n(6790),o=n(3673);function r(e,t){if(!e||"object"!=typeof e)return!0;const n=e.collection;return"string"!=typeof n||n===t}t.NODEGX_SSE={name:"nodegx",streamUrl:(e,t)=>e+"/realtime"+(t?"?token="+encodeURIComponent(t):""),helloEvent:"connected",changeEvents:()=>["change"],resyncEvent:"resync",subscribeRequest(e,t,n,i){const o=i.map(e=>void 0===e.where?{collection:e.collection}:{collection:e.collection,filter:e.where}),r={"content-type":"application/json"};return t&&(r.authorization="Bearer "+t),{url:e+"/realtime/subscriptions",init:{method:"POST",headers:r,body:JSON.stringify({clientId:n,subscriptions:o})}}},readVerdict(e,t,n){const i=t||{};if((Array.isArray(i.accepted)?i.accepted:[]).some(e=>r(e,n)))return{ok:!0};const o=(Array.isArray(i.rejected)?i.rejected:[]).filter(e=>r(e,n))[0];return{ok:!1,reason:o&&o.reason||void 0}},parseChange(e,t,n){var i;const o=n,r=o&&o.action;if("create"!==r&&"update"!==r&&"delete"!==r)return null;if(o.collection&&o.collection!==e)return null;const s=o.record,a=s?null!==(i=s.objectId)&&void 0!==i?i:s[t]:void 0;return{type:r,collection:e,ids:null==a?[]:[String(a)],records:s?[s]:[],recordsComplete:!!s}}},t.POCKETBASE_SSE={name:"pocketbase",streamUrl:e=>e+"/api/realtime",helloEvent:"PB_CONNECT",changeEvents:e=>[e],subscribeRequest(e,t,n,i){const o={"content-type":"application/json"};t&&(o.authorization=t);const r=[];for(const e of i)-1===r.indexOf(e.collection)&&r.push(e.collection);return{url:e+"/api/realtime",init:{method:"POST",headers:o,body:JSON.stringify({clientId:n,subscriptions:r})}}},readVerdict:(e,t)=>204===e||200===e?{ok:!0}:{ok:!1,reason:(t&&"object"==typeof t?t.message:void 0)||(void 0===e?void 0:"HTTP "+e)},parseChange(e,t,n){var i;const o=n,r=o&&o.action;if("create"!==r&&"update"!==r&&"delete"!==r)return null;const s=o.record,a=s?null!==(i=s[t])&&void 0!==i?i:s.id:void 0;return{type:r,collection:e,ids:null==a?[]:[String(a)],records:s?[s]:[],recordsComplete:!!s}}};class s extends o.RealtimeSubscription{constructor(e,t,n){super(e,t),this.transport="sse",this._connection=null,this._member=null,this._dialect=n}get dialect(){return this._dialect.name}openTransport(e){const t=this.resolveEventSource();if(!t)return void this.fail("TRANSPORT_UNAVAILABLE","EventSource is not available in this environment.");const n=this.resolveFetch();if(!n)return void this.fail("TRANSPORT_UNAVAILABLE","fetch is not available to register the realtime subscription.");const r=(0,o.normalizedHttpBase)(this.handle.url);if(!r)return void this.fail("CONNECT_FAILED",`Backend URL is not a valid http(s) URL: ${this.handle.url}`,"fatal");const s=(0,i.connectionFor)({host:this.hostKey,dialect:this._dialect,base:r,token:this.token,EventSourceImpl:t,fetchImpl:n,where:this.where}),a=this._buildMember(e);this._connection=s,this._member=a,s.join(a)}closeTransport(){const e=this._connection,t=this._member;this._connection=null,this._member=null,e&&t&&e.leave(t)}_buildMember(e){const t=this._dialect;return{collection:this.collection,where:this.where,receiveFrame:e=>{const n=t.parseChange(this.collection,this.primaryKey,e);n&&this.emitChange(n)},receiveResync:()=>{this.emitChange({type:"resync",collection:this.collection,ids:[],records:[],recordsComplete:!1})},settle:t=>{t.ok?this.confirmed():(this.fail("SUBSCRIPTION_REJECTED",`The subscription to "${this.collection}" was rejected: ${t.reason||"no reason given"}`),this.transportDownFrom(e,"closed"))},interrupt:()=>{this.interrupted(e)},abort:t=>{this.fail("CONNECT_FAILED",t),this.transportDownFrom(e,"closed")}}}}t.SseTransport=s},8570(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CUSTOM_REALTIME_REASON=t.SUPABASE_REALTIME_REASON=t.UnavailableTransport=void 0;const i=n(3673);class o extends i.RealtimeSubscription{constructor(e,t,n,i="none"){super(e,t),this._reason=n,this.transport=i}openTransport(e){this.fail("CAPABILITY_UNAVAILABLE",this._reason)}closeTransport(){}}t.UnavailableTransport=o,t.SUPABASE_REALTIME_REASON="Realtime is not available for Supabase backends. Supabase Realtime is a separate Phoenix-channel service and NodeGX has never connected to one — every cell in the contract's Supabase realtime profile is unmeasured (BCN-008), so no transport was written for it. The capability is conditional, not supported.",t.CUSTOM_REALTIME_REASON="Realtime is not available for a custom backend. There is no wire to speak: declare a transport for it if the API has one."},5153(e,t,n){"use strict";t.realtimeSupportFor=function(e){if(l(e))return{transport:"sse",state:"supported"};switch(e){case"directus":return{transport:"websocket",state:"supported"};case"pocketbase":return{transport:"sse",state:"supported"};case"parse":return{transport:"none",state:"conditional",reason:"Parse LiveQuery runs as a separate server and most deployments do not start one. NodeGX probes for it and reports what it finds; realtime is off unless one answers."};case"supabase":return{transport:"phoenix-channel",state:"unsupported",reason:s.SUPABASE_REALTIME_REASON};default:return{transport:"none",state:"unsupported",reason:s.CUSTOM_REALTIME_REASON}}},t.createRealtimeSubscription=function(e,t){const n=function(e,t){const n=e.type;return l(n)?new r.SseTransport(e,t,r.NODEGX_SSE):"directus"===n?new i.DirectusWebSocketTransport(e,t):"pocketbase"===n?new r.SseTransport(e,t,r.POCKETBASE_SSE):"parse"===n?new o.ParseLiveQueryTransport(e,t):"supabase"===n?new s.UnavailableTransport(e,t,s.SUPABASE_REALTIME_REASON,"phoenix-channel"):new s.UnavailableTransport(e,t,s.CUSTOM_REALTIME_REASON)}(e,t);return n.connect(),n};const i=n(4576),o=n(6661),r=n(4827),s=n(8570);n(3673),n(4576),n(4827),n(6790),n(6661),n(8570);const a=["nodegx","nodegx-backend","local"];function l(e){return!!e&&-1!==a.indexOf(e)}},8464(e,t){"use strict";function n(e,n){if(n===t.m)return e;if(null==e||"object"!=typeof e)return e;if(!(n in e))return e;const i=Object.assign({},e);return i[t.m]=e[n],delete i[n],i}t.m=void 0,t.normalizeRecordIdentity=n,t.normalizeRecordIdentities=function(e,i){return i===t.m?e:Array.isArray(e)?e.map(e=>n(e,i)):e},t.m="objectId"},5527(e,t){"use strict";function n(e){return void 0===e||t.PARSE_WIRE_TYPES.includes(e)}function i(e){return"external"===e||"parse"===e?"parse":"nodegx"}function o(e){if(!e||!e.endpoint)return;const n=i(e.type);return{id:t.ENDPOINT_BACKEND_ID,name:"nodegx"===n?"Built-in":"Parse Server",type:n,url:e.endpoint,auth:{publicToken:e.appId}}}function r(e){var t;const n=o(e.cloudservices),i=(null===(t=e.backendServices)||void 0===t?void 0:t.backends)||[];return n?[n].concat(i):i.slice()}function s(e){var t,n;const i=r(e);if(0===i.length)return;if(a(e)){const n=null===(t=e.backendServices)||void 0===t?void 0:t.activeBackendId;if(n&&i.some(e=>e.id===n))return n}const s=o(e.cloudservices);if(s)return s.id;const l=null===(n=e.backendServices)||void 0===n?void 0:n.activeBackendId;return l&&i.some(e=>e.id===l)?l:1===i.length?i[0].id:l}function a(e){var t,n;return(null!==(n=null===(t=e.backendServices)||void 0===t?void 0:t.version)&&void 0!==n?n:1)>=2}function l(e){var t,n;return{id:e.id,type:e.type||"nodegx",name:e.name||e.id,url:e.url,publicToken:null===(t=e.auth)||void 0===t?void 0:t.publicToken,sessionToken:null===(n=e.auth)||void 0===n?void 0:n.sessionToken}}Object.defineProperty(t,"__esModule",{value:!0}),t.PARSE_WIRE_TYPES=t.ENDPOINT_BACKEND_ID=t.ACTIVE_BACKEND=void 0,t.isParseWireType=n,t.endpointBackendType=i,t.endpointBackendEntry=o,t.backendEntries=r,t.defaultBackendId=s,t.isConvergedSelection=a,t.resolveBackendTarget=function(e,i){var o,a;const u=e&&e!==t.ACTIVE_BACKEND?e:s(i);if(!u)return;const c=r(i).find(e=>e.id===u);return c?{handle:l(c),entry:c,isParseWire:n(c.type),collections:(null===(o=c.schema)||void 0===o?void 0:o.collections)||[],relations:null===(a=c.schema)||void 0===a?void 0:a.relations}:void 0},t.hasStoredRelations=function(e){return!!(e&&e.relations&&e.relations.length>0)},t.handleFor=l,t.ACTIVE_BACKEND="_active_",t.ENDPOINT_BACKEND_ID="_endpoint_",t.PARSE_WIRE_TYPES=["nodegx","parse"]},8479(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.runtimeMetaDataSources=s,t.resolveBackendFromRuntime=function(e){return(0,r.resolveBackendTarget)(e,s())};const r=n(5527);function s(){try{const e=n(3538),t=e&&e.instance;return t?{backendServices:t.getMetaData("backendServices"),cloudservices:t.getMetaData("cloudservices")}:{}}catch(e){return{}}}o(n(5527),t)},9327(e,t){"use strict";function n(e,t){if(null==e)return e;if(t&&("json"===t.type||"array"===t.type)&&"string"==typeof e){const t=e.trim();if(""===t)return e;try{return JSON.parse(t)}catch(t){return e}}if(t&&("dateTime"===t.type||"date"===t.type||"timestamp"===t.type||"time"===t.type)){if("string"==typeof e&&/^\d{4}-\d{2}-\d{2}/.test(e))return e;try{const t=new Date(e);if(!isNaN(t.getTime()))return t.toISOString()}catch(t){console.warn("[BYOB Utils] Failed to convert date value:",e)}}return e}function i(e,t){const n=(e||[]).find(e=>e.name===t),i={};for(const e of(null==n?void 0:n.fields)||[])i[e.name]=e;return i}t.makeRestSerializer=function(e){return function(t,o){const r=i(e.collections(),o),s={};for(const i in t)s[i]=n(e.toJSON(t[i]),r[i]);return s}},t.filterSchemaFor=function(e,t){if(!t)return;const n=i(e,t);if(0===Object.keys(n).length)return;const o={};for(const e of Object.keys(n)){const t=n[e];o[e]={type:t.nativeType||t.type,...t.relationTarget?{targetClass:t.relationTarget}:{},..."many-to-many"===t.relationType||"one-to-many"===t.relationType?{cardinality:"many"}:t.relationType?{cardinality:"one"}:{}}}return{collection:t,properties:o}}},822(e){"use strict";e.exports=class{constructor({name:e,url:t,contentType:n,size:i,target:o,filename:r}){this.name=e,this.url=t,void 0!==n&&(this.contentType=n),void 0!==i&&(this.size=i),void 0!==o&&(this.target=o),void 0!==r&&(this.filename=r)}getUrl(){return this.url}getName(){return this.name}getContentType(){return this.contentType}getSize(){return this.size}getFilename(){return this.filename}getTarget(){return this.target}toString(){return this.url}}},3024(e,t,n){"use strict";t.backendType=a,t.collectFilterParameters=function(e,t){const n=[];return void 0===e||((0,i.isVisualQueryFormat)(e)?function e(t){void 0!==t&&(void 0!==t.rules?t.rules.forEach(e):void 0===t.input||n.includes(t.input)||n.push(t.input))}(e):function e(o){var r;if(!o)return;if((0,i.isSavedGroup)(o))return void(null!==(r=o.conditions)&&void 0!==r?r:[]).forEach(e);if("connected"!==o.valueSource||!o.valuePortName)return;const s=u(o.valuePortName,t);n.includes(s)||n.push(s)}(e)),n},t.convertVisualFilterToNeutral=c,t.convertVisualFilter=function(e,t){const n=c(e,t);if(void 0===n)return;const o=(0,i.toParseWhere)(l(n,void 0),{backend:a(),schema:s(t.collectionName)});return 0===Object.keys(o).length?void 0:o},t.matchesQuery=function e(t,n){let i=!0;return void 0===n||(void 0!==n.$and?n.$and.forEach(n=>{i&=Number(e(t,n))}):void 0!==n.$or?(i=!1,n.$or.forEach(n=>{i|=Number(e(t,n))})):Object.keys(n).forEach(e=>{if("objectId"===e)void 0!==n[e].$eq?i&=Number(t.getId()===n[e].$eq):void 0!==n[e].$in&&(i&=Number(-1!==n[e].$in.indexOf(t.getId())));else if("$relatedTo"===e)i=!1;else{const o=t.get(e),r=n[e];Object.keys(r).filter(e=>"$options"!==e).forEach(e=>{i&=Number(function(e,t,n){const i=n[t];switch(t){case"$eq":return i&&"Pointer"===i.__type?e===i.objectId:e==i;case"$ne":return e!=i;case"$lt":return e<i;case"$lte":return e<=i;case"$gt":return e>i;case"$gte":return e>=i;case"$exists":return!1===i?null==e:null!=e;case"$in":return Array.isArray(i)&&-1!==i.indexOf(e);case"$nin":return Array.isArray(i)&&-1===i.indexOf(e);case"$regex":return null!=e&&new RegExp(i,n.$options).test(String(e));default:return!0}}(o,e,r))})}}),i)},t.compareObjects=function(e,t,n){for(let i=0;i<e.length;i++){const o=e[i];if("-"===o[0]){const e=o.substring(1);if(t.get(e)>n.get(e))return-1;if(t.get(e)<n.get(e))return 1}else{if(t.get(o)>n.get(o))return 1;if(t.get(o)<n.get(o))return-1}}return 0},t.convertVisualSorting=function(e){return e.map(e=>("descending"===e.order?"-":"")+e.property)},t.convertFilterOp=function(e,t){try{const n=l(e,t.modelScope);return(0,i.toParseWhere)(n,{backend:a(),schema:s(t.collectionName)})}catch(e){if(e instanceof i.FilterTranslationError)return t.error(e.message),{};throw e}};const i=n(9972),o=n(7011),r=n(6835);function s(e){if(!e)return;let t;try{t=o._collections[e]}catch(e){return}if(t){if(t.schema)return{collection:e,properties:t.schema.properties};if(Array.isArray(t.columns)){const n={};for(const e of t.columns)e&&e.name&&(n[e.name]={type:e.type,required:e.required,targetClass:e.targetClass});return{collection:e,properties:n}}}}function a(){try{const e=o.instance&&o.instance._handle&&o.instance._handle();return e&&"parse"===e.type?"parse":"nodegx"}catch(e){return"nodegx"}}function l(e,t){var n;if(!e||"object"!=typeof e)return e;const i=e;if(Array.isArray(i.and))return{and:i.and.map(e=>l(e,t))};if(Array.isArray(i.or))return{or:i.or.map(e=>l(e,t))};if(i.relatedTo&&"object"==typeof i.relatedTo&&!i.relatedTo.className){const e=i.relatedTo.id,o=void 0===e||null===(n=(t||r).get(e))||void 0===n?void 0:n._class;if(void 0!==o)return{relatedTo:{...i.relatedTo,className:o}}}return e}function u(e,t){return t&&e.startsWith(t)?e.slice(t.length):e}function c(e,t){const n=(0,i.isVisualQueryFormat)(e)?(0,i.visualQueryToNeutral)(e,t.queryParameters):(0,i.savedFilterToNeutral)(e,e=>t.queryParameters[u(e,t.valuePortPrefix)],{dropUnresolvedConnected:!0});return null===n?void 0:n}},6989(e){"use strict";e.exports=async function(e,t,n){const i=[],o=[];for(const r of t){const s=Promise.resolve().then(()=>n(r,t));if(i.push(s),e<=t.length){const t=s.then(()=>{o.splice(o.indexOf(t),1)});o.push(t),o.length>=e&&await Promise.race(o)}}return Promise.all(i)}},3786(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_CAP=t.ITERATION_CAP=t.NOOP_STATEMENT_PROBE=t.IDENTITY_VALUE_PROBE=void 0,t.createBlockRunRecorder=function(e=i.DEFAULT_VALUE_CAP){const n=new Map,o=new Map;let r=!1;return{probeValue:function(e,i){let o=n.get(e);if(void 0===o){if(n.size>=t.BLOCK_CAP)return r=!0,i;o={n:0,raw:[]},n.set(e,o)}return o.n++,o.raw.length<t.ITERATION_CAP?o.raw.push(i):o.raw[t.ITERATION_CAP-1]=i,i},probeStatement:function(e){const n=o.get(e);if(void 0===n)return o.size>=t.BLOCK_CAP?void(r=!0):void o.set(e,1);o.set(e,n+1)},take(t,s,a){const l={nodeId:t,runId:s,t:a,values:{},statements:{}};return n.forEach((t,n)=>{l.values[n]={n:t.n,v:t.raw.map(t=>(0,i.previewValue)(t,e))}}),o.forEach((e,t)=>{l.statements[t]=e}),r&&(l.truncated=!0),l}}};const i=n(5801);t.IDENTITY_VALUE_PROBE=function(e,t){return t},t.NOOP_STATEMENT_PROBE=function(){},t.ITERATION_CAP=25,t.BLOCK_CAP=400},1656(e,t,n){"use strict";const i=n(6835),o=n(6202),r=n(1986),s=Symbol("noodl.collection.raw"),a=Symbol("noodl.collection.proxy"),l=Symbol("noodl.collection.batch");function u(e){if(null==e)return e;const t=e[s];return void 0===t?e:t}function c(e){const t=e[a];if(void 0!==t)return t;const n=new Proxy(e,b);try{Object.defineProperty(e,a,{value:n,enumerable:!1,writable:!1,configurable:!0})}catch(e){}return n}function d(e,t){const n=function(e){const t=e[l];if(void 0!==t)return t;const n={depth:0,pendingChange:!1};try{Object.defineProperty(e,l,{value:n,enumerable:!1,writable:!1,configurable:!0})}catch(e){}return n}(e);n.depth++;try{return t()}finally{n.depth--,0===n.depth&&n.pendingChange&&(n.pendingChange=!1,e.notify("change"))}}function p(e){const t=e[l];void 0!==t&&t.depth>0?t.pendingChange=!0:e.notify("change")}function h(e,t,n){if(null==e)return;const i=e.notify;"function"==typeof i&&i.call(e,t,n)}function f(e,t,n){e.notify("add",{item:t,index:n}),p(e),h(t,"add",{collection:c(e),index:n})}function g(e,t,n){e.notify("remove",{item:t,index:n}),p(e),h(t,"remove",{collection:c(e)})}function m(e){const t=Number(e);if(Number.isInteger(t)&&!(t<0)&&String(t)===e)return t}const y=new Set(["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"]),v=new WeakMap;const b={get(e,t,n){if("string"==typeof t){const n=t.charCodeAt(0);if(n>=48&&n<=57)return e[t];if(y.has(t))return function(e){const t=v.get(e);if(void 0!==t)return t;const n=function(e){function t(t,n){const i=Array.prototype.slice.call(e);return t.apply(e,n),function(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1}(i,e)&&p(e),c(e)}return{push(...t){if(0===t.length)return e.length;const n=e.length,i=Array.prototype.push.apply(e,t);return d(e,()=>{for(let i=0;i<t.length;i++)f(e,t[i],n+i)}),i},pop(){if(0===e.length)return;const t=e.length-1,n=Array.prototype.pop.call(e);return d(e,()=>g(e,n,t)),n},shift(){if(0===e.length)return;const t=Array.prototype.shift.call(e);return d(e,()=>g(e,t,0)),t},unshift(...t){if(0===t.length)return e.length;const n=Array.prototype.unshift.apply(e,t);return d(e,()=>{for(let n=0;n<t.length;n++)f(e,t[n],n)}),n},splice(...t){const n=e.length,i=Array.prototype.splice.apply(e,t),o=t.length>2?t.slice(2):[];if(0===i.length&&0===o.length)return i;const r=function(e,t){let n=Math.trunc(Number(e));return Number.isFinite(n)||(n=0),n<0?Math.max(t+n,0):Math.min(n,t)}(t[0],n);return d(e,()=>{for(let t=i.length-1;t>=0;t--)g(e,i[t],r+t);for(let t=0;t<o.length;t++)f(e,o[t],r+t)}),i},sort:(...e)=>t(Array.prototype.sort,e),reverse:(...e)=>t(Array.prototype.reverse,e),fill:(...e)=>t(Array.prototype.fill,e),copyWithin:(...e)=>t(Array.prototype.copyWithin,e)}}(e);return v.set(e,n),n}(e)[t]}else if(t===s)return e;return Reflect.get(e,t,n)},set(e,t,n){if("string"==typeof t){if("length"===t){const i=e.length,o=Number(n);if(Number.isInteger(o)&&o!==i){const r=[];for(let t=o;t<i;t++)r.push({item:e[t],index:t});return!!Reflect.set(e,t,n)&&(d(e,()=>{for(let t=r.length-1;t>=0;t--)g(e,r[t].item,r[t].index);p(e)}),!0)}return Reflect.set(e,t,n)}const i=m(t);if(void 0!==i){const o=i<e.length,r=e[i];return!(!o||r!==n)||!!Reflect.set(e,t,n)&&(d(e,()=>{o&&g(e,r,i),f(e,n,i)}),!0)}}return Reflect.set(e,t,n)},deleteProperty(e,t){const n="string"==typeof t?m(t):void 0;if(void 0===n)return Reflect.deleteProperty(e,t);const i=Object.prototype.hasOwnProperty.call(e,t),o=e[n];return!!Reflect.deleteProperty(e,t)&&(i&&d(e,()=>g(e,o,n)),!0)}};Object.defineProperty(Array.prototype,"items",{enumerable:!1,get(){return c(u(this))},set(e){u(this).set(e)}}),Object.defineProperty(Array.prototype,"each",{enumerable:!1,writable:!1,value:Array.prototype.forEach}),Object.defineProperty(Array.prototype,"size",{enumerable:!1,writable:!1,value:function(){return this.length}}),Object.defineProperty(Array.prototype,"get",{enumerable:!1,writable:!1,value:function(e){return this[e]}}),Object.defineProperty(Array.prototype,"getId",{enumerable:!1,writable:!1,value:function(){return this._id}}),Object.defineProperty(Array.prototype,"id",{enumerable:!1,get(){return this.getId()}});const w=new WeakMap,_=new WeakMap;function S(e,t){const n=e._plainRows;if(n.scope.exists(t))return!0;if(!i.exists(t))return!1;const o=i.get(t),r=w.get(o);if(void 0===r||r===n)return!1;const s=r.current.deref();return void 0!==s&&s.contains(o)}function O(e,t){if(S(e,t.id))return e._plainRows.scope.create(t);const n=i.create(t);return w.set(n,e._plainRows),n}Object.defineProperty(Array.prototype,"set",{enumerable:!1,writable:!1,value:function(e){var t,n;const r=u(this);if(u(e)===r)return;function s(e){for(var t={},n=e.length,i=0;i<n;i++){var o=e[i];t[o.getId()]=o}return t}e=e||[];let a=r._plainItemModels;void 0===a&&(a=new WeakMap,Object.defineProperty(r,"_plainItemModels",{value:a,enumerable:!1,writable:!0}));var l=[];let c;for(t=e.length,n=0;n<t;n++){var p=e[n];if(i.instanceOf(p)){l.push(p);continue}const t=p;let o="object"==typeof t&&null!==t?a.get(t):void 0;const s=void 0!==r._plainRows&&"object"==typeof t&&null!==t&&void 0!==t.id;if(s&&void 0!==o&&S(r,t.id)&&r._plainRows.scope.get(t.id)!==o&&(o=void 0),void 0===o){if("object"==typeof t&&null!==t)for(const e of Object.keys(t))i.isReservedFieldName(e)&&(void 0===c&&(c=new Map),c.has(e)||c.set(e,n));o=s?O(r,t):i.create(t),"object"==typeof t&&null!==t&&a.set(t,o)}else for(const e in t)"id"!==e&&o.data[e]!==t[e]&&o.set(e,t[e]);l.push(o)}void 0!==c&&c.forEach((e,t)=>{(0,o.raiseUnattributedRuntimeError)("collection/reserved-field-name",`A row field is named "${t}" (row ${e}), and "${t}" is one of a Noodl Object's own names. Every row in a list is a Noodl Object, so row.${t} reads that and never the data. Rename the field.`,{field:t,row:e})});{const e=new Set;l=l.filter(t=>{const n=t.getId();return!e.has(n)&&(e.add(n),!0)})}d(r,()=>{var e=r,i=s(e),o=s(l);for(t=e.length,n=0;n<t;n++)o.hasOwnProperty(e[n].getId())||(r.removeAtIndex(n),n--,t--);for(n=0;n<Math.min(e.length,l.length);n++)e[n]!==l[n]&&(i.hasOwnProperty(l[n].getId())&&r.remove(l[n]),r.addAtIndex(l[n],n));for(n=e.length;n<l.length;n++)r.add(l[n])})}}),Object.defineProperty(Array.prototype,"notify",{enumerable:!1,writable:!1,value:function(e,t){const n=u(this);if(n._listeners&&n._listeners[e])for(var i=n._listeners[e].slice(),r=0;r<i.length;r++)try{i[r](t)}catch(t){(0,o.raiseUnattributedRuntimeError)("collection/listener-threw","A '"+e+"' listener on an array threw",{event:e,error:t instanceof Error?t.message:String(t)})}}}),Object.defineProperty(Array.prototype,"contains",{enumerable:!1,writable:!1,value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(Array.prototype,"add",{enumerable:!1,writable:!1,value:function(e){const t=u(this);t.contains(e)||(Array.prototype.push.call(t,e),t.notify("add",{item:e,index:t.length-1}),p(t),h(e,"add",{collection:c(t)}))}}),Object.defineProperty(Array.prototype,"remove",{enumerable:!1,writable:!1,value:function(e){const t=u(this);var n=Array.prototype.indexOf.call(t,e);-1!==n&&t.removeAtIndex(n)}}),Object.defineProperty(Array.prototype,"addAtIndex",{enumerable:!1,writable:!1,value:function(e,t){const n=u(this);n.contains(e)||(Array.prototype.splice.call(n,t,0,e),n.notify("add",{item:e,index:t}),p(n),h(e,"add",{collection:c(n),index:t}))}}),Object.defineProperty(Array.prototype,"removeAtIndex",{enumerable:!1,writable:!1,value:function(e){const t=u(this);var n=t[e];Array.prototype.splice.call(t,e,1),t.notify("remove",{item:n,index:e}),p(t),h(n,"remove",{collection:c(t)})}}),Object.defineProperty(Array.prototype,"on",{enumerable:!1,writable:!1,value:function(e,t){const n=u(this);n._listeners||Object.defineProperty(n,"_listeners",{enumerable:!1,writable:!1,value:{}}),n._listeners[e]||(n._listeners[e]=[]),n._listeners[e].push(t)}}),Object.defineProperty(Array.prototype,"off",{enumerable:!1,writable:!1,value:function(e,t){const n=u(this);if(n._listeners&&n._listeners[e]){var i=n._listeners[e].indexOf(t);-1!==i&&n._listeners[e].splice(i,1)}}});class N extends Array{}const C=N;var x=C._collections={};const T=new r;function k(e){const t=new C;return Object.defineProperty(t,"_id",{enumerable:!1,writable:!1,value:e}),t}C.create=function(e){const t=k(i.guid());return T.add(t.getId(),t),e&&t.set(e),c(t)},C.keepPlainRowsApart=function(e,t){const n=u(e),o=null!=t?t:n;let r=_.get(o);void 0===r&&(r={scope:new i.Scope,current:new WeakRef(n)},_.set(o,r)),r.current=new WeakRef(n),Object.defineProperty(n,"_plainRows",{value:r,enumerable:!1,writable:!0,configurable:!0})},C.get=function(e){if(void 0===e){const e=k(i.guid());return T.add(e.getId(),e),c(e)}if(x[e])return c(x[e]);const t=T.take(e);return void 0!==t?(x[e]=t,c(t)):(x[e]=k(e),c(x[e]))},C.instanceOf=function(e){return e instanceof N},C.exists=function(e){return void 0!==x[e]||void 0!==T.peek(e)},C._registrySize=function(){return{named:Object.keys(x).length,anonymous:T.size()}};const E=new Proxy(C,{apply(){}});e.exports=E},1608(e,t){"use strict";t.Gk=void 0,t.KX=o,t.f4=s,t.findAncestorWithComponentObject=function(e){return s(e,t.Gk)},t.GM=function(e,t){return r(e,e=>e.name===t)},t.scopeChain=a,t.scopeChainNames=function(e){return a(e).map(e=>e.name)},t.n6=function(e){return o(e).map(e=>e.name)};const n=1e3;function i(e){if(!e)return;let t;if(e.getRoots().length>0){const n=e.getRoots()[0];if(n.getVisualParentNode){const e=n.getVisualParentNode();e&&(t=e.nodeScope.componentOwner)}else n.parentNodeScope&&(t=e.parentNodeScope.componentOwner)}else e.parentNodeScope&&(t=e.parentNodeScope.componentOwner);return t&&t.nodeScope&&t.nodeScope.componentOwner!==e?t:void 0}function o(e){const t=[];let o=e;for(let e=0;e<n;e++){const e=i(o);if(!e)break;t.push(e),o=e}return t}function r(e,t){let o=e;for(let e=0;e<n;e++){const e=i(o);if(!e)return;if(t(e))return e;o=e}}function s(e,t){return r(e,e=>t.some(t=>e.nodeScope.getNodesWithType(t).length>0))}function a(e){const t=[];let i=e;for(let e=0;e<n&&i&&(t.push(i),i.parentNodeScope);e++)i=i.parentNodeScope.componentOwner;return t}t.Gk=["net.noodl.ComponentObject","Component State"]},2192(e,t){"use strict";t.hE=void 0,t.hE={identity:{appName:"My Noodl App",description:""},seo:{},variables:[]}},2566(e,t){"use strict";function n(e){return 65279===e.charCodeAt(0)?e.slice(1):e}function i(e,t){const n=new RegExp("(\\"+t+'|\\r?\\n|\\r|^)(?:"([^"]*(?:""[^"]*)*)"|([^"\\'+t+"\\r\\n]*))","gi"),i=[[]];let o,r,s=null,a=0;for(;(s=n.exec(e))&&o!==n.lastIndex;){o=n.lastIndex,void 0===r&&s.index>a&&(r=a),a=n.lastIndex;const e=s[1];e.length&&e!==t&&i.push([]);const l=void 0!==s[2]?s[2].replace(/""/g,'"'):s[3];i[i.length-1].push(l)}return void 0===r&&a<e.length&&(r=a),{rows:i,gapAt:r}}function o(e){const t=[],n={};for(const i of e)if(i)for(const e of Object.keys(i))n[e]||(n[e]=!0,t.push(e));return t}function r(e,t){if(null==e)return"";const n="string"==typeof e?e:String(e);return-1!==n.indexOf(t)||/["\r\n]/.test(n)?'"'+n.replace(/"/g,'""')+'"':n}t.parseCSVRows=function(e,t){return i(n(String(e??"")),t||",").rows},t.parseCSV=function(e,t){const o=n(String(e??"")),{rows:r,gapAt:s}=i(o,t||",");if(void 0!==s){const e=o.slice(0,s).split(/\r\n|\r|\n/).length;return{rows:r,error:{line:e,message:`The CSV could not be parsed at line ${e}: a quote is never closed, so text around it would have been silently dropped. A quote inside a quoted cell has to be written as "".`}}}return{rows:r}},t.rowsToRecords=function(e){const t=e[0];if(!t)return[];const n=[];for(let i=1;i<e.length;i++){const o=e[i],r={};for(let e=0;e<t.length;e++)r[t[e]]=o[e];n.push(r)}return n},t.unionOfKeys=o,t.toCSV=function(e,t={}){const n=t.delimiter||",",i=t.newline||"\n",s=!1!==t.includeHeader,a=t.columns&&t.columns.length?t.columns:o(e||[]),l=[];s&&l.push(a.map(e=>r(e,n)).join(n));for(const t of e||[])l.push(a.map(e=>r(t?t[e]:void 0,n)).join(n));return l.join(i)},t.rowsToCSV=function(e,t={}){const n=t.delimiter||",",i=t.newline||"\n";return(e||[]).map(e=>(e||[]).map(e=>r(e,n)).join(n)).join(i)}},1550(e,t){"use strict";function n(e,t){if(e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let n=new Array(t.length+1),i=new Array(t.length+1);for(let e=0;e<=t.length;e++)n[e]=e;for(let o=1;o<=e.length;o++){i[0]=o;for(let r=1;r<=t.length;r++){const s=n[r-1]+(e.charCodeAt(o-1)===t.charCodeAt(r-1)?0:1);i[r]=Math.min(i[r-1]+1,n[r]+1,s)}const r=n;n=i,i=r}return n[t.length]}t.diagnosticsEnabled=function(e){const t=e.context&&e.context.editorConnection;return!!t&&("function"!=typeof t.isRunningLocally||t.isRunningLocally())},t.setDiagnostic=function(e,t,n){const i=e.context&&e.context.editorConnection;if(!i)return;if("function"==typeof i.isRunningLocally&&!i.isRunningLocally())return;let o="<unknown>";try{e.nodeScope&&e.nodeScope.componentOwner&&e.nodeScope.componentOwner.name&&(o=e.nodeScope.componentOwner.name)}catch(e){}n?i.sendWarning(o,e.id,t,{showGlobally:!0,message:n}):i.clearWarning&&i.clearWarning(o,e.id,t)},t.bp=function(e){if(null===e)return"null";if(void 0===e)return"nothing";if(Array.isArray(e))return 1===e.length?"an array of 1 item":`an array of ${e.length} items`;const t=typeof e;if("string"===t){const t=e;return`a string ("${t.length>40?t.slice(0,40)+"…":t}")`}return"number"===t?e!=e?"NaN":`a number (${e})`:"boolean"===t?`a boolean (${e})`:"function"===t?"a function":"object"===t?"an object":`a ${t}`},t.qb=function(e,t){if("string"!=typeof e||!e.length||!t||!t.length)return;if(t.length>64)return;const i=e.trim().toLowerCase();for(let e=0;e<t.length;e++){const n=t[e];if("string"==typeof n&&n.trim().toLowerCase()===i)return n}const o=i.length<=4?1:2;let r,s=o+1;for(let e=0;e<t.length;e++){const o=t[e];if("string"!=typeof o)continue;const a=n(i,o.trim().toLowerCase());a<s?(s=a,r=o):a===s&&(r=void 0)}return s<=o?r:void 0}},4830(e){"use strict";e.exports={createSetter:function(e){var t=!1;return function(n){const i=!!n;i&&!1===t&&e.valueChangedToTrue.call(this),t=i}}}},2336(e){"use strict";e.exports=class{constructor(){this.currentWarnings=new Map}setWarning(e,t,n){if(this.currentWarnings.has(e)){const i=this.currentWarnings.get(e);return!function(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let i=0;i<n.length;i++){const o=n[i];if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(e[o]!==t[o])return!1}return!0}(i[t],n)&&(i[t]=n,!0)}return this.currentWarnings.set(e,{[t]:n}),!0}clearWarning(e,t){const n=this.currentWarnings.get(e);return!(!n||!n[t]||(delete n[t],0===Object.keys(n).length&&this.currentWarnings.delete(e),0))}clearWarnings(e){return!1!==this.currentWarnings.has(e)&&(this.currentWarnings.delete(e),!0)}}},1185(e,t,n){"use strict";const i=n(8587),o=n(9771),r=n(2845),s=n(2336),a=function(e){const t=e||{};i.call(this),this.runtimeType=t.runtimeType,this.platform=t.platform,this.fixedClientId=t.clientId,this.ws=t.platform&&t.platform.webSocketClass||("undefined"!=typeof WebSocket?WebSocket:void 0),this.wsOptions=t.platform&&t.platform.webSocketOptions||void 0,this.reconnectOnClose=!0,this.enableDebugger=!1,this.lastSendTimestamp=0,this.sendQueue=[],this.sendTimer=void 0,this.activeWarnings=new s};(a.prototype=Object.create(i.prototype)).constructor=a,a.prototype.isRunningLocally=function(){return this.platform.isRunningLocally&&this.platform.isRunningLocally()||"undefined"!=typeof document&&("localhost"===document.location.hostname||"127.0.0.1"===document.location.hostname)},a.prototype.connect=function(e,t){this.socket=this.wsOptions?new this.ws(e,this.wsOptions):new this.ws(e);const n=this,i=t&&t.token||function(){if("undefined"==typeof window)return;const e=window.__nodegxRelayToken;return"string"==typeof e?e:void 0}();this.socket.addEventListener("open",function(){n.clientId=n.fixedClientId||r(),n.socket.send(JSON.stringify({cmd:"register",type:"viewer",clientId:n.clientId,token:i})),n.emit("connected")}),this.socket.addEventListener("close",function(i){n.reconnectOnClose&&n.reconnect(e,t),console.log("Editor connection closed",i.code,i.reason),n.emit("connectionClosed")}),this.socket.addEventListener("error",function(e){console.log("Editor connection error, trying to reconnect")}),this.socket.addEventListener("message",async e=>{const t="string"==typeof e.data?e.data:await e.data.text(),i=JSON.parse(t);let r;"registered"===i.cmd||("registerRejected"===i.cmd?(n.reconnectOnClose=!1,!n.hasRetriedRegistration&&"undefined"!=typeof window&&window.location?(n.hasRetriedRegistration=!0,console.log("The editor rejected this preview; reloading to pick up the current token"),window.location.reload()):console.log("The editor rejected this preview: "+(i.reason||"unknown reason")+". Reload the page, or reopen the preview from the editor.")):"export"===i.cmd?(r=JSON.parse(i.content),"full"===i.type&&i.target===this.clientId&&n.emit("exportDataFull",r)):"hoverStart"===i.cmd?n.emit("hoverStart",i.content.id):"hoverEnd"===i.cmd?n.emit("hoverEnd",i.content.id):"refresh"===i.cmd?n.emit("reload"):"debugInspectors"===i.cmd?this.debugInspectorsEnabled&&(r=JSON.parse(i.content),n.emit("debugInspectorsUpdated",r.inspectors)):"debuggingEnabled"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),n.emit("debuggingEnabledChanged",r.enabled)):"traceEnabled"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),n.emit("traceEnabledChanged",{enabled:r.enabled,owner:r.owner})):"peerDisconnected"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),n.emit("peerDisconnected",{clientId:r.clientId})):"getTraceState"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),await n.emit("getTraceState",{clientId:r.clientId})):"getTraceEvents"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),await n.emit("getTraceEvents",{clientId:r.clientId,afterSeq:r.afterSeq})):"getTraceDictionary"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),await n.emit("getTraceDictionary",{clientId:r.clientId})):"getPortValues"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),await n.emit("getPortValues",{clientId:r.clientId,ports:r.ports})):"injectInput"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),await n.emit("injectInput",r)):"evaluateBlockFragment"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),await n.emit("evaluateBlockFragment",{requestId:r.requestId,nodeId:r.nodeId,code:r.code})):"setBlockTracing"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),await n.emit("setBlockTracing",{nodeId:r.nodeId,enabled:r.enabled})):"getConnectionValue"===i.cmd?n.isRunningLocally()&&(r=JSON.parse(i.content),await n.emit("getConnectionValue",{clientId:r.clientId,connectionId:r.connectionId})):"modelUpdate"===i.cmd?await n.emit("modelUpdate",i.content):"publish"===i.cmd?o.pubsub.routeMessage(i):"noodlModules"===i.cmd?n.emit("noodlModules",JSON.parse(i.content)):"mqttUpdate"===i.cmd?n.emit("mqttUpdate",i.content):"activeComponentChanged"===i.cmd?n.emit("activeComponentChanged",i.component):console.log("Command not implemented",i))})},a.prototype.reconnect=function(e,t){const n=this;setTimeout(function(){n.connect(e,t)},2e3)},a.prototype.isConnected=function(){return void 0!==this.socket&&this.socket.readyState===this.ws.OPEN},a.prototype.send=function(e){const t=this.platform.getCurrentTime(),n=t-this.lastSendTimestamp,i=e=>{try{this.socket.send(JSON.stringify(e))}catch(t){if(t.message&&t.message.startsWith("Converting circular"))try{this.socket.send(JSON.stringify(e,(()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return"[Circular]";e.add(n)}return n}})()))}catch(t){console.log("failed to send message to editor",e,t)}else console.log("failed to send message to editor",e,t)}};n<200||this.sendTimer||!this.isConnected()?(this.sendQueue.push(e),this.sendTimer||(this.sendTimer=setTimeout(()=>{if(this.sendTimer=void 0,!1!==this.isConnected()){for(let e=0;e<this.sendQueue.length;e+=50){const t=this.sendQueue.slice(e,e+50);i(t)}this.sendQueue=[],this.sendTimer=void 0,this.lastSendTimestamp=this.platform.getCurrentTime()}else this.sendQueue=[]},100))):(this.lastSendTimestamp=t,i(e))},a.prototype.sendInspectId=function(e){this.send({cmd:"select",type:"viewer",content:JSON.stringify({id:e})})},a.prototype.sendSelectComponent=function(e){this.send({cmd:"select",type:"viewer",content:JSON.stringify({componentName:e})})},a.prototype.sendPulsingConnections=function(e){let t=[];Object.keys(e).forEach(function(n){const i=e[n];t=t.concat(i.connections)}),this.send({cmd:"connectiondebugpulse",type:"viewer",content:JSON.stringify({connectionsToPulse:t})})},a.prototype.sendDebugInspectorValues=function(e){this.send({cmd:"debuginspectorvalues",type:"viewer",content:{inspectors:e}})},a.prototype.sendConnectionValue=function(e,t){this.send({cmd:"connectionValue",type:"viewer",content:{connectionId:e,value:t}})},a.prototype.sendTraceDictionary=function(e){this.send({cmd:"traceDictionary",type:"viewer",clientId:this.clientId,content:JSON.stringify(e)})},a.prototype.sendTraceEvents=function(e){this.send({cmd:"traceEvents",type:"viewer",clientId:this.clientId,content:JSON.stringify({events:e})})},a.prototype.sendTraceState=function(e){this.send({cmd:"traceState",type:"viewer",clientId:this.clientId,content:JSON.stringify(e)})},a.prototype.sendPortValues=function(e){this.send({cmd:"portValues",clientId:this.clientId,type:"viewer",content:JSON.stringify({values:e})})},a.prototype.sendInputResult=function(e){const t={cmd:"inputResult",type:"viewer",clientId:this.clientId,content:JSON.stringify(e)};if(this.isConnected())try{return void this.socket.send(JSON.stringify(t))}catch(e){}this.send(t)},a.prototype.sendBlockFragmentResult=function(e){const t={cmd:"blockFragmentResult",type:"viewer",clientId:this.clientId,content:JSON.stringify(e)};if(this.isConnected())try{return void this.socket.send(JSON.stringify(t))}catch(e){}this.send(t)},a.prototype.sendBlockTraceState=function(e){const t={cmd:"blockTraceState",type:"viewer",clientId:this.clientId,content:JSON.stringify(e)};if(this.isConnected())try{return void this.socket.send(JSON.stringify(t))}catch(e){}this.send(t)},a.prototype.sendBlockValues=function(e){this.send({cmd:"blockValues",type:"viewer",clientId:this.clientId,content:JSON.stringify(e)})};const l={};a.prototype.sendDynamicPorts=function(e,t,n){const i=JSON.stringify(t);if(l[e]!==i){if(l[e]&&t&&n&&n.detectRenamed){const i=Array.isArray(n.detectRenamed)?n.detectRenamed:[n.detectRenamed],o=[];i.forEach(n=>{let i=JSON.parse(l[e]),r=[].concat(t);n.prefix&&(i=i.filter(e=>e.name.startsWith(n.prefix)),r=r.filter(e=>e.name.startsWith(n.prefix))),n.plug&&(i=i.filter(e=>e.plug===n.plug),r=r.filter(e=>e.plug===n.plug));const s=r.map(e=>e.name.substring((n.prefix||"").length)),a=function(e,t){if(!e||!t)return;if(e.length!==t.length)return;const n={};for(let i=0;i<e.length;i++){if(-1===t.indexOf(e[i])){if(n.before)return;n.before=e[i]}if(-1===e.indexOf(t[i])){if(n.after)return;n.after=t[i]}}return n.before&&n.after?n:void 0}(i.map(e=>e.name.substring((n.prefix||"").length)),s);a&&o.push({plug:n.plug,patterns:[(n.prefix||"")+"{{*}}"],before:a.before,after:a.after})}),o.length>0&&(n.renamed=o),delete n.detectRenamed}l[e]=i,this.send({cmd:"instanceports",type:"viewer",content:JSON.stringify({nodeid:e,ports:t,options:n})})}},a.prototype.sendNodeSubLabel=function(e,t){this.send({cmd:"nodesublabel",type:"viewer",content:JSON.stringify({nodeId:e,subLabel:t})})},a.prototype.sendWarning=function(e,t,n,i){this.activeWarnings.setWarning(t,n,i)&&this.send({cmd:"showwarning",type:"viewer",content:JSON.stringify({componentName:e,nodeId:t,key:n,warning:i})})},a.prototype.clearWarning=function(e,t,n){this.activeWarnings.clearWarning(t,n)&&this.send({cmd:"showwarning",type:"viewer",content:JSON.stringify({componentName:e,nodeId:t,key:n,warning:void 0})})},a.prototype.clearWarnings=function(e,t){this.activeWarnings.clearWarnings(t)&&this.send({cmd:"clearwarnings",type:"viewer",content:JSON.stringify({componentName:e,nodeId:t})})},a.prototype.sendPatches=function(e){this.send({cmd:"patchproject",type:"viewer",content:JSON.stringify(e)})},a.prototype.requestFullExport=function(){this.send({cmd:"register",type:"viewer"})},a.prototype.requestNoodlModules=function(){this.send({cmd:"getNoodlModules",type:"viewer"})};const u={};a.prototype.sendServiceRequest=function(e,t){e.token=r(),e.clientId=this.clientId,u[e.token]=t,this.send(e)},a.prototype.close=function(){this.reconnectOnClose=!1,!1!==this.isConnected()&&this.socket.close()},a.prototype.sendNodeLibrary=function(e){this.send({cmd:"nodelibrary",type:"viewer",runtimeType:this.runtimeType,content:e,clientId:this.clientId})},a.prototype.sendComponentMetadata=function(e,t,n){this.send({cmd:"componentMetadata",type:"viewer",content:JSON.stringify({componentName:e,key:t,data:n})})},a.prototype.sendProjectMetadata=function(e,t){this.send({cmd:"projectMetadata",type:"viewer",content:JSON.stringify({key:e,data:t})})},e.exports=a},9209(e,t){"use strict";function n(e,t){const n=new Set(t);return e.filter(e=>!n.has(e))}t.handleEvent=async function(e,t,i){function o(t,i){const o={},s={};i.forEach(function(e){e&&"outputs"===e.plug&&(e.plug="output"),"input"!==e.plug&&"input/output"!==e.plug||(o[e.name]=e),"output"!==e.plug&&"input/output"!==e.plug||(s[e.name]=e)});const a=Object.keys(t.getInputPorts()),l=n(a,Object.keys(o)),u=n(Object.keys(o),a);t.updateInputPortTypes(o),l.forEach(t.removeInputPortWithName.bind(t)),u.forEach(function(n){t.addInputPort(o[n]),t.parameters&&t.parameters.hasOwnProperty(n)&&r(e.rootComponent.nodeScope,t,n,t.parameters[n])}),t.updateOutputPortTypes(s);const c=Object.keys(t.getOutputPorts()),d=n(c,Object.keys(s)),p=n(Object.keys(s),c);d.forEach(t.removeOutputPortWithName.bind(t)),p.forEach(function(e){t.addOutputPort(s[e])})}function r(e,t,n,i){e.getNodesWithIdRecursive(t.id).forEach(function(e){e.queueInput(n,i)})}let s;if(i.componentName&&(s=t.getComponentWithName(i.componentName),!s))return;i.port&&"outputs"===i.port.plug&&(i.port.plug="output");const a={nodeAdded:function(e){s.importEditorNodeData(e.model,e.parentId,e.childIndex)},nodeRemoved:async function(e){s.hasNodeWithId(e.model.id)&&await s.removeNodeWithId(e.model.id)},connectionAdded:function(e){s.addConnection(e.model)},connectionRemoved:function(t){s.removeConnection(t.model);const n=s.getNodeWithId(t.model.targetId);if(0===s.getConnectionsToPort(n.id,t.model.targetId).length){let i=n.parameters[t.model.targetPort];void 0===i&&(i=e.getDefaultValueForInput(n.type,t.model.targetPort)),r(e.rootComponent.nodeScope,n,t.model.targetPort,i)}},parameterChanged:function(e){const t=s.getNodeWithId(e.nodeId);if(void 0!==t){if(e.parameters){const n=new Set(Object.keys(e.parameters).concat(Object.keys(e.oldParameters)));for(const i of Array.from(n))t.setParameter(i,e.parameters[i])}e.parameterName&&t.setParameter(e.parameterName,e.parameterValue,e.state)}else console.log("parameterChanged: Unknown node id",e)},nodeAttached:function(e){s.setNodeParent(s.getNodeWithId(e.nodeId),s.getNodeWithId(e.parentId),e.childIndex)},nodeDetached:function(e){s.setNodeParent(s.getNodeWithId(e.nodeId),null),s.addRootId(e.nodeId)},componentAdded:function(e){t.importComponentFromEditorData(e.model)},componentRemoved:async function(e){await t.removeComponentWithName(e.componentName)},rootAdded:function(e){s.addRootId(e.nodeId)},portAdded:function(t){const n=s.getNodeWithId(t.nodeId);"input"!==t.port.plug&&"input/output"!==t.port.plug||(n.addInputPort(t.port),n.parameters.hasOwnProperty(t.port)&&r(e.rootComponent.nodeScope,n,t.port,n.parameters[t.port])),"output"!==t.port.plug&&"input/output"!==t.port.plug||n.addOutputPort(t.port)},portRemoved:function(e){const t=s.getNodeWithId(e.nodeId);"input"!==e.port.plug&&"input/output"!==e.port.plug||t.removeInputPortWithName(e.port.name),"output"!==e.port.plug&&"input/output"!==e.port.plug||t.removeOutputPortWithName(e.port.name)},nodePortRenamed:function(e){"input"!==e.port.plug&&"input/output"!==e.port.plug||s.renameInputPortOnNodeWithId(e.nodeId,e.oldName,e.port.name),"output"!==e.port.plug&&"input/output"!==e.port.plug||s.renameOutputPortOnNodeWithId(e.nodeId,e.oldName,e.port.name);const n=s.getNodeWithId(e.nodeId);"Component Inputs"===n.type?(s.addInputPort(e.port),t.getNodesWithType(s.name).forEach(function(t){t.component.renameInputPortOnNodeWithId(t.id,e.oldName,e.port.name)}),s.removeInputPortWithName(e.oldName)):"Component Outputs"===n.type&&(s.addOutputPort(e.port),t.getNodesWithType(s.name).forEach(function(t){t.component.renameOutputPortOnNodeWithId(t.id,e.oldName,e.port.name)}),s.removeOutputPortWithName(e.oldName))},componentPortsUpdated:function(e){o(s,e.ports)},instancePortsChanged:function(e){s.hasNodeWithId(e.nodeId)&&o(s.getNodeWithId(e.nodeId),e.ports)},componentRenamed:function(e){t.renameComponent(e.oldName,e.newName)},settingsChanged:function(e){t.setSettings(e.settings)},scriptsChanged:function(e){t.setScripts(e.scripts)},metadataChanged:function(e){t.setMetaData(e.key,e.data)},componentMetadataChanged:function(e){const n=t.getComponentWithName(e.componentName);n&&n.setMetadata(e.key,e.data)},variantParametersChanged:function(n){if(n.variant)t.updateVariant(n.variant);else if(t.updateVariantParameter(n.variantName,n.variantTypeName,n.parameterName,n.parameterValue,n.state),void 0===n.parameterValue){const i=t.getVariant(n.variantTypeName,n.variantName);e.rootComponent.nodeScope.getAllNodesWithVariantRecursive(i).forEach(e=>{e.queueInput(n.parameterName,e.getParameter(n.parameterName))})}},variantDeleted:function(e){t.deleteVariant(e.variantTypeName,e.variantName)},variantChanged:function(e){const n=s.getNodeWithId(e.nodeId),i=t.getVariant(n.type,e.variantName);n.setVariant(i)},variantRenamed:function(e){const n=t.getVariant(e.variantTypeName,e.oldVariantName);n&&(n.name=n.variantName)},defaultStateTransitionChanged:function(e){s.getNodeWithId(e.nodeId).setDefaultStateTransition(e.curve,e.state)},stateTransitionsChanged:function(e){const t=s.getNodeWithId(e.nodeId);e.parameterName&&t.setStateTransitionParamter(e.parameterName,e.curve,e.state)},variantDefaultStateTransitionChanged:function(e){t.updateVariantDefaultStateTransition(e.variantName,e.variantTypeName,e.curve,e.state)},variantStateTransitionsChanged:function(e){t.updateVariantStateTransition(e)},routerIndexChanged:function(e){t.routerIndex=e.data}};a.hasOwnProperty(i.type)?(await a[i.type](i),e.scheduleUpdate()):console.log("Unknown event",i)}},8587(e){"use strict";const t=function(){this.listeners={},this.listenersWithRefs={}};t.prototype.on=function(e,t,n){n?(this.listenersWithRefs.hasOwnProperty(e)||(this.listenersWithRefs[e]=new Map),this.listenersWithRefs[e].get(n)||this.listenersWithRefs[e].set(n,[]),this.listenersWithRefs[e].get(n).push(t)):(this.listeners.hasOwnProperty(e)||(this.listeners[e]=[]),this.listeners[e].push(t))},t.prototype.removeListenersWithRef=function(e){Object.keys(this.listenersWithRefs).forEach(t=>{const n=this.listenersWithRefs[t];n.has(e)&&n.delete(e)})},t.prototype.removeAllListeners=function(e){e?(delete this.listeners[e],delete this.listenersWithRefs[e]):(this.listeners={},this.listenersWithRefs={})},t.prototype.emit=async function(e,t){const n=this.listeners[e];if(n)for(let e=0;e<n.length;e++){const i=n[e];await Promise.resolve(i.call(null,t))}const i=this.listenersWithRefs[e];if(i)for(const[e,n]of i)for(const i of n)await Promise.resolve(i.call(e,t))},e.exports=t},3162(e,t,n){"use strict";t.Mx=void 0,t.detectDependencies=function(e){const t={variables:[],objects:[],arrays:[]},n=Array.from(e.matchAll(/\$\{([^}]*)\}/g)).map(e=>e[1]).join(" "),i=e.replace(/"([^"\\]|\\.)*"/g,'""').replace(/'([^'\\]|\\.)*'/g,"''").replace(/`([^`\\]|\\.)*`/g,"``")+" "+n,o=e+" "+n,r=(e,t,n)=>{const i=new RegExp("(?:Noodl\\.)?"+n+"\\.([a-zA-Z_$][a-zA-Z0-9_$]*)","g");for(const n of Array.from(t.matchAll(i)))n[1]&&!e.includes(n[1])&&e.push(n[1]);const r=new RegExp("(?:Noodl\\.)?"+n+"\\[[\"']([^\"']+)[\"']\\]","g");for(const t of Array.from(o.matchAll(r)))t[1]&&!e.includes(t[1])&&e.push(t[1])};return r(t.variables,i,"Variables"),r(t.objects,i,"Objects"),r(t.arrays,i,"Arrays"),t},t.compileExpression=function(e){const n=`v${t.Mx}:${e}`;if(r.has(n))return r.get(n);const i=["Noodl","Variables","Objects","Arrays",...Object.keys(s)],o=`\n "use strict";\n return (${e});\n `;try{const e=new Function(...i,o);return r.set(n,e),e}catch(e){return console.error("Expression compilation error:",e.message),null}},t.evaluateExpression=function(e,t,n){if(!e)return;const r=function(e){const t=e||i,n=t.get("--ndl--global-variables");return{Variables:n?n.data:{},Objects:new Proxy({},{get(e,n){if("symbol"==typeof n)return;const i=t.get(n);return i?i.data:void 0}}),Arrays:new Proxy({},{get(e,t){if("symbol"!=typeof t)return o().get(t)}}),Object:t}}(t),a=Object.values(s);try{return e(r,r.Variables,r.Objects,r.Arrays,...a)}catch(e){if(n&&n.rethrow)throw e;return void console.error("Expression evaluation error:",e.message)}},t.subscribeToChanges=function(e,t,n){const r=n||i,s=[];if(e.variables.length>0){const n=r.get("--ndl--global-variables");if(n){const i=n=>{e.variables.some(e=>n.name===e||!n.name)&&t()};n.on("change",i),s.push(()=>n.off("change",i))}}for(const n of e.objects){const e=r.get(n);if(e){const n=()=>t();e.on("change",n),s.push(()=>e.off("change",n))}}for(const n of e.arrays){const e=o().get(n),i=()=>t();e.on("change",i),s.push(()=>e.off("change",i))}return()=>{s.forEach(e=>e())}},t.validateExpression=function(e){try{return new Function(`return (${e})`),{valid:!0,error:null}}catch(e){return{valid:!1,error:e.message}}};const i=n(6835);function o(){return n(1656)}t.Mx=1;const r=new Map,s={min:Math.min,max:Math.max,cos:Math.cos,sin:Math.sin,tan:Math.tan,sqrt:Math.sqrt,pi:Math.PI,round:Math.round,floor:Math.floor,ceil:Math.ceil,abs:Math.abs,random:Math.random,pow:Math.pow,log:Math.log,exp:Math.exp}},5812(e,t){"use strict";t.coerceToType=function(e,t,n,i){if(null==e)return n;switch(t){case"string":return String(e);case"number":{const t=Number(e);return isNaN(t)?n:t}case"boolean":return!!e;case"color":return function(e,t){const n=String(e);return/^#[0-9A-Fa-f]{3}$/.test(n)||/^#[0-9A-Fa-f]{6}$/.test(n)||/^rgba?\(/.test(n)?n:t}(e,n);case"enum":return function(e,t,n){if(!n)return t;const i=String(e);return n.some(e=>"string"==typeof e?e===i:e.value===i)?i:t}(e,n,i);default:return e}}},5868(e,t,n){"use strict";t.parseFeed=function(e,t){const n=(0,i.parseXML)(e,{alwaysArray:o,maxBytes:t});if(n.error)return{error:n.error};const p=n.value;let w,_={},S=[];const O=l(p,"rdf:RDF","RDF"),N=s(p,"rss"),C=s(p,"feed");if(r(O)?(w="rdf",_=s(O,"channel")||{},S=a(O,"item")):r(N)?(w="rss",_=s(N,"channel")||{},S=a(_,"item")):r(C)&&(w="atom",_=C,S=a(C,"entry")),!w)return{error:{code:"feed/unrecognised",message:"This XML parsed, but its root is not <rss>, <feed> or <rdf:RDF>, so it is not a feed. Wire it into Parse XML instead and read the shape you actually received"}};const x=S.filter(r).map(e=>function(e,t){const n=u(s(e,"title")),i="rss"===t?d(u(s(e,"link")),f(e)):f(e),o=h(l(e,"pubDate","published","dc:date","date")),r=h(l(e,"updated","lastBuildDate","dc:modified")),a=d(u(s(e,"description")),u(s(e,"summary")),u(s(e,"itunes:summary"))),p=d(u(s(e,"content:encoded")),u(s(e,"content")),u(s(s(e,"media:group"),"media:description")),a);return{id:d(u(s(e,"guid")),u(s(e,"id")),c(s(e,"guid"),"isPermaLink")&&i?i:"",i,function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return("0000000"+t.toString(16)).slice(-8)}(n+"\0"+(o||""))),title:n,link:i,published:o,updated:r,author:v(e),summary:a,content:p,image:g(e),enclosure:m(e),tags:y(e),raw:e}}(e,w));return{feed:{title:u(s(_,"title")),link:"rss"===w||"rdf"===w?d(u(s(_,"link")),f(_)):f(_),description:d(u(s(_,"description")),u(s(_,"subtitle"))),updated:h(l(_,"lastBuildDate","updated","pubDate")),kind:w,source:b("string"==typeof e?e.slice(0,65536):"",_,x)},items:x}};const i=n(6783),o=["item","entry","link","category","enclosure","media:content","media:thumbnail","content"];function r(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function s(e,t){if(!r(e))return;const n=e[t];return Array.isArray(n)?n[0]:n}function a(e,t){if(!r(e))return[];const n=e[t];return null==n?[]:Array.isArray(n)?n:[n]}function l(e,...t){for(const n of t){const t=s(e,n);if(null!=t)return t}}function u(e){if(null==e)return"";if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return String(e);if(Array.isArray(e))return u(e[0]);if(r(e)){const t=e[i.TEXT_KEY];return void 0!==t?u(t):""}return""}function c(e,t){return r(e)?u(e["@"+t]):""}function d(...e){for(const t of e)if(t)return t;return""}const p=["UT","UTC","GMT","Z","EST","EDT","CST","CDT","MST","MDT","PST","PDT"];function h(e){const t=u(e).trim().replace(/\s*\([^)]*\)$/,"");if(!t)return null;const n=/\s([A-Z]{1,5})$/.exec(t);if(n&&-1===p.indexOf(n[1]))return null;const i=n||/(?:Z|[+-]\d{2}:?\d{2})$/.test(t)||/^\d{4}-\d{2}-\d{2}$/.test(t)?t:/^\d{4}-\d{2}-\d{2}T/.test(t)?t+"Z":t+" GMT",o=Date.parse(i);return isNaN(o)?null:new Date(o).toISOString()}function f(e){const t=a(e,"link"),n=t.find(e=>"alternate"===(c(e,"rel")||"alternate").toLowerCase()&&c(e,"href"));if(n)return c(n,"href");const i=t.find(e=>c(e,"href"));return i?c(i,"href"):u(s(e,"link"))}function g(e){const t=s(e,"media:group"),n=[e];t&&n.push(t);for(const e of n){for(const t of a(e,"media:thumbnail")){const e=c(t,"url");if(e)return e}for(const t of a(e,"media:content")){const e=c(t,"medium").toLowerCase(),n=c(t,"type").toLowerCase();if("image"===e||0===n.indexOf("image/")){const e=c(t,"url");if(e)return e}}}const i=s(e,"itunes:image"),o=c(i,"href")||u(i);if(o)return o;for(const t of a(e,"enclosure"))if(0===c(t,"type").toLowerCase().indexOf("image/")){const e=c(t,"url");if(e)return e}return""}function m(e){for(const t of a(e,"enclosure")){const e=c(t,"url");if(!e)continue;const n={url:e},i=c(t,"type"),o=c(t,"length");return i&&(n.type=i),o&&(n.length=o),n}for(const t of a(e,"link"))if("enclosure"===c(t,"rel").toLowerCase()&&c(t,"href")){const e={url:c(t,"href")},n=c(t,"type"),i=c(t,"length");return n&&(e.type=n),i&&(e.length=i),e}return null}function y(e){const t=[],n=e=>{const n=e.trim();n&&-1===t.indexOf(n)&&t.push(n)};for(const t of a(e,"category"))n(c(t,"term")||c(t,"label")||u(t));for(const t of a(e,"media:keywords"))for(const e of u(t).split(","))n(e);for(const t of a(e,"itunes:keywords"))for(const e of u(t).split(","))n(e);return t}function v(e){const t=s(e,"author");return u(s(t,"name"))||d(u(s(e,"dc:creator")),u(s(e,"itunes:author")),u(t))}function b(e,t,n){return/xmlns:yt=|<yt:channelId>|youtube\.com\/(channel|watch)/i.test(e)?"youtube":/reddit\.com\/r\//i.test(e)?"reddit":/xmlns:itunes=/i.test(e)||s(t,"itunes:author")||n.some(e=>e.enclosure&&/^audio\//i.test(e.enclosure.type||""))?"podcast":"generic"}},3099(e,t,n){"use strict";t.resolveForEachItem=function(e,t={}){const n=(0,i.scopeChain)(e.nodeScope.componentOwner),o=t.target;if(o){const t=function(e,t){for(let n=0;n<e.length;n++)if(e[n].name===t)return e[n]}(n,o);return t?void 0===t[r]?u(e,"repeater-item/target-has-no-item",'The component "'+o+'" has no current item — it is not used as a Repeater or Run Tasks template',o,{target:o}):l(e,t):u(e,"repeater-item/target-not-found",'No component named "'+o+'" contains this node',o,{target:o,scope:(0,i.scopeChainNames)(e.nodeScope.componentOwner)})}const s=function(e){for(let t=0;t<e.length;t++)if(void 0!==e[t][r])return e[t]}(n);return s?l(e,s):u(e,"repeater-item/no-item-in-scope",'Id Source is set to "From repeater", but this node is not inside a Repeater or Run Tasks template',void 0,{scope:(0,i.scopeChainNames)(e.nodeScope.componentOwner)})},t.forgetForEachItem=function(e){s.forget(e),a.delete(e)};const i=n(1608),o=n(9849),r="_forEachModel",s=new o.ResolvedTargetReporter,a=new WeakMap;function l(e,t){return a.delete(e),s.report(e,t.name),t[r]}function u(e,t,n,i,o){s.report(e,void 0);const r=t+"|"+(i||"");a.get(e)!==r&&(a.set(e,r),e.raiseRuntimeError(t,n,o))}},2845(e){"use strict";e.exports=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}},6835(e,t,n){"use strict";const i=n(1986),o=function(e,t){this.id=e,this.data=t},r=o._models={},s={},a={get:function(e,t,n){const i=e[t];return"function"==typeof i?i.bind(e):t in e?Reflect.get(e,t,n):e.get(t)},set:function(e,t,n){if("_class"===t)e._class=n;else{if("id"===t)return console.log(`Noodl.Object warning: id is readonly (Id is ${e.id}, trying to set to ${n})`),!0;e.set(t,n)}return!0},ownKeys:e=>Reflect.ownKeys(e.data),getOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e.data,t)},l=Symbol("noodl.model.proxy");function u(e){const t=new o(e,{}),n=new Proxy(t,a);return Object.defineProperty(t,l,{value:n,enumerable:!1,writable:!1,configurable:!0}),t}function c(e){return e[l]}const d=new i;let p;function h(e){if(0===e)throw new Error("Zero-length randomString is useless.");let t="";for(let n=0;n<e;++n)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(65536*(1+Math.random()))%62];return t}o.get=function(e){if(void 0===e){const e=u(o.guid());return d.add(e.id,e),c(e)}if(r[e])return s[e];const t=d.take(e);if(void 0!==t)return r[e]=t,s[e]=c(t),s[e];const n=u(e);return r[e]=n,s[e]=c(n),s[e]},o.create=function(e){var t=e||{},n=o.get(t.id);for(var i in t)"id"!==i&&n.set(i,t[i]);return n},o.exists=function(e){return void 0!==r[e]||void 0!==d.peek(e)},o._registrySize=function(){return{named:Object.keys(r).length,anonymous:d.size()}},o.instanceOf=function(e){return e instanceof o||e.target instanceof o},o.isReservedFieldName=function(e){return"id"!==e&&(void 0===p&&(p=new o("",{}),p.on("change",()=>{}),p._class=""),"function"==typeof p[e]||e in p)},o.guid=function(){return h(10)},o.prototype.on=function(e,t){this.listeners||(this.listeners={}),this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},o.prototype.off=function(e,t){if(this.listeners&&this.listeners[e]){var n=this.listeners[e].indexOf(t);-1!==n&&this.listeners[e].splice(n,1)}},o.prototype.notify=function(e,t){if(this.listeners&&this.listeners[e])for(var n=this.listeners[e].slice(),i=0;i<n.length;i++)n[i](t)},o.prototype.setAll=function(e){for(var t in e)if("id"!==t&&this.data[t]!==e[t]){var n=this.data[t];this.data[t]=e[t],this.notify("change",{name:t,value:e[t],old:n})}},o.prototype.fill=function(e=null){for(const t in this.data){if("id"===t)continue;const n=this.data[t];this.data[t]=e,this.notify("change",{name:t,value:this.data[t],old:n})}},o.prototype.set=function(e,t,n){if(n&&n.resolve&&-1!==e.indexOf(".")){for(var i=e.split("."),r=this,s=0;s<i.length-1;s++){var a=r.get(i[s]);if(!o.instanceOf(a))return;r=a}return void r.set(i[i.length-1],t)}const l=n&&n.forceChange;var u=this.data[e];this.data[e]=t,(l||u!==t)&&(!n||!n.silent)&&this.notify("change",{name:e,value:t,old:u})},o.prototype.getId=function(){return this.id},o.prototype.get=function(e,t){if(t&&t.resolve&&-1!==e.indexOf(".")){for(var n=e.split("."),i=this,r=0;r<n.length-1;r++){var s=i.get(n[r]);if(!o.instanceOf(s))return;i=s}return i.get(n[n.length-1])}return this.data[e]},o.prototype.toJSON=function(){return Object.assign({},this.data,{id:this.id})},(o.Scope=function(){this.models={},this.proxies={},this._weak=new i}).prototype.get=function(e){if(void 0===e){const e=u(o.guid());return this._weak.add(e.id,e),c(e)}if(this.models[e])return this.proxies[e];const t=this._weak.take(e);if(void 0!==t)return this.models[e]=t,this.proxies[e]=c(t),this.proxies[e];const n=u(e);return this.models[e]=n,this.proxies[e]=c(n),this.proxies[e]},o.Scope.prototype.create=function(e){var t=e||{},n=this.get(t.id);for(var i in t)"id"!==i&&n.set(i,t[i]);return n},o.Scope.prototype.exists=function(e){return void 0!==this.models[e]||void 0!==this._weak.peek(e)},o.Scope.prototype.instanceOf=function(e){return e instanceof o||e.target instanceof o},o.Scope.prototype.guid=function(){return h(10)},o.Scope.prototype.reset=function(){this.models={},this.proxies={},this._weak.clear(),delete this._cloudStore},e.exports=o},2377(e,t,n){"use strict";const i=n(2988),o=n(8587),r=function(e){o.call(this),this.name=e,this.nodes=Object.create(null),this.connections=[],this.roots=[],this.inputPorts={},this.outputPorts={},this.metadata={}};(r.prototype=Object.create(o.prototype)).addNode=async function(e){e.component=this,this.nodes[e.id]=e,await this.emit("nodeAdded",e)},r.prototype.hasNodeWithId=function(e){return void 0!==this.getNodeWithId(e)},r.prototype.getNodeWithId=function(e){return this.nodes[e]},r.prototype.getAllNodes=function(){return Object.values(this.nodes)},r.prototype.getNodesWithType=function(e){const t=[],n=this;return Object.keys(this.nodes).forEach(function(i){const o=n.nodes[i];o.type===e&&t.push(o)}),t},r.prototype.addConnection=function(e){if(this.connections.push(e),this.emit("connectionAdded",e),e.targetId){const t=this.getNodeWithId(e.targetId);t&&t.emit("inputConnectionAdded",e)}},r.prototype.removeConnection=function(e){const t=this.connections.findIndex(t=>t.sourceId===e.sourceId&&t.sourcePort===e.sourcePort&&t.targetId===e.targetId&&t.targetPort===e.targetPort);if(-1!==t){if(this.connections.splice(t,1),this.emit("connectionRemoved",e),e.targetId){const t=this.getNodeWithId(e.targetId);t&&t.emit("inputConnectionRemoved",e)}}else console.log("Connection doesn't exist",e)},r.prototype.getConnectionsFromPort=function(e,t){return this.connections.filter(function(n){return n.sourceId===e&&n.sourcePort===t})},r.prototype.getConnectionsToPort=function(e,t){return this.connections.filter(function(n){return n.targetId===e&&n.targetPort===t})},r.prototype.getConnectionsFrom=function(e){return this.connections.filter(function(t){return t.sourceId===e})},r.prototype.getConnectionsTo=function(e){return this.connections.filter(function(t){return t.targetId===e})},r.prototype.addRootId=function(e){-1===this.roots.indexOf(e)&&(this.roots.push(e),this.emit("rootAdded",e))},r.prototype.removeRootId=function(e){const t=this.roots.indexOf(e);-1!==t&&(this.roots.splice(t,1),this.emit("rootRemoved",e))},r.prototype.getRoots=function(){return this.roots},r.prototype.removeNodeWithId=async function(e){const t=this.getNodeWithId(e);if(!t)return console.warn("ERROR: Attempted to remove non-existing node with ID:",e),!1;for(;t.children.length>0;){const e=t.children[0];await this.removeNodeWithId(e.id)||t.children.shift()}const n=this.getConnectionsTo(e).concat(this.getConnectionsFrom(e));for(let e=0;e<n.length;e++)this.removeConnection(n[e]);return this.setNodeParent(t,null),-1!==this.roots.indexOf(t.id)&&this.removeRootId(t.id),await this.emit("nodeRemoved",t),t.removeAllListeners(),delete this.nodes[e],await this.emit("nodeWasRemoved",t),!0},r.prototype.getAllConnections=function(){return this.connections},r.prototype.getInputPorts=function(){return this.inputPorts},r.prototype.getOutputPorts=function(){return this.outputPorts},r.prototype.addInputPort=function(e){this.inputPorts[e.name]=e,this.emit("inputPortAdded",e)},r.prototype.addOutputPort=function(e){this.outputPorts[e.name]=e,this.emit("outputPortAdded",e)},r.prototype.removeOutputPortWithName=function(e){if(this.outputPorts.hasOwnProperty(e)){const t=this.outputPorts[e];delete this.outputPorts[e],this.emit("outputPortRemoved",t)}},r.prototype.removeInputPortWithName=function(e){if(this.inputPorts.hasOwnProperty(e)){const t=this.inputPorts[e];delete this.inputPorts[e],this.emit("inputPortRemoved",t)}},r.prototype.updateInputPortTypes=function(e){let t=!1;for(const n in e)void 0!==this.inputPorts[n]&&(this.inputPorts[n].type=e[n].type,t=!0);t&&this.emit("inputPortTypesUpdated")},r.prototype.updateOutputPortTypes=function(e){let t=!1;for(const n in e)void 0!==this.outputPorts[n]&&(this.outputPorts[n].type=e[n].type,t=!0);t&&this.emit("outputPortTypesUpdated")},r.prototype.renameInputPortOnNodeWithId=function(e,t,n){const i=this.getConnectionsToPort(e,t);i.forEach(this.removeConnection.bind(this));const o=this.getNodeWithId(e),r={...o.getInputPort(t)};r&&(o.removeInputPortWithName(t),r.name=n,o.addInputPort(r)),i.forEach(function(e){e.targetPort=n}),i.forEach(this.addConnection.bind(this))},r.prototype.renameOutputPortOnNodeWithId=function(e,t,n){const i=this.getConnectionsFromPort(e,t);i.forEach(this.removeConnection.bind(this));const o=this.getNodeWithId(e),r={...o.getOutputPort(t)};o.removeOutputPortWithName(t),r.name=n,o.addOutputPort(r),i.forEach(function(e){e.sourcePort=n}),i.forEach(this.addConnection.bind(this))},r.prototype.setNodeParent=function(e,t,n){-1!==this.roots.indexOf(e.id)&&this.removeRootId(e.id),e.parent&&(this.emit("nodeParentWillBeRemoved",e),e.parent.removeChild(e)),e.emit("parentUpdated",t),t&&(t.addChild(e,n),this.emit("nodeParentUpdated",e))},r.prototype.importEditorNodeData=async function(e,t,n){const o=i.createFromExportData(e);if(await this.addNode(o),t&&this.setNodeParent(o,this.getNodeWithId(t),n),e.children)for(let t=0;t<e.children.length;t++){const n=e.children[t];await this.importEditorNodeData(n,o.id,t)}},r.prototype.reset=async function(){for(;this.roots.length;)await this.removeNodeWithId(this.roots[0]);for(const e of Object.keys(this.nodes))this.hasNodeWithId(e)&&await this.removeNodeWithId(e);if(Object.keys(this.nodes).length>0)throw new Error("Not all nodes were removed during a reset");if(this.connections.length>0)throw new Error("Not all connections were removed during a reset")},r.prototype.rename=function(e){const t=this.name;this.name=e,this.emit("renamed",{oldName:t,newName:e})},r.prototype.setMetadata=function(e,t){this.metadata[e]=t},r.prototype.getMetadata=function(e){return e?this.metadata[e]:this.metadata},r.createFromExportData=async function(e){const t=new r(e.name);if(e.metadata)for(const n in e.metadata)t.setMetadata(n,e.metadata[n]);if(e.ports&&e.ports.forEach(function(e){"input"!==e.plug&&"input/output"!==e.plug||t.addInputPort(e),"output"!==e.plug&&"input/output"!==e.plug||t.addOutputPort(e)}),e.nodes)for(const n of e.nodes)await t.importEditorNodeData(n);return e.connections&&e.connections.forEach(e=>t.addConnection(e)),e.roots&&e.roots.forEach(e=>t.addRootId(e)),t},e.exports=r},7492(e,t,n){"use strict";const i=n(2377),o=n(8587),r=n(5332),s=function(){o.call(this),this.components={},this.settings={},this.metadata={},this.scriptFiles=new r.ScriptFiles};(s.prototype=Object.create(o.prototype)).importComponentFromEditorData=async function(e){const t=await i.createFromExportData(e);await this.addComponent(t)},s.prototype.getBundleContainingComponent=function(e){return this.componentToBundleMap.get(e)},s.prototype.getBundlesContainingSheet=function(e){const t=new Set;for(const n of Array.from(this.componentToBundleMap.keys())){const i=0!==n.indexOf("/#");(i&&"Default"===e||!i&&0===n.indexOf("/#"+e))&&t.add(this.componentToBundleMap.get(n))}return Array.from(t)},s.prototype.getBundleDependencies=function(e){const t=new Set,n=e=>{const i=this.componentIndex[e];for(const e of i.dependencies)t.has(e)||(t.add(e),n(e))};return n(e),Array.from(t)},s.prototype.importEditorData=async function(e){this.componentIndex=e.componentIndex,this.routerIndex=e.routerIndex,this.componentToBundleMap=new Map;for(const t in e.componentIndex){const n=e.componentIndex[t];for(const e of n.components)this.componentToBundleMap.set(e,t)}this.variants=e.variants||[],e.settings&&this.setSettings(e.settings),e.metadata&&this.setAllMetaData(e.metadata),e.scripts&&this.setScripts(e.scripts);for(const t of e.components)await this.importComponentFromEditorData(t);this.setRootComponentName(e.rootComponent)},s.prototype.setRootComponentName=function(e){this.rootComponent=e,this.emit("rootComponentNameUpdated",e)},s.prototype.getNodesWithType=function(e){let t=[];const n=Object.keys(this.components);for(let i=0;i<n.length;i++){const o=this.components[n[i]];t=t.concat(o.getNodesWithType(e))}return t},s.prototype.getComponentWithName=function(e){return this.components[e]},s.prototype.hasComponentWithName=function(e){return!!this.components[e]},s.prototype.getAllComponents=function(){return Object.keys(this.components).map(e=>this.components[e])},s.prototype.getAllNodes=function(){let e=[];const t=Object.keys(this.components);for(let n=0;n<t.length;n++){const i=this.components[t[n]];e=e.concat(i.getAllNodes())}return e},s.prototype.addComponent=async function(e){this.components[e.name]=e,this.getNodesWithType(e.name).forEach(this._addComponentPorts.bind(this)),e.getAllNodes().forEach(this._onNodeAdded.bind(this)),e.on("nodeAdded",this._onNodeAdded.bind(this),this),e.on("nodeRemoved",this._onNodeRemoved.bind(this),this),e.on("nodeWasRemoved",this._onNodeWasRemoved.bind(this),this),await this.emit("componentAdded",e)},s.prototype.removeComponentWithName=async function(e){if(!1===this.components.hasOwnProperty(e))return void console.error("GraphModel: Component with name "+e+" not in graph");const t=this.components[e];await t.reset(),t.removeAllListeners(),delete this.components[t.name],this.emit("componentRemoved",t)},s.prototype.renameComponent=function(e,t){if(!1===this.components.hasOwnProperty(e))return void console.error("GraphModel: Component with name "+e+" not in graph");this.getNodesWithType(e).forEach(function(e){e.type=t});const n=this.components[e];n.rename(t),delete this.components[e],this.components[t]=n,this.emit("componentRenamed",n)},s.prototype._addComponentPorts=function(e){if(this.components.hasOwnProperty(e.type)){const t=this.components[e.type],n=t.getInputPorts(),i=t.getOutputPorts();Object.keys(n).forEach(t=>{e.addInputPort(n[t])}),Object.keys(i).forEach(t=>{e.addOutputPort(i[t])})}},s.prototype._onNodeAdded=function(e){this._addComponentPorts(e),this.emit("nodeAdded",e),this.emit("nodeAdded."+e.type,e)},s.prototype._onNodeRemoved=function(e){this.emit("nodeRemoved",e),this.emit("nodeRemoved."+e.type,e)},s.prototype._onNodeWasRemoved=function(e){this.emit("nodeWasRemoved",e),this.emit("nodeWasRemoved."+e.type,e)},s.prototype.reset=async function(){for(const e of Object.keys(this.components))await this.removeComponentWithName(e);this.setSettings({})},s.prototype.isEmpty=function(){return 0===Object.keys(this.components).length},s.prototype.setSettings=function(e){this.settings=e,this.emit("projectSettingsChanged",e)},s.prototype.getSettings=function(){return this.settings},s.prototype.setScripts=function(e){this.scriptFiles.setSources(e),this.emit("scriptsChanged",this.scriptFiles.version)},s.prototype.setAllMetaData=function(e){for(const t in e)this.setMetaData(t,e[t])},s.prototype.setMetaData=function(e,t){this.metadata[e]&&JSON.stringify(this.metadata[e])===JSON.stringify(t)||(this.metadata[e]=t,this.emit("metadataChanged",{key:e,data:t}),this.emit("metadataChanged."+e,t))},s.prototype.getMetaData=function(e){return e?this.metadata[e]:this.metadata},s.prototype.getVariants=function(){return this.variants||[]},s.prototype.getVariant=function(e,t){return this.variants.find(n=>n.name===t&&n.typename===e)},s.prototype.updateVariant=function(e){const t=this.variants.findIndex(t=>t.name===e.name&&t.typename===e.typename);-1!==t&&this.variants.splice(t,1),this.variants.push(e),this.emit("variantUpdated",e)},s.prototype.updateVariantParameter=function(e,t,n,i,o){const r=this.getVariant(t,e);r?(o?(r.stateParameters.hasOwnProperty(o)||(r.stateParameters[o]={}),void 0===i?delete r.stateParameters[o][n]:r.stateParameters[o][n]=i):void 0===i?delete r.parameters[n]:r.parameters[n]=i,this.emit("variantUpdated",r)):console.log("updateVariantParameter: can't find variant",e,t)},s.prototype.updateVariantDefaultStateTransition=function(e,t,n,i){const o=this.getVariant(t,e);o&&(o.defaultStateTransitions[i]=n,this.emit("variantUpdated",o))},s.prototype.updateVariantStateTransition=function(e){const{variantTypeName:t,variantName:n,state:i,parameterName:o,curve:r}=e,s=this.getVariant(t,n);s&&(s.stateTransitions[i]||(s.stateTransitions[i]={}),s.stateTransitions[i][o]=r)},s.prototype.deleteVariant=function(e,t){const n=this.variants.findIndex(n=>n.name===t&&n.typename===e);-1!==n&&this.variants.splice(n,1)},e.exports=s},2988(e,t,n){"use strict";const i=n(8587),o=function(e,t){i.call(this),this.id=e,this.type=t,this.inputs=[],this.outputs=[],this.children=[],this.parameters={},this.inputPorts={},this.outputPorts={}};(o.prototype=Object.create(i.prototype)).setParameter=function(e,t,n){n?(this.stateParameters||(this.stateParameters={}),this.stateParameters[n]||(this.stateParameters[n]={}),void 0===t?delete this.stateParameters[n][e]:this.stateParameters[n][e]=t):void 0===t?delete this.parameters[e]:this.parameters[e]=t,this.emit("parameterUpdated",{name:e,value:t,state:n})},o.prototype.setParameters=function(e){Object.keys(e).forEach(t=>{this.setParameter(t,e[t])})},o.prototype.setStateParameters=function(e){this.stateParameters=e},o.prototype.setStateTransitions=function(e){this.stateTransitions=e},o.prototype.setStateTransitionParamter=function(e,t,n){this.stateTransitions||(this.stateTransitions={}),t?this.stateTransitions[n][e]=t:delete this.stateTransitions[n][e]},o.prototype.setDefaultStateTransition=function(e,t){this.defaultStateTransitions||(this.defaultStateTransitions={}),this.defaultStateTransitions[t]=e},o.prototype.addInputPort=function(e){this.inputPorts[e.name]=e,this.emit("inputPortAdded",e)},o.prototype.getInputPort=function(e){return this.inputPorts[e]},o.prototype.getInputPorts=function(){return this.inputPorts},o.prototype.removeInputPortWithName=function(e){if(Object.prototype.hasOwnProperty.call(this.inputPorts,e)){const t=this.inputPorts[e];delete this.inputPorts[e],this.emit("inputPortRemoved",t)}},o.prototype.updateInputPortTypes=function(e){let t=!1;for(const n in e)void 0!==this.inputPorts[n]&&(this.inputPorts[n].type=e[n].type,t=!0);t&&this.emit("inputPortTypesUpdated")},o.prototype.addOutputPort=function(e){this.outputPorts[e.name]=e,this.emit("outputPortAdded",e)},o.prototype.getOutputPort=function(e){return this.outputPorts[e]},o.prototype.getOutputPorts=function(){return this.outputPorts},o.prototype.removeOutputPortWithName=function(e){if(Object.prototype.hasOwnProperty.call(this.outputPorts,e)){const t=this.outputPorts[e];delete this.outputPorts[e],this.emit("outputPortRemoved",t)}},o.prototype.updateOutputPortTypes=function(e){let t=!1;for(const n in e)void 0!==this.outputPorts[n]&&(this.outputPorts[n].type=e[n].type,t=!0);t&&this.emit("outputPortTypesUpdated")},o.prototype.addChild=function(e,t){e.parent=this,void 0===t?this.children.push(e):this.children.splice(t,0,e),this.emit("childAdded",e)},o.prototype.removeChild=function(e){e.parent=void 0;const t=this.children.indexOf(e);this.children.splice(t,1),this.emit("childRemoved",e)},o.prototype.reset=function(){this.removeAllListeners()},o.prototype.setVariant=function(e){this.variant=e,this.emit("variantUpdated",e)},o.createFromExportData=function(e){const t=new o(e.id,e.type);if(e.parameters&&t.setParameters(e.parameters),e.stateParameters&&t.setStateParameters(e.stateParameters),e.stateTransitions&&t.setStateTransitions(e.stateTransitions),e.defaultStateTransitions)for(const n in e.defaultStateTransitions)t.setDefaultStateTransition(e.defaultStateTransitions[n],n);return e.ports&&e.ports.forEach(function(e){"outputs"===e.plug&&(e.plug="output"),"input"!==e.plug&&"input/output"!==e.plug||t.addInputPort(e),"output"!==e.plug&&"input/output"!==e.plug||t.addOutputPort(e)}),e.variant&&t.setVariant(e.variant),t},e.exports=o},7268(module,__unused_webpack_exports,__webpack_require__){"use strict";const OutputProperty=__webpack_require__(6300),expression_evaluator_1=__webpack_require__(3162),expression_type_coercion_1=__webpack_require__(5812),diagnostics_1=__webpack_require__(1550),outcome_1=__webpack_require__(5162),run_on_value_change_1=__webpack_require__(5838),NAN_INPUT_KEY="node/nan-input/",SIGNAL_PULSE=Object.freeze({__noodlSignalPulse:!0});function isExpressionParameter(e){return null!=e&&"object"==typeof e&&"expression"===e.mode&&"string"==typeof e.expression}const Node=function(e,t){this.id=t,this.context=e,this._dirty=!1,this._inputs={},this._inputValues={},this._outputs={},this._inputConnections={},this._outputList=[],this._isUpdating=!1,this._inputValuesQueue={},this._inputCauseQueue={},this._afterInputsHaveUpdatedCallbacks=[],this._internal={},this._signalsSentThisUpdate={},this._deleted=!1,this._deleteListeners=[],this._isFirstUpdate=!0,this._valuesFromConnections={},this.updateOnDirtyFlagging=!0,this._runOnValueChange={},this._expressionSubscriptions={},this._expressionErrorPorts=null};function portHasUnits(e){if(!e)return!1;if(!0===e.hasUnits)return!0;const t=e.type;return!!t&&"object"==typeof t&&Array.isArray(t.units)}function defaultUnitOf(e){if(e.defaultUnit)return e.defaultUnit;const t=e.type;return t&&"object"==typeof t&&Array.isArray(t.units)?t.defaultUnit||t.units[0]:void 0}function isBareMagnitude(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&""!==e.trim()&&Number.isFinite(Number(e))}Node.prototype.getInputValue=function(e){return this._inputValues[e]},Node.prototype.registerInput=function(e,t){if(this.hasInput(e))throw new Error("Input property "+e+" already registered");this._inputs[e]=t;const n=t.type;if(n&&n.units){const i=n.defaultUnit||n.units[0];this._inputValues[e]={value:t.default,unit:i}}else t.hasOwnProperty("default")&&(this._inputValues[e]=t.default)},Node.prototype.deregisterInput=function(e){if(!1===this.hasInput(e))throw new Error("Input property "+e+" doesn't exist");delete this._inputs[e],delete this._inputValues[e]},Node.prototype.registerInputs=function(e){for(const t in e)this.registerInput(t,e[t])},Node.prototype.getInput=function(e){if(!1!==this.hasInput(e))return this._inputs[e];console.log("Node "+this.name+": Invalid input property "+e)},Node.prototype.hasInput=function(e){return e in this._inputs},Node.prototype.registerInputIfNeeded=function(){},Node.prototype.shouldRunOnValueChange=function(e){return(0,run_on_value_change_1.runOnValueChange)(this,e)},Node.prototype.shouldRunOnValueChanged=function(e,t,n){return(0,run_on_value_change_1.valueDidChange)(t,n)&&(0,run_on_value_change_1.runOnValueChange)(this,e)},Node.prototype.registerRunOnValueChangeInput=function(e,t){const n=(0,run_on_value_change_1.runOnChangePortName)(e);this.hasInput(n)||this.registerInput(n,(0,run_on_value_change_1.runOnChangeInput)(e,t))},Node.prototype.deregisterRunOnValueChangeInput=function(e){const t=(0,run_on_value_change_1.runOnChangePortName)(e);this.hasInput(t)&&this.deregisterInput(t),delete this._runOnValueChange[e]},Node.prototype._raiseExpressionError=function(e,t){this.context&&this.context.editorConnection&&(this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"expression-error-"+e,{showGlobally:!0,message:t}),null===this._expressionErrorPorts&&(this._expressionErrorPorts={}),this._expressionErrorPorts[e]=!0)},Node.prototype._clearExpressionError=function(e){null!==this._expressionErrorPorts&&this._expressionErrorPorts[e]&&(delete this._expressionErrorPorts[e],this.context&&this.context.editorConnection&&this.nodeScope&&this.nodeScope.componentOwner&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"expression-error-"+e))},Node.prototype._evaluateExpressionParameter=function(e,t){if(!isExpressionParameter(e)){if(this._expressionSubscriptions[t]){const e=this._expressionSubscriptions[t];e&&e.unsub&&e.unsub(),delete this._expressionSubscriptions[t]}return this._clearExpressionError(t),e}const n=this.getInput(t);if(!n)return e.fallback;try{const i=(0,expression_evaluator_1.compileExpression)(e.expression);if(!i){if(console.warn(`Expression compilation failed for ${this.name}.${t}: ${e.expression}`),this.context&&this.context.editorConnection){const n=(0,expression_evaluator_1.validateExpression)(e.expression);this._raiseExpressionError(t,`Expression error: ${n.error||"could not compile expression"}`)}return e.fallback}const o=(0,expression_evaluator_1.evaluateExpression)(i,void 0,{rethrow:!0}),r=(0,expression_type_coercion_1.coerceToType)(o,n.type,e.fallback),s=this._expressionSubscriptions[t];if(s&&s.expression!==e.expression&&s.unsub&&(s.unsub(),delete this._expressionSubscriptions[t]),!this._expressionSubscriptions[t]){const n=(0,expression_evaluator_1.detectDependencies)(e.expression);if(n.variables.length>0||n.objects.length>0||n.arrays.length>0){const i=(0,expression_evaluator_1.subscribeToChanges)(n,function(){if(this._deleted)return;const e=this._inputValues[t];isExpressionParameter(e)&&this.queueInput(t,e)}.bind(this));this._expressionSubscriptions[t]={unsub:i,expression:e.expression}}}return this._clearExpressionError(t),r}catch(n){return console.warn(`Expression evaluation failed for ${this.name}.${t}:`,n),this._raiseExpressionError(t,`Expression error: ${n.message}`),e.fallback}},Node.prototype.setInputValue=function(name,value){const input=this.getInput(name);if(!input)return void console.log("node doesn't have input",name,"for node:",this.name);const currentInputValue=this._inputValues[name];if(portHasUnits(input)&&!1===isNaN(value)&&currentInputValue&&currentInputValue.unit){const e=Object.assign({},currentInputValue);e.value=value,value=e}else portHasUnits(input)&&isBareMagnitude(value)&&defaultUnitOf(input)&&(value={value,unit:defaultUnitOf(input)});this._inputValues[name]=value,value=this._evaluateExpressionParameter(value,name);const inputTypeName="string"==typeof input.type?input.type:input.type&&input.type.name;if("color"===input.type&&this.context&&this.context.styles)value=this.context.styles.resolveColor(value);else if(("array"===inputTypeName||"object"===inputTypeName)&&"string"==typeof value){const literal="object"===inputTypeName?"("+value+")":value,canReport=!!(this.context.editorConnection&&this.nodeScope&&this.nodeScope.componentOwner),warningKey="invalid-"+inputTypeName+"-"+name;try{value=eval(literal),canReport&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,warningKey)}catch(e){value="object"===inputTypeName?{}:[],console.log(e),canReport&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,warningKey,{showGlobally:!0,message:"Invalid "+inputTypeName+"<br>"+e.toString()})}}input.set.call(this,value)},Node.prototype.hasOutput=function(e){return e in this._outputs},Node.prototype.registerOutput=function(e,t){if(this.hasOutput(e))throw new Error("Output property "+e+" already registered");const n=new OutputProperty({owner:this,getter:t.get||t.getter,name:e,type:t.type,onFirstConnectionAdded:t.onFirstConnectionAdded,onLastConnectionRemoved:t.onLastConnectionRemoved});this._outputs[e]=n,this._outputList.push(n)},Node.prototype.deregisterOutput=function(e){if(!1===this.hasOutput(e))throw new Error("Output property "+e+" isn't registered");const t=this._outputs[e];if(t.hasConnections())throw new Error("Output property "+e+" has connections and can't be removed");delete this._outputs[e];var n=this._outputList.indexOf(t);this._outputList.splice(n,1)},Node.prototype.registerOutputs=function(e){for(var t in e)this.registerOutput(t,e[t])},Node.prototype.registerOutputIfNeeded=function(){},Node.prototype.getOutput=function(e){if(!1===this.hasOutput(e))throw new Error("Node "+this.name+" doesn't have a port named "+e);return this._outputs[e]},Node.prototype.connectInput=function(e,t,n){if(!1===this.hasInput(e))throw new Error("Invalid connection, input doesn't exist. Trying to connect from "+t.name+" output "+n+" to "+this.name+" input "+e);var i=t.getOutput(n);if(i.registerConnection(this,e),this._inputConnections[e]||(this._inputConnections[e]=[]),this._inputConnections[e].push(i),t._signalsSentThisUpdate[n])this._setValueFromConnection(e,!0),this._setValueFromConnection(e,!1);else{var o=i.value;void 0!==o&&(this._setValueFromConnection(e,o),this.context&&this.context.connectionSentValue(i,i.value))}this.flagDirty()},Node.prototype.removeInputConnection=function(e,t,n){if(!this._inputConnections[e])throw new Error("Node removeInputConnection: Input doesn't exist");const i=this._inputConnections[e];for(let o=0;o<i.length;o++){const r=i[o];if(r.owner.id===t&&r.name===n){i.splice(o,1),r.owner.getOutput(n).deregisterConnection(this,e);break}}0===i.length&&delete this._valuesFromConnections[e]},Node.prototype.isInputConnected=function(e){return!!this._inputConnections.hasOwnProperty(e)&&this._inputConnections[e].some(e=>"Component Inputs"!==e.owner.name||e.owner.nodeScope.componentOwner.isInputConnected(e.name))},Node.prototype.update=function(){if(this._isUpdating||!1===this._dirty)return;this._updatedAtIteration!==this.context.updateIteration&&(this._updatedAtIteration=this.context.updateIteration,this._updateIteration=0,this._cyclicLoop&&(this._cyclicLoop=!1)),this._isUpdating=!0;const e=this.context&&!0===this.context.traceEnabled?this.context:void 0;try{for(;this._dirty&&!this._cyclicLoop;){this._updateDependencies(),this._dirty=!1;const t=Object.keys(this._inputValuesQueue),n=[];let i=!0;for(;i&&!this._cyclicLoop;){i=!1,n.length=0;for(let e=0;e<2;e++){const i=1===e;for(let e=0;e<t.length;e++){const o=this._inputValuesQueue[t[e]];void 0!==o&&0!==o.length&&o[0]===SIGNAL_PULSE===i&&n.push(t[e])}}for(let t=0;t<n.length;t++){const o=n[t],r=this._inputValuesQueue[o];if(void 0!==r&&r.length>0){const t=r.shift(),n=e?this._inputCauseQueue[o]:void 0,s=e?e._currentCause:0;e&&(e._currentCause=n&&n.length>0?n.shift():0);try{t===SIGNAL_PULSE?(this.setInputValue(o,!0),this.setInputValue(o,!1)):this.setInputValue(o,t)}finally{e&&(e._currentCause=s)}void 0!==this._inputValuesQueue[o]&&this._inputValuesQueue[o].length>0?i=!0:(delete this._inputValuesQueue[o],delete this._inputCauseQueue[o])}}const o=this._afterInputsHaveUpdatedCallbacks;this._afterInputsHaveUpdatedCallbacks=[];for(let e=0;e<o.length;e++)o[e].call(this)}this._updateIteration++,this._updateIteration>=100&&(this._cyclicLoop=!0,this._cyclicLoopCause={limit:"update-iterations",count:100})}}catch(e){throw this._isUpdating=!1,e}this._cyclicLoop&&(this.context.scheduleNextFrame(()=>{this.context.nodeIsDirty(this)}),!this._cyclicWarningSent&&this.context.isWarningTypeEnabled("cyclicLoops")&&(this._cyclicWarningSent=!0,this.raiseRuntimeError("runtime/cyclic-loop","Cyclic loop detected",this._cyclicLoopCause))),this._isFirstUpdate=!1,this._isUpdating=!1},Node.prototype._updateDependencies=function(){for(var e in this._inputConnections)for(var t=this._inputConnections[e],n=0;n<t.length;++n)t[n].owner.update()},Node.prototype.flagDirty=function(){this._dirty||(this._dirty=!0,this.updateOnDirtyFlagging&&this._performDirtyUpdate())},Node.prototype._performDirtyUpdate=function(){this.context&&this.context.nodeIsDirty(this);for(var e=0;e<this._outputList.length;++e)this._outputList[e].flagDependeesDirty()},Node.prototype.sendValue=function(e,t){if(!1===this.hasOutput(e))return void console.log("Error: Node",this.name,"doesn't have a output named",e);if(void 0===t)return;const n=this.getOutput(e);n.sendValue(t),this.context&&this.context.connectionSentValue(n,t)},Node.prototype.flagOutputDirty=function(e){const t=this.getOutput(e);this.sendValue(e,t.value)},Node.prototype.flagAllOutputsDirty=function(){for(const e of this._outputList)this.sendValue(e.name,e.value)},Node.prototype.sendSignalOnOutput=function(e){if(!1===this.hasOutput(e))return void console.log("Error: Node",this.name,"doesn't have a output named",e);const t=this.getOutput(e);t.sendPulse(),this._signalsSentThisUpdate[e]=!0,this.scheduleAfterInputsHaveUpdated(function(){this._signalsSentThisUpdate[e]=!1}),this.context&&this.context.connectionSentSignal(t)},Node.prototype.raiseRuntimeError=function(e,t,n){const i=this.context;if(!i||!i.errorBus)return;let o="<unknown>";try{this.nodeScope&&this.nodeScope.componentOwner&&this.nodeScope.componentOwner.name&&(o=this.nodeScope.componentOwner.name)}catch(e){}if(i.errorBus.raise({nodeId:this.id,componentName:o,nodeType:this.name,code:e,message:t,detail:n}),this._raisingForOutcome)return;const r=this.nodeScope,s=r&&r.runContext;if(!s||!s.beginStep||!s.endStep)return;const a=s.beginStep({nodeId:this.id,nodeType:this.name});null!=a&&s.endStep(a,{status:"failure",code:e,message:t,detail:n})},Node.prototype.setDiagnostic=function(e,t){(0,diagnostics_1.setDiagnostic)(this,e,t)},Object.defineProperty(Node.prototype,"diagnosticsEnabled",{get:function(){return(0,diagnostics_1.diagnosticsEnabled)(this)}}),Node.prototype.beginOutcome=function(e){const t={reported:void 0},n=this.nodeScope,i=n&&n.runContext;return i&&i.beginStep&&(t.step=i.beginStep({nodeId:this.id,nodeType:this.name,inputData:e})),t},Node.prototype.reportOutcome=function(e,t,n){if("unchanged"===t){const e=this._internal[outcome_1.TREAT_UNCHANGED_AS];"done"===e?t="done":"failure"===e&&(t="failure",n={code:"outcome/unchanged-as-failure",message:"The action was valid and there was nothing to do, which Treat Unchanged as reports as a failure on this node",detail:n&&n.detail})}if(void 0!==e.reported){this._raisingForOutcome=!0;try{this.raiseRuntimeError("outcome/duplicate",`Reported ${e.reported} and then ${t} for one invocation, which the outcome contract forbids`,{first:e.reported,second:t})}finally{this._raisingForOutcome=!1}return}e.reported=t,this._raisingForOutcome=!0;try{"failure"!==t||n&&!1===n.raise||this.raiseRuntimeError(n&&n.code||"outcome/unspecified-failure",n&&n.message||"The action could not be performed",n&&n.detail),this.hasOutput(t)?this.sendSignalOnOutput(t):this.raiseRuntimeError("outcome/missing-port",`Reported ${t} but has no ${t} output, so the outcome reached no wire`,{outcome:t}),this.hasOutput(outcome_1.COMPLETED_PORT)?this.sendSignalOnOutput(outcome_1.COMPLETED_PORT):this.raiseRuntimeError("outcome/missing-completed","Adopted the outcome contract without a Completed output, which every action must have",{outcome:t})}finally{this._raisingForOutcome=!1}const i=e.step;if(null!=i){e.step=void 0;const o=this.nodeScope,r=o&&o.runContext;r&&r.endStep&&r.endStep(i,{status:t,code:n&&n.code,message:n&&n.message,detail:n&&n.detail})}},Node.prototype._setValueFromConnection=function(e,t,n,i){const o="string"==typeof n?n:n&&n.name;if(("object"===o||"array"===o)&&null!==t&&"object"==typeof t){const n=this._inputs[e],i=n&&n.type;if("string"===("string"==typeof i?i:i&&i.name)&&(Array.isArray(t)||"[object Object]"===String(t)))try{t=JSON.stringify(t)}catch(n){t="",this.context.editorConnection&&this.nodeScope&&this.nodeScope.componentOwner&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"unstringifiable-object-"+e,{showGlobally:!0,message:"Could not convert object to string<br>"+n.toString()})}}t!=t?(void 0===this._nanInputs&&(this._nanInputs={}),this._nanInputs[e]||(this._nanInputs[e]=!0,this.setDiagnostic(NAN_INPUT_KEY+e,`Input "${e}" received NaN — something upstream produced Not-a-Number, commonly text that did not parse as a number. Every value computed from it will be NaN too.`))):void 0!==this._nanInputs&&this._nanInputs[e]&&(this._nanInputs[e]=!1,this.setDiagnostic(NAN_INPUT_KEY+e,null)),this._valuesFromConnections[e]=t,this.queueInput(e,t,i)},Node.prototype._setPulseFromConnection=function(e,t){this._valuesFromConnections[e]=!1,this.queueInput(e,SIGNAL_PULSE,t)},Node.prototype._hasInputBeenSetFromAConnection=function(e){return this._valuesFromConnections.hasOwnProperty(e)},Node.prototype.queueInput=function(e,t,n){this._inputValuesQueue[e]||(this._inputValuesQueue[e]=[]);const i=void 0!==n&&void 0!==this.context&&!0===this.context.traceEnabled;if(i&&!this._inputCauseQueue[e]&&(this._inputCauseQueue[e]=[]),this._isFirstUpdate){const n=this._inputValuesQueue[e][0];!0===n||n===SIGNAL_PULSE||(portHasUnits(this._inputs[e])&&n instanceof Object&&n.unit&&t instanceof Object==0&&(t={value:t,unit:n.unit}),this._inputValuesQueue[e].length=0,this._inputCauseQueue[e]&&(this._inputCauseQueue[e].length=0))}this._inputValuesQueue[e].push(t),i&&this._inputCauseQueue[e].push(n),this.flagDirty()},Node.prototype.scheduleAfterInputsHaveUpdated=function(e){this._afterInputsHaveUpdatedCallbacks.push(e),this.flagDirty()},Node.prototype.setNodeModel=function(e){this.model=e,e.on("parameterUpdated",this._onNodeModelParameterUpdated,this),e.on("variantUpdated",this._onNodeModelVariantUpdated,this),e.on("inputPortRemoved",e=>{this.hasInput(e.name)&&this.deregisterInput(e.name)},this),e.on("outputPortRemoved",e=>{this.hasOutput(e.name)&&this.deregisterOutput(e.name)},this)},Node.prototype.addDeleteListener=function(e){this._deleteListeners.push(e)},Node.prototype._onNodeDeleted=function(){this.model&&(this.model.removeListenersWithRef(this),this.model=void 0),this._deleted=!0;for(const e in this._expressionSubscriptions){const t=this._expressionSubscriptions[e];t&&t.unsub&&t.unsub()}this._expressionSubscriptions={};for(const e in this._expressionErrorPorts)this._clearExpressionError(e);for(const e of this._deleteListeners)e.call(this)},Node.prototype._scheduleEditorDrivenRerender=function(){this._rerenderReactNode&&(this._editorRerenderScheduled||(this._editorRerenderScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._editorRerenderScheduled=!1,this._rerenderReactNode&&this._rerenderReactNode()})))},Node.prototype._onNodeModelParameterUpdated=function(e){if(this.registerInputIfNeeded(e.name),void 0!==e.value)if(e.state){if(!this._getVisualStates)return void console.log("Node has nos visual states, but got a parameter for state",e.state);-1!==this._getVisualStates().indexOf(e.state)&&(this.queueInput(e.name,e.value),this._scheduleEditorDrivenRerender())}else this.queueInput(e.name,e.value),this._scheduleEditorDrivenRerender();else{let t;const n=this.variant;e.state?n&&n.stateParameters.hasOwnProperty(e.state)&&n.stateParameters[e.state].hasOwnProperty(e.name)?t=n.stateParameters[e.state][e.name]:this.model.parameters.hasOwnProperty(e.name)?t=this.model.parameters[e.name]:n&&n.parameters.hasOwnProperty(e.name)&&(t=n.parameters[e.name]):n&&n.parameters.hasOwnProperty(e.name)&&(t=n.parameters[e.name]),void 0===t&&(t=this.context.getDefaultValueForInput(this.model.type,e.name),this._resetReactVirtualDOM&&this._resetReactVirtualDOM(e.name)),this.queueInput(e.name,t)}},Node.prototype._onNodeModelVariantUpdated=function(e){this.setVariant(e)},module.exports=Node},2069(e,t,n){"use strict";const i=n(5293),o=n(8153),r=n(6202),s=n(9190),a=n(5801),l=n(9174),u=n(3786),c=function(e){(e=e||{}).runningInEditor=!!e.hasOwnProperty("runningInEditor")&&e.runningInEditor,this._dirtyNodes=[],this.callbacksAfterUpdate=[],this.graphModel=e.graphModel,this.platform=e.platform,this.eventEmitter=new i,this.eventEmitter.setMaxListeners(1e6),this.eventSenderEmitter=new i,this.eventSenderEmitter.setMaxListeners(1e6),this.globalValues={},this.globalsEventEmitter=new i,this.globalsEventEmitter.setMaxListeners(1e6),this.runningInEditor=e.runningInEditor,this.currentFrameTime=0,this.frameNumber=0,this.updateIteration=0,this.nodeRegister=new o(this),this.timerScheduler=new s(this.scheduleUpdate.bind(this)),this.componentModels={},this.popupStack=[],this.debugInspectorsEnabled=!1,this.traceEnabled=!1,this._traceOwners=new Set,this._traceBuffer=void 0,this._traceValueCap=a.DEFAULT_VALUE_CAP,this._currentCause=0,this.connectionsToPulse={},this.connectionsToPulseChanged=!1,this.debugInspectors={},this.connectionPulsingCallbackScheduled=!1,this.editorConnection=e.editorConnection,this.rootComponent=void 0,this._outputHistory={},this._signalHistory={},this.warningTypes={},this.bundleFetchesInFlight=new Map,this.variants=new l({graphModel:this.graphModel,getNodeScope:()=>this.rootComponent?this.rootComponent.nodeScope:null}),this.errorBus=new r.RuntimeErrorBus,this.editorConnection&&this.errorBus.subscribe((0,r.createEditorWarningSubscriber)(this.editorConnection)),this.editorConnection&&this.runningInEditor&&"cloud"!==this.editorConnection.runtimeType||this.errorBus.subscribe((0,r.createConsoleErrorSubscriber)()),(0,r.setAmbientErrorBus)(this.errorBus),this.editorConnection&&(this.editorConnection.on("debugInspectorsUpdated",e=>{this.onDebugInspectorsUpdated(e)}),this.editorConnection.on("getConnectionValue",({clientId:e,connectionId:t})=>{if(this.editorConnection.clientId!==e)return;const n=this._outputHistory[t];this.editorConnection.sendConnectionValue(t,n?n.value:void 0)}),this.editorConnection.on("traceEnabledChanged",e=>{"boolean"==typeof e?this.setTraceEnabled(e):this.setTraceEnabled(!!e.enabled,e.owner)}),this.editorConnection.on("peerDisconnected",({clientId:e})=>{this.releaseTraceOwner(e)}),this.editorConnection.on("getTraceState",({clientId:e})=>{this.editorConnection.clientId===e&&this.editorConnection.sendTraceState(this.getTraceState())}),this.editorConnection.on("getTraceEvents",({clientId:e,afterSeq:t})=>{this.editorConnection.clientId===e&&this.editorConnection.sendTraceEvents(this.getTraceEvents(t).map(a.toWireEvent))}),this.editorConnection.on("getTraceDictionary",({clientId:e})=>{this.editorConnection.clientId===e&&this.editorConnection.sendTraceDictionary(this.buildSessionDictionary())}),this.editorConnection.on("getPortValues",({clientId:e,ports:t})=>{this.editorConnection.clientId===e&&this.editorConnection.sendPortValues(this.getPortValues(t))}),this.editorConnection.on("evaluateBlockFragment",({requestId:e,nodeId:t,code:n})=>{this.editorConnection.sendBlockFragmentResult(this.evaluateBlockFragment(e,t,n))}),this.editorConnection.on("setBlockTracing",({nodeId:e,enabled:t})=>{this.setBlockTracing(e,!!t),this.editorConnection.sendBlockTraceState({nodeId:e,enabled:!!t,attached:this.hasNode(e)})}))};c.prototype.setRootComponent=function(e){this.rootComponent=e,this.traceEnabled&&this.editorConnection&&this.editorConnection.sendTraceDictionary&&this.editorConnection.sendTraceDictionary(this.buildSessionDictionary())},c.prototype.getCurrentTime=function(){return this.platform.getCurrentTime()},c.prototype.onDebugInspectorsUpdated=function(e){this.debugInspectorsEnabled&&(e=e.map(e=>{if("connection"===e.type){const t=e.connection;e.id=t.fromId+t.fromProperty}else"node"===e.type&&(e.id=e.nodeId);return e}),this.debugInspectors={},e.forEach(e=>this.debugInspectors[e.id]=e),this.sendDebugInspectorValues())},c.prototype.updateDirtyNodes=function(){var e,t,n=!0,i=0;for(this.updateIteration++,this.isUpdating=!0;n&&i<10;){var o=this._dirtyNodes;for(this._dirtyNodes=[],e=0,t=o.length;e<t;++e)try{o[e]._deleted||o[e].update()}catch(e){console.error(e,e.stack)}var r=this.callbacksAfterUpdate;for(this.callbacksAfterUpdate=[],e=0,t=r.length;e<t;e++)try{r[e]()}catch(e){console.error(e)}n=this.callbacksAfterUpdate.length>0||this._dirtyNodes.length>0,i++}this.isUpdating=!1},c.prototype.update=function(){this.frameNumber++,this.updateDirtyNodes(),this.timerScheduler.hasPendingTimers()&&(this.scheduleUpdate(),this.timerScheduler.runTimers(this.currentFrameTime)),this.debugInspectorsEnabled&&this.sendDebugInspectorValues()},c.prototype.reset=function(){this.eventEmitter.emit("applicationDataReloaded");var e=this.eventEmitter;["frameStart","frameEnd"].forEach(function(t){e.removeAllListeners(t)}),this.globalValues={},this._dirtyNodes.length=0,this.callbacksAfterUpdate.length=0,this.timerScheduler.runningTimers=[],this.timerScheduler.newTimers=[],this.rootComponent=void 0,this.clearDebugInspectors(),this.clearTrace()},c.prototype.nodeIsDirty=function(e){this._dirtyNodes.push(e),this.scheduleUpdate()},c.prototype.scheduleUpdate=function(){this.eventEmitter.emit("scheduleUpdate")},c.prototype.scheduleAfterUpdate=function(e){this.callbacksAfterUpdate.push(e),this.scheduleUpdate()},c.prototype.scheduleNextFrame=function(e){this.eventEmitter.once("frameStart",e),this.scheduleUpdate()},c.prototype.setGlobalValue=function(e,t){this.globalValues[e]=t,this.globalsEventEmitter.emit(e)},c.prototype.getGlobalValue=function(e){return this.globalValues[e]},c.prototype.registerComponentModel=function(e){if(this.componentModels.hasOwnProperty(e.name))throw new Error("Duplicate component name "+e.name);this.componentModels[e.name]=e;var t=this;e.on("renamed",function(n){delete t.componentModels[n.oldName],t.componentModels[n.newName]=e},this)},c.prototype.deregisterComponentModel=function(e){this.componentModels.hasOwnProperty(e.name)&&(this.componentModels[e.name].removeListenersWithRef(this),delete this.componentModels[e.name])},c.prototype.fetchComponentBundle=async function(e){const t=async e=>{let t=`${Noodl.Env.BaseUrl||"/"}noodl_bundles/${e}.json`;const n=await fetch(t);if(404===n.status)throw new Error("Component not found "+e);const i=await n.json();for(const e of i)!1===this.graphModel.hasComponentWithName(e.name)&&await this.graphModel.importComponentFromEditorData(e)};if(this.bundleFetchesInFlight.has(e))await this.bundleFetchesInFlight.get(e);else{const n=t(e);this.bundleFetchesInFlight.set(e,n),await n}},c.prototype.getComponentModel=async function(e){if(!e)throw new Error("Component instance must have a name");if(!1===this.componentModels.hasOwnProperty(e)){const t=this.graphModel.getBundleContainingComponent(e);if(!t)throw new Error("Can't find component model for "+e);for(const e of this.graphModel.getBundleDependencies(t))this.fetchComponentBundle(e);await this.fetchComponentBundle(t)}return this.componentModels[e]},c.prototype.hasComponentModelWithName=function(e){return this.componentModels.hasOwnProperty(e)},c.prototype.createComponentInstanceNode=async function(e,t,i,o){var r=new(n(8204))(this,t,i);r.name=e;for(const e in o)r[e]=o[e];const s=await this.getComponentModel(e);return await r.setComponentModel(s),r},c.prototype._formatConnectionValue=function(e){if("object"==typeof e&&e&&e.constructor&&"Node"===e.constructor.name)e="<Node> "+e.name;else if("object"==typeof e&&"undefined"!=typeof window&&e instanceof HTMLElement)e=`DOM Node <${e.tagName}>`;else{if("string"==typeof e&&!e.startsWith("[Signal]"))return'"'+e+'"';if(Number.isNaN(e))return"NaN"}return e},c.prototype.connectionSentValue=function(e,t){if(!this.editorConnection||!this.editorConnection.isConnected()||!this.debugInspectorsEnabled)return;const n=this.getCurrentTime();if(this._outputHistory[e.id]={value:t,timestamp:n},this.connectionsToPulse.hasOwnProperty(e.id))return void(this.connectionsToPulse[e.id].timestamp=n);const i=[];e.connections.forEach(t=>{i.push(e.owner.id+e.name+t.node.id+t.inputPortName)}),this.connectionsToPulse[e.id]={timestamp:n,connections:i},this.connectionsToPulseChanged=!0,!1===this.connectionPulsingCallbackScheduled&&(this.connectionPulsingCallbackScheduled=!0,setTimeout(this.clearOldConnectionPulsing.bind(this),100))},c.prototype.connectionSentSignal=function(e){const t=e.id;this._signalHistory.hasOwnProperty(t)||(this._signalHistory[t]={count:0}),this._signalHistory[t].count++,this.connectionSentValue(e,"[Signal] Trigger count "+this._signalHistory[t].count)},c.prototype.clearDebugInspectors=function(){this.debugInspectors={},this.connectionsToPulse={},this.editorConnection.sendPulsingConnections(this.connectionsToPulse)},c.prototype.clearOldConnectionPulsing=function(){this.connectionPulsingCallbackScheduled=!1;var e=this.getCurrentTime(),t=this;Object.keys(this.connectionsToPulse).forEach(function(n){var i=t.connectionsToPulse[n];e-i.timestamp>100&&(t.connectionsToPulseChanged=!0,delete t.connectionsToPulse[n])}),this.connectionsToPulseChanged&&(this.connectionsToPulseChanged=!1,this.editorConnection.sendPulsingConnections(this.connectionsToPulse)),Object.keys(this.connectionsToPulse).length>0&&(this.connectionPulsingCallbackScheduled=!0,setTimeout(this.clearOldConnectionPulsing.bind(this),500))},c.prototype._getDebugInspectorValueForNode=function(e){if(!this.rootComponent)return;const t=this.rootComponent.nodeScope.getNodesWithIdRecursive(e),n=t[t.length-1];if(n&&n.getInspectInfo){const t=n.getInspectInfo();if(void 0!==t)return{type:"node",id:e,value:t}}},c.prototype.sendDebugInspectorValues=function(){const e=[];for(const t in this.debugInspectors){const n=this.debugInspectors[t];if("connection"===n.type&&this._outputHistory.hasOwnProperty(t)){const n=this._outputHistory[t].value;e.push({type:"connection",id:t,value:this._formatConnectionValue(n)})}else if("node"===n.type){const n=this._getDebugInspectorValueForNode(t);n&&e.push(n)}}e.length>0&&this.editorConnection.sendDebugInspectorValues(e),this.connectionsToPulseChanged&&(this.connectionsToPulseChanged=!1,this.editorConnection.sendPulsingConnections(this.connectionsToPulse))},c.prototype.setDebugInspectorsEnabled=function(e){this.debugInspectorsEnabled=e,this.editorConnection.debugInspectorsEnabled=e,e&&this.sendDebugInspectorValues()},c.prototype.setTraceEnabled=function(e,t){this._traceOwners||(this._traceOwners=new Set);const n="string"==typeof t&&t.length>0?t:"(anonymous)",i=this._traceOwners.size>0;e?this._traceOwners.add(n):this._traceOwners.delete(n);const o=this._traceOwners.size>0;o!==i&&(this.traceEnabled=o,o?(this._traceBuffer=new a.TraceBuffer,this._currentCause=0,this.editorConnection&&this.editorConnection.sendTraceDictionary&&this.editorConnection.sendTraceDictionary(this.buildSessionDictionary())):(this._traceBuffer=void 0,this._currentCause=0))},c.prototype.releaseTraceOwner=function(e){"string"==typeof e&&0!==e.length&&this.setTraceEnabled(!1,e)},c.prototype.getTraceState=function(){return{enabled:!!this.traceEnabled,owners:this._traceOwners?Array.from(this._traceOwners):[],highestSeq:this._traceBuffer?this._traceBuffer.peekNextSeq()-1:0}},c.prototype.traceEdgeSend=function(e,t,n,i,o,r){return this.traceEnabled&&this._traceBuffer?this._traceBuffer.push(this.getCurrentTime(),this._currentCause,e,t,n,i,(0,a.previewValue)(o,this._traceValueCap),r):0},c.prototype.buildSessionDictionary=function(){const e={nodes:{},edges:[]};if(!this.rootComponent)return e;const t=this.rootComponent.nodeScope.getAllNodesRecursive();for(const n of t){let t="";try{t=n.nodeScope&&n.nodeScope.componentOwner&&n.nodeScope.componentOwner.name||""}catch(e){}if(e.nodes[n.id]={name:n.name||"",type:n.model&&n.model.type||n.name||"",component:t},n._outputList)for(const t of n._outputList)for(const i of t.connections)e.edges.push({from:{node:n.id,port:t.name},to:{node:i.node.id,port:i.inputPortName}})}return e},c.prototype.getPortValues=function(e){const t=[];if(!Array.isArray(e)||!this.rootComponent)return t;const n={};for(const e of this.rootComponent.nodeScope.getAllNodesRecursive())n[e.id]=e;for(const i of e){if(!i||"string"!=typeof i.node||"string"!=typeof i.port)continue;const e=n[i.node],o={node:i.node,port:i.port,direction:i.direction,exists:!1,value:void 0};if(e)try{"output"===i.direction?e.hasOutput(i.port)&&(o.exists=!0,o.value=(0,a.previewValue)(e.getOutput(i.port).value,this._traceValueCap)):e.hasInput(i.port)&&(o.exists=!0,o.value=(0,a.previewValue)(e.getInputValue(i.port),this._traceValueCap))}catch(e){o.value="<unreadable>"}t.push(o)}return t},c.prototype.evaluateBlockFragment=function(e,t,n){const i={requestId:e,nodeId:t,found:!1};if("string"!=typeof t||!this.rootComponent)return i;let o;for(const e of this.rootComponent.nodeScope.getAllNodesRecursive())if(e.id===t){o=e;break}if(!o||"function"!=typeof o._probeFragment)return i;i.found=!0;try{return Object.assign(i,o._probeFragment("string"==typeof n?n:""))}catch(e){return Object.assign(i,{ok:!1,errorPhase:"run",error:"The node could not evaluate this block: "+(e&&e.message?e.message:String(e))})}},c.prototype.hasNode=function(e){if("string"!=typeof e||!this.rootComponent)return!1;for(const t of this.rootComponent.nodeScope.getAllNodesRecursive())if(t.id===e)return!0;return!1},c.prototype.setBlockTracing=function(e,t){"string"==typeof e&&""!==e&&(this._blockTraceNodes||(this._blockTraceNodes=new Set),t?this._blockTraceNodes.add(e):this._blockTraceNodes.delete(e))},c.prototype.isBlockTracing=function(e){return!!this._blockTraceNodes&&this._blockTraceNodes.has(e)},c.prototype.beginBlockRun=function(e){if(this._blockTraceNodes&&this._blockTraceNodes.has(e))return(0,u.createBlockRunRecorder)(this._traceValueCap)},c.prototype.endBlockRun=function(e,t){if(!t)return;this._blockRunSeq=(this._blockRunSeq||0)+1;const n=this.platform?this.getCurrentTime():Date.now(),i=t.take(e,this._blockRunSeq,n);this.editorConnection&&"function"==typeof this.editorConnection.sendBlockValues&&this.editorConnection.sendBlockValues(i)},c.prototype.getTraceEvents=function(e){return this._traceBuffer?void 0===e?this._traceBuffer.toArray():this._traceBuffer.since(e):[]},c.prototype.clearTrace=function(){this._traceBuffer&&this._traceBuffer.clear(),this._currentCause=0},c.prototype.sendGlobalEventFromEventSender=function(e,t){this.eventSenderEmitter.emit(e,t)},c.prototype.setPopupCallbacks=function({onShow:e,onClose:t}){this.onShowPopup=e,this.onClosePopup=t},c.prototype._dismissOpenPopups=function(){const e=this.popupStack.slice();for(const t of e)t.dismiss()},c.prototype.cancelTopPopup=function(){let e;for(let t=this.popupStack.length-1;t>=0&&!e;t--)this.popupStack[t].modal&&(e=this.popupStack[t]);return!(!e||!e.closeOnEscape||!e.cancel||(e.cancel(),0))},c.prototype.showPopup=async function(e,t,n){var i;if(!this.onShowPopup)return;const o=this.rootComponent.nodeScope,r={group:void 0,dismissed:!1,closeOnEscape:!1!==(null==n?void 0:n.closeOnEscape),modal:!1!==(null==n?void 0:n.modal),dismiss:()=>{if(r.dismissed)return;r.dismissed=!0;const e=this.popupStack.indexOf(r);-1!==e&&this.popupStack.splice(e,1),r.group&&(this.onClosePopup(r.group),o.deleteNode(r.group)),n&&n.onDismissPopup&&n.onDismissPopup()}};let s;"replace"===(null!==(i=null==n?void 0:n.stackPolicy)&&void 0!==i?i:"replace")&&this._dismissOpenPopups(),this.popupStack.push(r);try{s=await o.createNode(e)}catch(e){if(r.dismissed)return"dismissed";r.dismissed=!0;const t=this.popupStack.indexOf(r);throw-1!==t&&this.popupStack.splice(t,1),e}if(r.dismissed)return o.deleteNode(s),"dismissed";for(const e in t)s.setInputValue(e,t[e]);s.popupParent=(null==n?void 0:n.senderNode)||null;const a=o.createPrimitiveNode("Group");a.setInputValue("flexDirection","node"),a.setInputValue("cssClassName","noodl-popup");const l=this.graphModel.getSettings().bodyScroll;a.setInputValue("position",l?"fixed":"absolute");const u=e=>{this.scheduleNextFrame(()=>{if(!o.hasNodeWithId(a.id))return;r.dismissed=!0;const t=this.popupStack.indexOf(r);-1!==t&&this.popupStack.splice(t,1),this.onClosePopup(a),o.deleteNode(a),e()})},c=(e,t)=>{u(()=>n&&n.onClosePopup&&n.onClosePopup(e,t))};r.cancel=()=>{u(()=>n&&n.onCancelPopup&&n.onCancelPopup())},s._popupCloseHandler=c;var d=s.nodeScope.getNodesWithType("NavigationClosePopup");if(d&&d.length>0)for(var p=0;p<d.length;p++)d[p]._setCloseCallback(c);r.group=a,this.onShowPopup(a,{accessibleName:(null==n?void 0:n.accessibleName)||void 0,modal:r.modal}),requestAnimationFrame(()=>{a.addChild(s)})},c.prototype.setWarningTypes=function(e){Object.assign(this.warningTypes,e)},c.prototype.isWarningTypeEnabled=function(e){return!this.warningTypes.hasOwnProperty(e)||!!this.warningTypes[e]},c.prototype.getDefaultValueForInput=function(e,t){if(!1===this.nodeRegister.hasNode(e))return;const n=this.nodeRegister.getNodeMetadata(e).inputs[t];return n?n.type.defaultUnit?{value:n.default,unit:n.type.defaultUnit}:n.default:void 0},e.exports=c},6569(e,t,n){"use strict";const i=n(7268),o=n(4830),r=n(5162),s=n(5838);function a(e,t,n){const i=e.registerInputIfNeeded;e.registerInputIfNeeded=function(o){if(i&&i.call(e,o),e.hasInput(o)||!o.startsWith(t))return;const r=Number(o.slice(t.length+1));e.registerInput(o,{type:n.type,set:n.createSetter.call(e,r)})}}function l(e,t){Object.keys(t).forEach(n=>{const i=t[n].default;if(void 0===i)return;const o=t[n].type;o.defaultUnit?e[n]={unit:o.defaultUnit,value:i}:e[n]=i})}function u(e){const t=[];return t.push(e.name?`node "${e.name}"`:"a definition"),e.module&&t.push(`in kit "${e.module}"`),` — ${t.join(" ")}`}function c(e,t){return e.module?` Add a \`${t}\` to its definition: without one NONE of this kit's nodes register, so every node from it is missing from the app. The rest of the app still runs.`:""}e.exports={defineNode:function(e){if(!e.category)throw new Error(`Node must have a category${u(e)}.${c(e,"category")}`);if(!e.name)throw new Error(`Node must have a name${u(e)}.${c(e,"name")}`);const t={inputs:{},outputs:{},category:e.category,dynamicports:e.dynamicports,exportDynamicPorts:e.exportDynamicPorts,useVariants:e.useVariants,allowChildren:e.allowChildren,allowChildrenWithCategory:e.allowChildrenWithCategory,singleton:e.singleton,connectionPanel:e.connectionPanel,allowAsChild:e.allowAsChild,visualStates:e.visualStates,panels:e.panels,color:e.color,usePortAsLabel:e.usePortAsLabel,portLabelTruncationMode:e.portLabelTruncationMode,name:e.name,displayNodeName:e.displayNodeName||e.displayName,deprecated:e.deprecated,replacedBy:e.replacedBy,haveComponentPorts:e.haveComponentPorts,wireDeclaredPortPrefix:e.wireDeclaredPortPrefix,version:e.version,module:e.module,docs:e.docs,docsUrl:e.docsUrl,allowAsExportRoot:e.allowAsExportRoot,nodeDoubleClickAction:e.nodeDoubleClickAction,searchTags:e.searchTags,ssr:e.ssr};if(e._internal=e._internal||{},e.prototypeExtensions=e.methods||e.prototypeExtensions||{},e.inputs=e.inputs||{},e.outputs=e.outputs||{},e.initialize=e.initialize||function(){},e.runOnValueChange){const t=[],n={};(e.runOnValueChange.inputs||[]).forEach(function(i){const o=e.inputs[i];if(!o)throw new Error("Node "+e.name+" declares runOnValueChange for input "+i+", which it does not have");t.push(i),o.displayName&&(n[i]=o.displayName)}),(e.runOnValueChange.sources||[]).forEach(function(e){t.push(e.name),n[e.name]=e.displayName}),Object.assign(e.inputs,(0,s.runOnChangeInputs)(t,n))}(0,r.narrowCompletedDescription)(e.outputs);let n={};function d(e,t){i.call(this,e,t)}(function(e,t,n){Object.keys(n).forEach(function(i){!function(e,t,n,i){if(e.hasOwnProperty(n))throw new Error("Input property "+n+" already registered");if(i.set||i.valueChangedToTrue||(i.set=()=>{}),i.set&&(e[n]={set:i.set},["color","textStyle","array","object","string"].forEach(t=>{!i.type||i.type!==t&&i.type.name!==t||(e[n].type=t)})),i.setUnitType&&(e[n].setUnitType=i.setUnitType),e[n]&&i.type&&Array.isArray(i.type.units)){e[n].hasUnits=!0;const t=i.type;e[n].defaultUnit=t.defaultUnit||t.units[0]}t.inputs[n]={displayName:i.displayName,editorName:i.editorName,group:i.group,type:i.type,default:i.default,index:i.index,exportToEditor:!i.hasOwnProperty("exportToEditor")||i.exportToEditor,inputPriority:i.inputPriority||0,tooltip:i.tooltip,description:i.description,placeholder:i.placeholder,tab:i.tab,popout:i.popout,allowVisualStates:i.allowVisualStates,nodeDoubleClickAction:i.nodeDoubleClickAction},i.valueChangedToTrue&&(t.inputs[n].type={name:"signal",allowConnectionsOnly:!0})}(e,t,i,n[i])})})(n,t,e.inputs),function(e,t){Object.keys(t).forEach(function(n){var i=t[n];e.outputs[n]={displayName:i.displayName,editorName:i.editorName,group:i.group,type:i.type,index:i.index,exportToEditor:!i.hasOwnProperty("exportToEditor")||i.exportToEditor,description:i.description}})}(t,e.outputs);const p=e.prototypeExtensions,h={};Object.keys(p).forEach(function(e){const t=p[e];if("function"==typeof t)return Object.prototype.hasOwnProperty.call(t,"value")||Object.defineProperty(t,"value",{value:t,configurable:!0}),void(h[e]={value:t,writable:!0,configurable:!0});t.value?h[e]={...t,writable:!t.hasOwnProperty("writable")||t.writable,configurable:!t.hasOwnProperty("configurable")||t.configurable}:h[e]={value:p[e],writable:!0,configurable:!0}}),d.prototype=Object.create(i.prototype,h),Object.defineProperty(d.prototype,"name",{value:e.name}),e.getInspectInfo&&(d.prototype.getInspectInfo=e.getInspectInfo),e.nodeScopeDidInitialize&&(d.prototype.nodeScopeDidInitialize=e.nodeScopeDidInitialize);const f=d.prototype.registerInputIfNeeded;Object.defineProperty(d.prototype,"registerInputIfNeeded",{value:function(e){const t=(0,s.inputNameForRunOnChangePort)(e);void 0===t?f.call(this,e):this.registerRunOnValueChangeInput(t)},writable:!0,configurable:!0});const g=function(i,r,s){const u=new d(i,r);return t.ssr&&"client-only"===t.ssr.compat&&function(e){const t=e&&e.platform;return!(!t||"function"!=typeof t.isSSRServer||!t.isSSRServer())}(i)?(function(e,t,n,i){const o=()=>{};e._inputs={},Object.keys(n.inputs).forEach(function(t){e._inputs[t]={set:o,type:i[t]&&i[t].type}}),Object.keys(n.outputs).forEach(function(t){const i=n.outputs[t];e.registerOutput(t,{type:i.type,getter:()=>{}})}),e.registerInputIfNeeded=function(t){e.hasInput(t)||e.registerInput(t,{set:o})},e.nodeScopeDidInitialize&&(e.nodeScopeDidInitialize=o),e._ssrDeferred=!0;const r=t,s=r._ssrDeferredNodeTypes=r._ssrDeferredNodeTypes||new Set;s.has(n.name)||(s.add(n.name),console.warn(`SSR: node type "${n.name}" is client-only; instances render default values server-side and run in the browser after hydration.`))}(u,i,e,n),u.nodeScope=s,l(u._inputValues,t.inputs),u):(u._inputs=Object.create(n),Object.keys(e.inputs).forEach(function(t){var n=e.inputs[t];n.valueChangedToTrue&&(u._inputs[t]={set:o.createSetter({valueChangedToTrue:n.valueChangedToTrue})})}),Object.keys(e.outputs).forEach(function(t){var n=e.outputs[t];"signal"===n.type?u.registerOutput(t,{getter:function(){}}):u.registerOutput(t,n)}),e.numberedInputs&&function(e,t){for(const n of Object.keys(t))a(e,n,t[n])}(u,e.numberedInputs),u.nodeScope=s,l(u._inputValues,t.inputs),e.initialize.call(u),u)};return g.metadata=t,e.numberedInputs&&function(e,t,n){const i=Object.keys(n);i.length&&(e.setupNumberedInputDynamicPorts=function(e,o){const r=e.editorConnection;function s(e){const t=i.map(t=>function(e,t,n){const i=e.component.getConnectionsTo(e.id).map(e=>e.targetPort),o=Object.keys(e.parameters).concat(i).filter(e=>e.startsWith(t+" ")),r=(o.length?1+Math.max(...o.map(e=>Number(e.slice(t.length+1)))):0)+1,s=[];for(let e=0;e<r;e++){const i={name:t+" "+e,displayName:(n.displayPrefix||t)+" "+e,type:n.type,plug:"input",group:n.group};n.hasOwnProperty("index")&&(i.index=n.index+e),s.push(i)}return s}(e,t,n[t])).flat();r.sendDynamicPorts(e.id,t)}r&&r.isRunningLocally()&&o.on("nodeAdded."+t,e=>{s(e),e.on("parameterUpdated",()=>{s(e)}),e.on("inputConnectionAdded",()=>{s(e)}),e.on("inputConnectionRemoved",()=>{s(e)})})})}(g,e.name,e.numberedInputs),g},extend:function e(t,n){for(var i in n)if("initialize"===i&&t.initialize){var o=t.initialize;t.initialize=function(){o.call(this),n.initialize.call(this)}}else n[i]&&n[i].constructor===Object?t[i]=e(t[i]||{},n[i]):n[i]&&n[i].constructor===Array&&t[i]&&t[i].constructor==Array?t[i]=t[i].concat(n[i]):t[i]=n[i];return t}}},8503(e,t,n){"use strict";const i=n(280);function o(e,t,n){const i={name:e,type:t.type,plug:n};return t.group&&(i.group=t.group),t.displayName&&(i.displayName=t.displayName),t.description&&(i.description=t.description),t.editorName&&(i.editorName=t.editorName),void 0!==t.default&&(i.default=t.default),t.hasOwnProperty("index")&&(i.index=t.index),t.tooltip&&(i.tooltip=t.tooltip),t.placeholder&&(i.placeholder=t.placeholder),t.tab&&(i.tab=t.tab),t.popout&&(i.popout=t.popout),t.allowVisualStates&&(i.allowVisualStates=t.allowVisualStates),i}e.exports=function(e,t){const n="cloud"===(null==t?void 0:t.runtimeType),r={typecasts:i.TYPECASTS.map(e=>({from:e.from,to:[...e.to]})),dynamicports:[{type:"conditionalports",name:"basic"},{type:"expand",name:"basic"}],colors:{nodes:{component:{base:"#3c3d5a",baseHighlighted:"#4c4872",header:"#33324f",headerHighlighted:"#3c3d5a",outline:"#33324f",outlineHighlighted:"#a78bfa",text:"#EEF2F6"},visual:{base:"#2d435b",baseHighlighted:"#345274",header:"#243850",headerHighlighted:"#2d435b",outline:"#243850",outlineHighlighted:"#5ca9ff",text:"#EEF2F6"},data:{base:"#284a44",baseHighlighted:"#2d5e4e",header:"#1f4038",headerHighlighted:"#284a44",outline:"#1f4038",outlineHighlighted:"#45d08a",text:"#EEF2F6"},javascript:{base:"#4c384f",baseHighlighted:"#654261",header:"#432e44",headerHighlighted:"#4c384f",outline:"#432e44",outlineHighlighted:"#f776c4",text:"#EEF2F6"},default:{base:"#333c46",baseHighlighted:"#3e4853",header:"#2b323b",headerHighlighted:"#333c46",outline:"#2b323b",outlineHighlighted:"#7d8a98",text:"#EEF2F6"}},connections:{signal:{normal:"#35c3e8",highlighted:"#7ad8f0",pulsing:"#ffffff"},default:{normal:"#45d08a",highlighted:"#7de0ac",pulsing:"#ffffff"}}},nodetypes:n?[]:[{name:"Component Children",docs:"https://docs.noodl.net/nodes/component-utilities/component-children",color:"component",allowAsChild:!0,category:"Visual",haveComponentChildren:["Visual"]}],nodeIndex:void 0},s=Object.keys(e._constructors);s.forEach(function(t){const n=e._constructors[t].metadata,i={name:t,searchTags:n.searchTags};r.nodetypes.push(i),n.version&&(i.version=n.version),n.displayNodeName&&(i.displayNodeName=n.displayNodeName),n.nodeDoubleClickAction&&(i.nodeDoubleClickAction=n.nodeDoubleClickAction),n.module&&(i.module=n.module),n.deprecated&&(i.deprecated=!0),"string"==typeof n.replacedBy&&(i.replacedBy=n.replacedBy),n.haveComponentPorts&&(i.haveComponentPorts=!0),n.wireDeclaredPortPrefix&&(i.wireDeclaredPortPrefix=n.wireDeclaredPortPrefix),"Visual"===n.category&&(i.allowAsChild=!0,i.allowAsExportRoot=!0,i.color="visual"),void 0!==n.allowAsExportRoot&&(i.allowAsExportRoot=n.allowAsExportRoot),n.allowChildren&&(i.allowChildrenWithCategory=["Visual"],i.color="visual"),n.allowChildrenWithCategory&&(i.allowChildrenWithCategory=n.allowChildrenWithCategory),n.singleton&&(i.singleton=!0),n.allowAsChild&&(i.allowAsChild=!0),n.docs&&(i.docs=n.docs),n.docsUrl&&(i.docsUrl=n.docsUrl),n.shortDocs?i.shortDocs=n.shortDocs:n.docs&&0===n.docs.indexOf("https://docs.noodl.net")&&(i.shortDocs=n.docs.replace("/#","")+"-short.md"),i.category=n.category,n.panels&&(i.panels=n.panels),n.usePortAsLabel&&(i.usePortAsLabel=n.usePortAsLabel,i.portLabelTruncationMode=n.portLabelTruncationMode),n.color&&(i.color=n.color),n.dynamicports&&(i.dynamicports=function(e){const t=[];for(const n of e.dynamicports)if(n.ports||n.template||n.port||n.channelPort)t.push(n);else if(n.inputs||n.outputs){const i=[];if(n.inputs)for(const t of n.inputs)i.push(o(t,e.inputs[t],"input"));if(n.outputs)for(const t of n.outputs)i.push(o(t,e.outputs[t],"output"));const r={name:n.name||"conditionalports/basic",condition:n.condition,ports:i};t.push(r)}return t}(n)),n.exportDynamicPorts&&(i.exportDynamicPorts=n.exportDynamicPorts),n.visualStates&&(i.visualStates=n.visualStates),n.useVariants&&(i.useVariants=n.useVariants),n.connectionPanel&&(i.connectionPanel=n.connectionPanel),i.ports=[];const s=i.dynamicports||[],a={},l={};s.filter(e=>void 0!==e.channelPort).forEach(e=>{l[e.channelPort.plug+"/"+e.channelPort.name]=!0}),s.length&&(i.dynamicports=s),Object.keys(n.inputs).forEach(function(e){if(a.hasOwnProperty("input/"+e)||l.hasOwnProperty("input/"+e))return;const t=n.inputs[e];!1!==t.exportToEditor&&i.ports.push(o(e,t,"input"))}),Object.keys(n.outputs).forEach(function(e){var t,r;a.hasOwnProperty("output/"+e)||l.hasOwnProperty("output/"+e)||(t=e,r=n.outputs[e],i.ports.push(o(t,r,"output")))})}),r.nodeIndex={coreNodes:[{name:"UI Elements",description:"Buttons, inputs, containers, media",type:"visual",subCategories:[{name:"Basic Elements",items:["Group","net.noodl.visual.columns","Text","Image","Video","Circle","net.noodl.visual.icon"]},{name:"UI Controls",items:["net.noodl.controls.button","net.noodl.controls.checkbox","net.noodl.controls.options","net.noodl.controls.radiobutton","Radio Button Group","net.noodl.controls.range","net.noodl.controls.textinput"]}]},{name:"Navigation & Popups",description:"Page routing, navigation, popups",type:"logic",subCategories:[{name:"Navigation",items:["Router","RouterNavigate","PageInputs","net.noodl.externallink","PageStackNavigateToPath"]},{name:"Component Stack",items:["Page Stack","PageStackNavigate","PageStackNavigateBack"]},{name:"Popups",items:["NavigationShowPopup","NavigationClosePopup"]}]},{name:"Logic & Utilities",description:"Logic, events, string manipulation",type:"logic",subCategories:[{name:"General Utils",items:["States","Value Changed","Timer","Repeat","Color Blend","Number Remapper","Counter","Drag","net.noodl.animatetovalue"]},{name:"Conditions & Booleans",items:["Boolean To String","Switch","And","Or","Condition","Inverter"]},{name:"Events",items:["Event Sender","Event Receiver"]},{name:"String Manipulation",items:["Substring","String Mapper","String Format","Date To String","Unique Id"]},{name:"Crypto",items:["net.noodl.Hash","net.noodl.RandomBytes","net.noodl.UUID"]},{name:"Date & Time",items:["net.noodl.Now","net.noodl.DateAdd","net.noodl.DateDifference","net.noodl.DateCompare","net.noodl.DateParts"]},{name:"System",items:["Screen Resolution","Open File Picker","On App Error","net.noodl.Log"]},{name:"Variables",items:["String","Boolean","Color","Number"]}]},{name:"Component Utilities",description:"Component inputs, outputs & object",type:"component",subCategories:[{name:"",items:["Component Inputs","Component Outputs","Component Children","net.noodl.ComponentObject","net.noodl.ParentComponentObject","net.noodl.SetComponentObjectProperties","net.noodl.SetParentComponentObjectProperties"]}]},{name:"Read & Write Data",description:"Arrays, objects, cloud data",type:"data",subCategories:[{name:"",items:["RunTasks","For Each","For Each Actions","Model2","SetModelProperties","NewModel","Set Variable","Variable2"]},{name:"Array",items:["Collection2","CollectionNew","CollectionRemove","CollectionClear","CollectionInsert","Filter Collection","Map Collection","Static Data","net.noodl.ParseCSV","net.noodl.ToCSV","net.noodl.ParseXML","net.noodl.ParseFeed"]},{name:"Cloud Data",items:["DbModel2","NewDbModelProperties","FilterDBModels","SetDbModelProperties","DbCollection2","SubscribeToChanges","DeleteDbModelProperties","AddDbModelRelation","RemoveDbModelRelation","Cloud File","Upload File","Sign File URL","CloudFunction2"]},{name:"User",items:["net.noodl.user.LogIn","net.noodl.user.LogOut","net.noodl.user.SignUp","net.noodl.user.User","net.noodl.user.SetUserProperties","net.noodl.user.VerifyEmail","net.noodl.user.SendEmailVerification","net.noodl.user.ResetPassword","net.noodl.user.RequestPasswordReset","net.noodl.user.RequestMagicLink","net.noodl.user.SignInWith"]},{name:"External Data",items:["net.noodl.HTTP","REST2"]},{name:"Streaming",items:["net.noodl.SSE","net.noodl.WebSocket","net.noodl.TextAccumulator","net.noodl.JSONStreamParser","net.noodl.PatternExtractor","net.noodl.StreamBuffer"]},{name:"App State",items:["net.noodl.GlobalStore","net.noodl.GlobalStore.Set","net.noodl.GlobalStore.Subscribe","net.noodl.OptimisticUpdate","net.noodl.StateHistory","net.noodl.StateHistory.Undo","net.noodl.StateSnapshot"]},{name:"Agent Actions",items:["net.noodl.ActionDispatcher","net.noodl.ActionHandler"]}]},{name:"Logic",description:"Three ways to compute — pick by how much you want to type",type:"javascript",subCategories:[{name:"",items:["Expression","Logic Builder","JavaScriptFunction","Javascript2","CSS Definition"]}]},{name:"Cloud Functions",description:"Nodes to be used in cloud functions",type:"data",subCategories:[{name:"",items:["noodl.cloud.request","noodl.cloud.response"]},{name:"Cloud Data",items:["noodl.cloud.aggregate"]},{name:"Email",items:["noodl.cloud.sendemail"]},{name:"Secrets",items:["noodl.cloud.secret"]},{name:"AI",items:["noodl.cloud.modelrequest"]},{name:"Security",items:["noodl.cloud.hmac","noodl.cloud.jwtsign","noodl.cloud.jwtverify"]},{name:"Users",items:["noodl.cloud.createuser","noodl.cloud.updateuser","noodl.cloud.deleteuser","noodl.cloud.verifysessiontoken"]},{name:"Roles",items:["noodl.cloud.addusertorole","noodl.cloud.removeuserfromrole","noodl.cloud.getuserroles","noodl.cloud.listusersinrole"]}]}]};const a=new Map;return s.forEach(t=>{const n=e._constructors[t].metadata;if(n.module){const e=String(n.module),i=a.get(e);i?i.push(t):a.set(e,[t])}}),a.size&&(r.nodeIndex.moduleNodes=Array.from(a.entries()).sort(([e],[t])=>e<t?-1:e>t?1:0).map(([e,t])=>({name:e,items:t}))),r}},8153(e){"use strict";const t=function(e){this._constructors={},this.context=e};t.prototype.register=function(e){var t=e.metadata.name;this._constructors[t]=e},t.prototype.peek=function(e){return this._constructors[e]},t.prototype.restore=function(e,t){void 0===t?delete this._constructors[e]:this._constructors[e]=t},t.prototype.createNode=function(e,t,n){if(!1===this._constructors.hasOwnProperty(e))throw new Error("Unknown node type with name "+e);return this._constructors[e](this.context,t,n)},t.prototype.getNodeMetadata=function(e){if(!1===this._constructors.hasOwnProperty(e))throw new Error("Unknown node type with name "+e);return this._constructors[e].metadata},t.prototype.hasNode=function(e){return this._constructors.hasOwnProperty(e)},t.prototype.getInputType=function(e,t){const n=this.getNodeMetadata(e);return n.inputs[t]&&n.inputs[t].type},e.exports=t},7438(e){"use strict";const t={node:{name:"Component Inputs",docs:"https://docs.noodl.net/nodes/component-utilities/component-inputs",panels:[{name:"PortEditor",context:["select","connectFrom"],title:"Inputs",plug:"output",type:{name:"*"},canArrangeInGroups:!0},{name:"PropertyEditor",hidden:!0}],getInspectInfo(){return{type:"value",value:this.nodeScope.componentOwner._internal.inputValues}},color:"component",haveComponentPorts:!0,category:"Component Utilities",methods:{registerOutputIfNeeded:function(e){this.hasOutput(e)||this.registerOutput(e,{getter:function(){return this.nodeScope.componentOwner._internal.inputValues[e]}})},_updateDependencies:function(){this.nodeScope.componentOwner.update()}}}};e.exports=t},8204(e,t,n){"use strict";const i=n(7268),o=n(9850);let r=0;const s=function(e,t,n){i.call(this,e,t),this.nodeScope=new o(e,this),this.parentNodeScope=n,this._internal.childRoot=null,this._internal.componentOutputValues={},this._internal.componentOutputs=[],this._internal.componentInputs=[],this._internal.inputValues={},this._internal.roots=[],this._internal.instanceId="__$ndl_componentInstaceId"+r,this.nodeScope.modelScope=n?n.modelScope:void 0,this.nodeScope.runContext=n?n.runContext:void 0,r++};(s.prototype=Object.create(i.prototype,{setComponentModel:{value:async function(e){this.componentModel=e;const t=this;await this.nodeScope.setComponentModel(e),this._internal.componentInputs=this.nodeScope.getNodesWithType("Component Inputs"),this._internal.componentOutputs=this.nodeScope.getNodesWithType("Component Outputs"),Object.values(e.getInputPorts()).forEach(this.registerComponentInputPort.bind(this)),Object.values(e.getOutputPorts()).forEach(this.registerComponentOutputPort.bind(this));const n=e.roots||[];this._internal.roots=n.map(e=>this.nodeScope.getNodeWithId(e)),e.on("rootAdded",e=>{this._internal.roots.push(this.nodeScope.getNodeWithId(e)),this.forceUpdate()},this),e.on("rootRemoved",function(e){const t=this._internal.roots.findIndex(t=>t.id===e);-1!==t&&this._internal.roots.splice(t,1),this.forceUpdate()},this),e.on("inputPortAdded",this.registerComponentInputPort.bind(this),this),e.on("outputPortAdded",this.registerComponentOutputPort.bind(this),this),e.on("inputPortRemoved",function(e){t.hasInput(e.name)&&t.deregisterInput(e.name)},this),e.on("outputPortRemoved",function(e){this.hasOutput(e.name)&&t.deregisterOutput(e.name)},this),e.on("nodeAdded",function(e){"Component Inputs"===e.type?t._internal.componentInputs.push(t.nodeScope.getNodeWithId(e.id)):"Component Outputs"===e.type&&t._internal.componentOutputs.push(t.nodeScope.getNodeWithId(e.id))},this),e.on("nodeRemoved",function(e){function n(e,t){return e.filter(e=>e.id!==t)}"Component Inputs"===e.type?t._internal.componentInputs=n(t._internal.componentInputs,e.id):"Component Outputs"===e.type&&(t._internal.componentOutputs=n(t._internal.componentOutputs,e.id))},this),e.on("renamed",function(e){t.name=e.newName},this)}},_onNodeDeleted:{value:function(){this.componentModel&&(this.componentModel.removeListenersWithRef(this),this.componentModel=void 0),this.nodeScope.reset(),i.prototype._onNodeDeleted.call(this)}},registerComponentInputPort:{value:function(e){const t=this;this.registerInput(e.name,{set:function(n){t._internal.inputValues[e.name]=n,t._internal.componentInputs.forEach(function(t){t.registerOutputIfNeeded(e.name),t.flagOutputDirty(e.name)})}})}},registerComponentOutputPort:{value:function(e){const t=this;this.registerOutput(e.name,{getter:function(){return t._internal.componentOutputValues[e.name]}})}},setOutputFromComponentOutput:{value:function(e,t){!1!==this.hasOutput(e)&&(this._internal.creatorCallbacks&&this._internal.creatorCallbacks.onOutputChanged&&this._internal.creatorCallbacks.onOutputChanged(e,t,this._internal.componentOutputValues[e]),this._internal.componentOutputValues[e]=t,this.flagOutputDirty(e))}},setChildRoot:{value:function(e){const t=this._internal.childRoot,n=e;if(this._internal.childRoot=n,this.model&&this.model.children){const e=this.parentNodeScope,i=this.model.children.filter(e=>"Component Children"!==e.type).map(t=>e.getNodeWithId(t.id));if(t)for(let e=0;e<i.length;e++)t.isChild(i[e])&&t.removeChild(i[e]);if(n)for(let e=0;e<i.length;e++){const t=i[e],n=t.model.parent.children.indexOf(t.model);this.addChild(t,n)}}}},getChildRootIndex:{value:function(){if(!this._internal.childRoot||!this._internal.childRoot.model||!this._internal.childRoot.model.children)return 0;const e=this._internal.childRoot.model.children;for(let t=0;t<e.length;t++)if("Component Children"===e[t].type)return t;return 0}},getChildRoot:{value:function(){return this._internal.childRoot?this._internal.childRoot:null}},getRoots:{value:function(){return this._internal.roots}},triggerDidMount:{value:function(){this._internal.roots.forEach(e=>{e.triggerDidMount&&e.triggerDidMount()})}},render:{value:function(){return 0===this._internal.roots.length?null:this._internal.roots[0].render()}},setChildIndex:{value:function(e){this.getRoots().forEach(t=>t.setChildIndex&&t.setChildIndex(e))}},addChild:{value:function(e,t){this.getChildRoot().addChild(e,t+this.getChildRootIndex())}},removeChild:{value:function(e){this.getChildRoot().removeChild(e)}},getChildren:{value:function(){const e=this.getChildRoot();return e?e.getChildren():[]}},isChild:{value:function(e){return!!this.getChildRoot()&&this.getChildRoot().isChild(e)}},contains:{value:function(e){return this.getRoots().some(t=>t.contains&&t.contains(e))}},_performDirtyUpdate:{value:function(){i.prototype._performDirtyUpdate.call(this);const e=this._internal.componentInputs;for(let t=0,n=e.length;t<n;t++)e[t].flagDirty();this._internal.componentOutputs.forEach(function(e){e.flagDirty()})}},getRef:{value:function(){const e=this._internal.roots[0];return e?e.getRef():void 0}},update:{value:function(){i.prototype.update.call(this),this._internal.componentOutputs.forEach(function(e){e.update()})}},forceUpdate:{value:function(){this.parent&&(this.parent.cachedChildren=void 0,this.parent.forceUpdate())}},getInstanceId:{value(){return this._internal.instanceId}}})).constructor=s,e.exports=s},1609(e){"use strict";e.exports={node:{category:"Component Utilities",name:"Component Outputs",docs:"https://docs.noodl.net/nodes/component-utilities/component-outputs",panels:[{name:"PortEditor",context:["select","connectTo"],title:"Outputs",plug:"input",type:{name:"*"},canArrangeInGroups:!0},{name:"PropertyEditor",hidden:!0}],color:"component",haveComponentPorts:!0,prototypeExtensions:{registerInputIfNeeded:function(e){this.hasInput(e)||this.registerInput(e,{set:function(t){this.nodeScope.componentOwner.setOutputFromComponentOutput(e,t)}})}}}}},9038(e,t,n){"use strict";t.ActionDispatcher=t.actionRegistry=t.BUILT_IN_ACTIONS=void 0,t.parseList=function(e){return e?String(e).split(",").map(e=>e.trim()).filter(e=>e.length>0):[]};const i=n(6086);t.BUILT_IN_ACTIONS=["SET_STORE","MERGE_STORE","DELETE_STORE_KEY","CLEAR_STORE"];const o=new Set(t.BUILT_IN_ACTIONS);function r(e){return o.has(e)}function s(e){return null==e||""===e?"default":String(e)}function a(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function l(e){return"payload"in e?e.payload:"data"in e?e.data:e}function u(e,t){if(t in e)return e[t];const n=l(e);return n!==e&&a(n)&&t in n?n[t]:void 0}t.actionRegistry=new class{constructor(){this.channels=new Map}ensure(e){const t=s(e);let n=this.channels.get(t);return n||(n={handlers:new Map,listeners:[]},this.channels.set(t,n)),n}register(e,t,n){if("string"!=typeof t||""===t)throw new Error("Action Handler: an action type is required");if(r(t))throw new Error(`Action Handler: "${t}" is a reserved built-in action name`);const i=this.ensure(e),o=i.handlers.get(t)||[];o.push(n),i.handlers.set(t,o);for(const e of i.listeners.slice())try{e(t)}catch(e){console.error("[ActionRegistry] registration listener threw:",e)}let a=!1;return()=>{if(a)return;a=!0;const o=i.handlers.get(t);if(!o)return;const r=o.indexOf(n);-1!==r&&o.splice(r,1),0===o.length&&i.handlers.delete(t),this.prune(s(e))}}getHandlers(e,t){const n=this.channels.get(s(e));return n&&n.handlers.get(t)||[]}has(e,t){return this.getHandlers(e,t).length>0}registeredTypes(e){const t=this.channels.get(s(e));return t?Array.from(t.handlers.keys()).sort():[]}onRegister(e,t){const n=this.ensure(e);n.listeners.push(t);let i=!1;return()=>{if(i)return;i=!0;const o=n.listeners.indexOf(t);-1!==o&&n.listeners.splice(o,1),this.prune(s(e))}}handlerCount(e,t){const n=this.channels.get(s(e));if(!n)return 0;if(void 0!==t)return(n.handlers.get(t)||[]).length;let i=0;for(const e of n.handlers.values())i+=e.length;return i}channelNames(){return Array.from(this.channels.keys())}reset(){this.channels.clear()}prune(e){const t=this.channels.get(e);t&&0===t.handlers.size&&0===t.listeners.length&&this.channels.delete(e)}};let c=0;t.ActionDispatcher=class{constructor(e,n={},o={}){this.options=e,this.hooks=n,this.queue=[],this.current=null,this.pumping=!1,this.disposed=!1,this.waiting=!1,this.workSinceIdle=!1,this.idleEmitted=!0,this.recentTimes=[],this.registry=o.registry||t.actionRegistry,this.store=o.store||i.globalStoreManager,this.setTimeoutImpl=o.setTimeoutImpl||((e,t)=>setTimeout(e,t)),this.clearTimeoutImpl=o.clearTimeoutImpl||(e=>clearTimeout(e)),this.nowImpl=o.nowImpl||(()=>Date.now())}get queueSize(){return this.queue.length}get isExecuting(){return null!==this.current&&this.current.started}get waitingFor(){return this.waiting&&this.current?this.current.action.type:""}get isDisposed(){return this.disposed}dispatch(e){if(this.disposed)return!1;const t=this.coerce(e);if("error"in t)return this.refuse(e,"","invalid",t.error),!1;const n=[];for(const e of t.actions){if(!a(e)){this.refuse(e,"","invalid",'an action must be an object with a "type"');continue}const t=e.type;if("string"!=typeof t||""===t){this.refuse(e,"","invalid",'an action must have a non-empty string "type"');continue}const i=this.options.maxQueueSize;if(i>0&&this.queue.length>=i){this.refuse(e,t,"queue-full",`the queue is full (${i}); this action was not accepted`);continue}const o=e;this.queue.push({id:"string"==typeof o.id&&o.id?o.id:"action_"+ ++c,action:o,payload:l(o),handlers:[],index:0,lastResult:void 0,timer:null,waitTimer:null,unlisten:null,inInvoke:!1,token:null,started:!1,refused:!1}),n.push(this.queue[this.queue.length-1])}return n.length>0&&this.notifyQueue(),this.pump(),n.some(e=>!e.refused)}cancelAll(){const e=this.queue.length+(this.current?1:0);for(const e of this.queue)this.clearEntryTimers(e);return this.queue.length=0,this.current&&(this.clearEntryTimers(this.current),this.current=null),this.waiting=!1,e>0&&this.notifyQueue(),e}dispose(){if(this.disposed)return 0;const e=this.queue.length+(this.current?1:0);for(const e of this.queue)this.clearEntryTimers(e);return this.queue.length=0,this.current&&(this.clearEntryTimers(this.current),this.current=null),this.waiting=!1,this.disposed=!0,e}pump(){if(!this.pumping&&!this.disposed){this.pumping=!0;try{for(;!this.current&&this.queue.length>0&&!this.disposed;){const e=this.queue.shift();if(this.notifyQueue(),!this.allowRate()){this.refuseEntry(e,"rate-limited",`rate limit of ${this.options.rateLimit} actions exceeded`);continue}const t=e.action.type;if(r(t)){const t=this.checkBuiltIn(e.action);if(t){this.refuseEntry(e,t.reason,t.message);continue}this.current=e,this.runBuiltIn(e);continue}const n=this.registry.getHandlers(this.options.channel,t);if(0===n.length){const n=this.options.waitForHandler;if(n>0){this.current=e,this.park(e,n);break}this.refuseEntry(e,"unknown",`no handler is registered for "${t}"`);continue}this.startExecution(e,n)}}finally{this.pumping=!1}this.maybeIdle()}}park(e,t){this.waiting=!0,this.notifyQueue(),e.unlisten=this.registry.onRegister(this.options.channel,t=>{t===e.action.type&&this.current===e&&(this.unpark(e),this.startExecution(e,this.registry.getHandlers(this.options.channel,t)),this.pump())}),e.waitTimer=this.setTimeoutImpl(()=>{e.waitTimer=null,this.current===e&&(this.unpark(e),this.current=null,this.refuseEntry(e,"unknown",`no handler is registered for "${e.action.type}"`),this.pump())},t)}unpark(e){this.waiting&&(this.waiting=!1,this.notifyQueue()),e.unlisten&&(e.unlisten(),e.unlisten=null),null!==e.waitTimer&&(this.clearTimeoutImpl(e.waitTimer),e.waitTimer=null)}startExecution(e,t){e.handlers=t.slice(),e.index=0,e.started=!0,this.current=e,this.workSinceIdle=!0,this.idleEmitted=!1,this.notifyQueue(),this.emit("onDispatched",this.infoOf(e)),this.runNextHandler(e)}runNextHandler(e){for(;;){if(this.current!==e||this.disposed)return;if(e.index>=e.handlers.length)return void this.settle(e,!0,e.lastResult);const t=e.handlers[e.index],n={done:!1,sync:!1};e.token=n;const i={actionId:e.id,actionType:e.action.type,action:e.action,payload:e.payload,complete:t=>{n.done||this.current!==e||(n.done=!0,this.clearHandlerTimer(e),void 0!==t&&(e.lastResult=t),e.index++,e.inInvoke?n.sync=!0:this.runNextHandler(e))},fail:t=>{n.done||this.current!==e||(n.done=!0,this.clearHandlerTimer(e),this.settle(e,!1,String(t||"the handler reported a failure")))}},o=this.options.handlerTimeout;o>0&&(e.timer=this.setTimeoutImpl(()=>{e.timer=null,n.done||this.current!==e||(n.done=!0,this.settle(e,!1,`the handler for "${e.action.type}" did not complete within ${o}ms`))},o)),e.inInvoke=!0;try{t.invoke(i)}catch(t){return e.inInvoke=!1,void(n.done||(n.done=!0,this.clearHandlerTimer(e),this.settle(e,!1,String((null==t?void 0:t.message)||t))))}if(e.inInvoke=!1,!n.sync)return}}settle(e,t,n){this.current===e&&(this.clearEntryTimers(e),this.current=null,this.notifyQueue(),t?this.emit("onCompleted",Object.assign(this.infoOf(e),{result:n})):this.emit("onFailed",Object.assign(this.infoOf(e),{error:String(n)})),this.pump())}checkBuiltIn(e){const t=e.type;if(-1===this.options.builtIns.indexOf(t))return{reason:"not-allowed",message:`"${t}" is a built-in action but this dispatcher does not have it enabled`};const n=this.options.allowedKeys;if("SET_STORE"===t||"DELETE_STORE_KEY"===t){const i=u(e,"key");return"string"!=typeof i||""===i?{reason:"invalid",message:`${t} requires a non-empty string "key"`}:n.length>0&&-1===n.indexOf(i)?{reason:"not-allowed",message:`the key "${i}" is not in this dispatcher's allowed keys`}:null}if("MERGE_STORE"===t){const t=u(e,"values");if(!a(t))return{reason:"invalid",message:'MERGE_STORE requires a "values" object'};if(n.length>0){const e=Object.keys(t).filter(e=>-1===n.indexOf(e));if(e.length>0)return{reason:"not-allowed",message:`these keys are not in this dispatcher's allowed keys: ${e.join(", ")}`}}return null}return"CLEAR_STORE"===t?n.length>0?{reason:"not-allowed",message:"CLEAR_STORE is refused while allowed keys are set, because it would remove keys outside them"}:null:{reason:"unknown",message:`"${t}" is not a known built-in action`}}runBuiltIn(e){e.started=!0,this.workSinceIdle=!0,this.idleEmitted=!1,this.notifyQueue(),this.emit("onDispatched",this.infoOf(e));const t=e.action,n=this.options.storeName;try{let i;switch(t.type){case"SET_STORE":{const e=u(t,"key");this.store.setKey(n,e,u(t,"value"),{merge:!0===u(t,"merge")}),i={storeName:n,key:e};break}case"MERGE_STORE":{const e=u(t,"values");this.store.setState(n,e),i={storeName:n,keys:Object.keys(e)};break}case"DELETE_STORE_KEY":{const e=u(t,"key");this.store.deleteKey(n,e),i={storeName:n,key:e};break}case"CLEAR_STORE":this.store.clearStore(n),i={storeName:n};break;default:throw new Error(`"${t.type}" is not a known built-in action`)}this.settle(e,!0,i)}catch(t){this.settle(e,!1,String((null==t?void 0:t.message)||t))}}coerce(e){if(null==e)return{error:"no action was provided"};let t=e;if("string"==typeof t){const e=t.trim();if(""===e)return{error:"no action was provided"};try{t=JSON.parse(e)}catch(e){return{error:"the action is not valid JSON: "+String((null==e?void 0:e.message)||e)}}}return Array.isArray(t)?0===t.length?{error:"the action array is empty"}:{actions:t.slice()}:{actions:[t]}}allowRate(){const e=this.options.rateLimit;if(e<=0)return!0;const t=this.options.rateLimitWindow>0?this.options.rateLimitWindow:6e4,n=this.nowImpl(),i=n-t;for(;this.recentTimes.length>0&&this.recentTimes[0]<=i;)this.recentTimes.shift();return!(this.recentTimes.length>=e||(this.recentTimes.push(n),0))}clearHandlerTimer(e){null!==e.timer&&(this.clearTimeoutImpl(e.timer),e.timer=null)}clearEntryTimers(e){this.clearHandlerTimer(e),this.unpark(e)}refuseEntry(e,t,n){e.refused=!0,this.clearEntryTimers(e),this.workSinceIdle=!0,this.idleEmitted=!1,this.emit("onRefused",{actionId:e.id,actionType:e.action.type,reason:t,message:n,action:e.action})}refuse(e,t,n,i){this.workSinceIdle=!0,this.idleEmitted=!1,this.emit("onRefused",{actionId:"action_"+ ++c,actionType:t,reason:n,message:i,action:e})}maybeIdle(){this.disposed||this.current||this.queue.length>0||!this.idleEmitted&&this.workSinceIdle&&(this.idleEmitted=!0,this.workSinceIdle=!1,this.emit("onIdle"))}notifyQueue(){this.emit("onQueueChanged")}infoOf(e){return{actionId:e.id,actionType:e.action.type,action:e.action,payload:e.payload}}emit(e,...t){const n=this.hooks[e];if(n)try{n.apply(this.hooks,t)}catch(t){console.error(`[ActionDispatcher] ${String(e)} hook threw:`,t)}}}},7003(e,t,n){"use strict";const i=n(5162),o=n(9038),r=n(7268);function s(e){return e._internal}const a={name:"net.noodl.ActionDispatcher",displayNodeName:"Action Dispatcher",category:"Data",color:"data",usePortAsLabel:"channel",searchTags:["action","dispatch","command","agent","ai","backend","remote","control","workflow","guided","tour"],initialize(){const e=s(this);e.options={channel:"default",storeName:"app",builtIns:[],allowedKeys:[],handlerTimeout:3e4,waitForHandler:2e3,maxQueueSize:100,rateLimit:0,rateLimitWindow:6e4},e.dispatcher=null,e.pendingAction=void 0,e.actionType="",e.actionId="",e.payload=void 0,e.result=void 0,e.lastError="",e.refusedType="",e.refusalReason="",e.refusalMessage="",e.completedCount=0,e.failedCount=0,e.refusedCount=0,e.cancelledCount=0,e.deps={}},getInspectInfo(){const e=s(this),t=e.dispatcher;return{type:"value",value:{channel:e.options.channel,enabledBuiltIns:e.options.builtIns,lastAction:e.actionType,queueSize:t?t.queueSize:0,waitingFor:t?t.waitingFor:"",completed:e.completedCount,failed:e.failedCount,refused:e.refusedCount,lastRefusal:e.refusalReason?e.refusalReason+": "+e.refusalMessage:""}}},inputs:{channel:{type:"string",default:"default",displayName:"Channel",description:"Names the handler registry this dispatcher draws on; leave it as default unless two independent flows must not see each other",group:"Dispatcher",tooltip:'Names the handler registry this dispatcher draws on. Leave as "default" unless two independent flows must not see each other.',set(e){s(this).options.channel=null==e||""===e?"default":String(e)}},action:{type:"*",displayName:"Action",description:"An action object, an array of them to run in order, or JSON text holding either",group:"Action",tooltip:"An action object, an array of them to run in order, or JSON text holding either.",set(e){s(this).pendingAction=e}},builtIns:{type:"string",displayName:"Enabled Built-ins",description:"Comma-separated built-in action names this dispatcher may execute; empty, the default, means a server cannot write to the store at all",group:"Built-in Actions",tooltip:"Comma-separated built-in action names this dispatcher may execute: "+o.BUILT_IN_ACTIONS.join(", ")+". Empty — the default — means a server cannot write to the store at all; everything must go through an Action Handler you wired.",set(e){const t=(0,o.parseList)(e),n=t.filter(e=>-1===o.BUILT_IN_ACTIONS.indexOf(e));s(this).options.builtIns=t.filter(e=>-1!==o.BUILT_IN_ACTIONS.indexOf(e)),n.length>0&&(s(this).lastError="Not built-in action names, so not enabled: "+n.join(", "),this.flagOutputDirty("lastError"))}},storeName:{type:"string",default:"app",displayName:"Store Name",description:"The only store the built-in actions can write; a store named inside an incoming action is ignored",group:"Built-in Actions",tooltip:"The only store the built-in actions can write. A store named inside an incoming action is ignored — the graph chooses the store, not the server.",set(e){s(this).options.storeName=null==e||""===e?"app":String(e)}},allowedKeys:{type:"string",displayName:"Allowed Keys",description:"Comma-separated keys the built-in store actions may write; blank means any key, and setting any key also refuses CLEAR_STORE",group:"Built-in Actions",tooltip:"Comma-separated keys the built-in store actions may write. Blank means any key of the configured store. Setting any key also refuses CLEAR_STORE.",set(e){s(this).options.allowedKeys=(0,o.parseList)(e)}},handlerTimeout:{type:"number",default:3e4,displayName:"Handler Timeout (ms)",description:"Milliseconds a handler has to signal Complete or Fail before the action is failed; 0 waits forever",group:"Delivery",tooltip:"How long a handler has to signal Complete or Fail before the action is failed. 0 waits forever.",set(e){s(this).options.handlerTimeout=Number(e)>=0?Number(e):3e4}},waitForHandler:{type:"number",default:2e3,displayName:"Wait For Handler (ms)",description:"Milliseconds an action waits for its handler to appear before being refused as unknown; everything behind it waits too",group:"Delivery",tooltip:"How long an action waits for its handler to appear before being refused as unknown — the window in which a component can still mount. 0 refuses immediately. Everything behind it waits too, because order is preserved.",set(e){s(this).options.waitForHandler=Number(e)>=0?Number(e):2e3}},maxQueueSize:{type:"number",default:100,displayName:"Max Queue Size",description:"Bound on queued actions; overflow refuses the newest so accepted actions keep their order; 0 is unbounded",group:"Delivery",tooltip:"Bound on queued actions. Overflow refuses the newest so accepted actions keep their order. 0 is unbounded.",set(e){s(this).options.maxQueueSize=Number(e)>=0?Number(e):100}},rateLimit:{type:"number",default:0,displayName:"Rate Limit",description:"Actions executed per window before the rest are refused rather than delayed; 0 is unlimited",group:"Delivery",tooltip:"Max actions executed per window. 0 is unlimited. Excess actions are refused, not delayed.",set(e){s(this).options.rateLimit=Number(e)>=0?Number(e):0}},rateLimitWindow:{type:"number",default:6e4,displayName:"Rate Limit Window (ms)",description:"Length of the rate-limit window in milliseconds; ignored unless Rate Limit is set",group:"Delivery",set(e){s(this).options.rateLimitWindow=Number(e)>0?Number(e):6e4}},dispatch:{displayName:"Dispatch",description:"Admits whatever is on Action and runs it, or refuses it with a reason",group:"Actions",valueChangedToTrue(){this.doDispatch()}},cancel:{displayName:"Cancel All",description:"Discards everything queued and abandons anything in flight, reporting how many were dropped",group:"Actions",valueChangedToTrue(){this.doCancel()}}},outputs:{actionType:{type:"string",displayName:"Action Type",description:"Type of the action currently being executed",group:"Data",get(){return s(this).actionType}},actionId:{type:"string",displayName:"Action Id",description:"Id of the action currently being executed, taken from the message when it carried one",group:"Data",get(){return s(this).actionId}},payload:{type:"*",displayName:"Payload",description:"The data the current action carried, taken from its payload or data field, or the whole action when it has neither",group:"Data",get(){return s(this).payload}},result:{type:"*",displayName:"Result",description:"What the handler or built-in returned for the action that just completed",group:"Data",get(){return s(this).result}},dispatched:{type:"signal",displayName:"Dispatched",description:"Fires when an action has been accepted and is about to run",group:"Events"},actionCompleted:{type:"signal",displayName:"Action Completed",description:"Fires once *one action* has finished and Result holds its answer — one Dispatch of an array fires this once per member, which is why it is not the node’s Completed",group:"Events"},failed:{type:"signal",displayName:"Failed",description:"Fires when an accepted action ran and did not succeed, whether the handler said so or the deadline passed",group:"Events"},idle:{type:"signal",displayName:"Idle",description:"Fires when the queue has drained after doing at least one thing",group:"Events"},refused:{type:"signal",displayName:"Refused",description:"Fires when an action was not run at all, which is the output to watch for anything a server can talk to",group:"Refusals"},refusedType:{type:"string",displayName:"Refused Type",description:"Type of the refused action, or blank when the message was too malformed to have one",group:"Refusals",get(){return s(this).refusedType}},refusalReason:{type:"string",displayName:"Refusal Reason",description:"Why it was refused, as one of invalid, unknown, not-allowed, rate-limited or queue-full",group:"Refusals",get(){return s(this).refusalReason}},refusalMessage:{type:"string",displayName:"Refusal Message",description:"The refusal in a sentence an app author can show or log",group:"Refusals",get(){return s(this).refusalMessage}},lastError:{type:"string",displayName:"Last Error",description:"The most recent failure or refusal, whichever happened last",group:"Status",get(){return s(this).lastError}},queueSize:{type:"number",displayName:"Queue Size",description:"How many actions are waiting behind the one being executed",group:"Status",get(){const e=s(this).dispatcher;return e?e.queueSize:0}},isExecuting:{type:"boolean",displayName:"Is Executing",description:"True while an action is running, which is the cue for a busy indicator",group:"Status",get(){const e=s(this).dispatcher;return!!e&&e.isExecuting}},waitingFor:{type:"string",displayName:"Waiting For",description:"Action type holding the head of the queue because its handler has not registered yet; blank when nothing is waiting",group:"Status",get(){const e=s(this).dispatcher;return e?e.waitingFor:""}},completedCount:{type:"number",displayName:"Completed Count",description:"How many actions have completed since the page loaded",group:"Status",get(){return s(this).completedCount}},failedCount:{type:"number",displayName:"Failed Count",description:"How many accepted actions have failed since the page loaded",group:"Status",get(){return s(this).failedCount}},refusedCount:{type:"number",displayName:"Refused Count",description:"How many actions have been refused since the page loaded",group:"Status",get(){return s(this).refusedCount}},cancelledCount:{type:"number",displayName:"Cancelled Count",description:"How many actions Cancel All has discarded since the page loaded",group:"Status",get(){return s(this).cancelledCount}},cancelled:{type:"signal",displayName:"Cancelled",description:"Fires once Cancel All has emptied the queue",group:"Events"},...(0,i.outcomeOutputs)({done:"Fires when the invocation did something: Dispatch admitted at least one action, or Cancel All dropped at least one",unchanged:"Fires when there was nothing to do — a Cancel All with an empty queue. Not a failure: the queue is empty, which is what was asked for",failure:"Fires when a Dispatch admitted nothing at all, because every action in it was refused"})},methods:{doDispatch(){const e=s(this),t=this.beginOutcome(),n=function(e){const t=s(e);return t.dispatcher||(t.dispatcher=new o.ActionDispatcher(t.options,{onDispatched(n){t.actionType=n.actionType,t.actionId=n.actionId,t.payload=n.payload,e.flagOutputDirty("actionType"),e.flagOutputDirty("actionId"),e.flagOutputDirty("payload"),e.flagOutputDirty("isExecuting"),e.sendSignalOnOutput("dispatched")},onCompleted(n){t.result=n.result,t.completedCount++,e.flagOutputDirty("result"),e.flagOutputDirty("isExecuting"),e.flagOutputDirty("completedCount"),e.sendSignalOnOutput("actionCompleted")},onFailed(n){t.lastError=n.error,t.failedCount++,e.flagOutputDirty("lastError"),e.flagOutputDirty("isExecuting"),e.flagOutputDirty("failedCount"),e.sendSignalOnOutput("failed")},onRefused(n){t.refusedType=n.actionType,t.refusalReason=n.reason,t.refusalMessage=n.message,t.lastError=n.message,t.refusedCount++,e.flagOutputDirty("refusedType"),e.flagOutputDirty("refusalReason"),e.flagOutputDirty("refusalMessage"),e.flagOutputDirty("lastError"),e.flagOutputDirty("refusedCount"),e.sendSignalOnOutput("refused")},onQueueChanged(){e.flagOutputDirty("queueSize"),e.flagOutputDirty("waitingFor"),e.flagOutputDirty("isExecuting")},onIdle(){e.sendSignalOnOutput("idle")}},t.deps)),t.dispatcher}(this).dispatch(e.pendingAction);n?this.reportOutcome(t,"done"):this.reportOutcome(t,"failure",{code:"action-dispatcher/nothing-admitted",message:"Nothing on Action was admitted; every action in it was refused",detail:{reason:e.refusalReason,message:e.refusalMessage}})},doCancel(){const e=s(this),t=this.beginOutcome(),n=e.dispatcher?e.dispatcher.cancelAll():0;0!==n?(e.cancelledCount+=n,this.flagOutputDirty("cancelledCount"),this.flagOutputDirty("queueSize"),this.flagOutputDirty("waitingFor"),this.flagOutputDirty("isExecuting"),this.sendSignalOnOutput("cancelled"),this.reportOutcome(t,"done")):this.reportOutcome(t,"unchanged")},_onNodeDeleted(){r.prototype._onNodeDeleted.call(this);const e=s(this);e.dispatcher&&(e.dispatcher.dispose(),e.dispatcher=null)}}};e.exports={node:a}},8520(e,t,n){"use strict";const i=n(5162),o=n(9038),r=n(7268),s="action-handler/operation-failed";function a(e){return e._internal}const l={name:"net.noodl.ActionHandler",displayNodeName:"Action Handler",category:"Data",color:"data",usePortAsLabel:"actionType",searchTags:["action","handler","register","dispatch","agent","ai","backend","remote","command"],initialize(){const e=a(this);e.channel="default",e.actionType="",e.enabled=!0,e.autoComplete=!0,e.result=void 0,e.errorMessage="",e.payload=void 0,e.actionId="",e.error="",e.triggeredCount=0,e.pending=null,e.unregister=null,e.setupScheduled=!1,e.registry=o.actionRegistry},getInspectInfo(){const e=a(this);return e.actionType?{type:"value",value:{channel:e.channel,actionType:e.actionType,registered:null!==e.unregister,inFlight:null!==e.pending,triggered:e.triggeredCount,lastPayload:e.payload,error:e.error}}:{type:"text",value:"[No action type set]"}},inputs:{channel:{type:"string",default:"default",displayName:"Channel",description:"Must match the Channel on the Action Dispatcher that should be able to reach this handler",group:"Handler",tooltip:"Must match the Channel on the Action Dispatcher that should be able to reach this handler.",set(e){a(this).channel=null==e||""===e?"default":String(e),this.scheduleSetup()}},actionType:{type:"string",displayName:"Action Type",description:"The exact action type this handler accepts; registering it is what makes it executable at all",group:"Handler",tooltip:"The exact action type this handler accepts, e.g. OPEN_SESSION. Registering it is what makes it executable at all.",set(e){a(this).actionType=null==e?"":String(e),this.scheduleSetup()}},enabled:{type:"boolean",default:!0,displayName:"Enabled",description:"Turning this off unregisters the handler, so the action is refused as unknown rather than quietly ignored",group:"Handler",tooltip:"Turning this off unregisters the handler, so the action is refused as unknown rather than quietly ignored.",set(e){a(this).enabled=void 0===e||!!e,this.scheduleSetup()}},autoComplete:{type:"boolean",default:!0,displayName:"Auto Complete",description:"Reports the action complete as soon as Trigger has been sent; turn it off when a later step must finish first",group:"Completion",tooltip:"Report the action complete as soon as Trigger has been sent. Turn off when a later step must wait for this one to finish, and wire Complete or Fail yourself.",set(e){a(this).autoComplete=void 0===e||!!e}},result:{type:"*",displayName:"Result",description:"Handed back to the dispatcher as the Result of this action when it completes",group:"Completion",tooltip:"Handed back to the dispatcher as the Result of this action when it completes.",set(e){a(this).result=e}},errorMessage:{type:"string",displayName:"Error Message",description:"Reason handed back to the dispatcher when Fail is signalled; a generic one is used when this is blank",group:"Completion",set(e){a(this).errorMessage=null==e?"":String(e)}},complete:{displayName:"Complete",description:"Reports the action finished, so the dispatcher runs whatever is queued behind it; ignored unless Auto Complete is off",group:"Actions",valueChangedToTrue(){this.doComplete(this.beginOutcome())}},fail:{displayName:"Fail",description:"Reports the action failed, so the dispatcher fires Failed with Error Message as the reason",group:"Actions",valueChangedToTrue(){this.doFail(this.beginOutcome())}}},outputs:{trigger:{type:"signal",displayName:"Trigger",description:"Fires when a dispatcher has an action of this type to run; whatever is wired downstream is the capability this grants",group:"Events"},payload:{type:"*",displayName:"Payload",description:"The data the action carried, taken from its payload or data field, or the whole action when it has neither",group:"Data",get(){return a(this).payload}},actionId:{type:"string",displayName:"Action Id",description:"Id of the action currently being handled, so a later Complete can be matched to it",group:"Data",get(){return a(this).actionId}},registered:{type:"boolean",displayName:"Registered",description:"True while this handler is in the allow-list, which needs both an Action Type and Enabled",group:"Status",get(){return null!==a(this).unregister}},triggeredCount:{type:"number",displayName:"Triggered Count",description:"How many actions this handler has been asked to run since the page loaded",group:"Status",get(){return a(this).triggeredCount}},error:{type:"string",displayName:"Error",description:"Why the handler could not register, or why the last Complete or Fail had nothing to act on",group:"Status",get(){return a(this).error}},...(0,i.outcomeOutputs)({done:"Fires when Complete or Fail acted on the action in flight — including a Fail, which succeeds by reporting the failure",failure:"Fires when Complete or Fail was signalled with no action in flight"})},methods:{scheduleSetup(){const e=a(this);e.setupScheduled||(e.setupScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){a(this).setupScheduled=!1,this.setupRegistration()}))},setupRegistration(){const e=a(this);if(this.teardownRegistration(),!e.enabled)return void this.flagOutputDirty("registered");if(!e.actionType)return e.error="An action type is required",this.flagOutputDirty("error"),this.flagOutputDirty("registered"),void this.raiseRuntimeError(s,e.error);const t=this;try{e.unregister=e.registry.register(e.channel,e.actionType,{invoke(e){const n=a(t);n.pending=e,n.payload=e.payload,n.actionId=e.actionId,n.triggeredCount++,t.flagOutputDirty("payload"),t.flagOutputDirty("actionId"),t.flagOutputDirty("triggeredCount"),t.sendSignalOnOutput("trigger"),n.autoComplete&&n.pending===e&&(n.pending=null,e.complete(n.result))}})}catch(t){return e.error=String((null==t?void 0:t.message)||t),this.flagOutputDirty("error"),this.flagOutputDirty("registered"),void this.raiseRuntimeError(s,e.error)}e.error&&(e.error="",this.flagOutputDirty("error")),this.flagOutputDirty("registered")},teardownRegistration(){const e=a(this);e.unregister&&(e.unregister(),e.unregister=null)},doComplete(e){const t=a(this),n=t.pending;n?(t.pending=null,n.complete(t.result),this.reportOutcome(e,"done")):this.reportFailure("Complete was signalled with no action in flight",e)},doFail(e){const t=a(this),n=t.pending;n?(t.pending=null,n.fail(t.errorMessage||`the handler for "${t.actionType}" reported a failure`),this.reportOutcome(e,"done")):this.reportFailure("Fail was signalled with no action in flight",e)},reportFailure(e,t){a(this).error=e,this.flagOutputDirty("error"),this.reportOutcome(t,"failure",{code:s,message:e})},_onNodeDeleted(){r.prototype._onNodeDeleted.call(this);const e=a(this),t=e.pending;e.pending=null,t&&t.fail(`the handler for "${e.actionType}" was removed before it completed`),this.teardownRegistration()}}};e.exports={node:l}},6086(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.STORAGE_KEY_PREFIX=t.MODEL_ID_PREFIX=t.globalStoreManager=t.GlobalStoreManager=void 0,t.cloneStoreValue=function(e){return u(e,new WeakSet,()=>{})};const o=i(n(6835)).default,r="--ndl--global-store--";t.MODEL_ID_PREFIX=r;const s="noodl_store_";t.STORAGE_KEY_PREFIX=s;const a=Symbol("noodl.globalstore.absent");function l(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function u(e,t,n){if("function"==typeof e)return n(),e;if(null===e||"object"!=typeof e)return e;if(t.has(e))return n(),e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){if(e.constructor!==Array)return n(),e;t.add(e);const i=e.map(e=>u(e,t,n));return t.delete(e),i}if(l(e)){t.add(e);const i={};for(const o of Object.keys(e))i[o]=u(e[o],t,n);return t.delete(e),i}return n(),e}class c{constructor(){this.stores=new Map,this.patchIndex=new Map,this.storage=void 0,this.patchCounter=0}modelIdFor(e){return r+this.normalizeName(e)}getModel(e){return this.ensure(e).model}getStoreNames(){return Array.from(this.stores.keys())}getRevision(e){const t=this.stores.get(this.normalizeName(e));return t?t.revision:0}getState(e){return this.ensure(e).model.data}getKey(e,t){return this.ensure(e).model.data[t]}hasKey(e,t){return t in this.ensure(e).model.data}setKey(e,t,n,i){if("string"!=typeof t||""===t)throw new Error("Global Store: a key is required");const o=this.ensure(e);this.write(o,()=>{const e=o.model.data[t];let r=n;i&&i.merge&&l(e)&&l(n)&&(r=Object.assign({},e,n)),this.recordPrevious(o,t),i&&i.force&&this.windowOf(o).forced.add(t),o.model.set(t,r,i&&i.force?{forceChange:!0}:void 0)})}setState(e,t){if(!l(t))throw new Error("Global Store: setState expects a plain object");const n=this.ensure(e);this.write(n,()=>{for(const e of Object.keys(t))this.recordPrevious(n,e),n.model.set(e,t[e])})}replaceState(e,t){if(!l(t))throw new Error("Global Store: replaceState expects a plain object");const n=this.ensure(e);this.write(n,()=>{for(const e of Object.keys(n.model.data))e in t||this.removeKey(n,e);for(const e of Object.keys(t))this.recordPrevious(n,e),n.model.set(e,t[e])})}deleteKey(e,t){const n=this.ensure(e);this.write(n,()=>this.removeKey(n,t))}clearStore(e){const t=this.ensure(e);if(this.write(t,()=>{for(const e of Object.keys(t.model.data))this.removeKey(t,e)}),t.persist){const e=this.resolveStorage();if(e)try{e.removeItem(s+(t.storageKey||t.name))}catch(e){this.reportError(t,"persist",e)}}}batch(e,t){const n=this.ensure(e);n.batchDepth++;try{return t()}finally{n.batchDepth--,0===n.batchDepth&&this.commit(n)}}deferNotifications(e){const t=this.ensure(e);if(t.deferredClose)return;t.batchDepth++;const n=()=>{t.deferredClose===n&&(t.deferredClose=null,t.batchDepth--,0===t.batchDepth&&this.commit(t))};t.deferredClose=n,Promise.resolve().then(n)}flushBatches(){for(const e of this.stores.values())e.deferredClose&&e.deferredClose()}subscribe(e,t,n){if("function"!=typeof t)throw new Error("Global Store: subscribe needs a callback");const i=this.ensure(e),o={callback:t,keys:n&&n.length?new Set(n):null,cancelled:!1};return i.subscribers.push(o),()=>{if(o.cancelled)return;o.cancelled=!0;const e=i.subscribers.indexOf(o);-1!==e&&i.subscribers.splice(e,1)}}subscriberCount(e){const t=this.stores.get(this.normalizeName(e));return t?t.subscribers.length:0}onError(e,t){const n=this.ensure(e);n.errorListeners.push(t);let i=!1;return()=>{if(i)return;i=!0;const e=n.errorListeners.indexOf(t);-1!==e&&n.errorListeners.splice(e,1)}}configureStore(e,t){const n=this.ensure(e);t&&void 0!==t.storageKey&&(n.storageKey=t.storageKey||void 0);const i=this.coerceState(n,t&&t.initialState);this.batch(n.name,()=>{if(i)for(const e of Object.keys(i))e in n.model.data||(this.recordPrevious(n,e),n.model.set(e,i[e]));if(t&&void 0!==t.persist){const e=n.persist;if(n.persist=!!t.persist,n.persist&&!e){const e=this.loadPersisted(n);if(e)for(const t of Object.keys(e))this.recordPrevious(n,t),n.model.set(t,e[t])}}})}getSnapshot(e){const t=this.ensure(e),n={},i=[];for(const e of Object.keys(t.model.data)){let o=!1;n[e]=u(t.model.data[e],new WeakSet,()=>{o=!0}),o&&i.push(e)}return{storeName:t.name,state:n,takenAt:Date.now(),revision:t.revision,byReference:i}}restoreSnapshot(e,t){if(!e||!l(e.state))throw new Error("Global Store: restoreSnapshot expects a snapshot with a state object");const n=t&&t.storeName||e.storeName,i=this.ensure(n),o=[],r=this.subscribe(i.name,e=>{for(const t of e.changedKeys)o.push(t)});try{const t=u(e.state,new WeakSet,()=>{});this.replaceState(i.name,t)}finally{r()}return o}applyPatch(e,t,n){if(!l(t))throw new Error("Global Store: applyPatch expects a plain object");const i=this.ensure(e),o=n&&n.id||"patch_"+Date.now().toString(36)+"_"+ ++this.patchCounter;if(this.patchIndex.has(o))throw new Error(`Global Store: patch "${o}" is already open`);const r=new Map;for(const e of Object.keys(t))r.set(e,e in i.model.data?i.model.data[e]:a);const s={id:o,storeName:i.name,before:r,status:"pending",appliedAt:Date.now()};return this.write(i,()=>{for(const e of Object.keys(t))this.recordPrevious(i,e),i.model.set(e,t[e])}),i.patches.push(s),this.patchIndex.set(o,s),this.toHandle(s)}commitPatch(e){const t=this.patchIndex.get(e);return!(!t||"pending"!==t.status||(t.status="committed",this.forget(t),0))}rollbackPatch(e){const t=this.patchIndex.get(e);if(!t||"pending"!==t.status)return!1;const n=this.ensure(t.storeName),i=n.patches.indexOf(t),o=-1===i?[]:n.patches.slice(i+1);return t.status="rolledBack",this.forget(t),this.write(n,()=>{for(const[e,i]of t.before){let t;for(const n of o)"pending"===n.status&&n.before.has(e)&&(t=n);t?t.before.set(e,i):i===a?this.removeKey(n,e):(this.recordPrevious(n,e),n.model.set(e,i))}}),!0}getPatch(e){const t=this.patchIndex.get(e);return t?this.toHandle(t):void 0}getOpenPatches(e){const t=this.stores.get(this.normalizeName(e));return t?t.patches.filter(e=>"pending"===e.status).map(e=>this.toHandle(e)):[]}setStorage(e){this.storage=e}flushPersistence(){for(const e of this.stores.values())e.persistDirty&&this.persistNow(e)}reset(e){for(const t of this.stores.values()){if(e&&e.clearState)for(const e of Object.keys(t.model.data))delete t.model.data[e];t.model.off("change",t.onModelChange),t.persistTimer&&(clearTimeout(t.persistTimer),t.persistTimer=null,t.persistDirty=!1),t.deferredClose&&(t.deferredClose=null,t.batchDepth=0),t.subscribers.length=0,t.errorListeners.length=0}this.stores.clear(),this.patchIndex.clear(),this.storage=void 0}normalizeName(e){return null==e||""===e?"app":String(e)}ensure(e){const t=this.normalizeName(e),n=this.stores.get(t);if(n)return n;const i=o.get(r+t),s={name:t,model:i,onModelChange:()=>{},subscribers:[],errorListeners:[],revision:0,batchDepth:0,window:null,pending:[],notifying:!1,deferredClose:null,persist:!1,storageKey:void 0,persistDirty:!1,persistTimer:null,patches:[]};return s.onModelChange=e=>{const t=this.windowOf(s);t.previous.has(e.name)||t.previous.set(e.name,e.old),0===s.batchDepth&&this.commit(s)},i.on("change",s.onModelChange),this.stores.set(t,s),s}windowOf(e){return e.window||(e.window={previous:new Map,forced:new Set}),e.window}recordPrevious(e,t){const n=this.windowOf(e);n.previous.has(t)||n.previous.set(t,t in e.model.data?e.model.data[t]:a)}removeKey(e,t){if(!(t in e.model.data))return;this.recordPrevious(e,t);const n=e.model.data[t];delete e.model.data[t],e.model.notify("change",{name:t,value:void 0,old:n})}write(e,t){e.batchDepth++;try{t()}finally{e.batchDepth--,0===e.batchDepth&&this.commit(e)}}commit(e){const t=e.window;if(e.window=null,!t)return;const n=e.model.data,i=Object.assign({},n),o=[];for(const[e,r]of t.previous){const s=r!==a;s?i[e]=r:delete i[e];const l=e in n;(t.forced.has(e)||s!==l||n[e]!==r)&&o.push(e)}0!==o.length&&(e.revision++,this.notify(e,{storeName:e.name,state:n,previousState:i,changedKeys:o,revision:e.revision}),e.persist&&this.schedulePersist(e))}notify(e,t){if(e.pending.push(t),!e.notifying){e.notifying=!0;try{for(;e.pending.length;){const t=e.pending.shift();for(const n of e.subscribers.slice()){if(n.cancelled)continue;const i=n.keys;if(!i||t.changedKeys.some(e=>i.has(e)))try{n.callback(t)}catch(t){this.reportError(e,"subscriber",t)}}}}finally{e.notifying=!1}}}toHandle(e){return{id:e.id,storeName:e.storeName,keys:Array.from(e.before.keys()),status:e.status,appliedAt:e.appliedAt}}forget(e){this.patchIndex.delete(e.id);const t=this.stores.get(e.storeName);if(!t)return;const n=t.patches.indexOf(e);-1!==n&&t.patches.splice(n,1)}coerceState(e,t){if(null!=t&&""!==t){if("string"==typeof t)try{const n=JSON.parse(t);return l(n)?n:void this.reportError(e,"clone",new Error("initial state must be a JSON object"))}catch(t){return void this.reportError(e,"clone",t)}if(l(t))return t;this.reportError(e,"clone",new Error("initial state must be an object"))}}resolveStorage(){if(void 0!==this.storage)return this.storage;const e=globalThis.localStorage;return this.storage=e&&"function"==typeof e.setItem?e:null,this.storage}schedulePersist(e){e.persistDirty||(e.persistDirty=!0,e.persistTimer=setTimeout(()=>this.persistNow(e),0))}persistNow(e){if(e.persistDirty=!1,e.persistTimer&&(clearTimeout(e.persistTimer),e.persistTimer=null),!e.persist)return;const t=this.resolveStorage();if(!t)return void this.reportError(e,"persist",new Error("no storage available; persistence is disabled"));const n=this.getSnapshot(e.name);try{t.setItem(s+(e.storageKey||e.name),JSON.stringify(n.state))}catch(t){const i=n.byReference.length?` (these keys hold values that cannot be serialised: ${n.byReference.join(", ")})`:"";this.reportError(e,"persist",new Error(String(t.message||t)+i))}}loadPersisted(e){const t=this.resolveStorage();if(t)try{const n=t.getItem(s+(e.storageKey||e.name));if(!n)return;const i=JSON.parse(n);return l(i)?i:void this.reportError(e,"load",new Error("persisted state is not an object; ignoring it"))}catch(t){return void this.reportError(e,"load",t)}}reportError(e,t,n){const i={storeName:e.name,phase:t,message:String((null==n?void 0:n.message)||n)};if(0!==e.errorListeners.length)for(const t of e.errorListeners.slice())try{t(i)}catch(t){console.error(`[GlobalStore:${e.name}] error listener threw:`,t)}else console.error(`[GlobalStore:${e.name}] ${t}: ${i.message}`)}}t.GlobalStoreManager=c,t.globalStoreManager=new c},8918(e,t,n){"use strict";const i=n(6086),o=n(7268),r={node:{name:"net.noodl.GlobalStore",displayNodeName:"Global Store",category:"Data",color:"data",usePortAsLabel:"storeName",initialize:function(){this._internal.storeName="app",this._internal.changedKeys="",this._internal.unsubscribe=null,this._internal.unsubscribeError=null,this._internal.setupScheduled=!1},nodeScopeDidInitialize:function(){this.scheduleSetup()},getInspectInfo:function(){return[{type:"text",value:"Store: "+this._internal.storeName},{type:"value",value:i.globalStoreManager.getState(this._internal.storeName)}]},inputs:{storeName:{type:"string",displayName:"Store Name",description:"Names the store this node reads; several nodes may share a name and every one of them sees the same state",group:"Store",default:"app",set:function(e){this._internal.storeName=null==e||""===e?"app":String(e),this.scheduleSetup()}},initialState:{type:"object",displayName:"Initial State",description:"Keys to fill in on stores that do not already have them, as an object or as JSON text; live values are never overwritten",group:"Store",set:function(e){this._internal.initialState=e,this.scheduleSetup()}},persist:{type:"boolean",displayName:"Persist",description:"Keeps the store in browser storage so it survives a reload; under SSR and cloud functions there is no storage and Error says so",group:"Store",default:!1,set:function(e){this._internal.persist=!!e,this.scheduleSetup()}},storageKey:{type:"string",displayName:"Storage Key",description:"Name to store the persisted copy under, defaulting to Store Name; ignored unless Persist is on",group:"Store",set:function(e){this._internal.storageKey=e,this.scheduleSetup()}}},outputs:{state:{type:"object",displayName:"State",description:"The whole store as a live object; write through Set Global Store rather than mutating it",group:"Data",getter:function(){return i.globalStoreManager.getState(this._internal.storeName)}},changedKeys:{type:"string",displayName:"Changed Keys",description:"Comma-separated keys that changed in the notification that fired State Changed",group:"Data",getter:function(){return this._internal.changedKeys}},stateChanged:{type:"signal",displayName:"State Changed",description:"Fires once per commit to the store, however many keys that commit touched",group:"Events"},ready:{type:"signal",displayName:"Ready",description:"Fires once the store has been created and configured, so a graph can sequence its first read",group:"Events"},error:{type:"string",displayName:"Error",description:"What the store could not do, prefixed by the phase it happened in: persist, load, clone or subscriber",group:"Error",getter:function(){return this._internal.error}},storeId:{type:"string",displayName:"Store Id",description:"The id of the Model backing this store, so a Function node can reach the same state through Noodl.Object",group:"Info",getter:function(){return i.globalStoreManager.modelIdFor(this._internal.storeName)}}},methods:{scheduleSetup:function(){this._internal.setupScheduled||(this._internal.setupScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.setupScheduled=!1,this.setupStore()}))},setupStore:function(){this.teardown();const e=this._internal.storeName;this._internal.unsubscribeError=i.globalStoreManager.onError(e,e=>{this._internal.error=`${e.phase}: ${e.message}`,this.flagOutputDirty("error")}),i.globalStoreManager.configureStore(e,{initialState:this._internal.initialState,persist:this._internal.persist,storageKey:this._internal.storageKey}),this._internal.unsubscribe=i.globalStoreManager.subscribe(e,e=>{this._internal.changedKeys=e.changedKeys.join(","),this.flagOutputDirty("state"),this.flagOutputDirty("changedKeys"),this.sendSignalOnOutput("stateChanged")}),this.flagOutputDirty("state"),this.flagOutputDirty("storeId"),this.sendSignalOnOutput("ready")},teardown:function(){this._internal.unsubscribe&&(this._internal.unsubscribe(),this._internal.unsubscribe=null),this._internal.unsubscribeError&&(this._internal.unsubscribeError(),this._internal.unsubscribeError=null)},_onNodeDeleted:function(){o.prototype._onNodeDeleted.call(this),this.teardown()}}}};e.exports=r},1988(e,t,n){"use strict";const i=n(5162),o=n(6086),r={node:{name:"net.noodl.GlobalStore.Set",displayNodeName:"Set Global Store",category:"Data",color:"data",usePortAsLabel:"key",initialize:function(){this._internal.storeName="app",this._internal.merge=!1,this._internal.transaction=!1,this._internal.writeScheduled=!1},getInspectInfo:function(){return this._internal.key?[{type:"text",value:this._internal.storeName+"."+this._internal.key},{type:"value",value:o.globalStoreManager.getKey(this._internal.storeName,this._internal.key)}]:"[No key set]"},inputs:{storeName:{type:"string",displayName:"Store Name",description:"Names the store to write; must match the Store Name of the Global Store node that owns it",group:"Store",default:"app",set:function(e){this._internal.storeName=null==e||""===e?"app":String(e)}},key:{type:"string",displayName:"Key",description:"Key to write; a Set with no key is refused rather than dropped",group:"Update",set:function(e){this._internal.key=e}},value:{type:"*",displayName:"Value",description:"Value to write, of any type; null is stored as null and is not coerced to a blank string",group:"Update",set:function(e){this._internal.value=e}},merge:{type:"boolean",displayName:"Merge Object",description:"Shallow-merges into the existing value when both the old and the new value are plain objects, instead of replacing it",group:"Update",default:!1,set:function(e){this._internal.merge=!!e}},transaction:{type:"boolean",displayName:"Batch With Others",description:"Holds the notification until the end of the current microtask so several writers in one turn produce a single change",group:"Update",default:!1,set:function(e){this._internal.transaction=!!e}},set:{displayName:"Set",description:"Writes Value at Key, reading both as of the end of the current frame",group:"Actions",valueChangedToTrue:function(){this.scheduleWrite()}}},outputs:{...(0,i.outcomeOutputs)({done:"Fires once the write has been applied and every subscriber has been told",failure:"Fires when the write could not be made, most often because Key is empty"}),error:{type:"string",displayName:"Error",description:"Why the last write failed; blank once a write succeeds",group:"Error",getter:function(){return this._internal.error}}},methods:{scheduleWrite:function(){if(this._internal.writeScheduled)return;this._internal.writeScheduled=!0;const e=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(function(){this._internal.writeScheduled=!1,this.doSet(e)})},doSet:function(e){const t=this._internal.key;if(t)try{this._internal.transaction&&o.globalStoreManager.deferNotifications(this._internal.storeName),o.globalStoreManager.setKey(this._internal.storeName,t,this._internal.value,{merge:this._internal.merge}),void 0!==this._internal.error&&(this._internal.error=void 0,this.flagOutputDirty("error")),this.reportOutcome(e,"done")}catch(t){this.reportFailure(e,String(t.message||t))}else this.reportFailure(e,"Key is required")},reportFailure:function(e,t){this._internal.error=t,this.flagOutputDirty("error"),this.reportOutcome(e,"failure",{code:"global-store/set-failed",message:t})}}}};e.exports=r},2848(e,t,n){"use strict";const i=n(6086),o=n(7268),r={node:{name:"net.noodl.GlobalStore.Subscribe",displayNodeName:"Subscribe to Store",category:"Data",color:"data",usePortAsLabel:"keys",initialize:function(){this._internal.storeName="app",this._internal.keyList=[],this._internal.changedKeys="",this._internal.unsubscribe=null,this._internal.setupScheduled=!1},nodeScopeDidInitialize:function(){this.scheduleSetup()},getInspectInfo:function(){return[{type:"text",value:"Store: "+this._internal.storeName+(this._internal.keyList.length?"":" (all keys)")},{type:"value",value:this.projectValue(i.globalStoreManager.getState(this._internal.storeName))}]},inputs:{storeName:{type:"string",displayName:"Store Name",description:"Names the store to watch; must match the Store Name of the Global Store node that owns it",group:"Store",default:"app",set:function(e){this._internal.storeName=null==e||""===e?"app":String(e),this.scheduleSetup()}},keys:{type:"string",displayName:"Keys",description:"Comma-separated keys to watch; leave blank to react to every change in the store",group:"Subscribe",tooltip:"Comma-separated keys to watch. Leave blank to react to every change in the store.",set:function(e){var t;this._internal.keys=e,this._internal.keyList=(t=e)?String(t).split(",").map(e=>e.trim()).filter(e=>e.length>0):[],this.scheduleSetup()}}},outputs:{value:{type:"*",displayName:"Value",description:"The watched value: one key gives that key, several give an object of just those keys, none gives the whole store",group:"Data",getter:function(){return this.projectValue(i.globalStoreManager.getState(this._internal.storeName))}},previousValue:{type:"*",displayName:"Previous Value",description:"The same projection as Value, as it was immediately before the change that fired Changed",group:"Data",getter:function(){return this._internal.previousValue}},changedKeys:{type:"string",displayName:"Changed Keys",description:"Comma-separated keys that changed in the notification that fired Changed",group:"Data",getter:function(){return this._internal.changedKeys}},changed:{type:"signal",displayName:"Changed",description:"Fires when one of the watched keys changed, and not for a commit that touched only other keys",group:"Events"}},methods:{scheduleSetup:function(){this._internal.setupScheduled||(this._internal.setupScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.setupScheduled=!1,this.setupSubscription()}))},setupSubscription:function(){this.teardown(),this._internal.unsubscribe=i.globalStoreManager.subscribe(this._internal.storeName,e=>{this._internal.previousValue=this.projectValue(e.previousState),this._internal.changedKeys=e.changedKeys.join(","),this.flagOutputDirty("value"),this.flagOutputDirty("previousValue"),this.flagOutputDirty("changedKeys"),this.sendSignalOnOutput("changed")},this._internal.keyList),this.flagOutputDirty("value")},teardown:function(){this._internal.unsubscribe&&(this._internal.unsubscribe(),this._internal.unsubscribe=null)},projectValue:function(e){const t=this._internal.keyList;if(0===t.length)return e;if(1===t.length)return e[t[0]];const n={};for(const i of t)n[i]=e[i];return n},_onNodeDeleted:function(){o.prototype._onNodeDeleted.call(this),this.teardown()}}}};e.exports=r},3579(e,t,n){"use strict";const i=n(5162),o=n(6325);function r(e){return e._internal}const s={name:"net.noodl.JSONStreamParser",displayNodeName:"JSON Stream Parser",category:"Data",color:"data",docs:"https://docs.noodl.net/nodes/data/json-stream-parser",searchTags:["json","ndjson","stream","parse","chunk","agent","ai","streaming","jsonl"],initialize(){const e=r(this);e.pendingChunk="",e.buffer="",e.format="ndjson",e.maxLength=1048576,e.parsed=void 0,e.values=[],e.totalValues=0,e.error="",e.errorCount=0,e.isComplete=!1},getInspectInfo(){const e=r(this);return{type:"value",value:{format:e.format,pendingCharacters:e.buffer.length,valuesThisParse:e.values.length,totalValues:e.totalValues,lastValue:e.parsed,errors:e.errorCount,lastError:e.error}}},inputs:{chunk:{type:"string",displayName:"Chunk",description:"The next fragment of the stream; boundaries may fall anywhere, including inside a string",group:"Data",set(e){r(this).pendingChunk=null==e?"":String(e)}},format:{type:{name:"enum",enums:[{label:"NDJSON (one per line)",value:"ndjson"},{label:"Stream (any complete values)",value:"stream"},{label:"Single document",value:"single"}]},default:"ndjson",displayName:"Format",description:"How values are framed on this stream: one per line, any concatenation of complete values, or one whole document",group:"Config",set(e){r(this).format=e||"ndjson"}},maxLength:{type:"number",default:1048576,displayName:"Max Pending (characters)",description:"Cap on unparsed text held while a value completes; exceeding it clears the buffer and reports an error rather than growing forever",group:"Config",tooltip:"Cap on unparsed text held while waiting for a value to complete. Exceeding it clears the buffer and reports an error, rather than growing without limit on a malformed stream.",set(e){r(this).maxLength=Number(e)>0?Number(e):0}},parse:{displayName:"Parse",description:"Appends the current Chunk and emits every value that is now complete; the chunk is retained between pulses",group:"Actions",valueChangedToTrue(){this.doParse(this.beginOutcome())}},clear:{displayName:"Clear",description:"Discards the pending text, the parsed values and the error counter",group:"Actions",valueChangedToTrue(){this.clearBuffer(this.beginOutcome())}}},outputs:{parsed:{type:"*",displayName:"Parsed",description:"The last complete value the most recent Parse produced",group:"Data",get(){return r(this).parsed}},values:{type:"array",displayName:"Values",description:"Every value completed by the most recent Parse, in order",group:"Data",get(){return r(this).values}},valueCount:{type:"number",displayName:"Value Count",description:"How many values have been parsed since the last Clear, across every Parse",group:"Status",get(){return r(this).totalValues}},pendingCharacters:{type:"number",displayName:"Pending Characters",description:"Text held back because a value is not complete yet; persistently non-zero means Format does not match the stream",group:"Status",get(){return r(this).buffer.length}},isComplete:{type:"boolean",displayName:"Is Complete",description:"True when the last Parse left nothing pending, so every value so far was whole",group:"Status",get(){return r(this).isComplete}},error:{type:"string",displayName:"Error",description:"Why the last value or line would not parse; kept until the next failure or a Clear",group:"Status",get(){return r(this).error}},errorCount:{type:"number",displayName:"Error Count",description:"How many values have failed to parse since the last Clear",group:"Status",get(){return r(this).errorCount}},success:{type:"signal",displayName:"Success",description:"Fires when a Parse yielded at least one value, so a chunk that merely advanced an incomplete value stays quiet",group:"Events"},cleared:{type:"signal",displayName:"Cleared",description:"Fires once the pending text and the values have been discarded",group:"Events"},...(0,i.outcomeOutputs)({done:"Fires when a Parse consumed text or a Clear discarded something; Success is narrower and fires only when values came out",unchanged:"Fires when there was nothing pending to parse, or nothing to clear — a valid action with nothing to do",failure:"Fires once when a Parse could not read part of its input, or when the pending text exceeded Max Pending; Error Count says how many"})},methods:{doParse(e){const t=r(this),n=t.pendingChunk;if(""!==n&&(t.buffer+=n),""===t.buffer)return void this.reportOutcome(e,"unchanged");if(t.maxLength>0&&t.buffer.length>t.maxLength)return t.buffer="",this.reportError("Gave up on "+t.maxLength+"+ characters of unparsed text; check the Format setting"),void this.settleParse(e,t.error);const i=[],s=[];if("ndjson"===t.format){const e=(0,o.splitDelimited)(t.buffer,"\n");t.buffer=e.rest;for(const t of e.messages){const e=t.trim();if(""===e)continue;const n=(0,o.tryParseJson)(e);n.ok?i.push(n.value):s.push("Line did not parse as JSON: "+n.error)}}else if("single"===t.format){const e=(0,o.scanJsonValues)(t.buffer,{arrayFraming:!1});e.values.length>0&&(i.push(e.values[0]),t.buffer=e.rest);for(const t of e.errors)s.push(t)}else{const e=(0,o.scanJsonValues)(t.buffer,{arrayFraming:!0});t.buffer=e.rest;for(const t of e.values)i.push(t);for(const t of e.errors)s.push(t)}t.isComplete=0===t.buffer.length,this.flagOutputDirty("isComplete"),this.flagOutputDirty("pendingCharacters"),i.length>0&&(t.values=i,t.parsed=i[i.length-1],t.totalValues+=i.length,this.flagOutputDirty("parsed"),this.flagOutputDirty("values"),this.flagOutputDirty("valueCount"));const a=t.errorCount;for(const e of s)this.reportError(e);i.length>0&&this.sendSignalOnOutput("success"),this.settleParse(e,t.errorCount>a?t.error:void 0)},settleParse(e,t){void 0===t?this.reportOutcome(e,"done"):this.reportOutcome(e,"failure",{code:"json-stream-parser/parse-failed",message:t})},reportError(e){const t=r(this);t.error=e,t.errorCount++,this.flagOutputDirty("error"),this.flagOutputDirty("errorCount")},clearBuffer(e){const t=r(this),n=""!==t.buffer||t.values.length>0||t.errorCount>0||t.totalValues>0;t.buffer="",t.values=[],t.parsed=void 0,t.error="",t.errorCount=0,t.totalValues=0,t.isComplete=!1,this.flagOutputDirty("values"),this.flagOutputDirty("valueCount"),this.flagOutputDirty("pendingCharacters"),this.flagOutputDirty("isComplete"),this.flagOutputDirty("error"),this.flagOutputDirty("errorCount"),this.sendSignalOnOutput("cleared"),e&&this.reportOutcome(e,n?"done":"unchanged")}}};e.exports={node:s}},7736(e,t,n){"use strict";const i=n(6086),o=n(5162),r=n(7268),s=Symbol("noodl.optimisticupdate.absent"),a=3e4,l={node:{name:"net.noodl.OptimisticUpdate",displayNodeName:"Optimistic Update",category:"Data",color:"data",usePortAsLabel:"key",initialize:function(){this._internal.storeName="app",this._internal.timeout=a,this._internal.onDispose="rollback",this._internal.open=[],this._internal.isCommitted=!1,this._internal.isRolledBack=!1,this._internal.unsubscribe=null,this._internal.setupScheduled=!1,this._internal.applyScheduled=!1,this._internal.commitScheduled=!1,this._internal.rollbackScheduled=!1,this._internal.applyOutcomes=[],this._internal.commitOutcomes=[],this._internal.rollbackOutcomes=[]},getInspectInfo:function(){if(!this._internal.key)return"[No key set]";const e=this._internal.open.length,t=e?e+(1===e?" update pending":" updates pending"):this._internal.isRolledBack?"Rolled back":this._internal.isCommitted?"Committed":"Idle";return[{type:"text",value:this._internal.storeName+"."+this._internal.key+" — "+t},{type:"value",value:i.globalStoreManager.getKey(this._internal.storeName,this._internal.key)}]},inputs:{storeName:{type:"string",displayName:"Store Name",description:"Names the store holding the key this update writes",group:"Store",default:"app",set:function(e){this._internal.storeName=null==e||""===e?"app":String(e),this.scheduleSetup()}},key:{type:"string",displayName:"Key",description:"Key to write optimistically; an Apply with no key is refused rather than dropped",group:"Store",set:function(e){this._internal.key=e,this.scheduleSetup()}},optimisticValue:{type:"*",displayName:"Optimistic Value",description:"Value to show immediately, before the server has confirmed anything",group:"Update",set:function(e){this._internal.optimisticValue=e}},errorMessage:{type:"string",displayName:"Error Message",description:"Reason reported on Error when this update is rolled back; wire the server error here",group:"Update",tooltip:"Reason reported on Error when this update is rolled back. Wire the server error here.",set:function(e){this._internal.errorMessage=e}},transactionId:{type:"string",displayName:"Transaction Id",description:"Names the update to commit or roll back when several are in flight; leave blank to generate one and resolve to the oldest",group:"Transaction",tooltip:"Leave blank to let the node generate one. Set it to commit or roll back a specific update when several are in flight.",set:function(e){this._internal.transactionIdInput=e}},timeout:{type:"number",displayName:"Timeout (ms)",description:"Milliseconds to wait for an answer before rolling back on its own; 0 waits forever",group:"Config",default:a,tooltip:"Roll back automatically after this long with no answer. Zero disables the deadline.",set:function(e){const t=Number(e);this._internal.timeout=isFinite(t)?t:a}},onDispose:{type:{name:"enum",enums:[{label:"Roll back",value:"rollback"},{label:"Keep the value",value:"commit"}],allowEditOnly:!0},default:"rollback",displayName:"When Removed",description:"What happens to updates still in flight when this node is removed: put the old value back, or keep the value that was shown",group:"Config",tooltip:"What happens to updates still in flight when this node is removed. Rolling back keeps the store honest; keeping the value suits fire-and-forget actions the user navigates away from.",set:function(e){this._internal.onDispose="commit"===e?"commit":"rollback"}},apply:{displayName:"Apply",description:"Writes Optimistic Value at Key now and opens a transaction the server response will resolve",group:"Actions",valueChangedToTrue:function(){this._internal.applyOutcomes.push(this.beginOutcome()),this.scheduleApply()}},commit:{displayName:"Commit",description:"Confirms the update, so the optimistic value becomes the truth",group:"Actions",valueChangedToTrue:function(){this._internal.commitOutcomes.push(this.beginOutcome()),this.scheduleCommit()}},rollback:{displayName:"Rollback",description:"Puts the old value back, unless something else has written the key since",group:"Actions",valueChangedToTrue:function(){this._internal.rollbackOutcomes.push(this.beginOutcome()),this.scheduleRollback()}}},outputs:{value:{type:"*",displayName:"Value",description:"What the key holds right now, following writes made by anything, not only by this node",group:"Data",getter:function(){if(this._internal.key)return i.globalStoreManager.getKey(this._internal.storeName,this._internal.key)}},previousValue:{type:"*",displayName:"Previous Value",description:"What the key held immediately before the most recent Apply; blank when the key did not exist",group:"Data",getter:function(){return this._internal.previousValue}},isPending:{type:"boolean",displayName:"Is Pending",description:"True while at least one update is waiting for an answer",group:"Status",getter:function(){return this._internal.open.length>0}},pendingCount:{type:"number",displayName:"Pending Count",description:"How many updates are open at once, which can be more than one when responses come back out of order",group:"Status",getter:function(){return this._internal.open.length}},isCommitted:{type:"boolean",displayName:"Is Committed",description:"True when the last update to resolve was confirmed",group:"Status",getter:function(){return this._internal.isCommitted}},isRolledBack:{type:"boolean",displayName:"Is Rolled Back",description:"True when the last update to resolve was undone, whether by Rollback, by the deadline, or by disposal",group:"Status",getter:function(){return this._internal.isRolledBack}},transactionId:{type:"string",displayName:"Transaction Id",description:"Id of the most recent Apply; carry it through the request and hand it back to resolve that update specifically",group:"Info",getter:function(){return this._internal.lastTransactionId}},applied:{type:"signal",displayName:"Applied",description:"Fires once the optimistic value is in the store and the transaction is open",group:"Events"},committed:{type:"signal",displayName:"Committed",description:"Fires once an update has been confirmed and its value is the truth",group:"Events"},rolledBack:{type:"signal",displayName:"Rolled Back",description:"Fires once an update has been undone, including when the value was left alone because something newer had written the key",group:"Events"},timedOut:{type:"signal",displayName:"Timed Out",description:"Fires alongside Rolled Back when it was the deadline rather than the graph that ended the update",group:"Events"},error:{type:"string",displayName:"Error",description:"Why the last update failed or was undone; blank once an Apply succeeds",group:"Error",getter:function(){return this._internal.error}},...(0,o.outcomeOutputs)({done:"Fires when the action did its work: an Apply that opened a transaction, a Commit that confirmed one, or a Rollback that put the old value back",unchanged:"Fires when a Rollback resolved its transaction without restoring anything, because something else had already written the key — the value this update wrote was gone already, so there was nothing to undo. Rolled Back fires too, and Error says why",failure:"Fires when the node refused to act: no Key, a transaction id already open, or no such update to resolve"})},methods:{scheduleSetup:function(){this._internal.setupScheduled||(this._internal.setupScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.setupScheduled=!1,this.setupSubscription()}))},setupSubscription:function(){this.teardown();const e=this._internal.key;e&&(this._internal.unsubscribe=i.globalStoreManager.subscribe(this._internal.storeName,()=>{this.flagOutputDirty("value")},[e]),this.flagOutputDirty("value"))},teardown:function(){this._internal.unsubscribe&&(this._internal.unsubscribe(),this._internal.unsubscribe=null)},scheduleApply:function(){this._internal.applyScheduled||(this._internal.applyScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.applyScheduled=!1,this.doApply()}))},scheduleCommit:function(){this._internal.commitScheduled||(this._internal.commitScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.commitScheduled=!1,this.doCommit()}))},scheduleRollback:function(){this._internal.rollbackScheduled||(this._internal.rollbackScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.rollbackScheduled=!1,this.doRollback()}))},doApply:function(){const e=this._internal.key,t=this._internal.applyOutcomes;if(this._internal.applyOutcomes=[],!e)return void this.reportFailure(t,"Key is required");const n=this._internal.storeName,r=this._internal.transactionIdInput,a=r?String(r):"tx_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,11),l=this._internal.optimisticValue,u=i.globalStoreManager.hasKey(n,e)?i.globalStoreManager.getKey(n,e):s;try{i.globalStoreManager.applyPatch(n,{[e]:l},{id:a})}catch(e){return void this.reportFailure(t,String(e.message||e))}const c={id:a,storeName:n,key:e,optimisticValue:l,previousValue:u,timer:null};this._internal.timeout>0&&(c.timer=setTimeout(()=>{c.timer=null,this.finishRollback(c,"Request timed out",!0,[])},this._internal.timeout)),this._internal.open.push(c),this._internal.lastTransactionId=a,this._internal.previousValue=u===s?void 0:u,this._internal.isCommitted=!1,this._internal.isRolledBack=!1,this.clearError(),this.flagOutputDirty("value"),this.flagOutputDirty("previousValue"),this.flagOutputDirty("transactionId"),this.flagStatus(),this.sendSignalOnOutput("applied"),(0,o.reportOutcomes)(this,t,"done")},doCommit:function(){const e=this._internal.commitOutcomes;this._internal.commitOutcomes=[];const t=this.pickTransaction("commit",e);t&&(this.forget(t),i.globalStoreManager.commitPatch(t.id),this._internal.isCommitted=!0,this._internal.isRolledBack=!1,this.clearError(),this.flagStatus(),this.sendSignalOnOutput("committed"),(0,o.reportOutcomes)(this,e,"done"))},doRollback:function(){const e=this._internal.rollbackOutcomes;this._internal.rollbackOutcomes=[];const t=this.pickTransaction("roll back",e);if(!t)return;const n=this._internal.errorMessage;this.finishRollback(t,n?String(n):"The update was rolled back",!1,e)},pickTransaction:function(e,t){const n=this._internal.open,i=this._internal.transactionIdInput;if(i){const o=String(i);return n.find(e=>e.id===o)||void this.reportFailure(t,`No open update with transaction id "${o}" to ${e}`)}if(0!==n.length)return n[0];this.reportFailure(t,`There is no open update to ${e}`)},forget:function(e){e.timer&&(clearTimeout(e.timer),e.timer=null);const t=this._internal.open.indexOf(e);-1!==t&&this._internal.open.splice(t,1)},isSuperseded:function(e){const t=i.globalStoreManager.getOpenPatches(e.storeName),n=t.findIndex(t=>t.id===e.id);return(-1===n||!t.slice(n+1).some(t=>-1!==t.keys.indexOf(e.key)))&&(!i.globalStoreManager.hasKey(e.storeName,e.key)||i.globalStoreManager.getKey(e.storeName,e.key)!==e.optimisticValue)},finishRollback:function(e,t,n,r){this.forget(e);const s=this.isSuperseded(e);s?i.globalStoreManager.commitPatch(e.id):i.globalStoreManager.rollbackPatch(e.id),this._internal.isRolledBack=!0,this._internal.isCommitted=!1,this.reportError(s?t+". The value changed after the update was applied, so it was left as it is.":t),this.flagOutputDirty("value"),this.flagStatus(),this.sendSignalOnOutput("rolledBack"),n&&this.sendSignalOnOutput("timedOut"),(0,o.reportOutcomes)(this,r,s?"unchanged":"done")},reportError:function(e){this._internal.error=e,this.flagOutputDirty("error")},reportFailure:function(e,t){this.reportError(t),(0,o.reportOutcomes)(this,e,"failure",{code:"optimistic-update/operation-failed",message:t})},clearError:function(){void 0!==this._internal.error&&(this._internal.error=void 0,this.flagOutputDirty("error"))},flagStatus:function(){this.flagOutputDirty("isPending"),this.flagOutputDirty("pendingCount"),this.flagOutputDirty("isCommitted"),this.flagOutputDirty("isRolledBack")},_onNodeDeleted:function(){r.prototype._onNodeDeleted.call(this),this.teardown();const e=this._internal.open.slice();this._internal.open.length=0;for(const t of e)t.timer&&(clearTimeout(t.timer),t.timer=null),"commit"===this._internal.onDispose||this.isSuperseded(t)?i.globalStoreManager.commitPatch(t.id):i.globalStoreManager.rollbackPatch(t.id)}}}};e.exports=l},3613(e,t,n){"use strict";const i=n(5162),o=n(6325);function r(e){return e._internal}const s={name:"net.noodl.PatternExtractor",displayNodeName:"Pattern Extractor",category:"Data",color:"data",docs:"https://docs.noodl.net/nodes/data/pattern-extractor",searchTags:["regex","regexp","pattern","extract","match","parse","capture","group","stream"],initialize(){const e=r(this);e.text="",e.pattern="",e.flags="",e.extractAll=!1,e.match=null,e.matches=[],e.groups=[],e.namedGroups={},e.error=""},getInspectInfo(){const e=r(this);return e.error?{type:"text",value:e.error}:{type:"value",value:{pattern:e.pattern,match:e.match,matches:e.matches.length,groups:e.groups}}},inputs:{text:{type:"string",displayName:"Text",description:"The text to search",group:"Data",set(e){r(this).text=null==e?"":String(e)}},pattern:{type:"string",displayName:"Pattern",description:"A JavaScript regular expression without the surrounding slashes; capture groups appear on Groups",group:"Pattern",tooltip:"A JavaScript regular expression, without the surrounding slashes. Capture groups appear on Groups.",set(e){r(this).pattern=null==e?"":String(e)}},flags:{type:"string",displayName:"Flags",description:"Regex flags i, m, s, u and y; g is controlled by Extract All and a g written here is ignored",group:"Pattern",tooltip:"Regex flags: i (ignore case), m (multiline), s (dot matches newline), u (unicode). g is controlled by Extract All.",set(e){r(this).flags=null==e?"":String(e)}},extractAll:{type:"boolean",default:!1,displayName:"Extract All",description:"Collects every match into Matches instead of stopping at the first one",group:"Pattern",set(e){r(this).extractAll=!!e}},extract:{displayName:"Extract",description:"Runs Pattern over Text and reports what it found",group:"Actions",valueChangedToTrue(){this.doExtract(this.beginOutcome())}}},outputs:{match:{type:"string",displayName:"Match",description:"The first match, or blank when nothing matched",group:"Data",get(){return null===r(this).match?"":r(this).match}},matches:{type:"array",displayName:"Matches",description:"Every match when Extract All is on, otherwise just the first",group:"Data",get(){return r(this).matches}},groups:{type:"array",displayName:"Groups",description:"Capture groups of the first match; an optional group that did not participate is a blank string, not a hole",group:"Data",get(){return r(this).groups}},firstGroup:{type:"string",displayName:"First Group",description:"The first capture group of the first match, which is the whole answer for a pattern like (\\d+)%",group:"Data",get(){const e=r(this).groups;return e.length>0?e[0]:""}},namedGroups:{type:"object",displayName:"Named Groups",description:"Named capture groups of the first match, keyed by name",group:"Data",get(){return r(this).namedGroups}},matchCount:{type:"number",displayName:"Match Count",description:"How many matches were found, which is at most one unless Extract All is on",group:"Status",get(){return r(this).matches.length}},error:{type:"string",displayName:"Error",description:"Why the pattern could not be used: it is blank, or it is not a valid regular expression",group:"Status",get(){return r(this).error}},found:{type:"signal",displayName:"Found",description:"Fires when the pattern ran and matched at least once",group:"Events"},notFound:{type:"signal",displayName:"Not Found",description:"Fires when the pattern ran and matched nothing, which is an ordinary outcome rather than a mistake",group:"Events"},...(0,i.outcomeOutputs)({done:"Fires once the extract has run, whether it matched or not — Found and Not Found say which",failure:"Fires when the pattern itself is unusable, which is a bug to fix rather than a result"})},methods:{doExtract(e){const t=r(this),n=(0,o.extractPattern)(t.text,t.pattern,{all:t.extractAll,flags:t.flags});t.match=n.match,t.matches=n.matches,t.groups=n.groups,t.namedGroups=n.namedGroups,t.error=n.ok?"":n.error||"Invalid pattern",this.flagOutputDirty("match"),this.flagOutputDirty("matches"),this.flagOutputDirty("groups"),this.flagOutputDirty("firstGroup"),this.flagOutputDirty("namedGroups"),this.flagOutputDirty("matchCount"),this.flagOutputDirty("error"),n.ok?(this.sendSignalOnOutput(null===n.match?"notFound":"found"),this.reportOutcome(e,"done")):this.reportOutcome(e,"failure",{code:"pattern-extractor/extract-failed",message:t.error})}}};e.exports={node:s}},2232(e,t,n){"use strict";t.SseConnection=t.NM=t.FN=t.Ui=void 0;const i=n(6325);t.Ui=1e3,t.FN=3e4,t.NM=512;class o{constructor(e){this._order=[],this._set=new Set,this._limit=e&&e>0?e:t.NM}has(e){return this._set.has(e)}add(e){if(this._set.has(e))return!1;if(this._set.add(e),this._order.push(e),this._order.length>this._limit){const e=this._order.shift();this._set.delete(e)}return!0}get size(){return this._set.size}clear(){this._order.length=0,this._set.clear()}}class r{constructor(e,t){this._es=null,this._closed=!1,this._everOpen=!1,this._url=e.url,this._withCredentials=!!e.withCredentials,this._eventTypes=e.eventTypes||[],this._EventSource="EventSourceImpl"in e?e.EventSourceImpl:"undefined"!=typeof EventSource?EventSource:null,this._cb=t}open(){if(this._closed)return;if(!this._EventSource)return void this._cb.onFailure("EventSource is not available in this environment",!0);let e;try{e=new this._EventSource(this._url,{withCredentials:this._withCredentials})}catch(e){return void this._cb.onFailure("Could not open EventSource for "+this._url+": "+(0,i.describeError)(e),!0)}this._es=e,e.onopen=()=>{this._closed||(this._everOpen=!0,this._cb.onOpen())},e.onmessage=e=>{this._closed||this._cb.onFrame({event:"message",data:e&&null!=e.data?String(e.data):"",id:s(e)})};for(const t of this._eventTypes)t&&"message"!==t&&e.addEventListener(t,e=>{this._closed||this._cb.onFrame({event:t,data:e&&null!=e.data?String(e.data):"",id:s(e)})});e.onerror=()=>{this._closed||(2!==e.readyState?this._cb.onSelfRetry():this._cb.onFailure(this._everOpen?"The event stream closed and the browser stopped retrying":"Could not open the event stream (check the URL, CORS, and that the response is text/event-stream)",!1))}}close(){this._closed=!0;const e=this._es;if(e){this._es=null,e.onopen=null,e.onmessage=null,e.onerror=null;try{e.close()}catch(e){}}}}function s(e){const t=e&&e.lastEventId;return"string"==typeof t?t:""}class a{constructor(e,t){this._controller=null,this._reader=null,this._closed=!1,this._url=e.url,this._method=(e.method||"GET").toUpperCase(),this._headers=e.headers||{},this._body=e.body,this._withCredentials=!!e.withCredentials,this._lastEventId=e.lastEventId||"",this._fetch="fetchImpl"in e?e.fetchImpl:"undefined"!=typeof fetch?fetch:null,this._AbortController="AbortControllerImpl"in e?e.AbortControllerImpl:"undefined"!=typeof AbortController?AbortController:null,this._cb=t}open(){if(this._closed)return;if(!this._fetch)return void this._cb.onFailure("fetch is not available in this environment",!0);const e={Accept:"text/event-stream","Cache-Control":"no-store"};for(const t in this._headers)void 0!==this._headers[t]&&null!==this._headers[t]&&(e[t]=String(this._headers[t]));this._lastEventId&&(e["Last-Event-ID"]=this._lastEventId);const t={method:this._method,headers:e,credentials:this._withCredentials?"include":"same-origin"};if(void 0!==this._body&&null!==this._body&&"GET"!==this._method&&"HEAD"!==this._method&&("string"==typeof this._body?t.body=this._body:(t.body=JSON.stringify(this._body),function(e){const t="content-type".toLowerCase();for(const n in e)if(n.toLowerCase()===t)return!0;return!1}(e)||(e["Content-Type"]="application/json"))),this._AbortController)try{this._controller=new this._AbortController,t.signal=this._controller.signal}catch(e){this._controller=null}let n;try{n=(0,this._fetch)(this._url,t)}catch(e){return void this._cb.onFailure("Could not start the request: "+(0,i.describeError)(e),!0)}Promise.resolve(n).then(e=>this._onResponse(e)).catch(e=>{this._closed||l(e)||this._cb.onFailure("Stream request failed: "+(0,i.describeError)(e),!1)})}async _onResponse(e){if(this._closed)return;if(!e)return void this._cb.onFailure("The stream request returned no response",!1);if(!1===e.ok||"number"==typeof e.status&&(e.status<200||e.status>=300)){const t=e.status,n="number"==typeof t&&t>=400&&t<500&&408!==t&&429!==t;return void this._cb.onFailure("The stream endpoint returned HTTP "+t,n)}this._cb.onOpen();const t=e.body;if(!t)return void this._cb.onFailure("The response has no readable body; this environment cannot stream fetch responses",!0);let n="";const o="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null,r=e=>{const t="string"==typeof e?e:o&&e?o.decode(e,{stream:!0}):"";if(!t)return;n+=t;const{frames:r,rest:s}=(0,i.parseSseChunk)(n);n=s;for(const e of r){if(this._closed)return;this._cb.onFrame(e)}};try{if("function"==typeof t.getReader){const e=t.getReader();for(this._reader=e;;){const t=await e.read();if(this._closed)return;if(t&&t.done)break;r(t&&t.value)}}else{if("function"!=typeof t[Symbol.asyncIterator])return void this._cb.onFailure("The response body is neither a reader nor async-iterable",!0);for await(const e of t){if(this._closed)return;r(e)}}}catch(e){if(this._closed||l(e))return;return void this._cb.onFailure("The event stream was interrupted: "+(0,i.describeError)(e),!1)}if(!this._closed){if(""!==n.trim()){const{frames:e}=(0,i.parseSseChunk)(n+"\n\n");for(const t of e){if(this._closed)return;this._cb.onFrame(t)}}this._cb.onEnd()}}close(){this._closed=!0;const e=this._controller;if(this._controller=null,e)try{e.abort()}catch(e){}const t=this._reader;if(this._reader=null,t&&"function"==typeof t.cancel)try{const e=t.cancel();e&&"function"==typeof e.catch&&e.catch(()=>{})}catch(e){}}}function l(e){return"AbortError"===(e&&e.name)}function u(e){return"eventsource"===e.transport?"eventsource":"fetch"===e.transport||("fetchImpl"in e?e.fetchImpl:"undefined"!=typeof fetch)?"fetch":("EventSourceImpl"in e?e.EventSourceImpl:"undefined"!=typeof EventSource)?"eventsource":"fetch"}t.SseConnection=class{constructor(e){this._transport=null,this._reconnectTimer=null,this._disposed=!1,this.state="idle",this.retryCount=0,this.lastError="",this.lastEventId="",this.lastEventType="",this.messageCount=0,this.duplicatesSuppressed=0,this.lastMessageTime=0,this._sawEventIds=!1,this._options=e,this._setTimeout=e.setTimeoutImpl||((e,t)=>setTimeout(e,t)),this._clearTimeout=e.clearTimeoutImpl||(e=>clearTimeout(e)),this._now=e.nowImpl||(()=>Date.now()),this._recentIds=new o(e.dedupeWindow)}get transportKind(){return u(this._options)}get connected(){return"open"===this.state}get deliverySemantics(){return this._sawEventIds?!1===this._options.dedupeById?"at-least-once":"at-least-once-deduped":"at-most-once"}hasPendingTimer(){return null!==this._reconnectTimer}connect(){this._disposed||(this._clearReconnectTimer(),this._closeTransport(),this._options.url?(this.retryCount=0,this.lastError="",this._setState("connecting"),this._openTransport()):this._fail("No URL was set on the stream",!0))}disconnect(){if(this._disposed)return!1;this._clearReconnectTimer();const e=null!==this._transport||"connecting"===this.state||"reconnecting"===this.state;return this._closeTransport(),(e||"closed"!==this.state)&&this._setState("closed"),e}dispose(){this._disposed=!0,this._clearReconnectTimer(),this._closeTransport(),this._recentIds.clear()}get disposed(){return this._disposed}_openTransport(){const e=u(this._options),t={onOpen:()=>this._onOpen(),onFrame:e=>this._onFrame(e),onFailure:(e,t)=>this._fail(e,t),onEnd:()=>this._onEnd(),onSelfRetry:()=>this._onSelfRetry()};this._transport="eventsource"===e?new r({url:this._options.url,withCredentials:this._options.withCredentials,eventTypes:this._options.eventTypes,..."EventSourceImpl"in this._options?{EventSourceImpl:this._options.EventSourceImpl}:{}},t):new a({url:this._options.url,method:this._options.method,headers:this._options.headers,body:this._options.body,withCredentials:this._options.withCredentials,lastEventId:this.lastEventId,..."fetchImpl"in this._options?{fetchImpl:this._options.fetchImpl}:{},..."AbortControllerImpl"in this._options?{AbortControllerImpl:this._options.AbortControllerImpl}:{}},t),this._transport.open()}_closeTransport(){const e=this._transport;this._transport=null,e&&e.close()}_clearReconnectTimer(){null!==this._reconnectTimer&&(this._clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}_setState(e){this.state!==e&&(this.state=e,!this._disposed&&this._options.onState&&this._options.onState(e))}_onOpen(){this._disposed||(this.retryCount=0,this.lastError="",this._setState("open"))}_onFrame(e){if(!this._disposed){if(void 0!==e.retry&&(this.serverRetryMs=e.retry),e.id&&(this._sawEventIds=!0,this.lastEventId=e.id,!1!==this._options.dedupeById&&!this._recentIds.add(e.id)))return this.duplicatesSuppressed++,void(this._options.onDuplicate&&this._options.onDuplicate(e));this.messageCount++,this.lastEventType=e.event,this.lastMessageTime=this._now(),this._options.onFrame&&this._options.onFrame(e)}}_onEnd(){this._disposed||(this._closeTransport(),this._options.reconnectOnStreamEnd?this._scheduleReconnect():this._setState("closed"))}_onSelfRetry(){if(this._disposed)return;this.retryCount++;const e=this._options.maxRetries||0;if(e>0&&this.retryCount>e)return this._closeTransport(),void this._fail("Gave up after "+e+" reconnection attempts",!0);this._report("The event stream dropped; the browser is reconnecting"),this._setState("reconnecting")}_fail(e,t){if(this._disposed)return;if(this._report(e),t)return this._closeTransport(),void this._setState("error");if(!1===this._options.autoReconnect)return this._closeTransport(),void this._setState("error");const n=this._options.maxRetries||0;if(n>0&&this.retryCount>=n)return this._closeTransport(),this.lastError=e+" (gave up after "+n+" attempts)",this._options.onError&&this._options.onError(this.lastError),void this._setState("error");this._closeTransport(),this.retryCount++,!this._disposed&&this._options.onRetry&&this._options.onRetry(),this._scheduleReconnect()}_scheduleReconnect(){this._clearReconnectTimer();const e=void 0!==this.serverRetryMs?this.serverRetryMs:this._options.reconnectDelay,n=function(e,n,i){const o=n>0?n:t.Ui,r=i>0?i:t.FN,s=e>0?e:0;return s>30?r:Math.min(r,o*Math.pow(2,s))}(this.retryCount-1>0?this.retryCount-1:0,e,this._options.maxReconnectDelay);this._setState("reconnecting"),this._reconnectTimer=this._setTimeout(()=>{this._reconnectTimer=null,this._disposed||this._openTransport()},n)}_report(e){this.lastError=e,!this._disposed&&this._options.onError&&this._options.onError(e)}}},1691(e,t,n){"use strict";const i=n(5162),o=n(2232),r=n(6325),s=n(7268);function a(e){return e._internal}function l(e,t){const n=a(e).connection;return n?n[t]:0}const u={name:"net.noodl.SSE",displayNodeName:"Server-Sent Events",category:"Data",color:"data",docs:"https://docs.noodl.net/nodes/data/sse",searchTags:["sse","stream","streaming","server-sent","events","eventsource","realtime","agent","ai","chat","tokens"],ssr:{compat:"client-only",note:"An event stream cannot be consumed during a server render; the node connects in the browser after hydration."},initialize(){const e=a(this);e.url="",e.transport="auto",e.method="GET",e.headers=null,e.body=void 0,e.withCredentials=!1,e.eventTypes="",e.textPath="",e.autoConnect=!1,e.autoReconnect=!0,e.reconnectOnStreamEnd=!1,e.reconnectDelay=1e3,e.maxReconnectDelay=3e4,e.maxRetries=0,e.dedupeById=!0,e.connection=null,e.connectionState="idle",e.data=void 0,e.raw="",e.eventType="",e.autoConnectScheduled=!1,e.pendingConnect=null,e.seams={}},getInspectInfo(){const e=a(this),t=e.connection;return e.url?{type:"value",value:{state:e.connectionState,url:e.url,transport:t?t.transportKind:e.transport,retryCount:t?t.retryCount:0,messages:t?t.messageCount:0,duplicatesSuppressed:t?t.duplicatesSuppressed:0,lastEventId:t?t.lastEventId:"",deliverySemantics:t?t.deliverySemantics:"at-most-once",lastEvent:e.data,lastText:(0,r.textForPath)(e.raw,e.data,e.textPath),lastError:t?t.lastError:""}}:{type:"text",value:"[No URL set]"}},inputs:{url:{type:"string",displayName:"URL",description:"Endpoint to stream from; changing it while connected reconnects to the new one",group:"Connection",set(e){a(this).url=null==e?"":String(e),this.scheduleAutoConnect()}},transport:{type:{name:"enum",enums:[{label:"Auto",value:"auto"},{label:"Fetch (headers, POST)",value:"fetch"},{label:"EventSource",value:"eventsource"}]},default:"auto",displayName:"Transport",description:"How the stream is fetched: Fetch carries headers and a body, EventSource lets the browser handle reconnection, Auto prefers Fetch",group:"Connection",set(e){a(this).transport=e||"auto"}},method:{type:{name:"enum",enums:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"}]},default:"GET",displayName:"Method",description:"HTTP method for the request; anything other than GET needs the Fetch transport",group:"Request",set(e){a(this).method=e?String(e):"GET"}},headers:{type:"object",displayName:"Headers",description:"Request headers as an object, for bearer tokens and the like; ignored by the EventSource transport, which cannot set them",group:"Request",set(e){a(this).headers=e&&"object"==typeof e?e:null}},body:{type:"*",displayName:"Body",description:"Request body, sent as JSON unless it is already a string; ignored for GET and HEAD",group:"Request",set(e){a(this).body=e}},withCredentials:{type:"boolean",default:!1,displayName:"With Credentials",description:"Sends cookies and HTTP auth to a cross-origin endpoint, which the server must also allow",group:"Request",set(e){a(this).withCredentials=!!e}},eventTypes:{type:"string",displayName:"Event Types",description:"Comma-separated named event types to subscribe to; only needed for the EventSource transport, as Fetch delivers every type",group:"Connection",tooltip:"Comma-separated named event types to subscribe to. Only needed for the EventSource transport, which delivers a named event only to a listener registered in advance; the Fetch transport delivers every event type.",set(e){a(this).eventTypes=e?String(e):""}},textPath:{type:"string",displayName:"Text Path",description:"Where the text lives inside a JSON payload, as a dot path such as choices.0.delta.content; leave blank for a stream of bare text",group:"Data",tooltip:"Where the text lives inside a JSON payload, as a dot path — for an OpenAI-compatible endpoint, choices.0.delta.content. Leave blank for a stream that sends bare text. Whatever it names ends up on the Text output, which is always a string.",set(e){a(this).textPath=null==e?"":String(e),this.flagOutputDirty("text")}},autoConnect:{type:"boolean",default:!1,displayName:"Auto Connect",description:"Opens the stream as soon as a URL is available, without waiting for a Connect signal",group:"Connection",set(e){a(this).autoConnect=!!e,this.scheduleAutoConnect()}},autoReconnect:{type:"boolean",default:!0,displayName:"Auto Reconnect",description:"Retries after a failure with a growing backoff; turning it off reports the failure and stops",group:"Reconnection",set(e){a(this).autoReconnect=!!e}},reconnectOnStreamEnd:{type:"boolean",default:!1,displayName:"Reconnect On Stream End",description:"Reconnects when the server closes the stream cleanly; off by default because reconnecting an agent stream re-issues the request",group:"Reconnection",tooltip:"Reconnect when the server closes the stream cleanly. Off by default: an agent response stream is finite, and reconnecting would re-issue the request and start the response again.",set(e){a(this).reconnectOnStreamEnd=!!e}},reconnectDelay:{type:"number",default:1e3,displayName:"Reconnect Delay (ms)",description:"First retry delay in milliseconds, doubling per consecutive failure up to Max Reconnect Delay",group:"Reconnection",tooltip:"First retry delay. Doubles per consecutive failure, up to the maximum.",set(e){a(this).reconnectDelay=Number(e)>0?Number(e):1e3}},maxReconnectDelay:{type:"number",default:3e4,displayName:"Max Reconnect Delay (ms)",description:"Ceiling on the backoff in milliseconds, however many failures there have been",group:"Reconnection",set(e){a(this).maxReconnectDelay=Number(e)>0?Number(e):3e4}},maxRetries:{type:"number",default:0,displayName:"Max Retries",description:"Consecutive failures allowed before the connection gives up and reports an error; 0 keeps retrying",group:"Reconnection",tooltip:"0 means keep retrying. Otherwise the connection reports an error after this many consecutive failures.",set(e){a(this).maxRetries=Number(e)>0?Number(e):0}},dedupeById:{type:"boolean",default:!0,displayName:"Dedupe By Id",description:"Drops events whose id has already been seen, so a reconnect that resumes cannot re-deliver messages",group:"Reconnection",tooltip:"Drop events whose id has already been seen, so a reconnect that resumes from the last event id cannot re-deliver messages. Turn off if your server reuses ids for distinct events.",set(e){a(this).dedupeById=!!e}},connect:{displayName:"Connect",description:"Opens the stream, replacing any connection already open and resetting the retry count",group:"Actions",valueChangedToTrue(){this.doConnect(this.beginOutcome())}},disconnect:{displayName:"Disconnect",description:"Closes the stream and stops retrying",group:"Actions",valueChangedToTrue(){const e=this.beginOutcome();this.settleConnect("unchanged"),this.reportOutcome(e,this.doDisconnect()?"done":"unchanged")}}},outputs:{connectionState:{type:"string",displayName:"Connection State",description:"Where the connection is: idle, connecting, open, reconnecting, closed or error",group:"Status",get(){return a(this).connectionState}},connected:{type:"boolean",displayName:"Connected",description:"True only while the stream is open and frames may arrive",group:"Status",get(){return"open"===a(this).connectionState}},lastError:{type:"string",displayName:"Last Error",description:"What went wrong most recently, including the reason a retry was scheduled",group:"Status",get(){const e=a(this).connection;return e?e.lastError:""}},retryCount:{type:"number",displayName:"Retry Count",description:"Consecutive failed attempts in the current outage; back to zero once the stream opens",group:"Status",get(){return l(this,"retryCount")}},onOpen:{type:"signal",displayName:"On Open",description:"Fires when the stream has been established",group:"Events"},onMessage:{type:"signal",displayName:"On Message",description:"Fires once per event, after Data, Raw and Text already hold it",group:"Events"},onError:{type:"signal",displayName:"On Error",description:"Fires when the stream failed or dropped, whether or not a retry is going to follow",group:"Events"},onClose:{type:"signal",displayName:"On Close",description:"Fires when the stream has stopped for good, whether it ended cleanly or gave up",group:"Events"},...(0,i.outcomeOutputs)({done:"Fires when the action finished: a Connect whose stream opened, or a Disconnect that stopped one",unchanged:"Fires when there was nothing to do: a Disconnect with no stream running, or a Connect a later Connect or Disconnect superseded before it opened",failure:"Fires when the stream could not be opened, or gave up retrying. Last Error carries the reason"}),data:{type:"*",displayName:"Data",description:"The event payload, parsed as JSON when it is JSON and handed over as text when it is not",group:"Data",get(){return a(this).data}},raw:{type:"string",displayName:"Raw",description:"The event payload exactly as it arrived, before any parsing",group:"Data",get(){return a(this).raw}},text:{type:"string",displayName:"Text",description:"The one data output guaranteed to be a string: Raw when no Text Path is set, the field at that path when one is, blank when it does not resolve",group:"Data",get(){const e=a(this);return(0,r.textForPath)(e.raw,e.data,e.textPath)}},eventType:{type:"string",displayName:"Event Type",description:"The event name the server sent, or message when it sent none",group:"Data",get(){return a(this).eventType}},lastEventId:{type:"string",displayName:"Last Event Id",description:"The furthest id the server has reported, which is the point a reconnect resumes from",group:"Data",get(){const e=a(this).connection;return e?e.lastEventId:""}},messageCount:{type:"number",displayName:"Message Count",description:"How many events have been delivered on this connection, not counting suppressed duplicates",group:"Status",get(){return l(this,"messageCount")}},lastMessageTime:{type:"number",displayName:"Last Message Time",description:"When the last event arrived, as milliseconds since the epoch; useful for spotting a stalled stream",group:"Status",get(){return l(this,"lastMessageTime")}},duplicatesSuppressed:{type:"number",displayName:"Duplicates Suppressed",description:"How many replayed events Dedupe By Id has dropped on this connection",group:"Status",get(){return l(this,"duplicatesSuppressed")}},deliverySemantics:{type:"string",displayName:"Delivery Semantics",description:"What this stream actually guarantees, derived from whether the server sends ids: at-most-once, at-least-once or at-least-once-deduped",group:"Status",get(){const e=a(this).connection;return e?e.deliverySemantics:"at-most-once"}}},methods:{scheduleAutoConnect(){const e=a(this);e.autoConnectScheduled||(e.autoConnectScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){const e=a(this);if(e.autoConnectScheduled=!1,e.connection&&!e.connection.disposed&&e.connection){if(e.connectedUrl===e.url)return;return this.settleConnect("unchanged"),this.teardownConnection(),void(e.autoConnect&&e.url?this.doConnect():(e.connectionState="idle",this.flagOutputDirty("connectionState"),this.flagOutputDirty("connected"),this.flagOutputDirty("retryCount")))}e.autoConnect&&e.url&&this.doConnect()}))},settleConnect(e,t,n){const i=a(this),o=i.pendingConnect;o&&(i.pendingConnect=null,this.reportOutcome(o,e,"failure"===e?{code:t,message:n}:void 0))},doConnect(e){const t=a(this);this.settleConnect("unchanged"),t.pendingConnect=e||null,this.teardownConnection(),t.connectedUrl=t.url;const n={url:t.url,transport:t.transport,method:t.method,headers:t.headers||void 0,body:t.body,withCredentials:t.withCredentials,eventTypes:t.eventTypes?t.eventTypes.split(",").map(e=>e.trim()).filter(Boolean):[],autoReconnect:t.autoReconnect,reconnectOnStreamEnd:t.reconnectOnStreamEnd,reconnectDelay:t.reconnectDelay,maxReconnectDelay:t.maxReconnectDelay,maxRetries:t.maxRetries,dedupeById:t.dedupeById,onState:e=>this.handleState(e),onFrame:e=>this.handleFrame(e),onError:e=>this.handleError(e),onRetry:()=>this.flagOutputDirty("retryCount"),onDuplicate:()=>this.flagOutputDirty("duplicatesSuppressed"),...t.seams},i=new o.SseConnection(n);t.connection=i,i.connect()},doDisconnect(){const e=a(this).connection;return!!e&&e.disconnect()},teardownConnection(){const e=a(this),t=e.connection;e.connection=null,t&&t.dispose()},handleState(e){if(a(this).connectionState=e,this.flagOutputDirty("connectionState"),this.flagOutputDirty("connected"),this.flagOutputDirty("retryCount"),"open"===e&&this.flagOutputDirty("lastError"),"open"===e&&this.sendSignalOnOutput("onOpen"),"closed"!==e&&"error"!==e||this.sendSignalOnOutput("onClose"),"open"===e&&this.settleConnect("done"),"error"===e){const e=a(this).connection;this.settleConnect("failure","sse/connect-failed",e&&e.lastError||"The stream could not be opened")}},handleFrame(e){const t=a(this);t.raw=e.data,t.data=(0,r.parseJsonOrText)(e.data),t.eventType=e.event,this.flagOutputDirty("data"),this.flagOutputDirty("raw"),this.flagOutputDirty("text"),this.flagOutputDirty("eventType"),this.flagOutputDirty("lastEventId"),this.flagOutputDirty("messageCount"),this.flagOutputDirty("lastMessageTime"),this.flagOutputDirty("deliverySemantics"),this.sendSignalOnOutput("onMessage")},handleError(e){this.flagOutputDirty("lastError"),this.flagOutputDirty("retryCount"),this.flagOutputDirty("duplicatesSuppressed"),this.sendSignalOnOutput("onError")},_onNodeDeleted(){s.prototype._onNodeDeleted.call(this),this.teardownConnection();const e=a(this);e&&(e.pendingConnect=null)}}};e.exports={node:u}},8775(e,t,n){"use strict";t.stateHistoryManager=void 0;const i=n(6086);function o(e,t){if(e.length!==t.length)return!1;const n=new Set(e);for(const e of t)if(!n.has(e))return!1;return!0}function r(e){return null==e||""===e?"app":String(e)}t.stateHistoryManager=new class{constructor(){this.histories=new Map,this.snapshots=new Map,this.now=()=>Date.now()}setClock(e){this.now=e||(()=>Date.now())}attach(e,t,n){const i=r(e);let o=this.histories.get(i);o?this.configure(i,t):(o=this.create(i,t),this.histories.set(i,o)),o.refs++,o.listeners.push(n);let s=!1;const a=o;return()=>{if(s)return;s=!0;const e=a.listeners.indexOf(n);-1!==e&&a.listeners.splice(e,1),a.refs--,a.refs<=0&&this.dispose(a)}}configure(e,t){const n=this.histories.get(r(e));n&&(void 0!==t.maxHistory&&(n.maxHistory=Math.max(2,Math.floor(t.maxHistory)||50),this.trim(n)),void 0!==t.coalesceMs&&(n.coalesceMs=Math.max(0,Number(t.coalesceMs)||0)),void 0!==t.enabled&&this.setEnabled(n.storeName,t.enabled),void 0===t.trackKeys||o(n.trackKeys,t.trackKeys)||(n.trackKeys=t.trackKeys.slice(),n.trackSet=n.trackKeys.length?new Set(n.trackKeys):null,this.resubscribe(n),this.resetEntries(n,"initial","Initial state"),this.notifyChanged(n)))}setEnabled(e,t){const n=this.histories.get(r(e));if(n&&n.enabled!==!!t){if(n.enabled=!!t,n.enabled){const e=n.entries[n.currentIndex],t=this.capture(n);e&&this.sameState(e.snapshot.state,t.state)||this.push(n,{snapshot:t,timestamp:this.now(),changedKeys:[],description:"Resumed",source:"change"})}this.notifyChanged(n)}}undo(e){const t=this.histories.get(r(e));return!t||t.currentIndex<=0?null:this.goTo(t,t.currentIndex-1)}redo(e){const t=this.histories.get(r(e));return!t||t.currentIndex>=t.entries.length-1?null:this.goTo(t,t.currentIndex+1)}jumpTo(e,t){const n=this.histories.get(r(e));if(!n)return null;if(!Number.isFinite(t))return null;const i=Math.floor(t);return i<0||i>=n.entries.length?null:this.goTo(n,i)}clearHistory(e){const t=this.histories.get(r(e));return t?t.entries.length<=1&&t.currentIndex<=0?"unchanged":(this.resetEntries(t,"reset","Cleared"),this.notifyChanged(t),"cleared"):"not-tracking"}isTracking(e){return this.histories.has(r(e))}getHistoryInfo(e){const t=this.histories.get(r(e));if(!t)return null;const n=new Set;for(const e of t.entries)for(const t of e.snapshot.byReference)n.add(t);return{storeName:t.storeName,size:t.entries.length,currentIndex:t.currentIndex,canUndo:t.currentIndex>0,canRedo:t.currentIndex<t.entries.length-1,enabled:t.enabled,byReferenceKeys:Array.from(n).sort(),entries:t.entries.map((e,n)=>({index:n,timestamp:e.timestamp,description:e.description,changedKeys:e.changedKeys.join(","),isCurrent:n===t.currentIndex,partial:e.snapshot.byReference.length>0,byReference:e.snapshot.byReference.join(",")}))}}saveNamedSnapshot(e,t){if("string"!=typeof e||""===e)throw new Error("State Snapshot: a snapshot name is required");const n=i.globalStoreManager.getSnapshot(r(t));return this.snapshots.set(e,n),n}getNamedSnapshot(e){return this.snapshots.get(e)}getSnapshotNames(){return Array.from(this.snapshots.keys())}deleteNamedSnapshot(e){return this.snapshots.delete(e)}restoreNamedSnapshot(e,t){const n=this.snapshots.get(e);if(!n)throw new Error(`State Snapshot: no snapshot named "${e}"`);return i.globalStoreManager.restoreSnapshot(n,{storeName:t&&t.storeName||n.storeName}),n}restoreSnapshotData(e,t){const n="string"==typeof e?JSON.parse(e):e;if(!n||"object"!=typeof n||"object"!=typeof n.state)throw new Error('State Snapshot: snapshot data must be an object with a "state" object');const o=n,s={storeName:r(t&&t.storeName||o.storeName),state:o.state,takenAt:"number"==typeof o.takenAt?o.takenAt:this.now(),revision:"number"==typeof o.revision?o.revision:0,byReference:Array.isArray(o.byReference)?o.byReference:[]};return i.globalStoreManager.restoreSnapshot(s,{storeName:s.storeName}),s}reset(){for(const e of this.histories.values())e.unsubscribe&&e.unsubscribe(),e.unsubscribe=null,e.listeners.length=0,e.entries.length=0;this.histories.clear(),this.snapshots.clear(),this.now=()=>Date.now()}create(e,t){var n;const i=t.trackKeys?t.trackKeys.slice():[],o={storeName:e,entries:[],currentIndex:-1,maxHistory:Math.max(2,Math.floor(null!==(n=t.maxHistory)&&void 0!==n?n:50)||50),trackKeys:i,trackSet:i.length?new Set(i):null,coalesceMs:Math.max(0,Number(t.coalesceMs)||0),enabled:void 0===t.enabled||!!t.enabled,restoring:!1,coalesceBarrier:!0,unsubscribe:null,listeners:[],refs:0};return this.resetEntries(o,"initial","Initial state"),this.resubscribe(o),o}dispose(e){e.unsubscribe&&e.unsubscribe(),e.unsubscribe=null,e.listeners.length=0,e.entries.length=0,e.currentIndex=-1,this.histories.delete(e.storeName)}resubscribe(e){e.unsubscribe&&e.unsubscribe(),e.unsubscribe=i.globalStoreManager.subscribe(e.storeName,t=>this.record(e,t),e.trackKeys)}resetEntries(e,t,n){e.entries=[{snapshot:this.capture(e),timestamp:this.now(),changedKeys:[],description:n,source:t}],e.currentIndex=0,e.coalesceBarrier=!0}capture(e){const t=i.globalStoreManager.getSnapshot(e.storeName),n=e.trackSet;if(!n)return t;const o={};for(const e of Object.keys(t.state))n.has(e)&&(o[e]=t.state[e]);return{storeName:t.storeName,state:o,takenAt:t.takenAt,revision:t.revision,byReference:t.byReference.filter(e=>n.has(e))}}record(e,t){if(!e.enabled||e.restoring)return;const n=this.now(),i=e.entries[e.currentIndex];if(e.coalesceMs>0&&!e.coalesceBarrier&&e.currentIndex>0&&e.currentIndex===e.entries.length-1&&void 0!==i&&"change"===i.source&&n-i.timestamp<=e.coalesceMs&&o(i.changedKeys,t.changedKeys))return i.snapshot=this.capture(e),i.timestamp=n,void this.notifyChanged(e);this.push(e,{snapshot:this.capture(e),timestamp:n,changedKeys:t.changedKeys.slice(),description:"Changed: "+t.changedKeys.join(", "),source:"change"})}push(e,t){e.currentIndex<e.entries.length-1&&(e.entries.length=e.currentIndex+1),e.entries.push(t),e.currentIndex=e.entries.length-1,e.coalesceBarrier=!1,this.trim(e),this.notifyChanged(e)}trim(e){for(;e.entries.length>e.maxHistory&&e.currentIndex>0;)e.entries.shift(),e.currentIndex--;for(;e.entries.length>e.maxHistory&&e.entries.length-1>e.currentIndex;)e.entries.pop()}goTo(e,t){const n=e.entries[t];e.restoring=!0;try{this.restore(e,n)}finally{e.restoring=!1}return e.currentIndex=t,e.coalesceBarrier=!0,this.notifyChanged(e),{index:t,canUndo:e.currentIndex>0,canRedo:e.currentIndex<e.entries.length-1,byReferenceKeys:n.snapshot.byReference.slice()}}restore(e,t){if(!e.trackSet)return void i.globalStoreManager.restoreSnapshot(t.snapshot,{storeName:e.storeName});const n=e.trackSet;i.globalStoreManager.batch(e.storeName,()=>{for(const o of n)o in t.snapshot.state?i.globalStoreManager.setKey(e.storeName,o,(0,i.cloneStoreValue)(t.snapshot.state[o])):i.globalStoreManager.deleteKey(e.storeName,o)})}sameState(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const i of n){if(!(i in t))return!1;if(e[i]!==t[i]&&JSON.stringify(e[i])!==JSON.stringify(t[i]))return!1}return!0}notifyChanged(e){for(const t of e.listeners.slice())try{t()}catch(t){console.error(`[StateHistory:${e.storeName}] listener threw:`,t)}}}},707(e,t,n){"use strict";const i=n(5162),o=n(8775),r=n(7268),s={node:{name:"net.noodl.StateHistory",displayNodeName:"State History",category:"Data",color:"data",usePortAsLabel:"storeName",initialize:function(){this._internal.storeName="app",this._internal.attachedTo=null,this._internal.trackKeyList=[],this._internal.maxHistory=50,this._internal.coalesceMs=0,this._internal.enabled=!0,this._internal.detach=null,this._internal.setupScheduled=!1},nodeScopeDidInitialize:function(){this.scheduleSetup()},getInspectInfo:function(){const e=this.info();if(!e)return"[Not tracking]";const t=[{type:"text",value:`Store: ${e.storeName} — ${e.currentIndex+1}/${e.size}`+(e.enabled?"":" (paused)")}];return e.byReferenceKeys.length&&t.push({type:"text",value:"Undo cannot fully restore these keys — they hold live objects (Collection, Model, function) that a snapshot can only keep by reference: "+e.byReferenceKeys.join(", ")}),t.push({type:"value",value:e.entries}),t},inputs:{storeName:{type:"string",displayName:"Store Name",description:"Names the global store to record; one tracker per store is enough, and two on the same store share one history",group:"Store",default:"app",set:function(e){this._internal.storeName=null==e||""===e?"app":String(e),this.scheduleSetup()}},trackKeys:{type:"string",displayName:"Track Keys",description:"Comma-separated keys to record; leave blank to record the whole store, and note that changing this clears the history",group:"Config",tooltip:"Comma-separated keys to record. Blank records the whole store. Undo then writes only these keys and leaves the rest alone. Changing this clears the history.",set:function(e){var t;this._internal.trackKeys=e,this._internal.trackKeyList=(t=e)?String(t).split(",").map(e=>e.trim()).filter(e=>e.length>0):[],this.scheduleSetup()}},maxHistory:{type:"number",displayName:"Max History",description:"How many entries to keep before the oldest is dropped, never below two and never dropping the current one",group:"Config",default:50,tooltip:"How many entries to keep. The oldest are dropped first. An unbounded history is a memory leak.",set:function(e){this._internal.maxHistory=Number(e),this.scheduleSetup()}},coalesceMs:{type:"number",displayName:"Coalesce (ms)",description:"Window in milliseconds within which successive changes to the same keys fold into one undo step; 0 records every change separately",group:"Config",default:0,tooltip:"Fold successive changes to the same keys within this many milliseconds into one undo step, so typing is one undo rather than one per keystroke. 0 records every change separately.",set:function(e){this._internal.coalesceMs=Number(e),this.scheduleSetup()}},enabled:{type:"boolean",displayName:"Enabled",description:"Turning this off pauses recording and keeps the entries already collected",group:"Config",default:!0,tooltip:"Turning this off pauses recording. The history already collected is kept.",set:function(e){this._internal.enabled=void 0===e||!!e,this.scheduleSetup()}},clearHistory:{displayName:"Clear History",description:"Throws the history away and starts again from the live state",group:"Actions",valueChangedToTrue:function(){const e=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(function(){const t=o.stateHistoryManager.clearHistory(this._internal.storeName);this.refreshOutputs(),this.reportOutcome(e,"cleared"===t?"done":"unchanged")})}}},outputs:{historySize:{type:"number",displayName:"History Size",description:"How many entries the history holds, including the baseline it started from",group:"Status",getter:function(){const e=this.info();return e?e.size:0}},currentIndex:{type:"number",displayName:"Current Index",description:"Where in the history the store is sitting; -1 when nothing is being tracked",group:"Status",getter:function(){const e=this.info();return e?e.currentIndex:-1}},canUndo:{type:"boolean",displayName:"Can Undo",description:"True when there is an earlier entry to step back to",group:"Status",getter:function(){const e=this.info();return!!e&&e.canUndo}},canRedo:{type:"boolean",displayName:"Can Redo",description:"True when an undo has been made and there is a later entry to step forward to",group:"Status",getter:function(){const e=this.info();return!!e&&e.canRedo}},fullyRestorable:{type:"boolean",displayName:"Fully Restorable",description:"False when some entry holds a Collection, a Model or a function, which a snapshot can only keep by reference",group:"Status",getter:function(){const e=this.info();return!e||0===e.byReferenceKeys.length}},byReferenceKeys:{type:"string",displayName:"By-Reference Keys",description:"Comma-separated keys an undo cannot fully restore because they hold live objects rather than data",group:"Status",getter:function(){const e=this.info();return e?e.byReferenceKeys.join(","):""}},history:{type:"array",displayName:"History",description:"One entry per recorded change, each with its index, timestamp, description and changed keys, but not its state",group:"Data",getter:function(){const e=this.info();return e?e.entries:[]}},historyChanged:{type:"signal",displayName:"History Changed",description:"Fires whenever an entry is added, the position moves, or the history is cleared",group:"Events"},...(0,i.outcomeOutputs)({done:"Fires once the history has been thrown away and re-baselined from the live state",unchanged:"Fires when there was nothing to throw away, because the history was already just its baseline"})},methods:{scheduleSetup:function(){this._internal.setupScheduled||(this._internal.setupScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.setupScheduled=!1,this.setupTracking()}))},setupTracking:function(){const e={maxHistory:this._internal.maxHistory,trackKeys:this._internal.trackKeyList,coalesceMs:this._internal.coalesceMs,enabled:this._internal.enabled};if(this._internal.attachedTo===this._internal.storeName)return o.stateHistoryManager.configure(this._internal.storeName,e),void this.refreshOutputs();this.teardown(),this._internal.attachedTo=this._internal.storeName,this._internal.detach=o.stateHistoryManager.attach(this._internal.storeName,e,()=>{this.refreshOutputs(),this.sendSignalOnOutput("historyChanged")}),this.refreshOutputs()},teardown:function(){this._internal.detach&&(this._internal.detach(),this._internal.detach=null),this._internal.attachedTo=null},info:function(){return o.stateHistoryManager.getHistoryInfo(this._internal.storeName)},refreshOutputs:function(){this.flagOutputDirty("historySize"),this.flagOutputDirty("currentIndex"),this.flagOutputDirty("canUndo"),this.flagOutputDirty("canRedo"),this.flagOutputDirty("fullyRestorable"),this.flagOutputDirty("byReferenceKeys"),this.flagOutputDirty("history")},_onNodeDeleted:function(){r.prototype._onNodeDeleted.call(this),this.teardown()}}}};e.exports=s},4255(e,t,n){"use strict";const i=n(5162),o=n(8775),r="state-snapshot/operation-failed",s={node:{name:"net.noodl.StateSnapshot",displayNodeName:"State Snapshot",category:"Data",color:"data",usePortAsLabel:"snapshotName",initialize:function(){this._internal.storeName="app",this._internal.queued=[],this._internal.scheduled=!1},getInspectInfo:function(){const e=this._internal.snapshot;if(!e)return"[No snapshot saved]";const t=[{type:"text",value:`${this._internal.snapshotName} — ${e.storeName}`}];return e.byReference.length&&t.push({type:"text",value:"These keys hold live objects and are kept by reference, so restoring will not undo changes made to them since: "+e.byReference.join(", ")}),t.push({type:"value",value:e.state}),t},inputs:{storeName:{type:"string",displayName:"Store Name",description:"Names the store to snapshot or restore into",group:"Store",default:"app",set:function(e){this._internal.storeName=null==e||""===e?"app":String(e)}},snapshotName:{type:"string",displayName:"Snapshot Name",description:"Name to save this checkpoint under, and the name Restore looks up; required to save",group:"Snapshot",set:function(e){this._internal.snapshotName=e}},snapshotData:{type:"object",displayName:"Snapshot Data",description:"A previously exported Snapshot to restore instead of the named one; leave blank to restore by name",group:"Snapshot",tooltip:'Snapshot to restore instead of the named one — a previously exported "Snapshot" output. Leave blank to restore by name.',set:function(e){this._internal.snapshotData=e}},save:{displayName:"Save",description:"Copies the store as it is now and keeps it under Snapshot Name",group:"Actions",valueChangedToTrue:function(){this.queue("save",this.beginOutcome())}},restore:{displayName:"Restore",description:"Puts a checkpoint back as an ordinary write, so it appears in the history and can itself be undone",group:"Actions",valueChangedToTrue:function(){this.queue("restore",this.beginOutcome())}}},outputs:{snapshot:{type:"object",displayName:"Snapshot",description:"The checkpoint just saved or restored, as plain data that can be written to a file and fed back into Snapshot Data",group:"Data",getter:function(){return this._internal.snapshot}},fullyRestorable:{type:"boolean",displayName:"Fully Restorable",description:"False when the checkpoint holds a Collection, a Model or a function, which it can only keep by reference",group:"Status",getter:function(){const e=this._internal.snapshot;return!e||0===e.byReference.length}},byReferenceKeys:{type:"string",displayName:"By-Reference Keys",description:"Comma-separated keys the checkpoint holds as live objects, so restoring will not undo changes made to them since",group:"Status",getter:function(){const e=this._internal.snapshot;return e?e.byReference.join(","):""}},saved:{type:"signal",displayName:"Saved",description:"Fires once the checkpoint has been taken and Snapshot holds it",group:"Events"},restored:{type:"signal",displayName:"Restored",description:"Fires once the store holds the checkpoint again",group:"Events"},...(0,i.outcomeOutputs)({done:"Fires once a Save or Restore you triggered has finished, whichever of the two it was",failure:"Fires when the checkpoint could not be saved or put back, most often an unnamed or unknown checkpoint"}),error:{type:"string",displayName:"Error",description:"Why the last save or restore failed; blank once one succeeds",group:"Error",getter:function(){return this._internal.error}}},methods:{queue:function(e,t){this._internal.queued.push({action:e,token:t}),this._internal.scheduled||(this._internal.scheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.scheduled=!1,this.runQueued()}))},runQueued:function(){const e=this._internal.queued;this._internal.queued=[];for(const t of e)"save"===t.action?this.doSave(t.token):this.doRestore(t.token)},doSave:function(e){try{const t=o.stateHistoryManager.saveNamedSnapshot(this._internal.snapshotName,this._internal.storeName);this.adopt(t),this.setError(void 0),this.sendSignalOnOutput("saved"),this.reportOutcome(e,"done")}catch(t){this.setError(String(t.message||t),e)}},doRestore:function(e){try{const t=this._internal.snapshotData,n=null!=t&&""!==t?o.stateHistoryManager.restoreSnapshotData(t,{storeName:this._internal.storeName}):o.stateHistoryManager.restoreNamedSnapshot(this._internal.snapshotName,{storeName:this._internal.storeName});this.adopt(n),this.setError(void 0),this.sendSignalOnOutput("restored"),this.reportOutcome(e,"done")}catch(t){this.setError(String(t.message||t),e)}},adopt:function(e){this._internal.snapshot=e,this.flagOutputDirty("snapshot"),this.flagOutputDirty("fullyRestorable"),this.flagOutputDirty("byReferenceKeys")},setError:function(e,t){const n=this._internal.error===e;n||(this._internal.error=e,this.flagOutputDirty("error"),void 0!==e&&this.raiseRuntimeError(r,e)),void 0!==e&&(t?this.reportOutcome(t,"failure",{code:r,message:e,raise:!1}):n||this.sendSignalOnOutput("failure"))}}}};e.exports=s},4955(e,t,n){"use strict";const i=n(5162),o=n(7268);function r(e){return e._internal}const s={name:"net.noodl.StreamBuffer",displayNodeName:"Stream Buffer",category:"Data",color:"data",docs:"https://docs.noodl.net/nodes/data/stream-buffer",searchTags:["buffer","batch","throttle","stream","queue","flush","debounce","agent","streaming"],ssr:{compat:"partial",note:"Interval-based flushing needs a running timer, so it only happens in the browser. Add, Flush and size-based flushing behave normally."},initialize(){const e=r(this);e.pendingData=void 0,e.hasPendingData=!1,e.buffer=[],e.flushedData=[],e.flushCount=0,e.droppedItems=0,e.flushSize=0,e.flushInterval=0,e.maxSize=1e4,e.timer=null,e.seams={}},getInspectInfo(){const e=r(this);return{type:"value",value:{buffered:e.buffer.length,flushes:e.flushCount,lastFlushSize:e.flushedData.length,droppedItems:e.droppedItems,intervalRunning:null!==e.timer}}},inputs:{data:{type:"*",displayName:"Data",description:"The next item to buffer, of any type; its value is retained between pulses of Add",group:"Data",set(e){const t=r(this);t.pendingData=e,t.hasPendingData=!0}},flushSize:{type:"number",default:0,displayName:"Flush Size",description:"Flush automatically once this many items are buffered; 0 disables size-based flushing",group:"Config",tooltip:"Flush automatically once this many items are buffered. 0 disables size-based flushing.",set(e){r(this).flushSize=Number(e)>0?Number(e):0}},flushInterval:{type:"number",default:0,displayName:"Flush Interval (ms)",description:"Flush automatically this often in milliseconds while items are buffered; 0 disables interval flushing",group:"Config",tooltip:"Flush automatically this often while items are buffered. 0 disables interval flushing.",set(e){const t=r(this),n=Number(e)>0?Number(e):0;n!==t.flushInterval&&(t.flushInterval=n,this.stopTimer(),t.buffer.length>0&&this.armTimer())}},maxSize:{type:"number",default:1e4,displayName:"Max Size",description:"Hard cap on buffered items; overflow drops the oldest and is counted on Dropped Items; 0 means no cap",group:"Config",tooltip:"Hard cap on buffered items. Overflow drops the oldest and is reported on Dropped Items. 0 means no cap.",set(e){r(this).maxSize=Number(e)>=0?Number(e):0}},add:{displayName:"Add",description:"Buffers the current Data, flushing straight away if that reaches Flush Size",group:"Actions",valueChangedToTrue(){this.addItem(this.beginOutcome())}},flush:{displayName:"Flush",description:"Hands the whole buffer to Flushed Data now; an empty buffer is a legitimate no-op",group:"Actions",valueChangedToTrue(){this.doFlush(this.beginOutcome())}},clear:{displayName:"Clear",description:"Discards the buffer and resets both counters without flushing",group:"Actions",valueChangedToTrue(){this.clearBuffer(this.beginOutcome())}}},outputs:{buffer:{type:"array",displayName:"Buffer",description:"Items waiting to be flushed, oldest first",group:"Data",get(){return r(this).buffer}},bufferSize:{type:"number",displayName:"Buffer Size",description:"How many items are waiting, which is what Flush Size is compared against",group:"Status",get(){return r(this).buffer.length}},flushedData:{type:"array",displayName:"Flushed Data",description:"The batch handed over by the most recent flush; a stable array that later Adds do not mutate",group:"Data",get(){return r(this).flushedData}},flushCount:{type:"number",displayName:"Flush Count",description:"How many flushes have happened since the last Clear",group:"Status",get(){return r(this).flushCount}},droppedItems:{type:"number",displayName:"Dropped Items",description:"How many items Max Size has discarded from the front since the last Clear",group:"Status",get(){return r(this).droppedItems}},flushed:{type:"signal",displayName:"Flushed",description:"Fires once Flushed Data holds a new batch, and not for a flush that found nothing",group:"Events"},overflowed:{type:"signal",displayName:"Overflowed",description:"Fires when Max Size has just discarded something",group:"Events"},cleared:{type:"signal",displayName:"Cleared",description:"Fires once the buffer has been discarded",group:"Events"},...(0,i.outcomeOutputs)({done:"Fires once an Add, Flush or Clear you triggered has changed the buffer",unchanged:"Fires when a Flush found nothing to send, or a Clear found nothing to discard — an idle buffer doing exactly what it should",failure:"Fires when Add ran before any value had arrived on Data, so nothing was buffered"}),error:{type:"string",displayName:"Error",description:"Why the last Add was refused; blank until one is",group:"Error",getter(){return r(this).lastError}}},methods:{addItem(e){const t=r(this);if(!t.hasPendingData)return this.reportFailure("stream-buffer/no-data","Nothing to add — no value has arrived on the Data input",e);if(t.buffer.push(t.pendingData),t.maxSize>0&&t.buffer.length>t.maxSize){const e=t.buffer.length-t.maxSize;t.buffer.splice(0,e),t.droppedItems+=e,this.flagOutputDirty("droppedItems"),this.sendSignalOnOutput("overflowed")}this.flagOutputDirty("buffer"),this.flagOutputDirty("bufferSize"),t.flushSize>0&&t.buffer.length>=t.flushSize?this.doFlush(e):(this.armTimer(),e&&this.reportOutcome(e,"done"))},reportFailure(e,t,n){r(this).lastError=t,this.flagOutputDirty("error"),n?this.reportOutcome(n,"failure",{code:e,message:t}):(this.raiseRuntimeError(e,t),this.sendSignalOnOutput("failure"))},doFlush(e){const t=r(this);this.stopTimer(),0!==t.buffer.length?(t.flushedData=t.buffer,t.buffer=[],t.flushCount++,this.flagOutputDirty("flushedData"),this.flagOutputDirty("buffer"),this.flagOutputDirty("bufferSize"),this.flagOutputDirty("flushCount"),this.sendSignalOnOutput("flushed"),e&&this.reportOutcome(e,"done")):e&&this.reportOutcome(e,"unchanged")},clearBuffer(e){const t=r(this);this.stopTimer();const n=t.buffer.length>0||t.flushedData.length>0||t.droppedItems>0||t.flushCount>0;t.buffer=[],t.flushedData=[],t.droppedItems=0,t.flushCount=0,this.flagOutputDirty("buffer"),this.flagOutputDirty("bufferSize"),this.flagOutputDirty("flushedData"),this.flagOutputDirty("flushCount"),this.flagOutputDirty("droppedItems"),this.sendSignalOnOutput("cleared"),e&&this.reportOutcome(e,n?"done":"unchanged")},armTimer(){const e=r(this);if(e.flushInterval<=0)return;if(null!==e.timer)return;const t=e.seams.setTimeoutImpl||((e,t)=>setTimeout(e,t));e.timer=t(()=>{e.timer=null,this.doFlush()},e.flushInterval)},stopTimer(){const e=r(this);null!==e.timer&&((e.seams.clearTimeoutImpl||(e=>clearTimeout(e)))(e.timer),e.timer=null)},_onNodeDeleted(){o.prototype._onNodeDeleted.call(this),this.stopTimer();const e=r(this);e.buffer=[],e.flushedData=[]}}};e.exports={node:s}},6325(e,t){"use strict";function n(e,t){const n=e[t];if("{"===n||"["===n){let n=0,i=!1,o=!1;for(let r=t;r<e.length;r++){const t=e[r];if(i)o?o=!1:"\\"===t?o=!0:'"'===t&&(i=!1);else if('"'===t)i=!0;else if("{"===t||"["===t)n++;else if(("}"===t||"]"===t)&&(n--,0===n))return r+1}return-1}if('"'===n){let n=!1;for(let i=t+1;i<e.length;i++){const t=e[i];if(n)n=!1;else if("\\"===t)n=!0;else if('"'===t)return i+1}return-1}for(let n=t;n<e.length;n++){const t=e[n];if(" "===t||"\t"===t||"\n"===t||"\r"===t||","===t||"}"===t||"]"===t)return n}return-1}function i(e){try{return{ok:!0,value:JSON.parse(e)}}catch(e){return{ok:!1,error:s(e)}}}function o(e){return Array.prototype.slice.call(e,1).map(e=>void 0===e?"":e)}function r(e){const t={},n=e.groups;if(n)for(const e in n)t[e]=void 0===n[e]?"":n[e];return t}function s(e){if(e instanceof Error)return e.message;if("string"==typeof e)return e;try{return String(e)}catch{return"Unknown error"}}t.parseSseChunk=function(e){const t=[];let n,i=65279===e.charCodeAt(0)?1:0,o=i,r="",s=null,a="";const l=()=>{if(null===s)return r="",void(n=void 0);t.push({event:r||"message",data:s.endsWith("\n")?s.slice(0,-1):s,id:a,...void 0!==n?{retry:n}:{}}),r="",s=null,n=void 0};for(;i<e.length;){let u=-1,c=-1;for(let n=i;n<e.length;n++){const i=e.charCodeAt(n);if(10===i){u=n,c=n+1;break}if(13===i){if(n+1>=e.length)return{frames:t,rest:e.slice(o)};u=n,c=10===e.charCodeAt(n+1)?n+2:n+1;break}}if(-1===u)break;const d=e.slice(i,u);if(i=c,0===d.length){l(),o=i;continue}if(58===d.charCodeAt(0))continue;const p=d.indexOf(":"),h=-1===p?d:d.slice(0,p);let f=-1===p?"":d.slice(p+1);32===f.charCodeAt(0)&&(f=f.slice(1)),"event"===h?r=f:"data"===h?s=null===s?f+"\n":s+f+"\n":"id"===h?-1===f.indexOf("\0")&&(a=f):"retry"===h&&/^\d+$/.test(f)&&(n=parseInt(f,10))}return{frames:t,rest:e.slice(o)}},t.splitDelimited=function(e,t){if(!t)return{messages:[],rest:e};const n=e.split(t),i=n.pop();return{messages:n,rest:i}},t.scanJsonValues=function(e,t){const i=!1!==(null==t?void 0:t.arrayFraming),o=[],r=[];let a=0;for(;a<e.length;){for(;a<e.length;){const t=e[a];if(" "===t||"\t"===t||"\n"===t||"\r"===t)a++;else{if(!i||","!==t&&"["!==t&&"]"!==t)break;a++}}if(a>=e.length)return{values:o,rest:"",errors:r};const t=n(e,a);if(-1===t)return{values:o,rest:e.slice(a),errors:r};const l=e.slice(a,t);try{o.push(JSON.parse(l))}catch(e){r.push("Could not parse JSON value: "+s(e))}a=t>a?t:a+1}return{values:o,rest:"",errors:r}},t.tryParseJson=i,t.parseJsonOrText=function(e){const t=e.trim();if(""===t)return e;const n=t.charCodeAt(0);if(!(123===n||91===n||34===n||45===n||n>=48&&n<=57||"true"===t||"false"===t||"null"===t))return e;const o=i(t);return o.ok?o.value:e},t.extractPattern=function(e,t,n){const i={ok:!0,match:null,matches:[],groups:[],namedGroups:{}};if(!t)return{ok:!1,error:"A pattern is required; set the Pattern input to a regular expression",match:null,matches:[],groups:[],namedGroups:{}};const a=((null==n?void 0:n.flags)||"").replace(/[^imsuy]/g,""),l=(null==n?void 0:n.all)?a+"g":a;let u;try{u=new RegExp(t,l)}catch(e){return{ok:!1,error:s(e),match:null,matches:[],groups:[],namedGroups:{}}}if("string"!=typeof e||""===e)return i;if(null==n?void 0:n.all){const t=Array.from(e.matchAll(u));if(0===t.length)return i;const n=t[0];return{ok:!0,match:n[0],matches:t.map(e=>e[0]),groups:o(n),namedGroups:r(n)}}const c=u.exec(e);return c?{ok:!0,match:c[0],matches:[c[0]],groups:o(c),namedGroups:r(c)}:i},t.utf8ByteLength=function(e){let t=0;for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);if(i<128)t+=1;else if(i<2048)t+=2;else if(i>=55296&&i<=56319){const i=e.charCodeAt(n+1);i>=56320&&i<=57343?(t+=4,n++):t+=3}else t+=3}return t},t.truncateHead=function(e,t){return!(t>0)||e.length<=t?{text:e,dropped:0}:{text:e.slice(e.length-t),dropped:e.length-t}},t.textForPath=function(e,t,n){if(!n)return e;const i=function(e,t){const n=function(e){return e?e.replace(/\[(\d+)\]/g,".$1").split(".").map(e=>e.trim()).filter(e=>""!==e):[]}(t);let i=e;for(const e of n){if(null===i||"object"!=typeof i)return;if("__proto__"===e||"constructor"===e||"prototype"===e)return;i=i[e]}return i}(t,n),o=typeof i;return"string"===o?i:"number"===o||"boolean"===o?String(i):""},t.describeError=s},5148(e,t,n){"use strict";const i=n(5162),o=n(6325);function r(e){return e._internal}const s="text-accumulator-chunk-not-text",a="text-accumulator/chunk-not-text",l={name:"net.noodl.TextAccumulator",displayNodeName:"Text Accumulator",category:"Data",color:"data",docs:"https://docs.noodl.net/nodes/data/text-accumulator",searchTags:["stream","accumulate","buffer","chunk","tokens","concat","agent","ai","streaming"],initialize(){const e=r(this);e.pendingChunk="",e.buffer="",e.messages=[],e.lastMessage="",e.delimiter="\n",e.maxLength=1048576,e.maxMessages=1e3,e.droppedCharacters=0,e.droppedMessages=0,e.error=""},getInspectInfo(){const e=r(this);return e.error?{type:"text",value:e.error}:{type:"value",value:{characters:e.buffer.length,messages:e.messages.length,lastMessage:e.lastMessage,droppedCharacters:e.droppedCharacters,droppedMessages:e.droppedMessages}}},inputs:{chunk:{type:"string",displayName:"Chunk",description:"The next fragment of text to append; wire a stream Text output, not its Data output, which is JSON-parsed and is usually an object",group:"Data",set(e){const t=r(this),n=typeof e;if(null==e)t.pendingChunk="";else if("string"===n)t.pendingChunk=e;else{if("number"!==n&&"boolean"!==n&&"bigint"!==n)return t.pendingChunk="",void this.reportChunkError(function(e){return`Chunk must be text, but ${Array.isArray(e)?"an array":e instanceof Date?"a Date":"object"==typeof e?"an object":"a "+typeof e} arrived, so nothing was appended. A stream's Data output is JSON-parsed and is an object for a payload like {"delta":"Hi"} — wire the stream's Text output instead (set its Text Path for a JSON payload), or a Function node that picks the string field out of Data.`}(e));t.pendingChunk=String(e)}this.clearChunkError()}},delimiter:{type:"string",default:"\n",displayName:"Delimiter",description:"Message boundary to split complete messages off; leave empty to accumulate everything, which is what a token stream wants",group:"Config",tooltip:"Message boundary. Leave empty to accumulate everything without splitting — the mode a token stream wants.",set(e){r(this).delimiter=null==e?"":String(e)}},maxLength:{type:"number",default:1048576,displayName:"Max Length (characters)",description:"Cap on the pending buffer in characters; overflow drops the oldest and is counted on Dropped Characters",group:"Config",tooltip:"Cap on the pending buffer. Overflow drops the oldest characters and is reported on Dropped Characters.",set(e){r(this).maxLength=Number(e)>0?Number(e):0}},maxMessages:{type:"number",default:1e3,displayName:"Max Messages",description:"Cap on retained complete messages, oldest dropped first; 0 keeps them all, which grows forever",group:"Config",tooltip:"Cap on retained complete messages; the oldest are dropped first. 0 keeps them all, which grows forever.",set(e){r(this).maxMessages=Number(e)>=0?Number(e):0}},add:{displayName:"Add",description:"Appends the current Chunk, which is retained between pulses, so a second Add with no new chunk appends it again",group:"Actions",valueChangedToTrue(){this.addChunk(this.beginOutcome())}},clear:{displayName:"Clear",description:"Empties the buffer, the messages and both dropped counts",group:"Actions",valueChangedToTrue(){this.clearBuffer(this.beginOutcome())}}},outputs:{accumulated:{type:"string",displayName:"Accumulated",description:"Everything appended since the last Clear that has not yet been split off as a complete message",group:"Data",get(){return r(this).buffer}},messages:{type:"array",displayName:"Messages",description:"Complete messages split off the delimiter, oldest first, capped at Max Messages",group:"Data",get(){return r(this).messages}},lastMessage:{type:"string",displayName:"Last Message",description:"The most recent complete message, which is what a chat surface usually wants",group:"Data",get(){return r(this).lastMessage}},messageCount:{type:"number",displayName:"Message Count",description:"How many complete messages are being retained, which is not how many have arrived",group:"Status",get(){return r(this).messages.length}},characterCount:{type:"number",displayName:"Character Count",description:"Length of Accumulated in characters",group:"Status",get(){return r(this).buffer.length}},byteCount:{type:"number",displayName:"Byte Count (UTF-8)",description:"Length of Accumulated in UTF-8 bytes, which differs from Character Count for anything outside ASCII",group:"Status",get(){return(0,o.utf8ByteLength)(r(this).buffer)}},droppedCharacters:{type:"number",displayName:"Dropped Characters",description:"How many characters Max Length has discarded from the front since the last Clear",group:"Status",get(){return r(this).droppedCharacters}},droppedMessages:{type:"number",displayName:"Dropped Messages",description:"How many complete messages Max Messages has discarded since the last Clear",group:"Status",get(){return r(this).droppedMessages}},error:{type:"string",displayName:"Error",description:"Why the last chunk was refused; blank once a chunk of text arrives",group:"Status",get(){return r(this).error}},messageReceived:{type:"signal",displayName:"Message Received",description:"Fires once per Add that completed at least one message, not once per message",group:"Events"},changed:{type:"signal",displayName:"Changed",description:"Fires whenever an Add appended something, which is the cue to redraw",group:"Events"},cleared:{type:"signal",displayName:"Cleared",description:"Fires once the buffer and the messages have been emptied",group:"Events"},overflowed:{type:"signal",displayName:"Overflowed",description:"Fires when Max Length or Max Messages has just discarded something",group:"Events"},...(0,i.outcomeOutputs)({done:"Fires once an Add or Clear you triggered has changed the buffer",unchanged:"Fires when an Add had no text to append — an empty chunk, or one already refused — or a Clear found nothing to discard",failure:"Fires when a chunk was not text and nothing was appended, which usually means the wrong stream output is wired"})},methods:{reportChunkError(e,t){const n=r(this),i=n.error===e;if(i||(n.error=e,this.flagOutputDirty("error")),t&&this.reportOutcome(t,"failure",{code:a,message:e,raise:!i&&void 0}),i)return;t||(this.sendSignalOnOutput("failure"),this.raiseRuntimeError(a,e));const o=this.context&&this.context.editorConnection;o&&this.nodeScope&&this.nodeScope.componentOwner&&o.sendWarning(this.nodeScope.componentOwner.name,this.id,s,{showGlobally:!0,message:e})},clearChunkError(){const e=r(this);if(!e.error)return;e.error="",this.flagOutputDirty("error");const t=this.context&&this.context.editorConnection;t&&this.nodeScope&&this.nodeScope.componentOwner&&t.clearWarning(this.nodeScope.componentOwner.name,this.id,s)},addChunk(e){const t=r(this),n=t.pendingChunk;if(""===n)return void(e&&this.reportOutcome(e,"unchanged"));t.buffer+=n;const i=(0,o.truncateHead)(t.buffer,t.maxLength);t.buffer=i.text,i.dropped>0&&(t.droppedCharacters+=i.dropped,this.flagOutputDirty("droppedCharacters"),this.sendSignalOnOutput("overflowed"));const s=(0,o.splitDelimited)(t.buffer,t.delimiter);if(t.buffer=s.rest,s.messages.length>0){t.messages=t.messages.concat(s.messages),t.lastMessage=s.messages[s.messages.length-1];const e=t.maxMessages;if(e>0&&t.messages.length>e){const n=t.messages.length-e;t.messages=t.messages.slice(n),t.droppedMessages+=n,this.flagOutputDirty("droppedMessages"),this.sendSignalOnOutput("overflowed")}this.flagOutputDirty("messages"),this.flagOutputDirty("lastMessage"),this.flagOutputDirty("messageCount")}this.flagOutputDirty("accumulated"),this.flagOutputDirty("characterCount"),this.flagOutputDirty("byteCount"),s.messages.length>0&&this.sendSignalOnOutput("messageReceived"),this.sendSignalOnOutput("changed"),e&&this.reportOutcome(e,"done")},clearBuffer(e){const t=r(this),n=t.buffer.length>0||t.messages.length>0||t.droppedCharacters>0||t.droppedMessages>0||!!t.error;t.buffer="",t.messages=[],t.lastMessage="",t.droppedCharacters=0,t.droppedMessages=0,this.clearChunkError(),this.flagOutputDirty("accumulated"),this.flagOutputDirty("messages"),this.flagOutputDirty("lastMessage"),this.flagOutputDirty("messageCount"),this.flagOutputDirty("characterCount"),this.flagOutputDirty("byteCount"),this.flagOutputDirty("droppedCharacters"),this.flagOutputDirty("droppedMessages"),this.sendSignalOnOutput("cleared"),e&&this.reportOutcome(e,n?"done":"unchanged")}}};e.exports={node:l}},774(e,t,n){"use strict";const i=n(5162),o=n(8775),r="undo/operation-failed",s={node:{name:"net.noodl.StateHistory.Undo",displayNodeName:"Undo / Redo",category:"Data",color:"data",usePortAsLabel:"storeName",initialize:function(){this._internal.storeName="app",this._internal.targetIndex=0,this._internal.queued=[],this._internal.scheduled=!1,this._internal.byReferenceKeys=""},getInspectInfo:function(){const e=o.stateHistoryManager.getHistoryInfo(this._internal.storeName);return e?[{type:"text",value:`${e.storeName}: at ${e.currentIndex+1}/${e.size}`+(e.canUndo?", can undo":"")+(e.canRedo?", can redo":"")}]:`[Nothing is tracking "${this._internal.storeName}"]`},inputs:{storeName:{type:"string",displayName:"Store Name",description:"Names the store to step through; a State History node must already be tracking it",group:"Store",default:"app",set:function(e){this._internal.storeName=null==e||""===e?"app":String(e)}},targetIndex:{type:"number",displayName:"Target Index",description:"Entry to move to when Jump To is signalled, counting from zero; ignored by Undo and Redo",group:"Jump",default:0,set:function(e){this._internal.targetIndex=Number(e)}},undo:{displayName:"Undo",description:"Steps the store back one entry, or fires Unchanged when it is already at the beginning",group:"Actions",valueChangedToTrue:function(){this.queue("undo")}},redo:{displayName:"Redo",description:"Steps the store forward one entry, or fires Unchanged when it is already at the end",group:"Actions",valueChangedToTrue:function(){this.queue("redo")}},jumpTo:{displayName:"Jump To",description:"Moves the store to the entry named by Target Index",group:"Actions",valueChangedToTrue:function(){this.queue("jumpTo")}}},outputs:{undone:{type:"signal",displayName:"Undone",description:"Fires when a step back actually happened, and not when the history was already at its beginning",group:"Events"},redone:{type:"signal",displayName:"Redone",description:"Fires when a step forward actually happened, and not when the history was already at its end",group:"Events"},jumped:{type:"signal",displayName:"Jumped",description:"Fires once the store holds the entry Target Index named",group:"Events"},fullyRestorable:{type:"boolean",displayName:"Fully Restorable",description:"False when the entry just restored held live objects a snapshot could only keep by reference",group:"Status",getter:function(){return""===this._internal.byReferenceKeys}},byReferenceKeys:{type:"string",displayName:"By-Reference Keys",description:"Comma-separated keys the restored entry put back as the same live object rather than as a copy",group:"Status",getter:function(){return this._internal.byReferenceKeys}},...(0,i.outcomeOutputs)({done:"Fires when the step actually moved the store",unchanged:"Fires when the history had nowhere to go — an Undo at the beginning or a Redo at the end. Not a failure: this is an ordinary end-stop, and it used to be silent",failure:"Fires when the step could not be made, because nothing is tracking the store or Target Index is outside the history"}),error:{type:"string",displayName:"Error",description:"Why the last step failed; blank once one succeeds",group:"Error",getter:function(){return this._internal.error}}},methods:{queue:function(e){this._internal.queued.push({action:e,outcome:this.beginOutcome()}),this._internal.scheduled||(this._internal.scheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){this._internal.scheduled=!1,this.runQueued()}))},runQueued:function(){const e=this._internal.queued;if(this._internal.queued=[],!o.stateHistoryManager.isTracking(this._internal.storeName)){const t=`No State History node is tracking store "${this._internal.storeName}"`;this.setError(t);for(const n of e)this.reportOutcome(n.outcome,"failure",{code:r,message:t});return}for(const t of e)if("undo"===t.action)this.report(t.outcome,"undone",o.stateHistoryManager.undo(this._internal.storeName));else if("redo"===t.action)this.report(t.outcome,"redone",o.stateHistoryManager.redo(this._internal.storeName));else{const e=this._internal.targetIndex,n=o.stateHistoryManager.jumpTo(this._internal.storeName,e);if(null===n){const n=`Target index ${e} is outside the history`;this.setError(n),this.reportOutcome(t.outcome,"failure",{code:r,message:n});continue}this.report(t.outcome,"jumped",n)}},report:function(e,t,n){null!==n?(this.setError(void 0),this._internal.byReferenceKeys=n.byReferenceKeys.join(","),this.flagOutputDirty("byReferenceKeys"),this.flagOutputDirty("fullyRestorable"),this.sendSignalOnOutput(t),this.reportOutcome(e,"done")):this.reportOutcome(e,"unchanged")},setError:function(e){this._internal.error!==e&&(this._internal.error=e,this.flagOutputDirty("error"))}}}};e.exports=s},4502(e,t){"use strict";t.WebSocketConnection=t.DEFAULT_MAX_QUEUE_SIZE=t.DEFAULT_MAX_RETRIES=t.DEFAULT_MAX_RECONNECT_DELAY=t.DEFAULT_RECONNECT_DELAY=t.nm=t.Ds=t.Gf=t.A7=t.FT=void 0,t.FT="websocket/nothing-to-send",t.A7="websocket/not-connected",t.Gf="websocket/queue-full",t.Ds="websocket/encode-failed",t.nm="websocket/send-failed",t.DEFAULT_RECONNECT_DELAY=1e3,t.DEFAULT_MAX_RECONNECT_DELAY=3e4,t.DEFAULT_MAX_RETRIES=10,t.DEFAULT_MAX_QUEUE_SIZE=100;const n=1006,i=[1002,1003,1007,1008,1009,1010,1015];function o(e){return-1!==i.indexOf(e)}function r(e){return"string"==typeof e?e:"object"==typeof e?JSON.stringify(e):String(e)}t.WebSocketConnection=class{constructor(e={}){this.state="idle",this.connected=!1,this.retryCount=0,this.lastError="",this.queueSize=0,this.droppedCount=0,this.latency=0,this.closeCode=0,this.closeReason="",this._socket=null,this._reconnectTimer=null,this._heartbeatTimer=null,this._pendingPingAt=0,this._queue=[],this._disposed=!1,this._intentionalClose=!1,this._hasEverOpened=!1,this._config={url:e.url||"",protocols:e.protocols||[],autoReconnect:!1!==e.autoReconnect,reconnectDelay:void 0!==e.reconnectDelay?e.reconnectDelay:t.DEFAULT_RECONNECT_DELAY,maxReconnectDelay:void 0!==e.maxReconnectDelay?e.maxReconnectDelay:t.DEFAULT_MAX_RECONNECT_DELAY,maxRetries:void 0!==e.maxRetries?e.maxRetries:t.DEFAULT_MAX_RETRIES,jitter:!1!==e.jitter,heartbeatInterval:e.heartbeatInterval||0,heartbeatMessage:void 0!==e.heartbeatMessage?e.heartbeatMessage:"ping",heartbeatReply:void 0!==e.heartbeatReply?e.heartbeatReply:"pong",sendWhenDisconnected:e.sendWhenDisconnected||"queue",maxQueueSize:void 0!==e.maxQueueSize?e.maxQueueSize:t.DEFAULT_MAX_QUEUE_SIZE,messageEncoding:e.messageEncoding||"auto"},this._callbacks={onStatus:e.onStatus,onOpen:e.onOpen,onMessage:e.onMessage,onError:e.onError,onClose:e.onClose,onSent:e.onSent},this._WebSocket="WebSocketImpl"in e?e.WebSocketImpl:"undefined"!=typeof WebSocket?WebSocket:null,this._setTimeout=e.setTimeoutImpl||((e,t)=>setTimeout(e,t)),this._clearTimeout=e.clearTimeoutImpl||(e=>clearTimeout(e)),this._now=e.nowImpl||(()=>Date.now()),this._random=e.randomImpl||(()=>Math.random())}configure(e){const t=this._config.heartbeatInterval;Object.keys(e).forEach(t=>{const n=e[t];void 0!==n&&(this._config[t]=n)}),this._config.heartbeatInterval!==t&&"open"===this.state&&this._startHeartbeat()}getConfig(){return this._config}connect(e=!1){if(this._disposed)return;if(this._clearReconnectTimer(),this._stopHeartbeat(),this._teardownSocket(),this._intentionalClose=!1,e||(this.retryCount=0),!this._WebSocket)return void this._fail("WebSocket is not available in this environment");const t=(this._config.url||"").trim();if(!t)return void this._fail("URL is required to connect");if(!/^wss?:\/\//i.test(t))return void this._fail("URL must start with ws:// or wss:// — got: "+t);this.state=e?"reconnecting":"connecting",this.connected=!1,this.closeCode=0,this.closeReason="",this._emitStatus();const n=this._config.protocols&&this._config.protocols.length?this._config.protocols:void 0;let i;try{i=new this._WebSocket(t,n)}catch(e){return void this._fail("Could not open WebSocket: "+this._describe(e))}this._socket=i;try{"binaryType"in i&&(i.binaryType="arraybuffer")}catch(e){}i.onopen=()=>this._handleOpen(i),i.onmessage=e=>this._handleMessage(i,e),i.onerror=()=>this._handleSocketError(i),i.onclose=e=>this._handleSocketDown(i,e)}disconnect(){if(this._disposed)return!1;this._clearReconnectTimer(),this._stopHeartbeat();const e=null!==this._socket||"connecting"===this.state||"reconnecting"===this.state||"open"===this.state;return this._intentionalClose=!0,this._teardownSocket(1e3,"Client disconnect"),this.connected=!1,this.retryCount=0,this.closeCode=1e3,this.closeReason="Client disconnect",e?(this.state="closed",this._emitStatus(),this._invoke(()=>this._callbacks.onClose&&this._callbacks.onClose(1e3,"Client disconnect",!1)),!0):(this.state="closed",this._emitStatus(),!1)}dispose(){this._disposed||(this._disposed=!0,this._clearReconnectTimer(),this._stopHeartbeat(),this._teardownSocket(1e3,"Node deleted"),this.droppedCount+=this._queue.length,this._queue=[],this.queueSize=0,this.connected=!1,this.state="closed")}get isDisposed(){return this._disposed}send(e){if(this._disposed)return{kind:"dropped"};if(null==e){const e="Nothing to send: the Message input is empty";return this._reportError(e),{kind:"failed",code:t.FT,message:e}}if("open"!==this.state||!this._socket)switch(this._config.sendWhenDisconnected){case"drop":return this.droppedCount++,this._emitStatus(),{kind:"dropped"};case"error":{this.droppedCount++;const e="Cannot send: the connection is not open (state: "+this.state+")";return this._reportError(e),{kind:"failed",code:t.A7,message:e}}default:{const n=this._config.maxQueueSize;if(n>0&&this._queue.length>=n){this.droppedCount++;const e="Send queue is full ("+n+" messages); this message was dropped";return this._reportError(e),{kind:"failed",code:t.Gf,message:e}}return this._queue.push(e),this.queueSize=this._queue.length,this._emitStatus(),{kind:"queued"}}}return this._sendNow(e,!0)}_sendNow(e,n){let i;try{i=this._encode(e)}catch(e){this.droppedCount++;const n="Could not encode the message: "+this._describe(e);return this._reportError(n),{kind:"failed",code:t.Ds,message:n}}try{this._socket.send(i)}catch(e){this.droppedCount++;const n="Send failed: "+this._describe(e);return this._reportError(n),{kind:"failed",code:t.nm,message:n}}return n&&this._invoke(()=>this._callbacks.onSent&&this._callbacks.onSent(e)),{kind:"sent"}}_encode(e){if(function(e){if(null==e)return!1;if("undefined"!=typeof ArrayBuffer){if(e instanceof ArrayBuffer)return!0;if(ArrayBuffer.isView(e))return!0}return"undefined"!=typeof Blob&&e instanceof Blob}(e))return e;if("binary"===this._config.messageEncoding){if("undefined"==typeof TextEncoder)throw new Error("binary encoding needs TextEncoder, which this environment does not provide");return(new TextEncoder).encode(r(e))}return r(e)}_flushQueue(){if(0!==this._queue.length){for(;this._queue.length>0&&"open"===this.state&&this._socket;){const e=this._queue.shift();if("sent"!==this._sendNow(e,!0).kind){this._queue.unshift(e);break}}this.queueSize=this._queue.length,this._emitStatus()}}peekQueue(){return this._queue.slice()}_handleOpen(e){if(this._disposed||e!==this._socket)return;const t=this._hasEverOpened;this._hasEverOpened=!0,this.state="open",this.connected=!0,this.retryCount=0,this.lastError="",this.closeCode=0,this.closeReason="",this._emitStatus(),this._invoke(()=>this._callbacks.onOpen&&this._callbacks.onOpen(t)),this._startHeartbeat(),this._flushQueue()}_handleMessage(e,t){if(this._disposed||e!==this._socket)return;const n=t&&t.data;if("string"==typeof n){const e=n,t=this._config.heartbeatInterval>0?this._config.heartbeatReply:"";return t&&e===t?void(this._pendingPingAt&&(this.latency=Math.max(0,this._now()-this._pendingPingAt),this._pendingPingAt=0,this._emitStatus())):void this._invoke(()=>this._callbacks.onMessage&&this._callbacks.onMessage(function(e){try{return JSON.parse(e)}catch(t){return e}}(e),e,!1))}this._invoke(()=>this._callbacks.onMessage&&this._callbacks.onMessage(n,"",!0))}_handleSocketError(e){if(e!==this._socket)return;const t=this._hasEverOpened?"WebSocket connection error":"Could not connect to "+(this._config.url||"(no url)");this._disposed||(this.lastError=t,this._invoke(()=>this._callbacks.onError&&this._callbacks.onError(t))),this._handleSocketDown(e,{code:n,reason:t,wasClean:!1})}_handleSocketDown(e,i){if(!e)return;const r=e;if(r.__nodegxDownHandled)return;r.__nodegxDownHandled=!0,this._detach(e);try{e.close()}catch(e){}if(e!==this._socket)return;if(this._socket=null,this._stopHeartbeat(),this._disposed)return;const s=i&&"number"==typeof i.code?i.code:n,a=i&&i.reason||"";if(this.connected=!1,this.closeCode=s,this.closeReason=a,this._intentionalClose)return;if(this._shouldReconnect(s)){const e=function(e,n,i,o,r){const s=n>0?n:t.DEFAULT_RECONNECT_DELAY,a=i>0?i:t.DEFAULT_MAX_RECONNECT_DELAY,l=Math.min(e,30),u=Math.min(a,s*Math.pow(2,l));return o?Math.round(u*(.5+.5*r())):Math.round(u)}(this.retryCount,this._config.reconnectDelay,this._config.maxReconnectDelay,this._config.jitter,this._random);return this.retryCount++,this.state="reconnecting",this.lastError=this._describeClose(s,a)+"; reconnecting in "+e+"ms",this._emitStatus(),this._invoke(()=>this._callbacks.onClose&&this._callbacks.onClose(s,a,!0)),void(this._reconnectTimer=this._setTimeout(()=>{this._reconnectTimer=null,this.connect(!0)},e))}if((1e3===s||1001===s)&&!this._config.autoReconnect)return this.state="closed",this._emitStatus(),void this._invoke(()=>this._callbacks.onClose&&this._callbacks.onClose(s,a,!1));this.state="error";const l=o(s)?this._describeClose(s,a)+"; this will not be retried":this._config.autoReconnect?this._describeClose(s,a)+"; gave up after "+this.retryCount+" reconnect attempts":this._describeClose(s,a)+"; Auto Reconnect is off";this.lastError=l,this._emitStatus(),this._invoke(()=>this._callbacks.onError&&this._callbacks.onError(l)),this._invoke(()=>this._callbacks.onClose&&this._callbacks.onClose(s,a,!1))}_shouldReconnect(e){if(!this._config.autoReconnect)return!1;if(o(e))return!1;const t=this._config.maxRetries;return t<0||this.retryCount<t}_startHeartbeat(){this._stopHeartbeat(),this._pendingPingAt=0;const e=this._config.heartbeatInterval;!e||e<=0||(this._heartbeatTimer=this._setTimeout(()=>this._onHeartbeat(),e))}_onHeartbeat(){if(this._heartbeatTimer=null,this._disposed||"open"!==this.state||!this._socket)return;const e=this._config.heartbeatReply;if(e&&this._pendingPingAt){const e=this._now()-this._pendingPingAt;this._pendingPingAt=0;const t="Heartbeat went unanswered for "+e+"ms; treating the connection as dead";return this.lastError=t,this._invoke(()=>this._callbacks.onError&&this._callbacks.onError(t)),void this._handleSocketDown(this._socket,{code:n,reason:t,wasClean:!1})}const t=this._config.heartbeatMessage;t&&"sent"===this._sendNow(t,!1).kind&&e&&(this._pendingPingAt=this._now()),"open"===this.state&&this._socket&&(this._heartbeatTimer=this._setTimeout(()=>this._onHeartbeat(),this._config.heartbeatInterval))}_stopHeartbeat(){null!==this._heartbeatTimer&&(this._clearTimeout(this._heartbeatTimer),this._heartbeatTimer=null),this._pendingPingAt=0}_clearReconnectTimer(){null!==this._reconnectTimer&&(this._clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}_detach(e){e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null}_teardownSocket(e,t){const n=this._socket;if(n){this._socket=null,this._detach(n);try{void 0!==e?n.close(e,t):n.close()}catch(e){}}}_fail(e){this.state="error",this.connected=!1,this.lastError=e,this._emitStatus(),this._invoke(()=>this._callbacks.onError&&this._callbacks.onError(e))}_reportError(e){this.lastError=e,this._emitStatus(),this._invoke(()=>this._callbacks.onError&&this._callbacks.onError(e))}_emitStatus(){this._invoke(()=>this._callbacks.onStatus&&this._callbacks.onStatus())}_invoke(e){try{e()}catch(e){console.error("[WebSocket] Error in a graph callback:",e)}}_describe(e){return e&&"string"==typeof e.message?e.message:String(e)}_describeClose(e,t){const i=e===n?"Connection lost (no close frame)":"Connection closed ("+e+")";return t?i+": "+t:i}}},8865(e,t,n){"use strict";const i=n(5162),o=n(4502),r=n(7268);function s(e){return e._internal}const a=["connectionState","connected","retryCount","lastError","queueSize","droppedCount","latency","closeCode","closeReason"],l={node:{name:"net.noodl.WebSocket",displayNodeName:"WebSocket",docs:"https://docs.noodl.net/nodes/data/websocket",category:"Data",color:"data",searchTags:["websocket","ws","wss","realtime","bidirectional","socket","stream","streaming","agent","chat","live"],usePortAsLabel:"url",portLabelTruncationMode:"path",ssr:{compat:"client-only",note:"A WebSocket cannot be meaningfully opened during a server render and would leak a socket per request; the node connects in the browser after hydration."},initialize(){const e=s(this);e.connection=null,e.autoConnect=!0,e.hasScheduledRebuild=!1,e.pendingConnect=null,e.message=void 0,e.received=void 0,e.receivedRaw="",e.receivedIsBinary=!1,e.config={url:"",protocols:[],autoReconnect:!0,reconnectDelay:o.DEFAULT_RECONNECT_DELAY,maxReconnectDelay:o.DEFAULT_MAX_RECONNECT_DELAY,maxRetries:o.DEFAULT_MAX_RETRIES,jitter:!0,heartbeatInterval:0,heartbeatMessage:"ping",heartbeatReply:"pong",sendWhenDisconnected:"queue",maxQueueSize:o.DEFAULT_MAX_QUEUE_SIZE,messageEncoding:"auto"}},getInspectInfo(){const e=s(this),t=e.connection;return t?{type:"value",value:{state:t.state,url:e.config.url,retryCount:t.retryCount,queueSize:t.queueSize,droppedCount:t.droppedCount,latency:t.latency,lastError:t.lastError||null,lastReceived:e.received}}:{type:"text",value:e.config.url?"[Not connected]":"[No URL set]"}},inputs:{url:{type:"string",displayName:"URL",description:"Endpoint to connect to, which must start with ws:// or wss://; changing it reconnects to the new one",group:"Connection",set(e){s(this).config.url="string"==typeof e?e:"",this.scheduleRebuild()}},autoConnect:{type:"boolean",displayName:"Auto Connect",description:"Connect as soon as a URL is available, without waiting for a Connect signal",group:"Connection",default:!0,tooltip:"Connect as soon as a URL is available, without waiting for a Connect signal.",set(e){s(this).autoConnect=!!e,this.scheduleRebuild()}},protocols:{type:"string",displayName:"Protocols",description:"Comma-separated WebSocket subprotocols to offer during the handshake",group:"Connection",tooltip:"Comma-separated WebSocket subprotocols to offer during the handshake.",set(e){s(this).config.protocols=function(e){return"string"!=typeof e||""===e.trim()?[]:e.split(",").map(e=>e.trim()).filter(e=>e.length>0)}(e),this.scheduleRebuild()}},autoReconnect:{type:"boolean",displayName:"Auto Reconnect",description:"Retries after an unsolicited close with a growing backoff; turning it off reports the close as an error",group:"Connection",default:!0,set(e){this.applyConfig({autoReconnect:!!e})}},reconnectDelay:{type:"number",displayName:"Reconnect Delay (ms)",description:"First backoff delay in milliseconds; each further attempt doubles it up to Max Reconnect Delay",group:"Connection",default:o.DEFAULT_RECONNECT_DELAY,tooltip:"First backoff delay. Each further attempt doubles it, up to Max Reconnect Delay.",set(e){this.applyConfig({reconnectDelay:Number(e)})}},maxReconnectDelay:{type:"number",displayName:"Max Reconnect Delay (ms)",description:"Ceiling on the backoff in milliseconds, however many attempts there have been",group:"Connection",default:o.DEFAULT_MAX_RECONNECT_DELAY,set(e){this.applyConfig({maxReconnectDelay:Number(e)})}},maxRetries:{type:"number",displayName:"Max Retries",description:"Reconnect attempts allowed per outage; 0 disables retrying and a negative value means unlimited",group:"Connection",default:o.DEFAULT_MAX_RETRIES,tooltip:"Reconnect attempts allowed per outage. 0 disables retrying; a negative value means unlimited.",set(e){this.applyConfig({maxRetries:Number(e)})}},jitter:{type:"boolean",displayName:"Backoff Jitter",description:"Spreads reconnect attempts randomly across the second half of each backoff window, so a fleet does not return in lockstep",group:"Connection",default:!0,tooltip:"Spread reconnect attempts randomly across the second half of each backoff window.",set(e){this.applyConfig({jitter:!!e})}},heartbeatInterval:{type:"number",displayName:"Heartbeat Interval (ms)",description:"Milliseconds between heartbeats while the socket is open; 0 disables it, and only enable it if your server expects the message",group:"Connection",default:0,tooltip:"Send Heartbeat Message this often while open. 0 disables it. Only enable this if your server expects the message — it is application data, not a protocol ping frame.",set(e){this.applyConfig({heartbeatInterval:Number(e)})}},heartbeatMessage:{type:"string",displayName:"Heartbeat Message",description:"Application text sent as the heartbeat; it is not a protocol ping frame",group:"Connection",default:"ping",set(e){this.applyConfig({heartbeatMessage:"string"==typeof e?e:""})}},heartbeatReply:{type:"string",displayName:"Heartbeat Reply",description:"Exact text the server answers a heartbeat with; it is measured as Latency, hidden from On Message, and its absence is treated as a dead connection",group:"Connection",default:"pong",tooltip:"Exact text the server answers a heartbeat with. It is measured as Latency, hidden from On Message, and — if it stops arriving — treated as a dead connection. Leave empty to only send heartbeats.",set(e){this.applyConfig({heartbeatReply:"string"==typeof e?e:""})}},connect:{displayName:"Connect",description:"Opens the socket, replacing one already open without reporting a close",group:"Actions",valueChangedToTrue(){this.settleConnect("unchanged"),s(this).pendingConnect=this.beginOutcome(),this.getConnection().connect()}},disconnect:{displayName:"Disconnect",description:"Closes the socket and cancels any pending reconnect",group:"Actions",valueChangedToTrue(){const e=this.beginOutcome(),t=s(this).connection;this.settleConnect("unchanged");const n=!!t&&t.disconnect();this.reportOutcome(e,n?"done":"unchanged")}},send:{displayName:"Send",description:"Hands the current Message to the socket, or applies the When Disconnected policy",group:"Actions",valueChangedToTrue(){const e=this.beginOutcome(),t=this.getConnection().send(s(this).message);"failed"!==t.kind?this.reportOutcome(e,"dropped"===t.kind?"unchanged":"done"):this.reportOutcome(e,"failure",{code:t.code,message:t.message})}},message:{type:"*",displayName:"Message",description:"Value to send; objects are JSON-serialised, and ArrayBuffers and typed arrays go as binary frames",group:"Message",tooltip:"Value to send. Objects are JSON-serialized; ArrayBuffers and typed arrays are sent as binary frames.",set(e){s(this).message=e}},messageType:{type:{name:"enum",enums:[{label:"Auto",value:"auto"},{label:"Text",value:"text"},{label:"Binary",value:"binary"}]},displayName:"Message Type",description:"Auto sends binary values as binary and everything else as text; Binary encodes text and objects as UTF-8 first",group:"Message",default:"auto",tooltip:"Auto sends binary values as binary and everything else as text. Binary forces text and objects to be UTF-8 encoded first.",set(e){this.applyConfig({messageEncoding:e||"auto"})}},whenDisconnected:{type:{name:"enum",enums:[{label:"Queue",value:"queue"},{label:"Drop",value:"drop"},{label:"Report Error",value:"error"}]},displayName:"When Disconnected",description:"What a Send does while the socket is not open: hold it in order, discard and count it, or also report an error",group:"Message",default:"queue",tooltip:"What a Send does while the connection is not open. Queue holds it (in order) until the socket reopens; Drop discards it and counts it; Report Error also sets Last Error and fires On Error.",set(e){this.applyConfig({sendWhenDisconnected:e||"queue"})}},maxQueueSize:{type:"number",displayName:"Max Queue Size",description:"Messages the queue holds before further Sends are refused and counted as dropped; 0 or less is unlimited and can grow during a long outage",group:"Message",default:o.DEFAULT_MAX_QUEUE_SIZE,tooltip:"Messages the queue holds before further Sends are refused and counted in Dropped. 0 or less means unlimited, which can grow without bound during a long outage.",set(e){this.applyConfig({maxQueueSize:Number(e)})}}},outputs:{connectionState:{type:"string",displayName:"Connection State",description:"Where the connection is: idle, connecting, open, reconnecting, closed or error",group:"Status",get(){const e=s(this).connection;return e?e.state:"idle"}},connected:{type:"boolean",displayName:"Connected",description:"True only while the socket is open and messages can be sent without queueing",group:"Status",get(){const e=s(this).connection;return!!e&&e.connected}},retryCount:{type:"number",displayName:"Retry Count",description:"Attempts made during the current outage; back to zero once the socket opens",group:"Status",get(){const e=s(this).connection;return e?e.retryCount:0}},lastError:{type:"string",displayName:"Last Error",description:"What went wrong most recently, including why a reconnect was scheduled or abandoned",group:"Status",get(){const e=s(this).connection;return e?e.lastError:""}},queueSize:{type:"number",displayName:"Queue Size",description:"Messages held because the socket was not open when Send ran",group:"Status",get(){const e=s(this).connection;return e?e.queueSize:0}},droppedCount:{type:"number",displayName:"Dropped",description:"Messages that will never be sent, whether discarded by policy, by a full queue, or by the node being removed",group:"Status",get(){const e=s(this).connection;return e?e.droppedCount:0}},latency:{type:"number",displayName:"Latency (ms)",description:"Round trip of the last heartbeat in milliseconds; 0 until one has been measured",group:"Status",get(){const e=s(this).connection;return e?e.latency:0}},closeCode:{type:"number",displayName:"Close Code",description:"WebSocket close code from the last close, or 1006 when the socket died without one",group:"Status",get(){const e=s(this).connection;return e?e.closeCode:0}},closeReason:{type:"string",displayName:"Close Reason",description:"Reason the server gave for closing, which is often blank",group:"Status",get(){const e=s(this).connection;return e?e.closeReason:""}},received:{type:"*",displayName:"Received",description:"The last message, parsed as JSON when it is JSON and handed over as text when it is not",group:"Data",get(){return s(this).received}},receivedRaw:{type:"string",displayName:"Received Raw",description:"The last text message exactly as it arrived; blank for a binary frame",group:"Data",get(){return s(this).receivedRaw}},receivedIsBinary:{type:"boolean",displayName:"Received Is Binary",description:"True when the last message was a binary frame, in which case Received holds the buffer",group:"Data",get(){return s(this).receivedIsBinary}},onOpen:{type:"signal",displayName:"On Open",description:"Fires every time the socket opens, including after a reconnect",group:"Events"},onMessage:{type:"signal",displayName:"On Message",description:"Fires once per message, after Received already holds it; heartbeat replies are not messages",group:"Events"},onMessageSent:{type:"signal",displayName:"On Message Sent",description:"Fires when a message has been handed to the socket, including a queued one flushed on reopen; not for heartbeats",group:"Events"},onError:{type:"signal",displayName:"On Error",description:"Fires when something went wrong: a failed connect, a refused send, a dead heartbeat, or a give-up",group:"Events"},onClose:{type:"signal",displayName:"On Close",description:"Fires whenever the socket goes down, whether or not a reconnect is going to follow",group:"Events"},onReconnect:{type:"signal",displayName:"On Reconnect",description:"Fires on every open after the first; a WebSocket cannot resume, so this is the cue to re-fetch rather than assume continuity",group:"Events"},...(0,i.outcomeOutputs)({done:"Fires when the action finished: a Connect whose socket opened, a Send accepted for delivery (sent, or queued for the next open), or a Disconnect that closed something",unchanged:"Fires when there was nothing to do: a Disconnect with nothing open, a Send discarded by the Drop policy, or a Connect a later Connect or Disconnect superseded before it opened",failure:"Fires when the action could not be performed — no URL, a URL that is not ws:// or wss://, a connection that gave up, or a refused Send. Last Error carries the reason"})},methods:{getConnection(){const e=s(this);if(e.connection&&!e.connection.isDisposed)return e.connection;const t=new o.WebSocketConnection({...e.config,onStatus:()=>{for(const e of a)this.flagOutputDirty(e);"error"===t.state&&this.settleConnect("failure","websocket/connect-failed",t.lastError||"The connection could not be opened")},onOpen:e=>{this.sendSignalOnOutput("onOpen"),e&&this.sendSignalOnOutput("onReconnect"),this.settleConnect("done")},onMessage:(t,n,i)=>{e.received=t,e.receivedRaw=n,e.receivedIsBinary=i,this.flagOutputDirty("received"),this.flagOutputDirty("receivedRaw"),this.flagOutputDirty("receivedIsBinary"),this.sendSignalOnOutput("onMessage")},onError:()=>{this.sendSignalOnOutput("onError")},onClose:()=>{this.sendSignalOnOutput("onClose")},onSent:()=>{this.sendSignalOnOutput("onMessageSent")},...this._webSocketTestSeams||{}});return e.connection=t,t},settleConnect(e,t,n){const i=s(this),o=i.pendingConnect;o&&(i.pendingConnect=null,this.reportOutcome(o,e,"failure"===e?{code:t,message:n}:void 0))},applyConfig(e){const t=s(this);Object.keys(e).forEach(n=>{const i=e[n];void 0!==i&&(t.config[n]=i)}),t.connection&&!t.connection.isDisposed&&t.connection.configure(e)},scheduleRebuild(){const e=s(this);e.hasScheduledRebuild||(e.hasScheduledRebuild=!0,this.scheduleAfterInputsHaveUpdated(()=>{e.hasScheduledRebuild=!1,this.rebuild()}))},rebuild(){const e=s(this),t=e.connection&&!e.connection.isDisposed?e.connection:null;if(!t||function(e,t){if((e.url||"")!==(t.url||""))return!0;const n=e.protocols||[],i=t.protocols||[];return n.length!==i.length||n.some((e,t)=>e!==i[t])}(t.getConfig(),e.config)){if(t){const n="connecting"===t.state||"open"===t.state||"reconnecting"===t.state;t.dispose(),e.connection=null,this.settleConnect("unchanged");for(const e of a)this.flagOutputDirty(e);return void(e.config.url&&(e.autoConnect||n)&&this.getConnection().connect())}e.autoConnect&&e.config.url&&this.getConnection().connect()}},_onNodeDeleted(){r.prototype._onNodeDeleted.call(this);const e=s(this);e&&e.connection&&(e.connection.dispose(),e.connection=null),e&&(e.pendingConnect=null)}}}};e.exports=l},1341(e){"use strict";const t={node:{name:"And",docs:"https://docs.noodl.net/nodes/logic/and",category:"Logic",initialize:function(){this._internal.inputs=[],this._internal.result=!1},getInspectInfo(){return[{type:"value",value:n(this._internal.inputs)}]},numberedInputs:{input:{displayPrefix:"Input",type:"boolean",createSetter:e=>function(t){const i=!!t;if(this._internal.inputs[e]===i)return;this._internal.inputs[e]=i;const o=n(this._internal.inputs);this._internal.result!==o&&(this._internal.result=o,this.flagOutputDirty("result"))}}},outputs:{result:{group:"Values",type:"boolean",displayName:"Result",description:"True only while every connected input is true; false when no input is connected at all",get(){return this._internal.result}}}}};function n(e){return e.length>0&&!1===e.some(e=>!e)}e.exports=t},200(e){"use strict";e.exports={node:{name:"Boolean To String",docs:"https://docs.noodl.net/nodes/utilities/boolean-to-string",category:"Utilities",initialize:function(){this._internal.inputs=[],this._internal.currentSelectedIndex=0,this._internal.indexChanged=!1,this._internal.trueString="",this._internal.falseString=""},inputs:{trueString:{group:"Values",displayName:"String for true",type:"string",description:"Text published on Current Value while Selector is true",set:function(e){this._internal.trueString!==e&&(this._internal.trueString=e,this._internal.currentInput&&this.flagOutputDirty("currentValue"))}},falseString:{group:"Values",displayName:"String for false",type:"string",description:"Text published on Current Value while Selector is false",set:function(e){this._internal.falseString!==e&&(this._internal.falseString=e,this._internal.currentInput||this.flagOutputDirty("currentValue"))}},input:{group:"Values",type:{name:"boolean"},displayName:"Selector",description:"Which of the two strings to publish: false, 0, empty text or no value picks String for false; anything else picks String for true",set:function(e){this._internal.currentInput!==e&&(this._internal.currentInput=e,this.flagOutputDirty("currentValue"),this.sendSignalOnOutput("inputChanged"))}}},outputs:{currentValue:{type:"string",displayName:"Current Value",group:"Values",description:"String for true or String for false, whichever Selector currently picks",getter:function(){return this._internal.currentInput?this._internal.trueString:this._internal.falseString}},inputChanged:{type:"signal",displayName:"Selector Changed",group:"Events",description:"Fires when Selector flips, after Current Value has been updated"}}}}},1848(e,t,n){"use strict";t.extendSetComponentObjectProperties=function(e){const t=new s.ResolvedTargetReporter;function n(e,t,n){const i=[],o=[{label:"String",value:"string"},{label:"Boolean",value:"boolean"},{label:"Number",value:"number"},{label:"Date",value:"date"},{label:"Array",value:"array"},{label:"Object",value:"object"},{label:"Any",value:"*"}],r=t.properties;if(r)for(const e of r.split(","))i.push({type:{name:void 0===t["type-"+e]?"*":t["type-"+e]},plug:"input",group:"Property Values",displayName:e,name:"prop-"+e}),i.push({type:{name:"enum",enums:o,allowEditOnly:!0},plug:"input",group:"Property Types",displayName:e,default:"*",name:"type-"+e});n.sendDynamicPorts(e,i,{detectRenamed:{plug:"input"}})}return{node:{name:e.name,displayNodeName:e.displayName,category:"Component Utilities",color:"component",docs:e.docs,initialize:function(){this._internal.inputValues={}},nodeScopeDidInitialize:function(){e.canFailToResolve&&this.context.scheduleAfterUpdate(()=>{this.reportResolution()})},inputs:Object.assign({properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",description:"Names of the values this node writes, each becoming an input to supply it",set(){}},store:{type:"signal",group:"Actions",displayName:"Do",description:"Writes every supplied property value into the component object",valueChangedToTrue(){this.scheduleStore()}}},e.inputs),outputs:Object.assign((0,r.outcomeOutputs)({done:"Fires once every property has been written"}),e.canFailToResolve?{failure:{type:"signal",group:"Events",displayName:"Failure",description:"Fires when no parent Component Object could be found, so nothing was written"},error:{type:"string",group:"Error",displayName:"Error",description:"Which ancestor was looked for and why it was not found",getter:function(){return this._internal.lastError}}}:void 0),methods:{resolveComponentObject:e.resolveComponentObject,reportResolution(){t.report(this,this.resolveComponentObject().name)},scheduleStore(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const n=this.beginOutcome(),i=this._internal;this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledStore=!1;const r=this.resolveComponentObject();if(e.canFailToResolve&&t.report(this,r.name),void 0===r.id)return i.lastError=r.missMessage,this.flagOutputDirty("error"),void this.reportOutcome(n,"failure",{code:r.missCode,message:r.missMessage,detail:r.missDetail});const s=(this.nodeScope.modelScope||o).get(r.id),a=(this.model.parameters.properties||"").split(","),l=Object.keys(i.inputValues).filter(e=>-1!==a.indexOf(e));for(const e of l)s.set(e,i.inputValues[e],{resolve:!0});this.reportOutcome(n,"done")})},_onNodeDeleted(){i.prototype._onNodeDeleted.call(this),e.canFailToResolve&&t.forget(this)},registerInputIfNeeded:function(e){if(!this.hasInput(e))if(e.startsWith("prop-")){const t=e.substring(5);this.registerInput(e,{set(e){this._internal.inputValues[t]=e}})}else e.startsWith("type-")&&this.registerInput(e,{set(){}})}}},setup:function(t,i){const o=t.editorConnection;o&&o.isRunningLocally()&&i.on("nodeAdded."+e.name,e=>{n(e.id,e.parameters,o),e.on("parameterUpdated",t=>{("properties"===t.name||t.name.startsWith("type-"))&&n(e.id,e.parameters,o)})})}}};const i=n(7268),o=n(6835),r=n(5162),s=n(9849)},6649(e,t,n){"use strict";const i=n(7268),o=n(6835),r=n(5162);function s(e,t,n){const i=[],o=t.properties;if(o)for(const e of o.split(","))i.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:"value-"+e,displayName:e}),i.push({type:"signal",plug:"output",group:"Events",displayName:e+" Changed",name:"changed-"+e});n.sendDynamicPorts(e,i,{detectRenamed:{plug:"input/output"}})}const a={node:{name:"net.noodl.ComponentObject",displayNodeName:"Component Object",category:"Component Utilities",color:"component",docs:"https://docs.noodl.net/nodes/component-utilities/component-object",runOnValueChange:{controlSignal:"fetch",sources:[{name:"object",displayName:"Object properties"}]},initialize:function(){this._internal.inputValues={},this._internal.dirtyValues={},this._internal.onModelChangedCallback=e=>{this.shouldRunOnValueChange("object")&&(this.hasOutput("value-"+e.name)&&this.flagOutputDirty("value-"+e.name),this.hasOutput("changed-"+e.name)&&this.sendSignalOnOutput("changed-"+e.name),this.sendSignalOnOutput("changed"))};const e=(this.nodeScope.modelScope||o).get("componentState"+this.nodeScope.componentOwner.getInstanceId());this._internal.model=e,e.on("change",this._internal.onModelChangedCallback)},getInspectInfo(){return{type:"value",value:this._internal.model.data}},inputs:{properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",description:"Names of the values this component keeps, each becoming a matching input and output",set(){}},fetch:{displayName:"Fetch",group:"Actions",description:"Republishes every property now. This is additional to the outputs updating on their own; untick Object properties under Run On Value Change to stop that",valueChangedToTrue(){this.scheduleFetch(this.beginOutcome())}}},outputs:{changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires when any property is written, unless Object properties is unticked under Run On Value Change"},fetched:{type:"signal",displayName:"Fetched",group:"Events",description:"Fires once Fetch has republished every property"},...(0,r.outcomeOutputs)({done:"Fires once Fetch has republished every property, after Fetched"})},methods:{scheduleStore(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledStore=!1;for(const t in e.dirtyValues)e.model.set(t,e.inputValues[t],{resolve:!0});e.dirtyValues={}})},scheduleFetch(e){const t=this._internal;e&&(t.pendingFetchOutcomes||(t.pendingFetchOutcomes=[]),t.pendingFetchOutcomes.push(e)),this.hasScheduledFetch||(this.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledFetch=!1,this.fetch();const e=t.pendingFetchOutcomes;t.pendingFetchOutcomes=void 0,e&&(0,r.reportOutcomes)(this,e,"done")}))},fetch(){for(const e in this._internal.model.data)this.hasOutput("value-"+e)&&(this.flagOutputDirty("value-"+e),this.hasOutput("changed-"+e)&&this.sendSignalOnOutput("changed-"+e));this.sendSignalOnOutput("fetched")},_onNodeDeleted(){i.prototype._onNodeDeleted.call(this),this._internal.model.off("change",this._internal.onModelChangedCallback)},registerOutputIfNeeded(e){if(this.hasOutput(e))return;const t=e.startsWith("value-")?e.substring(6):e.startsWith("changed-")?e.substring(8):e;this.registerOutput(e,{get(){return this._internal.model.get(t,{resolve:!0})}})},registerInputIfNeeded:function(e){if(!this.hasInput(e)&&e.startsWith("value-")){const t=e.substring(6);this.registerInput(e,{set(e){this._internal.inputValues[t]=e,this._internal.dirtyValues[t]=!0,this.scheduleStore()}})}}}},setup:function(e,t){const n=e.editorConnection;n&&n.isRunningLocally()&&t.on("nodeAdded.net.noodl.ComponentObject",e=>{s(e.id,e.parameters,n),e.on("parameterUpdated",t=>{"properties"===t.name&&s(e.id,e.parameters,n)})})}};e.exports=a},8812(e,t,n){"use strict";const i=n(1848);e.exports=(0,i.extendSetComponentObjectProperties)({name:"net.noodl.SetComponentObjectProperties",displayName:"Set Component Object Properties",docs:"https://docs.noodl.net/nodes/component-utilities/set-component-object-properties",resolveComponentObject:function(){const e=this.nodeScope.componentOwner;return{id:"componentState"+e.getInstanceId(),name:e.name}}})},4397(e,t,n){"use strict";const i=n(5162),o={node:{name:"Condition",docs:"https://docs.noodl.net/nodes/utilities/logic/condition",category:"Logic",runOnValueChange:{controlSignal:"eval",inputs:["condition"]},initialize:function(){this._internal.hasScheduledEvaluation=!1,this._internal.hasEvaluated=!1},getInspectInfo(){const e=this.getInputValue("condition");let t;return void 0===e&&(t="[No input]"),t=e,[{type:"value",value:t}]},inputs:{condition:{type:"boolean",displayName:"Condition",group:"General",description:"Value to test for truth; it is re-tested on every change unless you untick it below",set(e){const t=this._internal.lastConditionValue;this._internal.lastConditionValue=e,this.shouldRunOnValueChanged("condition",t,e)&&this.scheduleEvaluate()}},eval:{type:"signal",displayName:"Evaluate",group:"Actions",description:"Tests Condition now. This is additional to Condition re-testing on change; untick it under Run On Value Change to stop that",valueChangedToTrue(){this.scheduleEvaluate(this.beginOutcome())}}},outputs:{ontrue:{type:"signal",displayName:"On True",group:"Events",description:"Fires each time Condition is tested and found true — exactly one of On True and On False fires per test"},onfalse:{type:"signal",displayName:"On False",group:"Events",description:"Fires each time Condition is tested and found false, including while Condition has never been set"},result:{type:"boolean",displayName:"Is True",group:"Booleans",description:"Whether the last test found Condition true, for wiring into a value rather than branching on a signal; null until the first test. If Condition is a constant, every test pushes the same value — a mounted gate wired that way only ever turns on; a Switch is the two-way shape",get(){return this._internal.hasEvaluated?!!this._internal.testedResult:null}},isfalse:{type:"boolean",displayName:"Is False",group:"Booleans",description:"The opposite of Is True, so a false branch needs no Inverter; null until the first test",get(){return this._internal.hasEvaluated?!this._internal.testedResult:null}},...(0,i.outcomeOutputs)({done:"Fires once an Evaluate you triggered has tested Condition, after On True or On False"})},methods:{scheduleEvaluate(e){e&&(this._internal.pendingEvalOutcomes||(this._internal.pendingEvalOutcomes=[]),this._internal.pendingEvalOutcomes.push(e)),this._internal.hasScheduledEvaluation||(this._internal.hasScheduledEvaluation=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._internal.hasScheduledEvaluation=!1,this._internal.hasEvaluated=!0;const e=this.getInputValue("condition");this._internal.testedResult=!!e,this.flagOutputDirty("result"),this.flagOutputDirty("isfalse"),this.sendSignalOnOutput(e?"ontrue":"onfalse");const t=this._internal.pendingEvalOutcomes;this._internal.pendingEvalOutcomes=void 0,t&&(0,i.reportOutcomes)(this,t,"done")}))}}}};e.exports=o},2772(e,t,n){"use strict";const i=n(5162);function o(e){const{limitsMin:t,limitsMax:n}=e._internal;e.setDiagnostic("counter/min-above-max",t>n?`Min Value ${t} is above Max Value ${n}. With Limits Enabled on, the count gets stuck.`:null)}const r={node:{name:"Counter",docs:"https://docs.noodl.net/nodes/math/counter",category:"Math",initialize:function(){this._internal.currentValue=0,this._internal.startValue=0,this._internal.startValueSet=!1,this._internal.limitsEnabled=!1,this._internal.limitsMin=0,this._internal.limitsMax=0},getInspectInfo(){return"Count: "+this._internal.currentValue},inputs:{increase:{group:"Actions",displayName:"Increase Count",description:"Adds one to the count, or does nothing at all when Limits Enabled and the count is already at Max Value",valueChangedToTrue:function(){const e=this.beginOutcome();this._internal.limitsEnabled&&this._internal.currentValue>=this._internal.limitsMax?this.reportOutcome(e,"unchanged"):(this._internal.currentValue++,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"),this.reportOutcome(e,"done"))}},decrease:{group:"Actions",displayName:"Decrease Count",description:"Subtracts one from the count, or does nothing at all when Limits Enabled and the count is already at Min Value",valueChangedToTrue:function(){const e=this.beginOutcome();this._internal.limitsEnabled&&this._internal.currentValue<=this._internal.limitsMin?this.reportOutcome(e,"unchanged"):(this._internal.currentValue--,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"),this.reportOutcome(e,"done"))}},reset:{group:"Actions",displayName:"Reset To Start",description:"Puts the count back to Start Value, or reports Unchanged and leaves Count Changed silent when it is already there",valueChangedToTrue:function(){const e=this.beginOutcome();this._internal.currentValue!==this._internal.startValue?(this._internal.currentValue=this._internal.startValue,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"),this.reportOutcome(e,"done")):this.reportOutcome(e,"unchanged")}},startValue:{group:"Values",type:"number",displayName:"Start Value",description:"Count to begin at and to return to on Reset; setting it announces a change on Count Changed at page load",default:0,set:function(e){this._internal.startValue=Number(e),!1===this._internal.startValueSet&&(this._internal.startValueSet=!0,this._internal.currentValue=this._internal.startValue,this._internal.seededCount!==this._internal.currentValue&&this.flagOutputDirty("currentCount"),this._internal.seededCount=void 0,this.sendSignalOnOutput("countChanged"))}},limitsMin:{type:{name:"number"},displayName:"Min Value",description:"Lowest count Decrease will reach, ignored unless Limits Enabled",group:"Limits",default:0,set:function(e){this._internal.limitsMin=Number(e),o(this)}},limitsMax:{type:{name:"number"},displayName:"Max Value",description:"Highest count Increase will reach, ignored unless Limits Enabled",group:"Limits",default:0,set:function(e){this._internal.limitsMax=Number(e),o(this)}},limitsEnabled:{type:{name:"boolean"},displayName:"Limits Enabled",description:"Whether Min Value and Max Value bound the count; without it the count runs unbounded in both directions",group:"Limits",default:!1,set:function(e){this._internal.limitsEnabled=!!e}}},outputs:{currentCount:{group:"Values",displayName:"Current Count",type:"number",description:"The count as it stands",getter:function(){var e,t;if(!1===this._internal.startValueSet){const n=null===(t=null===(e=this.model)||void 0===e?void 0:e.parameters)||void 0===t?void 0:t.startValue;if(null!=n&&""!==n&&!isNaN(Number(n)))return this._internal.seededCount=Number(n),Number(n)}return this._internal.currentValue}},countChanged:{group:"Events",displayName:"Count Changed",type:"signal",description:"Fires after the count has moved, and also once at page load when Start Value is set"},...(0,i.outcomeOutputs)({done:"Fires when the count actually moved",unchanged:"Fires when nothing moved: Limits Enabled held the count at Min or Max, or Reset was pressed on a count already at Start Value"})}}};e.exports=r},9015(e,t){"use strict";function n(){return"undefined"!=typeof globalThis?globalThis.crypto:void 0}function i(e){let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return t}function o(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode.apply(null,Array.from(e.subarray(n,n+32768)));return btoa(t)}function r(e){const t=n();if(!t||"function"!=typeof t.getRandomValues)throw new Error("No cryptographic random source is available here (crypto.getRandomValues is missing). This node will not fall back to Math.random().");const i=new Uint8Array(e);for(let n=0;n<e;n+=65536)t.getRandomValues(i.subarray(n,Math.min(n+65536,e)));return i}t.requireSubtle=function(){const e=n();if(!e||!e.subtle)throw new Error("WebCrypto is not available here. In a browser, crypto.subtle only exists in a secure context — serve the page over HTTPS (or from localhost). In a cloud function it is always present.");return e.subtle},t.utf8Bytes=function(e){return(new TextEncoder).encode(e)},t.encodeBytes=function(e,t){if("hex"===t)return i(e);if("base64"===t)return o(e);if("base64url"===t)return function(e){return o(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}(e);throw new Error(`Unknown encoding "${t}". Use hex, base64 or base64url.`)},t.randomBytes=r,t.randomUuid=function(){const e=n();if(e&&"function"==typeof e.randomUUID)return e.randomUUID();const t=r(16);t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=i(t);return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}},9222(e,t,n){"use strict";const i=n(5162),o=n(9015),r={node:{name:"net.noodl.Hash",displayNodeName:"Hash",docs:"https://docs.noodl.net/nodes/utilities/hash",category:"Utilities",color:"data",initialize:function(){this._internal.algorithm="SHA-256",this._internal.encoding="hex"},inputs:{value:{type:"string",displayName:"Value",group:"General",description:"The text to hash, as UTF-8 bytes",set:function(e){this._internal.value=e}},algorithm:{type:{name:"enum",enums:[{label:"SHA-256",value:"SHA-256"},{label:"SHA-384",value:"SHA-384"},{label:"SHA-512",value:"SHA-512"}]},displayName:"Algorithm",group:"General",default:"SHA-256",description:"Which SHA-2 digest to compute. MD5 and SHA-1 are not offered — WebCrypto has neither",set:function(e){this._internal.algorithm=e}},encoding:{type:{name:"enum",enums:[{label:"Hex",value:"hex"},{label:"Base64",value:"base64"},{label:"Base64 URL",value:"base64url"}]},displayName:"Encoding",group:"General",default:"hex",description:"How the digest bytes are rendered as text",set:function(e){this._internal.encoding=e}},hash:{type:"signal",displayName:"Do",group:"Actions",description:"Computes the digest of Value",valueChangedToTrue:function(){const e=this.beginOutcome();this._internal.pendingOutcomes||(this._internal.pendingOutcomes=[]),this._internal.pendingOutcomes.push(e),this._internal.scheduled||(this._internal.scheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._internal.scheduled=!1,this._run()}))}}},outputs:{digest:{type:"string",displayName:"Digest",group:"Values",description:"The hash of Value, rendered in Encoding. Available once Done has fired",getter:function(){return this._internal.digest}},...(0,i.outcomeOutputs)({done:"Fires once the digest has been computed and is available on Digest",failure:"Fires when the digest could not be computed, most often because WebCrypto is not available here"}),error:{type:"string",displayName:"Error",group:"Error",description:"Why the digest could not be computed",getter:function(){return this._internal.error}}},methods:{_fail:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,t,"failure",{code:"hash/failed",message:e})},_run:function(){const e=this._internal.pendingOutcomes||[];this._internal.pendingOutcomes=void 0;const t=this._internal.algorithm||"SHA-256",n=this._internal.encoding||"hex",r=this._internal.value||"";let s;try{s=(0,o.requireSubtle)().digest(t,(0,o.utf8Bytes)(r))}catch(t){return void this._fail(t instanceof Error?t.message:String(t),e)}s.then(t=>{this._internal.digest=(0,o.encodeBytes)(new Uint8Array(t),n),this._internal.error=void 0,this.flagOutputDirty("digest"),this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,e,"done")}).catch(t=>this._fail(t instanceof Error?t.message:String(t),e))}}}};e.exports=r},7746(e,t,n){"use strict";const i=n(5162),o=n(9015),r={node:{name:"net.noodl.RandomBytes",displayNodeName:"Random Bytes",docs:"https://docs.noodl.net/nodes/utilities/random-bytes",category:"Utilities",color:"data",initialize:function(){this._internal.length=32,this._internal.encoding="hex"},inputs:{length:{type:"number",displayName:"Length",group:"General",default:32,description:"How many random BYTES to generate (not characters — hex renders each byte as two). 1 to 4096",set:function(e){this._internal.length=Number(e)}},encoding:{type:{name:"enum",enums:[{label:"Hex",value:"hex"},{label:"Base64",value:"base64"},{label:"Base64 URL",value:"base64url"}]},displayName:"Encoding",group:"General",default:"hex",description:"How the bytes are rendered as text. Base64 URL is the safe one for a URL or a token",set:function(e){this._internal.encoding=e}},generate:{type:"signal",displayName:"New",group:"Actions",description:"Generates a fresh block of random bytes",valueChangedToTrue:function(){this._generate(this.beginOutcome())}}},outputs:{value:{type:"string",displayName:"Value",group:"Values",description:"The random bytes rendered in Encoding, replaced on every New",getter:function(){return this._internal.value}},...(0,i.outcomeOutputs)({done:"Fires once fresh random bytes are available on Value",failure:"Fires when there is no cryptographic random source here, or Length is out of range. This node will not quietly substitute Math.random()"}),error:{type:"string",displayName:"Error",group:"Error",description:"Why no random bytes were produced",getter:function(){return this._internal.error}}},methods:{_generate:function(e){const t=void 0===this._internal.length?32:this._internal.length,n=this._internal.encoding||"hex",i=t=>{this._internal.error=t,this.flagOutputDirty("error"),this.reportOutcome(e,"failure",{code:"random-bytes/failed",message:t})};if(!Number.isFinite(t)||t<1||t>4096||Math.floor(t)!==t)i(`Random Bytes: Length must be a whole number from 1 to 4096, and was ${String(t)}.`);else{try{this._internal.value=(0,o.encodeBytes)((0,o.randomBytes)(t),n)}catch(e){return void i(e instanceof Error?e.message:String(e))}this._internal.error=void 0,this.flagOutputDirty("value"),this.flagOutputDirty("error"),this.reportOutcome(e,"done")}}}}};e.exports=r},9013(e,t,n){"use strict";const i=n(5162),o=n(9015),r={node:{name:"net.noodl.UUID",displayNodeName:"UUID",docs:"https://docs.noodl.net/nodes/utilities/uuid",category:"Utilities",color:"data",initialize:function(){try{this._internal.uuid=(0,o.randomUuid)()}catch{this._internal.uuid=void 0}},getInspectInfo(){return this._internal.uuid},inputs:{generate:{type:"signal",displayName:"New",group:"Actions",description:"Generates a fresh UUID, replacing the one on Id",valueChangedToTrue:function(){this._generate(this.beginOutcome())}}},outputs:{uuid:{type:"string",displayName:"Id",group:"Values",description:"A random version-4 UUID, generated once when the node is created and again on every New. Use this rather than Unique Id wherever the id has to be globally unique or unguessable",getter:function(){return this._internal.uuid}},...(0,i.outcomeOutputs)({done:"Fires once a new UUID is available on Id",failure:"Fires when there is no cryptographic random source here, leaving Id as it was"}),error:{type:"string",displayName:"Error",group:"Error",description:"Why no UUID could be generated",getter:function(){return this._internal.error}}},methods:{_generate:function(e){try{this._internal.uuid=(0,o.randomUuid)()}catch(t){const n=t instanceof Error?t.message:String(t);return this._internal.error=n,this.flagOutputDirty("error"),void this.reportOutcome(e,"failure",{code:"uuid/failed",message:n})}this._internal.error=void 0,this.flagOutputDirty("uuid"),this.flagOutputDirty("error"),this.reportOutcome(e,"done")}}}};e.exports=r},2546(e,t,n){"use strict";const i=n(822),o={node:{name:"Cloud File",docs:"https://docs.noodl.net/nodes/data/cloud-data/cloud-file",category:"Cloud Services",color:"data",getInspectInfo(){return this._internal.cloudFile&&this._internal.cloudFile.getUrl()},outputs:{url:{type:"string",displayName:"URL",group:"General",description:"Address the file can be fetched from; a private file needs a Sign File URL node before this link works",get(){return this._internal.cloudFile&&this._internal.cloudFile.getUrl()}},name:{type:"string",displayName:"Name",group:"General",description:"Original file name as it was uploaded, without the storage prefix",get(){const e=this._internal.cloudFile;if(!e)return;const t="function"==typeof e.getFilename?e.getFilename():void 0;if("string"==typeof t&&""!==t)return t;if(void 0!==e.getTarget())return e.getName();const n=e.getName().split("_");return 1===n.length?n[0]:n.slice(1).join("_")}},contentType:{type:"string",displayName:"Content Type",group:"General",description:"MIME type the backend recorded on upload; empty on a backend that does not report one, and on a file read back from a record property",get(){return this._internal.cloudFile&&this._internal.cloudFile.getContentType()}},size:{type:"number",displayName:"Size",group:"General",description:"Size in bytes the backend recorded on upload; empty on a backend that does not report one, and on a file read back from a record property",get(){return this._internal.cloudFile&&this._internal.cloudFile.getSize()}}},inputs:{file:{type:"cloudfile",displayName:"Cloud File",group:"General",description:"Stored file to read, as an Upload File node or a record property produces it; any other value leaves the previous file in place",set(e){e instanceof i!=0&&(this._internal.cloudFile=e,this.flagOutputDirty("name"),this.flagOutputDirty("url"),this.flagOutputDirty("contentType"),this.flagOutputDirty("size"))}}}}};e.exports=o},8830(e,t,n){"use strict";t.resolveCollectionId=o,t.setCollectionIdInput=function(e){null!=e?(e instanceof i&&(e=e.getId()),this.setCollection(o(e))):this.setCollection(void 0)},t.addCollectionFailure=function(e,t){Object.assign(e,{outputs:e.outputs||{}});const n=e.methods||e.prototypeExtensions||(e.methods={});function i(e,n,i){this._internal.error=i,this.flagOutputDirty("error"),this.reportOutcome(e,"failure",{code:t+"/"+n,message:i})}Object.assign(e.outputs,{error:{type:"string",displayName:"Error",description:"Why the last attempt changed nothing, in one sentence; empty until something fails",group:"Error",getter:function(){return this._internal.error}}}),Object.assign(n,{_failNoCollection:function(e,t){i.call(this,e,"no-array","Nothing to "+t+" — no array is bound. Set the Array Id input, or connect one, before triggering this node.")},_failNoObjectId:function(e,t){i.call(this,e,"no-object-id","Nothing to "+t+" — no Object Id was supplied. Connect one before triggering this node.")},_failUnknownObjectId:function(e,t,n){i.call(this,e,"unknown-object-id",`Nothing to ${t} — no record with the Id "${n}" has been loaded, so this would have done nothing. Connect the Id from a query, a Repeater item or an Object node rather than from a raw string.`)},_clearCollectionFailure:function(){const e=this.context.editorConnection;if(!e)return;const n=this.nodeScope.componentOwner.name;e.clearWarning(n,this.id,t+"/no-array"),e.clearWarning(n,this.id,t+"/no-object-id"),e.clearWarning(n,this.id,t+"/unknown-object-id"),e.clearWarning(n,this.id,"insert-warning")}})};const i=n(1656);function o(e){if(void 0!==e)return i.get(e)}},4629(e,t,n){"use strict";const i=n(5162),o=n(8830),r={name:"CollectionClear",docs:"https://docs.noodl.net/nodes/data/array/clear-array",displayNodeName:"Clear Array",category:"Data",usePortAsLabel:"collectionId",color:"data",inputs:{collectionId:{type:{name:"string",identifierOf:"CollectionName",identifierDisplayName:"Array Ids"},displayName:"Array Id",description:"Id of the array to empty; clearing it unbinds the node, and the next Do then fails rather than emptying a throwaway array",group:"General",set:o.setCollectionIdInput},clear:{displayName:"Do",description:"Removes every item from the array, or fires Failure if no array is bound",group:"Actions",valueChangedToTrue(){const e=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(()=>{const t=this._internal.collection;if(void 0===t)return void this._failNoCollection(e,"clear");this._clearCollectionFailure();const n=0===t.length;t.set([]),this.reportOutcome(e,n?"unchanged":"done")})}}},outputs:{...(0,i.outcomeOutputs)({done:"Fires once the array has been emptied",unchanged:"Fires when the array was already empty, so nothing was removed",failure:"Fires when no array is bound, so nothing was changed"})},methods:{setCollectionID:function(e){this.setCollection((0,o.resolveCollectionId)(e))},setCollection:function(e){this._internal.collection=e}}},s={node:r};(0,o.addCollectionFailure)(r,"clear-array"),e.exports=s},2675(e,t,n){"use strict";const i=n(6835),o=n(5162),r=n(8830),s={name:"CollectionInsert",docs:"https://docs.noodl.net/nodes/data/array/insert-into-array",displayNodeName:"Insert Object Into Array",category:"Data",usePortAsLabel:"collectionId",color:"data",initialize:function(){},inputs:{collectionId:{type:{name:"string",identifierOf:"CollectionName",identifierDisplayName:"Array Ids"},displayName:"Array Id",description:"Id of the array to insert into; clearing it unbinds the node, and the next Do then fails rather than writing to a throwaway array",group:"General",set:r.setCollectionIdInput},modifyId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Object Id",description:"Id of the object to insert; a record with this id is created if none has been loaded yet",group:"Modify",set:function(e){this._internal.modifyId=e}},add:{displayName:"Do",description:"Adds the object named by Object Id to the array, or fires Failure if either cannot be resolved",group:"Actions",valueChangedToTrue:function(){const e=this._internal,t=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(()=>{if(this._clearCollectionFailure(),void 0===e.modifyId)return void this._failNoObjectId(t,"insert");if(void 0===e.collection)return void this._failNoCollection(t,"insert");const n=(this.nodeScope.modelScope||i).get(e.modifyId),o=e.collection.contains(n);e.collection.add(n),this.reportOutcome(t,o?"unchanged":"done")})}}},outputs:{...(0,o.outcomeOutputs)({done:"Fires once the object has been added to the array",unchanged:"Fires when the object was already in the array, so nothing was added",failure:"Fires when the array or the object could not be resolved, so nothing was changed"})},prototypeExtensions:{setCollectionID:function(e){this.setCollection((0,r.resolveCollectionId)(e))},setCollection:function(e){this._internal.collection=e}}},a={node:s};(0,r.addCollectionFailure)(s,"insert-into-array"),e.exports=a},8562(e,t,n){"use strict";const i=n(1656),o=n(5162),r={node:{name:"CollectionNew",docs:"https://docs.noodl.net/nodes/data/array/create-new-array",displayNodeName:"Create New Array",category:"Data",color:"data",initialize:function(){},inputs:{new:{displayName:"Do",description:"Creates a fresh array with a generated id and copies Items into it",group:"Actions",valueChangedToTrue:function(){this.scheduleNew()}},items:{type:"array",group:"General",displayName:"Items",description:"Contents to copy into the new array when Do fires; leave unconnected to start empty",set:function(e){this._internal.sourceCollection=e}}},outputs:{id:{type:"string",displayName:"Id",description:"Id of the array made by the last Do — give it to an Array node or a mutator to reach the same array; empty until Do has fired",group:"General",getter:function(){return this._internal.collection?this._internal.collection.getId():void 0}},...(0,o.outcomeOutputs)({done:"Fires once the new array exists and Id is up to date"})},prototypeExtensions:{setCollection:function(e){this._internal.collection=e,this.flagOutputDirty("id")},scheduleNew:function(){this.pendingNewOutcomes||(this.pendingNewOutcomes=[]),this.pendingNewOutcomes.push(this.beginOutcome()),this.hasScheduledNew||(this.hasScheduledNew=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledNew=!1;const e=this.pendingNewOutcomes||[];this.pendingNewOutcomes=void 0;const t=i.get();void 0!==this._internal.sourceCollection&&t.set(this._internal.sourceCollection),this.setCollection(t),(0,o.reportOutcomes)(this,e,"done")}))}}}};e.exports=r},2990(e,t,n){"use strict";const i=n(6835),o=n(5162),r=n(8830),s={name:"CollectionRemove",docs:"https://docs.noodl.net/nodes/data/array/remove-from-array",displayNodeName:"Remove Object From Array",category:"Data",usePortAsLabel:"collectionId",color:"data",initialize:function(){},inputs:{collectionId:{type:{name:"string",identifierOf:"CollectionName",identifierDisplayName:"Array Ids"},displayName:"Array Id",description:"Id of the array to remove from; clearing it unbinds the node, and the next Do then fails rather than acting on a throwaway array",group:"General",set:r.setCollectionIdInput},modifyId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Object Id",description:"Id of the object to remove; the record must already have been loaded, or the removal is refused instead of quietly doing nothing",group:"Modify",set:function(e){this._internal.modifyId=e}},remove:{displayName:"Do",description:"Removes the object named by Object Id from the array, or fires Failure if either cannot be resolved",group:"Actions",valueChangedToTrue:function(){const e=this._internal,t=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(()=>{if(this._clearCollectionFailure(),void 0===e.modifyId)return void this._failNoObjectId(t,"remove");if(void 0===e.collection)return void this._failNoCollection(t,"remove");const n=this.nodeScope.modelScope||i;if(!n.exists(e.modifyId))return void this._failUnknownObjectId(t,"remove",e.modifyId);const o=n.get(e.modifyId),r=e.collection.contains(o);e.collection.remove(o),this.reportOutcome(t,r?"done":"unchanged")})}}},outputs:{...(0,o.outcomeOutputs)({done:"Fires once the object has been removed from the array",unchanged:"Fires when the object was not in the array, so nothing was removed",failure:"Fires when the array or the object could not be resolved, so nothing was changed"})},prototypeExtensions:{setCollectionID:function(e){this.setCollection((0,r.resolveCollectionId)(e))},setCollection:function(e){this._internal.collection=e}}},a={node:s};(0,r.addCollectionFailure)(s,"remove-from-array"),e.exports=a},7179(e,t,n){"use strict";const i=n(7268),o=n(1656),r=n(5162),s={node:{name:"Collection2",docs:"https://docs.noodl.net/nodes/data/array/array-node",displayNodeName:"Array",category:"Data",usePortAsLabel:"collectionId",color:"data",runOnValueChange:{controlSignal:"fetch",inputs:["collectionId"],sources:[{name:"array",displayName:"Array contents"}]},initialize:function(){let e=!1;this._internal.collectionChangedCallback=()=>{this.shouldRunOnValueChange("array")&&(e||(e=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.sendSignalOnOutput("changed"),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("count"),e=!1})))},this._internal.sourceCollectionChangedCallback=()=>{this.scheduleCopyItems()}},getInspectInfo(){const e=this._internal.collection;return e?[{type:"text",value:"Id: "+e.getId()},{type:"value",value:e.items}]:{type:"text",value:"[No Array]"}},inputs:{collectionId:{type:{name:"string",identifierOf:"CollectionName",identifierDisplayName:"Array Ids"},displayName:"Id",description:"Id of the shared array to bind to; the first node to use an id creates the array, and every later node naming it reaches the same one",group:"General",set:function(e){e instanceof o&&(e=e.getId());const t=this._internal.collectionId;this._internal.collectionId=e,this.shouldRunOnValueChanged("collectionId",t,e)?this.setCollectionID(e):this.flagOutputDirty("id")}},items:{type:"array",group:"General",displayName:"Items",description:"undefined leaves this Array's current collection alone (no opinion supplied). null clears it — every item is removed and Changed fires once, the same as connecting an empty collection.",set:function(e){void 0!==e&&e!==this._internal.collection&&(this._internal.pendingSourceCollection=e,this.scheduleAfterInputsHaveUpdated(()=>{this.setSourceCollection(e)}))}},fetch:{displayName:"Fetch",description:"Re-reads the array named by Id and rebinds this node to it. This is additional to Id rebinding on change and to array changes being announced; untick either under Run On Value Change to stop it",group:"Actions",valueChangedToTrue:function(){this.scheduleSetCollection()}}},outputs:{id:{type:"string",displayName:"Id",description:"Id of the array this node is currently bound to",group:"General",getter:function(){return this._internal.collection?this._internal.collection.getId():this._internal.collectionId}},items:{type:"array",displayName:"Items",description:"The bound array itself, for a Repeater or another Array node to read",group:"General",getter:function(){return this._internal.collection}},firstItemId:{type:"string",displayName:"First Item Id",description:"Id of the first object in the array, or empty while the array holds nothing",group:"General",getter:function(){if(this._internal.collection){const e=this._internal.collection.get(0);if(void 0!==e)return e.getId()}}},count:{type:"number",displayName:"Count",description:"How many objects the bound array holds",group:"General",getter:function(){return this._internal.collection?this._internal.collection.size():0}},changed:{group:"Events",type:"signal",displayName:"Changed",description:"Fires when the bound array gains or loses items; with Array contents unticked it stays silent and only Fetch updates the node"},fetched:{group:"Events",type:"signal",displayName:"Fetched",description:"Fires once Fetch has rebound this node and the outputs are up to date"},...(0,r.outcomeOutputs)({done:"Fires when a Fetch finished and the outputs are up to date"})},prototypeExtensions:{setCollectionID:function(e){this.setCollection(o.get(e))},setCollection:function(e){this._internal.collection&&this._internal.collection.off("change",this._internal.collectionChangedCallback),this._internal.collection=e,this.flagOutputDirty("id"),e.on("change",this._internal.collectionChangedCallback),this.flagOutputDirty("items"),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("count")},setSourceCollection:function(e){const t=this._internal;t.sourceCollection&&t.sourceCollection instanceof o&&t.sourceCollection.off("change",t.sourceCollectionChangedCallback),t.sourceCollection=e,t.sourceCollection instanceof o&&t.sourceCollection.on("change",t.sourceCollectionChangedCallback),this._copySourceItems()},scheduleSetCollection:function(){(this._internal.pendingFetch||(this._internal.pendingFetch=[])).push(this.beginOutcome()),this.hasScheduledSetCollection||(this.hasScheduledSetCollection=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledSetCollection=!1;const e=this._internal.pendingFetch||[];this._internal.pendingFetch=[],this.setCollectionID(this._internal.collectionId),this.sendSignalOnOutput("fetched"),(0,r.reportOutcomes)(this,e,"done")}))},_copySourceItems:function(){const e=this._internal;void 0===e.collection&&this.shouldRunOnValueChange("collectionId")&&this.setCollection(o.get()),e.collection&&e.collection.set(e.sourceCollection)},scheduleCopyItems:function(){this.hasScheduledCopyItems||(this.hasScheduledCopyItems=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledCopyItems=!1,this._copySourceItems()}))},_onNodeDeleted:function(){i.prototype._onNodeDeleted.call(this),this._internal.collection&&this._internal.collection.off("change",this._internal.collectionChangedCallback);const e=this._internal.sourceCollection;e&&"function"==typeof e.off&&e.off("change",this._internal.sourceCollectionChangedCallback)}}}};e.exports=s},4089(e,t,n){"use strict";const i=n(7268),o=n(4830),r=n(6835),s=n(1656),a=n(7011),l=n(8600),u=n(3024),c=n(8479),d=n(5153),p=n(2114),h=n(1711),f=n(5838),g=r,m=s,y={name:"DbCollection2",docs:"https://docs.noodl.net/nodes/data/cloud-data/query-records",displayName:"Query Records",category:"Cloud Services",usePortAsLabel:"collectionName",color:"data",initialize:function(){const e=this;this._internal.queryParameters={},this.registerRunOnValueChangeInput("records","Record changes"),this.registerRunOnValueChangeInput("querySettings","Query settings");let t=!1;this._internal.collectionChangedCallback=function(){t||(t=!0,e.scheduleAfterInputsHaveUpdated(function(){e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty"),t=!1}))},this._internal.cloudStoreEvents=function(t){if(e.shouldRunOnValueChange("records")&&void 0!==e._internal.collection&&t.collection===e._internal.name)if(e._internal.search)e.scheduleFetch();else if("create"===t.type){const i=g.get(t.object.objectId);void 0!==i&&u.matchesQuery(i,e._internal.currentQuery.where)&&n(i)}else if("save"===t.type){const i=g.get(t.objectId);if(void 0!==i){const t=u.matchesQuery(i,e._internal.currentQuery.where);if(!t&&e._internal.collection.contains(i))e._internal.collection.remove(i),e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty");else if(t&&!e._internal.collection.contains(i))n(i);else if(t){const t=e._internal.currentQuery.sort;if(Array.isArray(t)?t.length>0:void 0!==t){const n=e._internal.collection;let o=-1;for(let e=0;e<n.size();e++)n.get(e)===i&&(o=e);n.remove(i);let r=0;for(r=0;r<n.size()&&!(u.compareObjects(t,n.get(r),i)>0);r++);n.addAtIndex(i,r),r!==o&&(e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty"))}}}}else if("delete"===t.type){const n=g.get(t.objectId);void 0!==n&&(e._internal.collection.remove(n),e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty"))}function n(t){const n=e._internal.currentQuery.sort,i=Array.isArray(n)?n.length>0:void 0!==n,o=e._internal.currentQuery.limit;if(!i&&void 0!==o&&e._internal.collection.size()+1>o)return void e.scheduleFetch();let r=0;if(i){for(r=0;r<e._internal.collection.size()&&!(u.compareObjects(n,e._internal.collection.get(r),t)>0);r++);e._internal.collection.addAtIndex(t,r)}else e._internal.collection.add(t);const s=e._internal.collection.size();void 0!==o&&s>o&&e._internal.collection.remove(e._internal.collection.get(s-1)),e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty")}},this.bindStoreEvents(a.forScope(this.nodeScope.modelScope)),this._internal.storageSettings={}},getInspectInfo(){const e=this._internal.collection;return e?[{type:"value",value:e.items}]:{type:"text",value:"[Not executed yet]"}},inputs:{},outputs:{items:{type:"array",displayName:"Items",group:"General",description:"Records the query matched, in the order Sort asks for; empty before the first query has run",getter:function(){return this._internal.collection}},firstItemId:{type:"string",displayName:"First Record Id",group:"General",description:"Id of the first matched record, for feeding a Record node without going through a repeater",getter:function(){if(this._internal.collection){const e=this._internal.collection.get(0);if(void 0!==e)return e.getId()}}},isEmpty:{type:"boolean",displayName:"Is Empty",group:"General",description:"True when the query matched nothing, and also true before the first query has run",getter:function(){return!this._internal.collection||0===this._internal.collection.size()}},count:{type:"number",displayName:"Count",group:"General",description:"How many records are in Items, which Limit caps — turn on Fetch total count for the uncapped figure",getter:function(){return this._internal.collection?this._internal.collection.size():0}},fetched:{group:"Events",type:"signal",displayName:"Success",description:"Fires once the query has returned and Items is up to date"},failure:{group:"Events",type:"signal",displayName:"Failure",description:"Fires when the query could not be run, after the reason has been reported on the error channel"},error:{type:"string",displayName:"Error",group:"Error",description:"Why the last query failed; empty until one does",getter:function(){return this._internal.error}},subscribed:{type:"boolean",displayName:"Subscribed",group:"Realtime",description:"True while the backend has confirmed the subscription and is delivering changes",getter:function(){return"subscribed"===this._internal.realtimeStatus}},realtimeStatus:{type:"string",displayName:"Realtime Status",group:"Realtime",description:'connecting, subscribed, interrupted or stopped. Four states rather than a boolean, because "connecting for the first time" and "dropped and retrying" want different things on screen',getter:function(){return this._internal.realtimeStatus||""}},realtimeError:{type:"object",displayName:"Realtime Error",group:"Realtime",description:"The last realtime failure, with a code and whether retrying can help; null until one happens",getter:function(){return this._internal.realtimeError||null}},realtimeFailure:{type:"signal",displayName:"Realtime Failure",group:"Realtime",description:"Fires when a subscription cannot connect, is rejected, or has been given up on"},created:{type:"signal",displayName:"Record Created",group:"Realtime",description:"Another client created a record in this collection"},updated:{type:"signal",displayName:"Record Updated",group:"Realtime",description:"Another client updated a record in this collection"},deleted:{type:"signal",displayName:"Record Deleted",group:"Realtime",description:"Another client deleted a record from this collection"},changed:{type:"signal",displayName:"Records Changed",group:"Realtime",description:"Any of the three, and also the backend saying the view may be stale after a reconnect — the one to react to if you do not care which happened"},changedEvent:{type:"string",displayName:"Change Type",group:"Realtime",description:"create, update, delete, init or resync",getter:function(){return this._internal.realtimeEvent||""}},changedRecord:{type:"object",displayName:"Changed Record",group:"Realtime",description:"The record the change was about. ⚠️ Null on a delete against Directus, which sends only the key — use Changed Record Id, which every backend fills",getter:function(){return this._internal.changedRecord||null}},changedRecords:{type:"array",displayName:"Changed Records",group:"Realtime",description:"Every record in the change frame; some backends batch",getter:function(){return this._internal.changedRecords||[]}},changedRecordId:{type:"string",displayName:"Changed Record Id",group:"Realtime",description:"The id of the changed record, always a string — even where the backend's primary key is an integer",getter:function(){return this._internal.changedRecordId||""}}},prototypeExtensions:{setCollectionName:function(e){const t=this._internal.name;this._internal.name=e,this.shouldRunOnValueChanged("collectionName",t,e)&&this.scheduleFetch(),(0,f.valueDidChange)(t,e)&&this.scheduleRealtimeReconfigure()},setCollection:function(e){this.bindCollection(e),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("isEmpty"),this.flagOutputDirty("items"),this.flagOutputDirty("count")},unbindCurrentCollection:function(){const e=this._internal.collection;e&&(e.off("change",this._internal.collectionChangedCallback),this._internal.collection=void 0)},bindCollection:function(e){this.unbindCurrentCollection(),this._internal.collection=e,e&&e.on("change",this._internal.collectionChangedCallback)},bindStoreEvents:function(e){const t=this._internal.boundStore;t!==e&&(t&&(t.off("create",this._internal.cloudStoreEvents),t.off("delete",this._internal.cloudStoreEvents),t.off("save",this._internal.cloudStoreEvents)),this._internal.boundStore=e,e&&(e.on("save",this._internal.cloudStoreEvents),e.on("create",this._internal.cloudStoreEvents),e.on("delete",this._internal.cloudStoreEvents)))},_onNodeDeleted:function(){i.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection(),this.bindStoreEvents(void 0),this.teardownRealtime()},setRealtime:function(e){const t=this._internal.realtime;this._internal.realtime=!!e,(0,f.valueDidChange)(!!t,this._internal.realtime)&&this.scheduleRealtimeReconfigure()},scheduleRealtimeReconfigure:function(){this._internal.realtimeReconfigureScheduled||(this._internal.realtimeReconfigureScheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._internal.realtimeReconfigureScheduled=!1,this.reconfigureRealtime()}))},reconfigureRealtime:function(){var e;if(this.teardownRealtime(),!this._internal.realtime)return;const t=this._internal.name;if(!t)return;const n=null===(e=this.context)||void 0===e?void 0:e.platform;if(n&&"function"==typeof n.isSSRServer&&n.isSSRServer())return;const i=(0,c.resolveBackendFromRuntime)(this._internal.backendId);if(!i)return void this.handleRealtimeError({message:`The backend this node is set to ("${this._internal.backendId}") is not configured in this project.`,code:"CAPABILITY_UNAVAILABLE",kind:"fatal"});const o=(0,d.realtimeSupportFor)(i.handle.type);"unsupported"!==o.state?(this._internal.subscription=(0,d.createRealtimeSubscription)(i.handle,{collection:t,primaryKey:this.realtimePrimaryKey(i.collections,i.isParseWire),onEvent:this.handleRealtimeChange.bind(this),onStatus:this.handleRealtimeStatus.bind(this),onError:this.handleRealtimeError.bind(this)}),this.handleRealtimeStatus(this._internal.subscription.status)):this.handleRealtimeError({message:o.reason||"This backend does not support realtime.",code:"CAPABILITY_UNAVAILABLE",kind:"fatal"})},teardownRealtime:function(){this._internal.subscription&&(this._internal.subscription.dispose(),this._internal.subscription=null),this._internal.realtimeStatus&&(this._internal.realtimeStatus=void 0,this.flagOutputDirty("subscribed"),this.flagOutputDirty("realtimeStatus"))},realtimePrimaryKey:function(e,t){const n=(e||[]).find(e=>e.name===this._internal.name);return(null==n?void 0:n.primaryKey)||(t?"objectId":"id")},handleRealtimeChange:function(e){if(this._internal.realtimeEvent=e.type,this._internal.changedRecord=e.recordsComplete&&e.records.length>0?e.records[0]:null,this._internal.changedRecords=e.recordsComplete?e.records:[],this._internal.changedRecordId=e.ids.length>0?e.ids[0]:"",this.flagOutputDirty("changedEvent"),this.flagOutputDirty("changedRecord"),this.flagOutputDirty("changedRecords"),this.flagOutputDirty("changedRecordId"),"init"===e.type)return;const t={create:"created",update:"updated",delete:"deleted"};t[e.type]&&this.sendSignalOnOutput(t[e.type]),this.sendSignalOnOutput("changed"),this.shouldRunOnValueChange("records")&&this.scheduleFetch()},handleRealtimeStatus:function(e){this._internal.realtimeStatus=e,"subscribed"===e&&this._internal.realtimeError&&(this._internal.realtimeError=null,this.flagOutputDirty("realtimeError")),this.flagOutputDirty("subscribed"),this.flagOutputDirty("realtimeStatus")},handleRealtimeError:function(e){this._internal.realtimeError=e,this.flagOutputDirty("realtimeError"),this.sendSignalOnOutput("realtimeFailure"),this.raiseRuntimeError("query-records/realtime-failed",e.message||"The realtime subscription failed.",e)},setError:function(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.raiseRuntimeError("query-records/query-failed",e)},scheduleFetch:function(){const e=this._internal;e.fetchScheduled||(e.fetchScheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{e.fetchScheduled=!1,this.fetch()}))},fetch:function(){this.context.editorConnection&&(void 0===this._internal.name?this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"query-collection",{message:"No collection specified for query"}):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"query-collection"));const e=a.forBackend(this.nodeScope.modelScope,this._internal.backendId);if(!e)return void this.setError(`The backend this node is set to ("${this._internal.backendId}") is not configured in this project.`);this.bindStoreEvents(e);const t=m.get(),n=this.getStorageFilter();if(n&&n.failed)return void this.setError(n.failed);const i=this.getStorageLimit(),o=this.getStorageSkip(),r=this.getStorageFetchTotalCount(),s=this._internal.search||void 0;this._internal.currentQuery={where:n.where,sort:n.sort,limit:i,skip:o,search:s},e.query({collection:this._internal.name,where:e.usesNeutralFilter?n.neutralWhere:n.where,sort:n.sort,limit:i,skip:o,count:r,search:s,success:(e,n)=>{void 0!==e&&t.set(e.map(e=>a._fromJSON(e,this._internal.name,this.nodeScope.modelScope))),void 0!==n&&(this._internal.storageSettings.storageTotalCount=n,this.hasOutput("storageTotalCount")&&this.flagOutputDirty("storageTotalCount")),this.setCollection(t),this.sendSignalOnOutput("fetched")},error:e=>{void 0===this._internal.collection&&this.setCollection(t),this.setError(e||"Failed to fetch.")}})},getStorageFilter:function(){const e=this._internal.storageSettings;if(void 0===e.storageFilterType||"simple"===e.storageFilterType){let e,t;if(void 0!==this._internal.visualFilter)try{const n={queryParameters:this._internal.queryParameters,collectionName:this._internal.name,valuePortPrefix:"qp-"};t=u.convertVisualFilterToNeutral(this._internal.visualFilter,n),e=u.convertVisualFilter(this._internal.visualFilter,n)}catch(e){return this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"query-collection-filter",{message:e.message}),{failed:e.message||"The filter could not be applied."}}return{where:e,neutralWhere:t,sort:void 0!==this._internal.visualSorting?u.convertVisualSorting(this._internal.visualSorting):void 0}}if("json"===e.storageFilterType){if(!this._internal.filterFunc)try{let t="string"==typeof e.storageJSONFilter?e.storageJSONFilter:w;t=t.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""),this._internal.filterVariables=t.match(/\$[A-Za-z0-9]+/g)||[];const n=["filter","where","sort","Inputs"].concat(this._internal.filterVariables).concat([t]);this._internal.filterFunc=Function.apply(null,n)}catch(e){return this._internal.filterFunc=void 0,{failed:"The filter script could not be read: "+(e.message||String(e))}}let t,n,i={},o=[];const r=this,s=function(e){n=e,i=u.convertFilterOp(e,{collectionName:r._internal.name,error:function(e){t=e,r.context.editorConnection&&r.context.editorConnection.sendWarning(r.nodeScope.componentOwner.name,r.id,"query-collection-filter",{message:e})}})},a=function(e){o=e},l={};for(const t in e)t.startsWith("storageFilterValue-")&&(l[t.substring(19)]=e[t]);const c=[s,s,a,l];this._internal.filterVariables.forEach(t=>{c.push(e["storageFilterValue-"+t.substring(1)])});try{this._internal.filterFunc.apply(this,c)}catch(e){return void 0!==t?{failed:t}:{failed:"The filter script failed: "+(e.message||String(e))}}return void 0!==t?{failed:t}:{where:i,neutralWhere:n,sort:o}}},getStorageLimit:function(){const e=this._internal.storageSettings;return e.storageEnableLimit?e.storageLimit||10:void 0},getStorageSkip:function(){const e=this._internal.storageSettings;return e.storageEnableLimit?e.storageSkip||0:void 0},getStorageFetchTotalCount:function(){return!!this._internal.storageSettings.storageEnableCount},registerOutputIfNeeded:function(e){this.hasOutput(e)||this.registerOutput(e,{getter:v.bind(this,e)})},setVisualFilter:function(e){this._internal.visualFilter=e,this.shouldRunOnValueChange("querySettings")&&this.scheduleFetch()},setVisualSorting:function(e){this._internal.visualSorting=e,this.shouldRunOnValueChange("querySettings")&&this.scheduleFetch()},setSearch:function(e){const t=this._internal.search;this._internal.search=e,this.shouldRunOnValueChanged("search",t,e)&&this.scheduleFetch()},setQueryParameter:function(e,t){const n=this._internal.queryParameters[e];this._internal.queryParameters[e]=t,this.shouldRunOnValueChanged("qp-"+e,n,t)&&this.scheduleFetch()},registerInputIfNeeded:function(e){if(this.hasInput(e))return;if(e.startsWith("qp-"))return this.registerInput(e,{set:this.setQueryParameter.bind(this,e.substring(3))}),void this.registerRunOnValueChangeInput(e,e.substring(3));const t={storageFetch:this.scheduleFetch.bind(this)};if(t[e])return this.registerInput(e,{set:o.createSetter({valueChangedToTrue:t[e]})});const n={collectionName:this.setCollectionName.bind(this),visualFilter:this.setVisualFilter.bind(this),visualSort:this.setVisualSorting.bind(this),search:this.setSearch.bind(this),backendId:e=>{const t=this._internal.backendId;this._internal.backendId=e,this.shouldRunOnValueChanged("querySettings",t,e)&&this.scheduleFetch(),(0,f.valueDidChange)(t,e)&&this.scheduleRealtimeReconfigure()},realtime:this.setRealtime.bind(this)};if(n[e])return this.registerInput(e,{set:n[e]}),"collectionName"===e&&this.registerRunOnValueChangeInput(e,"Class"),void("search"===e&&this.registerRunOnValueChangeInput(e,"Search"));this.registerInput(e,{set:b.bind(this,e)})}}};function v(e){return this._internal.storageSettings[e]}function b(e,t){const n=this._internal.storageSettings[e];this._internal.storageSettings[e]=t,this.shouldRunOnValueChanged("querySettings",n,t)&&this.scheduleFetch()}const w="// Write your query script here, check out the reference documentation for examples\nwhere({ })\n";function _(e,t,n,i){const o=[],r=(0,p.recordSchemaContext)(i,t);if(o.push(...(0,p.recordBackendPickerPorts)(r)),o.push(...(0,p.recordClassPorts)(r)),o.push({name:"storageFilterType",type:{name:"enum",allowEditOnly:!0,enums:[{value:"simple",label:"Visual"},{value:"json",label:"Javascript"}]},displayName:"Filter",default:"simple",plug:"input",group:"General"}),o.push({type:"string",plug:"input",group:"Search",name:"search",displayName:"Search"}),o.push({type:"boolean",plug:"input",group:"Limit",name:"storageEnableLimit",displayName:"Use limit"}),t.storageEnableLimit&&(o.push({type:"number",default:10,plug:"input",group:"Limit",name:"storageLimit",displayName:"Limit"}),o.push({type:"number",default:0,plug:"input",group:"Limit",name:"storageSkip",displayName:"Skip"})),o.push({type:"signal",plug:"input",group:"Actions",name:"storageFetch",displayName:"Do"}),o.push(...(0,f.runOnChangeDynamicPorts)(["collectionName","search","records","querySettings"],{collectionName:"Class",search:"Search",records:"Record changes",querySettings:"Query settings"})),o.push({type:"boolean",plug:"input",group:"Realtime",name:"realtime",default:!1,displayName:"Subscribe To Changes",tooltip:"Keep Items current from the server: re-runs this query when another client creates, updates or deletes a record, and fires the Record Created/Updated/Deleted signals. Not every backend can — see Realtime Error."}),o.push({type:"boolean",plug:"input",group:"Total Count",name:"storageEnableCount",displayName:"Fetch total count"}),t.storageEnableCount&&o.push({type:"number",plug:"output",group:"General",name:"storageTotalCount",displayName:"Total Count"}),void 0===t.storageFilterType||"simple"===t.storageFilterType){if(void 0!==t.collectionName){const e=(0,p.recordFilterSchema)(r);e&&(o.push({name:"visualFilter",plug:"input",type:{name:"query-filter",schema:e,allowEditOnly:!0,backend:(0,p.recordFilterBackendType)(r,u.backendType()),valuePortPrefix:"qp-"},displayName:"Filter",group:"Filter"}),o.push({name:"visualSort",plug:"input",type:{name:"query-sorting",schema:e,allowEditOnly:!0},displayName:"Sort",group:"Sorting"})),void 0!==t.visualFilter&&u.collectFilterParameters(t.visualFilter,"qp-").forEach(e=>{o.push({name:"qp-"+e,plug:"input",type:"*",displayName:e,group:"Query Parameters"}),o.push(...(0,f.runOnChangeDynamicPorts)(["qp-"+e],{["qp-"+e]:e}))})}}else if("json"===t.storageFilterType){o.push({type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},plug:"input",group:"Filter",name:"storageJSONFilter",default:w,displayName:"Filter"});let e=t.storageJSONFilter;if(e){e=e.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"");const t=e.match(/\$[A-Za-z0-9]+/g);if(t){const e={};t.forEach(t=>{e[t]=!0}),Object.keys(e).forEach(e=>{o.push({name:"storageFilterValue-"+e.substring(1),displayName:e.substring(1),group:"Filter Values",plug:"input",type:{name:"*",allowConnectionsOnly:!0}})})}l.parseAndAddPortsFromScript(e,o,{inputPrefix:"storageFilterValue-",inputGroup:"Filter Values",inputType:{name:"*",allowConnectionsOnly:!0},skipOutputs:!0})}}(0,h.sendSchemaPorts)(n,e,o,{staticPorts:(0,h.staticPortNames)(y)})}const S={node:y,setup:function(e,t){function n(n){_(n.id,n.parameters,e.editorConnection,t),n.on("parameterUpdated",function(i){(i.name.startsWith("storage")||"visualFilter"===i.name||"collectionName"===i.name||"backendId"===i.name)&&_(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.dbCollections",function(){a.invalidateCollections(),_(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.systemCollections",function(){a.invalidateCollections(),_(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.cloudservices",function(){a.instance._initCloudServices(),_(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.backendServices",function(){_(n.id,n.parameters,e.editorConnection,t)})}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",()=>{t.on("nodeAdded.DbCollection2",function(e){n(e)});for(const e of t.getNodesWithType("DbCollection2"))n(e)})}};e.exports=S},5427(e,t,n){"use strict";const i=n(6835),o=n(7268),r=n(7011),s=n(3099),a=n(5162),l=n(2114),u=n(1711),c=i,d=r,p="record/storage-op-failed",h={addInputProperties:function(e){const t={node:Object.assign({},e.node),setup:e.setup},n=Object.assign({},e.node.methods);e._hasInputProperties=!0,e.node.wireDeclaredPortPrefix="prop-",Object.assign(e.node,{inputs:e.node.inputs||{},outputs:e.node.outputs||{},methods:e.node.methods||{}}),Object.assign(e.node,{initialize:function(){this._internal.inputValues={},t.node.initialize&&t.node.initialize.call(this)}}),Object.assign(e.node.outputs,{}),Object.assign(e.node.inputs,{}),Object.assign(e.node.methods,{registerInputIfNeeded:function(e){this.hasInput(e)||(e.startsWith("prop-")&&this.registerInput(e,{set:this._setInputValue.bind(this,e.substring(5))}),n&&n.registerInputIfNeeded&&n.registerInputIfNeeded.call(this,e))},_setInputValue:function(e,t){this._internal.inputValues[e]=t}})},addModelId:function(e,t){const n=Object.assign({},e.node.methods),i=void 0===t||t.includeInputs,r=void 0===t||t.includeOutputs;Object.assign(e.node,{inputs:e.node.inputs||{},outputs:e.node.outputs||{},methods:e.node.methods||{}}),i&&(Object.assign(e.node,{usePortAsLabel:"collectionName"}),e.node.dynamicports=(e.node.dynamicports||[]).concat([{name:"conditionalports/extended",condition:"idSource = explicit OR idSource NOT SET",inputs:["modelId"]},{name:"conditionalports/extended",condition:"idSource = foreach",inputs:["repeaterComponent"]}]),Object.assign(e.node.inputs,{idSource:{type:{name:"enum",enums:[{label:"Specify explicitly",value:"explicit"},{label:"From repeater",value:"foreach"}],allowEditOnly:!0},default:"explicit",displayName:"Id Source",group:"General",description:"Whether the record comes from the Id input or from the record the surrounding Repeater is on",tooltip:"Choose if you want to specify the Id explicitly, \n or if you want it to be that of the current record in a repeater.",set:function(e){this._internal.idSource=e,"foreach"===e&&this.bindToRepeaterItem()}},repeaterComponent:{type:"component",displayName:"Repeater Component",group:"General",description:"Names which Repeater supplies the current record when Id Source is From repeater; leave blank to use the nearest enclosing one",set:function(e){this._internal.repeaterComponent=e||void 0,"foreach"===this._internal.idSource&&this.bindToRepeaterItem()}},modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",description:"Id of the record this node acts on; a record itself is accepted here as well as its Id",set:function(e){e instanceof c&&(e=e.getId()),this._internal.modelId=e,this.setModelID(e)}}})),r&&Object.assign(e.node.outputs,{id:{type:"string",displayName:"Id",group:"General",description:"Id of the record this node last acted on, which on Create Record is the Id the backend assigned",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}}}),Object.assign(e.node.methods,{bindToRepeaterItem:function(){this.scheduleAfterInputsHaveUpdated(()=>{this.setModel((0,s.resolveForEachItem)(this,{target:this._internal.repeaterComponent}))})},_onNodeDeleted:function(){o.prototype._onNodeDeleted.call(this),(0,s.forgetForEachItem)(this)},setCollectionID:function(e){this._internal.collectionId=e,this.clearWarnings()},setModelID:function(e){if(null==e||""===e)return void this.setModel(void 0);const t=(this.nodeScope.modelScope||c).get(e);this.setModel(t)},setModel:function(e){this._internal.model=e,this.flagOutputDirty("id")},registerInputIfNeeded:function(e){this.hasInput(e)||("collectionName"===e&&this.registerInput(e,{set:this.setCollectionID.bind(this)}),n&&n.registerInputIfNeeded&&n.registerInputIfNeeded.call(this,e))}})},addBaseInfo:function(e,t){Object.assign(e.node,{category:"Data",color:"data",inputs:e.node.inputs||{},outputs:e.node.outputs||{},methods:e.node.methods||{}}),Object.assign(e.node.outputs,{...(0,a.outcomeOutputs)({done:t&&t.done,failure:"Fires when the backend refused the operation or the node had nothing valid to send, with the reason on Error"}),error:{type:"string",displayName:"Error",group:"Error",description:"Why the most recent attempt failed, kept after a later attempt succeeds",getter:function(){return this._internal.error}}}),Object.assign(e.node.methods,{registerInputIfNeeded:function(e){this.hasInput(e)||"backendId"===e&&this.registerInput(e,{set:e=>{this._internal.backendId=e}})},scheduleOnce:function(e,t){const n=this,i="hasScheduled"+e;this._internal[i]||(this._internal[i]=!0,this.scheduleAfterInputsHaveUpdated(function(){n._internal[i]=!1,t()}))},pendingOutcomes:function(e){const t="pendingOutcomes"+e;return this._internal[t]||(this._internal[t]=[])},takeOutcomes:function(e){const t="pendingOutcomes"+e,n=this._internal[t]||[];return this._internal[t]=[],n},checkWarningsBeforeCloudOp(e){return this.clearWarnings(),!!this._internal.collectionId||(this.setError("No class name specified",e),!1)},cloudStore:function(e){return this.cloudStoreForScope(this.nodeScope.modelScope,e)},cloudStoreForScope:function(e,t){const n=d.forBackend(e,this._internal.backendId);return n||this.setError(`The backend this node is set to ("${this._internal.backendId}") is not configured in this project.`,t),n},setError:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,a.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:p,message:e})},clearWarnings(){if(this.context.editorConnection){const e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,p),this.context.editorConnection.clearWarning(e,this.id,"storage-op-warning")}}}),Object.assign(e,{setup:function(t,n){function i(i){var o;function r(){const o=(0,l.recordSchemaContext)(n,i.parameters),r=[];if(r.push(...(0,l.recordBackendPickerPorts)(o)),r.push(...(0,l.recordClassPorts)(o)),e._hasRelationProperty&&o.selectedCollection&&r.push(...(0,l.recordRelationPorts)(o)),e._hasInputProperties){const e=o.selectedCollection?(0,l.recordFieldPorts)(o,{plug:"input"}):[];r.push(...e),r.push(...(0,l.recordWiredFieldPorts)(i,e,{plug:"input"}))}e._additionalDynamicPorts&&e._additionalDynamicPorts(i,r,n),(0,u.sendSchemaPorts)(t.editorConnection,i.id,r,{staticPorts:(0,u.staticPortNames)(e.node)})}r(),i.on("parameterUpdated",function(){r()}),i.on("inputConnectionAdded",function(){r()}),i.on("inputConnectionRemoved",function(){r()});const s=function(e){e&&(e.sourceId!==i.id&&e.targetId!==i.id||r())};"function"==typeof(null===(o=i.component)||void 0===o?void 0:o.on)&&(i.component.on("connectionAdded",s,i),i.component.on("connectionRemoved",s,i)),n.on("metadataChanged.dbCollections",function(){d.invalidateCollections(),r()}),n.on("metadataChanged.systemCollections",function(){d.invalidateCollections(),r()}),n.on("metadataChanged.backendServices",function(){r()}),n.on("metadataChanged.cloudservices",function(){r()})}t.editorConnection&&t.editorConnection.isRunningLocally()&&n.on("editorImportComplete",()=>{n.on("nodeAdded."+e.node.name,function(e){i(e)});for(const t of n.getNodesWithType(e.node.name))i(t)})}})},addRelationProperty:function(e){const t=Object.assign({},e.node.methods);e._hasRelationProperty=!0,Object.assign(e.node,{inputs:e.node.inputs||{},outputs:e.node.outputs||{},methods:e.node.methods||{}}),Object.assign(e.node.inputs,{targetId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Target Record Id",group:"General",description:"Id of the record at the other end of the relation, which must come from a Query Records or Record output so that its class is known",set:function(e){this._internal.targetModelId=e}}}),Object.assign(e.node.methods,{registerInputIfNeeded:function(e){this.hasInput(e)||("relationProperty"===e&&this.registerInput(e,{set:this.setRelationProperty.bind(this)}),t&&t.registerInputIfNeeded&&t.registerInputIfNeeded.call(this,e))},setRelationProperty:function(e){this._internal.relationProperty=e}})},addAccessControl:function(e){const t={node:Object.assign({},e.node),setup:e.setup},n=Object.assign({},e.node.methods);Object.assign(e.node,{inputs:e.node.inputs||{},outputs:e.node.outputs||{},methods:e.node.methods||{}}),Object.assign(e.node,{initialize:function(){this._internal.accessControl={},t.node.initialize&&t.node.initialize.call(this)}}),Object.assign(e.node.inputs,{accessControl:{type:{name:"proplist",autoName:"Rule",allowEditOnly:!0},index:1e3,displayName:"Access Control Rules",group:"Access Control Rules",description:"Read and write rules stored on the record as it is written, each rule adding its own Target, Read and Write ports; the NodeGX backend enforces them on every query and every realtime event, and backends with no per-record access control ignore them",tooltip:"Access Control Rules\n\nRules written onto the record itself and enforced by the backend, not by your app.\n\nOn the NodeGX backend a record you have no Read rule for is never returned by a query, and its changes are never delivered to you over realtime. It is a real permission boundary, not a display filter.\n\nBackends that control access another way — Supabase, PostgREST, Directus, PocketBase — have no per-record ACL and ignore these rules. On those this port is disabled, with the reason on the row.",set:function(e){this._internal.accessControlRules=e}}});const i=e._additionalDynamicPorts;e._additionalDynamicPorts=function(e,t,n){const o=e.parameters.accessControl;void 0!==o&&o.length>0&&o.forEach(n=>{const i="acl-"+n.id;t.push({name:i+"-target",displayName:"Target",editorName:n.label+" | Target",plug:"input",type:{name:"enum",enums:[{value:"user",label:"User"},{value:"everyone",label:"Everyone"},{value:"role",label:"Role"}],allowEditOnly:!0},group:n.label+" Access Rule",default:"user",parent:"accessControl",parentItemId:n.id}),"role"===e.parameters[i+"-target"]?t.push({name:i+"-role",displayName:"Role",editorName:n.label+" | Role",group:n.label+" Access Rule",plug:"input",type:"string",parent:"accessControl",parentItemId:n.id}):void 0!==e.parameters[i+"-target"]&&"user"!==e.parameters[i+"-target"]||t.push({name:i+"-userid",displayName:"User Id",group:n.label+" Access Rule",editorName:n.label+" | User Id",plug:"input",type:{name:"string",allowConnectionsOnly:!0},parent:"accessControl",parentItemId:n.id}),t.push({name:i+"-read",displayName:"Read",editorName:n.label+" | Read",group:n.label+" Access Rule",plug:"input",type:{name:"boolean"},default:!0,parent:"accessControl",parentItemId:n.id}),t.push({name:i+"-write",displayName:"Write",editorName:n.label+" | Write",group:n.label+" Access Rule",plug:"input",type:{name:"boolean"},default:!0,parent:"accessControl",parentItemId:n.id})}),i&&i(e,t,n)},Object.assign(e.node.methods,{registerInputIfNeeded:function(e){this.hasInput(e)||(e.startsWith("acl-")&&this.registerInput(e,{set:this.setAccessControl.bind(this,e)}),n&&n.registerInputIfNeeded&&n.registerInputIfNeeded.call(this,e))},_aclRefusal:function(){const e=this._internal.accessControlRules;if(void 0!==e)for(let t=0;t<e.length;t++){const n=(this._internal.accessControl||{})[e[t].id];if(n&&"role"===n.target&&(void 0===n.role||null===n.role||""===n.role))return"An access rule is set to Role but names no role. Name the role, or choose another target."}},_getACL:function(){const e={};function t(e){return{read:void 0===e.read||e.read,write:void 0===e.write||e.write}}const n=function(e,t){if("undefined"==typeof _noodl_cloud_runtime_version){const n=d.forBackend(e,t);return n?n.currentUserId():void 0}return e.get("Request").UserId}(this.nodeScope.modelScope,this._internal.backendId);return void 0!==this._internal.accessControlRules&&this._internal.accessControlRules.forEach(i=>{const o=this._internal.accessControl[i.id];if(void 0===o)return void(void 0!==n&&(e[n]={write:!0,read:!0}));const r=void 0===o.target?"user":o.target;if("everyone"===r)e["*"]=t(o);else if("user"===r){const i=o.userid||n;void 0!==i&&(e[i]=t(o))}else"role"===r&&(e["role:"+o.role]=t(o))}),Object.keys(e).length>0?e:void 0},setAccessControl:function(e,t){const n=e.split("-");void 0===this._internal.accessControl[n[1]]&&(this._internal.accessControl[n[1]]={}),this._internal.accessControl[n[1]][n[2]]=t}})}};e.exports=h},3516(e,t,n){"use strict";const i=n(6835),o=n(5162),r=n(5427),s=i,a={node:{name:"AddDbModelRelation",docs:"https://docs.noodl.net/nodes/data/cloud-data/add-record-relation",displayNodeName:"Add Record Relation",usePortAsLabel:"collectionName",inputs:{store:{displayName:"Do",group:"Actions",description:"Adds the record named by Target Record Id to the chosen Relation on the record named by Id",valueChangedToTrue:function(){this.scheduleAddRelation()}}},outputs:{},methods:{validateInputs:function(){let e;return void 0===this._internal.collectionId?e="No class specified":void 0===this._internal.relationProperty?e="No relation property specified":void 0===this._internal.targetModelId?e="No target record Id (the record to add a relation to) specified":void 0===this._internal.model?e="No record Id specified (the record that should get the relation)":void 0===this.targetCollection()&&(e=`The target record "${this._internal.targetModelId}" has not been loaded, so its class is unknown. Connect the Id from a Query Records / Record node rather than from a raw string, or the relation cannot be written.`),this.context.editorConnection&&(e?this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"add-relation",{message:e}):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"add-relation")),e},targetCollection:function(){const e=this._internal.targetModelId;if(void 0!==e)return(this.nodeScope.modelScope||s).get(e)._class},scheduleAddRelation:function(){const e=this,t=this._internal;this.pendingOutcomes("AddRelation").push(this.beginOutcome()),this.scheduleOnce("StorageAddRelation",function(){const n=e.takeOutcomes("AddRelation"),i=e.validateInputs();if(void 0!==i)return void e.setError(i,n);const r=t.model,s=t.targetModelId,a=e.cloudStore(n);a&&a.addRelation({collection:t.collectionId,objectId:r.getId(),key:t.relationProperty,targetObjectId:s,targetCollection:e.targetCollection(),success:function(t){for(const e in t)r.set(e,t[e]);(0,o.reportOutcomes)(e,n,"done")},error:function(t){e.setError(t||"Failed to add relation.",n)}})})}}}};r.addBaseInfo(a,{done:"Fires once the relation has been written and the record has been refreshed from the response"}),r.addModelId(a),r.addRelationProperty(a),e.exports=a},5759(e,t,n){"use strict";const i=n(6835),o=n(5162),r=n(5427),s=i,a={node:{name:"RemoveDbModelRelation",docs:"https://docs.noodl.net/nodes/data/cloud-data/remove-record-relation",displayName:"Remove Record Relation",usePortAsLabel:"collectionName",inputs:{store:{displayName:"Do",group:"Actions",description:"Removes the record named by Target Record Id from the chosen Relation on the record named by Id",valueChangedToTrue:function(){this.scheduleRemoveRelation()}}},outputs:{},methods:{validateInputs:function(){let e;return void 0===this._internal.collectionId?e="No class specified":void 0===this._internal.relationProperty?e="No relation property specified":void 0===this._internal.targetModelId?e="No target record Id (the record to remove a relation from) specified":void 0===this._internal.model?e="No record Id specified (the record that should lose the relation)":void 0===this.targetCollection()&&(e=`The target record "${this._internal.targetModelId}" has not been loaded, so its class is unknown. Connect the Id from a Query Records / Record node rather than from a raw string, or the relation cannot be written.`),this.context.editorConnection&&(e?this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"add-relation",{message:e}):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"add-relation")),e},targetCollection:function(){const e=this._internal.targetModelId;if(void 0!==e)return(this.nodeScope.modelScope||s).get(e)._class},scheduleRemoveRelation:function(){const e=this,t=this._internal;this.pendingOutcomes("RemoveRelation").push(this.beginOutcome()),this.scheduleOnce("StorageRemoveRelation",function(){const n=e.takeOutcomes("RemoveRelation"),i=e.validateInputs();if(void 0!==i)return void e.setError(i,n);const r=t.model,s=t.targetModelId,a=e.cloudStore(n);a&&a.removeRelation({collection:t.collectionId,objectId:r.getId(),key:t.relationProperty,targetObjectId:s,targetCollection:e.targetCollection(),success:function(t){for(const e in t)r.set(e,t[e]);(0,o.reportOutcomes)(e,n,"done")},error:function(t){e.setError(t||"Failed to remove relation.",n)}})})}}}};r.addBaseInfo(a,{done:"Fires once the backend has accepted the removal, which is also what happens when the relation was not there to begin with"}),r.addModelId(a),r.addRelationProperty(a),e.exports=a},7146(e,t,n){"use strict";const i=n(7268),o=n(4830),r=n(3099),s=n(6835),a=n(7011),l=n(5162),u=n(2114),c=n(1711),d=s,p="record/storage-op-failed",h={name:"DbModel2",docs:"https://docs.noodl.net/nodes/data/cloud-data/record",displayNodeName:"Record",category:"Cloud Services",usePortAsLabel:"collectionName",wireDeclaredPortPrefix:"prop-",color:"data",dynamicports:[{name:"conditionalports/extended",condition:"idSource = explicit OR idSource NOT SET",inputs:["modelId"]},{name:"conditionalports/extended",condition:"idSource = foreach",inputs:["repeaterComponent"]}],runOnValueChange:{controlSignal:"fetch",inputs:["modelId"],sources:[{name:"record",displayName:"Record properties"}]},initialize:function(){const e=this._internal;e.inputValues={},e.relationModelIds={};const t=this;this._internal.onModelChangedCallback=function(e){t.shouldRunOnValueChange("record")&&(t.hasOutput("prop-"+e.name)&&t.flagOutputDirty("prop-"+e.name),t.hasOutput("changed-"+e.name)&&t.sendSignalOnOutput("changed-"+e.name),t.sendSignalOnOutput("changed"))}},getInspectInfo(){const e=this._internal.model;return e?[{type:"text",value:"Id: "+e.getId()},{type:"value",value:e.data}]:"[No Record]"},outputs:{id:{type:"string",displayName:"Id",group:"General",description:"Id of the record this node is bound to, whether or not it has been read yet",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}},fetched:{type:"signal",displayName:"Fetched",group:"Events",description:"Fires when the Id binds a record, and again when a Fetch finishes reading it — a bind has read nothing, so use Done to act on data that is really there"},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires when a property of the bound record changes, including a change another node made"},...(0,l.outcomeOutputs)({done:"Fires when a Fetch finished and the property outputs are up to date",failure:"Fires when the record could not be read, after the reason has been reported on the error channel"}),error:{type:"string",displayName:"Error",group:"Error",description:"Why the last read failed; empty until one does",getter:function(){return this._internal.error}}},inputs:{idSource:{type:{name:"enum",enums:[{label:"Specify explicitly",value:"explicit"},{label:"From repeater",value:"foreach"}],allowEditOnly:!0},default:"explicit",displayName:"Id Source",group:"General",description:"Whether the record is named by Id or taken from the repeater this node sits inside",set:function(e){this._internal.idSource=e,"foreach"===e&&this.bindToRepeaterItem()}},repeaterComponent:{type:"component",displayName:"Repeater Component",group:"General",description:"Which repeater to take the current item from when nesting makes the nearest one ambiguous; leave blank for the nearest, and ignored unless Id Source is From repeater",set:function(e){this._internal.repeaterComponent=e||void 0,"foreach"===this._internal.idSource&&this.bindToRepeaterItem()}},modelId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Id",group:"General",description:"Id of the record to read; ignored unless Id Source is Specify explicitly",set:function(e){e instanceof d?e=e.getId():"object"==typeof e&&null!==e&&(e=d.create(e).getId());const t=this._internal.modelId;this._internal.modelId=e,this.shouldRunOnValueChanged("modelId",t,e)?this.setModelID(e):this.flagOutputDirty("id")}},fetch:{displayName:"Fetch",group:"Actions",description:"Re-reads the record from the backend now, replacing the copy held in memory. This is additional to Id rebinding on change and to changes being announced; untick either under Run On Value Change to stop it",valueChangedToTrue:function(){this.scheduleFetch()}}},methods:{bindToRepeaterItem:function(){this.scheduleAfterInputsHaveUpdated(()=>{this.setModel((0,r.resolveForEachItem)(this,{target:this._internal.repeaterComponent}))})},setCollectionID:function(e){this._internal.collectionId=e},setModelID:function(e){if(null==e||""===e)return void this.setModel(void 0);const t=(this.nodeScope.modelScope||d).get(e);this.setModel(t)},setModel:function(e){if(this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),this._internal.model=e,this.flagOutputDirty("id"),e){e.on("change",this._internal.onModelChangedCallback);for(const t in e.data)this.hasOutput("prop-"+t)&&this.flagOutputDirty("prop-"+t);this.sendSignalOnOutput("fetched")}},_onNodeDeleted:function(){i.prototype._onNodeDeleted.call(this),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),(0,r.forgetForEachItem)(this)},scheduleOnce:function(e,t){const n=this,i="hasScheduled"+e;this._internal[i]||(this._internal[i]=!0,this.scheduleAfterInputsHaveUpdated(function(){n._internal[i]=!1,t()}))},setError:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,l.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:p,message:e})},clearWarnings(){if(this.context.editorConnection){const e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,p),this.context.editorConnection.clearWarning(e,this.id,"storage-op-warning")}},scheduleFetch:function(){const e=this,t=this._internal;(t.pendingFetch||(t.pendingFetch=[])).push(this.beginOutcome()),this.scheduleOnce("Fetch",function(){const n=t.pendingFetch||[];if(t.pendingFetch=[],void 0===t.modelId||null===t.modelId||""===t.modelId)return void e.setError("Missing Id.",n);const i=a.forBackend(e.nodeScope.modelScope,t.backendId);i?i.fetch({collection:t.collectionId,objectId:t.modelId,success:function(o){const r=i._fromJSON(o,t.collectionId);t.model!==r&&(t.model&&t.model.off("change",t.onModelChangedCallback),t.model=r,r.on("change",t.onModelChangedCallback)),e.flagOutputDirty("id"),delete o.objectId;for(const t in o)e.hasOutput("prop-"+t)&&e.flagOutputDirty("prop-"+t);e.sendSignalOnOutput("fetched"),(0,l.reportOutcomes)(e,n,"done")},error:function(t){e.setError(t||"Failed to fetch.",n)}}):e.setError(`The backend this node is set to ("${t.backendId}") is not configured in this project.`,n)})},scheduleStore:function(){const e=this._internal;e.model&&this.scheduleOnce("Store",function(){for(const t in e.inputValues)e.model.set(t,e.inputValues[t],{resolve:!0})})},registerOutputIfNeeded:function(e){this.hasOutput(e)||(e.startsWith("prop-")&&this.registerOutput(e,{getter:f.bind(this,e.substring(5))}),e.startsWith("changed-")&&this.registerOutput(e,{type:"signal",getter:()=>{}}))},registerInputIfNeeded:function(e){if(this.hasInput(e))return;const t={};if(t[e])return this.registerInput(e,{set:o.createSetter({valueChangedToTrue:t[e]})});const n={collectionName:this.setCollectionID.bind(this),backendId:e=>{this._internal.backendId=e}};if(n[e])return this.registerInput(e,{set:n[e]});e.startsWith("prop-")&&this.registerInput(e,{set:g.bind(this,e.substring(5))})}}};function f(e){return this._internal.model?this._internal.model.get(e,{resolve:!0}):void 0}function g(e,t){this._internal.inputValues[e]=t}function m(e,t,n){const i=(0,u.recordSchemaContext)(n,e.parameters),o=[];o.push(...(0,u.recordBackendPickerPorts)(i)),o.push(...(0,u.recordClassPorts)(i));const r=i.selectedCollection?(0,u.recordFieldPorts)(i,{plug:"output",skipRelationColumns:!0,includeChangedSignals:!0}):[];o.push(...r),o.push(...(0,u.recordWiredFieldPorts)(e,r,{plug:"output"})),(0,c.sendSchemaPorts)(t,e.id,o,{staticPorts:(0,c.staticPortNames)(h)})}const y={node:h,setup:function(e,t){function n(n){var i;m(n,e.editorConnection,t),n.on("parameterUpdated",function(){m(n,e.editorConnection,t)}),n.on("inputConnectionAdded",function(){m(n,e.editorConnection,t)}),n.on("inputConnectionRemoved",function(){m(n,e.editorConnection,t)});const o=function(i){i&&(i.sourceId!==n.id&&i.targetId!==n.id||m(n,e.editorConnection,t))};"function"==typeof(null===(i=n.component)||void 0===i?void 0:i.on)&&(n.component.on("connectionAdded",o,n),n.component.on("connectionRemoved",o,n)),t.on("metadataChanged.dbCollections",function(){a.invalidateCollections(),m(n,e.editorConnection,t)}),t.on("metadataChanged.systemCollections",function(){a.invalidateCollections(),m(n,e.editorConnection,t)}),t.on("metadataChanged.backendServices",function(){m(n,e.editorConnection,t)}),t.on("metadataChanged.cloudservices",function(){m(n,e.editorConnection,t)})}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",()=>{t.on("nodeAdded.DbModel2",function(e){n(e)});for(const e of t.getNodesWithType("DbModel2"))n(e)})}};e.exports=y},4674(e,t,n){"use strict";const i=n(5162),o=n(5427),r={node:{name:"DeleteDbModelProperties",docs:"https://docs.noodl.net/nodes/data/cloud-data/delete-record",displayNodeName:"Delete Record",inputs:{store:{displayName:"Do",group:"Actions",description:"Deletes the record named by Id from its Class in the backend",valueChangedToTrue:function(){this.storageDelete()}}},outputs:{},methods:{storageDelete:function(){const e=this,t=this._internal,n=this.beginOutcome();this.checkWarningsBeforeCloudOp([n])&&(this.pendingOutcomes("Delete").push(n),this.scheduleOnce("StorageDelete",function(){const n=e.takeOutcomes("Delete");if(!t.model)return void e.setError("Missing Record Id",n);const o=e.cloudStoreForScope(e.nodeScope.ModelScope,n);if(!o)return;const r=t.model;o.delete({collection:t.collectionId,objectId:r.getId(),success:function(){r.notify("delete"),(0,i.reportOutcomes)(e,n,"done")},error:function(t){e.setError(t||"Failed to delete.",n)}})}))}}}};o.addBaseInfo(r,{done:"Fires once the backend has deleted the record and everything bound to it has been told that it is gone"}),o.addModelId(r),e.exports=r},6483(e,t,n){"use strict";const i=n(7268),o=n(1656),r=n(6835),s=n(5162),a=n(1021);function l(e,t){if(Object.prototype.hasOwnProperty.call(e,t)||!t.includes("."))return e[t];let n=e;for(const e of t.split(".")){if(null===n||"object"!=typeof n)return;n=n[e]}return n}function u(e){return e instanceof o?e.items.map(e=>e instanceof r?e.getId():e):Array.isArray(e)?e.map(e=>e instanceof r?e.getId():e):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(e=>""!==e):[e]}function c(e,t){e instanceof r&&(e=e.data),t instanceof r&&(t=t.data);for(const n in this){const i=e[n],o=t[n];if(i!==o)return"string"==typeof i&&"string"==typeof o?1===this[n]?i>o?1:-1:i>o?-1:1:"number"==typeof i&&"number"==typeof o?1===this[n]?i-o:o-i:1===this[n]?i>o?1:-1:i>o?-1:1}return 0}function d(e,t){const n=this._internal.filterSettings[e];this._internal.filterSettings[e]=t,this.shouldRunOnValueChanged("filterSettings",n,t)&&this.scheduleFilter()}function p(e,t,n){const i=[];i.push({type:"boolean",plug:"input",group:"Limit",name:"filterEnableLimit",displayName:"Use limit"}),t.filterEnableLimit&&(i.push({type:"number",default:10,plug:"input",group:"Limit",name:"filterLimit",displayName:"Limit"}),i.push({type:"number",default:0,plug:"input",group:"Limit",name:"filterSkip",displayName:"Skip"})),i.push({type:{name:"stringlist",allowEditOnly:!0},plug:"input",group:"Filter",name:"filterFilter",displayName:"Filter"}),i.push({type:{name:"stringlist",allowEditOnly:!0},plug:"input",group:"Sort",name:"filterSort",displayName:"Sort"});const o={string:[{value:"eq",label:"Equals"},{value:"neq",label:"Not Equals"},{value:"regex",label:"Matches RegEx"},{value:"in",label:"Is one of"},{value:"nin",label:"Is not one of"}],boolean:[{value:"eq",label:"Equals"},{value:"neq",label:"Not Equals"}],number:[{value:"eq",label:"Equals"},{value:"neq",label:"Not Equals"},{value:"lt",label:"Less than"},{value:"gt",label:"Greater than"},{value:"gte",label:"Greater than or equal"},{value:"lte",label:"Less than or equal"},{value:"in",label:"Is one of"},{value:"nin",label:"Is not one of"}]};t.filterFilter&&String(t.filterFilter).split(",").forEach(e=>{i.push({type:{name:"enum",enums:[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"boolean",label:"Boolean"}]},default:"string",plug:"input",group:e+" filter",displayName:"Type",editorName:e+" filter | Type",name:"filterFilterType-"+e});const n=t["filterFilterType-"+e];i.push({type:{name:"enum",enums:o[n||"string"]},default:"eq",plug:"input",group:e+" filter",displayName:"Op",editorName:e+" filter| Op",name:"filterFilterOp-"+e}),"regex"===t["filterFilterOp-"+e]&&i.push({type:"boolean",default:!1,plug:"input",group:e+" filter",displayName:"Case sensitive",editorName:e+" filter| Case",name:"filterFilterOption-case-"+e});const r="in"===t["filterFilterOp-"+e]||"nin"===t["filterFilterOp-"+e];i.push({type:r?"*":n||"string",plug:"input",group:e+" filter",displayName:r?"Values":"Value",editorName:e+" Filter Value",name:"filterFilterValue-"+e})}),t.filterSort&&String(t.filterSort).split(",").forEach(e=>{i.push({type:{name:"enum",enums:[{value:"ascending",label:"Ascending"},{value:"descending",label:"Descending"}]},default:"ascending",plug:"input",group:e+" sort",displayName:"Sort",editorName:e+" sorting",name:"filterSort-"+e})}),n.sendDynamicPorts(e,i)}const h={node:{name:"Filter Collection",docs:"https://docs.noodl.net/nodes/data/array/array-filter",displayNodeName:"Array Filter",category:"Data",color:"data",runOnValueChange:{controlSignal:"filter",inputs:["items","enabled"],sources:[{name:"array",displayName:"Array contents"},{name:"filterSettings",displayName:"Filter settings"}]},initialize:function(){this._internal.collectionChangedCallback=()=>{this.shouldRunOnValueChange("array")&&this.scheduleFilter()},this._internal.enabled=!0,this._internal.filterSettings={}},getInspectInfo(){const e=this._internal.filteredCollection;return e?[{type:"text",value:"Id: "+e.getId()},{type:"value",value:e.items}]:{type:"text",value:"[Not executed yet]"}},inputs:{items:{type:"array",displayName:"Items",description:"Array to filter; the node re-runs whenever this array changes, unless you untick it under Run On Value Change",group:"General",set(e){this.bindCollection(e),this.shouldRunOnValueChange("items")&&this.scheduleFilter()}},enabled:{type:"boolean",group:"General",displayName:"Enabled",description:"When false the input array passes straight through — unfiltered, unsorted and unlimited",default:!0,set:function(e){const t=this._internal.enabled;this._internal.enabled=e,this.shouldRunOnValueChanged("enabled",t,e)&&this.scheduleFilter()}},filter:{type:"signal",group:"Actions",displayName:"Filter",description:"Runs the filter now and replaces Items with the result. This is additional to it re-running when Items, Enabled, the filter settings or the array contents change; untick any of those under Run On Value Change to stop it",valueChangedToTrue:function(){this.requestFilter()}},refresh:{type:"signal",group:"Actions",displayName:"Refresh",description:"Runs the filter now — the same action as Filter, under the name the rest of the Array family uses",valueChangedToTrue:function(){this.requestFilter()}}},outputs:{items:{type:"array",displayName:"Items",description:"A new array holding the records that passed, in sort order; the input array is never modified",group:"General",getter:function(){return this._internal.filteredCollection}},firstItemId:{type:"string",displayName:"First Item Id",description:"Id of the first record that passed, or empty when nothing matched",group:"General",getter:function(){if(void 0!==this._internal.filteredCollection){const e=this._internal.filteredCollection.get(0);if(void 0!==e)return e.getId()}}},count:{type:"number",displayName:"Count",description:"How many records passed the filter, after Skip and Limit have been applied",group:"General",getter:function(){return this._internal.filteredCollection?this._internal.filteredCollection.size():0}},modified:{group:"Events",type:"signal",displayName:"Filtered",description:"Fires once the filter has run and Items is up to date, whether an author asked for the run or an input changed; wire Done instead for the outcome of a Filter you triggered"},...(0,s.outcomeOutputs)({done:"Fires once a Filter or Refresh you triggered has run and Items is up to date",failure:"Fires when the filter could not be applied — a pattern that will not compile, or a Filter pulse with no array connected"}),error:{group:"Error",type:"string",displayName:"Error",description:"Why the last run failed, in one sentence; empty until something fails",getter:function(){return this._internal.lastError}}},prototypeExtensions:{unbindCurrentCollection:function(){const e=this._internal.collection;e&&(e.off("change",this._internal.collectionChangedCallback),this._internal.collection=void 0)},bindCollection:function(e){this.unbindCurrentCollection(),this._internal.notAList=(0,a.notAList)(e),this._internal.collection=void 0===this._internal.notAList?e:void 0,this._internal.collection&&this._internal.collection.on("change",this._internal.collectionChangedCallback)},_onNodeDeleted:function(){i.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection()},getFilter:function(){const e=this._internal.filterSettings,t=["case"];if(e.filterFilter){const n=String(e.filterFilter).split(","),i={};return n.forEach(function(n){const o="$"+(e["filterFilterOp-"+n]||"eq");i[n]={},i[n][o]=e["filterFilterValue-"+n],t.forEach(t=>{const o=e["filterFilterOption-"+t+"-"+n];o&&(i[n]["$"+t]=o)})}),i}},getSort:function(){const e=this._internal.filterSettings;if(e.filterSort){const t=String(e.filterSort).split(","),n={};return t.forEach(function(t){n[t]="descending"===e["filterSort-"+t]?-1:1}),n}},getLimit:function(){const e=this._internal.filterSettings;return e.filterEnableLimit?e.filterLimit||10:void 0},getSkip:function(){const e=this._internal.filterSettings;return e.filterEnableLimit?e.filterSkip||0:void 0},requestFilter:function(){const e=this._internal;e.pendingFilterOutcomes||(e.pendingFilterOutcomes=[]),e.pendingFilterOutcomes.push(this.beginOutcome()),this.scheduleFilter()},reportFailure:function(e,t,n,i){const o=this._internal;o.lastError=t,this.flagOutputDirty("error");const r=o.lastReportedError===t;r||(o.lastReportedError=t,this.raiseRuntimeError(e,t,n)),i&&i.length?(0,s.reportOutcomes)(this,i,"failure",{code:e,message:t,detail:n,raise:!1}):r||this.sendSignalOnOutput("failure")},scheduleFilter:function(){this.collectionChangedScheduled||(this.collectionChangedScheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.collectionChangedScheduled=!1;const e=this._internal.pendingFilterOutcomes||[];this._internal.pendingFilterOutcomes=[];const t=e.length>0;if(void 0!==this._internal.notAList)return void this.reportFailure("array-filter/not-a-list",this._internal.notAList,void 0,e);if(!this._internal.collection)return void(t&&this.reportFailure("array-filter/no-items","Nothing to filter — no array is connected to the Items input",void 0,e));let n=[].concat(this._internal.collection.items);if(this._internal.enabled){const t=this.getFilter(),i=this.getSort();try{t&&(n=n.filter(e=>function(e,t){for(const n in t){const i=t[n],o=l(e,n);if(void 0!==i.$neq){if(o==i.$neq)return!1}else if(void 0!==i.$nin){if(u(i.$nin).some(e=>o==e))return!1}else{if(void 0===o)return!1;if(void 0!==i.$eq&&o!=i.$eq)return!1;if(!(void 0===i.$gt||o>i.$gt))return!1;if(!(void 0===i.$lt||o<i.$lt))return!1;if(!(void 0===i.$gte||o>=i.$gte))return!1;if(!(void 0===i.$lte||o<=i.$lte))return!1;if(void 0!==i.$in&&!u(i.$in).some(e=>o==e))return!1;if(void 0!==i.$regex){const e=o+"";if(!new RegExp(i.$regex,!0!==i.$case?"i":void 0).test(e))return!1}}}return!0}(e instanceof r?e.data:e,t))),i&&n.sort(c.bind(i))}catch(n){return void this.reportFailure("array-filter/filter-failed","The filter could not be applied: "+(n.message||String(n)),{filter:t,sort:i},e)}const o=this.getSkip();o&&(n=n.slice(o,n.length));const s=this.getLimit();s&&(n=n.slice(0,s))}this._internal.lastReportedError=void 0,this._internal.filteredCollection=o.create(n),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("items"),this.flagOutputDirty("count"),this.sendSignalOnOutput("modified"),(0,s.reportOutcomes)(this,e,"done")}))},registerInputIfNeeded:function(e){this.hasInput(e)||this.registerInput(e,{set:d.bind(this,e)})}}},setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Filter Collection",function(n){p(n.id,n.parameters,e.editorConnection),n.on("parameterUpdated",function(t){t.name.startsWith("filter")&&p(n.id,n.parameters,e.editorConnection)}),t.on("metadataChanged.dbCollections",function(){p(n.id,n.parameters,e.editorConnection)})})}};e.exports=h},2371(e,t,n){"use strict";const i=n(5162),o=n(1021),r=n(7268),s=n(1656),a=n(6835),l=n(7011),u=n(3024),c=n(5838),d=n(2114),p=n(1711),h=s,f=a,g={name:"FilterDBModels",docs:"https://docs.noodl.net/nodes/data/cloud-data/filter-records",displayNodeName:"Filter Records",category:"Data",color:"data",runOnValueChange:{controlSignal:"filter",inputs:["items","enabled"],sources:[{name:"records",displayName:"Record changes"},{name:"filterSettings",displayName:"Filter settings"}]},initialize:function(){const e=this;this._internal.collectionChangedCallback=function(){e.shouldRunOnValueChange("records")&&e.scheduleFilter()},this._internal.cloudStoreEvents=function(t){e.shouldRunOnValueChange("records")&&void 0!==e._internal.visualFilter&&void 0!==e._internal.collection&&null!==e._internal.collection&&t.collection===e._internal.collectionName&&void 0!==t.objectId&&e._internal.collection.contains(f.get(t.objectId))&&e.scheduleFilter()},this.bindStoreEvents(l.forBackend(this.nodeScope.modelScope,void 0)||l.instance),this._internal.enabled=!0,this._internal.filterSettings={},this._internal.filterParameters={}},getInspectInfo(){const e=this._internal.filteredCollection;return e?[{type:"text",value:"Id: "+e.getId()},{type:"value",value:e.items}]:{type:"text",value:"[Not executed yet]"}},inputs:{items:{type:"array",displayName:"Items",group:"General",description:"The records to filter, normally the Items output of a Query Records node",set(e){this.bindCollection(e),this.shouldRunOnValueChange("items")&&this.scheduleFilter()}},enabled:{type:"boolean",group:"General",displayName:"Enabled",default:!0,description:"Passes every record through unchanged when off, rather than emptying the result",set:function(e){const t=this._internal.enabled;this._internal.enabled=e,this.shouldRunOnValueChanged("enabled",t,e)&&this.scheduleFilter()}},filter:{type:"signal",group:"Actions",displayName:"Filter",description:"Re-runs the filter now. This is additional to it re-running when Items, Enabled, the filter settings or the records themselves change; untick any of those under Run On Value Change to stop it",valueChangedToTrue:function(){this.requestFilter()}}},outputs:{items:{type:"array",displayName:"Items",group:"General",description:"The records that matched, after Sorting, Skip and Limit have been applied",getter:function(){return this._internal.filteredCollection}},firstItemId:{type:"string",displayName:"First Record Id",group:"General",description:"Id of the first record in the result, and nothing at all when the result is empty",getter:function(){if(void 0!==this._internal.filteredCollection){const e=this._internal.filteredCollection.get(0);if(void 0!==e)return e.getId()}}},count:{type:"number",displayName:"Count",group:"General",description:"How many records are in the result after Skip and Limit, not how many matched the filter",getter:function(){return this._internal.filteredCollection?this._internal.filteredCollection.size():0}},modified:{group:"Events",type:"signal",displayName:"Filtered",description:"Fires each time the result has been rebuilt, including when the same records come back and including runs nobody triggered; wire Done for the outcome of a Filter you triggered"},...(0,i.outcomeOutputs)({done:"Fires once a Filter you triggered has run and Items is up to date",failure:"Fires when the filter could not be applied, or when Filter was triggered with nothing on Items"}),error:{group:"Error",type:"string",displayName:"Error",description:"Why the most recent failed run failed, kept after a later run succeeds",getter:function(){return this._internal.lastError}}},prototypeExtensions:{unbindCurrentCollection:function(){const e=this._internal.collection;e&&(e.off("change",this._internal.collectionChangedCallback),this._internal.collection=void 0)},bindCollection:function(e){this.unbindCurrentCollection(),this._internal.notAList=(0,o.notAList)(e),this._internal.collection=void 0===this._internal.notAList?e:void 0,this._internal.collection&&this._internal.collection.on("change",this._internal.collectionChangedCallback)},bindStoreEvents:function(e){const t=this._internal.boundStore;t!==e&&(t&&t.off("save",this._internal.cloudStoreEvents),this._internal.boundStore=e,e&&e.on("save",this._internal.cloudStoreEvents))},_onNodeDeleted:function(){r.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection(),this.bindStoreEvents(void 0)},getLimit:function(){const e=this._internal.filterSettings;return e.filterEnableLimit?e.filterLimit||10:void 0},getSkip:function(){const e=this._internal.filterSettings;return e.filterEnableLimit?e.filterSkip||0:void 0},requestFilter:function(){const e=this._internal;e.pendingFilterOutcomes||(e.pendingFilterOutcomes=[]),e.pendingFilterOutcomes.push(this.beginOutcome()),this.scheduleFilter()},reportFailure:function(e,t,n,o){const r=this._internal;r.lastError=t,this.flagOutputDirty("error");const s=r.lastReportedError===t;s||(r.lastReportedError=t,this.raiseRuntimeError(e,t,n)),o&&o.length?(0,i.reportOutcomes)(this,o,"failure",{code:e,message:t,detail:n,raise:!1}):s||this.sendSignalOnOutput("failure")},scheduleFilter:function(){this.collectionChangedScheduled||(this.collectionChangedScheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.collectionChangedScheduled=!1,this.bindStoreEvents(l.forBackend(this.nodeScope.modelScope,this._internal.backendId)||l.instance);const e=this._internal.pendingFilterOutcomes||[];this._internal.pendingFilterOutcomes=[];const t=e.length>0;if(void 0!==this._internal.notAList)return void this.reportFailure("filter-records/not-a-list",this._internal.notAList,void 0,e);if(!this._internal.collection)return void(t&&this.reportFailure("filter-records/no-items","Nothing to filter — no records are connected to the Items input",void 0,e));let n=[].concat(this._internal.collection.items);if(this._internal.enabled){try{const e=this._internal.visualFilter;if(void 0!==e){const t=u.convertVisualFilter(e,{queryParameters:this._internal.filterParameters,collectionName:this._internal.collectionName,valuePortPrefix:"fp-"});t&&(n=n.filter(e=>u.matchesQuery(e,t)))}const t=this._internal.visualSorting;if(void 0!==t&&t.length>0){const e=u.convertVisualSorting(t);e&&n.sort(u.compareObjects.bind(this,e))}}catch(t){return void this.reportFailure("filter-records/filter-failed","The filter could not be applied: "+(t.message||String(t)),{collectionName:this._internal.collectionName},e)}const t=this.getSkip();t&&(n=n.slice(t,n.length));const i=this.getLimit();i&&(n=n.slice(0,i))}this._internal.lastReportedError=void 0,this._internal.filteredCollection=h.create(n),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("items"),this.flagOutputDirty("count"),this.sendSignalOnOutput("modified"),(0,i.reportOutcomes)(this,e,"done")}))},setCollectionName:function(e){this._internal.collectionName=e},setVisualFilter:function(e){this._internal.visualFilter=e,this.shouldRunOnValueChange("filterSettings")&&this.scheduleFilter()},setVisualSorting:function(e){this._internal.visualSorting=e,this.shouldRunOnValueChange("filterSettings")&&this.scheduleFilter()},setFilterParameter:function(e,t){const n=this._internal.filterParameters[e];this._internal.filterParameters[e]=t,this.shouldRunOnValueChanged("fp-"+e,n,t)&&this.scheduleFilter()},registerInputIfNeeded:function(e){if(!this.hasInput(e))return"collectionName"===e?this.registerInput(e,{set:this.setCollectionName.bind(this)}):"backendId"===e?this.registerInput(e,{set:e=>{this._internal.backendId=e,this.bindStoreEvents(l.forBackend(this.nodeScope.modelScope,e)||l.instance)}}):"visualFilter"===e?this.registerInput(e,{set:this.setVisualFilter.bind(this)}):"visualSorting"===e?this.registerInput(e,{set:this.setVisualSorting.bind(this)}):e.startsWith("fp-")?(this.registerInput(e,{set:this.setFilterParameter.bind(this,e.substring(3))}),void this.registerRunOnValueChangeInput(e,e.substring(3))):void this.registerInput(e,{set:m.bind(this,e)})}}};function m(e,t){const n=this._internal.filterSettings[e];this._internal.filterSettings[e]=t,this.shouldRunOnValueChanged("filterSettings",n,t)&&this.scheduleFilter()}function y(e,t,n,i){const o=[],r=(0,d.recordSchemaContext)(i,t);if(o.push(...(0,d.recordBackendPickerPorts)(r)),o.push(...(0,d.recordClassPorts)(r)),o.push({type:"boolean",plug:"input",group:"Limit",name:"filterEnableLimit",displayName:"Use limit"}),t.filterEnableLimit&&(o.push({type:"number",default:10,plug:"input",group:"Limit",name:"filterLimit",displayName:"Limit"}),o.push({type:"number",default:0,plug:"input",group:"Limit",name:"filterSkip",displayName:"Skip"})),void 0!==t.collectionName){const e=function(e){var t;if(!e)return null;const n=e.properties;if(!n)return e;const i={Boolean:!0,String:!0,Date:!0,Number:!0,Pointer:!0},o={};for(const e in n)i[null===(t=n[e])||void 0===t?void 0:t.type]&&(o[e]=n[e]);return Object.assign({},e,{properties:o})}((0,d.recordFilterSchema)(r));e&&(o.push({name:"visualFilter",plug:"input",type:{name:"query-filter",schema:e,allowEditOnly:!0,backend:(0,d.recordFilterBackendType)(r,u.backendType()),valuePortPrefix:"fp-"},displayName:"Filter",group:"Filter"}),o.push({name:"visualSorting",plug:"input",type:{name:"query-sorting",schema:e,allowEditOnly:!0},displayName:"Sorting",group:"Sorting"})),void 0!==t.visualFilter&&u.collectFilterParameters(t.visualFilter,"fp-").forEach(e=>{o.push({name:"fp-"+e,plug:"input",type:"*",displayName:e,group:"Filter Parameters"}),o.push(...(0,c.runOnChangeDynamicPorts)(["fp-"+e],{["fp-"+e]:e}))})}(0,p.sendSchemaPorts)(n,e,o,{staticPorts:(0,p.staticPortNames)(g)})}const v={node:g,setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.FilterDBModels",function(n){y(n.id,n.parameters,e.editorConnection,t),n.on("parameterUpdated",function(){y(n.id,n.parameters,e.editorConnection,t)});for(const i of["dbCollections","systemCollections","backendServices","cloudservices"])t.on("metadataChanged."+i,function(){l.invalidateCollections(),y(n.id,n.parameters,e.editorConnection,t)})})}};e.exports=v},2657(e,t,n){"use strict";const i=n(5162);function o(e){return null!==e&&"object"==typeof e?(e.httpBadBody=!0,e):Object.assign(new Error(String(e)),{httpBadBody:!0})}function r(e,t){if(!t||!t.startsWith("$"))return;if(null==e)return;const n=t.substring(2).split(".").filter(Boolean);let i=e;for(const e of n){if(null==i)return;const t=e.match(/^(\w+)\[(\d+)\]$/);if(t){const e=i[t[1]];i=null==e?void 0:e[parseInt(t[2])]}else i=i[e]}return i}function s(e){return null!=e}function a(e){const t={};for(const n of Object.keys(e))n.startsWith("auth-")&&(t[n.slice(5)]=e[n]);return t}const l={none:()=>({}),bearer:e=>({headers:e.authToken?{Authorization:`Bearer ${e.authToken}`}:{}}),basic:e=>e.authUsername&&e.authPassword?{headers:{Authorization:`Basic ${"undefined"!=typeof btoa?btoa(e.authUsername+":"+e.authPassword):Buffer.from(e.authUsername+":"+e.authPassword).toString("base64")}`}}:{},apiKey:e=>e.authApiKeyName&&e.authApiKeyValue?"query"===e.authApiKeyLocation?{queryParams:{[e.authApiKeyName]:e.authApiKeyValue}}:{headers:{[e.authApiKeyName]:e.authApiKeyValue}}:{}};function u(e,t,n){const i=[];if(t.url){const e=t.url.match(/\{([A-Za-z0-9_]+)\}/g)||[],n=[...new Set(e.map(e=>e.replace(/[{}]/g,"")))];for(const e of n)i.push({name:"path-"+e,displayName:e,type:"string",plug:"input",group:"Path Parameters",description:"undefined or null leaves the {"+e+"} placeholder in the URL literally, unreplaced — a path segment cannot be empty."})}if(i.push({name:"headers",displayName:"Headers",type:{name:"stringlist",allowEditOnly:!0},plug:"input",group:"Headers",description:"Names the request headers to send; each name listed here gets its own value input"}),t.headers){const e=t.headers.split(",").map(e=>e.trim()).filter(Boolean);for(const t of e)i.push({name:"header-"+t,displayName:t,type:"string",plug:"input",group:"Headers",description:"undefined or null omits this header — an HTTP header has no way to carry null."})}if(i.push({name:"queryParams",displayName:"Query Parameters",type:{name:"stringlist",allowEditOnly:!0},plug:"input",group:"Query Parameters",description:"Names the query-string parameters to append to the URL; each name listed here gets its own value input"}),t.queryParams){const e=t.queryParams.split(",").map(e=>e.trim()).filter(Boolean);for(const t of e)i.push({name:"query-"+t,displayName:t,type:"string",plug:"input",group:"Query Parameters",description:"undefined, null or '' omits this query parameter — a query string has no way to carry null."})}i.push({name:"method",displayName:"Method",type:{name:"enum",enums:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"},{label:"DELETE",value:"DELETE"},{label:"HEAD",value:"HEAD"},{label:"OPTIONS",value:"OPTIONS"}],allowEditOnly:!0},default:"GET",plug:"input",group:"Request",description:"HTTP verb the request is sent with; GET, HEAD and OPTIONS send no body and hide the Body group"});const o=t.method||"GET";if(["POST","PUT","PATCH"].includes(o)){i.push({name:"bodyType",displayName:"Body Type",type:{name:"enum",enums:[{label:"JSON",value:"json"},{label:"Form Data",value:"form"},{label:"URL Encoded",value:"urlencoded"},{label:"Raw",value:"raw"}],allowEditOnly:!0},default:"json",plug:"input",group:"Body",description:"How the body is encoded, which decides both the Content-Type sent and whether a null field value is kept or omitted"});const e=t.bodyType||"json";if("json"===e||"form"===e||"urlencoded"===e){i.push({name:"bodyFields",displayName:"Body Fields",type:{name:"stringlist",allowEditOnly:!0},plug:"input",group:"Body",description:"Names the fields to put in the request body; each name listed here gets its own value and type input"});const n=[{label:"String",value:"string"},{label:"Number",value:"number"},{label:"Boolean",value:"boolean"},{label:"Array",value:"array"},{label:"Object",value:"object"},{label:"Any",value:"*"}];if(t.bodyFields){const o=t.bodyFields.split(",").map(e=>e.trim()).filter(Boolean);for(const r of o){const o=t["body-type-"+r]||"string";i.push({name:"body-type-"+r,displayName:r+" Type",type:{name:"enum",enums:n,allowEditOnly:!0},default:"string",plug:"input",group:"Body",description:"Type the matching value input accepts and is sent as"}),i.push({name:"body-"+r,displayName:r,type:o,plug:"input",group:"Body",description:"json"===e?"undefined omits this field from the JSON body. null is kept and sent as JSON null.":"undefined or null omits this field — this encoding has no way to carry null."})}}}else"raw"===e&&i.push({name:"body-raw",displayName:"Body",type:{name:"string",allowEditOnly:!0,codeeditor:"json"},plug:"input",group:"Body",description:"Body sent verbatim, with no encoding applied and no Content-Type added for you"})}i.push({name:"authType",displayName:"Authentication",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Bearer Token",value:"bearer"},{label:"Basic Auth",value:"basic"},{label:"API Key",value:"apiKey"}],allowEditOnly:!0},default:"none",plug:"input",group:"Authentication",description:"Credential scheme to apply, which decides which credential inputs appear below; Bearer and Basic set the Authorization header, so leave Authorization out of Headers"});const r=t.authType||"none";if("bearer"===r?i.push({name:"auth-authToken",displayName:"Token",type:"string",plug:"input",group:"Authentication",description:'Token sent as "Authorization: Bearer …"; leave blank and no Authorization header is sent at all'}):"basic"===r?(i.push({name:"auth-authUsername",displayName:"Username",type:"string",plug:"input",group:"Authentication",description:"Half of the Basic credential; no Authorization header is sent unless both this and Password are set"}),i.push({name:"auth-authPassword",displayName:"Password",type:"string",plug:"input",group:"Authentication",description:"Half of the Basic credential; no Authorization header is sent unless both this and Username are set"})):"apiKey"===r&&(i.push({name:"auth-authApiKeyName",displayName:"Key Name",type:"string",plug:"input",group:"Authentication",description:"Header or query-parameter name the key is sent under; nothing is sent unless Key Value is set too"}),i.push({name:"auth-authApiKeyValue",displayName:"Key Value",type:"string",plug:"input",group:"Authentication",description:"The key itself; nothing is sent unless Key Name is set too"}),i.push({name:"auth-authApiKeyLocation",displayName:"Add To",type:{name:"enum",enums:[{label:"Header",value:"header"},{label:"Query Parameter",value:"query"}]},default:"header",plug:"input",group:"Authentication",description:"Whether the API key travels as a request header or as a query-string parameter"})),i.push({name:"timeout",displayName:"Timeout (ms)",type:"number",default:3e4,plug:"input",group:"Request",description:"Time before the request is abandoned, in milliseconds; abandoning it fires Failure, not Canceled, and 0 or blank means 30000"}),i.push({name:"responseType",displayName:"Response Type",type:{name:"enum",enums:[{label:"Auto",value:"auto"},{label:"JSON",value:"json"},{label:"Text",value:"text"}],allowEditOnly:!0},default:"auto",plug:"input",group:"Response",description:"How to read the body. Auto parses JSON when the server says application/json and hands over text otherwise. Text always hands over text, whatever the server claimed — which is what an XML or feed parser downstream needs. JSON always parses, and fires Failure when the body is not JSON"}),i.push({name:"conditional",displayName:"Conditional",type:"boolean",default:!1,plug:"input",group:"Request",description:"Remembers the ETag and Last-Modified this URL last answered with and sends them back as If-None-Match / If-Modified-Since, so an unchanged source answers 304 with no body and fires Not Modified instead of Done. Only the backend remembers; in a browser the port is ignored and the request is sent as normal"}),i.push({name:"responseMapping",displayName:"Output Fields",type:{name:"stringlist",allowEditOnly:!0},plug:"input",group:"Response Mapping",description:"Names the values to pull out of the response; each name listed here gets a Path input and an output port"}),i.push({name:"fetch",displayName:"Fetch",type:"signal",plug:"input",group:"Actions",description:"Sends the request using the values currently on the inputs"}),i.push({name:"cancel",displayName:"Cancel",type:"signal",plug:"input",group:"Actions",description:"Abandons a request that is still in flight, which answers on Canceled rather than Failure"}),i.push({name:"url",displayName:"URL",type:"string",plug:"input",group:"Request",description:"Address the request is sent to; any {name} in it becomes a Path Parameter input, and leaving it blank fails the request rather than sending one"}),t.responseMapping&&"string"==typeof t.responseMapping){const e=t.responseMapping.split(",").map(e=>e.trim()).filter(Boolean);for(const t of e)i.push({name:"mapping-path-"+t,displayName:t+" Path",type:"string",default:"$",plug:"input",group:"Response Mapping",description:"Where to read this value from in the response, as $.a.b or $.items[0].c; $ is the whole body, and a path that matches nothing yields no value"}),i.push({name:"out-"+t,displayName:t,type:"*",plug:"output",group:"Response",description:"Value read out of the response at "+t+" Path, refreshed on every answer"})}i.push({name:"response",displayName:"Response",type:"*",plug:"output",group:"Response",description:"Body the server sent, parsed as JSON when it said so and as text otherwise; it keeps the previous body when a request never reached the server"}),i.push({name:"statusCode",displayName:"Status Code",type:"number",plug:"output",group:"Response",description:"HTTP status the server answered with; it keeps the previous status when a request timed out or never reached the server"}),i.push({name:"responseHeaders",displayName:"Response Headers",type:"object",plug:"output",group:"Response",description:"Every header the server returned, keyed by lower-cased header name"}),i.push({name:"failure",displayName:"Failure",type:"signal",plug:"output",group:"Events",description:"Fires when the request could not be completed — no URL, a network error, a timeout, an unparseable body, or a non-2xx status — after the reason has been put on Error"}),i.push({name:"canceled",displayName:"Canceled",type:"signal",plug:"output",group:"Events",description:"Fires only when Cancel abandoned a request in flight; a timeout answers on Failure instead"}),i.push({name:"notModified",displayName:"Not Modified",type:"signal",plug:"output",group:"Events",description:"Fires when Conditional is on and the server answered 304 — nothing has changed, Response still holds the previous body, and the invocation reports Unchanged"}),i.push({name:"error",displayName:"Error",type:"string",plug:"output",group:"Events",description:"What went wrong with the last request, in one sentence; unchanged when a request succeeds"}),n.sendDynamicPorts(e,i)}const c={node:{name:"net.noodl.HTTP",displayNodeName:"HTTP Request",docs:"https://docs.noodl.net/nodes/data/http-request",category:"Data",color:"data",searchTags:["http","request","fetch","api","rest","curl"],initialize:function(){this._internal.inputValues={},this._internal.outputValues={},this._internal.headers="",this._internal.queryParams="",this._internal.bodyFields="",this._internal.responseMapping="",this._internal.inspectData=null,this._internal.pendingFetchOutcomes=[]},getInspectInfo(){return this._internal.inspectData?{type:"value",value:this._internal.inspectData}:{type:"text",value:"[Not executed yet]"}},inputs:{url:{type:"string",displayName:"URL",group:"Request",default:"",description:"Address the request is sent to; any {name} in it becomes a Path Parameter input, and leaving it blank fails the request rather than sending one",set:function(e){this._internal.url=e}},fetch:{type:"signal",displayName:"Fetch",group:"Actions",description:"Sends the request using the values currently on the inputs",valueChangedToTrue:function(){this._internal.pendingFetchOutcomes.push(this.beginOutcome()),this.scheduleFetch()}},cancel:{type:"signal",displayName:"Cancel",group:"Actions",description:"Abandons every request still in flight, each answering on Canceled rather than Failure; reports Unchanged when there is nothing to cancel",valueChangedToTrue:function(){this.cancelFetch(this.beginOutcome())}}},outputs:{response:{type:"*",displayName:"Response",group:"Response",description:"Body the server sent, read the way Response Type says: Auto parses JSON when the server said application/json and hands over text otherwise, Text always hands over text, JSON always parses; it keeps the previous body when a request never reached the server",getter:function(){return this._internal.response}},statusCode:{type:"number",displayName:"Status Code",group:"Response",description:"HTTP status the server answered with; it keeps the previous status when a request timed out or never reached the server",getter:function(){return this._internal.statusCode}},responseHeaders:{type:"object",displayName:"Response Headers",group:"Response",description:"Every header the server returned, keyed by lower-cased header name",getter:function(){return this._internal.responseHeaders}},canceled:{type:"signal",displayName:"Canceled",group:"Events",description:"Fires only when Cancel abandoned a request in flight; a timeout answers on Failure instead"},notModified:{type:"signal",displayName:"Not Modified",group:"Events",description:"Fires when Conditional is on and the server answered 304 — nothing has changed since the last fetch, Response still holds the previous body, and the invocation reports Unchanged"},error:{type:"string",displayName:"Error",group:"Error",description:"What went wrong with the last request, in one sentence; unchanged when a request succeeds",getter:function(){return this._internal.error}},...(0,i.outcomeOutputs)({done:"Fires once the server has answered with a 2xx status and Response is up to date",unchanged:"Fires when nothing was fetched and nothing changed: a Cancel that abandoned a request in flight, a Cancel with no request to abandon, or a Conditional request the server answered 304. Canceled and Not Modified tell those apart",failure:"Fires when the request could not be completed — no URL, a network error, a timeout, an unparseable body, or a non-2xx status — after the reason has been put on Error"})},prototypeExtensions:{_storeInputValue:function(e,t){this._internal.inputValues[e]=t},getOutputValue:function(e){return this._internal.outputValues[e]},registerOutputIfNeeded:function(e){this.hasOutput(e)||e.startsWith("out-")&&this.registerOutput(e,{getter:this.getOutputValue.bind(this,e)})},registerInputIfNeeded:function(e){if(this.hasInput(e))return;const t={method:this.setMethod.bind(this),timeout:this.setTimeout.bind(this),headers:this.setHeaders.bind(this),queryParams:this.setQueryParams.bind(this),bodyType:this.setBodyType.bind(this),bodyFields:this.setBodyFields.bind(this),authType:this.setAuthType.bind(this),responseMapping:this.setResponseMapping.bind(this),responseType:this.setResponseType.bind(this),conditional:this.setConditional.bind(this)};if(t[e])return this.registerInput(e,{set:t[e]});const n=["path-","header-","query-","body-","auth-","mapping-path-"];for(const t of n)if(e.startsWith(t))return this.registerInput(e,{set:this._storeInputValue.bind(this,e)})},scheduleFetch:function(){this._internal.hasScheduledFetch||(this._internal.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated(this.doFetch.bind(this)))},cancelFetch:function(e){const t=this._internal.abortControllers;if(t&&t.size>0){const n=Array.from(t);t.clear();for(const e of n)e.abort();return void this.reportOutcome(e,"done")}this.reportOutcome(e,"unchanged")},buildUrl:function(){let e=this._internal.url||"";const t=e.match(/\{([A-Za-z0-9_]+)\}/g)||[];for(const n of t){const t=n.replace(/[{}]/g,""),i=this._internal.inputValues["path-"+t];s(i)&&(e=e.replace(n,encodeURIComponent(String(i))))}const n={};if(this._internal.queryParams){const e=this._internal.queryParams.split(",").map(e=>e.trim()).filter(Boolean);for(const t of e){const e=this._internal.inputValues["query-"+t];s(e)&&""!==e&&(n[t]=e)}}const i=this._internal.authType;if(i&&l[i]){const e=l[i](a(this._internal.inputValues));e.queryParams&&Object.assign(n,e.queryParams)}const o=Object.entries(n).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`).join("&");return o&&(e+=(e.includes("?")?"&":"?")+o),e},buildHeaders:function(){const e={};if(this._internal.headers){const t=this._internal.headers.split(",").map(e=>e.trim()).filter(Boolean);for(const n of t){const t=this._internal.inputValues["header-"+n];s(t)&&(e[n]=String(t))}}const t=this._internal.authType;if(t&&l[t]){const n=l[t](a(this._internal.inputValues));n.headers&&Object.assign(e,n.headers)}return e},buildBody:function(){const e=this._internal.method||"GET";if(["GET","HEAD","OPTIONS"].includes(e))return;const t=this._internal.bodyType||"json",n=(this._internal.bodyFields||"").split(",").map(e=>e.trim()).filter(Boolean);if("json"===t){const e={};for(const t of n){const n=this._internal.inputValues["body-"+t];void 0!==n&&(e[t]=n)}return Object.keys(e).length>0?JSON.stringify(e):void 0}if("form"===t){const e=new FormData;for(const t of n){const n=this._internal.inputValues["body-"+t];s(n)&&e.append(t,n)}return e}if("urlencoded"===t){const e=new URLSearchParams;for(const t of n){const n=this._internal.inputValues["body-"+t];s(n)&&e.append(t,String(n))}return e.toString()}return"raw"===t?this._internal.inputValues["body-raw"]:void 0},processResponse:function(e,t){this._internal.response=t,this._internal.statusCode=e.status;const n={};e.headers.forEach((e,t)=>{n[t]=e}),this._internal.responseHeaders=n;const i=(this._internal.responseMapping||"").split(",").map(e=>e.trim()).filter(Boolean);for(const e of i){const n="out-"+e,i=r(t,this._internal.inputValues["mapping-path-"+e]||"$");this.registerOutputIfNeeded(n),this._internal.outputValues[n]=i,this.flagOutputDirty(n)}this.flagOutputDirty("response"),this.flagOutputDirty("statusCode"),this.flagOutputDirty("responseHeaders"),this._internal.inspectData={url:this._internal.lastRequestUrl,method:this._internal.method,status:e.status,response:t}},doFetch:function(){this._internal.hasScheduledFetch=!1;const e=this._internal.pendingFetchOutcomes;this._internal.pendingFetchOutcomes=[];const t=function(e){const t=e=>!!e&&"string"!=typeof e;if(t(e.url))return"URL";if(t(e.queryParams))return"Query Parameters";if(t(e.headers))return"Headers";const n=e.method||"GET";return!["GET","HEAD","OPTIONS"].includes(n)&&t(e.bodyFields)?"Body Fields":void 0}(this._internal);if(void 0!==t)return this._internal.error=t+" is not text",this.flagOutputDirty("error"),void(0,i.reportOutcomes)(this,e,"failure",{code:"http/input-not-text",message:t+" is not text, so no request could be sent"});const n=this.buildUrl(),r=this._internal.method||"GET",s=this.buildHeaders(),a=this.buildBody(),l=this._internal.timeout||3e4;if(this._internal.lastRequestUrl=n,!n)return this._internal.error="URL is required",this.flagOutputDirty("error"),void(0,i.reportOutcomes)(this,e,"failure",{code:"http/no-url",message:"URL is required, so no request could be sent"});const u=new AbortController;this._internal.abortControllers||(this._internal.abortControllers=new Set),this._internal.abortControllers.add(u);let c=!1;const d=setTimeout(()=>{c=!0,u.abort()},l),p=this._internal.bodyType||"json";a&&"json"===p&&!s["Content-Type"]?s["Content-Type"]="application/json":a&&"urlencoded"===p&&!s["Content-Type"]&&(s["Content-Type"]="application/x-www-form-urlencoded");const h=(this.runContext()||{}).httpUserAgent;h&&!Object.keys(s).some(e=>"user-agent"===e.toLowerCase())&&(s["User-Agent"]=h),this.conditionalHeaders(n).then(e=>fetch(n,{method:r,headers:{...s,...e},body:a,signal:u.signal})).then(t=>{var s;if(clearTimeout(d),null===(s=this._internal.abortControllers)||void 0===s||s.delete(u),304===t.status)return this._internal.inspectData={url:this._internal.lastRequestUrl,method:r,status:304,notModified:!0},this.sendSignalOnOutput("notModified"),(0,i.reportOutcomes)(this,e,"unchanged"),null;this.rememberValidators(n,t);const a=this._internal.responseType||"auto";return"text"===a?t.text().then(e=>({response:t,body:e})):"json"===a?t.text().then(e=>{try{return{response:t,body:JSON.parse(e)}}catch(e){throw o(new Error("Response Type is JSON but the body is not JSON: "+(e&&e.message?e.message:String(e))))}}):(t.headers.get("content-type")||"").includes("application/json")?t.json().then(e=>({response:t,body:e}),e=>{throw o(e)}):t.text().then(e=>({response:t,body:e}))}).then(t=>{if(!t)return;const{response:n,body:o}=t;this.processResponse(n,o),n.ok?(0,i.reportOutcomes)(this,e,"done"):(this._internal.error=`HTTP ${n.status}: ${n.statusText}`,this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,e,"failure",{code:"http/error-status",message:`The server answered ${n.status} ${n.statusText}`,detail:{url:this._internal.lastRequestUrl,status:n.status}}))}).catch(t=>{var n;clearTimeout(d),null===(n=this._internal.abortControllers)||void 0===n||n.delete(u),"AbortError"!==t.name||c?(this._internal.error=c?`Request timed out after ${l} ms`:t.message||"Network error",this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,e,"failure",{code:c?"http/timeout":t.httpBadBody?"http/bad-body":"http/network-error",message:this._internal.error,detail:{url:this._internal.lastRequestUrl,timeout:c?l:void 0}})):(this.sendSignalOnOutput("canceled"),(0,i.reportOutcomes)(this,e,"unchanged")),this._internal.inspectData={url:this._internal.lastRequestUrl,method:r,error:this._internal.error}})},setHeaders:function(e){this._internal.headers=e||""},setQueryParams:function(e){this._internal.queryParams=e||""},setBodyType:function(e){this._internal.bodyType=e},setBodyFields:function(e){this._internal.bodyFields=e||""},setResponseMapping:function(e){this._internal.responseMapping=e||""},setAuthType:function(e){this._internal.authType=e},setMethod:function(e){this._internal.method=e||"GET"},setTimeout:function(e){this._internal.timeout=e||3e4},setResponseType:function(e){this._internal.responseType=e||"auto"},setConditional:function(e){this._internal.conditional=!0===e},runContext:function(){const e=this.nodeScope;return e&&e.runContext?e.runContext:void 0},conditionalHeaders:function(e){if(!this._internal.conditional)return Promise.resolve({});const t=this.runContext(),n=t&&t.httpValidators;return n?Promise.resolve(n.read(e)).then(e=>{const t={};return e?(e.etag&&(t["If-None-Match"]=e.etag),e.lastModified&&(t["If-Modified-Since"]=e.lastModified),t):t},()=>({})):(this._internal.warnedNoConditionalSupport||(this._internal.warnedNoConditionalSupport=!0,console.warn("[HTTP Request] Conditional is on, but this runtime does not remember response validators (only the NodeGX backend does). The request is being sent normally, and Not Modified will never fire here.")),Promise.resolve({}))},rememberValidators:function(e,t){if(!this._internal.conditional)return;const n=this.runContext(),i=n&&n.httpValidators;if(!i)return;const o=t.headers.get("etag"),r=t.headers.get("last-modified");(o||r)&&i.write(e,{...o?{etag:o}:{},...r?{lastModified:r}:{}})}}},setup:function(e,t){function n(t){u(t.id,t.parameters||{},e.editorConnection),t.on("parameterUpdated",function(n){("url"===n.name||"method"===n.name||"headers"===n.name||"queryParams"===n.name||"bodyType"===n.name||"bodyFields"===n.name||"authType"===n.name||"responseMapping"===n.name||n.name.startsWith("body-type-"))&&u(t.id,t.parameters,e.editorConnection)})}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",()=>{t.on("nodeAdded.net.noodl.HTTP",function(e){n(e)});for(const e of t.getNodesWithType("net.noodl.HTTP"))n(e)})}};e.exports=c},1021(e,t){"use strict";t.notAList=function(e){return!e||Array.isArray(e)?void 0:"Items is not a list — it received "+("object"==typeof e?"an object":"a "+typeof e)}},3887(e,t,n){"use strict";const i=n(7268),o=n(1656),r=n(6835),s=n(5162),a=n(1021),l="map({\n\t// Here you add mappings between the input object and the mapped output object.\n\t//myOutputProp: 'inputProp',\n\t//anotherProperty: function(object) { return object.get('someProperty') + ' ' + object.get('otherProp') }\n})\n",u={node:{name:"Map Collection",docs:"https://docs.noodl.net/nodes/data/array/array-map",displayNodeName:"Array Map",category:"Data",color:"data",initialize:function(){this._internal.collectionChangedCallback=()=>{this.scheduleMap()},this.compileMapScript(l)},inputs:{items:{type:"array",displayName:"Items",description:"Array to map; the node re-runs whenever this array reports a change",group:"General",set:function(e){this.setCollection(e),this.scheduleMap()}},mapScript:{group:"Values",type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},displayName:"Script",description:"Script run once per record, declaring the output properties through map({ … }); each entry is either a source property name or a function of the record",default:l,set:function(e){this.compileMapScript(e),this.scheduleMap()}},refresh:{type:"signal",group:"General",displayName:"Refresh",description:"Re-runs the mapping now, for a source array that changed without notifying",valueChangedToTrue:function(){this.requestMap()}}},outputs:{items:{type:"array",displayName:"Items",description:"A new array of records built by the script; the source array is never modified",group:"General",getter:function(){return this._internal.mappedCollection}},count:{type:"number",displayName:"Count",description:"How many records the last successful mapping produced",group:"General",getter:function(){return this._internal.mappedCollection?this._internal.mappedCollection.size():0}},modified:{group:"Events",type:"signal",displayName:"Changed",description:"Fires once the mapping has run and Items is up to date, whether an author asked for the run or an input changed; wire Done instead for the outcome of a Refresh you triggered"},...(0,s.outcomeOutputs)({done:"Fires once a Refresh you triggered has run and Items is up to date",failure:"Fires when the script could not be compiled, or threw while mapping a record"}),error:{group:"Error",type:"string",displayName:"Error",description:"Why the last mapping failed, in one sentence; empty until something fails",getter:function(){return this._internal.lastError}}},prototypeExtensions:{compileMapScript:function(e){this._internal.mapCode=e;try{this._internal.mapFunc=new Function("map","object",e)}catch(e){return this._internal.mapFunc=void 0,void(this._internal.mapCompileError=e.message||String(e))}this._internal.mapCompileError=void 0},setCollection:function(e){this.bindCollection(e),this.flagOutputDirty("items"),this.flagOutputDirty("count")},unbindCurrentCollection:function(){const e=this._internal.collection;e&&(e.off("change",this._internal.collectionChangedCallback),this._internal.collection=void 0)},bindCollection:function(e){this.unbindCurrentCollection(),this._internal.notAList=(0,a.notAList)(e),this._internal.collection=void 0===this._internal.notAList?e:void 0,this._internal.collection&&this._internal.collection.on("change",this._internal.collectionChangedCallback)},_onNodeDeleted:function(){i.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection()},requestMap:function(){const e=this._internal;e.pendingMapOutcomes||(e.pendingMapOutcomes=[]),e.pendingMapOutcomes.push(this.beginOutcome()),this.scheduleMap()},reportFailure:function(e,t,n,i){const o=this._internal;o.lastError=t,this.flagOutputDirty("error");const r=o.lastReportedError===t;r||(o.lastReportedError=t,this.raiseRuntimeError(e,t,n)),i&&i.length?(0,s.reportOutcomes)(this,i,"failure",{code:e,message:t,detail:n,raise:!1}):r||this.sendSignalOnOutput("failure")},scheduleMap:function(){this.collectionChangedScheduled||(this.collectionChangedScheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.collectionChangedScheduled=!1;const e=this._internal.pendingMapOutcomes||[];this._internal.pendingMapOutcomes=[];const t=e.length>0;if(void 0!==this._internal.notAList)return void this.reportFailure("array-map/not-a-list",this._internal.notAList,void 0,e);if(void 0===this._internal.collection)return void(t&&this.reportFailure("array-map/no-items","Nothing to map — no array is connected to the Items input",void 0,e));if(void 0===this._internal.mapFunc)return void this.reportFailure("array-map/script-failed","The map script could not be compiled: "+(this._internal.mapCompileError||"the Script input is empty"),void 0,e);let n;try{n=this._internal.collection.map(e=>{const t=(this.nodeScope.modelScope||r).create();return this._internal.mapFunc(function(n){for(const i in n){const o=n[i];"function"==typeof o?t.set(i,o(e)):"string"==typeof o&&t.set(i,e instanceof r?e.get(o):e[o])}},e),t})}catch(t){return void this.reportFailure("array-map/map-failed","The map script failed: "+(t.message||String(t)),void 0,e)}this._internal.lastReportedError=void 0,this._internal.mappedCollection=o.create(n),this.flagOutputDirty("items"),this.flagOutputDirty("count"),this.sendSignalOnOutput("modified"),(0,s.reportOutcomes)(this,e,"done")}))}}},setup:function(e){e.editorConnection&&e.editorConnection.isRunningLocally()}};e.exports=u},3761(module,__unused_webpack_exports,__webpack_require__){"use strict";const CollectionImport=__webpack_require__(1656),ModelImport=__webpack_require__(6835),Node=__webpack_require__(7268),foreachitem_1=__webpack_require__(3099),outcome_1=__webpack_require__(5162),Collection=CollectionImport,Model=ModelImport;function _addFailure(e,t){Object.assign(e.node,{outputs:e.node.outputs||{},methods:e.node.methods||{}}),Object.assign(e.node.outputs,{failure:{type:"signal",displayName:"Failure",group:"Events",description:"Fires when there was no object to act on, so nothing was written, after the reason has been put on Error"},error:{type:"string",displayName:"Error",group:"Error",description:"Why no object was bound, and what to set so that one is",getter:function(){return this._internal.error}}}),Object.assign(e.node.methods,{_failNoModel:function(e,n,i){const o="foreach"===this._internal.idSource,r=o?"Nothing to "+n+' — Id Source is "From repeater" and no item resolved.':"Nothing to "+n+" — no object is bound. Set the Id input, or connect one, before triggering this node.";this._internal.error=r,this.flagOutputDirty("error"),this.reportOutcome(e,"failure",{code:t+"/no-object",message:r,detail:{idSource:"explicit"},raise:!o&&!i})}})}function _addBaseInfo(e){Object.assign(e.node,{category:"Data",color:"data"})}function _addModelId(e,t){const n=void 0===t||t.includeInputs,i=void 0===t||t.includeOutputs;Object.assign(e.node,{inputs:e.node.inputs||{},outputs:e.node.outputs||{},methods:e.node.methods||{}}),n&&(Object.assign(e.node,{usePortAsLabel:"modelId"}),e.node.dynamicports=(e.node.dynamicports||[]).concat([{name:"conditionalports/extended",condition:"idSource = explicit OR idSource NOT SET",inputs:["modelId"]},{name:"conditionalports/extended",condition:"idSource = foreach",inputs:["repeaterComponent"]}]),Object.assign(e.node.inputs,{idSource:{type:{name:"enum",enums:[{label:"Specify explicitly",value:"explicit"},{label:"From repeater",value:"foreach"}],allowEditOnly:!0},default:"explicit",displayName:"Id Source",group:"General",description:"Where the object comes from: the Id input, or the item of the Repeater this node sits inside",set:function(e){this._internal.idSource=e,"foreach"===e&&this.bindToRepeaterItem()}},repeaterComponent:{type:"component",displayName:"Repeater Component",group:"General",description:"Which Repeater to take the item from when several are nested; leave blank to use the nearest one, and ignored unless Id Source is From repeater",set:function(e){this._internal.repeaterComponent=e||void 0,"foreach"===this._internal.idSource&&this.bindToRepeaterItem()}},modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",description:"Id of the object to act on, which is created the first time it is named; an Object may be wired here instead, and null or blank binds nothing so Do fails",set:function(e){e instanceof Model&&(e=e.getId()),this._internal.modelId=e,this.setModelID(e)}}})),i&&Object.assign(e.node.outputs,{id:{type:"string",displayName:"Id",group:"General",description:"Id of the object this node acted on, which is how a newly created one is picked up downstream",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}}}),Object.assign(e.node.methods,{bindToRepeaterItem:function(){this.scheduleAfterInputsHaveUpdated(()=>{this.setModel((0,foreachitem_1.resolveForEachItem)(this,{target:this._internal.repeaterComponent}))})},setModelID:function(e){if(null==e||""===e)return void this.setModel(void 0);const t=(this.nodeScope.modelScope||Model).get(e);this.setModel(t)},setModel:function(e){this._internal.model=e,this.flagOutputDirty("id")},_onNodeDeleted:function(){Node.prototype._onNodeDeleted.call(this),(0,foreachitem_1.forgetForEachItem)(this)}}),e.node.getInspectInfo||(e.node.getInspectInfo=function(){const e=this._internal.model;return e?[{type:"text",value:"Id: "+e.getId()},{type:"value",value:e.data}]:"[No Object]"})}function _addInputProperties(def){const _def={node:Object.assign({},def.node),setup:def.setup},_methods=Object.assign({},def.node.methods);Object.assign(def.node,{inputs:def.node.inputs||{},outputs:def.node.outputs||{},methods:def.node.methods||{}}),Object.assign(def,{setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&(t.on("nodeAdded."+def.node.name,function(t){function n(){const n=[],i=[{label:"String",value:"string"},{label:"Boolean",value:"boolean"},{label:"Number",value:"number"},{label:"Date",value:"date"},{label:"Array",value:"array"},{label:"Object",value:"object"},{label:"Any",value:"*"}];let o=t.parameters.properties;if(o){o=o?o.split(","):void 0;for(const e in o){const r=o[e];n.push({type:{name:void 0===t.parameters["type-"+r]?"*":t.parameters["type-"+r]},plug:"input",group:"Property Values",displayName:r,name:"prop-"+r,description:"undefined leaves this property on the record unchanged. null clears it (writes null onto the record and notifies)."}),n.push({type:{name:"enum",enums:i,allowEditOnly:!0},plug:"input",group:"Property Types",displayName:r,default:"*",name:"type-"+r,description:"How to read the "+r+" value before writing it: Object and Array turn a string into the object or array it names, and Any writes it through untouched"})}}e.editorConnection.sendDynamicPorts(t.id,n,{detectRenamed:{plug:"input"}})}n(),t.on("parameterUpdated",function(){n()})}),_def.setup&&_def.setup(e,t))}}),Object.assign(def.node,{initialize:function(){const e=this._internal;e.inputValues={},e.inputTypes={},_def.node.initialize&&_def.node.initialize.call(this)}}),Object.assign(def.node.outputs,{}),Object.assign(def.node.inputs,{properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties to set",description:"Names the properties to write; each name listed here gets a value input and a type selector",set:function(){}}}),Object.assign(def.node.methods,{_pushInputValues:function(model){const internal=this._internal,_allKeys={};for(const e in internal.inputTypes)_allKeys[e]=!0;for(const e in internal.inputValues)_allKeys[e]=!0;const properties=this.model.parameters.properties||"",validProperties=properties.split(","),keysToSet=Object.keys(_allKeys).filter(e=>-1!==validProperties.indexOf(e));for(const i of keysToSet){let value=internal.inputValues[i];if(void 0!==value){if(void 0!==internal.inputTypes[i]&&"array"===internal.inputTypes[i]&&"string"==typeof value){const source=value;this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"invalid-array-"+i);try{value=eval(source)}catch(e){-1!==source.indexOf("[")||-1!==source.indexOf("{")?(this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"invalid-array-"+i,{showGlobally:!0,message:"Invalid array<br>"+e.toString()}),value=[]):value=Collection.get(source)}}void 0!==internal.inputTypes[i]&&"object"===internal.inputTypes[i]&&"string"==typeof value&&(value=(this.nodeScope.modelScope||Model).get(value)),model.set(i,value,{resolve:!0})}}},scheduleStore:function(){if(this.pendingStoreOutcomes||(this.pendingStoreOutcomes=[]),this.pendingStoreOutcomes.push(this.beginOutcome()),this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledStore=!1;const t=this.pendingStoreOutcomes||[];if(this.pendingStoreOutcomes=void 0,e.model)this._pushInputValues(e.model),(0,outcome_1.reportOutcomes)(this,t,"done");else if(this._failNoModel)for(let e=0;e<t.length;e++)this._failNoModel(t[e],"store",e>0);else this.raiseRuntimeError("data/mixin-missing","This node cannot report failures: addFailure was not applied")})},registerInputIfNeeded:function(e){this.hasInput(e)||(e.startsWith("prop-")&&this.registerInput(e,{set:this._setInputValue.bind(this,e.substring(5))}),e.startsWith("type-")&&this.registerInput(e,{set:this._setInputType.bind(this,e.substring(5))}),_methods&&_methods.registerInputIfNeeded&&_def.node.methods.registerInputIfNeeded.call(this,e))},_setInputValue:function(e,t){this._internal.inputValues[e]=t},_setInputType:function(e,t){this._internal.inputTypes[e]=t}})}const ModelCRUDBase={addInputProperties:_addInputProperties,addModelId:_addModelId,addBaseInfo:_addBaseInfo,addFailure:_addFailure};module.exports=ModelCRUDBase},3192(e,t,n){"use strict";const i=n(7268),o=n(6835),r=n(3099),s=n(5162),a=o;function l(e){return this._internal.model?this._internal.model.get(e,{resolve:!0}):void 0}function u(e,t){this._internal.inputValues[e]=t;const n=this._internal.model;(!n||n.get(e)!==t)&&(this._internal.dirtyValues[e]=!0,this.scheduleStore())}function c(e,t,n){const i=[];let o=t.properties;if(o){o=o?o.split(","):void 0;for(const e in o){const t=o[e];i.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:"prop-"+t,displayName:t,description:"Reads and writes the "+t+" property of the bound object; a value arriving before an object is bound is held and written once one is"}),i.push({type:"signal",plug:"output",group:"Events",displayName:t+" Changed",name:"changed-"+t,description:"Fires when the "+t+" property changes, from this node or from anywhere else"})}}n.sendDynamicPorts(e,i,{detectRenamed:{plug:"input/output"}})}const d={node:{name:"Model2",docs:"https://docs.noodl.net/nodes/data/object/object-node",displayNodeName:"Object",category:"Data",usePortAsLabel:"modelId",color:"data",dynamicports:[{name:"conditionalports/extended",condition:"idSource = explicit OR idSource NOT SET",inputs:["modelId"]},{name:"conditionalports/extended",condition:"idSource = foreach",inputs:["repeaterComponent"]}],runOnValueChange:{controlSignal:"fetch",inputs:["modelId"],sources:[{name:"object",displayName:"Object properties"}]},initialize:function(){const e=this._internal;e.inputValues={},e.dirtyValues={};const t=this;this._internal.onModelChangedCallback=function(e){t.shouldRunOnValueChange("object")&&(t.hasOutput("prop-"+e.name)&&t.flagOutputDirty("prop-"+e.name),t.hasOutput("changed-"+e.name)&&t.sendSignalOnOutput("changed-"+e.name),t.sendSignalOnOutput("changed"))}},getInspectInfo(){const e=this._internal.model;return e?[{type:"text",value:"Id: "+e.getId()},{type:"value",value:e.data}]:"[No Object]"},outputs:{id:{type:"string",displayName:"Id",group:"General",description:"Id of the object this node is bound to, whether that came from the Id input or from a repeater item. This names the object; the Object output carries the object itself, which is what a node that watches or reads it wants",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}},object:{type:"object",displayName:"Object",group:"General",description:"The bound object itself, for Object Changed or anything else that reads or watches the object rather than naming it; empty while nothing is bound",getter:function(){return this._internal.model||null}},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires whenever any property of the bound object changes, from this node or from anywhere else"},fetched:{type:"signal",displayName:"Fetched",group:"Events",description:"Fires once a new object has been bound and its property outputs are up to date"},...(0,s.outcomeOutputs)({done:"Fires when a Fetch finished and the property outputs are up to date",failure:"Fires when Fetch was pressed with no Id to bind to, with the reason on the error channel"})},inputs:{idSource:{type:{name:"enum",enums:[{label:"Specify explicitly",value:"explicit"},{label:"From repeater",value:"foreach"}],allowEditOnly:!0},default:"explicit",displayName:"Get Id from",group:"General",description:"Where the object comes from: the Id input, or the item of the Repeater this node sits inside",set:function(e){this._internal.idSource=e,"foreach"===e&&this.bindToRepeaterItem()}},repeaterComponent:{type:"component",displayName:"Repeater Component",group:"General",description:"Which Repeater to take the item from when several are nested; leave blank to use the nearest one, and ignored unless Get Id from is From repeater",set:function(e){this._internal.repeaterComponent=e||void 0,"foreach"===this._internal.idSource&&this.bindToRepeaterItem()}},modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",description:"Id of the object to bind to, which is created the first time it is named; an Object or a plain JS object may be wired here instead, and null or blank binds nothing",set:function(e){e instanceof a?e=e.getId():"object"==typeof e&&null!==e&&(e=a.create(e).getId());const t=this._internal.modelId;this._internal.modelId=e,this.shouldRunOnValueChanged("modelId",t,e)?this.setModelID(e):this.flagOutputDirty("id")}},properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",description:"Names the properties to read and write; each name listed here gets an input, an output and a Changed signal",set:function(){}},fetch:{displayName:"Fetch",group:"Actions",description:"Re-reads the object named by Id now. This is additional to Id rebinding on change and to changes being announced; untick either under Run On Value Change to stop it",valueChangedToTrue:function(){this.scheduleSetModel()}}},prototypeExtensions:{bindToRepeaterItem:function(){this.scheduleAfterInputsHaveUpdated(()=>{this.setModel((0,r.resolveForEachItem)(this,{target:this._internal.repeaterComponent}))})},scheduleStore:function(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated(()=>{if(this.hasScheduledStore=!1,e.model){for(const t in e.dirtyValues)e.model.set(t,e.inputValues[t],{resolve:!0});e.dirtyValues={}}})},scheduleSetModel:function(){(this._internal.pendingFetch||(this._internal.pendingFetch=[])).push(this.beginOutcome()),this.hasScheduledSetModel||(this.hasScheduledSetModel=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledSetModel=!1;const e=this._internal.pendingFetch||[];this._internal.pendingFetch=[];const t=this._internal.modelId;null!=t&&""!==t?(this.setModelID(t),(0,s.reportOutcomes)(this,e,"done")):(0,s.reportOutcomes)(this,e,"failure",{code:"object/fetch-failed",message:"Fetch was triggered with no Id, so there is no object to bind to"})}))},setModelID:function(e){if(null==e||""===e)return void this.setModel(void 0);const t=(this.nodeScope.modelScope||a).get(e);this.setModel(t),this.sendSignalOnOutput("fetched")},setModel:function(e){if(this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),this._internal.model=e,this.flagOutputDirty("id"),this.flagOutputDirty("object"),e){e.on("change",this._internal.onModelChangedCallback);for(const t in e.data)this.hasOutput("prop-"+t)&&this.flagOutputDirty("prop-"+t);Object.keys(this._internal.dirtyValues).length>0&&this.scheduleStore()}},_onNodeDeleted:function(){i.prototype._onNodeDeleted.call(this),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),(0,r.forgetForEachItem)(this)},registerOutputIfNeeded:function(e){this.hasOutput(e)||(e.startsWith("prop-")&&this.registerOutput(e,{getter:l.bind(this,e.substring(5))}),e.startsWith("changed-")&&this.registerOutput(e,{type:"signal",getter:()=>{}}))},registerInputIfNeeded:function(e){this.hasInput(e)||e.startsWith("prop-")&&this.registerInput(e,{set:u.bind(this,e.substring(5))})}}},setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Model2",function(t){c(t.id,t.parameters,e.editorConnection),t.on("parameterUpdated",function(){c(t.id,t.parameters,e.editorConnection)})})}};e.exports=d},7697(e,t,n){"use strict";const i=n(6835),o=n(5162),r=n(5427),s=i,a={node:{name:"NewDbModelProperties",docs:"https://docs.noodl.net/nodes/data/cloud-data/create-new-record",displayName:"Create Record",usePortAsLabel:"collectionName",inputs:{store:{displayName:"Do",group:"Actions",description:"Creates a record in the chosen Class from the property inputs and sends it to the backend",valueChangedToTrue:function(){this.storageInsert()}},sourceObjectId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Source Object Id",group:"General",description:"Id of an existing record whose properties seed the new one before the property inputs are applied over them; leave blank to start empty",set:function(e){e instanceof s&&(e=e.getId()),this._internal.sourceObjectId=e}},upsertOn:{type:"string",displayName:"Upsert On",group:"General",description:"Name of a unique-indexed property. When a record already holds this value the write updates that record instead of creating a second one. Leave empty to always create.",set:function(e){this._internal.upsertOn="string"==typeof e&&""!==e.trim()?e.trim():void 0}}},outputs:{},methods:{storageInsert:function(){const e=this._internal,t=this.beginOutcome();this.checkWarningsBeforeCloudOp([t])&&(this.pendingOutcomes("Insert").push(t),this.scheduleOnce("StorageInsert",()=>{const t=this.takeOutcomes("Insert"),n=Object.assign({},e.sourceObjectId?(this.nodeScope.modelScope||s).get(e.sourceObjectId).data:{},e.inputValues),i=this._aclRefusal();if(void 0!==i)return void this.setError(i,t);const r=this.cloudStore(t);r&&r.create({collection:e.collectionId,data:n,acl:this._getACL(),upsertOn:e.upsertOn,success:n=>{const i=r._fromJSON(n,e.collectionId);this.setModel(i),(0,o.reportOutcomes)(this,t,"done")},error:e=>{this.setError(e||"Failed to insert.",t)}})}))}}}};r.addBaseInfo(a,{done:"Fires once the backend has stored the new record and Id carries the Id it was given"}),r.addModelId(a,{includeOutputs:!0}),r.addInputProperties(a),r.addAccessControl(a),e.exports=a},6854(e,t,n){"use strict";const i=n(6835),o=n(3761),r=n(5162),s=i,a={node:{name:"NewModel",docs:"https://docs.noodl.net/nodes/data/object/create-new-object",displayNodeName:"Create New Object",inputs:{new:{displayName:"Do",group:"Actions",description:"Creates a new object with a generated id and writes the property values currently on the inputs",valueChangedToTrue:function(){this.scheduleNew()}}},outputs:(0,r.outcomeOutputs)({done:"Fires once the new object exists, its properties are written and Id names it"}),methods:{scheduleNew:function(){this.pendingNewOutcomes||(this.pendingNewOutcomes=[]),this.pendingNewOutcomes.push(this.beginOutcome()),this.hasScheduledNew||(this.hasScheduledNew=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledNew=!1;const e=this.pendingNewOutcomes||[];this.pendingNewOutcomes=void 0;const t=(this.nodeScope.modelScope||s).get();this._pushInputValues(t),this.setModel(t),(0,r.reportOutcomes)(this,e,"done")}))}}}};o.addBaseInfo(a),o.addModelId(a,{includeOutputs:!0}),o.addInputProperties(a),e.exports=a},6996(e,t,n){"use strict";const i=n(1656),o=n(2566),r={node:{name:"net.noodl.ParseCSV",displayNodeName:"Parse CSV",docs:"https://docs.noodl.net/nodes/data/array/parse-csv",category:"Data",color:"data",initialize:function(){this._internal.hasHeader=!0,this._internal.delimiter=",",this._internal.count=0},getInspectInfo(){return this._internal.lastError?this._internal.lastError:this._internal.items?[{type:"value",value:this._internal.items}]:void 0},inputs:{text:{type:{name:"string",codeeditor:"text"},displayName:"CSV",group:"General",description:"The CSV text to parse. A leading byte-order mark — which is what Excel writes when it saves UTF-8 — is stripped, so the first column keeps its name",set:function(e){this._internal.textSupplied=null!=e,this._internal.text=e,this._schedule()}},hasHeader:{type:"boolean",displayName:"Has Header",group:"General",default:!0,description:"When ticked the first row names the columns and Items is an array of records. Untick it and Items is an array of rows, each an array of cells",set:function(e){this._internal.hasHeader=!!e,this._schedule()}},delimiter:{type:"string",displayName:"Delimiter",group:"General",default:",",description:"The character between cells. Use ; for a European export, or a tab for TSV",set:function(e){this._internal.delimiter=e||",",this._schedule()}}},outputs:{items:{type:"array",displayName:"Items",group:"Values",description:"The parsed rows — records when Has Header is ticked, arrays of cells when it is not. Every cell is a string, including columns that look numeric. Unchanged while the CSV cannot be parsed",getter:function(){return this._internal.items}},count:{type:"number",displayName:"Count",group:"Values",description:"How many rows the last successful parse produced, not counting the header row",getter:function(){return this._internal.count}},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires once Items and Count hold the freshly parsed CSV"},failure:{type:"signal",displayName:"Failure",group:"Events",description:"Fires when the CSV could not be parsed, leaving Items and Count as they were"},error:{type:"string",displayName:"Error",group:"Error",description:"Why the CSV could not be parsed, naming the line it gave up on; empty until a parse fails",getter:function(){return this._internal.lastError}}},methods:{_schedule:function(){this._internal.scheduled||(this._internal.scheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._internal.scheduled=!1,this._parse()}))},_parse:function(){if(!this._internal.textSupplied)return;const e=(0,o.parseCSV)(this._internal.text,this._internal.delimiter);if(e.error)return this._internal.lastError=e.error.message,this.flagOutputDirty("error"),this.raiseRuntimeError("parse-csv/parse-failed",e.error.message,{line:e.error.line}),void this.sendSignalOnOutput("failure");if(this._internal.lastError=void 0,this.flagOutputDirty("error"),this._internal.hasHeader){const t=(0,o.rowsToRecords)(e.rows),n=i.get();n.set(t),this._internal.items=n,this._internal.count=t.length}else this._internal.items=e.rows,this._internal.count=e.rows.length;this.flagOutputDirty("items"),this.flagOutputDirty("count"),this.sendSignalOnOutput("changed")}}}};e.exports=r},3046(e,t,n){"use strict";const i=n(1656),o=n(5868),r=n(6783),s={node:{name:"net.noodl.ParseFeed",displayNodeName:"Parse Feed",docs:"https://docs.noodl.net/nodes/data/array/parse-feed",category:"Data",color:"data",initialize:function(){this._internal.maxBytes=r.DEFAULT_MAX_BYTES,this._internal.count=0,this._internal.feedTitle="",this._internal.feedLink="",this._internal.feedDescription="",this._internal.kind="",this._internal.source=""},getInspectInfo(){return this._internal.lastError?this._internal.lastError:this._internal.items?[{type:"value",value:this._internal.items}]:void 0},inputs:{text:{type:{name:"string",codeeditor:"text"},displayName:"Feed",group:"General",description:"The feed document — RSS 2.0, Atom 1.0 or RDF/RSS 1.0. Wire an HTTP Request node's Response here with its Response Type set to Text: feeds are served as application/rss+xml, text/xml and, from some sources, text/html, and Text is what guarantees the body arrives untouched",set:function(e){this._internal.textSupplied=null!=e,this._internal.text=e,this._schedule()}},maxBytes:{type:"number",displayName:"Max Characters",group:"General",default:r.DEFAULT_MAX_BYTES,description:"Refuse a document longer than this many characters (not bytes), before parsing it. Raise it for a source that really does publish its whole archive in one file",set:function(e){const t=Number(e);this._internal.maxBytes=isFinite(t)&&t>0?t:r.DEFAULT_MAX_BYTES,this._schedule()}}},outputs:{items:{type:"array",displayName:"Items",group:"Values",description:"The feed's items, always an array whether the feed carried one or a hundred. Each has Id, Title, Link, Published, Updated, Author, Summary, Content, Image, Enclosure, Tags and Raw. Id is never empty — it is the guid, or the Atom id, or the link, or a hash of title and date — which is what lets a collection store each item once. Each item is the app's shared record of its Id: two items with one Id are one record, with the later item's fields, and an Object node or another Parse Feed using that Id holds the same one. Unchanged while the feed cannot be parsed",getter:function(){return this._internal.items}},count:{type:"number",displayName:"Count",group:"Values",description:"How many items Items holds after the last successful parse",getter:function(){return this._internal.count}},feedTitle:{type:"string",displayName:"Feed Title",group:"Feed",description:"The title of the feed itself, not of any item",getter:function(){return this._internal.feedTitle}},feedLink:{type:"string",displayName:"Feed Link",group:"Feed",description:"The site the feed belongs to — its alternate link, never its own XML address",getter:function(){return this._internal.feedLink}},feedDescription:{type:"string",displayName:"Feed Description",group:"Feed",description:"The feed's description, or an Atom feed's subtitle",getter:function(){return this._internal.feedDescription}},feedUpdated:{type:"string",displayName:"Feed Updated",group:"Feed",description:"When the feed last changed, as an ISO 8601 string; empty when it did not say",getter:function(){return this._internal.feedUpdated}},kind:{type:"string",displayName:"Kind",group:"Feed",description:"Which format this was: rss, atom or rdf",getter:function(){return this._internal.kind}},source:{type:"string",displayName:"Source",group:"Feed",description:"A hint at where the feed came from, for a graph that wants to branch: youtube, reddit, podcast or generic. A hint, not a promise — generic is what an unrecognised source gets and it is not a failure",getter:function(){return this._internal.source}},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires once Items and the Feed outputs hold the freshly parsed feed"},failure:{type:"signal",displayName:"Failure",group:"Events",description:"Fires when the feed could not be read, leaving Items and Count as they were"},error:{type:"string",displayName:"Error",group:"Error",description:"Why the feed could not be read; empty until a parse fails",getter:function(){return this._internal.lastError}},errorCode:{type:"string",displayName:"Error Code",group:"Error",description:"A stable code for the failure, for a graph that branches rather than reads: feed/unrecognised when the document is XML but not a feed, otherwise the Parse XML codes (xml/too-large, xml/entity-declaration, xml/doctype-subset, xml/parse-failed, xml/empty)",getter:function(){return this._internal.lastErrorCode}}},methods:{_schedule:function(){this._internal.scheduled||(this._internal.scheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._internal.scheduled=!1,this._parse()}))},_parse:function(){if(!this._internal.textSupplied)return;const e=(0,o.parseFeed)(this._internal.text,this._internal.maxBytes);if(e.error)return this._internal.lastError=e.error.message,this._internal.lastErrorCode=e.error.code,this.flagOutputDirty("error"),this.flagOutputDirty("errorCode"),this.raiseRuntimeError("parse-feed/parse-failed",e.error.message,{code:e.error.code}),void this.sendSignalOnOutput("failure");this._internal.lastError=void 0,this._internal.lastErrorCode=void 0,this.flagOutputDirty("error"),this.flagOutputDirty("errorCode");const t=e.items||[],n=i.get();n.set(t),this._internal.items=n,this._internal.count=n.size();const r=e.feed;this._internal.feedTitle=r&&r.title||"",this._internal.feedLink=r&&r.link||"",this._internal.feedDescription=r&&r.description||"",this._internal.feedUpdated=r&&r.updated||"",this._internal.kind=r&&r.kind||"",this._internal.source=r&&r.source||"";for(const e of["items","count","feedTitle","feedLink","feedDescription","feedUpdated","kind","source"])this.flagOutputDirty(e);this.sendSignalOnOutput("changed")}}}};e.exports=s},2345(e,t,n){"use strict";const i=n(6783),o={node:{name:"net.noodl.ParseXML",displayNodeName:"Parse XML",docs:"https://docs.noodl.net/nodes/data/array/parse-xml",category:"Data",color:"data",initialize:function(){this._internal.attributePrefix="@",this._internal.alwaysArray="",this._internal.trimValues=!0,this._internal.maxBytes=i.DEFAULT_MAX_BYTES},getInspectInfo(){return this._internal.lastError?this._internal.lastError:this._internal.result?[{type:"value",value:this._internal.result}]:void 0},inputs:{text:{type:{name:"string",codeeditor:"text"},displayName:"XML",group:"General",description:"The XML text to parse. Wire an HTTP Request node's Response here with its Response Type set to Text, so the body reaches this node untouched whatever content-type the server claimed",set:function(e){this._internal.textSupplied=null!=e,this._internal.text=e,this._schedule()}},attributePrefix:{type:"string",displayName:"Attribute Prefix",group:"General",default:"@",description:'What an attribute\'s key starts with, so it cannot collide with a child element of the same name. With the default, <a href="x"/> is { "@href": "x" }',set:function(e){this._internal.attributePrefix=e??"@",this._schedule()}},alwaysArray:{type:"string",displayName:"Always Array",group:"General",default:"",description:"Comma-separated tag names that are always an array, however many times they appear. Without this, a document with one <item> and a document with ten have different shapes and everything downstream needs a branch",set:function(e){this._internal.alwaysArray=e?String(e):"",this._schedule()}},trimValues:{type:"boolean",displayName:"Trim Values",group:"General",default:!0,description:"Strip leading and trailing whitespace from text. Untick it to keep a document's indentation",set:function(e){this._internal.trimValues=!!e,this._schedule()}},maxBytes:{type:"number",displayName:"Max Characters",group:"General",default:i.DEFAULT_MAX_BYTES,description:"Refuse a document longer than this many characters (not bytes), before parsing it. A big document costs many times its own size in memory once it is an object, and a server can always send more than you expected",set:function(e){const t=Number(e);this._internal.maxBytes=isFinite(t)&&t>0?t:i.DEFAULT_MAX_BYTES,this._schedule()}}},outputs:{result:{type:"object",displayName:"Result",group:"Values",description:'The document as an object. Every value is a string, including ones that look numeric — an id of 0123 stays "0123". A tag carrying both attributes and text becomes { "@attr": "…", "#text": "…" }. Unchanged while the XML cannot be parsed',getter:function(){return this._internal.result}},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires once Result holds the freshly parsed document"},failure:{type:"signal",displayName:"Failure",group:"Events",description:"Fires when the XML could not be parsed or was refused, leaving Result as it was"},error:{type:"string",displayName:"Error",group:"Error",description:"Why the XML could not be read; empty until a parse fails",getter:function(){return this._internal.lastError}},errorCode:{type:"string",displayName:"Error Code",group:"Error",description:"A stable code for the failure, for a graph that branches rather than reads: xml/too-large, xml/entity-declaration, xml/doctype-subset, xml/parse-failed, xml/empty",getter:function(){return this._internal.lastErrorCode}}},methods:{_schedule:function(){this._internal.scheduled||(this._internal.scheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._internal.scheduled=!1,this._parse()}))},_parse:function(){if(!this._internal.textSupplied)return;const e=(0,i.parseXML)(this._internal.text,{attributePrefix:this._internal.attributePrefix,alwaysArray:this._internal.alwaysArray.split(",").map(e=>e.trim()).filter(Boolean),trimValues:this._internal.trimValues,maxBytes:this._internal.maxBytes});if(e.error)return this._internal.lastError=e.error.message,this._internal.lastErrorCode=e.error.code,this.flagOutputDirty("error"),this.flagOutputDirty("errorCode"),this.raiseRuntimeError("parse-xml/parse-failed",e.error.message,{code:e.error.code}),void this.sendSignalOnOutput("failure");this._internal.lastError=void 0,this._internal.lastErrorCode=void 0,this.flagOutputDirty("error"),this.flagOutputDirty("errorCode"),this._internal.result=e.value,this.flagOutputDirty("result"),this.sendSignalOnOutput("changed")}}}};e.exports=o},2114(e,t,n){"use strict";t.recordSchemaContext=function(e,t){const n=a(e);return(0,o.resolveSchemaPortContext)({graphModel:e,parameters:t,collectionParam:"collectionName",extraBackends:l(n),activeBackendId:(0,i.defaultBackendId)(n)})},t.metaDataSources=a,t.recordBackendPickerPorts=function(e){return(0,o.backendPickerPorts)(e,{hideWhenSingleBackend:!0,group:"General"})},t.recordClassPorts=function(e){const t=new Set(e.collections.map(e=>e.name)),n=u(e)?s.filter(e=>!t.has(e.value)):[];return(0,o.collectionPorts)(e,{name:"collectionName",displayName:"Class",group:"General",placeholderLabel:null,filterByApiPathMode:!1,extraEnums:n.slice()})},t.isParseWireContext=u,t.recordFieldPorts=function(e,t){var n;const i=[],r=t.readOnlyFields||[];for(const s of(null===(n=e.selectedCollection)||void 0===n?void 0:n.fields)||[])r.includes(s.name)||(0,o.shouldShowField)(s)&&(t.skipRelationColumns&&"relation"===s.type||(i.push({name:`prop-${s.name}`,displayName:s.displayName||s.name,type:c(s),plug:t.plug,group:"Properties"}),t.includeChangedSignals&&i.push({name:`changed-${s.name}`,displayName:`${s.displayName||s.name} Changed`,type:"signal",plug:"output",group:"Events"})));return i},t.recordPortType=c,t.recordWiredFieldPorts=function(e,t,n){var i,o;const r=null==e?void 0:e.component;if(!e||!r)return[];const s=[...(null===(i=r.getConnectionsTo)||void 0===i?void 0:i.call(r,e.id))||[],...(null===(o=r.getConnectionsFrom)||void 0===o?void 0:o.call(r,e.id))||[]],a=n.readOnlyFields||[],l=new Set(t.map(e=>e.name)),u=[];for(const t of function(e,t,n){const i=[],o=e=>{if("string"!=typeof e||!e.startsWith("prop-"))return;const t=e.substring(5);t.length>0&&!i.includes(t)&&i.push(t)};for(const e of Object.keys(t||{}))o(e);for(const t of n)t&&(t.targetId===e&&o(t.targetPort),t.sourceId===e&&o(t.sourcePort));return i}(e.id,e.parameters,s))a.includes(t)||l.has(`prop-${t}`)||u.push({name:`prop-${t}`,displayName:t,type:{name:"*"},plug:n.plug,group:"Properties"});return u},t.recordRelationPorts=function(e){return e.selectedCollection?[{name:"relationProperty",displayName:"Relation",group:"General",type:{name:"enum",enums:(e.selectedCollection.fields||[]).filter(e=>"relation"===e.type||"many-to-many"===e.relationType).map(e=>({label:e.displayName||e.name,value:e.name})),allowEditOnly:!0},plug:"input"}]:[]},t.recordFilterSchema=function(e){if(!e.selectedCollection)return null;if(u(e)){const t={};for(const n of e.selectedCollection.fields||[])t[n.name]={type:n.nativeType||d(n),...n.relationTarget?{targetClass:n.relationTarget}:{}};const n={};for(const t of e.collections)for(const i of t.fields||[])"Relation"!==i.nativeType&&"relation"!==i.type||i.relationTarget===e.selectedCollection.name&&(void 0===n[t.name]&&(n[t.name]=[]),n[t.name].push({property:i.name}));return Object.keys(n).length>0?{properties:t,relations:n}:{properties:t}}return{collection:e.selectedCollection.name,fields:(0,o.getFilterFields)(e)}},t.recordFilterBackendType=function(e,t){return e.backendType||t};const i=n(5527),o=n(1711),r=Object.freeze({String:"string",Boolean:"boolean",Number:"number",Date:"date"}),s=Object.freeze([{label:"User",value:"_User"},{label:"Role",value:"_Role"}]);function a(e){return{backendServices:e.getMetaData("backendServices"),cloudservices:e.getMetaData("cloudservices")}}function l(e){const t=(0,i.endpointBackendEntry)(e.cloudservices);return t?[t]:[]}function u(e){return void 0===e.backendType||"parse"===e.backendType||"nodegx"===e.backendType}function c(e){return e.nativeType&&Object.prototype.hasOwnProperty.call(r,e.nativeType)?{name:r[e.nativeType]}:e.nativeType?{name:"*"}:(0,o.getEnhancedFieldType)(e).type}function d(e){switch(e.type){case"string":return"String";case"number":return"Number";case"boolean":return"Boolean";case"dateTime":case"date":return"Date";case"relation":return"Relation";default:return}}},2103(e){"use strict";function t(e,t,n,i,o,r){if(o.editorConnection.clearWarning(i.component.name,i.id,"rest-run-waring-"+n),void 0===e)return void o.editorConnection.clearWarning(i.component.name,i.id,"rest-parse-waring-"+n);try{new Function(...t,e),o.editorConnection.clearWarning(i.component.name,i.id,"rest-parse-waring-"+n)}catch(e){o.editorConnection.sendWarning(i.component.name,i.id,"rest-parse-waring-"+n,{message:"<strong>"+n+"</strong>: "+e.message,showGlobally:!0})}function s(e){return void 0!==r.find(t=>t.name===e)}const a=e.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""),l=a.match(/Inputs\.[A-Za-z0-9]+/g);if(l){const e={};l.forEach(t=>{e[t.substring(7)]=!0}),Object.keys(e).forEach(e=>{s("in-"+e)||r.push({name:"in-"+e,displayName:e,plug:"input",type:"*",group:"Inputs"})})}const u=a.match(/Outputs\.[A-Za-z0-9]+/g);if(u){const e={};u.forEach(t=>{e[t.substring(8)]=!0}),Object.keys(e).forEach(e=>{s("out-"+e)||r.push({name:"out-"+e,displayName:e,plug:"output",type:"*",group:"Outputs"})})}}const n={node:{name:"REST2",displayNodeName:"REST",docs:"https://docs.noodl.net/nodes/data/rest",deprecated:!0,replacedBy:"net.noodl.HTTP",category:"Data",color:"data",searchTags:["http","request","fetch"],initialize:function(){this._internal.inputValues={},this._internal.outputValues={},this._internal.outputValuesProxy=new Proxy(this._internal.outputValues,{set:(e,t,n)=>(n!==this._internal.outputValues[t]&&(this.registerOutputIfNeeded("out-"+t),this._internal.outputValues[t]=n,this.flagOutputDirty("out-"+t)),!0)}),this._internal.self={}},getInspectInfo(){return this._internal.inspectData?{type:"value",value:this._internal.inspectData}:{type:"text",value:"[Not executed yet]"}},inputs:{resource:{type:"string",displayName:"Resource",group:"Request",default:"/",set:function(e){this._internal.resource=e}},method:{type:{name:"enum",enums:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"},{label:"DELETE",value:"DELETE"}]},displayName:"Method",group:"Request",default:"GET",set:function(e){this._internal.method=e}},requestScript:{type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},displayName:"Request",default:"//Add custom code to setup the request object before the request\n//is made.\n//\n//*Request.resource contains the resource path of the request.\n//*Request.method contains the method, GET, POST, PUT or DELETE.\n//*Request.headers is a map where you can add additional headers.\n//*Request.parameters is a map the parameters that will be appended\n// to the url.\n//*Request.content contains the content of the request as a javascript\n// object.\n//\n",group:"Scripts",set:function(e){try{this._internal.requestFunc=new Function("Inputs","Outputs","Request",e)}catch(e){console.log(e)}}},responseScript:{type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},displayName:"Response",default:"// Add custom code to convert the response content to outputs\n//\n//*Response.status The status code of the response\n//*Response.content The content of the response as a javascript\n// object.\n//*Response.request The request object that resulted in the response.\n//\n//*Inputs and *Outputs contain the inputs and outputs of the node.\n",group:"Scripts",set:function(e){try{this._internal.responseFunc=new Function("Inputs","Outputs","Response",e)}catch(e){console.log(e)}}},fetch:{type:"signal",displayName:"Fetch",group:"Actions",valueChangedToTrue:function(){this.scheduleFetch()}},cancel:{type:"signal",displayName:"Cancel",group:"Actions",valueChangedToTrue:function(){this.cancelFetch()}}},outputs:{failure:{type:"signal",displayName:"Failure",group:"Events"},success:{type:"signal",displayName:"Success",group:"Events"},canceled:{type:"signal",displayName:"Canceled",group:"Events"}},prototypeExtensions:{getScriptOutputValue:function(e){return this._internal.outputValues[e]},setScriptInputValue:function(e,t){return this._internal.inputValues[e]=t},registerOutputIfNeeded:function(e){if(!this.hasOutput(e))return e.startsWith("out-")?this.registerOutput(e,{getter:this.getScriptOutputValue.bind(this,e.substring(4))}):void 0},registerInputIfNeeded:function(e){if(!this.hasInput(e))return e.startsWith("in-")?this.registerInput(e,{set:this.setScriptInputValue.bind(this,e.substring(3))}):void 0},scheduleFetch:function(){const e=this._internal;e.hasScheduledFetch||(e.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated(this.doFetch.bind(this)))},doResponse:function(e,t,n){this._internal.responseFunc&&this._internal.responseFunc.apply(this._internal.self,[this._internal.inputValues,this._internal.outputValuesProxy,{status:e,content:t,request:n}]),this._internal.inspectData={status:e,content:t},e>=200&&e<300?this.sendSignalOnOutput("success"):this.sendSignalOnOutput("failure")},doExternalFetch:function(e){let t=e.resource;if(Object.keys(e.parameters).length>0){const n=Object.keys(e.parameters).map(function(t){return t+"="+encodeURIComponent(e.parameters[t])});t+="?"+n.join("&")}if("undefined"!=typeof window){const n=this,i=new window.XMLHttpRequest;this._xhr=i,i.open(e.method,t,!0);for(const t in e.headers)i.setRequestHeader(t,e.headers[t]);i.onreadystatechange=function(){let t=!1;if(4===this.readyState||this.readyState===XMLHttpRequest.DONE){const i=this.status;let o=this.getResponseHeader("content-type");const r=this.response;if(delete this._xhr,o){o=o.toLowerCase();const s=-1!==o.indexOf("json")?JSON.parse(r):r;n.doResponse(i,s,e),t=!0}!1===t&&n.doResponse(i,r,e)}},i.onerror=function(){delete this._xhr,n.sendSignalOnOutput("failure")},i.onabort=function(){delete this._xhr,n.sendSignalOnOutput("canceled")},e.content?(i.setRequestHeader("Content-Type","application/json"),i.send(JSON.stringify(e.content))):i.send()}else{const n=Object.assign({},e.headers,e.content?{"Content-Type":"application/json"}:{});fetch(t,{method:e.method,headers:n,body:e.content?JSON.stringify(e.content):void 0}).then(t=>{const n=t.headers.get("content-type");n?-1!==n.indexOf("/json")?t.json().then(n=>{this.doResponse(t.status,n,e)}):this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"rest-run-waring-",{message:"REST only supports json content type in response."}):t.text().then(n=>{this.doResponse(t.status,n,e)})}).catch(e=>{console.log("REST: Failed to request",t),console.log(e),this.sendSignalOnOutput("failure")})}},doFetch:function(){this._internal.hasScheduledFetch=!1;let e=this._internal.resource;if(e)for(const t in this._internal.inputValues)e=e.replace("{"+t+"}",this._internal.inputValues[t]);const t={resource:e,headers:{},method:void 0!==this._internal.method?this._internal.method:"GET",parameters:{}};this._internal.requestFunc&&this._internal.requestFunc.apply(this._internal.self,[this._internal.inputValues,this._internal.outputValuesProxy,t]),this.doExternalFetch(t)},cancelFetch:function(){"undefined"==typeof _noodl_cloud_runtime_version?this._xhr&&this._xhr.abort():this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"rest-run-waring-",{message:"REST doesn't support cancel in cloud functions."})}}},setup:function(e,n){function i(n){function i(){if(!n.parameters)return;const i=[];function o(e){for(let t=0;t<i.length;t++)if(i[t].name===e&&"input"===i[t].plug)return!0;return!1}if(n.parameters.resource){const e=n.parameters.resource.match(/\{[A-Za-z0-9_]*\}/g);for(const t in e){const n=e[t].replace("{","").replace("}","");o("in-"+n)||i.push({name:"in-"+n,displayName:n,type:"string",plug:"input",group:"Inputs"})}}n.parameters.requestScript&&t(n.parameters.requestScript,["Inputs","Outputs","Request"],"Request script",n,e,i),n.parameters.responseScript&&t(n.parameters.responseScript,["Inputs","Outputs","Response"],"Response script",n,e,i),e.editorConnection.sendDynamicPorts(n.id,i)}i(),n.on("parameterUpdated",function(){i()})}e.editorConnection&&n.on("editorImportComplete",()=>{n.on("nodeAdded.REST2",function(e){i(e)});for(const e of n.getNodesWithType("REST2"))i(e)})}};e.exports=n},1711(e,t){"use strict";function n(e){return e&&e.startsWith("directus_")}function i(e){var t,n;return!(!e||!e.name||!0===e.hidden||(null===(t=e.meta)||void 0===t?void 0:t.interface)&&e.meta.interface.startsWith("presentation-")||!0===(null===(n=e.meta)||void 0===n?void 0:n.hidden))}function o(e,n){const o=[];for(const{field:r,targetCollection:s}of function(e,n){if(!e||!Array.isArray(e.fields))return[];const o=[];for(const r of e.fields){if(!i(r))continue;if(!r.relationTarget)continue;if(r.relationType&&!t.J7.includes(r.relationType))continue;const e=(n||[]).find(e=>e.name===r.relationTarget);e&&o.push({field:r,targetCollection:e})}return o}(e,n)){const e=r.displayName||r.name;for(const t of s.fields||[])i(t)&&(t.relationTarget||o.push({name:`${r.name}.${t.name}`,displayName:`${e} → ${t.displayName||t.name}`,type:t.type,nativeType:t.nativeType,required:!1,enumValues:t.enumValues,relationPath:!0}))}return o}function r(e){return function(e){if(Array.isArray(e))return e;const t=null==e?void 0:e.results;if(Array.isArray(t))return t;const n=null==e?void 0:e.tables;return Array.isArray(n)?n:[]}(e).map(e=>{const n=e.className||e.name;if(!n)return null;const i=function(e){var t;if(e.fields)return e.fields;if(null===(t=e.schema)||void 0===t?void 0:t.properties)return e.schema.properties;if(Array.isArray(e.columns)){const t={};for(const n of e.columns)n&&n.name&&(t[n.name]=n);return t}return{}}(e);return{name:n,displayName:n,primaryKey:"objectId",isSystem:n.startsWith("_"),fields:Object.keys(i).map(e=>function(e,n){const i=null==n?void 0:n.type,o={name:e,displayName:e,type:t.wz[i]||"string",nativeType:i,required:!0===(null==n?void 0:n.required)};return"Pointer"===i?(o.relationTarget=null==n?void 0:n.targetClass,o.relationType="many-to-one"):"Relation"===i&&(o.relationTarget=null==n?void 0:n.targetClass,o.relationType="many-to-many"),"objectId"===e&&(o.primaryKey=!0),"ACL"===e&&(o.hidden=!0),o}(e,i[e]))}}).filter(e=>null!==e)}t.fl=t.wz=t.J7=void 0,t.shouldShowField=i,t.getEnhancedFieldType=function(e){var t,n,i,o;const r={type:"string",options:null,placeholder:null};if(Array.isArray(e.enumValues)&&e.enumValues.length>0)return r.type={name:"enum",enums:e.enumValues.map(e=>({label:e,value:e})),allowEditOnly:!1},r;if("select-dropdown"===(null===(t=e.meta)||void 0===t?void 0:t.interface)||"select-dropdown-m2o"===(null===(n=e.meta)||void 0===n?void 0:n.interface)){const t=null===(o=null===(i=e.meta)||void 0===i?void 0:i.options)||void 0===o?void 0:o.choices;if(t&&Array.isArray(t))return r.type={name:"enum",enums:t.map(e=>({label:e.text||e.value,value:e.value})),allowEditOnly:!1},r}return"integer"===e.type||"bigInteger"===e.type||"float"===e.type||"decimal"===e.type||"number"===e.type?r.type="number":"boolean"===e.type?r.type="boolean":"json"===e.type||"array"===e.type?r.type="object":"dateTime"===e.type||"timestamp"===e.type?(r.type="string",r.placeholder="YYYY-MM-DDTHH:mm:ss.sssZ"):"date"===e.type?(r.type="string",r.placeholder="YYYY-MM-DD"):"time"===e.type?(r.type="string",r.placeholder="HH:mm:ss"):"uuid"===e.type?(r.type="string",r.placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"):r.type="string",r},t.resolveSchemaPortContext=function(e){var i;const{graphModel:o,parameters:s}=e,a=e.backendIdParam||"backendId",l=e.collectionParam||"collection",u=o.getMetaData("backendServices")||{backends:[]},c=(e.extraBackends||[]).concat(u.backends||[]),d=void 0!==e.activeBackendId?e.activeBackendId:u.activeBackendId,p=s[a],h="_active_"!==p&&p?p:d,f=c.find(e=>e.id===h);let g=(null===(i=null==f?void 0:f.schema)||void 0===i?void 0:i.collections)||[],m=g.length>0?"backendServices":"none";const y=null==f?void 0:f.type;if(0===g.length&&(!y||t.fl.includes(y))){const e=o.getMetaData("dbCollections"),t=o.getMetaData("systemCollections"),n=r(e).concat(r(t));n.length>0&&(g=n,m="dbCollections")}const v=s[l],b=n(v),w=s.apiPathMode||(b?"system":"items");return{backends:c,activeBackendId:d,selectedBackend:f,backendType:y,collections:g,collectionName:v,selectedCollection:g.find(e=>e.name===v),apiPathMode:w,source:m}},t.backendPickerPorts=function(e,t={}){if(t.hideWhenSingleBackend&&e.backends.length<=1)return[];const n=[{label:"Active Backend",value:"_active_"}];return e.backends.forEach(e=>{n.push({label:e.name,value:e.id})}),[{name:t.name||"backendId",displayName:t.displayName||"Backend",type:{name:"enum",enums:n,allowEditOnly:!0},default:"_active_",plug:"input",group:t.group||"Backend"}]},t.collectionPorts=function(e,t={}){const i=!1===t.filterByApiPathMode?e.collections:(r=e.collections,(s=e.apiPathMode)&&"items"!==s?r.filter(e=>n(e.name)):r.filter(e=>!n(e.name))),o=[];var r,s;return null!==t.placeholderLabel&&o.push({label:t.placeholderLabel||"(Select collection)",value:""}),t.extraEnums&&o.push(...t.extraEnums),i.forEach(e=>{o.push({label:e.displayName||e.name,value:e.name})}),[{name:t.name||"collection",displayName:t.displayName||"Collection",type:{name:"enum",enums:o,allowEditOnly:!0},plug:"input",group:t.group||"Configuration"}]},t.getFilterFields=function(e){return e.selectedCollection?(e.selectedCollection.fields||[]).concat(o(e.selectedCollection,e.collections)):[]},t.sendSchemaPorts=function(e,t,n,i={}){const o=function(e,t){const n=new Set((null==t?void 0:t.inputs)||[]),i=new Set((null==t?void 0:t.outputs)||[]),o=new Set,r=[];for(const t of e){if(!t||!t.name)continue;if("output"===t.plug?i.has(t.name):n.has(t.name)){console.warn(`[Schema Ports] Dropping dynamic port "${t.name}" (${t.plug}) — the node already declares it statically, and pushing it again lists it twice in getPorts().`);continue}const e=`${t.plug}:${t.name}`;o.has(e)||(o.add(e),r.push(t))}return r}(n,i.staticPorts);return e.sendDynamicPorts(t,o),o},t.staticPortNames=function(e){return{inputs:Object.keys(e.inputs||{}),outputs:Object.keys(e.outputs||{})}},t.J7=["many-to-one","one-to-one"],t.wz={String:"string",Number:"number",Boolean:"boolean",Date:"dateTime",Object:"json",Array:"array",GeoPoint:"json",Polygon:"json",Bytes:"string",File:"json",Pointer:"string",Relation:"relation"},t.fl=["parse","nodegx"]},599(e,t,n){"use strict";const i=n(5162),o=n(5427),r={node:{name:"SetDbModelProperties",docs:"https://docs.noodl.net/nodes/data/cloud-data/set-record-properties",displayNodeName:"Update Record",usePortAsLabel:"collectionName",dynamicports:[{name:"conditionalports/extended",condition:"storeType = cloud OR storeType NOT SET",inputs:["storeProperties"]}],inputs:{store:{displayName:"Do",group:"Actions",description:"Writes the property inputs onto the record named by Id, and on to the backend unless Store to is Local only",valueChangedToTrue:function(){void 0===this._internal.storeType||"cloud"===this._internal.storeType?this.scheduleSave():this.scheduleStore()}},storeProperties:{displayName:"Properties to store",group:"General",description:"Whether to send only the properties wired on this node or every property the record holds; not offered when Store to is Local only",type:{name:"enum",enums:[{label:"Only specified",value:"specified"},{label:"All",value:"all"}]},default:"specified",set:function(e){this._internal.storeProperties=e}},storeType:{displayName:"Store to",group:"General",description:"Whether the change is sent to the backend as well as applied to the in-memory record, or only held locally",type:{name:"enum",enums:[{label:"Cloud and local",value:"cloud"},{label:"Local only",value:"local"}]},default:"cloud",set:function(e){this._internal.storeType=e}},onlyIfUnchanged:{type:"string",displayName:"Only If Unchanged",group:"General",description:"Property names, comma-separated (e.g. version). The update is applied only if these still hold the values the record had when it was read; otherwise Failure fires and nothing is written. Fetch the record again before retrying. Needs a NodeGX backend. Leave empty to always write.",set:function(e){const t="string"==typeof e?e.split(",").map(e=>e.trim()).filter(e=>""!==e):[];this._internal.onlyIfUnchanged=t.length>0?t:void 0}}},outputs:{},methods:{scheduleSave:function(){const e=this,t=this._internal,n=this.beginOutcome();this.checkWarningsBeforeCloudOp([n])&&(this.pendingOutcomes("Save").push(n),this.scheduleOnce("StorageSave",function(){const n=e.takeOutcomes("Save");if(!t.model)return void e.setError("Missing Record Id",n);const o=t.model;let r;if(t.onlyIfUnchanged){r={};for(const i of t.onlyIfUnchanged){const t=o.get(i);if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t)return void e.setError(void 0===t?`Only If Unchanged names "${i}", which this record has not been read with. Fetch the record first.`:`Only If Unchanged names "${i}", which holds an object or list. Name a plain value such as a version number.`,n);r[i]=t}}const s=e._aclRefusal();if(void 0!==s)return void e.setError(s,n);const a=e.cloudStore(n);if(!a)return;const l={};for(const e in t.inputValues)l[e]=o.get(e),o.set(e,t.inputValues[e],{resolve:!0});a.save({collection:t.collectionId,objectId:o.getId(),data:"all"===t.storeProperties?o.data:t.inputValues,acl:e._getACL(),ifMatch:r,success:function(t){for(const e in t)o.set(e,t[e]);(0,i.reportOutcomes)(e,n,"done")},error:function(t,i){for(const e in l)o.set(e,l[e]);i&&"precondition-failed"===i.reason?e.setError("Someone else changed this record after it was read, so this update was not applied. Fetch the record again, then retry.",n):e.setError(t||"Failed to save.",n)}})}))},scheduleStore:function(){if(this.pendingOutcomes("Store").push(this.beginOutcome()),this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated(()=>{this.hasScheduledStore=!1;const t=this.takeOutcomes("Store");if(e.model){for(const t in e.inputValues)e.model.set(t,e.inputValues[t],{resolve:!0});(0,i.reportOutcomes)(this,t,"done")}else this.setError("Missing Record Id",t)})}}}};o.addBaseInfo(r,{done:"Fires once the record has been updated, waiting for the backend to answer unless Store to is Local only"}),o.addModelId(r),o.addInputProperties(r),o.addAccessControl(r),e.exports=r},973(e,t,n){"use strict";const i=n(3761),o={node:{name:"SetModelProperties",docs:"https://docs.noodl.net/nodes/data/object/set-object-properties",displayNodeName:"Set Object Properties",inputs:{store:{displayName:"Do",group:"Actions",description:"Writes the property values currently on the inputs onto the object named by Id",valueChangedToTrue:function(){this.scheduleStore()}}},outputs:(0,n(5162).outcomeOutputs)({done:"Fires once the properties have been written onto the object and anything watching it has been told"})}};i.addBaseInfo(o),i.addModelId(o),i.addFailure(o,"set-object-properties"),i.addInputProperties(o),e.exports=o},8257(e,t,n){"use strict";const i=n(1656),o=n(6835),r=n(5162),s={node:{name:"Set Variable",docs:"https://docs.noodl.net/nodes/data/variable/set-variable",category:"Data",usePortAsLabel:"name",color:"data",initialize:function(){this._internal.variablesModel=(this.nodeScope.modelScope||o).get("--ndl--global-variables")},outputs:{...(0,r.outcomeOutputs)({done:"Fires once the variable has been written and every Variable node reading it has been notified",failure:"Fires when nothing was stored because no variable Name is set"}),error:{type:"string",displayName:"Error",description:"Why the write was refused, in one sentence; empty until something fails",group:"Error",getter:function(){return this._internal.lastError}}},inputs:{name:{type:{name:"string",identifierOf:"VariableName",identifierDisplayName:"Variable names"},displayName:"Name",description:"Which app-wide variable to write; leaving it blank refuses the write rather than storing it somewhere unreadable",group:"General",set:function(e){this._internal.name=e}},setWith:{type:{name:"enum",enums:[{label:"String",value:"string"},{label:"Boolean",value:"boolean"},{label:"Number",value:"number"},{label:"Empty string",value:"emptyString"},{label:"Date",value:"date"},{label:"Object",value:"object"},{label:"Array",value:"array"},{label:"Any",value:"*"}],allowEditOnly:!0},displayName:"Set as",description:'Chooses the type of the Value port; Empty string stores "" and needs no Value, Object and Array accept an id as well as a value, and Boolean is coerced',default:"*",group:"General",set:function(e){this._internal.setWith=e}},do:{displayName:"Do",description:"Writes Value into the named variable, or fires Failure when no Name is set",group:"Actions",valueChangedToTrue:function(){const e=this._internal;e.pendingStoreOutcomes||(e.pendingStoreOutcomes=[]),e.pendingStoreOutcomes.push(this.beginOutcome()),this.scheduleStore()}}},methods:{reportFailure:function(e,t,n){this._internal.lastError=t,this.flagOutputDirty("error"),(0,r.reportOutcomes)(this,n,"failure",{code:e,message:t})},setValue:function(e){this._internal.value=e},scheduleStore:function(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated(function(){this.hasScheduledStore=!1;const t=e.pendingStoreOutcomes||[];if(e.pendingStoreOutcomes=[],void 0===e.name||null===e.name||""===e.name)return void this.reportFailure("set-variable/no-name","No variable name is set — the value was not stored anywhere a Variable node can read",t);let n="emptyString"===e.setWith?"":e.value;"object"===e.setWith&&"string"==typeof n&&(n=(this.nodeScope.modelScope||o).get(n)),"array"===e.setWith&&"string"==typeof n&&(n=i.get(n)),"boolean"===e.setWith&&(n=!!n),e.variablesModel.set(e.name,n,{forceChange:!0}),(0,r.reportOutcomes)(this,t,"done")})},registerInputIfNeeded:function(e){this.hasInput(e)||"value"===e&&this.registerInput(e,{set:this.setValue.bind(this)})}}},setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Set Variable",function(t){function n(){const n=[];"emptyString"===t.parameters.setWith||n.push({type:void 0!==t.parameters.setWith?t.parameters.setWith:"*",plug:"input",group:"General",name:"value",displayName:"Value"}),e.editorConnection.sendDynamicPorts(t.id,n)}n(),t.on("parameterUpdated",function(){n()})})}};e.exports=s},2117(e,t,n){"use strict";const i=n(822),o=n(7011),r=n(5600),s=n(5162),a=n(2114),l=n(1711),u={name:"Sign File URL",docs:"https://docs.noodl.net/nodes/data/cloud-data/sign-file-url",category:"Cloud Services",color:"data",getInspectInfo(){return this._internal.url?[{type:"value",value:{url:this._internal.url,kind:this._internal.kind,expiresAt:this._internal.expiresAt}}]:"[Not signed yet]"},inputs:{file:{group:"General",displayName:"File",type:"cloudfile",description:"Stored file to mint a link for, as an Upload File node or a record property produces it; any other value leaves the previous file in place",set(e){e instanceof i!=0&&(this._internal.cloudFile=e)}},sign:{type:"signal",displayName:"Sign",group:"Actions",description:"Mints a fresh link for File, refused for a caller who could not read the file directly",valueChangedToTrue(){const e=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(()=>{const t=this._internal.cloudFile;if(!t)return void this.setError("No file specified",[e]);const n=this.cloudStore([e]);n&&n.signFileUrl({name:t.getName(),target:t.getTarget(),success:t=>{this._internal.url=t.url,this._internal.kind=t.kind,this._internal.expiresAt=void 0!==t.expiresAt?t.expiresAt:"",this._internal.ttlSeconds=void 0!==t.ttlSeconds?t.ttlSeconds:null,this.flagOutputDirty("url"),this.flagOutputDirty("urlKind"),this.flagOutputDirty("isShareable"),this.flagOutputDirty("expiresAt"),this.flagOutputDirty("ttlSeconds"),this.reportOutcome(e,"done")},error:t=>this.setError(t,[e])})})}}},outputs:{url:{group:"General",displayName:"Signed URL",type:"string",description:"Usable link to the file; empty until Sign has succeeded once. Read URL Kind before sharing it — on some backends this link carries your own credential rather than a signature",get(){return this._internal.url}},urlKind:{group:"General",displayName:"URL Kind",type:"string",description:'How this link is protected: "signed" — it carries its own proof and stops working at Expires At; "token" — it carries your own sign-in credential; "public" — it needs nothing and never expires',get(){return this._internal.kind}},isShareable:{group:"General",displayName:"Safe To Share",type:"boolean",description:"False when the link only works because it carries your own credential — sending it to someone else either fails for them or hands them your session. True for a signed or public link",get(){const e=this._internal.kind;if(void 0!==e)return"token"!==e}},expiresAt:{group:"General",displayName:"Expires At",type:"string",description:'Moment the link stops working, as an ISO 8601 timestamp. Empty for a "public" link, which never expires; for a "token" link on Directus this is the session\'s expiry rather than the link\'s',get(){return this._internal.expiresAt}},ttlSeconds:{group:"General",displayName:"TTL (Seconds)",type:"number",description:"How long Signed URL stays valid from the moment it was minted, in seconds",get(){return this._internal.ttlSeconds}},...(0,s.outcomeOutputs)({done:"Fires once a link has been minted and Signed URL is up to date",failure:"Fires when no link could be minted — no file was set, or the backend refused the caller access — after the reason has been reported on the error channel"}),error:{type:"string",displayName:"Error",group:"Error",description:"Why the last signing attempt failed; empty until one does",get(){return this._internal.error}},errorStatus:{type:"number",displayName:"Error Status Code",group:"Error",description:"HTTP status the backend refused with, or 0 when the request never left the app",get(){return this._internal.errorStatus}}},methods:{registerInputIfNeeded(e){this.hasInput(e)||"backendId"===e&&this.registerInput(e,{set:e=>{this._internal.backendId=e}})},cloudStore(e){const t=o.forBackend(this.nodeScope?this.nodeScope.modelScope:void 0,this._internal.backendId);return t||this.setError(`The backend this node is set to ("${this._internal.backendId}") is not configured in this project.`,e),t},setError(e,t){const n=(0,r.fileFailureOf)(e);this._internal.error=n.message,this._internal.errorStatus=n.status,this.flagOutputDirty("error"),this.flagOutputDirty("errorStatus"),(0,s.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:"sign-file-url/sign-failed",message:String(this._internal.error),detail:{status:this._internal.errorStatus}})}}};function c(e,t,n,i){const o=(0,a.recordSchemaContext)(i,t);(0,l.sendSchemaPorts)(n,e,(0,a.recordBackendPickerPorts)(o),{staticPorts:(0,l.staticPortNames)(u)})}const d={node:u,setup(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){t.on("nodeAdded.Sign File URL",n);for(const e of t.getNodesWithType("Sign File URL"))n(e)}function n(n){c(n.id,n.parameters,e.editorConnection,t),n.on("parameterUpdated",()=>c(n.id,n.parameters,e.editorConnection,t)),t.on("metadataChanged.backendServices",()=>c(n.id,n.parameters,e.editorConnection,t)),t.on("metadataChanged.cloudservices",()=>c(n.id,n.parameters,e.editorConnection,t))}}};e.exports=d},659(e,t,n){"use strict";const i=n(1656),o=n(2566),r="static-array/json-parse-failed",s={node:{name:"Static Data",docs:"https://docs.noodl.net/nodes/data/array/static-array",displayNodeName:"Static Array",category:"Data",color:"data",nodeDoubleClickAction:[{focusPort:"JSON"},{focusPort:"CSV"}],getInspectInfo(){if(this._internal.collection)return[{type:"value",value:this._internal.collection.items}]},dynamicports:[{name:"conditionalports/extended",condition:"type = csv OR type NOT SET",inputs:["csv"]},{name:"conditionalports/extended",condition:"type = json",inputs:["json"]}],inputs:{type:{type:{name:"enum",enums:[{label:"CSV",value:"csv"},{label:"JSON",value:"json"}],allowEditOnly:!0},displayName:"Type",description:"Which of the two authoring formats below is read",group:"General",default:"csv",set:function(e){this._internal.type=e}},csv:{type:{name:"string",codeeditor:"text",allowEditOnly:!0},displayName:"CSV",description:"Rows of comma-separated values whose first row names the properties; every cell is read as a string, so use JSON if numbers must stay numbers — ignored unless Type is CSV",group:"General",set:function(e){this._internal.csv=e,this.scheduleParseData()}},json:{type:{name:"string",codeeditor:"json",allowEditOnly:!0},displayName:"JSON",description:"An array of objects authored inline; unlike CSV it keeps numbers and booleans as they are — ignored unless Type is JSON",group:"General",set:function(e){this._internal.json=e,this.scheduleParseData()}}},outputs:{items:{type:"array",displayName:"Items",description:"The authored rows, as an array of records; unchanged while the JSON cannot be parsed",group:"General",getter:function(){return this._internal.collection}},count:{type:"number",displayName:"Count",description:"How many rows the last successful parse produced",group:"General",get(){return this._internal.collection?this._internal.collection.size():0}},failure:{type:"signal",displayName:"Failure",description:"Fires when the authored JSON could not be parsed, leaving Items as it was",group:"Events"},error:{type:"string",displayName:"Error",description:"Why the JSON could not be parsed, in one sentence; empty until a parse fails",group:"Error",getter:function(){return this._internal.lastError}}},methods:{reportFailure:function(e,t){const n=this._internal;n.lastError=t,this.flagOutputDirty("error"),n.lastReportedError!==t&&(n.lastReportedError=t,this.raiseRuntimeError(e,t),this.sendSignalOnOutput("failure"))},scheduleParseData:function(){const e=this._internal;e.hasScheduledParseData||(e.hasScheduledParseData=!0,this.scheduleAfterInputsHaveUpdated(this.parseData.bind(this)))},parseData:function(){const e=this._internal;if(e.hasScheduledParseData=!1,void 0===e.type||"csv"===e.type){const t=(0,o.rowsToRecords)((0,o.parseCSVRows)(e.csv));e.collection=i.get(),i.keepPlainRowsApart(e.collection,this),e.collection.set(t),this.flagOutputDirty("items"),this.flagOutputDirty("count")}else if("json"===e.type){const t=this.context.editorConnection;if(t){const e=this.nodeScope.componentOwner.name;t.clearWarning(e,this.id,r),t.clearWarning(e,this.id,"json-parse-warning")}let n;try{n=JSON.parse(e.json)}catch(e){return void this.reportFailure(r,"The JSON could not be parsed: "+e.message)}e.lastReportedError=void 0,e.collection=i.get(),i.keepPlainRowsApart(e.collection,this),e.collection.set(n),this.flagOutputDirty("items"),this.flagOutputDirty("count")}}}}};e.exports=s},8523(e,t,n){"use strict";const i=n(7268),o=n(3024),r=n(8479),s=n(5153),a=n(2114),l=n(5838),u=n(1711),c={name:"SubscribeToChanges",docs:"https://docs.noodl.net/nodes/data/cloud-data/subscribe-to-changes",displayNodeName:"Subscribe To Changes",category:"Cloud Services",color:"data",usePortAsLabel:"collectionName",searchTags:["realtime","subscribe","subscription","live","changes","push","sync","sse","websocket","socket","backend"],ssr:{compat:"client-only",note:"A realtime subscription cannot be opened during a server render and would hold one connection per request; the node subscribes in the browser after hydration."},inputs:{enabled:{type:"boolean",displayName:"Enabled",group:"General",default:!0,description:"Hold the subscription open. Turn it off to stop receiving changes without deleting the node — the connection is closed and Subscribed goes false. On by default: this node has nothing else to do",set:function(e){this.setEnabled(e)}}},outputs:{subscribed:{type:"boolean",displayName:"Subscribed",group:"Realtime",description:"True while the backend has confirmed the subscription and is delivering changes",getter:function(){return"subscribed"===this._internal.realtimeStatus}},realtimeStatus:{type:"string",displayName:"Realtime Status",group:"Realtime",description:'connecting, subscribed, interrupted or stopped. Four states rather than a boolean, because "connecting for the first time" and "dropped and retrying" want different things on screen',getter:function(){return this._internal.realtimeStatus||""}},realtimeError:{type:"object",displayName:"Realtime Error",group:"Realtime",description:"The last realtime failure, with a code and whether retrying can help; null until one happens",getter:function(){return this._internal.realtimeError||null}},realtimeFailure:{type:"signal",displayName:"Realtime Failure",group:"Realtime",description:"Fires when a subscription cannot connect, is rejected, or has been given up on"},created:{type:"signal",displayName:"Record Created",group:"Realtime",description:"Another client created a record in this collection"},updated:{type:"signal",displayName:"Record Updated",group:"Realtime",description:"Another client updated a record in this collection"},deleted:{type:"signal",displayName:"Record Deleted",group:"Realtime",description:"Another client deleted a record from this collection"},changed:{type:"signal",displayName:"Records Changed",group:"Realtime",description:"Any of the three, and also the backend saying the view may be stale after a reconnect — the one to react to if you do not care which happened"},changedEvent:{type:"string",displayName:"Change Type",group:"Realtime",description:"create, update, delete, init or resync",getter:function(){return this._internal.realtimeEvent||""}},changedRecord:{type:"object",displayName:"Changed Record",group:"Realtime",description:"The record the change was about. ⚠️ Null on a delete against Directus, which sends only the key — use Changed Record Id, which every backend fills",getter:function(){return this._internal.changedRecord||null}},changedRecords:{type:"array",displayName:"Changed Records",group:"Realtime",description:"Every record in the change frame; some backends batch",getter:function(){return this._internal.changedRecords||[]}},changedRecordId:{type:"string",displayName:"Changed Record Id",group:"Realtime",description:"The id of the changed record, always a string — even where the backend's primary key is an integer",getter:function(){return this._internal.changedRecordId||""}}},initialize:function(){this._internal.queryParameters={}},prototypeExtensions:{isEnabled:function(){return!1!==this._internal.enabled},setEnabled:function(e){const t=this._internal.enabled;this._internal.enabled=!!e,(0,l.valueDidChange)(t,this._internal.enabled)&&this.scheduleReconfigure()},setCollectionName:function(e){const t=this._internal.name;this._internal.name=e,(0,l.valueDidChange)(t,e)&&this.scheduleReconfigure()},setVisualFilter:function(e){const t=this._internal.visualFilter;this._internal.visualFilter=e,(0,l.valueDidChange)(t,e)&&this.scheduleReconfigure()},setQueryParameter:function(e,t){const n=this._internal.queryParameters[e];this._internal.queryParameters[e]=t,(0,l.valueDidChange)(n,t)&&this.scheduleReconfigure()},subscriptionFilter:function(){if(void 0!==this._internal.visualFilter)try{return o.convertVisualFilter(this._internal.visualFilter,{queryParameters:this._internal.queryParameters,collectionName:this._internal.name,valuePortPrefix:"qp-"})}catch(e){return void(this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"subscribe-filter",{message:e.message}))}},scheduleReconfigure:function(){this._internal.reconfigureScheduled||(this._internal.reconfigureScheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._internal.reconfigureScheduled=!1,this.reconfigure()}))},reconfigure:function(){if(this.teardown(),!this.isEnabled())return;const e=this._internal.name;if(!e)return;const t=(0,r.resolveBackendFromRuntime)(this._internal.backendId);if(!t)return void this.handleRealtimeError({message:`The backend this node is set to ("${this._internal.backendId||"_active_"}") is not configured in this project.`,code:"CAPABILITY_UNAVAILABLE",kind:"fatal"});const n=(0,s.realtimeSupportFor)(t.handle.type);"unsupported"!==n.state?(this._internal.subscription=(0,s.createRealtimeSubscription)(t.handle,{collection:e,where:this.subscriptionFilter(),primaryKey:this.realtimePrimaryKey(t.collections,t.isParseWire),onEvent:this.handleRealtimeChange.bind(this),onStatus:this.handleRealtimeStatus.bind(this),onError:this.handleRealtimeError.bind(this)}),this.handleRealtimeStatus(this._internal.subscription.status)):this.handleRealtimeError({message:n.reason||"This backend does not support realtime.",code:"CAPABILITY_UNAVAILABLE",kind:"fatal"})},teardown:function(){this._internal.subscription&&(this._internal.subscription.dispose(),this._internal.subscription=null),this._internal.realtimeStatus&&(this._internal.realtimeStatus=void 0,this.flagOutputDirty("subscribed"),this.flagOutputDirty("realtimeStatus"))},realtimePrimaryKey:function(e,t){const n=(e||[]).find(e=>e.name===this._internal.name);return(null==n?void 0:n.primaryKey)||(t?"objectId":"id")},handleRealtimeChange:function(e){if(this._internal.realtimeEvent=e.type,this._internal.changedRecord=e.recordsComplete&&e.records.length>0?e.records[0]:null,this._internal.changedRecords=e.recordsComplete?e.records:[],this._internal.changedRecordId=e.ids.length>0?e.ids[0]:"",this.flagOutputDirty("changedEvent"),this.flagOutputDirty("changedRecord"),this.flagOutputDirty("changedRecords"),this.flagOutputDirty("changedRecordId"),"init"===e.type)return;const t={create:"created",update:"updated",delete:"deleted"};t[e.type]&&this.sendSignalOnOutput(t[e.type]),this.sendSignalOnOutput("changed")},handleRealtimeStatus:function(e){this._internal.realtimeStatus=e,"subscribed"===e&&this._internal.realtimeError&&(this._internal.realtimeError=null,this.flagOutputDirty("realtimeError")),this.flagOutputDirty("subscribed"),this.flagOutputDirty("realtimeStatus")},handleRealtimeError:function(e){this._internal.realtimeError=e,this.flagOutputDirty("realtimeError"),this.sendSignalOnOutput("realtimeFailure"),this.raiseRuntimeError("subscribe-to-changes/realtime-failed",e.message||"The realtime subscription failed.",e)},_onNodeDeleted:function(){i.prototype._onNodeDeleted.call(this),this.teardown()},registerInputIfNeeded:function(e){if(this.hasInput(e))return;if(e.startsWith("qp-"))return void this.registerInput(e,{set:this.setQueryParameter.bind(this,e.substring(3))});const t={collectionName:this.setCollectionName.bind(this),visualFilter:this.setVisualFilter.bind(this),backendId:e=>{const t=this._internal.backendId;this._internal.backendId=e,(0,l.valueDidChange)(t,e)&&this.scheduleReconfigure()}};this.registerInput(e,{set:t[e]||function(){}})}}};function d(e,t,n,i){const r=[],s=(0,a.recordSchemaContext)(i,t);if(r.push(...(0,a.recordBackendPickerPorts)(s)),r.push(...(0,a.recordClassPorts)(s)),void 0!==t.collectionName){const e=(0,a.recordFilterSchema)(s);e&&r.push({name:"visualFilter",plug:"input",type:{name:"query-filter",schema:e,allowEditOnly:!0,backend:(0,a.recordFilterBackendType)(s,o.backendType()),valuePortPrefix:"qp-"},displayName:"Filter",group:"Filter",description:"Evaluated by the server on the built-in NodeGX backend only. PocketBase, Directus and Parse take no filter on a subscription, so on those backends every change in the class is delivered and this filter is ignored. It is never applied on the client: events you never received are not events a filter excluded, and pretending otherwise would make two backends disagree about what one setting means."}),void 0!==t.visualFilter&&o.collectFilterParameters(t.visualFilter,"qp-").forEach(e=>{r.push({name:"qp-"+e,plug:"input",type:"*",displayName:e,group:"Query Parameters"})})}(0,u.sendSchemaPorts)(n,e,r,{staticPorts:(0,u.staticPortNames)(c)})}const p={node:c,setup:function(e,t){function n(n){d(n.id,n.parameters,e.editorConnection,t),n.on("parameterUpdated",function(i){"collectionName"!==i.name&&"visualFilter"!==i.name&&"backendId"!==i.name||d(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.dbCollections",function(){d(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.systemCollections",function(){d(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.cloudservices",function(){d(n.id,n.parameters,e.editorConnection,t)}),t.on("metadataChanged.backendServices",function(){d(n.id,n.parameters,e.editorConnection,t)})}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",()=>{t.on("nodeAdded.SubscribeToChanges",function(e){n(e)});for(const e of t.getNodesWithType("SubscribeToChanges"))n(e)})}};e.exports=p},2430(e,t,n){"use strict";const i=n(6835),o=n(2566);function r(e){return null==e?{}:i.instanceOf(e)?Object.assign({},e.data):Object.assign({},e)}const s={node:{name:"net.noodl.ToCSV",displayNodeName:"To CSV",docs:"https://docs.noodl.net/nodes/data/array/to-csv",category:"Data",color:"data",initialize:function(){this._internal.delimiter=",",this._internal.includeHeader=!0,this._internal.text=""},getInspectInfo(){return this._internal.text},inputs:{items:{type:"array",displayName:"Items",group:"General",description:"The array to write. Records become rows; an array of arrays is written cell for cell",set:function(e){this._internal.itemsSupplied=null!=e,this._internal.items=e,this._schedule()}},columns:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Columns",group:"General",description:"Which properties to write, in order, comma separated. Leave it empty and every property found on the records is written, in the order they were first seen",set:function(e){this._internal.columns=e,this._schedule()}},delimiter:{type:"string",displayName:"Delimiter",group:"General",default:",",description:"The character between cells. Any cell containing it is quoted automatically",set:function(e){this._internal.delimiter=e||",",this._schedule()}},includeHeader:{type:"boolean",displayName:"Include Header",group:"General",default:!0,description:"Write the column names as the first row",set:function(e){this._internal.includeHeader=!!e,this._schedule()}}},outputs:{text:{type:"string",displayName:"CSV",group:"Values",description:"The array as CSV text. Cells containing the delimiter, a quote or a newline are quoted and their quotes doubled, so this round-trips back through Parse CSV unchanged",getter:function(){return this._internal.text}},count:{type:"number",displayName:"Count",group:"Values",description:"How many data rows were written, not counting the header row",getter:function(){return this._internal.items?this._internal.items.length:0}},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires once CSV holds the freshly written text"}},methods:{_schedule:function(){this._internal.scheduled||(this._internal.scheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._internal.scheduled=!1,this._render()}))},_render:function(){if(!this._internal.itemsSupplied)return;const e=this._internal.items,t=e?e.length:0,n=[];for(let i=0;i<t;i++)n.push(e[i]);const i=(this._internal.columns||"").split(",").map(e=>e.trim()).filter(e=>e.length>0);if(n.length>0&&n.every(e=>Array.isArray(e)))this._internal.text=(0,o.rowsToCSV)(n,{delimiter:this._internal.delimiter});else{const e=n.map(r);this._internal.text=(0,o.toCSV)(e,{columns:i.length?i:(0,o.unionOfKeys)(e),delimiter:this._internal.delimiter,includeHeader:this._internal.includeHeader})}this.flagOutputDirty("text"),this.flagOutputDirty("count"),this.sendSignalOnOutput("changed")}}}};e.exports=s},4567(e,t,n){"use strict";const i=n(7268),o=n(6835),r=n(5162),s={node:{name:"Variable2",displayNodeName:"Variable",docs:"https://docs.noodl.net/nodes/data/variable/variable-node",category:"Data",usePortAsLabel:"name",color:"data",runOnValueChange:{controlSignal:"fetch",inputs:["name"],sources:[{name:"variable",displayName:"Variable changes"}]},initialize:function(){const e=this._internal;this._internal.onModelChangedCallback=t=>{this.shouldRunOnValueChange("variable")&&t.name===e.name&&(this.sendSignalOnOutput("changed"),this.flagOutputDirty("value"))},e.variablesModel=(this.nodeScope.modelScope||o).get("--ndl--global-variables"),e.variablesModel.on("change",this._internal.onModelChangedCallback)},getInspectInfo(){return this._internal.name?[{type:"value",value:this._internal.variablesModel.get(this._internal.name)}]:"[No value set]"},outputs:{name:{type:"string",displayName:"Name",description:"The variable name this node is currently bound to",group:"General",getter:function(){return this._internal.name}},changed:{type:"signal",displayName:"Changed",description:"Fires when the named variable is written from anywhere in the app",group:"Events"},fetched:{type:"signal",displayName:"Fetched",description:"Fires once Fetch has rebound this node and Value is up to date",group:"Events"},...(0,r.outcomeOutputs)({done:"Fires when a Fetch finished and Value is up to date"}),failure:{type:"signal",displayName:"Failure",description:"Fires when a value arrived but could not be stored because no Name is set. This belongs to the Value input rather than to Fetch, so it reports no outcome and does not fire Completed",group:"Events"},error:{type:"string",displayName:"Error",description:"Why the last write was refused, in one sentence; empty until something fails",group:"Error",getter:function(){return this._internal.lastError}},value:{type:"*",displayName:"Value",description:"Current contents of the named variable, or empty until something writes it",group:"General",getter:function(){var e,t;const n=this._internal;if(n.name)return n.variablesModel.get(n.name);const i=null===(t=null===(e=this.model)||void 0===e?void 0:e.parameters)||void 0===t?void 0:t.name;if(!i||"string"!=typeof i)return;const o=n.variablesModel.get(i);return n.seeded={name:i,value:o},o}}},inputs:{name:{type:{name:"string",identifierOf:"VariableName",identifierDisplayName:"Variable names"},displayName:"Name",description:"Which app-wide variable this node reads and writes",group:"General",set:function(e){this.shouldRunOnValueChange("name")?this.setVariableName(e):(this._internal.name=e,this.flagOutputDirty("name"))}},fetch:{displayName:"Fetch",description:"Re-reads the variable named by Name and refreshes Value. This is additional to Name rebinding on change and to changes being announced; untick either under Run On Value Change to stop it",group:"Actions",valueChangedToTrue:function(){const e=this.beginOutcome();this.setVariableName(this._internal.name),this.reportOutcome(e,"done")}},value:{type:"*",displayName:"Value",description:"Stores this value in the named variable as soon as it arrives; refused, loudly, when Name is empty",group:"General",set:function(e){this._internal.value=e,this.scheduleStore()}}},prototypeExtensions:{reportFailure:function(e,t){this._internal.lastError=t,this.raiseRuntimeError(e,t),this.flagOutputDirty("error"),this.sendSignalOnOutput("failure")},scheduleStore:function(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated(function(){this.hasScheduledStore=!1,void 0!==e.name&&null!==e.name&&""!==e.name?e.variablesModel.set(e.name,e.value):this.reportFailure("variable/no-name","No variable name is set — the value was not stored anywhere a Variable node can read")})},setVariableName:function(e){const t=this._internal.seeded;this._internal.seeded=void 0,this._internal.name=e,this.flagOutputDirty("name"),t&&t.name===e&&this._internal.variablesModel.get(e)===t.value||this.flagOutputDirty("value"),this.sendSignalOnOutput("fetched")},_onNodeDeleted:function(){i.prototype._onNodeDeleted.call(this),this._internal.variablesModel.off("change",this._internal.onModelChangedCallback)}}}};e.exports=s},2694(e,t,n){"use strict";const i=n(2152),o={node:{name:"net.noodl.DateAdd",displayNodeName:"Date Add",docs:"https://docs.noodl.net/nodes/utilities/date-add",category:"Utilities",color:"data",initialize:function(){this._internal.amount=0,this._internal.unit="days"},inputs:{input:{type:{name:"date"},displayName:"Date",group:"General",description:"The instant to shift. A string or a millisecond timestamp arriving here is read as a date",set:function(e){this._internal.inputSupplied=null!=e&&""!==e,this._internal.input=(0,i.toDate)(e),this._recompute()}},amount:{type:"number",displayName:"Amount",group:"General",default:0,description:"How much to add. Negative subtracts. Months and years use whole steps",set:function(e){this._internal.amount=Number(e),this._recompute()}},unit:{type:{name:"enum",enums:i.UNIT_ENUMS},displayName:"Unit",group:"General",default:"days",description:"What Amount counts. Months and years are calendar steps and CLAMP: 31 January plus one month is 28 (or 29) February, never 2 March",set:function(e){this._internal.unit=(0,i.unitOrDays)(e),this.setDiagnostic("date-add/unknown-unit",(0,i.unknownUnitMessage)(e)),this._recompute()}}},outputs:{result:{type:"date",displayName:"Result",group:"Values",description:"Date shifted by Amount of Unit, or unset when Date could not be read",getter:function(){return this._internal.result}},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires after Result has been recomputed, whichever input caused it"},failure:{type:"signal",displayName:"Invalid Date",group:"Events",description:"Fires when Date could not be read, leaving Result unset"}},methods:{_recompute:function(){if(!this._internal.inputSupplied)return;const e=this._internal.input;if(void 0===e)return this._internal.result=void 0,this.flagOutputDirty("result"),void this.sendSignalOnOutput("failure");const t=Number.isFinite(this._internal.amount)?this._internal.amount:0;this._internal.result=(0,i.addToDate)(e,t,this._internal.unit),this.flagOutputDirty("result"),this.sendSignalOnOutput("changed")}}}};e.exports=o},6042(e,t,n){"use strict";const i=n(2152),o={node:{name:"net.noodl.DateCompare",displayNodeName:"Date Compare",docs:"https://docs.noodl.net/nodes/utilities/date-compare",category:"Utilities",color:"data",initialize:function(){this._internal.granularity="millisecond"},inputs:{a:{type:{name:"date"},displayName:"Date",group:"General",description:"The instant being asked about",set:function(e){this._internal.aSupplied=null!=e&&""!==e,this._internal.a=(0,i.toDate)(e),this._recompute()}},b:{type:{name:"date"},displayName:"Compare To",group:"General",description:"The instant it is compared against",set:function(e){this._internal.bSupplied=null!=e&&""!==e,this._internal.b=(0,i.toDate)(e),this._recompute()}},granularity:{type:{name:"enum",enums:[{label:"Millisecond (exact)",value:"millisecond"},{label:"Second",value:"second"},{label:"Minute",value:"minute"},{label:"Hour",value:"hour"},{label:"Day",value:"day"},{label:"Month",value:"month"},{label:"Year",value:"year"}]},displayName:"Granularity",group:"General",default:"millisecond",description:'How coarsely to compare. Day answers "is this the same day", which is almost always the question — two instants are hardly ever the same millisecond',set:function(e){this._internal.granularity=e,this._recompute()}}},outputs:{before:{type:"boolean",displayName:"Is Before",group:"Values",description:"True when Date is earlier than Compare To, at this Granularity",getter:function(){return this._internal.before}},after:{type:"boolean",displayName:"Is After",group:"Values",description:"True when Date is later than Compare To, at this Granularity",getter:function(){return this._internal.after}},same:{type:"boolean",displayName:"Is Same",group:"Values",description:"True when the two land in the same Granularity bucket — the same day, month or year",getter:function(){return this._internal.same}},isBefore:{type:"signal",displayName:"On Before",group:"Events",description:"Fires after a comparison that came out Before"},isAfter:{type:"signal",displayName:"On After",group:"Events",description:"Fires after a comparison that came out After"},isSame:{type:"signal",displayName:"On Same",group:"Events",description:"Fires after a comparison that came out Same"},failure:{type:"signal",displayName:"Invalid Date",group:"Events",description:"Fires when a date arrived that could not be read, leaving all three answers unset"}},methods:{_recompute:function(){if(!this._internal.aSupplied||!this._internal.bSupplied)return;const e=this._internal.a,t=this._internal.b;if(void 0===e||void 0===t)return this._internal.before=void 0,this._internal.after=void 0,this._internal.same=void 0,this.flagOutputDirty("before"),this.flagOutputDirty("after"),this.flagOutputDirty("same"),void this.sendSignalOnOutput("failure");const n=this._internal.granularity||"millisecond",o=(0,i.truncateTo)(e,n),r=(0,i.truncateTo)(t,n);this._internal.before=o<r,this._internal.after=o>r,this._internal.same=o===r,this.flagOutputDirty("before"),this.flagOutputDirty("after"),this.flagOutputDirty("same"),this._internal.same?this.sendSignalOnOutput("isSame"):this._internal.before?this.sendSignalOnOutput("isBefore"):this.sendSignalOnOutput("isAfter")}}}};e.exports=o},6150(e,t,n){"use strict";const i=n(2152),o={node:{name:"net.noodl.DateDifference",displayNodeName:"Date Difference",docs:"https://docs.noodl.net/nodes/utilities/date-difference",category:"Utilities",color:"data",initialize:function(){this._internal.unit="days",this._internal.absolute=!1},inputs:{from:{type:{name:"date"},displayName:"From",group:"General",description:"The earlier instant, in the reading that makes Difference positive",set:function(e){this._internal.fromSupplied=null!=e&&""!==e,this._internal.from=(0,i.toDate)(e),this._recompute()}},to:{type:{name:"date"},displayName:"To",group:"General",description:"The later instant. Difference is negative when this is actually earlier than From",set:function(e){this._internal.toSupplied=null!=e&&""!==e,this._internal.to=(0,i.toDate)(e),this._recompute()}},unit:{type:{name:"enum",enums:i.UNIT_ENUMS},displayName:"Unit",group:"General",default:"days",description:"What Difference counts. Fixed units are exact and fractional (36 hours is 1.5 days); months and years are whole calendar steps",set:function(e){this._internal.unit=(0,i.unitOrDays)(e),this.setDiagnostic("date-difference/unknown-unit",(0,i.unknownUnitMessage)(e)),this._recompute()}},absolute:{type:"boolean",displayName:"Absolute",group:"General",default:!1,description:"Drop the sign, so the output is a distance rather than a direction",set:function(e){this._internal.absolute=!!e,this._recompute()}}},outputs:{difference:{type:"number",displayName:"Difference",group:"Values",description:"To minus From, counted in Unit. Unset while either date is missing or unreadable",getter:function(){return this._internal.difference}},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires after Difference has been recomputed"},failure:{type:"signal",displayName:"Invalid Date",group:"Events",description:"Fires when a date arrived that could not be read, leaving Difference unset"}},methods:{_recompute:function(){if(!this._internal.fromSupplied||!this._internal.toSupplied)return;const e=this._internal.from,t=this._internal.to;if(void 0===e||void 0===t)return this._internal.difference=void 0,this.flagOutputDirty("difference"),void this.sendSignalOnOutput("failure");const n=(0,i.differenceBetween)(e,t,this._internal.unit);this._internal.difference=this._internal.absolute?Math.abs(n):n,this.flagOutputDirty("difference"),this.sendSignalOnOutput("changed")}}}};e.exports=o},2152(e,t){"use strict";t.UNIT_ENUMS=void 0,t.unitOrDays=function(e){return t.UNIT_ENUMS.some(t=>t.value===e)?e:"days"},t.unknownUnitMessage=function(e){return null==e||""===e||t.UNIT_ENUMS.some(t=>t.value===e)?null:`Unit ${"string"==typeof e?`"${e.length>40?e.slice(0,40)+"…":e}"`:String(e)} is not one of ${t.UNIT_ENUMS.map(e=>e.value).join(", ")}, so it is counted as days.`},t.toDate=function(e){if(null!=e&&""!==e){if(e instanceof Date)return Number.isNaN(e.getTime())?void 0:e;if("number"==typeof e){if(!Number.isFinite(e))return;const t=new Date(e);return Number.isNaN(t.getTime())?void 0:t}if("string"==typeof e){const t=new Date(e);return Number.isNaN(t.getTime())?void 0:t}}},t.addToDate=i,t.differenceBetween=function(e,t,o){const r=n[o];if(void 0!==r)return(t.getTime()-e.getTime())/r;const s=t.getTime()>=e.getTime()?1:-1;let a=12*(t.getFullYear()-e.getFullYear())+(t.getMonth()-e.getMonth())-0;return s>0&&i(e,a,"months").getTime()>t.getTime()&&(a-=1),s<0&&i(e,a,"months").getTime()<t.getTime()&&(a+=1),"months"===o?a:Math.trunc(a/12)},t.truncateTo=function(e,t){const n=new Date(e.getTime());switch(t){case"year":n.setMonth(0);case"month":n.setDate(1);case"day":n.setHours(0);case"hour":n.setMinutes(0);case"minute":n.setSeconds(0);case"second":n.setMilliseconds(0)}return n.getTime()},t.isoWeek=function(e){const t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()+3-(t.getDay()+6)%7);const n=new Date(t.getFullYear(),0,4);return n.setDate(n.getDate()+3-(n.getDay()+6)%7),1+Math.round((t.getTime()-n.getTime())/6048e5)};const n={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5};function i(e,t,i){const o=n[i];if(void 0!==o)return new Date(e.getTime()+t*o);const r=Math.trunc(t),s=new Date(e.getTime()),a=s.getDate();if(s.setDate(1),"months"===i)s.setMonth(s.getMonth()+r);else{if("years"!==i)throw new Error(`Unknown unit "${i}".`);s.setFullYear(s.getFullYear()+r)}const l=new Date(s.getFullYear(),s.getMonth()+1,0).getDate();return s.setDate(Math.min(a,l)),s}t.UNIT_ENUMS=[{label:"Milliseconds",value:"milliseconds"},{label:"Seconds",value:"seconds"},{label:"Minutes",value:"minutes"},{label:"Hours",value:"hours"},{label:"Days",value:"days"},{label:"Weeks",value:"weeks"},{label:"Months",value:"months"},{label:"Years",value:"years"}]},943(e,t,n){"use strict";const i=n(2152),o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=["year","month","date","hours","minutes","seconds","milliseconds","dayOfWeek","dayName","isoWeek","timestamp"],s={node:{name:"net.noodl.DateParts",displayNodeName:"Date Parts",docs:"https://docs.noodl.net/nodes/utilities/date-parts",category:"Utilities",color:"data",inputs:{input:{type:{name:"date"},displayName:"Date",group:"General",description:"The instant to take apart. A string or a millisecond timestamp here is read as a date",set:function(e){this._internal.inputSupplied=null!=e&&""!==e,this._internal.input=(0,i.toDate)(e),this._recompute()}}},outputs:{year:{type:"number",displayName:"Year",group:"Values",description:"Four-digit year, in the host s local zone",getter:function(){return this._internal.input&&this._internal.input.getFullYear()}},month:{type:"number",displayName:"Month",group:"Values",description:"Month as 1-12 — January is 1, not 0",getter:function(){return this._internal.input&&this._internal.input.getMonth()+1}},date:{type:"number",displayName:"Day of Month",group:"Values",description:"Day of the month, 1-31",getter:function(){return this._internal.input&&this._internal.input.getDate()}},hours:{type:"number",displayName:"Hours",group:"Values",description:"Hour of the day, 0-23",getter:function(){return this._internal.input&&this._internal.input.getHours()}},minutes:{type:"number",displayName:"Minutes",group:"Values",description:"Minutes past the hour, 0-59",getter:function(){return this._internal.input&&this._internal.input.getMinutes()}},seconds:{type:"number",displayName:"Seconds",group:"Values",description:"Seconds past the minute, 0-59",getter:function(){return this._internal.input&&this._internal.input.getSeconds()}},milliseconds:{type:"number",displayName:"Milliseconds",group:"Values",description:"Milliseconds past the second, 0-999",getter:function(){return this._internal.input&&this._internal.input.getMilliseconds()}},dayOfWeek:{type:"number",displayName:"Day of Week",group:"Values",description:"Day of the week as 0-6, Sunday first — JavaScript s own numbering",getter:function(){return this._internal.input&&this._internal.input.getDay()}},dayName:{type:"string",displayName:"Day Name",group:"Values",description:"The English name of the weekday. For a localised name, format through Date To String",getter:function(){return this._internal.input&&o[this._internal.input.getDay()]}},isoWeek:{type:"number",displayName:"ISO Week",group:"Values",description:"ISO-8601 week number, 1-53: weeks start on Monday and week 1 holds the first Thursday",getter:function(){return this._internal.input&&(0,i.isoWeek)(this._internal.input)}},timestamp:{type:"number",displayName:"Timestamp",group:"Values",description:"The instant as milliseconds since 1 January 1970 UTC",getter:function(){return this._internal.input&&this._internal.input.getTime()}},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires after a new Date has been taken apart and every part output is up to date"},failure:{type:"signal",displayName:"Invalid Date",group:"Events",description:"Fires when a date arrived that could not be read, leaving every part unset"}},methods:{_recompute:function(){if(this._internal.inputSupplied){for(const e of r)this.flagOutputDirty(e);void 0!==this._internal.input?this.sendSignalOnOutput("changed"):this.sendSignalOnOutput("failure")}}}}};e.exports=s},5673(e,t,n){"use strict";const i=n(5162),o={node:{name:"net.noodl.Now",displayNodeName:"Now",docs:"https://docs.noodl.net/nodes/utilities/now",category:"Utilities",color:"data",initialize:function(){this._internal.now=new Date(Date.now())},getInspectInfo(){return this._internal.now.toISOString()},inputs:{read:{type:"signal",displayName:"Read",group:"Actions",description:"Re-reads the clock. The outputs hold the instant of the last Read, not a live value",valueChangedToTrue:function(){this._read(this.beginOutcome())}}},outputs:{date:{type:"date",displayName:"Date",group:"Values",description:"The instant of the last Read, for the other date nodes",getter:function(){return this._internal.now}},timestamp:{type:"number",displayName:"Timestamp",group:"Values",description:"The same instant as milliseconds since 1 January 1970 UTC",getter:function(){return this._internal.now.getTime()}},iso:{type:"string",displayName:"ISO String",group:"Values",description:"The same instant as an ISO-8601 string in UTC — the shape to put in a JSON body",getter:function(){return this._internal.now.toISOString()}},...(0,i.outcomeOutputs)({done:"Fires once the outputs hold the freshly-read instant"})},methods:{_read:function(e){this._internal.now=new Date(Date.now()),this.flagOutputDirty("date"),this.flagOutputDirty("timestamp"),this.flagOutputDirty("iso"),e&&this.reportOutcome(e,"done")}}}};e.exports=o},5434(e,t,n){"use strict";const i=n(2152),o={node:{name:"Date To String",docs:"https://docs.noodl.net/nodes/utilities/date-to-string",category:"Utilities",initialize:function(){this._internal.formatString="{year}-{month}-{date}",this._internal.timeZone="",this._internal.locale=""},inputs:{formatString:{group:"Values",displayName:"Format",type:"string",default:"{year}-{month}-{date}",description:"Template in which these tokens are replaced and everything else is copied through. Date: {date} 09, {d} 9, {ordinal} 9th. Month: {month} 09, {m} 9, {monthShort} Sep, {monthName} September. Year: {year} 2026, {yearShort} 26. Weekday: {dayName} Thursday, {dayShort} Thu. Time: {hours} 15, {h} 15, {hours12} 03, {h12} 3, {minutes} 05, {min} 5, {seconds} 07, {s} 7, {ampm} pm, {AMPM} PM. Names follow Locale; {ordinal} is English",set:function(e){this._internal.formatString!==e&&(this._internal.formatString=e,void 0!==this._internal.currentInput&&(this._format(),this.flagOutputDirty("currentValue")))}},timeZone:{group:"Values",displayName:"Timezone",type:"string",default:"",description:"IANA zone name to render in, such as Europe/London or America/New_York. Leave empty for the host machine's zone — which on a server is whatever the container says, and is the usual reason a date is an hour out in production but right on your laptop",set:function(e){const t=e||"";this._internal.timeZone!==t&&(this._internal.timeZone=t,void 0!==this._internal.currentInput&&(this._format(),this.flagOutputDirty("currentValue")))}},locale:{group:"Values",displayName:"Locale",type:"string",default:"",description:"BCP 47 language tag for the month and day names — fr-FR, de-DE, ja-JP. Leave empty for English (en-US), which is what every project rendered before this port existed. It does not change the digits, the padding or {ordinal}, only the words",set:function(e){const t=e||"";this._internal.locale!==t&&(this._internal.locale=t,void 0!==this._internal.currentInput&&(this._format(),this.flagOutputDirty("currentValue")))}},input:{group:"Values",type:{name:"date"},displayName:"Date",description:"The instant to render; a string arriving here is parsed as a date first",set:function(e){const t="string"==typeof e?new Date(e):e;this._internal.currentInput!==t&&(this._internal.currentInput=t,this._format())}}},outputs:{currentValue:{type:"string",displayName:"Date String",group:"Values",description:"Date rendered through Format, or blank when the date could not be read",getter:function(){return this._internal.dateString}},inputChanged:{type:"signal",displayName:"Date Changed",group:"Events",description:"Fires whenever a new Date arrives or Format changes, after Date String has been updated"},onError:{type:"signal",displayName:"Invalid Date",group:"Events",description:"Fires when the Date could not be read, leaving Date String blank"}},methods:{_format(){try{const e=(0,i.toDate)(this._internal.currentInput);if(!e)throw new RangeError("Invalid date");const t=this._internal.formatString,n=this._internal.timeZone,o=this._internal.locale||"en-US",r=n?function(e,t){const n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),i=e=>{const t=n.find(t=>t.type===e);return t?parseInt(t.value,10):NaN};return{date:i("day"),month:i("month"),year:i("year"),hours:i("hour")%24,minutes:i("minute"),seconds:i("second")}}(e,n):{date:e.getDate(),month:e.getMonth()+1,year:e.getFullYear(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()};if(Number.isNaN(r.year))throw new RangeError("Invalid date");const s=("0"+r.date).slice(-2),a=("0"+r.month).slice(-2),l=n?{month:"short",timeZone:n}:{month:"short"},u=new Intl.DateTimeFormat(o,l).format(e),c=r.year,d=c.toString().substring(2),p=("0"+r.hours).slice(-2),h=("0"+r.minutes).slice(-2),f=("0"+r.seconds).slice(-2);let g=t.replace(/\{date\}/g,s).replace(/\{month\}/g,a).replace(/\{monthShort\}/g,u).replace(/\{year\}/g,String(c)).replace(/\{yearShort\}/g,d).replace(/\{hours\}/g,p).replace(/\{minutes\}/g,h).replace(/\{seconds\}/g,f);const m=(e,t)=>{const n="{"+e+"}";-1!==g.indexOf(n)&&(g=g.split(n).join(t()))},y=t=>new Intl.DateTimeFormat(o,n?{...t,timeZone:n}:t).format(e),v=(r.hours+11)%12+1,b=r.hours<12?"am":"pm";m("dayName",()=>y({weekday:"long"})),m("dayShort",()=>y({weekday:"short"})),m("monthName",()=>y({month:"long"})),m("hours12",()=>("0"+v).slice(-2)),m("h12",()=>String(v)),m("ampm",()=>b),m("AMPM",()=>b.toUpperCase()),m("ordinal",()=>String(r.date)+function(e){if(e>=11&&e<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}(r.date)),m("d",()=>String(r.date)),m("m",()=>String(r.month)),m("h",()=>String(r.hours)),m("min",()=>String(r.minutes)),m("s",()=>String(r.seconds)),this._internal.dateString=g}catch(e){this._internal.dateString="",this.sendSignalOnOutput("onError")}this.flagOutputDirty("currentValue"),this.sendSignalOnOutput("inputChanged")}}}};e.exports=o},1065(e,t){"use strict";t.wJ=t.aE=t.wT=t.Dl=void 0,t.isReservedExpressionName=function(e){return n.has(e)},t.expressionNodeInputsRead=function(e){const n=[];for(const i of s(e))-1!==t.wJ.indexOf(i.name)&&-1===n.indexOf(i.name)&&n.push(i.name);return n},t.expressionPorts=function(e){const t=[];for(const i of s(e))n.has(i.name)||-1!==t.indexOf(i.name)||t.push(i.name);return t},t.Dl=["min","max","cos","sin","tan","sqrt","pi","round","floor","ceil","abs","random","pow","log","exp"],t.wT=["window","document","globalThis","console","undefined","NaN","Infinity","Boolean","String","Number","BigInt","Symbol","Object","Array","JSON","Date","RegExp","Map","Set","WeakMap","WeakSet","Promise","Error","TypeError","RangeError","Intl","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI"],t.aE=["true","false","null","this","typeof","instanceof","new","in","void","delete","function","class","super","return","var","const","if","else","for","while","do","switch","case","default","break","continue","throw","try","catch","finally","with","debugger","export","import","extends","enum"],t.wJ=["expression","run","evaluateAtLoad"];const n=new Set([...t.Dl,"Math","Vars","Variables","Objects","Arrays","Noodl","NoodlContext",...t.wT,...t.aE,...t.wJ]),i=/[A-Za-z_$]/,o=/[A-Za-z0-9_$]/,r=/[0-9]/;function s(e){const t=e,n=t.length,s=[],a=[];let l=0,u="",c=0;function d(e,i){let o=e+1;for(;o<n&&t[o]!==i;)o+="\\"===t[o]?2:1;return o+1}function p(e){let i=e;for(;i<n;)if("\\"===t[i])i+=2;else{if("`"===t[i])return u="`",i+1;if("$"===t[i]&&"{"===t[i+1])return a.push(l),l++,u="{",i+2;i++}return n}function h(e){let n=e-1;for(;n>=0&&/\s/.test(t[n]);)n--;return n>=0&&"."===t[n]&&"."!==t[n-1]}for(;c<n;){const e=t[c];if(/\s/.test(e))c++;else if("/"===e&&"/"===t[c+1])for(;c<n&&"\n"!==t[c];)c++;else if("/"===e&&"*"===t[c+1]){const e=t.indexOf("*/",c+2);c=-1===e?n:e+2}else if('"'===e||"'"===e)c=d(c,e),u=e;else if("`"===e)c=p(c+1);else if("/"!==e||""!==u&&-1==="(,=:[!&|?{};+-*%<>~^".indexOf(u))if(r.test(e)||"."===e&&r.test(t[c+1]||"")){for(;c<n&&(o.test(t[c])||"."===t[c]);)c++;u="0"}else if(i.test(e)){const e=c;for(;c<n&&o.test(t[c]);)c++;h(e)||s.push({name:t.slice(e,c),start:e,end:c}),u="a"}else{if("{"===e)l++;else if("}"===e&&(l--,a.length>0&&a[a.length-1]===l)){a.pop(),c=p(c+1);continue}u=e,c++}else{let e=c+1,i=!1;for(;e<n&&"\n"!==t[e];)if("\\"!==t[e]){if("["===t[e])i=!0;else if("]"===t[e])i=!1;else if("/"===t[e]&&!i)break;e++}else e+=2;for(e++;e<n&&o.test(t[e]);)e++;c=e,u="/"}}return s}},84(e,t,n){"use strict";const i=n(1065),o=n(4557),r=n(7268),s=n(5162),a=n(5838),l=n(4627),u=n(3162),c={name:"Expression",docs:"https://docs.noodl.net/nodes/math/expression",usePortAsLabel:"expression",category:"CustomCode",color:"javascript",nodeDoubleClickAction:{focusPort:"Expression"},searchTags:["javascript",...o.ARITHMETIC_SEARCH_TAGS],initialize:function(){const e=this._internal;e.scope={},e.hasScheduledEvaluation=!1,e.code=void 0,e.cachedValue=null,e.hasEvaluated=!1,e.anyInputArrived=!1,e.referencedPorts=[],e.reservedReads=[],e.evaluateAtLoad=!0,e.pendingLoadEvaluation=!1,e.currentExpression="",e.compiledFunction=void 0,e.inputNames=[],e.compiledWith=[],e.noodlDependencies={variables:[],objects:[],arrays:[]},e.unsubscribe=null},methods:{_onNodeDeleted:function(){this._internal.unsubscribe&&(this._internal.unsubscribe(),this._internal.unsubscribe=null),r.prototype._onNodeDeleted.call(this)},registerInputIfNeeded:function(e){this.hasInput(e)||((0,i.isReservedExpressionName)(e)?this.registerInput(e,{set:function(){}}):(this._internal.scope[e]=void 0,this._inputValues[e]=void 0,this.registerInput(e,{set:function(t){this._onInputValueArrived(e,t)}}),this.registerRunOnValueChangeInput(e)))},_onInputValueArrived:function(e,t){const n=this._internal.scope[e];this._internal.scope[e]=t,this._internal.anyInputArrived=!0,this.shouldRunOnValueChanged(e,n,t)&&this._scheduleEvaluateExpression()},_scheduleAutomaticEvaluation:function(){const e=this._internal;e.referencedPorts.length>0&&!e.anyInputArrived||this._scheduleEvaluateExpression()},_scheduleLoadEvaluation:function(){const e=this._internal;e.referencedPorts.length>0&&!e.anyInputArrived&&(e.pendingLoadEvaluation=!0),this._scheduleEvaluateExpression()},_scheduleEvaluateExpression:function(e){const t=this._internal;e&&(t.pendingRunOutcomes||(t.pendingRunOutcomes=[]),t.pendingRunOutcomes.push(e)),!1===t.hasScheduledEvaluation&&(t.hasScheduledEvaluation=!0,this.flagDirty(),this.scheduleAfterInputsHaveUpdated(function(){const e=t.cachedValue,n=t.hasEvaluated,i=t.pendingRunOutcomes||[];t.pendingRunOutcomes=void 0;const o=t.pendingLoadEvaluation&&0===i.length&&!t.anyInputArrived;if(t.pendingLoadEvaluation=!1,o){const e=t.evaluateAtLoad?this._evaluateOverUnsetInputs():p;if(e===p)return void(t.hasScheduledEvaluation=!1);t.cachedValue=e}else t.cachedValue=this._calculateExpression(i);t.hasEvaluated=!0,n&&e===t.cachedValue||(this.flagOutputDirty("result"),this.flagOutputDirty("isTrue"),this.flagOutputDirty("isFalse"),this.flagOutputDirty("asString"),this.flagOutputDirty("asNumber"),this.flagOutputDirty("asBoolean")),t.cachedValue?this.sendSignalOnOutput("isTrueEv"):this.sendSignalOnOutput("isFalseEv"),t.hasScheduledEvaluation=!1,(0,s.reportOutcomes)(this,i.filter(e=>void 0===e.reported),"done")}))},_reportFailure:function(e,t,n,i){const o=this._internal;o.lastError=t,this.flagOutputDirty("error");const r=o.lastReportedError===t;r||(o.lastReportedError=t,this.raiseRuntimeError(e,t,n)),i&&i.length>0?(0,s.reportOutcomes)(this,i,"failure",{code:e,message:t,detail:n,raise:!1}):r||this.sendSignalOnOutput("failure")},_calculateExpression:function(e){const t=this._internal;if(t.reservedReads.length>0){const n=t.reservedReads.slice();return this._reportFailure("expression/reserved-name",f(n),{names:n},e),0}if(t.compiledFunction||(t.compiledFunction=this._compileFunction()),!t.compiledFunction)return this._reportFailure("expression/compile-failed","The expression could not be compiled: "+(t.compileError||"syntax error"),{expression:this.model&&this.model.parameters?this.model.parameters.expression:void 0},e),0;const n=this._argumentsForEvaluation();try{const e=t.compiledFunction.apply(null,n);return t.lastReportedError=void 0,t.lastError&&(t.lastError="",this.flagOutputDirty("error")),e}catch(t){this._reportFailure("expression/threw","The expression threw: "+t.message,{message:t.message},e)}return 0},_argumentsForEvaluation:function(){const e=this._internal,t=e.compiledWith.map(t=>e.scope[t]),i=n(8600).createNoodlAPI(this.context&&this.context.modelScope);return t.concat([i])},_evaluateOverUnsetInputs:function(){const e=this._internal;if(e.compiledFunction||(e.compiledFunction=this._compileFunction()),!e.compiledFunction)return p;let t;try{t=e.compiledFunction.apply(null,this._argumentsForEvaluation())}catch(e){return p}return t!=t?p:t},_compileFunction:function(){const e=this._internal.currentExpression,t=Object.keys(this._internal.scope);this._internal.compiledWith=t.slice(),t.push("Noodl");const n=e+t.join(" ");if(!1===h.hasOwnProperty(n)){t.push(e);try{h[n]=function(e,t){function n(){return e.apply(this,t)}return n.prototype=e.prototype,new n}(Function,t),this._internal.compileError=void 0}catch(e){this._internal.compileError=e.message}}return h[n]}},getInspectInfo(){return[{type:"value",value:this._internal.cachedValue}]},inputs:{expression:{group:"General",inputPriority:1,type:{name:"string",allowEditOnly:!0,codeeditor:"javascript",codenotation:"expression"},displayName:"Expression",description:"JavaScript expression whose value becomes Result. Every name it reads becomes an input port, except JavaScript's own (String, Number, JSON, Date, parseInt, Math and the rest), the Math shortcuts (round, min, pi…) and keywords such as typeof; a port can never be called one of those, nor run, expression or evaluateAtLoad, which are this node's own inputs",set:function(e){const t=this._internal;t.currentExpression=d+"return ("+e+");",t.compiledFunction=void 0;const n=(0,i.expressionPorts)(e);t.referencedPorts=n,t.reservedReads=(0,i.expressionNodeInputsRead)(e);const o=l(n,t.inputNames),r=l(t.inputNames,n),s=this;r.forEach(function(e){s.deregisterInput(e),s.deregisterRunOnValueChangeInput(e),delete t.scope[e]}),o.forEach(function(e){s.hasInput(e)||(s.registerInput(e,{set:function(t){this._onInputValueArrived(e,t)}}),s.registerRunOnValueChangeInput(e),t.scope[e]=void 0,s._inputValues[e]=void 0)}),t.noodlDependencies=u.detectDependencies(e),t.unsubscribe&&(t.unsubscribe(),t.unsubscribe=null),(t.noodlDependencies.variables.length>0||t.noodlDependencies.objects.length>0||t.noodlDependencies.arrays.length>0)&&(t.unsubscribe=u.subscribeToChanges(t.noodlDependencies,function(){s._scheduleAutomaticEvaluation()},s.context&&s.context.modelScope)),t.inputNames=Object.keys(t.scope),this.isInputConnected("run")||this._scheduleLoadEvaluation()}},run:{group:"Actions",displayName:"Run",type:"signal",description:"Evaluates the expression now. This is additional to the inputs that re-run it; untick an input under Run On Value Change to stop that one triggering a run",valueChangedToTrue:function(){this._scheduleEvaluateExpression(this.beginOutcome())}},evaluateAtLoad:{group:a.RUN_ON_CHANGE_GROUP,displayName:"Evaluate At Load",default:!0,type:{name:"boolean",allowEditOnly:!0},description:"Whether the expression runs when the page loads even though an input it reads has not arrived yet. Those inputs read as undefined, so `m !== false` is true and `m === true` is false. An expression that throws or gives NaN over them waits for its inputs instead. Untick to wait for an input to arrive",set:function(e){this._internal.evaluateAtLoad=!1!==e}}},outputs:{result:{group:"Result",type:"*",displayName:"Result",description:"What the expression evaluated to; null until it has been evaluated at least once",getter:function(){return this._internal.hasEvaluated?this._internal.cachedValue:null}},isTrue:{group:"Result",type:"boolean",displayName:"Is True",description:"Whether Result is truthy; null until the expression has been evaluated at least once",getter:function(){return this._internal.hasEvaluated?!!this._internal.cachedValue:null}},isFalse:{group:"Result",type:"boolean",displayName:"Is False",description:"Whether Result is falsy; null until the expression has been evaluated at least once",getter:function(){return this._internal.hasEvaluated?!this._internal.cachedValue:null}},isTrueEv:{group:"Events",type:"signal",displayName:"On True",description:"Fires after an evaluation whose Result is truthy"},isFalseEv:{group:"Events",type:"signal",displayName:"On False",description:"Fires after an evaluation whose Result is falsy"},failure:{group:"Events",type:"signal",displayName:"Failure",description:"Fires when the expression could not be compiled, or threw while being evaluated"},...(0,s.outcomeOutputs)({done:"Fires once a Run you triggered has evaluated the expression, after On True or On False"}),error:{group:"Error",type:"string",displayName:"Error",description:"The compile or evaluation error, in JavaScript's own words",getter:function(){return this._internal.lastError}},asString:{group:"Typed Results",type:"string",displayName:"As String",description:"Result rendered as text, and blank when it is null or undefined",getter:function(){const e=this._internal.cachedValue;return null!=e?String(e):""}},asNumber:{group:"Typed Results",type:"number",displayName:"As Number",description:"Result read as a number, falling back to 0 when it is not one",getter:function(){const e=this._internal.cachedValue;return"number"==typeof e?e:Number(e)||0}},asBoolean:{group:"Typed Results",type:"boolean",displayName:"As Boolean",description:"Whether Result is truthy, for wiring straight to a boolean input",getter:function(){return!!this._internal.cachedValue}}}},d=['var min = Math.min, max = Math.max, cos = Math.cos, sin = Math.sin, tan = Math.tan, sqrt = Math.sqrt, pi = Math.PI, round = Math.round, floor = Math.floor, ceil = Math.ceil, abs = Math.abs, random = Math.random, pow = Math.pow, log = Math.log, exp = Math.exp;try { var NoodlContext = (typeof Noodl !== "undefined") ? Noodl : (typeof global !== "undefined" && global.Noodl) || {}; var Variables = NoodlContext.Variables || {}; var Objects = NoodlContext.Objects || {}; var Arrays = NoodlContext.Arrays || {};} catch (e) { var Variables = {}, Objects = {}, Arrays = {};}'].join(""),p={},h={};function f(e){const t=e.length>1?e.slice(0,-1).join(", ")+" and "+e[e.length-1]:e.join("");return 1===e.length?`${t} is the name of one of this Expression's own inputs (Expression, Run, Evaluate At Load), so the expression cannot read a variable called that — rename it, for example to ${t}Value`:`${t} are names of this Expression's own inputs (Expression, Run, Evaluate At Load), so the expression cannot read variables called those — rename them`}function g(e,t,n){const o=(0,i.expressionPorts)(t),r=o.map(function(e){return{group:"Parameters",name:e,type:{name:"*",editAsType:"string"},plug:"input"}});n.sendDynamicPorts(e,r.concat((0,a.runOnChangeDynamicPorts)(o)))}function m(e,t){const n=t.parameters.expression;if(!n)return void e.clearWarning(t.component.name,t.id,"expression-compile-error");const o=u.validateExpression(n);if(o.valid)if((0,i.expressionNodeInputsRead)(n).length>0)e.sendWarning(t.component.name,t.id,"expression-compile-error",{message:f((0,i.expressionNodeInputsRead)(n))});else{e.clearWarning(t.component.name,t.id,"expression-compile-error");const i=u.detectDependencies(n);if(i.variables.length+i.objects.length+i.arrays.length>0){const e=[];i.variables.length>0&&e.push("Variables: "+i.variables.join(", ")),i.objects.length>0&&e.push("Objects: "+i.objects.join(", ")),i.arrays.length>0&&e.push("Arrays: "+i.arrays.join(", ")),console.log("[Expression Node] Reactive dependencies detected:",e.join("; "))}}else e.sendWarning(t.component.name,t.id,"expression-compile-error",{message:"Syntax error: "+o.error})}const y={node:c,setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Expression",function(t){t.parameters.expression&&(g(t.id,t.parameters.expression,e.editorConnection),m(e.editorConnection,t)),t.on("parameterUpdated",function(n){"expression"===n.name&&(g(t.id,t.parameters.expression,e.editorConnection),m(e.editorConnection,t))})})}};e.exports=y},440(e,t,n){"use strict";t.userPositionForError=function(e){const t=l(e&&e.stack);if(!t)return;const n=t.line-function(){if(void 0!==u)return u;try{let e;const t=new(0,Object.getPrototypeOf(async function(){}).constructor)("Inputs","Outputs","Noodl","Component",i.getCodePrefix()+'Inputs.__fun007Probe(new Error("fun-007 probe"));').call({},{__fun007Probe(t){e=t}},{},{},{});t&&"function"==typeof t.catch&&t.catch(()=>{});const n=l(e&&e.stack);if(n&&n.line>=1)return u=n.line-1,u}catch(e){}const e=(String(i.getCodePrefix()).match(/\n/g)||[]).length;return u=e+2,u}();return n<1?void 0:{line:n,column:t.column}},t.noOutputWrittenMessage=function(e){if(0===e.length)return"";const t=e[0],n=e.map(e=>'"'+e.label+'"').join(", "),i=1===e.length?"it":'"'+t.label+'"';return t.isSignal?"The script ran but produced no output: "+n+" never fired. Fire "+i+" in the script with "+s("Outputs",t.label,!0)+".":"The script ran but produced no output: "+n+" stayed empty. Write "+i+" in the script with "+s("Outputs",t.label,!1)+" — assigning to a plain variable of the same name does not reach the port."},t.declaredOutputPorts=p,t.hintForThrownError=function(e,t){const n=function(e){const t=e;if(!t||"ReferenceError"!==t.name||"string"!=typeof t.message)return;const n=/^([A-Za-z_$][A-Za-z0-9_$]*) is not defined$/.exec(t.message);if(n)return n[1];const i=/^Can't find variable: ([A-Za-z_$][A-Za-z0-9_$]*)$/.exec(t.message);return i?i[1]:void 0}(e);if(!n)return;if(-1!==function(e){const t=[],n={};function i(e){e&&!n[e]&&(n[e]=!0,t.push(e))}const o=e&&e.inputPorts;if(o)for(const e in o)0===e.indexOf("in-")&&i(e.substring(3));const r=d(e,"scriptInputs");for(let e=0;e<r.length;e++)i(r[e]);return t}(t).indexOf(n))return c(n,"Inputs");const i=p(t);for(let e=0;e<i.length;e++)if(i[e].label===n)return c(n,"Outputs",i[e].isSignal)},t.runtimeErrorMessage=function(e,t,n){let i=t?"Line "+t.line+": "+e:e;return n&&(i+=" — "+n),i};const i=n(8600),o=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function r(e,t){return o.test(t)?e+"."+t:e+"["+JSON.stringify(t)+"]"}function s(e,t,n=!1){const i=r(e,t);return"Inputs"===e?i:n?i+"()":i+" = ..."}const a=/<anonymous>:(\d+):(\d+)/g;function l(e){if("string"!=typeof e)return;const t=e.split("\n");for(let e=0;e<t.length;e++){if(!/^\s*at /.test(t[e]))continue;let n,i;for(a.lastIndex=0;null!==(n=a.exec(t[e]));)i=n;if(i)return{line:Number(i[1]),column:Number(i[2])}}}let u;function c(e,t,n=!1){return"Inputs"===t?e+" is an input port on this node. Read it with "+r("Inputs",e)+".":e+" is an output port on this node. Write it with "+s("Outputs",e,n)+"."}function d(e,t){const n=e&&e.parameters&&e.parameters[t];if(!Array.isArray(n))return[];const i=[];for(let e=0;e<n.length;e++){const t=n[e];t&&"string"==typeof t.label&&""!==t.label&&i.push(t.label)}return i}function p(e){const t=[],n={};function i(e,i){e&&!n[e]&&(n[e]=!0,t.push({label:e,isSignal:i}))}const o=e&&e.outputPorts;if(o)for(const e in o){if(0!==e.indexOf("out-"))continue;const t=o[e];i(e.substring(4),!!t&&"signal"===t.type)}const r=e&&e.parameters||{},s=d(e,"scriptOutputs");for(let e=0;e<s.length;e++)i(s[e],"signal"===r["outtype-"+s[e]]);return t}},1305(e){"use strict";function t(e){if(void 0!==e)return!e}const n={node:{name:"Inverter",docs:"https://docs.noodl.net/nodes/logic/inverter",category:"Logic",initialize:function(){this._internal.currentValue=void 0},getInspectInfo(){return String(t(this._internal.currentValue))},inputs:{value:{group:"Values",type:{name:"boolean"},displayName:"Value",description:"Value to negate; anything falsy counts as false, and leaving it unset keeps Result unset too",set:function(e){this._internal.currentValue=e,this.flagOutputDirty("result")}}},outputs:{result:{group:"Values",type:"boolean",displayName:"Result",description:"The opposite of Value, and unset rather than true while Value has never been set",getter:function(){return t(this._internal.currentValue)}}}}};e.exports=n},7426(e,t,n){"use strict";const i=n(5162),o=["debug","info","warn","error"],r={node:{name:"net.noodl.Log",displayNodeName:"Log",docs:"https://docs.noodl.net/nodes/utilities/log",category:"Utilities",color:"default",initialize:function(){this._internal.level="info"},inputs:{message:{type:"string",displayName:"Message",group:"General",description:"The line to write. Free text, so keep credentials out of it by habit — the backend does scrub the values of its own stored secrets out of this before it is written, but that cannot cover a credential it never issued",set:function(e){this._internal.message=e}},level:{type:{name:"enum",enums:[{label:"Debug",value:"debug"},{label:"Info",value:"info"},{label:"Warning",value:"warn"},{label:"Error",value:"error"}]},displayName:"Level",group:"General",default:"info",description:"How loud this line is. In a cloud function the backend drops anything below its configured level, so Debug lines cost nothing in production unless someone turns them on",set:function(e){this._internal.level=-1===o.indexOf(e)?"info":e}},data:{type:"object",displayName:"Data",group:"General",description:"An optional object written alongside the message as structured fields. In a cloud function every property whose NAME says it holds a credential is redacted on the way out",set:function(e){this._internal.data=e}},value:{type:"*",displayName:"Value",group:"General",description:"Passed straight through to the Value output, so this node can sit inline on a wire",set:function(e){this._internal.value=e,this.flagOutputDirty("value")}},log:{type:"signal",displayName:"Log",group:"Actions",description:"Writes the line. Nothing is written until this fires",valueChangedToTrue:function(){this._write(this.beginOutcome({level:this._internal.level||"info",message:void 0===this._internal.message||null===this._internal.message?"":String(this._internal.message),...void 0!==this._internal.data&&null!==this._internal.data?{data:this._internal.data}:{}}))}}},outputs:{value:{type:"*",displayName:"Value",group:"Values",description:"Whatever arrived on the Value input, unchanged — this node never alters what passes through it",getter:function(){return this._internal.value}},...(0,i.outcomeOutputs)({done:"Fires once the line has been written"})},methods:{_write:function(e){const t=this._internal,n=t.level||"info",i=void 0===t.message||null===t.message?"":String(t.message),o={level:n,message:i,nodeId:this.id};void 0!==t.data&&null!==t.data&&(o.data=t.data);const r=this.nodeScope,s=r&&r.runContext&&r.runContext.log;if(s)s(o);else{const e=console[n]||console.log||function(){};void 0!==o.data?e.call(console,i,o.data):e.call(console,i)}e&&this.reportOutcome(e,"done")}}}};e.exports=r},1692(e,t){"use strict";t.createBlockConsole=function(e,t){if("function"!=typeof e)return console;const i=function(){const e={},t=console;for(const n in t){const i=t[n];e[n]="function"==typeof i?i.bind(t):i}return e}();for(const r of Object.keys(n)){const s=n[r];i[r]=function(...n){e({level:s,message:o(n),nodeId:t})}}return i};const n={log:"info",info:"info",debug:"debug",warn:"warn",error:"error"};function i(e){if("string"==typeof e)return e;if(void 0===e)return"undefined";if(null===e)return"null";if("object"==typeof e)try{const t=JSON.stringify(e);return void 0===t?String(e):t}catch{try{return String(e)}catch{return"[unprintable]"}}return String(e)}function o(e){return e.map(i).join(" ")}},9009(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(4069),t)},2599(e,t,n){"use strict";t.PROBE_TRIGGER_SIGNAL=t.NOOP_STATEMENT_PROBE=t.IDENTITY_VALUE_PROBE=void 0,t.evaluateFragment=function(e,t,n=o.DEFAULT_VALUE_CAP){if("string"!=typeof t||""===t.trim())return{ok:!1,errorPhase:"compile",error:"There is nothing to work out here — this block generates no code."};let s;try{s=new Function("Inputs","Outputs","Noodl","Variables","Objects","Arrays","sendSignalOnOutput","__triggerSignal__","__p","__s","console",t)}catch(e){return{ok:!1,errorPhase:"compile",error:"The block could not be compiled: "+a(e)}}const l=[];try{const t=s(e.Inputs,e.Outputs,e.Noodl,e.Variables,e.Objects,e.Arrays,function(e){l.push(String(e))},e.__triggerSignal__,i.IDENTITY_VALUE_PROBE,i.NOOP_STATEMENT_PROBE,(0,r.createBlockConsole)(void 0)),a={ok:!0,value:(0,o.previewValue)(t,n)};return l.length&&(a.suppressedSignals=l),a}catch(e){const t={ok:!1,errorPhase:"run",error:a(e)};return l.length&&(t.suppressedSignals=l),t}};const i=n(3786),o=n(5801),r=n(1692);var s=n(3786);function a(e){if(e&&"string"==typeof e.message&&e.message)return e.message;const t=String(e);return""===t?"The block threw, with no message.":t}Object.defineProperty(t,"IDENTITY_VALUE_PROBE",{enumerable:!0,get:function(){return s.IDENTITY_VALUE_PROBE}}),Object.defineProperty(t,"NOOP_STATEMENT_PROBE",{enumerable:!0,get:function(){return s.NOOP_STATEMENT_PROBE}}),t.PROBE_TRIGGER_SIGNAL="__doIt__"},8576(e,t,n){"use strict";const i=n(1692),o=n(9009),r=n(2599),s=n(4557),a=n(5162),l=n(4830);function u(e,t,n){const i=(0,o.detectIO)(t),r=[];for(const e of i.inputs)-1===o.RESERVED_INPUTS.indexOf(e.name)&&r.push({name:e.name,type:e.type,plug:"input",group:"Inputs",displayName:e.name});for(const e of i.outputs)-1===o.RESERVED_OUTPUTS.indexOf(e.name)&&r.push({name:e.name,type:e.type,plug:"output",group:"Outputs",displayName:e.name});for(const e of i.signalInputs)-1===o.RESERVED_INPUTS.indexOf(e)&&r.push({name:e,type:"signal",plug:"input",group:"Actions",displayName:e});for(const e of i.signalOutputs)-1===o.RESERVED_OUTPUTS.indexOf(e)&&r.push({name:e,type:"signal",plug:"output",group:"Events",displayName:e});n.sendDynamicPorts(e,r)}const c={node:{name:"Logic Builder",docs:"https://docs.noodl.net/nodes/logic/logic-builder",displayNodeName:"Visual Function",category:"CustomCode",color:"javascript",nodeDoubleClickAction:{focusPort:"workspace"},searchTags:["blockly","visual","logic","blocks","nocode",...s.ARITHMETIC_SEARCH_TAGS],initialize:function(){const e=this._internal;e.workspace="",e.compiledFunction=null,e.compileError=null,e.executionError=null,e.inputValues={},e.outputValues={}},methods:{_io:function(){const e=this._internal,t=this.model&&this.model.parameters&&this.model.parameters.workspace,n="string"==typeof t&&t||e.workspace||"";return e.ioSource===n&&e.io||(e.ioSource=n,e.io=(0,o.detectIO)(n)),e.io},registerInputIfNeeded:function(e){if(this.hasInput(e))return;const t=this._internal,n=this._io();-1===n.signalInputs.indexOf(e)?this.registerInput(e,{type:(0,o.typeOfPort)(n,"input",e),set:function(n){t.inputValues[e]=n}}):this.registerInput(e,{type:"signal",set:l.createSetter({valueChangedToTrue:function(){this._executeLogic(e,this.beginOutcome())}})})},registerOutputIfNeeded:function(e){if(this.hasOutput(e))return;const t=this._io();-1===t.signalOutputs.indexOf(e)?this.registerOutput(e,{type:(0,o.typeOfPort)(t,"output",e),getter:function(){return this._internal.outputValues[e]}}):this.registerOutput(e,{type:"signal"})},_fail:function(e,t,n){const i=this._internal;i.executionError=t,this.flagOutputDirty("error"),i.raisedCodes||(i.raisedCodes=[]),-1===i.raisedCodes.indexOf(e)&&i.raisedCodes.push(e),i.runRaisedCodes||(i.runRaisedCodes=[]),-1===i.runRaisedCodes.indexOf(e)&&i.runRaisedCodes.push(e),i.lastReportedError!==t&&(i.lastReportedError=t,this.raiseRuntimeError(e,t,{error:t})),n?this.reportOutcome(n,"failure",{code:e,message:t,raise:!1}):this.sendSignalOnOutput("failure")},_clearFailureWarnings:function(){const e=this._internal,t=e.runRaisedCodes||[];0===t.length&&(e.lastReportedError=void 0);const n=e.raisedCodes;if(!n||0===n.length)return;const i=n.filter(e=>-1===t.indexOf(e));if(e.raisedCodes=t.slice(),0===i.length)return;const o=this.context&&this.context.editorConnection;if(!o||"function"!=typeof o.clearWarning)return;let r="<unknown>";try{this.nodeScope&&this.nodeScope.componentOwner&&this.nodeScope.componentOwner.name&&(r=this.nodeScope.componentOwner.name)}catch(e){}for(let e=0;e<i.length;e++)o.clearWarning(r,this.id,i[e])},_executeLogic:function(e,t){const n=this._internal;if(n.runRaisedCodes=[],n.compiledFunction||(n.compiledFunction=this._compileFunction()),!n.compiledFunction)return n.compileError?void this._fail("logic-builder/code-not-compiled","The blocks could not be compiled: "+n.compileError,t):void(t&&this.reportOutcome(t,"unchanged"));const i=this.context,s=i&&"function"==typeof i.beginBlockRun?i.beginBlockRun(this.id):void 0;try{const i=this._createExecutionContext(e);n.refusedSignal=null,n.blocksRunning=!0,n.compiledFunction(i.Inputs,i.Outputs,i.Noodl,i.Variables,i.Objects,i.Arrays,i.sendSignalOnOutput,i.__triggerSignal__,s?s.probeValue:r.IDENTITY_VALUE_PROBE,s?s.probeStatement:r.NOOP_STATEMENT_PROBE,i.console),n.blocksRunning=!1;let a=null;for(const e in i.Outputs)-1===o.RESERVED_OUTPUTS.indexOf(e)?(n.outputValues[e]=i.Outputs[e],this.registerOutputIfNeeded(e),this.flagOutputDirty(e)):a=e;if(n.refusedSignal)return void this._fail("logic-builder/reserved-port-name",'"'+n.refusedSignal+"\" is one of the node's own output signals and cannot be sent from the blocks",t);if(null!==a)return void this._fail("logic-builder/reserved-port-name",'"'+a+"\" is one of the node's own output ports and cannot be set from the blocks",t);n.executionError=null,this.flagOutputDirty("error"),this._clearFailureWarnings(),this.sendSignalOnOutput("success"),t&&this.reportOutcome(t,"done")}catch(e){n.blocksRunning=!1,console.error("[Logic Builder] Execution error:",e),this._fail("logic-builder/blocks-threw",e&&e.message?String(e.message):String(e),t)}finally{if(s&&i&&"function"==typeof i.endBlockRun)try{i.endBlockRun(this.id,s)}catch(e){console.error("[Logic Builder] Could not report block values:",e)}}},_createExecutionContext:function(e){var t,r;const s=this._internal,a=this,l=n(8600).createNoodlAPI(this.context&&this.context.modelScope);return{Inputs:s.inputValues,Outputs:{},Noodl:l,Variables:l.Variables,Objects:l.Objects,Arrays:l.Arrays,sendSignalOnOutput:function(e){if(-1!==o.RESERVED_OUTPUTS.indexOf(e))return s.blocksRunning?void(s.refusedSignal||(s.refusedSignal=e)):void a._fail("logic-builder/reserved-port-name",'"'+e+"\" is one of the node's own output signals and cannot be sent from the blocks");a.registerOutputIfNeeded(e),a.sendSignalOnOutput(e)},__triggerSignal__:e,console:(0,i.createBlockConsole)(null===(r=null===(t=this.nodeScope)||void 0===t?void 0:t.runContext)||void 0===r?void 0:r.log,this.id)}},_compileFunction:function(){const e=this._internal;e.compileError=null;const t=e.generatedCode||"";if(!t)return null;try{return new Function("Inputs","Outputs","Noodl","Variables","Objects","Arrays","sendSignalOnOutput","__triggerSignal__","__p","__s","console",t)}catch(t){return console.error("[Logic Builder] Failed to compile function:",t),e.compileError=t&&t.message?String(t.message):String(t),null}},_probeFragment:function(e){let t;try{t=this._createExecutionContext(r.PROBE_TRIGGER_SIGNAL)}catch(e){return{ok:!1,errorPhase:"run",error:"The node could not build a context to evaluate in: "+(e&&e.message?e.message:e)}}return(0,r.evaluateFragment)(t,e)}},getInspectInfo(){const e=this._internal;return e.executionError?`Error: ${e.executionError}`:"Visual Function"},inputs:{workspace:{group:"General",type:{name:"string",allowEditOnly:!0,editorType:"logic-builder-workspace"},displayName:"Logic Blocks",description:"The block program itself, authored in the block editor — it decides which ports this node has, so editing it adds and removes ports",set:function(e){const t=this._internal;t.workspace=e,t.compiledFunction=null,t.ioSource=void 0,t.io=void 0}},generatedCode:{group:"Advanced",type:{name:"string",allowEditOnly:!0,editorType:"logic-builder-hidden"},displayName:"Generated Code",description:"The JavaScript the block editor writes out of Logic Blocks and the runtime actually executes; it is overwritten on every block edit, so hand edits do not survive",set:function(e){const t=this._internal;t.generatedCode=e,t.compiledFunction=null}},run:{type:"signal",displayName:"Run",group:"Actions",description:"Runs the block program once; the blocks never run on their own, so a value arriving at an input changes nothing until this fires",valueChangedToTrue:function(){this._executeLogic("run",this.beginOutcome())}}},outputs:{success:{group:"Status",type:"signal",displayName:"Success",description:"Fires once the block program has run through without throwing and every output it wrote is up to date"},...(0,a.outcomeOutputs)({group:"Status",done:"Fires once a run you triggered has finished, after Success and after every output the program wrote",unchanged:"Fires when there are no blocks to run yet, which is what a freshly dropped Visual Function looks like",failure:"Fires when the block program threw while running, or could not be compiled at all"}),error:{group:"Status",type:"string",displayName:"Error",description:"What the last run went wrong with, in JavaScript's own words; empty once a run succeeds",getter:function(){return this._internal.executionError||""}}}},setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Logic Builder",function(t){u(t.id,t.parameters.workspace,e.editorConnection),t.on("parameterUpdated",function(n){"workspace"===n.name&&u(t.id,t.parameters.workspace,e.editorConnection)})})}};e.exports=c},4557(e,t){"use strict";t.ARITHMETIC_SEARCH_TAGS=void 0,t.ARITHMETIC_SEARCH_TAGS=["math","calculate","formula","equation","add","subtract","multiply","divide","round","ceil","floor","sum","average","percent","%"]},2399(e){"use strict";const t={name:"Number Remapper",docs:"https://docs.noodl.net/nodes/math/number-remapper",category:"Math",initialize:function(){const e=this._internal;e._currentInputValue=0,e._remappedValue=0,e._minInputValue=0,e._maxInputValue=1,e._minOutputValue=0,e._maxOutputValue=1,e._clampOutput=!0},getInspectInfo(){return[{type:"value",value:this._internal._remappedValue}]},inputs:{inputValue:{group:"Value to Remap",type:{name:"number",allowConnectionOnly:!0},default:0,displayName:"Input Value",description:"Number to remap, read against Input Minimum and Input Maximum",set:function(e){this._internal._currentInputValue=e,this._calculateNewOutputValue()}},minInputValue:{group:"Input Parameters",type:{name:"number"},default:0,displayName:"Input Minimum",description:"Value of Input Value that maps to Output Minimum",set:function(e){this._internal._minInputValue=e,this._calculateNewOutputValue()}},maxInputValue:{group:"Input Parameters",type:{name:"number"},default:1,displayName:"Input Maximum",description:"Value of Input Value that maps to Output Maximum; set equal to Input Minimum and the result is pinned at Output Minimum for every input",set:function(e){this._internal._maxInputValue=e,this._calculateNewOutputValue()}},minOutputValue:{group:"Output Parameters",type:{name:"number"},default:0,displayName:"Output Minimum",description:"Result when Input Value is at Input Minimum",set:function(e){this._internal._minOutputValue=e,this._calculateNewOutputValue()}},maxOutputValue:{group:"Output Parameters",type:{name:"number"},default:1,displayName:"Output Maximum",description:"Result when Input Value is at Input Maximum",set:function(e){this._internal._maxOutputValue=e,this._calculateNewOutputValue()}},clamp:{group:"Output Parameters",type:{name:"boolean",allowEditOnly:!0},default:!0,displayName:"Clamp Output",description:"Holds the result inside the output range when Input Value falls outside the input range, instead of extrapolating",set:function(e){this._internal._clampOutput=!!e,this._calculateNewOutputValue()}}},outputs:{remappedValue:{type:"number",displayName:"Remapped Value",group:"Outputs",description:"Input Value rescaled from the input range onto the output range",getter:function(){return this._internal._remappedValue}}},prototypeExtensions:{_calculateNewOutputValue:{value:function(){let e,t=this._internal;e=t._maxInputValue===t._minInputValue?0:(t._currentInputValue-t._minInputValue)/(t._maxInputValue-t._minInputValue),t._clampOutput&&(e=Math.max(0,Math.min(1,e))),t._remappedValue=t._minOutputValue+e*(t._maxOutputValue-t._minOutputValue),this.flagOutputDirty("remappedValue")}}}};e.exports={node:t}},5856(e){"use strict";const t={node:{name:"On App Error",displayNodeName:"On App Error",category:"Utilities",color:"component",initialize:function(){this._internal.subscription=this.context.errorBus.subscribe(e=>{this.onRuntimeError(e)}),this.addDeleteListener(function(){this._internal.subscription&&(this._internal.subscription.unsubscribe(),this._internal.subscription=void 0)})},getInspectInfo(){const e=this._internal.last;return e?e.code+": "+e.message:"No errors yet"},inputs:{filter:{type:"string",displayName:"Filter",group:"General",description:"Only errors whose Code starts with this text are reported; leave blank to catch every error in the app",set:function(e){this._internal.filter=null==e?void 0:String(e)}}},outputs:{error:{type:"signal",displayName:"Error",group:"Error",description:"Fires when an error passes the Filter, after every value output below has been updated to describe it"},message:{type:"string",displayName:"Message",group:"General",description:"Human-readable account of what went wrong, safe to reword between releases — match on Code instead",getter:function(){return this._internal.last?this._internal.last.message:void 0}},code:{type:"string",displayName:"Code",group:"General",description:"Stable kebab-case identifier for this kind of error, namespaced by node type, as in run-tasks/task-failed",getter:function(){return this._internal.last?this._internal.last.code:void 0}},nodeId:{type:"string",displayName:"Node Id",group:"Source",description:"Graph id of the node that raised the error, or <runtime> when it was raised outside any node",getter:function(){return this._internal.last?this._internal.last.nodeId:void 0}},componentName:{type:"string",displayName:"Component Name",group:"Source",description:"Component the failing node sits in, or <runtime> when the error was raised outside any node",getter:function(){return this._internal.last?this._internal.last.componentName:void 0}},nodeType:{type:"string",displayName:"Node Type",group:"Source",description:"Kind of node that raised the error, or <runtime> when it was raised outside any node",getter:function(){return this._internal.last?this._internal.last.nodeType:void 0}},errorObject:{type:"object",displayName:"Error Object",group:"General",description:"The whole error event as one record, for logging it or sending it to an error-reporting service",getter:function(){return this._internal.last}}},prototypeExtensions:{onRuntimeError:function(e){const t=this._internal;t.filter&&0!==e.code.indexOf(t.filter)||(t.last=e,this.flagOutputDirty("message"),this.flagOutputDirty("code"),this.flagOutputDirty("nodeId"),this.flagOutputDirty("componentName"),this.flagOutputDirty("nodeType"),this.flagOutputDirty("errorObject"),this.sendSignalOnOutput("error"))}}}};e.exports=t},3155(e){"use strict";const t={node:{name:"Or",docs:"https://docs.noodl.net/nodes/logic/or",category:"Logic",initialize:function(){this._internal.inputs=[]},getInspectInfo(){return[{type:"value",value:this._internal.inputs.some(n)}]},numberedInputs:{input:{type:"boolean",displayPrefix:"Input",createSetter:e=>function(t){this._internal.inputs[e]!==t&&(this._internal.inputs[e]=t,this.flagOutputDirty("result"))}}},outputs:{result:{group:"Values",type:"boolean",displayName:"Result",description:"True while at least one connected input is true; false when no input is connected at all",getter:function(){return this._internal.inputs.some(n)}}}}};function n(e){return!!e}e.exports=t},5109(e,t){"use strict";function n(e){const n=t=>{const n=e(t.parameter);return"string"==typeof n&&n.length>0?n:t.default};return{start:n(t.TEMPLATE_CONTRACT.start),success:n(t.TEMPLATE_CONTRACT.success),failure:n(t.TEMPLATE_CONTRACT.failure),error:n(t.TEMPLATE_CONTRACT.error)}}t.TEMPLATE_CONTRACT=void 0,t.resolveTemplateContract=n,t.checkTemplateContract=function(e,r,s){const a=()=>e.clearWarning(r.component.name,r.id,i),l=t=>e.sendNodeSubLabel(r.id,t),u=r.parameters.taskTemplate;if(!u)return l(void 0),a();const c=s.components[u];if(!c)return l(void 0),e.sendWarning(r.component.name,r.id,i,{message:'The task template "'+u+'" does not exist. Pick a component that does.'});const d=n(e=>r.parameters[e]),p=[];c.inputPorts[d.start]||p.push('no "'+d.start+'" signal input ('+t.TEMPLATE_CONTRACT.start.purpose+"), so no task will ever start — it has "+o(c.inputPorts));const h=[t.TEMPLATE_CONTRACT.success,t.TEMPLATE_CONTRACT.failure].map(e=>({spec:e,name:e===t.TEMPLATE_CONTRACT.success?d.success:d.failure})).filter(e=>!c.outputPorts[e.name]);if(2===h.length)p.push('neither a "'+d.success+'" nor a "'+d.failure+'" signal output, so no task can ever report completion — it has '+o(c.outputPorts));else if(1===h.length){const e=h[0];p.push('no "'+e.name+'" signal output, so '+e.spec.purpose+" has no way to be reported")}if(0===p.length){const e=!!c.outputPorts[d.error];return l(u+": "+d.start+" → "+d.success+" / "+d.failure+(e?" / "+d.error:"")),a()}l(void 0),e.sendWarning(r.component.name,r.id,i,{message:'The task template "'+u+'" does not match what Run Tasks expects: '+p.join("; ")+". Run Tasks matches these port names exactly — there is no connection between this node and the template. Rename the port, or set the matching name on this node."})},t.TEMPLATE_CONTRACT={start:{parameter:"taskStartInput",default:"Do",plug:"input",purpose:"Run Tasks pulses it to start each task"},success:{parameter:"taskSuccessOutput",default:"Success",plug:"output",purpose:"a task reports that it finished"},failure:{parameter:"taskFailureOutput",default:"Failure",plug:"output",purpose:"a task reports that it failed"},error:{parameter:"taskErrorOutput",default:"Error",plug:"output",purpose:"a failing task explains itself"}};const i="run-tasks-template";function o(e){const t=Object.keys(e||{});if(0===t.length)return"none";const n=t.slice(0,12).map(e=>'"'+e+'"');return n.join(", ")+(t.length>n.length?", …":"")}},6055(e,t,n){"use strict";const i=n(5109),o=n(5162),{Node:r}=n(3538),s=n(2845),a=n(6835),l={node:{name:"RunTasks",displayNodeName:"Run Tasks",docs:"https://docs.noodl.net/nodes/data/run-tasks",color:"data",category:"Data",searchTags:["for each","foreach","loop","iterate","each","map","batch","queue","concurrency"],initialize(){this._internal.queuedOperations=[],this._internal.state="idle",this._internal.maxRunningTasks=10,this._internal.activeTasks=new Map,this._internal.pendingRunOutcomes=[],this._internal.runOutcomes=[],this._internal.pendingAbortOutcomes=[],this._internal.abortOutcomes=[]},inputs:{items:{group:"Data",displayName:"Items",description:"The list to run the template once for; each entry becomes one task and is passed to it as a record",type:"array",set:function(e){null!==e?e&&e!==this._internal.items&&(this._internal.items=e):this._internal.items=void 0}},stopOnFailure:{group:"General",displayName:"Stop On Failure",type:"boolean",description:"Abandons the remaining items as soon as one task fails, rather than running the whole list",default:!1,set:function(e){this._internal.stopOnFailure=e}},maxRunningTasks:{group:"General",displayName:"Max Running Tasks",type:"number",description:"How many tasks may run at the same time; must be at least 1 or the run fails rather than starting",default:10,set:function(e){this._internal.maxRunningTasks=e}},taskTemplate:{type:"component",displayName:"Template",group:"General",description:"The component to run once per item, which must expose the ports named under Template Contract",set:function(e){this._internal.template=e}},taskStartInput:{type:{name:"string",allowEditOnly:!0},displayName:"Start Input",group:"Template Contract",description:"Name of the template's signal input to pulse when a task begins",default:i.TEMPLATE_CONTRACT.start.default,set:function(e){this._internal.startInput=e}},taskSuccessOutput:{type:{name:"string",allowEditOnly:!0},displayName:"Success Output",group:"Template Contract",description:"Name of the template's signal output that means one task finished successfully",default:i.TEMPLATE_CONTRACT.success.default,set:function(e){this._internal.successOutput=e}},taskFailureOutput:{type:{name:"string",allowEditOnly:!0},displayName:"Failure Output",group:"Template Contract",description:"Name of the template's signal output that means one task failed",default:i.TEMPLATE_CONTRACT.failure.default,set:function(e){this._internal.failureOutput=e}},taskErrorOutput:{type:{name:"string",allowEditOnly:!0},displayName:"Error Output",group:"Template Contract",description:"Name of an optional value output on the template carrying why a task failed; leave blank if it cannot say",default:i.TEMPLATE_CONTRACT.error.default,set:function(e){this._internal.errorOutput=e}},run:{group:"General",displayName:"Do",type:"signal",description:"Starts a run over Items; a Do while a run is already in progress reports Unchanged rather than queueing",valueChangedToTrue:function(){this._internal.pendingRunOutcomes.push(this.beginOutcome()),this.scheduleRun()}},abort:{group:"General",displayName:"Abort",type:"signal",description:"Stops starting new tasks and ends the run once those already running finish; reports Unchanged when no run is in progress",valueChangedToTrue:function(){this._internal.pendingAbortOutcomes.push(this.beginOutcome()),this.scheduleAbort()}}},outputs:{aborted:{type:"signal",group:"Events",displayName:"Aborted",description:"Fires when a run ended early, either from Abort or because Stop On Failure caught a failure"},...(0,o.outcomeOutputs)({done:"Fires when the run ended having done its work: every task completed without failing, the Items list was empty, or an Abort was honoured — Aborted fires alongside it when the run ended early",unchanged:"Fires when there was nothing to do: a Do while a run is already in progress, or an Abort with no run in progress",failure:"Fires when at least one task failed, or when the run could not start at all; which item failed is reported on the error channel"})},methods:{scheduleRun(){const e=this._internal;e.hasScheduledRun||(e.hasScheduledRun=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._queueOperation(()=>{e.hasScheduledRun=!1,this.run()})}))},scheduleAbort(){const e=this._internal;e.hasScheduledAbort||(e.hasScheduledAbort=!0,this.scheduleAfterInputsHaveUpdated(()=>{this._queueOperation(()=>{e.hasScheduledAbort=!1,this.abort()})}))},_contract(){const e=this._internal,t={[i.TEMPLATE_CONTRACT.start.parameter]:e.startInput,[i.TEMPLATE_CONTRACT.success.parameter]:e.successOutput,[i.TEMPLATE_CONTRACT.failure.parameter]:e.failureOutput,[i.TEMPLATE_CONTRACT.error.parameter]:e.errorOutput};return(0,i.resolveTemplateContract)(e=>t[e])},async createTaskComponent(e){const t=this._internal,n=e.item,i=this._contract(),o=(this.nodeScope.modelScope||a).create(n),r=await this.nodeScope.createNode(t.template,s(),{_forEachModel:o,_forEachNode:this}),l=r.isInputConnected.bind(r);r.isInputConnected=e=>e===i.start||l(e),r._runTaskIndex=e.index,r.hasInput("Id")&&r.setInputValue("Id",o.getId()),r.hasInput("id")&&r.setInputValue("id",o.getId());for(const e in r._inputs)void 0!==o.data[e]&&r.setInputValue(e,o.data[e]);return r._internal.creatorCallbacks={onOutputChanged:(e,t,n)=>{!1!==n&&void 0!==n||!0!==t||this.itemOutputSignalTriggered(e,o,r)}},r},async startTask(e){const t=this._internal,n=this._contract();try{const r=await this.createTaskComponent(e);if(!r.hasOutput(n.success)&&!r.hasOutput(n.failure))return this.nodeScope.deleteNode(r),void this.endRunAsFailed("run-tasks/no-completion-output",'The task template "'+t.template+'" has no '+n.success+" or "+n.failure+" output, so a task can never report completion",{template:t.template,expectedOutputs:[n.success,n.failure]});t.runningTasks++,i=r,o=n.start,i.queueInput(o,!0),i.queueInput(o,!1),t.activeTasks.set(r.id,r)}catch(n){this.endRunAsFailed("run-tasks/task-start-failed","A task could not be started",{template:t.template,itemIndex:e.index,error:n instanceof Error?n.message:String(n)})}var i,o},endRunAsFailed(e,t,n){const i=this._internal;"idle"!==i.state&&(this.raiseRuntimeError(e,t,n),i.queuedTasks=[],i.state="idle",this._endRun("failure",{raise:!1,code:e,message:t,detail:n}))},_endRun(e,t){const n=this._internal,i=n.runOutcomes,r=n.abortOutcomes;n.runOutcomes=[],n.abortOutcomes=[],(0,o.reportOutcomes)(this,i,e,t),(0,o.reportOutcomes)(this,r,"done")},_runFailureReport(e){const t=this._internal,n=t.failedTasks||0,i=t.numTasks||0;return{raise:!1,code:e?"run-tasks/stopped-on-failure":"run-tasks/tasks-failed",message:e?"Stopped after "+n+" of "+i+" tasks failed, because Stop On Failure is set":n+" of "+i+" tasks failed",detail:{template:t.template,failedTasks:n,numTasks:i}}},_failToStart(e,t,n,i){this.raiseRuntimeError(t,n,i),(0,o.reportOutcomes)(this,e,"failure",{raise:!1,code:t,message:n,detail:i})},async run(){const e=this._internal,t=e.pendingRunOutcomes;if(e.pendingRunOutcomes=[],this.context.editorConnection&&("idle"!==e.state?this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"run-tasks",{message:"Cannot start when not in idle mode"}):e.template?e.items?this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"run-tasks"):this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"run-tasks",{message:"No items array provided."}):this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"run-tasks",{message:"No task template specified."})),"idle"!==e.state)return this.raiseRuntimeError("run-tasks/already-running","Do was triggered while a run was still in progress, so it was ignored",{template:e.template}),void(0,o.reportOutcomes)(this,t,"unchanged");if(e.template)if(e.items)if(e.maxRunningTasks>=1){if(e.runOutcomes=t,e.state="running",e.numTasks=e.items.length,e.failedTasks=0,e.completedTasks=0,e.queuedTasks=e.items.map((e,t)=>({item:e,index:t})),e.runningTasks=0,0===e.items.length)return e.state="idle",void this._endRun("done");for(let t=0;t<Math.min(e.maxRunningTasks,e.queuedTasks.length);t++){const t=e.queuedTasks.shift();if(!t)break;this.startTask(t)}}else this._failToStart(t,"run-tasks/invalid-concurrency","Max Running Tasks is "+e.maxRunningTasks+", so no task could ever start",{maxRunningTasks:e.maxRunningTasks});else this._failToStart(t,"run-tasks/no-items","No Items list was provided, so there is nothing to run — an empty list is a completed run, but an absent one is a wiring mistake");else this._failToStart(t,"run-tasks/no-template","No task template is selected, so there is nothing to run")},abort:function(){const e=this._internal,t=this._internal.pendingAbortOutcomes;e.pendingAbortOutcomes=[],"running"===e.state?(e.state="aborted",e.abortOutcomes.push(...t),0===e.activeTasks.size&&(e.queuedTasks=[],e.state="idle",this.sendSignalOnOutput("aborted"),this._endRun("done"))):(0,o.reportOutcomes)(this,t,"unchanged")},itemOutputSignalTriggered:function(e,t,n){const i=this._internal;if("idle"===i.state)return;const o=()=>{if("aborted"===i.state)return i.queuedTasks=[],i.state="idle",this.sendSignalOnOutput("aborted"),void this._endRun("done");if(i.completedTasks===i.numTasks)i.state="idle",0===i.failedTasks?this._endRun("done"):this._endRun("failure",this._runFailureReport(!1));else if(i.stopOnFailure)if(0===i.failedTasks){i.runningTasks++;const e=i.queuedTasks.shift();e&&this.startTask(e)}else i.queuedTasks=[],i.state="idle",this.sendSignalOnOutput("aborted"),this._endRun("failure",this._runFailureReport(!0));else{i.runningTasks++;const e=i.queuedTasks.shift();e&&this.startTask(e)}},r=this._contract();e===r.success?(i.completedTasks++,i.runningTasks--,o()):e===r.failure&&(this.reportTaskFailure(t,n),i.completedTasks++,i.failedTasks++,i.runningTasks--,o()),i.activeTasks.delete(n.id),this.nodeScope.deleteNode(n)},reportTaskFailure(e,t){const n=this._internal,i=this._contract();let o;if(t.hasOutput(i.error))try{o=t.getOutput(i.error).value}catch(e){o="<the "+i.error+" output threw: "+(e instanceof Error?e.message:String(e))+">"}const r=t._runTaskIndex;this.raiseRuntimeError("run-tasks/task-failed","Task "+(void 0===r?"":r+1+" of "+n.numTasks+" ")+"failed"+(null==o||""===o?"":": "+String(o)),{template:n.template,itemIndex:r,itemId:e&&"function"==typeof e.getId?e.getId():void 0,item:e?e.data:void 0,error:o})},_queueOperation(e){this._internal.queuedOperations.push(e),this._runQueueOperations()},async _runQueueOperations(){if(!this.runningOperations){for(this.runningOperations=!0;this._internal.queuedOperations.length;){const e=this._internal.queuedOperations.shift();await e()}this.runningOperations=!1}},_deleteAllTasks(){for(const e of this._internal.activeTasks.values())this.nodeScope.deleteNode(e);this._internal.activeTasks.clear()},_onNodeDeleted(){r.prototype._onNodeDeleted.call(this),this._deleteAllTasks()}}},setup:function(e,t){if(!e.editorConnection||!e.editorConnection.isRunningLocally())return;const n=e.editorConnection;function o(e){const o=()=>(0,i.checkTemplateContract)(n,e,t);function r(e){if(!e)return;const n=t.components[e];n&&(n.on("inputPortAdded",o),n.on("inputPortRemoved",o),n.on("outputPortAdded",o),n.on("outputPortRemoved",o))}o(),r(e.parameters.taskTemplate),e.on("parameterUpdated",function(t){"taskTemplate"===t.name&&(o(),r(e.parameters.taskTemplate))})}t.on("editorImportComplete",()=>{t.on("nodeAdded.RunTasks",function(e){o(e)});for(const e of t.getNodesWithType("RunTasks"))o(e)})}};e.exports=l},4087(e,t,n){"use strict";const i=n(4557),o=n(5162),r=n(5838),s=n(440),a=n(7268),l=n(5332),u=n(9935),c=n(8600),{logJavaScriptNodeError:d,thrownMessage:p}=n(7831),h="js-function-run-waring",f="js-function-no-output-written";function g(e){return e.context?e.context.graphModel:void 0}const m=["function/script-missing","function/script-file-failed","function/script-name-clash","function/scripts-in-cloud"];function y(e,t){const n=g(e);if(!n||"function"!=typeof n.getAllComponents)return[];const i=[];for(const e of n.getAllComponents())for(const n of e.getNodesWithType("JavaScriptFunction"))(0,l.scriptUsesOf)(n.parameters&&n.parameters.uses).includes(t)&&i.push(e.name+" / "+(n.label||n.id));return i}const v={name:"JavaScriptFunction",displayNodeName:"Function",docs:"https://docs.noodl.net/nodes/javascript/function",category:"CustomCode",color:"javascript",ssr:{compat:"partial",note:"Runs user code server-side; code touching window/document fails there (error logged, outputs unchanged)."},nodeDoubleClickAction:{focusPort:"Script"},searchTags:["javascript",...i.ARITHMETIC_SEARCH_TAGS],exportDynamicPorts:!0,initialize:function(){this._internal.inputValues={},this._internal.outputValues={},this._internal.outputWrites=new Set,this._internal.heldWrites=new Set,this._internal.outputValuesProxy=new Proxy(this._internal.outputValues,{set:(e,t,n)=>{if(!this._deleted)return this._internal.outputWrites.add(t),n!==this._internal.outputValues[t]?(this.registerOutputIfNeeded("out-"+t),this._internal.outputValues[t]=n,this.flagOutputDirty("out-"+t),this._internal.heldWrites.delete(t)):this._internal.heldWrites.add(t),!0}}),this._internal._this={}},getInspectInfo(){return[{type:"value",value:{inputs:this._internal.inputValues,outputs:this._internal.outputValues}}]},inputs:{scriptInputs:{type:{name:"proplist",allowEditOnly:!0},group:"Script Inputs",description:"Names of the values the script reads from Inputs, each becoming an input port",set(){}},scriptOutputs:{type:{name:"proplist",allowEditOnly:!0},group:"Script Outputs",description:"Names of the values the script writes to Outputs, each becoming an output port",set(){}},functionScript:{displayName:"Script",description:"JavaScript run when Run fires, reading Inputs.name and writing Outputs.name",plug:"input",type:{name:"string",allowEditOnly:!0,codeeditor:"javascript",codenotation:"function"},group:"General",set(e){if(this.clearRunDiagnostics(),void 0===e)return this._internal.func=void 0,void(this._internal.parseError=void 0);this._internal.func=this.parseScript(e),this.isInputConnected("run")||this.scheduleRun()}},uses:{displayName:"Uses",description:"The project's script files this Function uses. Each one is ready in the code as Scripts.<file name>, so engine/world.js is Scripts.world",group:"General",type:{name:"stringlist",allowEditOnly:!0,editorType:"script-uses"},set(e){this._internal.uses=(0,l.scriptUsesOf)(e),this.clearRunDiagnostics();const t=g(this);!this._internal.listeningForScripts&&t&&(this._internal.listeningForScripts=!0,t.on("scriptsChanged",()=>{!this._deleted&&this._internal.uses&&0!==this._internal.uses.length&&(this.clearRunDiagnostics(),this.isInputConnected("run")||this.scheduleRun())},this)),this._internal.func&&!this.isInputConnected("run")&&this.scheduleRun()}},run:{type:"signal",displayName:"Run",group:"Actions",description:"Runs the script now. This is additional to the inputs that re-run it; untick an input under Run On Value Change to stop that one triggering a run",valueChangedToTrue:function(){this.scheduleRun(this.beginOutcome())}}},outputs:{success:{type:"signal",displayName:"Success",group:"Events",description:"Fires once the script has finished, waiting for an async script to resolve first"},failure:{type:"signal",displayName:"Failure",group:"Events",description:"Fires when the script threw while running, or could not be compiled at all"},...(0,o.outcomeOutputs)({done:"Fires once a Run you triggered has finished, waiting for an async script to resolve first",unchanged:"Fires when there is no script to run yet, which is what a freshly dropped Function looks like"}),error:{type:"string",displayName:"Error",group:"Error",description:"What the script went wrong with, in JavaScript's own words",getter:function(){return this._internal.lastError}}},methods:{_onNodeDeleted:function(){const e=g(this);this._internal.listeningForScripts&&e&&(e.removeListenersWithRef(this),this._internal.listeningForScripts=!1),a.prototype._onNodeDeleted.call(this)},scheduleRun:function(e){e&&(this._internal.pendingRunOutcomes||(this._internal.pendingRunOutcomes=[]),this._internal.pendingRunOutcomes.push(e)),this.runScheduled||(this.runScheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.runScheduled=!1,this._deleted||this.runScript()}))},runScript:async function(){const e=this._internal.func,t=this._internal.pendingRunOutcomes||[];if(this._internal.pendingRunOutcomes=void 0,void 0===e){const e=this._internal.parseError;return void 0!==e?(this._internal.lastError=e,this.flagOutputDirty("error"),this._internal.lastReportedError!==e&&(this._internal.lastReportedError=e,this.raiseRuntimeError("function/script-not-compiled","The script could not be compiled: "+e,{error:e})),void(t.length>0?(0,o.reportOutcomes)(this,t,"failure",{code:"function/script-not-compiled",message:"The script could not be compiled: "+e,raise:!1}):this.sendSignalOnOutput("failure"))):void(0,o.reportOutcomes)(this,t,"unchanged")}const n=function(e){const t=e._internal.uses||[],n={};if(0===t.length)return{scripts:n};const i=e.context&&e.context.editorConnection;if(i&&"cloud"===i.runtimeType)return{failure:{code:"function/scripts-in-cloud",message:"Script files don't run in cloud functions yet. This Function uses "+t.map(e=>"scripts/"+e).join(", "),detail:{uses:t}}};const o=g(e),r=o&&o.scriptFiles,s={};for(const i of t){const o=(0,l.scriptAlias)(i);if(void 0!==s[o])return{failure:{code:"function/script-name-clash",message:"scripts/"+s[o]+" and scripts/"+i+" would both be Scripts."+o+". Rename one of the files",detail:{alias:o,paths:[s[o],i]}}};s[o]=i;try{if(!r)throw new l.ScriptFileError("script/missing",i,"There is no script file scripts/"+i);n[o]=r.load(i)}catch(n){const o=n instanceof l.ScriptFileError?n:new l.ScriptFileError("script/threw",i,n&&n.message?n.message:String(n));return{failure:{code:"script/missing"===o.code?"function/script-missing":"function/script-file-failed",message:o.describe(),detail:{path:o.path,line:o.line,column:o.column,uses:t,users:y(e,o.path)},error:o}}}}return{scripts:n}}(this);if("failure"in n){const{code:e,message:i,detail:r,error:s}=n.failure;this._internal.lastError=i,this.flagOutputDirty("error");const a=!s||!s.reported;return s&&(s.reported=!0),void(t.length>0?(0,o.reportOutcomes)(this,t,"failure",{code:e,message:i,detail:r,raise:a}):(a&&this.raiseRuntimeError(e,i,r),this.sendSignalOnOutput("failure")))}const i=this.context.editorConnection;if(i)for(const e of m)i.clearWarning(this.nodeScope.componentOwner.name,this.id,e);const r=this._internal.inputValues,a=this._internal.outputValuesProxy;for(const e in this.model.outputPorts)if(this._isSignalType(e)){const t=()=>{var t;this._internal.outputWrites.add(e.substring(4)),(t=this)._internal.heldWrites.forEach(e=>{t.registerOutputIfNeeded("out-"+e),t.flagOutputDirty("out-"+e)}),t._internal.heldWrites.clear(),this.hasOutput(e)&&this.sendSignalOnOutput(e)},n=t;n.send=t,this._internal.outputValues[e.substring(4)]=n}const u=c.createNoodlAPI(this.nodeScope.modelScope);u.Inputs=r,u.Outputs=a,this._internal.outputWrites=new Set,this._internal.heldWrites=new Set;try{await e.apply(this._internal._this,[r,a,u,c.getComponentScopeForNode(this),n.scripts]),this._deleted||(this.reportOutputSilence(),this._internal.lastError&&(this._internal.lastError="",this.flagOutputDirty("error")),this.sendSignalOnOutput("success"),(0,o.reportOutcomes)(this,t,"done"))}catch(e){d(e);const n=p(e),i=(0,s.userPositionForError)(e),r=(0,s.hintForThrownError)(e,this.model);if(this.context.editorConnection&&this.context.isWarningTypeEnabled("javascriptExecution")&&(this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,f),this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,h,{showGlobally:!0,message:(0,s.runtimeErrorMessage)(n,i,r),stack:e?e.stack:void 0,line:i?i.line:void 0,column:i?i.column:void 0,hint:r})),this._deleted)return;this._internal.lastError=n,this.flagOutputDirty("error");const a="The script threw: "+this._internal.lastError,l={error:this._internal.lastError,line:i?i.line:void 0,column:i?i.column:void 0,hint:r};t.length>0?(0,o.reportOutcomes)(this,t,"failure",{code:"function/script-threw",message:a,detail:l}):(this.raiseRuntimeError("function/script-threw",a,l),this.sendSignalOnOutput("failure"))}},reportOutputSilence:function(){const e=this.context.editorConnection;if(!e||!this.context.isWarningTypeEnabled("javascriptExecution"))return;const t=this.nodeScope.componentOwner.name;e.clearWarning(t,this.id,h);const n=(0,s.declaredOutputPorts)(this.model);0===n.length||this._internal.outputWrites.size>0?e.clearWarning(t,this.id,f):e.sendWarning(t,this.id,f,{showGlobally:!1,level:"warning",message:(0,s.noOutputWrittenMessage)(n)})},clearRunDiagnostics:function(){this._internal.lastError&&(this._internal.lastError="",this.flagOutputDirty("error"));const e=this.context.editorConnection;if(!e||!this.nodeScope||!this.nodeScope.componentOwner)return;const t=this.nodeScope.componentOwner.name;e.clearWarning(t,this.id,h),e.clearWarning(t,this.id,f)},setScriptInputValue:function(e,t){const n=this._internal.inputValues[e];this._internal.inputValues[e]=t,this.shouldRunOnValueChanged("in-"+e,n,t)&&this.scheduleRun()},getScriptOutputValue:function(e){if(!this._isSignalType(e))return this._internal.outputValues[e]},setScriptInputType:function(e,t){this._internal.inputTypes[e]=t},setScriptOutputType:function(e,t){this._internal.outputTypes[e]=t},parseScript:function(e){let t;try{t=new(0,Object.getPrototypeOf(async function(){}).constructor)("Inputs","Outputs","Noodl","Component","Scripts",c.getCodePrefix()+e),this._internal.parseError=void 0,this._internal.lastReportedError=void 0}catch(e){console.log("Error while parsing action script: "+e),this._internal.parseError=e&&e.message?String(e.message):String(e)}return t},_isSignalType:function(e){return this.model.outputPorts[e]&&"signal"===this.model.outputPorts[e].type},registerInputIfNeeded:function(e){if(!this.hasInput(e)){if(e.startsWith("in-")){const t=e.substring(3),n={set:this.setScriptInputValue.bind(this,t)};this.model&&this.model.parameters["intype-"+t]&&(n.type=this.model.parameters["intype-"+t]),this.registerInput(e,n),this.registerRunOnValueChangeInput(e,t)}if(e.startsWith("intype-")){const t=e.substring(7);this.registerInput(e,{set(e){this.hasInput("in"+t)&&(this.getInput("in"+t).type=e)}})}e.startsWith("outtype-")&&this.registerInput(e,{set(){}})}},registerOutputIfNeeded:function(e){if(!this.hasOutput(e)&&e.startsWith("out-")){const t=e.substring(4),n=this.model&&this.model.parameters&&this.model.parameters["outtype-"+t];return this.registerOutput(e,{type:n||"*",getter:this.getScriptOutputValue.bind(this,t)})}}}};const b=[{value:"string",label:"String"},{value:"boolean",label:"Boolean"},{value:"number",label:"Number"},{value:"object",label:"Object"},{value:"date",label:"Date"},{value:"array",label:"Array"},{value:"color",label:"Color"}],w={node:v,setup:function(e,t){function n(t){function n(){const n=[],i=[{value:"*",label:"Any"}].concat(b,[{value:"signal",label:"Signal"}]),o=t.parameters.scriptOutputs;void 0!==o&&o.length>0&&o.forEach(e=>{n.push({name:"outtype-"+e.label,displayName:"Type",editorName:e.label+" | Type",plug:"input",type:{name:"enum",enums:i,allowEditOnly:!0},default:"*",parent:"scriptOutputs",parentItemId:e.id}),n.push({name:"out-"+e.label,displayName:e.label,plug:"output",type:t.parameters["outtype-"+e.label]||"*",group:"Outputs"})});const s=t.parameters.scriptInputs;void 0!==s&&s.length>0&&s.forEach(e=>{n.push({name:"intype-"+e.label,displayName:"Type",editorName:e.label+" | Type",plug:"input",type:{name:"enum",enums:b,allowEditOnly:!0},default:"string",parent:"scriptInputs",parentItemId:e.id}),n.push({name:"in-"+e.label,displayName:e.label,plug:"input",type:t.parameters["intype-"+e.label]||"string",group:"Inputs"})}),function(e,t,n,i,o){if(i.editorConnection.clearWarning(n.component.name,n.id,h),i.editorConnection.clearWarning(n.component.name,n.id,f),void 0!==e){try{new(0,Object.getPrototypeOf(async function(){}).constructor)("Inputs","Outputs","Noodl","Component",e),i.editorConnection.clearWarning(n.component.name,n.id,"js-function-parse-waring")}catch(e){i.editorConnection.sendWarning(n.component.name,n.id,"js-function-parse-waring",{showGlobally:!0,message:e.message})}!function(e,t){const n=(0,u.functionScriptPortNames)(e),i=(e,n,i)=>{t.some(t=>t.name===e&&t.plug===n)||t.push({name:e,displayName:e.slice(e.indexOf("-")+1),plug:n,type:i,group:"input"===n?"Inputs":"Outputs"})};for(const e of n.inputs)i("in-"+e,"input","*");for(const e of n.signals)i("out-"+e,"output","signal");for(const e of n.outputs)i("out-"+e,"output","*")}(e,o)}else i.editorConnection.clearWarning(n.component.name,n.id,"js-function-parse-waring")}(t.parameters.functionScript,0,t,e,n),n.forEach(e=>{"signal"===e.type&&"output"===e.plug&&(t.outputPorts[e.name]=e)});const a=[],l={};n.forEach(e=>{const t=e.name;"input"===e.plug&&t.startsWith("in-")&&-1===a.indexOf(t)&&(a.push(t),l[t]=t.substring(3))}),e.editorConnection.sendDynamicPorts(t.id,n.concat((0,r.runOnChangeDynamicPorts)(a,l)))}n(),t.on("parameterUpdated",function(){n()})}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",()=>{t.on("nodeAdded.JavaScriptFunction",function(e){n(e)});for(const e of t.getNodesWithType("JavaScriptFunction"))n(e)})}};e.exports=w},3316(e){"use strict";function t(e,t){this._internal.inputValues[e]!==t&&(this._internal.inputValues[e]=t,this._internal.resultDirty=!0,this.scheduleFormat())}function n(e,t,n){const i=(t.match(/\{[A-Za-z0-9_]*\}/g)||[]).map(function(e){return e.replace("{","").replace("}","")}).filter(function(e,t,n){return n.indexOf(e)===t}).map(function(e){return{name:e,type:"string",plug:"input"}});n.sendDynamicPorts(e,i)}const i={node:{name:"String Format",docs:"https://docs.noodl.net/nodes/string-manipulation/string-format",category:"String Manipulation",usePortAsLabel:"format",portLabelTruncationMode:"length",initialize(){const e=this._internal;e.format="",e.cachedResult="",e.resultDirty=!1,e.inputValues={}},getInspectInfo(){return this.formatValue()},inputs:{format:{group:"Values",type:{name:"string",multiline:!0},displayName:"Format",description:"Template text; each {placeholder} becomes an input port, and every copy of a placeholder is filled",set(e){const t=String(e);this._internal.format!==t&&(this._internal.format=t,this._internal.resultDirty=!0,this.scheduleFormat())}}},outputs:{formatted:{group:"Values",type:"string",displayName:"Formatted",description:"Format with every placeholder substituted, and an unset placeholder replaced by nothing",get(){return this.formatValue()}}},methods:{formatValue(){const e=this._internal;if(e.resultDirty){let t=e.format;const n=e.format.match(/\{[A-Za-z0-9_]*\}/g);let i=[];n&&(i=n.map(function(e){return e.replace("{","").replace("}","")})),i.forEach(function(n){const i=e.inputValues[n],o=void 0!==i?String(i):"";t=t.replace("{"+n+"}",()=>o)}),e.cachedResult=t,e.resultDirty=!1}return e.cachedResult},registerInputIfNeeded(e){this.hasInput(e)||this.registerInput(e,{set:t.bind(this,e)})},scheduleFormat(){this.formatScheduled||(this.formatScheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{try{this.formatValue(),this.flagOutputDirty("formatted")}finally{this.formatScheduled=!1}}))}}},setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.String Format",function(t){t.parameters.format&&n(t.id,t.parameters.format,e.editorConnection),t.on("parameterUpdated",function(i){"format"===i.name&&n(t.id,t.parameters.format,e.editorConnection)})})}};e.exports=i},5638(e){"use strict";const t={node:{name:"String Mapper",docs:"https://docs.noodl.net/nodes/string-manipulation/string-mapper",category:"Utilities",initialize:function(){this._internal.inputs=[],this._internal.mappings=[]},getInspectInfo(){return this._internal.mappedString},numberedInputs:{input:{type:"string",displayPrefix:"Input",group:"Inputs",index:10,createSetter:e=>function(t){this._internal.inputs[e]=null==t?"":t.toString(),this.scheduleMapping()}},output:{type:"string",displayPrefix:"Mapping",index:1001,group:"Mappings",createSetter:e=>function(t){this._internal.mappings[e]=null==t?"":t.toString(),this.scheduleMapping()}}},inputs:{inputString:{group:"Values",type:{name:"string"},index:1,displayName:"Input String",description:"The string to look up among the numbered inputs",set:function(e){this._internal.currentInputString=void 0===e?void 0:null===e?"":e.toString(),this.scheduleMapping()}},defaultMapping:{type:"string",displayName:"Default",index:1e3,group:"Mappings",description:"Published when Input String matches none of the numbered inputs",set:function(e){this._internal.defaultMapping=e,this.scheduleMapping()}}},outputs:{mappedString:{type:"string",displayName:"Mapped String",group:"Values",description:"The mapping paired with the input that matched, or Default when none did",getter:function(){return this._internal.mappedString}}},prototypeExtensions:{doMapping:function(){this._internal.hasScheduledFetch=!1;const e=this._internal.inputs.indexOf(this._internal.currentInputString);this._internal.mappedString=-1!==e?this._internal.mappings[e]:this._internal.defaultMapping,this.flagOutputDirty("mappedString")},scheduleMapping:function(){const e=this._internal;e.hasScheduledFetch||(e.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated(this.doMapping.bind(this)))}}}};e.exports=t},7171(e){"use strict";const t={node:{name:"Substring",docs:"https://docs.noodl.net/nodes/string-manipulation/substring",category:"String Manipulation",initialize:function(){const e=this._internal;e.startIndex=0,e.endIndex=-1,e.cachedResult="",e.inputString="",e.resultDirty=!1},inputs:{start:{group:"Values",type:"number",displayName:"Start",description:"Position of the first character to keep, counting from zero; a negative value counts back from the end",default:0,set:function(e){this._internal.startIndex=e,this._internal.resultDirty=!0,this.flagOutputDirty("result")}},end:{group:"Values",type:"number",displayName:"End",description:"Position to stop before; -1, the default, runs to the end of the string, and 0 yields an empty result",default:-1,set:function(e){this._internal.endIndex=e,this._internal.resultDirty=!0,this.flagOutputDirty("result")}},string:{group:"Values",type:{name:"string"},displayName:"String",description:"Text to take the substring from; an empty value (null) counts as empty text",default:"",set:function(e){this._internal.inputString=null==e?"":String(e),this._internal.resultDirty=!0,this.flagOutputDirty("result")}}},outputs:{result:{group:"Values",type:"string",displayName:"Result",description:"The section of String between Start and End",getter:function(){const e=this._internal;return e.resultDirty&&(-1===Number(e.endIndex)?e.cachedResult=e.inputString.substr(e.startIndex):e.cachedResult=e.inputString.substr(e.startIndex,e.endIndex-e.startIndex),e.resultDirty=!1),e.cachedResult}}}}};e.exports=t},9346(e,t,n){"use strict";const i=n(5162),o={name:"Switch",docs:"https://docs.noodl.net/nodes/logic/switch",category:"Logic",initialize(){this._internal.state=!1,this._internal.initialized=!1},getInspectInfo(){return[{type:"value",value:this._internal.state}]},inputs:{on:{displayName:"On",group:"Change State",description:"Switches on, or fires Unchanged if it is already on",valueChangedToTrue(){this.setStateByAction(!0)}},off:{displayName:"Off",group:"Change State",description:"Switches off, or fires Unchanged if it is already off",valueChangedToTrue(){this.setStateByAction(!1)}},flip:{displayName:"Flip",group:"Change State",description:"Switches to whichever state it is not currently in",valueChangedToTrue(){this.setStateByAction(!this._internal.state)}},onFromStart:{type:"boolean",displayName:"State",group:"General",description:"State to start in, and setting it announces a switch on Switched even though nothing switched",default:!1,set(e){this._internal.state=!!e,this.flagOutputDirty("state"),this.emitSignals()}}},outputs:{state:{group:"Values",type:"boolean",displayName:"Current State",description:"True while the switch is on — wire it into a mounted or visible port for a gate that turns on AND off",getter(){return this._internal.state}},switched:{displayName:"Switched",type:"signal",group:"Events",description:"Fires on every state change, alongside whichever of Switched To On and Switched To Off applies"},switchedToOn:{displayName:"Switched To On",type:"signal",group:"Events",description:"Fires when the switch becomes on"},switchedToOff:{displayName:"Switched To Off",type:"signal",group:"Events",description:"Fires when the switch becomes off"},...(0,i.outcomeOutputs)({done:"Fires when the switch actually changed state",unchanged:"Fires when it was already in that state, so none of the Switched signals fired"})},prototypeExtensions:{setStateByAction(e){const t=this.beginOutcome();this._internal.state!==e?(this._internal.state=e,this.flagOutputDirty("state"),this.emitSignals(),this.reportOutcome(t,"done")):this.reportOutcome(t,"unchanged")},emitSignals(){!0===this._internal.state?this.sendSignalOnOutput("switchedToOn"):this.sendSignalOnOutput("switchedToOff"),this.sendSignalOnOutput("switched")}}};e.exports={node:o}},7452(e,t,n){"use strict";const i=n(5162),o=n(6835),r={node:{name:"Unique Id",docs:"https://docs.noodl.net/nodes/utilities/unique-id",category:"String Manipulation",initialize:function(){this._internal.guid=o.guid()},getInspectInfo(){return this._internal.guid},inputs:{new:{group:"Actions",displayName:"New",description:"Generates a fresh id, replacing the one on Id",valueChangedToTrue:function(){const e=this._internal,t=this.beginOutcome();e.guid=o.guid(),this.flagOutputDirty("guid"),this.reportOutcome(t,"done")}}},outputs:{guid:{group:"Values",type:"string",displayName:"Id",description:"A short random id — 10 characters, from Math.random(). Good for keying a list. For a record id, an idempotency key or anything that must be unguessable, use the UUID node instead",getter:function(){return this._internal.guid}},...(0,i.outcomeOutputs)({done:"Fires once a new id is available on Id"})},prototypeExtensions:{}}};e.exports=r},3548(e,t,n){"use strict";const i=n(5162),o=n(2114),r=n(1711),s=n(7054),a="user/set-properties-failed",l=n(3538),u={name:"net.noodl.user.SetUserProperties",docs:"https://docs.noodl.net/nodes/data/user/set-user-properties",displayNodeName:"Set User Properties",category:"Cloud Services",color:"data",initialize:function(){this._internal.userProperties={}},getInspectInfo(){},outputs:{...(0,i.outcomeOutputs)({done:"Fires once the user record has been written",failure:"Fires when the user record could not be written, after the reason has been reported on the error channel"}),error:{type:"string",displayName:"Error",group:"Error",description:"Why the last write failed; empty until one does",getter:function(){return this._internal.error}}},inputs:{store:{displayName:"Do",group:"Actions",description:"Writes the values below to the signed-in user, and fails when nobody is signed in",valueChangedToTrue:function(){this.scheduleStore()}},email:{displayName:"Email",type:"string",group:"General",description:"New email address for the signed-in user; leave blank to keep the current one",set:function(e){this._internal.email=e}},username:{displayName:"Username",type:"string",group:"General",description:"New username for the signed-in user; leave blank to keep the current one",set:function(e){this._internal.username=e}}},methods:{setError:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,i.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:a,message:e})},clearWarnings(){if(this.context.editorConnection){const e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,a),this.context.editorConnection.clearWarning(e,this.id,"user-set-warning")}},scheduleStore:function(){const e=this._internal;(e.pendingStore||(e.pendingStore=[])).push(this.beginOutcome()),!0!==this.storeScheduled&&(this.storeScheduled=!0,this.scheduleAfterInputsHaveUpdated(()=>{this.storeScheduled=!1;const t=e.pendingStore||[];e.pendingStore=[],l.Services.UserService.forScope(this.nodeScope.modelScope).setUserProperties({backendId:this._internal.backendId,email:this._internal.email,username:this._internal.username,properties:e.userProperties,success:()=>{(0,i.reportOutcomes)(this,t,"done")},error:e=>{this.setError(e,t)}})}))},setUserProperty:function(e,t){this._internal.userProperties[e]=t},registerInputIfNeeded:function(e){if(!this.hasInput(e))return"backendId"===e?this.registerInput(e,{set:e=>{this._internal.backendId=e}}):e.startsWith("prop-")?this.registerInput(e,{set:this.setUserProperty.bind(this,e.substring(5))}):void 0}}},c={node:u,setup:function(e,t){function n(n){const i=()=>function(e,t,n,i){const a=(0,s.userSchemaContext)(i,t),l=(0,o.isParseWireContext)(a)?"undefined"==typeof _noodl_cloud_runtime_version?s.USER_INPUT_IGNORE_PARSE_BROWSER:s.USER_INPUT_IGNORE_PARSE_CLOUD:s.USER_INPUT_IGNORE_REST,c=[].concat((0,s.userBackendPickerPorts)(a)).concat((0,s.userPropertyPorts)(a,{plug:"input",ignore:l}));(0,r.sendSchemaPorts)(n,e,c,{staticPorts:(0,r.staticPortNames)(u)})}(n.id,n.parameters,e.editorConnection,t);i(),n.on("parameterUpdated",i),t.on("metadataChanged.systemCollections",i),t.on("metadataChanged.dbCollections",i),t.on("metadataChanged.backendServices",i)}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",()=>{t.on("nodeAdded.net.noodl.user.SetUserProperties",function(e){n(e)});for(const e of t.getNodesWithType("net.noodl.user.SetUserProperties"))n(e)})}};e.exports=c},7054(e,t,n){"use strict";t.USER_INPUT_IGNORE_REST=t.USER_INPUT_IGNORE_PARSE_CLOUD=t.USER_INPUT_IGNORE_PARSE_BROWSER=t.USER_OUTPUT_IGNORE_REST=t.USER_OUTPUT_IGNORE_PARSE=t.XI=void 0,t.userSchemaContext=function(e,n){const i=(0,r.metaDataSources)(e),l=(0,s.resolveSchemaPortContext)({graphModel:e,parameters:n,collectionParam:"__none",extraBackends:a(i),activeBackendId:(0,o.defaultBackendId)(i)}),u=void 0===(c=l.backendType)?"_User":t.XI[c];var c;return Object.assign({},l,{collectionName:u,selectedCollection:u?l.collections.find(e=>e.name===u):void 0})},t.userBackendPickerPorts=function(e){return(0,s.backendPickerPorts)(e,{hideWhenSingleBackend:!0,group:"General"})},t.userPropertyPorts=function(e,t){const n=[];if(!e.selectedCollection)return n;for(const i of e.selectedCollection.fields||[])i&&i.name&&-1===t.ignore.indexOf(i.name)&&(l(i)||(0,s.shouldShowField)(i)&&(n.push({name:"prop-"+i.name,displayName:i.displayName||i.name,type:(0,r.recordPortType)(i),plug:t.plug,group:"Properties"}),t.includeChangedSignals&&n.push({name:"changed-"+i.name,displayName:(i.displayName||i.name)+" Changed",type:"signal",plug:"output",group:"Events"})));return n};const i=n(3972),o=n(8479),r=n(2114),s=n(1711);function a(e){const t=(0,o.endpointBackendEntry)(e.cloudservices);return t?[t]:[]}function l(e){return"Relation"===e.nativeType||"relation"===e.type||"many-to-many"===e.relationType}t.XI=Object.freeze({parse:"_User",nodegx:"_User",directus:"directus_users",pocketbase:"users"}),t.USER_OUTPUT_IGNORE_PARSE=Object.freeze(["authData","password","username","email"]),t.USER_OUTPUT_IGNORE_REST=Object.freeze(["password","tokenKey","tfa_secret","username","email","id","objectId"]),t.USER_INPUT_IGNORE_PARSE_BROWSER=Object.freeze(["authData","createdAt","updatedAt","email","username","emailVerified","password"]),t.USER_INPUT_IGNORE_PARSE_CLOUD=Object.freeze(["authData","createdAt","updatedAt","email","username"]),t.USER_INPUT_IGNORE_REST=Object.freeze(i.REST_USER_READONLY_FIELDS.concat(["username","email","tfa_secret"]))},4427(e,t,n){"use strict";const i="user/fetch-failed",o=n(3538),{Node:r}=n(3538),s=n(5162),a=n(1711),l=n(7054),u=n(2114),c={name:"net.noodl.user.User",docs:"https://docs.noodl.net/nodes/data/user/user-node",displayNodeName:"User",category:"Cloud Services",color:"data",ssr:{compat:"partial",note:"Sessions live in browser storage; a server render always sees a logged-out user."},runOnValueChange:{controlSignal:"fetch",sources:[{name:"user",displayName:"User properties"}]},initialize:function(){const e=this;this._internal.onModelChangedCallback=function(t){e.shouldRunOnValueChange("user")&&(e.hasOutput("prop-"+t.name)&&e.flagOutputDirty("prop-"+t.name),e.hasOutput("changed-"+t.name)&&e.sendSignalOnOutput("changed-"+t.name),e.sendSignalOnOutput("changed"))};const t=o.Services.UserService.forScope(this.nodeScope.modelScope);this.setUserModel(this.currentUserModel()),t.on("loggedIn",()=>{this.setUserModel(this.currentUserModel()),this.hasOutput("loggedIn")&&this.sendSignalOnOutput("loggedIn")}),t.on("sessionGained",()=>{this.setUserModel(this.currentUserModel())}),t.on("loggedOut",()=>{this.setUserModel(this.currentUserModel()),this.hasOutput("loggedOut")&&this.sendSignalOnOutput("loggedOut")}),t.on("sessionLost",()=>{this.setUserModel(this.currentUserModel()),this.hasOutput("sessionLost")&&this.sendSignalOnOutput("sessionLost")})},getInspectInfo(){const e=this._internal.model;return e?[{type:"text",value:"Id: "+e.getId()},{type:"value",value:this._internal.model.data}]:"[No Model]"},outputs:{id:{type:"string",displayName:"Id",group:"General",description:"Id of the signed-in user record; empty while nobody is signed in",getter:function(){return void 0!==this._internal.model?this._internal.model.getId():""}},fetched:{type:"signal",displayName:"Fetched",group:"Events",description:"Fires once the user record has been re-read and the outputs below are up to date"},changed:{type:"signal",displayName:"Changed",group:"Events",description:"Fires when a property of the signed-in user changes, including a change another node made"},...(0,s.outcomeOutputs)({done:"Fires when a Fetch finished and the outputs below are up to date",failure:"Fires when the user record could not be read, after the reason has been reported on the error channel"}),error:{type:"string",displayName:"Error",group:"Error",description:"Why the last read failed; empty until one does",getter:function(){return this._internal.error}},roles:{type:"array",displayName:"Roles",group:"General",description:"Roles the signed-in user is in, resolved by the server on each session read; empty while nobody is signed in, and not set on backends that do not track roles",getter:function(){if(void 0===this._internal.model)return null;const e=this._internal.model.get("roles");return Array.isArray(e)?e:void 0}},username:{type:"string",displayName:"Username",group:"General",description:"Username of the signed-in user; empty while nobody is signed in",getter:function(){return void 0!==this._internal.model?this._internal.model.get("username"):""}},email:{type:"string",displayName:"Email",group:"General",description:"Email address of the signed-in user; empty while nobody is signed in",getter:function(){return void 0!==this._internal.model?this._internal.model.get("email"):""}},authenticated:{type:"boolean",displayName:"Authenticated",group:"General",description:"True while somebody is signed in on this device; a server render always sees false",getter:function(){return void 0!==this._internal.model}}},inputs:{fetch:{displayName:"Fetch",group:"Actions",description:"Re-reads the signed-in user from the backend, which is also how an expired session is discovered",valueChangedToTrue:function(){this.scheduleFetch()}}},methods:{_onNodeDeleted:function(){r.prototype._onNodeDeleted.call(this),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},scheduleOnce:function(e,t){const n=this,i="hasScheduled"+e;this._internal[i]||(this._internal[i]=!0,this.scheduleAfterInputsHaveUpdated(function(){n._internal[i]=!1,t()}))},setError:function(e,t){this._internal.error=e,this.flagOutputDirty("error"),(0,s.reportOutcomes)(this,t||[this.beginOutcome()],"failure",{code:i,message:e})},clearWarnings(){if(this.context.editorConnection){const e=this.nodeScope.componentOwner.name;this.context.editorConnection.clearWarning(e,this.id,i),this.context.editorConnection.clearWarning(e,this.id,"user-warning")}},setUserModel(e){const t=this._internal,n=t.model;t.model!==e&&(t.model&&t.model.off("change",t.onModelChangedCallback),t.model=e,e&&e.on("change",t.onModelChangedCallback)),this.flagOutputDirty("id"),this.flagOutputDirty("authenticated"),this.flagOutputDirty("email"),this.flagOutputDirty("username"),this.flagOutputDirty("roles");const i=e||n;if(i)for(const e in i.data)this.hasOutput("prop-"+e)&&this.flagOutputDirty("prop-"+e)},currentUserModel:function(){const e=o.Services.UserService.forScope(this.nodeScope.modelScope);return"function"==typeof e.currentFor?e.currentFor(this._internal.backendId):e.current},scheduleFetch:function(){(this._internal.pendingFetch||(this._internal.pendingFetch=[])).push(this.beginOutcome()),this.scheduleOnce("Fetch",()=>{const e=this._internal.pendingFetch||[];this._internal.pendingFetch=[],o.Services.UserService.forScope(this.nodeScope.modelScope).fetchCurrentUser({backendId:this._internal.backendId,success:()=>{this.setUserModel(this.currentUserModel()),this.sendSignalOnOutput("fetched"),(0,s.reportOutcomes)(this,e,"done")},error:t=>{this.setError(t||"Failed to fetch.",e)}})})},registerInputIfNeeded:function(e){this.hasInput(e)||"backendId"===e&&this.registerInput(e,{set:e=>{this._internal.backendId=e,this.setUserModel(this.currentUserModel())}})},registerOutputIfNeeded:function(e){this.hasOutput(e)||("loggedOut"!==e&&"loggedIn"!==e&&"sessionLost"!==e?(e.startsWith("prop-")&&this.registerOutput(e,{getter:this.getUserProperty.bind(this,e.substring(5))}),e.startsWith("changed-")&&this.registerOutput(e,{type:"signal",getter:()=>{}})):this.registerOutput(e,{getter:()=>{}}))},getUserProperty:function(e){return void 0!==this._internal.model?this._internal.model.get(e):null}}},d={node:c,setup:function(e,t){function n(n){const i=()=>function(e,t,n,i){const o=(0,l.userSchemaContext)(i,t),r=[].concat((0,l.userBackendPickerPorts)(o)).concat((0,l.userPropertyPorts)(o,{plug:"output",includeChangedSignals:!0,ignore:(0,u.isParseWireContext)(o)?l.USER_OUTPUT_IGNORE_PARSE:l.USER_OUTPUT_IGNORE_REST}));"undefined"==typeof _noodl_cloud_runtime_version&&(r.push({plug:"output",name:"loggedIn",type:"signal",displayName:"Logged In",group:"Events"}),r.push({plug:"output",name:"loggedOut",type:"signal",displayName:"Logged Out",group:"Events"}),r.push({plug:"output",name:"sessionLost",type:"signal",displayName:"Session Lost",group:"Events"})),(0,a.sendSchemaPorts)(n,e,r,{staticPorts:(0,a.staticPortNames)(c)})}(n.id,n.parameters,e.editorConnection,t);i(),n.on("parameterUpdated",i),t.on("metadataChanged.systemCollections",i),t.on("metadataChanged.dbCollections",i),t.on("metadataChanged.backendServices",i)}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",()=>{t.on("nodeAdded.net.noodl.user.User",function(e){n(e)});for(const e of t.getNodesWithType("net.noodl.user.User"))n(e)})}};e.exports=d},6154(e,t,n){"use strict";const i={node:(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(n(6141)).default.createDefinition({name:"Boolean",docs:"https://docs.noodl.net/nodes/data/boolean",startValue:!1,type:{name:"boolean"},cast:function(e){return Boolean(e)},emptyOptions:[{value:"null",label:"Null (default)",coerce:null},{value:"false",label:"False",coerce:!1}]})};e.exports=i},8165(e,t,n){"use strict";const i={node:(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(n(6141)).default.createDefinition({name:"Number",docs:"https://docs.noodl.net/nodes/data/number",startValue:0,nodeDoubleClickAction:{focusPort:"value"},type:{name:"number"},cast:function(e){return Number(e)},emptyOptions:[{value:"null",label:"Null (default)",coerce:null},{value:"zero",label:"Zero (0)",coerce:0}]})};e.exports=i},1157(e,t,n){"use strict";const i=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(n(6141)),{NodeDefinition:o}=n(3538),r=i.default.createDefinition({name:"String",docs:"https://docs.noodl.net/nodes/data/string",startValue:"",nodeDoubleClickAction:{focusPort:"value"},type:{name:"string"},cast:function(e){return String(e)},onChanged:function(){this.flagOutputDirty("length")},emptyOptions:[{value:"null",label:"Null (default)",coerce:null},{value:"empty-string",label:'Empty string ("")',coerce:""}]});o.extend(r,{usePortAsLabel:"value",portLabelTruncationMode:"length",outputs:{length:{group:"Values",type:"number",displayName:"Length",description:"0 when the Variable is cleared (`savedValue` is `null`) — there is no text to measure, and 0 is what an author reading this as a plain number expects, rather than a thrown error or `null` itself.",getter:function(){const e=this._internal.currentValue;return"string"==typeof e?e.length:0}}}});const s={node:r};e.exports=s},6141(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createDefinition=r;const i=n(5162),o={done:"Fires when a Set stored a value the Variable was not already holding",unchanged:"Fires when a Set stored the value it already held, so nothing changed. ⚠️ With Value left ticked under Run On Value Change this is the common case, because Value has already stored by the time Set fires"};function r(e){return{name:e.name,docs:e.docs,nodeDoubleClickAction:e.nodeDoubleClickAction,category:"Variables",runOnValueChange:{controlSignal:"saveValue",inputs:["value"]},initialize:function(){this._internal.currentValue=e.startValue,this._internal.latestValue=void 0,this._internal.hasBeenSet=!1,this._internal.treatEmptyAs=e.emptyOptions[0].value},getInspectInfo(){return[{type:"color"===e.type.name?"color":"text",value:this._internal.currentValue}]},inputs:{value:{group:"Values",type:e.type,displayName:"Value",default:e.startValue,description:'The empty-value contract (dev-docs/reference/EMPTY-VALUE-CONTRACT.md): `undefined` abstains and leaves the Variable\'s stored value untouched. `null` is a real value — it clears the Variable, is stored, and fires Changed. What "cleared" is stored as is controlled by `Treat empty as` (null by default).',set:function(e){if(void 0===e)return;const t=this._internal.latestValue;this._internal.latestValue=e,this.shouldRunOnValueChanged("value",t,e)&&this.setValueTo(e)}},treatEmptyAs:{type:{name:"enum",enums:e.emptyOptions.map(e=>({label:e.label,value:e.value})),allowEditOnly:!0},displayName:"Treat empty as",group:"Advanced",default:e.emptyOptions[0].value,description:"Back-compat for graphs written before Variables were nullable. `null` (default) keeps a cleared value distinguishable from a real "+(e.emptyOptions[1]?JSON.stringify(e.emptyOptions[1].coerce):"empty value")+". Choosing another option restores the pre-NDA-003 coercion for authors who relied on it.",set:function(e){this._internal.treatEmptyAs=e}},saveValue:{group:"Actions",displayName:"Set",description:"Stores the latest value now. This is additional to Value storing on change; untick Value under Run On Value Change to stop that",valueChangedToTrue:function(){const e=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(function(){const t=this.setValueTo(this._internal.latestValue);this.reportOutcome(e,t?"done":"unchanged")})}},...(0,i.outcomeInputs)(o)},outputs:{savedValue:{group:"Values",type:e.type.name,displayName:"Value",description:"Can be `null` — a cleared Variable (see `value`'s description) stores and emits null by default, not this type's zero value, unless `Treat empty as` says otherwise.",getter:function(){return this._internal.currentValue}},changed:{group:"Events",type:"signal",displayName:"Changed",description:"Fires whenever the stored value actually changed, however it was reached — including Value writing straight through under Run On Value Change. It is a value-level event, not the outcome of a Set"},...(0,i.outcomeOutputs)(o)},prototypeExtensions:{setValueTo:function(t){var n;if(void 0===t)return!1;const i=null!==(n=e.emptyOptions.find(e=>e.value===this._internal.treatEmptyAs))&&void 0!==n?n:e.emptyOptions[0];let o;null===t?o=i.coerce:(o=e.cast(t),"number"==typeof o&&Number.isNaN(o)&&(o=i.coerce));const r=!this._internal.hasBeenSet||this._internal.currentValue!==o;return this._internal.currentValue=o,this._internal.hasBeenSet=!0,r&&(this.flagOutputDirty("savedValue"),this.sendSignalOnOutput("changed"),e.onChanged&&e.onChanged.call(this)),r}}}}t.default={createDefinition:r}},9850(e,t,n){"use strict";const i=n(2845);function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const r=function(e,t){this.context=e,this.nodes=Object.create(null),this.componentOwner=t,this.componentInstanceChildren=Object.create(null)};r.prototype.addConnection=function(e){try{t=e,["sourceId","sourcePort","targetId","targetPort"].forEach(function(e){if(!t[e])throw new Error("Missing "+e)})}catch(e){throw new Error("Error in connection: "+e.message)}var t;try{var n=this.getNodeWithId(e.sourceId),i=this.getNodeWithId(e.targetId);i.registerInputIfNeeded(e.targetPort),n.registerOutputIfNeeded(e.sourcePort),i.connectInput(e.targetPort,n,e.sourcePort)}catch(e){console.error(e.message)}},r.prototype.setNodeParameters=function(e,t){var n;const i=this.context.variants.getVariant(t.type,t.variant);if(i)null===(n=e.setVariant)||void 0===n||n.call(e,i);else{const n=t.parameters;var o=Object.keys(n);const i="runOnChange-",r=this.context.nodeRegister.hasNode(e.name)?this.context.nodeRegister.getNodeMetadata(e.name):void 0,s=function(e){if(0===e.indexOf(i))return Number.MAX_SAFE_INTEGER;const t=r?r.inputs[e]:void 0;return t?t.inputPriority:0};o.sort(function(e,t){return s(t)-s(e)}),o.forEach(t=>{e.registerInputIfNeeded(t),!1!==e.hasInput(t)&&e.queueInput(t,n[t])})}},r.prototype.createNodeFromModel=async function(e,t){if("Component Children"!==e.type){var n;try{(n=await this.createNode(e.type,e.id)).updateOnDirtyFlagging=!1!==t,n.setNodeModel(e)}catch(t){return console.error(t.message),void(this.context.editorConnection&&this.context.isWarningTypeEnabled("nodescope")&&this.context.editorConnection.sendWarning(this.componentOwner.name,e.id,"nodelibrary-unknown-node",{message:t.message,showGlobally:!0}))}return e.variant&&n.setVariant&&n.setVariant(e.variant),this.setNodeParameters(n,e),e.parent&&this.insertNodeInTree(n,e),n}if(e.parent){var i=this.getNodeWithId(e.parent.id);this.componentOwner.setChildRoot(i)}},r.prototype.insertNodeInTree=function(e,t){var n=this.getNodeWithId(t.parent.id),i=t.parent.children.indexOf(t);if(!n.addChild)throw new Error("Node "+n.id+" of type "+n.constructor.name+" can't have children");n.addChild(e,i)},r.prototype.getNodeWithId=function(e){if(!1===o(this.nodes,e))throw new Error("Unknown node id "+e);return this.nodes[e]},r.prototype.hasNodeWithId=function(e){return o(this.nodes,e)},r.prototype.createPrimitiveNode=function(e,t,n){if(t||(t=i()),o(this.nodes,t))throw Error("duplicate id "+t);const r=this.context.nodeRegister.createNode(e,t,this);if(n)for(const e in n)r[e]=n[e];return this.nodes[t]=r,r},r.prototype.createNode=async function(e,t,n){if(t||(t=i()),o(this.nodes,t))throw Error("duplicate id "+t);let r;if(this.context.nodeRegister.hasNode(e)){if(r=this.context.nodeRegister.createNode(e,t,this),n)for(const e in n)r[e]=n[e]}else r=await this.context.createComponentInstanceNode(e,t,this,n),this.componentInstanceChildren[t]=r;return this.nodes[t]=r,r},r.prototype.getNodesWithIdRecursive=function(e){var t=n(8204),i=[];return function e(n,i,r){o(n.nodes,i)&&r.push(n.nodes[i]),Object.keys(n.nodes).filter(function(e){return n.nodes[e]instanceof t}).forEach(function(t){e(n.nodes[t].nodeScope,i,r)})}(this,e,i),i},r.prototype.getNodesWithType=function(e){var t=this;return Object.keys(this.nodes).filter(function(n){return t.nodes[n].name===e}).map(function(e){return t.nodes[e]})},r.prototype.getNodesWithTypeRecursive=function(e){var t=n(8204),i=this,o=[];return o=o.concat(i.getNodesWithType(e)),Object.keys(i.nodes).filter(function(e){return i.nodes[e]instanceof t}).forEach(function(t){var n=i.nodes[t].nodeScope.getNodesWithTypeRecursive(e);o=o.concat(n)}),o},r.prototype.getAllNodesRecursive=function(){var e=n(8204);let t=[];return(()=>{t=t.concat(Object.values(this.nodes)),Object.keys(this.nodes).filter(t=>this.nodes[t]instanceof e).forEach(e=>{var n=this.nodes[e].nodeScope.getAllNodesRecursive();t=t.concat(n)})})(),t},r.prototype.getAllNodesWithVariantRecursive=function(e){return this.getAllNodesRecursive().filter(t=>t.variant===e)},r.prototype.onNodeModelRemoved=function(e){var t,n=this.getNodeWithId(e.id);if(e.parent){var i=this.getNodeWithId(e.parent.id);null===(t=i.removeChild)||void 0===t||t.call(i,n)}n._onNodeDeleted(),delete this.nodes[n.id],delete this.componentInstanceChildren[n.id]},r.prototype.removeConnection=function(e){this.getNodeWithId(e.targetId).removeInputConnection(e.targetPort,e.sourceId,e.sourcePort)},r.prototype.setComponentModel=async function(e){this.componentModel=e;const t=[];for(const n of e.getAllNodes()){const e=await this.createNodeFromModel(n,!1);e&&t.push(e)}e.getAllConnections().forEach(e=>this.addConnection(e)),t.forEach(e=>e.updateOnDirtyFlagging=!0),t.forEach(e=>{e._dirty&&e._performDirtyUpdate()}),e.on("connectionAdded",e=>this.addConnection(e),this),e.on("connectionRemoved",this.removeConnection,this),e.on("nodeAdded",this.createNodeFromModel,this);var n=this;e.on("nodeParentWillBeRemoved",function(e){if("Component Children"===e.type)return void(e.parent&&this.componentOwner.setChildRoot(null));const t=n.getNodeWithId(e.id);t.parent&&t.parent.removeChild(t)},this),e.on("nodeParentUpdated",function(e){if("Component Children"===e.type){var t=this.getNodeWithId(e.parent.id);this.componentOwner.setChildRoot(t)}else{var i=n.getNodeWithId(e.id);n.insertNodeInTree(i,e)}},this),e.on("nodeRemoved",function(e){"Component Children"!==e.type&&n.onNodeModelRemoved(e)},this);for(const e in this.nodes){const t=this.nodes[e];t.nodeScopeDidInitialize&&t.nodeScopeDidInitialize()}},r.prototype.reset=function(){this.componentModel&&(this.componentModel.removeListenersWithRef(this),this.componentModel=void 0),Object.keys(this.nodes).forEach(e=>{o(this.nodes,e)&&this.deleteNode(this.nodes[e])})},r.prototype.deleteNode=function(e){if(!1!==o(this.nodes,e.id)){if(e.parent&&e.parent.removeChild(e),e.getChildren&&e.getChildren().forEach(t=>{var n;null===(n=e.removeChild)||void 0===n||n.call(e,t),(t.parentNodeScope||t.nodeScope).deleteNode(t)}),this.componentModel){const t=this.componentModel.getConnectionsFrom(e.id),n=this.componentModel.getConnectionsTo(e.id);t.concat(n).forEach(e=>{o(this.nodes,e.targetId)&&o(this.nodes,e.sourceId)&&this.removeConnection(e)})}e._onNodeDeleted(),delete this.nodes[e.id],delete this.componentInstanceChildren[e.id]}else console.error("Node doesn't belong to this scope",e.id,e.name)},r.prototype.sendEventFromThisScope=function(e,t,n,i,o){if(i)for(var r=this.getNodesWithType("Event Receiver").filter(function(t){return t.getChannelName()===e}),s=0;s<r.length;s++)if(r[s].handleEvent(t))return!0;if("parent"===n&&this.componentOwner.parentNodeScope){const i=this.componentOwner.parent?this.componentOwner.parent.nodeScope:this.componentOwner.parentNodeScope;if(!i)return;i.sendEventFromThisScope(e,t,n,!0)}else if("children"===n){var a=this.nodes;for(var l in a){var u=a[l].children;if(u)for(var c=0;c<u.length;c++){var d=u[c];if(d.name&&this.context.hasComponentModelWithName(d.name)&&d.nodeScope.sendEventFromThisScope(e,t,n,!0))return!0}}}else if("siblings"===n){let n;if(n=this.componentOwner.parent?this.componentOwner.parent.nodeScope:this.componentOwner.parentNodeScope,!n)return;var p=n.nodes;for(var l in p){var h=p[l].children;if(h)for(var f=h.filter(e=>e.name&&this.context.hasComponentModelWithName(e.name)&&e.nodeScope!==this),g=0;g<f.length;g++)if(f[g].nodeScope.sendEventFromThisScope(e,t,null,!0))return!0}}return!1},e.exports=r},5162(e,t){"use strict";function n(e){return!1!==e&&void 0!==e}t.TREAT_UNCHANGED_AS=t.k7=t.d=t.YQ=t.COMPLETED_PORT=void 0,t.reportOutcomes=function(e,t,n,i){for(const o of t)e.reportOutcome(o,n,i)},t.narrowCompletedDescription=function(e){const n=e[t.COMPLETED_PORT];n&&n.description===t.YQ&&(e.unchanged||e.failure||(n.description=t.d))},t.outcomeOutputs=function(e={}){const i=e.group||"Events",o=e.unchanged,r=e.failure,s=n(o),a=n(r),l={done:{type:"signal",displayName:"Done",group:i,description:e.done||"Fires when the action ran and changed something"},[t.COMPLETED_PORT]:{type:"signal",displayName:"Completed",group:i,description:t.YQ}};return s&&(l.unchanged={type:"signal",displayName:"Unchanged",group:i,description:o}),a&&(l.failure={type:"signal",displayName:"Failure",group:i,description:r}),l},t.outcomeInputs=function(e={}){if(!n(e.unchanged))return{};const i=n(e.failure),o=[{label:"Unchanged",value:"unchanged"},{label:"Done",value:"done"}];return i&&o.push({label:"Failure",value:"failure"}),{[t.k7]:{type:{name:"enum",enums:o,allowEditOnly:!0},displayName:"Treat Unchanged as",group:"Advanced",default:"unchanged",description:"What this node reports when the action was valid and there was nothing to do. Unchanged (the default) keeps it a third outcome of its own. Done suits a project whose chains should carry on either way"+(i?"; Failure suits one whose idiom is that a no-op is a bug":"")+". Completed fires whatever this is set to.",set:function(e){this._internal[t.TREAT_UNCHANGED_AS]=e}}}},t.COMPLETED_PORT="completed",t.YQ="Fires after every invocation, whatever the outcome — wire this to carry on regardless. Failure still fires and still carries its reason, so this cannot hide an error",t.d="Fires after every invocation. This node has no other outcome — no Unchanged and no Failure — so it always fires together with Done, and wiring either one does the same thing. It is here on every action so that reaching for it is never a per-node decision",t.k7="treatUnchangedAs",t.TREAT_UNCHANGED_AS="_treatUnchangedAs"},6300(e){"use strict";const t=function(e){if(!e.owner)throw new Error("Owner must be set");this.getter=e.getter,this.connections=[],this.owner=e.owner,this.name=e.name,this.type=e.type,this.onFirstConnectionAdded=e.onFirstConnectionAdded,this.onLastConnectionRemoved=e.onLastConnectionRemoved,this._id=void 0};Object.defineProperties(t.prototype,{value:{get:function(){return this.getter.call(this.owner)}},id:{get:function(){return this._id||(this._id=this.owner.id+this.name),this._id}},registerConnection:{value:function(e,t){this.connections.push({node:e,inputPortName:t}),1===this.connections.length&&this.onFirstConnectionAdded&&this.onFirstConnectionAdded.call(this.owner)}},deregisterConnection:{value:function(e,t){for(var n=0;n<this.connections.length;n++){var i=this.connections[n];if(i.node===e&&i.inputPortName===t){this.connections.splice(n,1);break}}0===this.connections.length&&this.onLastConnectionRemoved&&this.onLastConnectionRemoved.call(this.owner)}},flagDependeesDirty:{value:function(){for(var e=0,t=this.connections.length;e<t;e++)this.connections[e].node.flagDirty()}},sendValue:{value:function(e){this._lastUpdateIteration!==this.owner._updatedAtIteration?(this._lastUpdateIteration=this.owner._updatedAtIteration,this.valuesSendThisIteration=0):this.valuesSendThisIteration++,this.valuesSendThisIteration>500&&(this.owner._cyclicLoop=!0,this.owner._cyclicLoopCause={limit:"value-sends",count:500,port:this.name});const t=this.owner.context,n=void 0!==t&&!0===t.traceEnabled;for(var i=0,o=this.connections.length;i<o;i++){var r=this.connections[i];if(n){const n=t.traceEdgeSend(this.owner.id,this.name,r.node.id,r.inputPortName,e,"value");r.node._setValueFromConnection(r.inputPortName,e,this.type,n)}else r.node._setValueFromConnection(r.inputPortName,e,this.type)}}},sendPulse:{value:function(){this._lastUpdateIteration!==this.owner._updatedAtIteration?(this._lastUpdateIteration=this.owner._updatedAtIteration,this.valuesSendThisIteration=0):this.valuesSendThisIteration++,this.valuesSendThisIteration>500&&(this.owner._cyclicLoop=!0);const e=this.owner.context,t=void 0!==e&&!0===e.traceEnabled;for(var n=0,i=this.connections.length;n<i;n++){var o=this.connections[n];const i=t?e.traceEdgeSend(this.owner.id,this.name,o.node.id,o.inputPortName,!0,"signal"):0;o.node._setPulseFromConnection?o.node._setPulseFromConnection(o.inputPortName,i):(o.node._setValueFromConnection(o.inputPortName,!0,void 0,i),o.node._setValueFromConnection(o.inputPortName,!1,void 0,i))}}},hasConnections:{value:function(){return this.connections.length>0}}}),e.exports=t},8818(e){"use strict";e.exports={generateProjectSettings:function(e,t){const n={dynamicports:[],ports:[]};return function(e,t){for(let n=0;n<t.length;n++){const i=t[n];i.settings&&i.settings.forEach(function(t){e.ports.push(t)})}}(n,t),n}}},9849(e,t){"use strict";t.ResolvedTargetReporter=void 0,t.ResolvedTargetReporter=class{constructor(){this._byContext=new WeakMap}report(e,t){const n=this._stateFor(e);if(!n)return;let i=n.byGraphNode.get(e.id);i||(i=new Map,n.byGraphNode.set(e.id,i)),i.set(e,t),this._flush(e,n,i)}forget(e){const t=this._stateFor(e);if(!t)return;const n=t.byGraphNode.get(e.id);if(n){if(n.delete(e),0===n.size)return t.byGraphNode.delete(e.id),void t.lastSent.delete(e.id);this._flush(e,t,n)}}_stateFor(e){const t=e.context;if(!t)return;let n=this._byContext.get(t);return n||(n={byGraphNode:new Map,lastSent:new Map},this._byContext.set(t,n)),n}_flush(e,t,n){const i=[];n.forEach(e=>i.push(e));const o=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];void 0!==i&&-1===t.indexOf(i)&&t.push(i)}if(0===t.length)return;if(1===t.length)return"→ "+t[0];const n=t.slice(0,3).join(", "),i=t.length-3;return"→ "+t.length+" targets: "+n+(i>0?", +"+i:"")}(i);if(t.lastSent.has(e.id)&&t.lastSent.get(e.id)===o)return;t.lastSent.set(e.id,o);const r=e.context&&e.context.editorConnection;r&&r.isRunningLocally()&&"function"==typeof r.sendNodeSubLabel&&r.sendNodeSubLabel(e.id,o)}}},5838(e,t){"use strict";function n(e){return t.sz+e}function i(e,n){return{group:t.RUN_ON_CHANGE_GROUP,displayName:n||e,default:!0,type:{name:"boolean",allowEditOnly:!0},description:"Whether a new value on "+(n||e)+" re-runs this node. On by default; untick to make this input passive so only the control signal runs it",set:function(t){!function(e,t,n){const i=e;i._runOnValueChange||(i._runOnValueChange={}),i._runOnValueChange[t]=n}(this,e,!1!==t)}}}function o(e){if(null===e)return!0;const t=typeof e;return"object"!==t&&"function"!==t&&"undefined"!==t}t.RUN_ON_CHANGE_GROUP=t.sz=void 0,t.runOnChangePortName=n,t.inputNameForRunOnChangePort=function(e){if(0!==e.indexOf(t.sz))return;const n=e.slice(t.sz.length);return n.length>0?n:void 0},t.runOnChangeInput=i,t.runOnChangeInputs=function(e,t){const o={};return e.forEach(function(e){o[n(e)]=i(e,t&&t[e])}),o},t.runOnChangeDynamicPorts=function(e,i){return e.map(function(e){const o=i&&i[e]||e;return{name:n(e),displayName:o,group:t.RUN_ON_CHANGE_GROUP,plug:"input",default:!0,type:{name:"boolean",allowEditOnly:!0}}})},t.runOnValueChange=function(e,t){const n=e._runOnValueChange;return!n||!1!==n[t]},t.valueDidChange=function(e,t){return!o(e)||!o(t)||!Object.is(e,t)},t.sz="runOnChange-",t.RUN_ON_CHANGE_GROUP="Run On Value Change"},6202(e,t){"use strict";let n;t.RuntimeErrorBus=void 0,t.setAmbientErrorBus=function(e){n=e},t.raiseUnattributedRuntimeError=function(e,t,i){const o={nodeId:"<runtime>",componentName:"<runtime>",nodeType:"<runtime>",code:e,message:t,detail:i};n&&n.hasSubscribers?n.raise(o):console.error("[noodl] "+t+" ["+e+"]",o)},t.createConsoleErrorSubscriber=function(){return function(e){console.error("[noodl] "+e.nodeType+" ("+e.componentName+"): "+e.message+" ["+e.code+"]",e)}},t.createEditorWarningSubscriber=function(e){return function(t){e.sendWarning(t.componentName,t.nodeId,t.code,{showGlobally:!0,message:t.message})}},t.RuntimeErrorBus=class{constructor(){this._subscribers=[],this._depth=0}subscribe(e){return this._subscribers.push(e),{unsubscribe:()=>{this.unsubscribe(e)}}}unsubscribe(e){const t=this._subscribers.indexOf(e);-1!==t&&this._subscribers.splice(t,1)}get hasSubscribers(){return this._subscribers.length>0}raise(e){if(0===this._subscribers.length)return;if(this._depth>=2)return void console.error("[noodl] runtime error raised while delivering another; dropped",e);const t=this._subscribers.slice();this._depth++;try{for(let n=0;n<t.length;n++)try{t[n](e)}catch(e){console.error("[noodl] a runtime-error subscriber threw",e)}}finally{this._depth--}}}},997(e,t,n){"use strict";t.p=function(e){const t=function(e){let t,n;return function(){const r=e();return n&&r===t||(t=r,n=new o.SandboxStore(r?{...r,user:(0,i.ensureUser)(r.user)}:{classes:{},user:(0,i.ensureUser)(void 0)})),n}}(e),n=function(e){const t=window.fetch;return window.fetch=function(n,o){var s,a;const l="string"==typeof n?n:n instanceof URL?n.href:n.url,u=null!==(s=null==o?void 0:o.method)&&void 0!==s?s:n instanceof Request?n.method:"GET",c=(0,i.respond)({method:u,url:l,body:r(null==o?void 0:o.body)},e());return c?Promise.resolve(new Response(JSON.stringify(null!==(a=c.body)&&void 0!==a?a:{}),{status:c.status,headers:{"Content-Type":"application/json"}})):t.call(window,n,o)},()=>{window.fetch=t}}(t),s=function(e){const t=XMLHttpRequest.prototype,n=t.open,o=t.send,s=new WeakMap;return t.open=function(e,t,...i){return s.set(this,{method:e,url:t}),n.apply(this,arguments)},t.send=function(t){const n=s.get(this),a=n?(0,i.respond)({method:n.method,url:n.url,body:r(t)},e()):null;if(!a)return o.call(this,null!=t?t:null);!function(e,t,n){var i;const o=JSON.stringify(null!==(i=t.body)&&void 0!==i?i:{}),r=(t,n)=>Object.defineProperty(e,t,{value:n,configurable:!0,writable:!1});setTimeout(()=>{r("readyState",4),r("status",t.status),r("statusText","OK"),r("response",o),r("responseText",o),r("responseURL",n),e.dispatchEvent(new Event("readystatechange")),e.dispatchEvent(new Event("load")),e.dispatchEvent(new Event("loadend"))},0)}(this,a,n.url)},()=>{t.open=n,t.send=o}}(t);return()=>{n(),s()}};const i=n(1252),o=n(51);function r(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch{return e}}},1252(e,t,n){"use strict";t.respond=function(e,t){const{path:n,params:i}=function(e){const t=e.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,"").replace(/^undefined/,""),[n,i]=t.split("?");return{path:n||"/",params:new URLSearchParams(null!=i?i:"")}}(e.url);if(o.some(e=>e.test(n)))return null;const d=function(e,t,n,i){var o,d,p,h,f,g,m,y;const v=function(e){const t=r(e),n=t.findIndex(e=>-1!==c.indexOf(e));return-1===n?t:t.slice(n)}(n),b=v[0],w=e.method.toUpperCase(),_=s(e.body);if("classes"===b){const e=v[1],n=v[2];if(!e)return{status:400,body:{error:"No class"}};if(n){if("DELETE"===w)return t.remove(e,n),{status:200,body:{}};if("PUT"===w){const i=t.get(e,n),o=t.update(e,n,l(i,_));return{status:200,body:null!=o?o:{updatedAt:(new Date).toISOString()}}}const i=t.get(e,n);return i?{status:200,body:i}:{status:404,body:{code:101,error:"Object not found."}}}if("GET"===w||"GET"===_._method){const n={where:null!==(o=_.where)&&void 0!==o?o:a(i,"where"),limit:void 0!==_.limit?Number(_.limit):i.has("limit")?Number(i.get("limit")):void 0,skip:void 0!==_.skip?Number(_.skip):i.has("skip")?Number(i.get("skip")):void 0,order:null!==(p=null!==(d=_.order)&&void 0!==d?d:i.get("order"))&&void 0!==p?p:void 0,count:Boolean(null!==(h=_.count)&&void 0!==h?h:i.get("count"))},{results:r,count:s}=t.query(e,n);return{status:200,body:n.count?{results:r,count:s}:{results:r}}}if("POST"===w){const n=t.create(e,_);return{status:201,body:{objectId:n.objectId,createdAt:n.createdAt}}}}if("aggregate"===b){const e=v[1],n=null!==(g=null!==(f=a(i,"$group"))&&void 0!==f?f:a(i,"group"))&&void 0!==g?g:{},o=null!==(m=a(i,"$match"))&&void 0!==m?m:a(i,"match"),{results:r}=t.query(e,{where:o}),l={};for(const[e,t]of Object.entries(n)){if("_id"===e||"objectId"===e)continue;const n=Object.keys(s(t))[0],i=String(null!==(y=s(t)[n])&&void 0!==y?y:"").replace(/^\$/,""),o=r.map(e=>e[i]).filter(e=>null!=e),a=o.map(Number).filter(e=>!Number.isNaN(e));l[e]="$sum"===n?a.reduce((e,t)=>e+t,0):"$avg"===n?a.length?a.reduce((e,t)=>e+t,0)/a.length:0:"$max"===n?a.length?Math.max(...a):0:"$min"===n?a.length?Math.min(...a):0:"$addToSet"===n?Array.from(new Set(o)):a.length}const u=i.get("distinct");return u?{status:200,body:{results:Array.from(new Set(r.map(e=>e[u])))}}:{status:200,body:{results:[l]}}}if("functions"===b)return console.log(`[sandbox] cloud function "${v[1]}" answered with an empty result — preview data is simulated.`),{status:200,body:{result:{}}};if("files"===b){const e=v.slice(1).join("/")||"file";return{status:201,body:{name:e,url:`sandbox://files/${e}`}}}return"login"===b||"users"===b||"logout"===b||"auth"===b||"oauth"===b?function(e,t,n,i,o){const r=n[0];return"logout"===r?{status:200,body:{}}:"login"===r||"users"===r&&"POST"===i||"oauth"===r||"auth"===r?("string"==typeof o.username&&o.username&&(t.user.username=o.username),"string"==typeof o.email&&o.email&&(t.user.email=o.email),"auth"===r&&"providers"===n[1]?{status:200,body:{providers:[]}}:{status:200,body:u(t)}):"users"===r&&"me"===n[1]?{status:200,body:u(t)}:"users"===r&&n[1]&&"PUT"===i?(Object.assign(t.user,l(t.user,o)),{status:200,body:{updatedAt:(new Date).toISOString()}}):"users"===r&&n[1]?{status:200,body:u(t)}:{status:200,body:{}}}(0,t,v,w,_):n.includes("request_password_reset")||"requestPasswordReset"===b||"verificationEmailRequest"===b?{status:200,body:{}}:void 0}(e,t,n,i);if(d)return d;const p=function(e,t,n,i){var o;const l=r(n),u=l.indexOf("items");if(-1===u)return;const c=l[u+1],d=l[u+2],p=e.method.toUpperCase(),h=s(e.body);if(!c)return;if(d){if("DELETE"===p)return t.remove(c,d),{status:200,body:{data:null}};if("PATCH"===p||"PUT"===p){const e=t.update(c,d,h);return{status:200,body:{data:null!=e?e:null}}}const e=t.get(c,d);return{status:e?200:404,body:{data:null!=e?e:null}}}if("POST"===p)return{status:200,body:{data:t.create(c,h)}};const f=i.get("limit"),{results:g,count:m}=t.query(c,{limit:f?Number(f):void 0,skip:i.has("offset")?Number(i.get("offset")):void 0,order:null!==(o=i.get("sort"))&&void 0!==o?o:void 0,where:a(i,"filter")});return{status:200,body:{data:g,meta:{total_count:m,filter_count:m}}}}(e,t,n,i);return p||(console.log(`[sandbox] ${e.method} ${e.url} answered locally — the preview makes no real requests.`),{status:200,body:{}})},t.ensureUser=function(e){return e&&"string"==typeof e.objectId?e:(0,i.sandboxUser)()};const i=n(6180),o=[/\.(js|css|map|png|jpe?g|gif|svg|woff2?|ttf|ico|html|json5?)($|\?)/i,/^\/?noodl_modules\//,/^\/?static\//,/^\/?favicon/];function r(e){return e.split("/").filter(Boolean)}function s(e){return null!==e&&"object"==typeof e?e:{}}function a(e,t){const n=e.get(t);if(n)try{return JSON.parse(n)}catch{return}}function l(e,t){const n={};for(const[i,o]of Object.entries(t)){const t=s(o).__op;if("Increment"===t){const t=Number(s(o).amount)||0;n[i]=(Number(null==e?void 0:e[i])||0)+t}else if("Delete"===t)n[i]=void 0;else{if("AddRelation"===t||"RemoveRelation"===t)continue;n[i]=o}}return n}function u(e){var t;return{...e.user,sessionToken:String(null!==(t=e.user.sessionToken)&&void 0!==t?t:"r:sandbox-session")}}const c=["classes","aggregate","functions","files","login","logout","users","auth","oauth","requestPasswordReset","verificationEmailRequest"]},5354(e,t,n){"use strict";t.jr=function(e,t,n,r={}){const s=void 0!==r.storage?r.storage:"undefined"==typeof localStorage?void 0:localStorage;if(!s)return[];const a=function(e){var t,n,o,r;const s=[void 0,null===(t=e.cloudservices)||void 0===t?void 0:t.appId];for(const t of null!==(o=null===(n=e.backendServices)||void 0===n?void 0:n.backends)&&void 0!==o?o:[])(null===(r=null==t?void 0:t.auth)||void 0===r?void 0:r.publicToken)&&s.push(t.auth.publicToken);const a=[];for(const e of s){const t=(0,i.parseSessionKey)(e);-1===a.indexOf(t)&&a.push(t)}return a}(t);for(const t of a)n&&e?s[t]=JSON.stringify(o(e.user)):delete s[t];return a};const i=n(3518);function o(e){var t;return{...e,sessionToken:String(null!==(t=e.sessionToken)&&void 0!==t?t:"r:sandbox-session")}}},51(e,t,n){"use strict";t.SandboxStore=void 0;const i=n(6180),o=n(551),r=["name","description","imageUrl","status","count"];function s(e,t){return"number"==typeof e&&"number"==typeof t?e-t:"boolean"==typeof e&&"boolean"==typeof t?Number(e)-Number(t):String(null!=e?e:"").localeCompare(String(null!=t?t:""))}function a(e,t){for(const[n,i]of Object.entries(t))switch(n){case"$eq":if(e!==i)return!1;break;case"$ne":if(e===i)return!1;break;case"$gt":if(!(s(e,i)>0))return!1;break;case"$gte":if(!(s(e,i)>=0))return!1;break;case"$lt":if(!(s(e,i)<0))return!1;break;case"$lte":if(!(s(e,i)<=0))return!1;break;case"$in":if(!Array.isArray(i)||!i.includes(e))return!1;break;case"$nin":if(Array.isArray(i)&&i.includes(e))return!1;break;case"$exists":if(null!=e!==Boolean(i))return!1;break;case"$regex":try{if(!new RegExp(String(i),"i").test(String(null!=e?e:"")))return!1}catch{}}return!0}function l(e,t){if(!t)return!0;for(const[n,i]of Object.entries(t)){if("$or"===n){const t=Array.isArray(i)?i:[];if(t.length>0&&!t.some(t=>l(e,t)))return!1;continue}if("$and"===n){if(!(Array.isArray(i)?i:[]).every(t=>l(e,t)))return!1;continue}const t=e[n];if(null!==i&&"object"==typeof i&&!Array.isArray(i)){const e=i;if("__type"in e){if(JSON.stringify(t)!==JSON.stringify(e))return!1;continue}if(!a(t,e))return!1;continue}if(t!==i)return!1}return!0}t.SandboxStore=class{constructor(e){var t,n,i,o;this.records=new Map,this.fields=new Map,this.nextId=1e3;for(const[o,r]of Object.entries(null!==(t=null==e?void 0:e.classes)&&void 0!==t?t:{}))this.fields.set(o,null!==(n=r.fields)&&void 0!==n?n:[]),this.records.set(o,(null!==(i=r.records)&&void 0!==i?i:[]).map(e=>({...e})));this.user={...null!==(o=null==e?void 0:e.user)&&void 0!==o?o:{}},this.synthesizeMissing=!1!==(null==e?void 0:e.synthesizeMissing)}list(e){var t;const n=this.records.get(e);if(n)return n;const o=this.synthesizeMissing?(0,i.synthesizeRecords)(null!==(t=this.fields.get(e))&&void 0!==t?t:r,5):[];return this.records.set(e,o),o}query(e,t={}){const n=this.list(e).filter(e=>l(e,t.where)),i=function(e,t){if(!t)return e;const n=t.split(",").map(e=>e.trim()).filter(Boolean);return 0===n.length?e:e.slice().sort((e,t)=>{for(const i of n){const n=i.startsWith("-"),o=n?i.slice(1):i,r=s(e[o],t[o]);if(0!==r)return n?-r:r}return 0})}(n,t.order),o=Math.max(0,Number(t.skip)||0),r=void 0===t.limit||null===t.limit?i.length:Math.max(0,Number(t.limit));return{results:i.slice(o,o+r),count:n.length}}get(e,t){return this.list(e).find(e=>e.objectId===t||e.id===t)}create(e,t){var n;const r="sandbox-new-"+this.nextId++,s=(new Date).toISOString(),a={...(0,i.synthesizeRecord)(null!==(n=this.fields.get(e))&&void 0!==n?n:[],this.list(e).length),...t,objectId:r,id:r,createdAt:s,updatedAt:s,[o.SANDBOX_RECORD_FLAG]:!0};return this.list(e).push(a),a}update(e,t,n){const i=this.get(e,t);if(i)return Object.assign(i,n,{updatedAt:(new Date).toISOString()}),i}remove(e,t){const n=this.list(e),i=n.findIndex(e=>e.objectId===t||e.id===t);return-1!==i&&(n.splice(i,1),!0)}knownClasses(){return Array.from(this.fields.keys())}}},6180(e,t,n){"use strict";t.synthesizeRecord=_,t.synthesizeRecords=function(e,t){const n=[];for(let i=0;i<t;i++)n.push(_(e,i));return n},t.sandboxUser=function(){return{...w(0),objectId:"sandbox-user",id:"sandbox-user",username:"sample.user@example.com",email:"sample.user@example.com",emailVerified:!0,name:"Sample User",firstName:"Sample",lastName:"User",sessionToken:"r:sandbox-session",profileImage:y("Sample User",2)}};const i=n(551),o=["Northern","Quiet","Amber","Copper","Meridian","Harbour","Ivory","Silver","Hollow","Marbled"],r=["Atlas","Signal","Garden","Compass","Ledger","Beacon","Orchard","Lantern","Quarry","Anchor"],s=["Ada","Ines","Milo","Rune","Sara","Tomas","Nadia","Oscar","Lena","Jonas"],a=["Beck","Nour","Ferrer","Okafor","Lindqvist","Mehta","Duarte","Halvorsen","Roy","Ivanov"],l=["A short summary that stands in for the real copy.","Written to show how the layout behaves at this length.","Long enough to wrap onto a second line in a narrow column.","Kept deliberately plain so the design does the talking.","Sample text — replaced by whatever your data actually says."],u=["Active","Pending","Archived","Draft","Complete"],c=["General","Design","Finance","Research","Operations"],d=["Lisbon","Malmö","Kyoto","Bristol","Valparaíso"],p=[210,32,160,280,12,195];function h(e,t){return e[(t%e.length+e.length)%e.length]}function f(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_\-.]+/g," ").toLowerCase().split(/\s+/).filter(Boolean)}function g(e){const t=f(e);return 0===t.length?e:t[0].charAt(0).toUpperCase()+t[0].slice(1)+(t.length>1?" "+t.slice(1).join(" "):"")}function m(e,...t){return t.some(t=>e.includes(t))}function y(e,t){const n=h(p,t),i=e.slice(0,18).replace(/[<>&"]/g,"");return"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="480" height="360" viewBox="0 0 480 360"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="hsl(${n} 62% 72%)"/><stop offset="1" stop-color="hsl(${(n+40)%360} 58% 52%)"/></linearGradient></defs><rect width="480" height="360" fill="url(#g)"/><text x="240" y="192" text-anchor="middle" font-family="system-ui,sans-serif" font-size="26" fill="rgba(255,255,255,0.92)">${i}</text></svg>`)}function v(e,t){const n=Date.UTC(2026,0,15,9,30,0);return new Date(n-864e5*(e+t)).toISOString()}function b(e,t){const n=f(e),i=e.toLowerCase();if("objectid"===i||"id"===i||"_id"===i)return`sandbox-${t+1}`;if(/^(is|has|can|should|was|are)[A-Z_]/.test(e))return t%3!=1;if(m(n,"image","photo","avatar","thumbnail","thumb","cover","picture","banner","logo","icon"))return y(g(e),t);if(m(n,"email")||i.endsWith("mail"))return`${h(s,t).toLowerCase()}.${h(a,t).toLowerCase()}@example.com`;if(m(n,"url","link","href","website","site"))return`https://example.com/${h(r,t).toLowerCase()}`;if(m(n,"phone","mobile","tel"))return`+46 70 ${100+t} ${40+t} ${11+t}`;if(m(n,"password","token","secret","key"))return"••••••••";if(m(n,"color","colour"))return`hsl(${h(p,t)} 60% 55%)`;const b=m(n,"name","firstname","lastname","surname");return b&&m(n,"first","given","firstname")?h(s,t):b&&m(n,"last","family","surname","lastname")?h(a,t):m(n,"username","handle","nickname")?`${h(s,t).toLowerCase()}${t+1}`:m(n,"author","owner","user","customer","member","contact","person","assignee")?`${h(s,t)} ${h(a,t)}`:m(n,"name","title","heading","label","subject")?`${h(o,t)} ${h(r,t+3)}`:m(n,"description","summary","body","content","text","bio","note","notes","message","comment")?h(l,t):m(n,"price","amount","cost","total","subtotal","salary","fee","balance","revenue")?Math.round(100*(19.5+17.25*t))/100:m(n,"rating","score","stars")?Math.min(5,3+t%3*.5):m(n,"count","quantity","qty","stock","views","likes","comments","age","number","num")?3+7*t:m(n,"percent","percentage","progress")?Math.min(100,12+19*t):m(n,"date","time","at","deadline","due","published","created","updated","birthday")?v(t,m(n,"due","deadline")?-14:0):m(n,"status","state")?h(u,t):m(n,"category","type","kind","group","tag","topic","role","department")?h(c,t):m(n,"city","town","country","location","address","place")?h(d,t):m(n,"enabled","active","done","completed","visible","verified","featured","archived","public")?t%3!=1:`${g(e)} ${t+1}`}function w(e){const t=`sandbox-${e+1}`;return{objectId:t,id:t,createdAt:v(e,30),updatedAt:v(e,0),[i.SANDBOX_RECORD_FLAG]:!0}}function _(e,t){const n=w(t);for(const i of e)i&&!(i in n)&&(n[i]=b(i,t));return n}},551(e,t){"use strict";t.SANDBOX_RECORD_FLAG=t.a=void 0,t.a="sandbox",t.SANDBOX_RECORD_FLAG="__sandbox"},5332(e,t){"use strict";t.ScriptFiles=t.ScriptFileError=void 0,t.scriptUsesOf=function(e){var t;const n=Array.isArray(e)?e:"string"==typeof e?e.split(","):[],i=[];for(const e of n){if("string"!=typeof e||""===e.trim())continue;const n=null!==(t=o(e))&&void 0!==t?t:e.trim();i.includes(n)||i.push(n)}return i},t.scriptAlias=function(e){const t=e.substring(e.lastIndexOf("/")+1);return t.endsWith(".js")?t.substring(0,t.length-3):t};const n=["use","exports","module","Noodl","window","document"];class i extends Error{constructor(e,t,n,i,o){super(n),this.reported=!1,this.name="ScriptFileError",this.code=e,this.path=t,this.line=i,this.column=o}describe(){return"scripts/"+this.path+(void 0!==this.line?":"+this.line:"")+": "+this.message}}function o(e){if("string"!=typeof e)return;let t=e.trim().replace(/\\/g,"/");return t=t.replace(/^\.\//,"").replace(/^\/+/,""),t.startsWith("scripts/")&&(t=t.substring(8)),""===t||t.endsWith("/")||t.split("/").some(e=>""===e||"."===e||".."===e)?void 0:(t.endsWith(".js")||(t+=".js"),t)}function r(e){return e&&"string"==typeof e.message?e.message:String(e)}t.ScriptFileError=i,t.ScriptFiles=class{constructor(){this.sources={},this.loaded=new Map,this.version=0}setSources(e){const t={};for(const n in e||{}){const i=o(n);void 0!==i&&"string"==typeof e[n]&&(t[i]=e[n])}this.sources=t,this.loaded.clear(),this.version++}has(e){const t=o(e);return void 0!==t&&Object.prototype.hasOwnProperty.call(this.sources,t)}paths(){return Object.keys(this.sources).sort()}load(e){const t=o(e);if(void 0===t)throw new i("script/missing",String(e),'This is not a script file path: "'+String(e)+'"');const s=this.loaded.get(t);if(s){if("failed"===s.state)throw s.error;return s.module.exports}if(!Object.prototype.hasOwnProperty.call(this.sources,t)){const e=new i("script/missing",t,"There is no script file scripts/"+t);throw this.loaded.set(t,{module:{exports:{}},state:"failed",error:e}),e}const a={module:{exports:{}},state:"loading"};let l;this.loaded.set(t,a);try{l=new Function(...n,this.sources[t]+"\n//# sourceURL=scripts/"+t)}catch(e){return this.fail(a,new i("script/not-compiled",t,r(e)))}const u=e=>this.load(e);try{l(u,a.module.exports,a.module,void 0,void 0,void 0)}catch(e){if(e instanceof i)return this.fail(a,e);const n=function(e,t){if("string"!=typeof e)return;const n="scripts/"+t+":",i=e.indexOf(n);if(i<0)return;const o=/^(\d+):(\d+)/.exec(e.substring(i+n.length));return o?{line:Math.max(1,Number(o[1])-2),column:Number(o[2])}:void 0}(e&&e.stack,t);return this.fail(a,new i("script/threw",t,r(e),n&&n.line,n&&n.column))}return a.state="done",a.module.exports}fail(e,t){throw e.state="failed",e.error=t,t}}},9771(e,t,n){"use strict";const i=n(5293),o=function(){};o.events=new i,e.exports=o},9190(e){"use strict";function t(e,t){this.duration=t.duration||0,this._isRunning=!1,this._hasCalledOnStart=!1,this.scheduler=e,this.repeatCount=1,this.delay=0;for(const e in t)this[e]=t[e]}function n(e){this.requestFrame=e,this.runningTimers=[],this.newTimers=[]}function i(e){try{e()}catch(e){console.error(e)}}t.prototype.start=function(){return this._isRunning&&this.stop(),this.scheduler.scheduleTimer(this),this},t.prototype.stop=function(){this.scheduler.stopTimer(this),this._hasCalledOnStart=!1,this._isRunning=!1,this._wasStopped=!0},t.prototype.isRunning=function(){return this._isRunning},t.prototype.durationLeft=function(){return this._durationLeft},n.prototype.createTimer=function(e){return new t(this,e)},n.prototype.scheduleTimer=function(e){-1===this.newTimers.indexOf(e)&&(0===e.repeatCount&&(e.repeatCount=1e5),this.newTimers.push(e),this.requestFrame())},n.prototype.stopTimer=function(e){let t;e._isRunning?(t=this.runningTimers.indexOf(e),-1!==t&&this.runningTimers.splice(t,1),e.onStop&&!e._wasStopped&&e.onStop()):(t=this.newTimers.indexOf(e),-1!==t&&this.newTimers.splice(t,1))},n.prototype.runTimers=function(e){const t=[],n=[],o=[];let r,s;const a=this.runningTimers.length;for(r=0;r<a;++r)o[r]=this.runningTimers[r];for(r=0;r<a;++r)if(s=o[r],s&&e>=s._start){let o;!1===s._hasCalledOnStart&&s.onStart&&(i(()=>s.onStart()),s._hasCalledOnStart=!0),o=s.duration>0?(e-s._start)/(s.duration*s.repeatCount):1,s._durationLeft=s.duration*(1-o);let r=o*s.repeatCount-Math.floor(o*s.repeatCount);o>=1&&(r=1),s.onRunning&&i(()=>s.onRunning(r)),o<1&&s._isRunning?t.push(s):s._wasStopped||n.push(s)}else t.push(s);for(this.runningTimers=t,r=0;r<n.length;++r)if(n[r]._isRunning=!1,n[r]._hasCalledOnStart=!1,n[r].onFinish){const e=n[r];i(()=>e.onFinish())}if(this.newTimers.length>0){for(r=0;r<this.newTimers.length;++r)if(s=this.newTimers[r],s._start=e+s.delay,s._isRunning=!0,s._wasStopped=!1,this.runningTimers.push(s),0===s.delay){const e=s;e.onStart&&(i(()=>e.onStart()),e._hasCalledOnStart=!0),e.onRunning&&i(()=>e.onRunning(0))}this.newTimers.length=0}},n.prototype.hasPendingTimers=function(){return this.runningTimers.length>0||this.newTimers.length>0},e.exports=n},5801(e,t){"use strict";t.TraceBuffer=t.b=t.DEFAULT_VALUE_CAP=void 0,t.toWireEvent=function(e){return{seq:e.seq,t:e.t,cause:e.cause,from:{node:e.fromNode,port:e.fromPort},to:{node:e.toNode,port:e.toPort},value:e.value,kind:e.kind}},t.previewValue=function(e,i=t.DEFAULT_VALUE_CAP){const o=[];let r=0;const s=new Set;function a(e){if(r+=e.length,r>i)throw o.push(e.slice(0,Math.max(0,e.length-(r-i)))),n;o.push(e)}try{!function e(t,n){var i;if(null===t)return a("null");if(void 0===t)return a("undefined");const o=typeof t;if("string"===o)return a('"'+t+'"');if("number"===o)return a(Number.isNaN(t)?"NaN":String(t));if("boolean"===o||"bigint"===o)return a(String(t));if("function"===o)return a("<function "+(t.name||"anonymous")+">");if("symbol"===o)return a(String(t));const r=null===(i=t.constructor)||void 0===i?void 0:i.name;if("Node"===r)return a("<Node> "+(t.name||""));if("undefined"!=typeof window&&"undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return a("DOM Node <"+t.tagName+">");if(t instanceof Date)return a(t.toISOString());if(s.has(t))return a("[Circular]");if(n>6)return a("…");if(s.add(t),Array.isArray(t)){a("[");for(let i=0;i<t.length;i++)i>0&&a(","),e(t[i],n+1);return void a("]")}if("Collection"===r||"Model"===r){const e=t.id;return a("<"+r+(void 0!==e?" "+String(e):"")+">")}a("{");let l=!0;for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(l||a(","),l=!1,a(i+":"),e(t[i],n+1));a("}")}(e,0)}catch(e){return e===n?o.join("")+"…":"<unpreviewable>"}return o.join("")},t.DEFAULT_VALUE_CAP=200,t.b=25e4;const n={};t.TraceBuffer=class{constructor(e=t.b){this.writeIndex=0,this.wrapped=!1,this.nextSeq=1,this.capacity=Math.max(1,e),this.events=new Array(this.capacity)}peekNextSeq(){return this.nextSeq}push(e,t,n,i,o,r,s,a){const l=this.nextSeq++;return this.events[this.writeIndex]={seq:l,t:e,cause:t,fromNode:n,fromPort:i,toNode:o,toPort:r,value:s,kind:a},this.writeIndex++,this.writeIndex>=this.capacity&&(this.writeIndex=0,this.wrapped=!0),l}get size(){return this.wrapped?this.capacity:this.writeIndex}toArray(){return this.wrapped?this.events.slice(this.writeIndex).concat(this.events.slice(0,this.writeIndex)):this.events.slice(0,this.writeIndex)}since(e){const t=this.toArray();let n=0,i=t.length;for(;n<i;){const o=n+i>>1;t[o].seq<=e?n=o+1:i=o}return t.slice(n)}clear(){this.events=new Array(this.capacity),this.writeIndex=0,this.wrapped=!1}}},7831(e,t){"use strict";function n(e){if(e&&e.message)return String(e.message);try{return String(e)}catch{return typeof e}}t.getAbsoluteUrl=function(e){const t=String(e);return!t||"/"===t[0]||t.includes("://")||t.startsWith("data:")?t:(Noodl.baseUrl||"/")+t},t.thrownMessage=n,t.logJavaScriptNodeError=function(e){const t="Error in JS node run code.";if(null===e||"object"!=typeof e&&"function"!=typeof e)return void console.log(t,n(e));const i=Object.getPrototypeOf(e),o=i&&i.constructor&&i.constructor.name?i.constructor.name:"Error";console.log(t,o+": "+n(e),e.stack)}},9174(e){"use strict";e.exports=class{constructor({graphModel:e,getNodeScope:t}){this.getNodeScope=t,e&&(this.graphModel=e,e.on("variantUpdated",e=>this.onVariantUpdated(e)))}getVariant(e,t){if(this.graphModel)return this.graphModel.getVariant(e,t)}onVariantUpdated(e){const t=this.getNodeScope();if(!t)return;const n=t.getNodesWithTypeRecursive(e.typename).filter(t=>t.variant?t.variant.name===e.name:t.model&&t.model.variant===e.name);for(const t of n)t.setVariant(e)}}},1986(e){"use strict";const t="function"==typeof WeakRef;e.exports=class{constructor(){this.refs=new Map,this.strongFallback=new Map,t&&"function"==typeof FinalizationRegistry&&(this.finalizer=new FinalizationRegistry(e=>{const t=this.refs.get(e);void 0!==t&&void 0===t.deref()&&this.refs.delete(e)}))}add(e,n){var i;t?(this.refs.set(e,new WeakRef(n)),null===(i=this.finalizer)||void 0===i||i.register(n,e)):this.strongFallback.set(e,n)}peek(e){if(!t)return this.strongFallback.get(e);const n=this.refs.get(e);if(void 0===n)return;const i=n.deref();if(void 0!==i)return i;this.refs.delete(e)}take(e){const t=this.peek(e);if(void 0!==t)return this.refs.delete(e),this.strongFallback.delete(e),void 0!==this.finalizer&&this.finalizer.unregister(t),t}size(){if(!t)return this.strongFallback.size;for(const e of Array.from(this.refs.keys()))this.peek(e);return this.refs.size}clear(){this.refs.clear(),this.strongFallback.clear()}}},6783(e,t,n){"use strict";t.TEXT_KEY=t.DEFAULT_MAX_BYTES=void 0,t.parseXML=function(e,n={}){const o=n.maxBytes&&n.maxBytes>0?n.maxBytes:t.DEFAULT_MAX_BYTES;if("string"!=typeof e||""===e.trim())return{error:{code:"xml/empty",message:"There was no XML to parse — the text was empty"}};if(e.length>o)return{error:{code:"xml/too-large",message:`This XML is ${Math.round(e.length/1024)} K characters, over the ${Math.round(o/1024)} K limit. Raise Max Characters on the node if the source really is this big`}};const r=function(e){const t=e.slice(0,65536);return/<!ENTITY/i.test(t)?{code:"xml/entity-declaration",message:"This XML declares its own entities (<!ENTITY). They are refused, not expanded, because a few lines of nested declarations expand to gigabytes and take the process with them. No feed format needs them"}:/<!DOCTYPE[^>[]*\[/i.test(t)?{code:"xml/doctype-subset",message:"This XML carries an inline DOCTYPE subset (<!DOCTYPE … [ … ]). It is refused rather than read, because that is the only place a document can define entities that expand"}:void 0}(e);if(r)return{error:r};const s=n.alwaysArray||[],a=new i.XMLParser({attributeNamePrefix:void 0===n.attributePrefix?"@":n.attributePrefix,ignoreAttributes:!1,removeNSPrefix:!1,trimValues:void 0===n.trimValues||!!n.trimValues,parseTagValue:!1,parseAttributeValue:!1,processEntities:!0,htmlEntities:!0,textNodeName:t.TEXT_KEY,isArray:e=>-1!==s.indexOf(e)});try{const t=a.parse(e);return t&&"object"==typeof t?{value:t}:{error:{code:"xml/parse-failed",message:"This text is not XML"}}}catch(e){return{error:{code:"xml/parse-failed",message:e&&e.message?e.message:String(e)}}}};const i=n(8116);t.DEFAULT_MAX_BYTES=5242880,t.TEXT_KEY="#text"},3169(e,t,n){var i;!function(){function o(e,t,n){return e.call.apply(e.bind,arguments)}function r(e,t,n){if(!e)throw Error();if(2<arguments.length){var i=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,i),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function s(e,t,n){return(s=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?o:r).apply(null,arguments)}var a=Date.now||function(){return+new Date};function l(e,t){this.a=e,this.o=t||e,this.c=this.o.document}var u=!!window.FontFace;function c(e,t,n,i){if(t=e.c.createElement(t),n)for(var o in n)n.hasOwnProperty(o)&&("style"==o?t.style.cssText=n[o]:t.setAttribute(o,n[o]));return i&&t.appendChild(e.c.createTextNode(i)),t}function d(e,t,n){(e=e.c.getElementsByTagName(t)[0])||(e=document.documentElement),e.insertBefore(n,e.lastChild)}function p(e){e.parentNode&&e.parentNode.removeChild(e)}function h(e,t,n){t=t||[],n=n||[];for(var i=e.className.split(/\s+/),o=0;o<t.length;o+=1){for(var r=!1,s=0;s<i.length;s+=1)if(t[o]===i[s]){r=!0;break}r||i.push(t[o])}for(t=[],o=0;o<i.length;o+=1){for(r=!1,s=0;s<n.length;s+=1)if(i[o]===n[s]){r=!0;break}r||t.push(i[o])}e.className=t.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function f(e,t){for(var n=e.className.split(/\s+/),i=0,o=n.length;i<o;i++)if(n[i]==t)return!0;return!1}function g(e,t,n){function i(){a&&o&&r&&(a(s),a=null)}t=c(e,"link",{rel:"stylesheet",href:t,media:"all"});var o=!1,r=!0,s=null,a=n||null;u?(t.onload=function(){o=!0,i()},t.onerror=function(){o=!0,s=Error("Stylesheet failed to load"),i()}):setTimeout(function(){o=!0,i()},0),d(e,"head",t)}function m(e,t,n,i){var o=e.c.getElementsByTagName("head")[0];if(o){var r=c(e,"script",{src:t}),s=!1;return r.onload=r.onreadystatechange=function(){s||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(s=!0,n&&n(null),r.onload=r.onreadystatechange=null,"HEAD"==r.parentNode.tagName&&o.removeChild(r))},o.appendChild(r),setTimeout(function(){s||(s=!0,n&&n(Error("Script load timeout")))},i||5e3),r}return null}function y(){this.a=0,this.c=null}function v(e){return e.a++,function(){e.a--,w(e)}}function b(e,t){e.c=t,w(e)}function w(e){0==e.a&&e.c&&(e.c(),e.c=null)}function _(e){this.a=e||"-"}function S(e,t){this.c=e,this.f=4,this.a="n";var n=(t||"n4").match(/^([nio])([1-9])$/i);n&&(this.a=n[1],this.f=parseInt(n[2],10))}function O(e){var t=[];e=e.split(/,\s*/);for(var n=0;n<e.length;n++){var i=e[n].replace(/['"]/g,"");-1!=i.indexOf(" ")||/^\d/.test(i)?t.push("'"+i+"'"):t.push(i)}return t.join(",")}function N(e){return e.a+e.f}function C(e){var t="normal";return"o"===e.a?t="oblique":"i"===e.a&&(t="italic"),t}function x(e){var t=4,n="n",i=null;return e&&((i=e.match(/(normal|oblique|italic)/i))&&i[1]&&(n=i[1].substr(0,1).toLowerCase()),(i=e.match(/([1-9]00|normal|bold)/i))&&i[1]&&(/bold/i.test(i[1])?t=7:/[1-9]00/.test(i[1])&&(t=parseInt(i[1].substr(0,1),10)))),n+t}function T(e,t){this.c=e,this.f=e.o.document.documentElement,this.h=t,this.a=new _("-"),this.j=!1!==t.events,this.g=!1!==t.classes}function k(e){if(e.g){var t=f(e.f,e.a.c("wf","active")),n=[],i=[e.a.c("wf","loading")];t||n.push(e.a.c("wf","inactive")),h(e.f,n,i)}E(e,"inactive")}function E(e,t,n){e.j&&e.h[t]&&(n?e.h[t](n.c,N(n)):e.h[t]())}function I(){this.c={}}function P(e,t){this.c=e,this.f=t,this.a=c(this.c,"span",{"aria-hidden":"true"},this.f)}function R(e){d(e.c,"body",e.a)}function A(e){return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+O(e.c)+";font-style:"+C(e)+";font-weight:"+e.f+"00;"}function D(e,t,n,i,o,r){this.g=e,this.j=t,this.a=i,this.c=n,this.f=o||3e3,this.h=r||void 0}function F(e,t,n,i,o,r,s){this.v=e,this.B=t,this.c=n,this.a=i,this.s=s||"BESbswy",this.f={},this.w=o||3e3,this.u=r||null,this.m=this.j=this.h=this.g=null,this.g=new P(this.c,this.s),this.h=new P(this.c,this.s),this.j=new P(this.c,this.s),this.m=new P(this.c,this.s),e=A(e=new S(this.a.c+",serif",N(this.a))),this.g.a.style.cssText=e,e=A(e=new S(this.a.c+",sans-serif",N(this.a))),this.h.a.style.cssText=e,e=A(e=new S("serif",N(this.a))),this.j.a.style.cssText=e,e=A(e=new S("sans-serif",N(this.a))),this.m.a.style.cssText=e,R(this.g),R(this.h),R(this.j),R(this.m)}_.prototype.c=function(e){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n].replace(/[\W_]+/g,"").toLowerCase());return t.join(this.a)},D.prototype.start=function(){var e=this.c.o.document,t=this,n=a(),i=new Promise(function(i,o){!function r(){a()-n>=t.f?o():e.fonts.load(function(e){return C(e)+" "+e.f+"00 300px "+O(e.c)}(t.a),t.h).then(function(e){1<=e.length?i():setTimeout(r,25)},function(){o()})}()}),o=null,r=new Promise(function(e,n){o=setTimeout(n,t.f)});Promise.race([r,i]).then(function(){o&&(clearTimeout(o),o=null),t.g(t.a)},function(){t.j(t.a)})};var M={D:"serif",C:"sans-serif"},j=null;function V(){if(null===j){var e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);j=!!e&&(536>parseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))}return j}function L(e,t,n){for(var i in M)if(M.hasOwnProperty(i)&&t===e.f[M[i]]&&n===e.f[M[i]])return!0;return!1}function U(e){var t,n=e.g.a.offsetWidth,i=e.h.a.offsetWidth;(t=n===e.f.serif&&i===e.f["sans-serif"])||(t=V()&&L(e,n,i)),t?a()-e.A>=e.w?V()&&L(e,n,i)&&(null===e.u||e.u.hasOwnProperty(e.a.c))?B(e,e.v):B(e,e.B):function(e){setTimeout(s(function(){U(this)},e),50)}(e):B(e,e.v)}function B(e,t){setTimeout(s(function(){p(this.g.a),p(this.h.a),p(this.j.a),p(this.m.a),t(this.a)},e),0)}function W(e,t,n){this.c=e,this.a=t,this.f=0,this.m=this.j=!1,this.s=n}F.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=a(),U(this)};var z=null;function q(e){0==--e.f&&e.j&&(e.m?((e=e.a).g&&h(e.f,[e.a.c("wf","active")],[e.a.c("wf","loading"),e.a.c("wf","inactive")]),E(e,"active")):k(e.a))}function H(e){this.j=e,this.a=new I,this.h=0,this.f=this.g=!0}function G(e,t,n,i,o){var r=0==--e.h;(e.f||e.g)&&setTimeout(function(){var e=o||null,a=i||{};if(0===n.length&&r)k(t.a);else{t.f+=n.length,r&&(t.j=r);var l,u=[];for(l=0;l<n.length;l++){var c=n[l],d=a[c.c],p=t.a,f=c;if(p.g&&h(p.f,[p.a.c("wf",f.c,N(f).toString(),"loading")]),E(p,"fontloading",f),p=null,null===z)if(window.FontFace){f=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent);var g=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);z=f?42<parseInt(f[1],10):!g}else z=!1;p=z?new D(s(t.g,t),s(t.h,t),t.c,c,t.s,d):new F(s(t.g,t),s(t.h,t),t.c,c,t.s,e,d),u.push(p)}for(l=0;l<u.length;l++)u[l].start()}},0)}function $(e,t){this.c=e,this.a=t}function X(e,t){this.c=e,this.a=t}function Y(e,t){this.c=e||K,this.a=[],this.f=[],this.g=t||""}W.prototype.g=function(e){var t=this.a;t.g&&h(t.f,[t.a.c("wf",e.c,N(e).toString(),"active")],[t.a.c("wf",e.c,N(e).toString(),"loading"),t.a.c("wf",e.c,N(e).toString(),"inactive")]),E(t,"fontactive",e),this.m=!0,q(this)},W.prototype.h=function(e){var t=this.a;if(t.g){var n=f(t.f,t.a.c("wf",e.c,N(e).toString(),"active")),i=[],o=[t.a.c("wf",e.c,N(e).toString(),"loading")];n||i.push(t.a.c("wf",e.c,N(e).toString(),"inactive")),h(t.f,i,o)}E(t,"fontinactive",e),q(this)},H.prototype.load=function(e){this.c=new l(this.j,e.context||this.j),this.g=!1!==e.events,this.f=!1!==e.classes,function(e,t,n){var i=[],o=n.timeout;!function(e){e.g&&h(e.f,[e.a.c("wf","loading")]),E(e,"loading")}(t),i=function(e,t,n){var i,o=[];for(i in t)if(t.hasOwnProperty(i)){var r=e.c[i];r&&o.push(r(t[i],n))}return o}(e.a,n,e.c);var r=new W(e.c,t,o);for(e.h=i.length,t=0,n=i.length;t<n;t++)i[t].load(function(t,n,i){G(e,r,t,n,i)})}(this,new T(this.c,e),e)},$.prototype.load=function(e){function t(){if(r["__mti_fntLst"+i]){var n,o=r["__mti_fntLst"+i](),s=[];if(o)for(var a=0;a<o.length;a++){var l=o[a].fontfamily;null!=o[a].fontStyle&&null!=o[a].fontWeight?(n=o[a].fontStyle+o[a].fontWeight,s.push(new S(l,n))):s.push(new S(l))}e(s)}else setTimeout(function(){t()},50)}var n=this,i=n.a.projectId,o=n.a.version;if(i){var r=n.c.o;m(this.c,(n.a.api||"https://fast.fonts.net/jsapi")+"/"+i+".js"+(o?"?v="+o:""),function(o){o?e([]):(r["__MonotypeConfiguration__"+i]=function(){return n.a},t())}).id="__MonotypeAPIScript__"+i}else e([])},X.prototype.load=function(e){var t,n,i=this.a.urls||[],o=this.a.families||[],r=this.a.testStrings||{},s=new y;for(t=0,n=i.length;t<n;t++)g(this.c,i[t],v(s));var a=[];for(t=0,n=o.length;t<n;t++)if((i=o[t].split(":"))[1])for(var l=i[1].split(","),u=0;u<l.length;u+=1)a.push(new S(i[0],l[u]));else a.push(new S(i[0]));b(s,function(){e(a,r)})};var K="https://fonts.googleapis.com/css";function J(e){this.f=e,this.a=[],this.c={}}var Q={latin:"BESbswy","latin-ext":"çöüğş",cyrillic:"йяЖ",greek:"αβΣ",khmer:"កខគ",Hanuman:"កខគ"},Z={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},ee={i:"i",italic:"i",n:"n",normal:"n"},te=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;function ne(e,t){this.c=e,this.a=t}var ie={Arimo:!0,Cousine:!0,Tinos:!0};function oe(e,t){this.c=e,this.a=t}function re(e,t){this.c=e,this.f=t,this.a=[]}ne.prototype.load=function(e){var t=new y,n=this.c,i=new Y(this.a.api,this.a.text),o=this.a.families;!function(e,t){for(var n=t.length,i=0;i<n;i++){var o=t[i].split(":");3==o.length&&e.f.push(o.pop());var r="";2==o.length&&""!=o[1]&&(r=":"),e.a.push(o.join(r))}}(i,o);var r=new J(o);!function(e){for(var t=e.f.length,n=0;n<t;n++){var i=e.f[n].split(":"),o=i[0].replace(/\+/g," "),r=["n4"];if(2<=i.length){var s;if(s=[],a=i[1])for(var a,l=(a=a.split(",")).length,u=0;u<l;u++){var c;if((c=a[u]).match(/^[\w-]+$/))if(null==(d=te.exec(c.toLowerCase())))c="";else{if(c=null==(c=d[2])||""==c?"n":ee[c],null==(d=d[1])||""==d)d="4";else var d=Z[d]||(isNaN(d)?"4":d.substr(0,1));c=[c,d].join("")}else c="";c&&s.push(c)}0<s.length&&(r=s),3==i.length&&(s=[],0<(i=(i=i[2])?i.split(","):s).length&&(i=Q[i[0]])&&(e.c[o]=i))}for(e.c[o]||(i=Q[o])&&(e.c[o]=i),i=0;i<r.length;i+=1)e.a.push(new S(o,r[i]))}}(r),g(n,function(e){if(0==e.a.length)throw Error("No fonts to load!");if(-1!=e.c.indexOf("kit="))return e.c;for(var t=e.a.length,n=[],i=0;i<t;i++)n.push(e.a[i].replace(/ /g,"+"));return t=e.c+"?family="+n.join("%7C"),0<e.f.length&&(t+="&subset="+e.f.join(",")),0<e.g.length&&(t+="&text="+encodeURIComponent(e.g)),t}(i),v(t)),b(t,function(){e(r.a,r.c,ie)})},oe.prototype.load=function(e){var t=this.a.id,n=this.c.o;t?m(this.c,(this.a.api||"https://use.typekit.net")+"/"+t+".js",function(t){if(t)e([]);else if(n.Typekit&&n.Typekit.config&&n.Typekit.config.fn){t=n.Typekit.config.fn;for(var i=[],o=0;o<t.length;o+=2)for(var r=t[o],s=t[o+1],a=0;a<s.length;a++)i.push(new S(r,s[a]));try{n.Typekit.load({events:!1,classes:!1,async:!0})}catch(e){}e(i)}},2e3):e([])},re.prototype.load=function(e){var t=this.f.id,n=this.c.o,i=this;t?(n.__webfontfontdeckmodule__||(n.__webfontfontdeckmodule__={}),n.__webfontfontdeckmodule__[t]=function(t,n){for(var o=0,r=n.fonts.length;o<r;++o){var s=n.fonts[o];i.a.push(new S(s.name,x("font-weight:"+s.weight+";font-style:"+s.style)))}e(i.a)},m(this.c,(this.f.api||"https://f.fontdeck.com/s/css/js/")+function(e){return e.o.location.hostname||e.a.location.hostname}(this.c)+"/"+t+".js",function(t){t&&e([])})):e([])};var se=new H(window);se.a.c.custom=function(e,t){return new X(t,e)},se.a.c.fontdeck=function(e,t){return new re(t,e)},se.a.c.monotype=function(e,t){return new $(t,e)},se.a.c.typekit=function(e,t){return new oe(t,e)},se.a.c.google=function(e,t){return new ne(t,e)};var ae={load:s(se.load,se)};void 0===(i=function(){return ae}.call(t,n,t,e))||(e.exports=i)}()},7011(e,t,n){const i=n(3538),o=n(6835),r=n(1656),s=n(822),{ParseWireAdapter:a}=n(6342),{RestDataAdapter:l}=n(4758),{makeRestSerializer:u,filterSchemaFor:c}=n(9327),{relationsFromCachedCollections:d}=n(8995),{resolveBackendFromRuntime:p,ACTIVE_BACKEND:h,hasStoredRelations:f}=n(8479);class g{constructor(e,t){this._initCloudServices(),this.modelScope=e,this._target=t,this.usesNeutralFilter=Boolean(t&&!t.isParseWire),this._adapter=this.usesNeutralFilter?new l({serializeObject:u({collections:()=>this._target?this._target.collections:[],toJSON:m}),schemaFor:e=>c(this._target?this._target.collections:[],e),relationsFor:()=>{const e=this._target;return e?f(e)?e.relations:d(e.collections):[]}}):new a({serializeObject:(e,t)=>y(e,t),getServerVersionMajor:()=>this.dbVersionMajor}),this.events=this._adapter.events,this._fromJSON=(t,n)=>g._fromJSON(t,n,e),this._deserializeJSON=(t,n)=>g._deserializeJSON(t,n,e),this._serializeObject=(t,n)=>g._serializeObject(t,n,e)}_initCloudServices(){S=void 0;const e=i.instance.getMetaData("cloudservices");e&&(this.appId=e.appId,this.endpoint=e.endpoint);const t=i.instance.getMetaData("dbVersionMajor");this.dbVersionMajor=t}_handle(){return this._target?this._target.handle:{id:h,type:"nodegx",name:"Built-in",url:this.endpoint,publicToken:this.appId}}backendType(){return this._handle().type}on(){this.events.on.apply(this.events,arguments)}off(){this.events.off.apply(this.events,arguments)}_makeRequest(e,t){this._adapter._makeRequest(this._handle(),e,t)}query(e){this._adapter.query(this._handle(),e)}aggregate(e){this._adapter.aggregate(this._handle(),e)}count(e){this._adapter.count(this._handle(),e)}distinct(e){this._adapter.distinct(this._handle(),e)}fetch(e){this._adapter.fetch(this._handle(),e)}create(e){this._adapter.create(this._handle(),e)}increment(e){this._adapter.increment(this._handle(),e)}save(e){this._adapter.save(this._handle(),e)}delete(e){this._adapter.delete(this._handle(),e)}addRelation(e){this._adapter.addRelation(this._handle(),e)}removeRelation(e){this._adapter.removeRelation(this._handle(),e)}uploadFile(e){this._adapter.uploadFile(this._handle(),e)}signFileUrl(e){this._adapter.signFileUrl(this._handle(),e)}deleteFile(e){this._adapter.deleteFile(this._handle(),e)}currentUserId(){return this._adapter.currentUserId(this._handle())}}function m(e){if(e instanceof o){var t={};for(var n in e.data)t[n]=m(e.data[n]);return t}return e instanceof r?(t=[],e.items.forEach(e=>{t.push(m(e))}),t):e}function y(e,t,n){if(g._collections[t])var i=g._collections[t].schema;for(var a in e){var l=i&&i.properties&&i.properties[a]?i.properties[a].type:void 0;if(void 0===e[a]||null===e[a]);else if("Pointer"===l&&"string"==typeof e[a])e[a]={__type:"Pointer",className:i.properties[a].targetClass,objectId:e[a]};else if("Pointer"===l&&"object"==typeof e[a]&&(n||o).instanceOf(e[a]))e[a]={__type:"Pointer",className:i.properties[a].targetClass,objectId:e[a].getId()};else if("Date"===l&&("string"==typeof e[a]||e[a]instanceof Date))e[a]={__type:"Date",iso:e[a]instanceof Date?e[a].toISOString():e[a]};else if("File"===l&&e[a]instanceof s){const t=e[a];e[a]={__type:"File",url:t.getUrl(),name:t.getName()}}else"Array"===l&&"string"==typeof e[a]&&r.exists(e[a])?e[a]=m(r.get(e[a])):"Object"===l&&"string"==typeof e[a]&&(n||o).exists(e[a])?e[a]=m((n||o).get(e[a])):"GeoPoint"===l&&"object"==typeof e[a]?e[a]={__type:"GeoPoint",latitude:Number(e[a].latitude),longitude:Number(e[a].longitude)}:e[a]=m(e[a])}return e}function v(e,t,n){if(void 0!==e){if(null===e)return null;if("Relation"!==t||"Relation"!==e.__type){if("Pointer"===t&&"Pointer"===e.__type)return e.objectId;if("Date"===t&&"Date"===e.__type)return new Date(e.iso);if("Date"===t&&"string"==typeof e)return new Date(e);if("File"===t&&"File"===e.__type)return new s(e);if("GeoPoint"===t&&"GeoPoint"===e.__type)return{latitude:e.latitude,longitude:e.longitude};if(function(e){if(!Array.isArray(e))return!1;for(var t=0;t<e.length;t++)if("object"!=typeof e[t]||null===e[t])return!1;return!0}(e)){for(var i=[],a=0;a<e.length;a++)i.push(v(e[a],void 0,n));var l=r.get();return l.set(i),l}if(Array.isArray(e))return e;if(e&&"Object"===e.__type&&void 0!==e.className&&void 0!==e.objectId){const t=Object.assign({},e);return delete t.className,delete t.__type,b(t,e.className,n)}if("object"==typeof e&&null!==e){var u=(n||o).get();for(var c in e)u.set(c,v(e[c],void 0,n));return u}return e}}}function b(e,t,n){const i=(n||o).get(e.objectId);if(i._class=t,void 0!==t&&void 0!==g._collections[t])var r=g._collections[t].schema;for(var s in e){if("objectId"===s||"ACL"===s)continue;var a=r&&r.properties&&r.properties[s]?r.properties[s].type:void 0;const t=v(e[s],a,n);Array.isArray(t)&&w(i.get(s),t)||i.set(s,t)}return i}function w(e,t){if(!Array.isArray(e)||e.length!==t.length)return!1;try{return JSON.stringify(m(e))===JSON.stringify(m(t))}catch(e){return!1}}var _,S;g._fromJSON=b,g._plainFromJSON=function e(t){const n={};for(const i in t){if("ACL"===i)continue;const o=t[i];if(o&&"object"==typeof o&&!Array.isArray(o)){if("Relation"===o.__type)continue;if("Date"===o.__type&&"string"==typeof o.iso){n[i]=o.iso;continue}if("Pointer"===o.__type&&void 0!==o.objectId){n[i]=o.objectId;continue}if("Object"===o.__type&&void 0!==o.className&&void 0!==o.objectId){const t=Object.assign({},o);delete t.__type,delete t.className,n[i]=e(t);continue}}n[i]=o}return n},g._deserializeJSON=v,g._serializeObject=y,g._toJSON=m,g.forScope=e=>void 0===e?g.instance:(e._cloudStore||(e._cloudStore=new g(e)),e._cloudStore),g.forBackend=(e,t)=>{const n=p(t);if(!n)return t&&t!==h?void 0:g.forScope(e);if(n.isParseWire&&"_endpoint_"===n.entry.id)return g.forScope(e);const i=e||g;return void 0===i._cloudStoresByBackend&&(i._cloudStoresByBackend={}),void 0===i._cloudStoresByBackend[n.entry.id]?i._cloudStoresByBackend[n.entry.id]=new g(e,n):i._cloudStoresByBackend[n.entry.id]._target=n,i._cloudStoresByBackend[n.entry.id]},g.invalidateBackends=e=>{(e||g)._cloudStoresByBackend=void 0},Object.defineProperty(g,"instance",{get:function(){return void 0===_&&(_=new g),_}}),Object.defineProperty(g,"_collections",{get:function(){return void 0===S&&(S={},(i.instance.getMetaData("dbCollections")||[]).forEach(e=>{S[e.name]=e}),(i.instance.getMetaData("systemCollections")||[]).forEach(e=>{S[e.name]=e})),S}}),g.invalidateCollections=()=>{S=void 0},e.exports=g},2423(e,t,n){const i=n(7011),o=n(3024),r=n(6835);e.exports=function(e){let t;const n=()=>(t||(t=new i(e)),t);return{async query(t,r,s){if(void 0===t)throw new Error("'className' is undefined");return new Promise((a,l)=>{n().query({collection:t,where:o.convertFilterOp(r||{},{collectionName:t,error:e=>l(e),modelScope:e}),limit:s?s.limit:void 0,sort:s?s.sort:void 0,skip:s?s.skip:void 0,include:s?s.include:void 0,select:s?s.select:void 0,count:s?s.count:void 0,success:(e,o)=>{const r=s&&s.plain?e.map(e=>i._plainFromJSON(e)):e.map(e=>n()._fromJSON(e,t));a(void 0!==o?{results:r,count:o}:r)},error:e=>{l(Error(e||"Failed to query."))}})})},async count(t,i){if(void 0===t)throw new Error("'className' is undefined");return new Promise((r,s)=>{n().count({collection:t,where:i?o.convertFilterOp(i||{},{collectionName:t,error:e=>s(e),modelScope:e}):void 0,success:e=>{r(e)},error:e=>{s(Error(e||"Failed to query."))}})})},async distinct(t,i,r){if(void 0===t)throw new Error("'className' is undefined");return new Promise((s,a)=>{n().distinct({collection:t,property:i,where:r?o.convertFilterOp(r||{},{collectionName:t,error:e=>a(e),modelScope:e}):void 0,success:e=>{s(e)},error:e=>{a(Error(e||"Failed to query."))}})})},async aggregate(t,i,r){if(void 0===t)throw new Error("'className' is undefined");return new Promise((s,a)=>{n().aggregate({collection:t,group:i,where:r?o.convertFilterOp(r||{},{collectionName:t,error:e=>a(e),modelScope:e}):void 0,success:e=>{s(e)},error:e=>{a(Error(e||"Failed to aggregate."))}})})},async fetch(t,o){if(void 0===t)return Promise.reject(new Error("'objectOrId' is undefined."));"string"!=typeof t&&(t=t.getId());const s=(o?o.className:void 0)||(e||r).get(t)._class;return new Promise((e,r)=>{if(!s)return r("No class name specified");n().fetch({collection:s,objectId:t,include:o?o.include:void 0,success:function(t){if(o&&o.plain)return e(i._plainFromJSON(t));var r=n()._fromJSON(t,s);e(r)},error:function(e){r(Error(e||"Failed to fetch."))}})})},async increment(t,i,o){if(void 0===t)return Promise.reject(new Error("'objectOrId' is undefined."));"string"!=typeof t&&(t=t.getId());const s=(o?o.className:void 0)||(e||r).get(t)._class;return new Promise((e,o)=>{if(!s)return o("No class name specified");n().increment({collection:s,objectId:t,properties:i,success:i=>{n()._fromJSON(Object.assign({objectId:t},i),s),e()},error:e=>{o(Error(e||"Failed to increment."))}})})},async save(t,i,o){if(void 0===t)return Promise.reject(new Error("'objectOrId' is undefined."));"string"!=typeof t&&(t=t.getId());const s=(o?o.className:void 0)||(e||r).get(t)._class,a=(e||r).get(t),l=o?o.ifMatch:void 0,u={};return i&&Object.keys(i).forEach(e=>{u[e]=a.get(e),a.set(e,i[e])}),new Promise((e,r)=>{if(!s)return r("No class name specified");n().save({collection:s,objectId:t,data:i||a.data,acl:o?o.acl:void 0,ifMatch:l,success:i=>{n()._fromJSON(Object.assign({objectId:t},i),s),e()},error:(e,t)=>{const n=Error(e||"Failed to save.");t&&"precondition-failed"===t.reason&&(n.code="precondition-failed",n.expected=t.expected,Object.keys(u).forEach(e=>a.set(e,u[e]))),r(n)}})})},async create(e,t,i){if(void 0===e)throw new Error("'className' is undefined");return new Promise((o,r)=>{n().create({collection:e,data:t,acl:i?i.acl:void 0,success:t=>{const i=n()._fromJSON(t,e);o(i)},error:e=>{r(Error(e||"Failed to insert."))}})})},async delete(t,i){if(void 0===t)return Promise.reject(new Error("'objectOrId' is undefined."));"string"!=typeof t&&(t=t.getId());const o=(i?i.className:void 0)||(e||r).get(t)._class;return new Promise((i,s)=>{if(!o)return s("No class name specified");n().delete({collection:o,objectId:t,success:()=>{(e||r).get(t).notify("delete"),i()},error:e=>{s(Error(e||"Failed to delete."))}})})},async addRelation(t){const i=t.recordId||t.record.getId(),o=t.className||(e||r).get(i)._class,s=t.targetRecordId||t.targetRecord.getId(),a=t.targetClassName||(e||r).get(s)._class;return new Promise((e,r)=>o?a?void n().addRelation({collection:o,objectId:i,key:t.key,targetObjectId:s,targetCollection:a,success:t=>{e()},error:e=>{r(Error(e||"Failed to add relation."))}}):r("No target class name specified"):r("No class name specified"))},async removeRelation(t){const i=t.recordId||t.record.getId(),o=t.className||(e||r).get(i)._class,s=t.targetRecordId||t.targetRecord.getId(),a=t.targetClassName||(e||r).get(s)._class;return new Promise((e,r)=>o?a?void n().removeRelation({collection:o,objectId:i,key:t.key,targetObjectId:s,targetCollection:a,success:t=>{e()},error:e=>{r(Error(e||"Failed to add relation."))}}):r("No target class name specified"):r("No class name specified"))}}}},5293(e){"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function r(){r.init.call(this)}e.exports=r,e.exports.once=function(e,t){return new Promise(function(n,i){function o(n){e.removeListener(t,r),i(n)}function r(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}g(e,t,r,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,o)})},r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var o,r,s,u;if(a(n),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),r=e._events),s=r[t]),void 0===s)s=r[t]=n,++e._eventsCount;else if("function"==typeof s?s=r[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),(o=l(e))>0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,u=c,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=c.bind(i);return o.listener=n,i.wrapFn=o,o}function p(e,t,n){var i=e._events;if(void 0===i)return[];var o=i[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):f(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function f(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function g(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function o(r){i.once&&e.removeEventListener(t,o),n(r)})}}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),r.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},r.prototype.getMaxListeners=function(){return l(this)},r.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var o="error"===e,r=this._events;if(void 0!==r)o=o&&void 0===r.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=r[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=f(l,u);for(n=0;n<u;++n)i(c[n],this,t)}return!0},r.prototype.addListener=function(e,t){return u(this,e,t,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(e,t){return u(this,e,t,!0)},r.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},r.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},r.prototype.removeListener=function(e,t){var n,i,o,r,s;if(a(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,r=n.length-1;r>=0;r--)if(n[r]===t||n[r].listener===t){s=n[r].listener,o=r;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,s||t)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,r=Object.keys(n);for(i=0;i<r.length;++i)"removeListener"!==(o=r[i])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},r.prototype.listeners=function(e){return p(this,e,!0)},r.prototype.rawListeners=function(e){return p(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},r.prototype.listenerCount=h,r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},8600(e,t,n){"use strict";const i=n(6835),{getAbsoluteUrl:o}=n(7831),{findAncestorWithComponentObject:r}=n(1608),{resolveForEachItem:s}=n(3099);var a={};function l(e,t){this.inputs={},this.outputs={},this.error=void 0,this.code=e;const n=t?t.node:void 0;this._initializeAPIs();var i=a[e];if(!i)try{i=new Function(["define","script","Node","Component"],l.getCodePrefix()+e),a[e]=i}catch(e){this.error=e.message,console.error(e)}if(i)try{i(this.define.bind(this),this.script.bind(this),this.apis.Node,n?l.getComponentScopeForNode(n):{}),this._afterSourced()}catch(e){this.error=e.message,console.error(e)}}function u(e){var t=Object.create(l.prototype);return t.inputs={},t.outputs={},t.error=e,t.code=void 0,t.apis={Node:{}},t}l.prototype.define=function(e){this.inputs=e.inputs||{},this.outputs=e.outputs||{},this.setup=e.setup,this.change=e.run||e.change,this.destroy=e.destroy,this.definedObject=e},l.prototype.script=function(e){var t=function(e){var t={inputs:e.inputs||{},outputs:e.outputs||{},setup:function(t,n){if(this.inputs=t,this.outputs=n,this.setOutputs=function(e){for(var t in e)this.outputs[t]=e[t],this.flagOutputDirty(t)},e.methods)for(var i in e.methods)this[i]=e.methods[i];e.setup&&e.setup.apply(this)},destroy:function(t,n){this.inputs=t,this.outputs=n,e.destroy&&e.destroy.apply(this)},change:function(t,n){this.inputs=t,this.outputs=n;var i=this._oldInputs||{};if(e.changed)for(var o in t)if(t[o]!==i[o]){var r=e.changed[o];"function"==typeof r&&r.apply(this,[t[o],i[o]])}this._oldInputs=Object.assign({},t)}};if(e.signals)for(var n in e.signals)t[n]=e.signals[n],t.inputs[n]="signal";return t}(e);this.inputs=t.inputs||{},this.outputs=t.outputs||{},this.setup=t.setup,this.change=t.run||t.change,this.destroy=t.destroy,this.definedObject=t},l.prototype._initializeAPIs=function(){this.apis={Node:{Inputs:{},Outputs:{},Signals:{},Setters:{}}}},l.prototype._afterSourced=function(){if(void 0===this.definedObject){var e=this.apis.Node;if(this.inputs=Object.assign({},e.Inputs||{}),this.outputs=Object.assign({},e.Outputs||{}),this.setup=function(t,n){const i=this;e.setOutputs=function(e){for(var t in e)n[t]=e[t],i.flagOutputDirty(t)},e.OnInit&&e.OnInit.apply(this)},this.destroy=e.OnDestroy||this.destory,this.change=(t,n,i)=>{for(var o in i)"function"==typeof e.Setters[o]&&e.Setters[o](t[o]);"function"==typeof e.OnInputsChanged&&e.OnInputsChanged()},this.definedObject={inputs:this.inputs,outputs:this.outputs,setup:this.setup,destroy:this.destroy,change:this.change},void 0!==e.Signals)for(var t in e.Signals)"function"==typeof e.Signals[t]&&(this.inputs[t]="signal",this.definedObject[t]=e.Signals[t])}},l.createFromCode=function(e,t){return new l(e,t)},l.createFromURL=function(e,t,n){e=o(e);var i=!1;function r(e){i||(i=!0,t(e))}var s=new window.XMLHttpRequest;s.open("GET",e,!0),s.onreadystatechange=function(){if(4===this.readyState||this.readyState===XMLHttpRequest.DONE){if(0!==this.status&&(this.status<200||this.status>=300))return void r(u('Could not load "'+e+'": the server answered '+this.status));if(0===this.status)return void r(u('Could not load "'+e+'": the request failed'));r(new l(this.response,n))}},s.onerror=function(){r(u('Could not load "'+e+'": the request failed'))},s.send()},l.parseAndAddPortsFromScript=function(e,t,n){function i(e,n){if(null==e)return;const i={};for(const t of e){let e=t[1];void 0!==e&&(i[e]=!0)}Object.keys(i).forEach(e=>{var i;("string"==typeof(i={name:n.prefix+e,plug:n.plug})?void 0===t.find(e=>e.name===i):void 0===t.find(e=>e.name===i.name&&e.plug===i.plug))&&t.push({name:n.prefix+e,displayName:e,plug:n.plug,type:n.type,group:n.group})})}n.skipInputs||(i(e.matchAll(/Inputs\.([A-Za-z0-9_]+)/g),{type:n.inputType||"*",plug:"input",group:n.inputGroup||"Inputs",prefix:n.inputPrefix||""}),i(e.matchAll(/Inputs\s*\[\s*(?:'|")(.*)(?:'|")\s*\]/g),{type:n.inputType||"*",plug:"inputs",group:n.inputGroup||"Inputs",prefix:n.inputPrefix||""})),n.skipOutputs||(n.skipOutputSignals||(i(e.matchAll(/Outputs\.([A-Za-z0-9]+)\s*\(\s*\)/g),{type:"signal",plug:"output",group:"Outputs",prefix:n.outputPrefix||""}),i(e.matchAll(/Outputs\s*\[\s*(?:'|")(.*)(?:'|")\s*\]\(\s*\)/g),{type:"signal",plug:"output",group:"Outputs",prefix:n.outputPrefix||""})),n.skipRegularOutputs||(i(e.matchAll(/Outputs\.([A-Za-z0-9_]+)/g),{type:"*",plug:"output",group:"Outputs",prefix:n.outputPrefix||""}),i(e.matchAll(/Outputs\s*\[\s*\"([^\"]*)\"\s*\]/g),{type:"*",plug:"output",group:"Outputs",prefix:n.outputPrefix||""})))},l.prototype.getPorts=function(){var e=[],t=this;return Object.keys(this.inputs).forEach(function(n){var i=t.inputs[n],o={name:n,plug:"input"};if("string"==typeof i)o.type={name:i},o.group="Inputs";else for(var r in i)o[r]=i[r];e.push(o)}),Object.keys(this.outputs).forEach(function(n){e.push({name:n,type:{name:t.outputs[n]},plug:"output",group:"Outputs"})}),l.parseAndAddPortsFromScript(this.code,e,{}),e};const c={};l.getComponentScopeForNode=function(e){const t=e.nodeScope.componentOwner.getInstanceId();if(void 0===c[t]){c[t]={};const n=(e.nodeScope.modelScope||i).get("componentState"+t);c[t].Object=n}const n=function(e){const t=r(e.nodeScope.componentOwner);if(t)return"componentState"+t.getInstanceId()}(e),o=void 0!==n?(e.nodeScope.modelScope||i).get(n):void 0;return c[t].ParentObject=o,Object.defineProperty(c[t],"RepeaterObject",{configurable:!0,enumerable:!0,get:function(){return s(e)}}),c[t]},l.getCodePrefix=function(){return"const Script = (typeof Node !== 'undefined')?Node:undefined;\n"},l.createNoodlAPI=function(){return"undefined"!=typeof window&&void 0!==window.Noodl?window.Noodl:{}},e.exports=l},7685(e){e.exports=function(e,t,n,i,o,r,s){void 0===s&&(s=this.options);var a=e-t,l=Math.abs(a)/n,u=s.deceleration,c=(s.swipeBounceTime,{destination:e+l/u*(a<0?-1:1),duration:s.swipeTime,rate:15});return this.hooks.trigger(this.hooks.eventTypes.momentum,c,a),c.destination<i?(c.destination=r?Math.max(i-r/4,i-r/c.rate*l):i,c.duration=Math.abs(c.destination-e)/l):c.destination>o&&(c.destination=r?Math.min(o+r/4,o+r/c.rate*l):o,c.duration=Math.abs(c.destination-e)/l),c.destination=Math.round(c.destination),c}},5711(e){"use strict";function t(){return new Promise(e=>setTimeout(e,1))}e.exports={settle:async function(e,n){const{isIdle:i=()=>!0,quietTurns:o=10,maxTurns:r=3e3,tick:s=t}=n||{};let a=0,l=0;for(;a<o;){if(l>=r)return{settled:!1,turns:l};await s(),l++,e.rootComponent&&e.rootComponent.triggerDidMount&&e.rootComponent.triggerDidMount(),e.updateScheduled||!i()?a=0:a++}return{settled:!0,turns:l}},createPageReadyGate:function(e){const t=new Set,n=[];return e.on("SSR_PageLoading",e=>{t.add(e)}),e.on("SSR_PageReady",e=>{t.delete(e),function(){if(0===t.size)for(;n.length>0;)n.pop()(!0)}()}),{hasPendingPages:()=>t.size>0,pendingPageIds:()=>Array.from(t),whenReady:e=>0===t.size?Promise.resolve(!0):new Promise(t=>{const i=setTimeout(()=>{const e=n.indexOf(o);-1!==e&&n.splice(e,1),t(!1)},void 0===e?1e4:e);function o(e){clearTimeout(i),t(e)}n.push(o)})}},createFetchTracker:function(e){let t=0;return{fetch:function(){let n;t++;try{n=e.apply(this,arguments)}catch(e){throw t--,e}return Promise.resolve(n).then(e=>(t--,e),e=>{throw t--,e})},isIdle:()=>0===t,inFlight:()=>t}},createXhrTracker:function(e){let t=0;return{XMLHttpRequest:function(){const n=new e;let i=!1;function o(){i&&(i=!1,t--)}n.addEventListener("readystatechange",function(){4===n.readyState&&o()});const r=n.send;return n.send=function(){i||(i=!0,t++);try{return r.apply(n,arguments)}catch(e){throw o(),e}},n},isIdle:()=>0===t,inFlight:()=>t}},defaultTick:t}},1594(e){"use strict";e.exports=React},5206(e){"use strict";e.exports=ReactDOM}};const __webpack_module_cache__={};function __webpack_require__(e){const t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;const n=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.loaded=!0,n.exports}__webpack_require__.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{if(Array.isArray(t))for(var n=0;n<t.length;){var i=t[n++],o=t[n++];__webpack_require__.o(e,i)?0===o&&n++:0===o?Object.defineProperty(e,i,{enumerable:!0,value:t[n++]}):Object.defineProperty(e,i,{enumerable:!0,get:o})}else for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),__webpack_require__.nc=void 0;let __webpack_exports__={};(()=>{"use strict";var e=__webpack_require__(1594),t=__webpack_require__.n(e),n=__webpack_require__(5206),i=__webpack_require__.n(n),o=__webpack_require__(3538),r=__webpack_require__.n(o),s=__webpack_require__(997),a=__webpack_require__(5354),l=__webpack_require__(551),u=null,c=function(){function e(){this.nodes=[]}return e.prototype.reset=function(){this.nodes=[]},e.prototype.setNodeFocused=function(e,t){var n=this.nodes.indexOf(e);return t?!(e._canFocus&&!e._canFocus()||(-1!==n?(e._hasFocus&&!e._hasFocus()&&e._focus(),0):(this.nodes.filter(function(t){return!t.contains(e)}).forEach(function(e){return e._blur()}),e._focus(),this.nodes.push(e),0))):(e._blur(),-1!==n&&this.nodes.splice(n,1),!0)},e.prototype.nodeUnmounted=function(e){var t=this.nodes.indexOf(e);-1!==t&&this.nodes.splice(t,1)},e.prototype.onClickCapture=function(e){for(var t=this,n=[],i=e;i;)i.noodlNode&&i.noodlNode._focus&&n.push(i.noodlNode),i=i.parentNode;var o=this.nodes.filter(function(e){return-1===n.indexOf(e)}),r=o.filter(function(e){return e._hasFocus&&e._hasFocus()});o.filter(function(e){return-1===r.indexOf(e)}).forEach(function(e){return e._blur()}),n.filter(function(e){return-1===t.nodes.indexOf(e)}).forEach(function(e){return e._focus()}),this.nodes=n.concat(r)},e}();const d=function(){function e(e,t){var n=this;this.graphModel=e,this.editorConnection=t,this.graphModel.getAllComponents().forEach(function(e){return n._bindComponentModel(e)}),this.graphModel.on("componentAdded",function(e){return n._bindComponentModel(e)},this),this.graphModel.on("componentRemoved",function(e){return e.removeListenersWithRef(n)},this)}return e.prototype._bindComponentModel=function(e){var t=this;e.on("rootAdded",function(){return t._evaluateWarnings(e)},this),e.on("rootRemoved",function(n){t.editorConnection.clearWarning(e.name,n,"multiple-visual-roots-warning"),t._evaluateWarnings(e)},this),this._evaluateWarnings(e)},e.prototype._evaluateWarnings=function(e){var t=e.getRoots();if(0!==t.lenth){this.editorConnection.clearWarning(e.name,t[0],"multiple-visual-roots-warning");for(var n=1;n<t.length;n++)this.editorConnection.sendWarning(e.name,t[n],"multiple-visual-roots-warning",{message:"This node is detached from the main node tree<br>and won't be rendered",level:"info"})}},e.prototype.dispose=function(){var e=this;this.graphModel.getAllComponents().forEach(function(t){t.removeListenersWithRef(e)}),this.graphModel.removeListenersWithRef(this)},e}();var p=function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))},h=Symbol.for("noodl.defaultStyleLayer"),f=["sizeMode","width","height","fixedWidth","fixedHeight","position"],g=["alignX","alignY","position"],m={position:["position"],width:p(p([],f,!0),["marginLeft","marginRight"],!1),height:p(p([],f,!0),["marginTop","marginBottom"],!1),flexGrow:f,flexShrink:f,left:g,right:g,top:g,bottom:g,transform:p(p([],g,!0),["transform"],!1),alignSelf:g,marginLeft:p(p([],g,!0),["marginLeft"],!1),marginRight:p(p([],g,!0),["marginRight"],!1),marginTop:p(p([],g,!0),["marginTop"],!1),marginBottom:p(p([],g,!0),["marginBottom"],!1)};function y(e,t){var n=e[h];if(n){for(var i=[],o=0,r=Object.keys(e);o<r.length;o++){var s=r[o];if(!n.authoredStyle.has(s)&&!n.authoredInputs.has(s)){var a=e[s];if(null!=a&&""!==a){var l=t&&t[s]||m[s];(l?!l.some(function(e){return n.authoredInputs.has(e)||n.authoredStyle.has(e)}):Object.prototype.hasOwnProperty.call(n.start,s)&&n.start[s]===a)&&(i.push([s,a]),delete e[s])}}}return i.length>0?function(e){var t=e.map(function(e){var t=e[0],n=e[1];return[w(t),_(t,n)]}),n=t.map(function(e){var t=e[0],n=e[1];return"".concat(t,":").concat(n)}).join(";"),i=O.get(n);if(i)return i;for(var o="ndl-d-"+function(e){for(var t=3735928559,n=1103547991,i=0;i<e.length;i++){var o=e.charCodeAt(i);t=Math.imul(t^o,2654435761),n=Math.imul(n^o,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&(n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909)))+(t>>>0)).toString(36)}(n);N.has(o)&&N.get(o)!==n;)o+="x";O.set(n,o),N.set(o,n),C.set(o,Object.freeze(Object.fromEntries(t)));var r=".".concat(o,"{").concat(n,"}");return x.push(r),function(e){var t="undefined"!=typeof document&&document.head?(k&&k.isConnected||(k=document.getElementById(S))||((k=document.createElement("style")).id=S,document.head.insertBefore(k,document.head.firstChild)),document.head.firstChild!==k&&document.head.insertBefore(k,document.head.firstChild),k.sheet):null;if(t)try{t.insertRule(e,t.cssRules.length)}catch(e){}}(r),o}(i):void 0}}function v(e,t){return t?e?"".concat(e," ").concat(t):t:e}var b=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function w(e){return e.startsWith("--")?e:e.replace(/^(Webkit|Moz|O)(?=[A-Z])/,function(e){return"-"+e.toLowerCase()}).replace(/^ms(?=[A-Z])/,"-ms").replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function _(e,t){return"number"!=typeof t||0===t||b.has(e)||e.startsWith("--")?String(t).trim():"".concat(t,"px")}var S="noodl-default-styles",O=new Map,N=new Map,C=new Map,x=[];function T(e){for(var t=0,n=Array.from(e.classList);t<n.length;t++){var i=n[t];if(i.startsWith("ndl-d-"))return C.get(i)}}globalThis.__noodlDefaultStyleRules=x;var k=null;function E(e){if(!e)return 0;var t=parseFloat(e);return isFinite(t)?t:0}function I(e,t){return{top:E(e.getPropertyValue(t("top"))),right:E(e.getPropertyValue(t("right"))),bottom:E(e.getPropertyValue(t("bottom"))),left:E(e.getPropertyValue(t("left")))}}function P(e,t){return{border:{x:e.x,y:e.y,width:e.width,height:e.height},margin:I(t,function(e){return"margin-"+e}),borderWidth:I(t,function(e){return"border-"+e+"-width"}),padding:I(t,function(e){return"padding-"+e})}}function R(e){return{x:e.border.x-e.margin.left,y:e.border.y-e.margin.top,width:e.border.width+e.margin.left+e.margin.right,height:e.border.height+e.margin.top+e.margin.bottom}}function A(e,t){return{x:e.x+t.left,y:e.y+t.top,width:Math.max(0,e.width-t.left-t.right),height:Math.max(0,e.height-t.top-t.bottom)}}function D(e){return A(e.border,e.borderWidth)}function F(e){return A(D(e),e.padding)}var M=["img","video","canvas","svg","iframe","embed","object","input","select","textarea"];function j(e){return{topLeft:E(e.getPropertyValue("border-top-left-radius")),topRight:E(e.getPropertyValue("border-top-right-radius")),bottomRight:E(e.getPropertyValue("border-bottom-right-radius")),bottomLeft:E(e.getPropertyValue("border-bottom-left-radius"))}}function V(e,t){if(-1!==M.indexOf((e||"").toLowerCase()))return!0;var n=t.getPropertyValue("overflow-x")||"visible",i=t.getPropertyValue("overflow-y")||"visible";return"visible"!==n||"visible"!==i}function L(e,t){return e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height}function U(e){var t=e.radii,n=e.borderRect,i=e.clips,o=e.childRects;if(i||!o||0===o.length)return t;var r=function(e,t,n){if(e<=0)return 0;for(var i={x:t,y:n,width:e,height:e},r=0;r<o.length;r++)if(L(o[r],i))return 0;return e};return{topLeft:r(t.topLeft,n.x,n.y),topRight:r(t.topRight,n.x+n.width-t.topRight,n.y),bottomRight:r(t.bottomRight,n.x+n.width-t.bottomRight,n.y+n.height-t.bottomRight),bottomLeft:r(t.bottomLeft,n.x,n.y+n.height-t.bottomLeft)}}function B(e){return e.topLeft+"px "+e.topRight+"px "+e.bottomRight+"px "+e.bottomLeft+"px"}function W(e){return Math.round(10*e)/10}function z(e){var t=/calc\(\s*([\d.]+%)/.exec(e);return t?t[1]:null}function q(e){return 0===e.indexOf("column")?"height":"width"}function H(e,t){var n=(t.specified.getPropertyValue(e)||"").trim(),i=t.parent?t.parent.computed.getPropertyValue("flex-direction")||"row":"",o=!!t.parent&&-1!==(t.parent.computed.getPropertyValue("display")||"").indexOf("flex"),r=parseFloat(t.computed.getPropertyValue("flex-grow")||"0")||0;if(o&&r>0&&q(i)===e){var s=n||z(n)||"";return e+": "+(s?s+" — shares":"shares")+" the "+("width"===q(i)?"row":"column")+" with its siblings (flex-grow: "+r+")"}if(!n)return e+": from its content";var a=z(n);return a?e+": "+a+" of the parent, less its own margins":"%"===n.charAt(n.length-1)?e+": "+n+" of the parent":e+": fixed "+n}function G(e,t){var n=(e||"").trim();return n&&"normal"!==n?n:t}var $={center:"centred across its parent","flex-start":"held to the start of its parent, not centred","flex-end":"held to the end of its parent, not centred",start:"held to the start of its parent, not centred",end:"held to the end of its parent, not centred",stretch:"stretched to fill its parent across"};var X="#14181C",Y="#F4F6F8",K="#14181C",J="#FFFFFF",Q="#C7D0DA",Z=["top","right","bottom","left"];function ee(e,t){return e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.boxSizing="border-box",e.style.borderStyle="solid",e.style.borderColor=t,e.style.borderWidth="0",e}function te(e,t){ne(e,t.x,t.y),e.style.width=t.width+"px",e.style.height=t.height+"px"}function ne(e,t,n){e.style.transform="translateX("+t+"px) translateY("+n+"px)"}function ie(e,t){e.style.borderWidth=t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px"}var oe=function(){function e(e){var t=document.createElement("div");t.setAttribute("data-noodl-box-overlay",""),t.style.pointerEvents="none",t.style.display="none",e.appendChild(t),this.root=t,this.marginDiv=ee(document.createElement("div"),"rgba(246, 178, 107, 0.55)"),this.borderDiv=ee(document.createElement("div"),"rgba(255, 229, 153, 0.55)"),this.paddingDiv=ee(document.createElement("div"),"rgba(147, 196, 125, 0.55)"),this.contentDiv=document.createElement("div"),this.contentDiv.style.position="absolute",this.contentDiv.style.top="0",this.contentDiv.style.left="0",this.contentDiv.style.backgroundColor="rgba(111, 168, 220, 0.30)",this.edgeDiv=document.createElement("div"),this.edgeDiv.style.position="absolute",this.edgeDiv.style.top="0",this.edgeDiv.style.left="0",this.edgeDiv.style.boxShadow="0 0 0 1px "+X+", 0 0 0 2px "+Y,this.chip=document.createElement("div"),this.chip.setAttribute("data-noodl-box-overlay-chip",""),this.chip.style.position="absolute",this.chip.style.top="0",this.chip.style.left="0",this.chip.style.padding="6px 8px",this.chip.style.borderRadius="4px",this.chip.style.backgroundColor=K,this.chip.style.color=J,this.chip.style.font="500 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",this.chip.style.whiteSpace="nowrap",this.chip.style.boxShadow="0 0 0 1px "+Y+", 0 2px 8px rgba(0,0,0,0.45)",this.numbers=[],t.appendChild(this.marginDiv),t.appendChild(this.borderDiv),t.appendChild(this.paddingDiv),t.appendChild(this.contentDiv),t.appendChild(this.edgeDiv),t.appendChild(this.chip)}return e.prototype.clear=function(){this.root.style.display="none"},e.prototype.chipRect=function(){if("none"===this.root.style.display)return null;var e=this.chip.getBoundingClientRect();return{x:e.x,y:e.y,width:e.width,height:e.height}},e.prototype.dispose=function(){this.root.remove()},e.prototype.update=function(e,t,n){if(e&&e.isConnected){var i=t||window.getComputedStyle(e),o=n||e.getBoundingClientRect(),r=P(o,i);te(this.marginDiv,R(r)),ie(this.marginDiv,r.margin),te(this.borderDiv,r.border),ie(this.borderDiv,r.borderWidth);var s=D(r);te(this.paddingDiv,s),ie(this.paddingDiv,r.padding),te(this.contentDiv,F(r)),te(this.edgeDiv,r.border),this.edgeDiv.style.borderRadius=B(U({radii:j(i),borderRect:r.border,clips:V(e.tagName,i),childRects:ae(e)})),this.renderNumbers(r),this.renderChip(e,i,o,r),this.root.style.display="block"}else this.clear()},e.prototype.renderNumbers=function(e){var t=[],n=e.border,i=R(e),o=D(e);for(Z.forEach(function(o){var r=e.margin[o];r>=14&&t.push(re(String(r),i,n,o))}),Z.forEach(function(n){var i=e.padding[n];i>=14&&t.push(re(String(i),o,F(e),n))});this.numbers.length<t.length;)(s=document.createElement("div")).style.position="absolute",s.style.top="0",s.style.left="0",s.style.transformOrigin="0 0",s.style.padding="0 3px",s.style.borderRadius="2px",s.style.backgroundColor="#14181C",s.style.color="#FFFFFF",s.style.font="500 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",s.style.whiteSpace="nowrap",this.root.appendChild(s),this.numbers.push(s);for(var r=0;r<this.numbers.length;r++){var s=this.numbers[r];if(r<t.length){s.textContent=t[r].text,s.style.display="block";var a=s.getBoundingClientRect();s.style.transform="translateX("+(t[r].x-a.width/2)+"px) translateY("+(t[r].y-a.height/2)+"px)"}else s.style.display="none"}},e.prototype.renderChip=function(e,t,n,i){var o=e.parentElement,r=function(e){var t=[W(e.rect.width)+" × "+W(e.rect.height)];t.push(H("width",e)),t.push(H("height",e));var n=e.computed.getPropertyValue("position")||"static";"absolute"===n||"fixed"===n?t.push("position: "+n+" — placed on its parent, not in its flow"):t.push("position: "+n+" — flows after its siblings");var i=(e.computed.getPropertyValue("transform")||"none").trim();if(i&&"none"!==i&&t.push("transform: "+i+" — moves it after it has been placed"),e.parent){var o=e.parent.computed.getPropertyValue("display")||"";if(-1!==o.indexOf("flex")){var r=e.parent.computed.getPropertyValue("flex-direction")||"row";t.push("parent stacks its children in a "+(0===r.indexOf("column")?"column":"row")),t.push("parent packs: "+G(e.parent.computed.getPropertyValue("justify-content"),"flex-start")+" · lines up: "+G(e.parent.computed.getPropertyValue("align-items"),"stretch"))}else o&&t.push("parent lays out as "+o)}var s,a,l,u,c,d,p=(s=e.specified,a="auto"===(s.getPropertyValue("margin-left")||"").trim(),l="auto"===(s.getPropertyValue("margin-right")||"").trim(),u="auto"===(s.getPropertyValue("margin-top")||"").trim(),c="auto"===(s.getPropertyValue("margin-bottom")||"").trim(),d=[],a&&l?d.push("centred across by auto margins"):a?d.push("pushed right by margin-left: auto"):l&&d.push("pushed left by margin-right: auto"),u&&c?d.push("centred down by auto margins"):u?d.push("pushed down by margin-top: auto"):c&&d.push("pushed up by margin-bottom: auto"),d.length?d.join(", "):null);p&&t.push(p);var h=(e.specified.getPropertyValue("align-self")||e.computed.getPropertyValue("align-self")||"").trim();h&&"auto"!==h&&"normal"!==h&&t.push("align-self: "+h+" — "+($[h]||"this child only, overriding the parent"));var f=function(e){if(!e.parent)return null;var t=F(P(e.parent.rect,e.parent.computed)),n=[],i=function(e,t){e>.5&&n.push(W(e)+"px past the "+t)};return i(t.x-e.rect.x,"left"),i(e.rect.x+e.rect.width-(t.x+t.width),"right"),i(t.y-e.rect.y,"top"),i(e.rect.y+e.rect.height-(t.y+t.height),"bottom"),n.length?"overflows its parent: "+n.join(", "):null}(e);return f&&t.push(f),t}({rect:n,computed:t,specified:le(e),parent:o?{rect:o.getBoundingClientRect(),computed:window.getComputedStyle(o)}:void 0}),s=function(e){var t=[],n=function(e){return e.top+"/"+e.right+"/"+e.bottom+"/"+e.left},i=function(e){return 0!==e.top||0!==e.right||0!==e.bottom||0!==e.left};return i(e.margin)&&t.push("margin "+n(e.margin)),i(e.padding)&&t.push("padding "+n(e.padding)),i(e.borderWidth)&&t.push("border "+n(e.borderWidth)),t.length?t.join(" · ")+" (top/right/bottom/left)":null}(i);for(s&&r.push(s);this.chip.firstChild;)this.chip.removeChild(this.chip.firstChild);for(var a=0;a<r.length;a++){var l=document.createElement("div");l.textContent=r[a],a>0&&(l.style.color=Q),this.chip.appendChild(l)}var u=se(R(i),this.chip.getBoundingClientRect(),{width:window.innerWidth,height:window.innerHeight});ne(this.chip,u.x,u.y)},e}();function re(e,t,n,i){switch(i){case"top":return{text:e,x:n.x+n.width/2,y:(t.y+n.y)/2};case"bottom":return{text:e,x:n.x+n.width/2,y:(n.y+n.height+t.y+t.height)/2};case"left":return{text:e,x:(t.x+n.x)/2,y:n.y+n.height/2};default:return{text:e,x:(n.x+n.width+t.x+t.width)/2,y:n.y+n.height/2}}}function se(e,t,n){var i=function(e){return Math.max(8,Math.min(e,n.width-t.width-8))},o=function(e){return Math.max(8,Math.min(e,n.height-t.height-8))},r=e.x+e.width+8;if(r>=8&&r+t.width<=n.width-8)return{x:i(r),y:o(e.y)};var s=e.x-t.width-8;if(s>=8&&s+t.width<=n.width-8)return{x:i(s),y:o(e.y)};var a=e.y-t.height-8,l=a>=8?a:e.y+e.height+8;return{x:i(e.x),y:o(l)}}function ae(e){for(var t=[],n=e.children,i=Math.min(n.length,40),o=0;o<i;o++)t.push(n[o].getBoundingClientRect());return t}function le(e){var t=T(e);return t?{getPropertyValue:function(n){return e.style.getPropertyValue(n)||t[n]||""}}:e.style}function ue(e){for(var t,n=[e.id],i=e,o=0;o<256;o++){var r=null!==(t=i.parentNodeScope)&&void 0!==t?t:i.nodeScope,s=null==r?void 0:r.componentOwner;if(!s||s===i||!s.parentNodeScope)break;n.unshift(s.id),i=s}return n}var ce={a:1,b:0,c:0,d:1,e:0,f:0},de={left:0,top:0,center:50,right:100,bottom:100},pe=["left","right"],he=["top","bottom"];function fe(e,t){return-1!==t.indexOf(e)}function ge(e,t){var n=(e||"").trim().toLowerCase();if(!n)return null;if(Object.prototype.hasOwnProperty.call(de,n))return de[n]/100*t;var i=parseFloat(n);return isFinite(i)?-1!==n.indexOf("%")?i/100*t:i:null}function me(e){var t=(e||"").trim().toLowerCase().split(/\s+/).filter(Boolean);if(!t.length)return null;if(1===t.length)return fe(t[0],he)?{x:"center",y:t[0]}:{x:t[0],y:"center"};var n=t[0],i=t[1];return fe(n,he)||fe(i,pe)?{x:i,y:n}:{x:n,y:i}}var ye="50% 50%";function ve(e){var t=(e.specified.getPropertyValue("transform-origin")||"").trim();if(t)return{value:t,isDefault:!1};var n=(e.computed.getPropertyValue("transform-origin")||"").trim();if(n){var i=function(e,t){var n=me(e);if(!n)return null;var i=ge(n.x,t.layout.width),o=ge(n.y,t.layout.height);return null===i||null===o?null:{x:i,y:o}}(n,e);return i&&function(e,t){return Math.abs(e.x-t.width/2)<=be&&Math.abs(e.y-t.height/2)<=be}(i,e.layout)?{value:ye,isDefault:!0}:{value:n,isDefault:!1}}return{value:ye,isDefault:!0}}var be=.5;function we(e){var t=me(ve(e).value);if(!t)return null;var n=ge(t.x,e.layout.width),i=ge(t.y,e.layout.height);return null===n||null===i?null:{x:n,y:i}}function _e(e){return Math.round(10*e)/10}function Se(){return"0 0 0 1px "+Y}var Oe=function(){function e(e){var t=document.createElement("div");t.setAttribute("data-noodl-transform-origin",""),t.style.pointerEvents="none",t.style.display="none",e.appendChild(t),this.root=t,this.horizontal=this.createArm(),this.vertical=this.createArm(),this.ring=document.createElement("div"),this.ring.style.position="absolute",this.ring.style.top="0",this.ring.style.left="0",this.ring.style.boxSizing="border-box",this.ring.style.width="11px",this.ring.style.height="11px",this.ring.style.borderRadius="50%",this.ring.style.border="1px solid "+X,this.ring.style.boxShadow=Se()+", inset 0 0 0 1px "+Y,this.label=document.createElement("div"),this.label.setAttribute("data-noodl-transform-origin-label",""),this.label.style.position="absolute",this.label.style.top="0",this.label.style.left="0",this.label.style.padding="6px 8px",this.label.style.borderRadius="4px",this.label.style.backgroundColor=K,this.label.style.color=J,this.label.style.font="500 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",this.label.style.whiteSpace="nowrap",this.label.style.boxShadow="0 0 0 1px "+Y+", 0 2px 8px rgba(0,0,0,0.45)",t.appendChild(this.horizontal),t.appendChild(this.vertical),t.appendChild(this.ring),t.appendChild(this.label)}return e.prototype.createArm=function(){var e=document.createElement("div");return e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.backgroundColor=X,e.style.boxShadow=Se(),e},e.prototype.clear=function(){this.root.style.display="none"},e.prototype.dispose=function(){this.root.remove()},e.prototype.update=function(e,t,n,i){if(e&&e.isConnected){var o=t||window.getComputedStyle(e),r=n||e.getBoundingClientRect(),s={rect:r,layout:{width:e.offsetWidth,height:e.offsetHeight},computed:o,specified:e.style},a=function(e){var t=we(e);if(!t)return null;for(var n=function(e){var t=(e||"").trim();if(!t||"none"===t)return ce;var n=t.indexOf("(");if(-1===n||")"!==t.charAt(t.length-1))return ce;var i=t.substring(0,n).trim(),o=t.substring(n+1,t.length-1).split(",").map(function(e){return parseFloat(e)});return o.some(function(e){return!isFinite(e)})?ce:"matrix"===i&&o.length>=6?{a:o[0],b:o[1],c:o[2],d:o[3],e:o[4],f:o[5]}:"matrix3d"===i&&o.length>=16?{a:o[0],b:o[1],c:o[4],d:o[5],e:o[12],f:o[13]}:ce}(e.computed.getPropertyValue("transform")),i=e.layout.width,o=e.layout.height,r=[{x:0,y:0},{x:i,y:0},{x:i,y:o},{x:0,y:o}].map(function(e){var i,o,r=(i=n,o={x:e.x-t.x,y:e.y-t.y},{x:i.a*o.x+i.c*o.y+i.e,y:i.b*o.x+i.d*o.y+i.f});return{x:r.x+t.x,y:r.y+t.y}}),s=r[0].x,a=r[0].y,l=r[0].x,u=r[0].y,c=1;c<r.length;c++)s=Math.min(s,r[c].x),a=Math.min(a,r[c].y),l=Math.max(l,r[c].x),u=Math.max(u,r[c].y);var d=l-s,p=u-a,h=d>0?e.rect.width/d:1,f=p>0?e.rect.height/p:1;return{x:e.rect.x+(t.x-s)*h,y:e.rect.y+(t.y-a)*f}}(s);if(a){var l=function(e,t){var n=Math.min(e.x,t.x)-16,i=Math.max(e.x+e.width,t.x)+16,o=Math.min(e.y,t.y)-16,r=Math.max(e.y+e.height,t.y)+16;return{horizontal:{x:n,y:t.y,width:i-n,height:0},vertical:{x:t.x,y:o,width:0,height:r-o}}}(r,a);this.horizontal.style.transform="translateX("+l.horizontal.x+"px) translateY("+a.y+"px)",this.horizontal.style.width=l.horizontal.width+"px",this.horizontal.style.height="1px",this.vertical.style.transform="translateX("+a.x+"px) translateY("+l.vertical.y+"px)",this.vertical.style.width="1px",this.vertical.style.height=l.vertical.height+"px",this.ring.style.transform="translateX("+(a.x-5)+"px) translateY("+(a.y-5)+"px)",this.renderLabel(s,a,i||null),this.root.style.display="block"}else this.clear()}else this.clear()},e.prototype.renderLabel=function(e,t,n){for(var i=function(e){var t=ve(e),n=we(e);if(!n)return[];var i=["transform-origin: "+t.value+(t.isDefault?" (default)":"")];(function(e,t){var n=me(e);return!!n&&-1!==n.x.indexOf("px")&&-1!==n.y.indexOf("px")&&Math.abs(parseFloat(n.x)-t.x)<.05&&Math.abs(parseFloat(n.y)-t.y)<.05})(t.value,n)||i.push(_e(n.x)+"px, "+_e(n.y)+"px from the element’s top left");var o=e.layout.width,r=e.layout.height;return(n.x<0||n.y<0||n.x>o||n.y>r)&&i.push("outside the element — it rotates and scales about a point beyond its own edge"),i}(e);this.label.childNodes.length>i.length;)this.label.removeChild(this.label.lastChild);for(;this.label.childNodes.length<i.length;){var o=document.createElement("div");this.label.appendChild(o)}for(var r=0;r<i.length;r++)(o=this.label.childNodes[r]).textContent=i[r],o.style.color=0===r?J:Q;var s={width:window.innerWidth,height:window.innerHeight},a=this.label.getBoundingClientRect(),l=function(e,t,n,i){if(!n)return e;var o;if(o=e.y,!(e.x<n.x+n.width&&e.x+t.width>n.x&&o<n.y+n.height&&o+t.height>n.y))return e;var r=function(e){return Math.max(8,Math.min(e,i.height-t.height-8))},s=n.y+n.height+8;if(s+t.height<=i.height-8)return{x:e.x,y:r(s)};var a=n.y-t.height-8;if(a>=8)return{x:e.x,y:r(a)};var l=n.x-t.width-8;return l>=8?{x:l,y:r(e.y)}:{x:e.x,y:r(e.y)}}(se({x:t.x,y:t.y,width:0,height:0},a,s),a,n,s);this.label.style.transform="translateX("+l.x+"px) translateY("+l.y+"px)"},e}(),Ne=function(){function e(e){this.highlightedNodes=new Map,this.selectedNodes=new Map,this.placedNodes=new Map,this.noodlRuntime=e,this.isUpdatingHighlights=!1,this.designMode=!1,this.transformOriginFocused=!1;var t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.top="0",t.style.left="0",t.style.overflow="hidden",t.style.position="fixed",t.style.zIndex="1000000000",t.style.pointerEvents="none",document.body.appendChild(t),this.highlightRootDiv=t,this.boxOverlay=new oe(t),this.originCrosshair=new Oe(t),this.windowBorderDiv=this.createHighlightDiv(),this.windowBorderDiv.style.position="absolute",this.windowBorderDiv.style.top="0",this.windowBorderDiv.style.left="0",this.windowBorderDiv.style.boxShadow="inset 0 0 0 3px #2CA7BA",this.windowBorderDiv.style.opacity="1.0",this.windowBorderDiv.style.width="100vw",this.windowBorderDiv.style.height="100vh"}return e.prototype.createHighlightDiv=function(e){void 0===e&&(e="selected");var t=document.createElement("div");return t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.outline="".concat("hover"===e?1:2,"px solid #2CA7BA"),t.style.opacity="1.0",t},e.prototype.setWindowSelected=function(e){},e.prototype.setDesignMode=function(e){this.designMode=e,e||this.boxOverlay.clear()},e.prototype.setTransformOriginFocus=function(e){this.transformOriginFocused=e,e?this.anyHighlight()&&!this.isUpdatingHighlights&&this.updateHighlights():this.originCrosshair.clear()},e.prototype.anyHighlight=function(){return this.selectedNodes.size>0||this.highlightedNodes.size>0||this.placedNodes.size>0},e.prototype.updateHighlights=function(){for(var e=null,t=!1,n=null,i=0,o=Array.from(this.highlightedNodes.entries()).concat(Array.from(this.selectedNodes.entries())).concat(Array.from(this.placedNodes.entries()));i<o.length;i++){var r=o[i],s=r[0].getDOMElement&&r[0].getDOMElement();if(s){var a=s.getBoundingClientRect(),l=r[1];l.style.transform="translateX(".concat(a.x,"px) translateY(").concat(a.y,"px)"),l.style.width=a.width+"px",l.style.height=a.height+"px";var u=window.getComputedStyle(s);l.style.borderRadius=B(U({radii:j(u),borderRect:a,clips:V(s.tagName,u),childRects:Ce(s)}));var c=this.highlightedNodes.has(r[0]);this.placedNodes.has(r[0])&&!c&&!this.selectedNodes.has(r[0])||e&&(!c||t)||(e={element:s,computed:u,rect:a},t=c),!n&&this.selectedNodes.has(r[0])&&(n={element:s,computed:u,rect:a})}else this.highlightedNodes.delete(r[0]),this.placedNodes.delete(r[0]),r[1].remove()}this.designMode&&e?this.boxOverlay.update(e.element,e.computed,e.rect):this.boxOverlay.clear();var d=n||e;this.transformOriginFocused&&d?this.originCrosshair.update(d.element,d.computed,d.rect,this.boxOverlay.chipRect()):this.originCrosshair.clear(),this.isUpdatingHighlights=this.anyHighlight(),this.isUpdatingHighlights&&requestAnimationFrame(this.updateHighlights.bind(this))},e.prototype.highlightNodesWithId=function(e){this.highlightNodesAtPath([e])},e.prototype.highlightNodesAtPath=function(e){for(var t=this,n=xe(this.noodlRuntime,e).filter(function(e){return e.getRef}).filter(function(e){return!t.highlightedNodes.has(e)}),i=0,o=n;i<o.length;i++){var r=o[i],s=this.createHighlightDiv("hover");this.highlightRootDiv.appendChild(s),this.highlightedNodes.set(r,s)}(this.selectedNodes.size>0||this.highlightedNodes.size>0)&&!this.isUpdatingHighlights&&this.updateHighlights()},e.prototype.disableHighlight=function(){for(var e=0,t=Array.from(this.highlightedNodes.entries());e<t.length;e++){var n=t[e][1];n&&n.remove()}this.highlightedNodes.clear()},e.prototype.selectNodesWithId=function(e){return this.selectNodesAtPath([e])},e.prototype.selectNodesAtPath=function(e){var t=this;this.noodlRuntime.rootComponent||this.noodlRuntime.eventEmitter.once("rootComponentUpdated",function(){setTimeout(function(){t.selectNodesAtPath(e)},300)});for(var n=xe(this.noodlRuntime,e).filter(function(e){return e.getRef}).filter(function(e){return!t.selectedNodes.has(e)}),i=0,o=n;i<o.length;i++){var r=o[i],s=this.createHighlightDiv("selected");this.highlightRootDiv.appendChild(s),this.selectedNodes.set(r,s)}return this.selectedNodes.size>0&&this.setWindowSelected(!1),(this.selectedNodes.size>0||this.highlightedNodes.size>0)&&!this.isUpdatingHighlights&&this.updateHighlights(),n},e.prototype.showPlacementAtPath=function(e){var t=this;if(this.clearPlacement(),e&&e.length){this.noodlRuntime.rootComponent||this.noodlRuntime.eventEmitter.once("rootComponentUpdated",function(){setTimeout(function(){return t.showPlacementAtPath(e)},300)});for(var n=0,i=xe(this.noodlRuntime,e).filter(function(e){return e.getRef});n<i.length;n++){var o=i[n],r=this.createHighlightDiv("selected");this.highlightRootDiv.appendChild(r),this.placedNodes.set(o,r)}this.anyHighlight()&&!this.isUpdatingHighlights&&this.updateHighlights()}},e.prototype.clearPlacement=function(){for(var e=0,t=Array.from(this.placedNodes.entries());e<t.length;e++){var n=t[e];n[1]&&n[1].remove()}this.placedNodes.clear()},e.prototype.explainStyleAtPath=function(e){for(var t=0,n=xe(this.noodlRuntime,e);t<n.length;t++){var i=n[t],o=i.explainStyleSources;if("function"==typeof o&&i.getDOMElement())return o.call(i)}return[]},e.prototype.deselectNodes=function(){for(var e=0,t=Array.from(this.selectedNodes.entries());e<t.length;e++){var n=t[e][1];n&&n.remove()}this.selectedNodes.clear()},e}();function Ce(e){for(var t=[],n=e.children,i=Math.min(n.length,40),o=0;o<i;o++)t.push(n[o].getBoundingClientRect());return t}function xe(e,t){if(!e.rootComponent||!t.length)return[];var n=e.rootComponent.nodeScope.getNodesWithIdRecursive(t[t.length-1]);return 1===t.length?n:n.filter(function(e){return function(e,t){if(!e.length||!t.length)return!1;if(e[e.length-1]!==t[t.length-1])return!1;for(var n=0,i=0;i<e.length-1;i++){for(;n<t.length-1&&t[n]!==e[i];)n++;if(n>=t.length-1)return!1;n++}return!0}(t,ue(e))})}var Te=function(){return Te=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Te.apply(this,arguments)};var ke=function(){function e(e){var t=e.onInspect,n=e.onHighlight,i=e.onDisableHighlight,o=this;this.onMouseMove=function(e){i();var t=o.findNoodlNode(e.target);t?(document.body.style.cursor="crosshair",n(t.id,ue(t))):document.body.style.cursor="initial",e.stopPropagation()},this.onClick=function(e){i();var n=o.findNoodlNode(e.target);n&&t([n.id],[ue(n)]),e.stopPropagation(),e.preventDefault(),document.activeElement&&document.activeElement.blur()},this.onContextMenu=function(e){var n=document.elementsFromPoint(e.clientX,e.clientY).map(function(e){return o.findNoodlNode(e)}).filter(function(e){return!!e}).map(function(e){return e.id});n.length&&t(n),e.stopPropagation(),e.preventDefault(),document.activeElement&&document.activeElement.blur()},this.onMouseOut=function(e){i()},this.blockEvent=function(e){e.stopPropagation()},this.onDisableHighlight=i}return e.prototype.setComponent=function(e){this.component=e},e.prototype.enable=function(){document.activeElement&&document.activeElement.blur(),document.addEventListener("mouseenter",this.blockEvent,!0),document.addEventListener("mouseover",this.blockEvent,!0),document.addEventListener("mousedown",this.blockEvent,!0),document.addEventListener("mouseup",this.blockEvent,!0),document.addEventListener("mousemove",this.onMouseMove,!0),document.addEventListener("mouseout",this.onMouseOut,!0),document.addEventListener("click",this.onClick,!0),document.addEventListener("contextmenu",this.onContextMenu,!0)},e.prototype.disable=function(){document.body.style.cursor="initial",document.removeEventListener("mouseenter",this.blockEvent,!0),document.removeEventListener("mouseover",this.blockEvent,!0),document.removeEventListener("mousedown",this.blockEvent,!0),document.removeEventListener("mouseup",this.blockEvent,!0),document.removeEventListener("mousemove",this.onMouseMove,!0),document.removeEventListener("mouseout",this.onMouseOut,!0),document.removeEventListener("click",this.onClick,!0),document.removeEventListener("contextmenu",this.onContextMenu,!0),this.onDisableHighlight()},e.prototype.findNoodlNode=function(e){for(var t;!t&&e;)(t=e[Object.keys(e).find(function(e){return e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$")})])||(e=e.parentElement);if(t){for(var n=function(e){for(var t=e.return;t&&"string"==typeof t.type;)t=t.return;return t},i=n(t);i&&(!i.stateNode||!i.stateNode.props||!i.stateNode.props.noodlNode);)i=n(i);var o=i?i.stateNode.props.noodlNode:void 0;if(o){if(this.component){for(var r=o;r;)if(r.parentNodeScope){if(r.parentNodeScope.componentOwner.name===this.component.name)return r;r=r.parentNodeScope.componentOwner}else{if(r.nodeScope.componentOwner.name===this.component.name)return r;r=r.nodeScope.componentOwner}return r}return o}}},e}();const Ee=ke;var Ie=__webpack_require__(2192),Pe=function(){return Pe=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Pe.apply(this,arguments)};var Re="undefined"!=typeof document,Ae=function(){function e(){this._title="",this._meta={}}return Object.defineProperty(e.prototype,"title",{get:function(){return Re?document.title:this._title},enumerable:!1,configurable:!0}),e.prototype.setTitle=function(e){this._title=e,Re&&(document.title=e)},Object.defineProperty(e.prototype,"meta",{get:function(){return this._meta},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this.clearMeta(),this._title=""},e.prototype.clearMeta=function(){Re&&Object.keys(this._meta).forEach(function(e){var t=document.querySelector('meta[name="'.concat(e,'"]'));t&&t.remove()}),this._meta={}},e.prototype.getMeta=function(e){return this._meta[e]},e.prototype.setMeta=function(e,t){if(this._meta[e]=t,Re){var n=document.querySelector('meta[name="'.concat(e,'"]'));if(n)t?n.setAttribute("content",t):n.remove();else if(t){var i=document.createElement("meta");i.setAttribute("name",e),i.setAttribute("property",e),i.setAttribute("content",t),document.head.appendChild(i)}}},e}(),De=__webpack_require__(3518),Fe=__webpack_require__(3538),Me={run:function(e,t){return n=this,i=void 0,r=function(){return function(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,function(n){return[2,new Promise(function(n,i){var o=Fe.instance.getMetaData("cloudservices");if(void 0!==o){var r=o.appId,s=o.endpoint;!function(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){var e=void 0;try{e=JSON.parse(n.response)}catch(e){}200===n.status||201===n.status?t.success(e):t.error(e,n.status)}},n.open(t.method||"GET",t.endpoint+e,!0),n.setRequestHeader("X-Parse-Application-Id",t.appId),n.setRequestHeader("Content-Type","application/json");var i=Fe.instance.getMetaData("cloudservices");i&&i.deployVersion&&n.setRequestHeader("x-noodl-cloud-version",i.deployVersion);var o=(0,De.parseSessionStore)(t.appId).read();void 0!==o&&n.setRequestHeader("X-Parse-Session-Token",o.sessionToken),n.send(JSON.stringify(t.content))}("/functions/"+encodeURIComponent(e),{appId:r,endpoint:s,content:t,method:"POST",success:function(e){n(e?e.result:void 0)},error:function(e,t){i(void 0!==e?e:{error:0===t?"Could not reach the backend at "+s:"Cloud function call failed with no response body"})}})}else i("No cloud services defined in this project.")})]})},new((o=void 0)||(o=Promise))(function(e,t){function s(e){try{l(r.next(e))}catch(e){t(e)}}function a(e){try{l(r.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(s,a)}l((r=r.apply(n,i||[])).next())});var n,i,o,r}};const je=Me;var Ve=__webpack_require__(7011),Le=__webpack_require__(822),Ue={upload:function(e,t){return n=this,i=void 0,r=function(){return function(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,function(n){return[2,new Promise(function(n,i){Ve.instance.uploadFile({file:e,onUploadProgress:function(e){t&&t.onProgress&&t.onProgress(e)},success:function(e){n(new Le(e))},error:function(e){i(e)}})})]})},new((o=void 0)||(o=Promise))(function(e,t){function s(e){try{l(r.next(e))}catch(e){t(e)}}function a(e){try{l(r.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(s,a)}l((r=r.apply(n,i||[])).next())});var n,i,o,r}};const Be=Ue;var We=__webpack_require__(907),ze=__webpack_require__(3538),qe={showPopup:function(e,t){return n=this,i=void 0,r=function(){return function(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,function(n){return[2,new Promise(function(n){qe._noodlRuntime.context.showPopup(e,t,{onDismissPopup:function(){n({action:"dismissed",parameters:{}})},onClosePopup:function(e,t){n({action:e?e.replace("closeAction-",""):"",parameters:t})}})})]})},new((o=void 0)||(o=Promise))(function(e,t){function s(e){try{l(r.next(e))}catch(e){t(e)}}function a(e){try{l(r.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(s,a)}l((r=r.apply(n,i||[])).next())});var n,i,o,r},navigate:function(e,t,n){We.u.instance.navigate(e,{target:t,params:n})},navigateToPath:function(e,t){var n,i,o=ze.instance.getProjectSettings().navigationPathType;void 0===o||"hash"===o?n=e:i=e;var r=[];if(t&&void 0!==t.query)for(var s in t.query){var a=t.query[s];null!=a&&r.push(encodeURIComponent(s)+"="+encodeURIComponent(String(a)))}var l=(void 0!==i?i:"")+(r.length>=1?"?"+r.join("&"):"")+(void 0!==n?"#"+n:"");window.history.pushState({},"",l),dispatchEvent(new PopStateEvent("popstate",{}))}};const He=qe;var Ge=__webpack_require__(2568),$e=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})},Xe=function(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Ye={logIn:function(e){return $e(this,void 0,void 0,function(){return Xe(this,function(t){return[2,new Promise(function(t,n){Ge.A.instance.logIn({username:e.username,password:e.password,success:function(){t()},error:function(e){n(e)}})})]})})},signUp:function(e){return $e(this,void 0,void 0,function(){return Xe(this,function(t){return[2,new Promise(function(t,n){Ge.A.instance.signUp({username:e.username,password:e.password,email:e.email,properties:e.properties,success:function(){t()},error:function(e){n(e)}})})]})})},become:function(e){return $e(this,void 0,void 0,function(){return Xe(this,function(t){return[2,new Promise(function(t,n){Ge.A.instance.fetchCurrentUser({sessionToken:e,success:function(){t()},error:function(e){n(e)}})})]})})},on:function(e,t){Ge.A.instance.on(e,t)},off:function(e,t){Ge.A.instance.off(e,t)}},Ke={logOut:function(){return $e(this,void 0,void 0,function(){return Xe(this,function(e){return[2,new Promise(function(e,t){Ge.A.instance.logOut({success:function(){e()},error:function(e){t(e)}})})]})})},save:function(){return $e(this,void 0,void 0,function(){return Xe(this,function(e){return[2,new Promise(function(e,t){var n=Object.assign({},Ke.Properties.data);Ge.A.instance.setUserProperties({properties:n,success:function(){e()},error:function(e){t(e)}})})]})})},fetch:function(){return $e(this,void 0,void 0,function(){return Xe(this,function(e){return[2,new Promise(function(e,t){Ge.A.instance.fetchCurrentUser({success:function(){e()},error:function(e){t(e)}})})]})})}};Object.defineProperty(Ye,"Current",{get:function(){var e=Ge.A.instance.current;return void 0===e?void 0:(Ke.email=e.email,Ke.username=e.username,Ke.id=e.id,Ke.emailVerified=e.emailVerified,Ke.Properties=e,Ke)}});const Je=Ye;function Qe(e){var t,n,i="undefined"!=typeof window?window:globalThis;i.Noodl.getProjectSettings=e.getProjectSettings.bind(e),i.Noodl.getMetaData=e.getMetaData.bind(e),i.Noodl.Collection=i.Noodl.Array=__webpack_require__(1656),i.Noodl.Model=i.Noodl.Object=__webpack_require__(6835),i.Noodl.Variables=i.Noodl.Object.get("--ndl--global-variables"),i.Noodl.Events=i.Noodl.eventEmitter=e.context.eventSenderEmitter,i.Noodl.Records=__webpack_require__(2423)(),i.Noodl.Users=Je,i.Noodl.CloudFunctions=je,i.Noodl.Navigation=He,i.Noodl.Navigation._noodlRuntime=e,i.Noodl.Files=Be,i.Noodl.SEO=i.Noodl.SEO||new Ae,i.Noodl.Config=(t=i.Noodl.getMetaData,n=function(){return function(e){var t,n,i,o,r,s;e||(e={});for(var a=Pe(Pe(Pe({},Ie.hE),e),{identity:Pe(Pe({},Ie.hE.identity),e.identity),seo:Pe(Pe({},Ie.hE.seo),e.seo),variables:e.variables||[]}),l={appName:a.identity.appName,description:a.identity.description,coverImage:a.identity.coverImage,ogTitle:a.seo.ogTitle||a.identity.appName,ogDescription:a.seo.ogDescription||a.identity.description,ogImage:a.seo.ogImage||a.identity.coverImage,favicon:a.seo.favicon,themeColor:a.seo.themeColor,pwaEnabled:null!==(n=null===(t=a.pwa)||void 0===t?void 0:t.enabled)&&void 0!==n&&n,pwaShortName:null===(i=a.pwa)||void 0===i?void 0:i.shortName,pwaDisplay:null===(o=a.pwa)||void 0===o?void 0:o.display,pwaStartUrl:null===(r=a.pwa)||void 0===r?void 0:r.startUrl,pwaBackgroundColor:null===(s=a.pwa)||void 0===s?void 0:s.backgroundColor},u=0,c=a.variables;u<c.length;u++){var d=c[u];l[d.key]=d.value}return l}(t("appConfig"))},new Proxy({},{get:function(e,t){if("symbol"!=typeof t){var i=n();if(t in i)return i[t];console.warn("Noodl.Config.".concat(t," is not defined"))}},has:function(e,t){return t in n()},ownKeys:function(){var e=n();return Reflect.ownKeys(e)},getOwnPropertyDescriptor:function(e,t){var i=n();if(t in i)return{enumerable:!0,configurable:!0,value:i[t]}},set:function(e,t){return console.error("Cannot set Noodl.Config.".concat(t," - Config values are immutable. ")+"Use Noodl.Variables for runtime-changeable values."),!1},deleteProperty:function(e,t){return console.error("Cannot delete Noodl.Config.".concat(t," - Config values are immutable.")),!1}})),i.Noodl.Env||(i.Noodl.Env={}),i.Noodl.Arrays=new Proxy(i.Noodl.Array,{get:function(e,t){return Noodl.Array.get(t)},set:function(e,t,n){if(!Array.isArray(n))throw new Error("Cannot assign non array value to array with id "+String(t));return Noodl.Array.get(t).set(n),!0}}),i.Noodl.Objects=new Proxy(i.Noodl.Object,{get:function(e,t){return Noodl.Object.get(t)},set:function(e,t,n){return Noodl.Object.get(t).setAll(n),!0}})}var Ze=function(){return Ze=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ze.apply(this,arguments)},et=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","iframe",'[contenteditable=""]','[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(","),tt=0;function nt(e){return void 0!==e.focus&&e.matches(et)&&e.getClientRects().length>0}function it(e){return!(!e||!e.isConnected)&&(e.focus({preventScroll:!0}),e.ownerDocument.activeElement===e)}var ot=function(){function e(e){this.getContainer=e,this.open=[],this.pendingRestore=null,this.restorePending=!1,this.closing=[],this.lastClosedOpener=null}return e.semanticProps=function(e){return Ze({role:"dialog","aria-modal":"true",tabIndex:-1},e?{"aria-label":e}:{})},e.prototype.shown=function(t,n){void 0===n&&(n={});var i=!1!==n.modal;i?(t.props&&(t.props.dom=Ze(Ze({},t.props.dom||{}),e.semanticProps(n.accessibleName))),this.open.push({group:t,opener:this.currentOpener(),accessibleName:n.accessibleName,focused:!1,modal:i}),this.restorePending=!1):this.open.push({group:t,opener:null,accessibleName:void 0,focused:!0,modal:i})},e.prototype.closed=function(e){var t,n=this.open.findIndex(function(t){return t.group===e});if(-1!==n){var i=this.open.splice(n,1)[0];if(i.modal){var o=null===(t=e.getDOMElement)||void 0===t?void 0:t.call(e);o&&this.closing.push(o),this.lastClosedOpener=i.opener,this.pendingRestore=i.opener,this.restorePending=!0}}},e.prototype.afterRender=function(){var e,t;if(this.applyInert(),this.closing=[],this.restorePending){this.restorePending=!1;var n=this.topModal(),i=null===(t=null==n?void 0:(e=n.group).getDOMElement)||void 0===t?void 0:t.call(e),o=this.pendingRestore;this.pendingRestore=null,o&&o.isConnected&&!o.closest("[inert]")&&it(o)||it(i)||this.focusApp()}for(var r=0,s=this.open;r<s.length;r++){var a=s[r];a.focused||this.settle(a)}this.lastClosedOpener=null},e.prototype.dispose=function(){this.open=[],this.applyInert()},e.prototype.currentOpener=function(){if("undefined"==typeof document)return null;var e=document.activeElement;return e&&e!==document.body&&e.isConnected&&!this.closing.some(function(t){return t.contains(e)})&&!this.isInsideClosedPopup(e)?e:this.lastClosedOpener&&this.lastClosedOpener.isConnected?this.lastClosedOpener:null},e.prototype.isInsideClosedPopup=function(e){var t=e.closest('[role="dialog"][aria-modal="true"]');return!!t&&!this.open.some(function(e){var n,i;return(null===(i=(n=e.group).getDOMElement)||void 0===i?void 0:i.call(n))===t})},e.prototype.topModal=function(){for(var e=this.open.length-1;e>=0;e--)if(this.open[e].modal)return this.open[e]},e.prototype.applyInert=function(){var e=this.getContainer(),t=this.topModal(),n=t?this.open.indexOf(t):-1,i=this.open.map(function(e){var t,n,i;return null!==(i=null===(n=(t=e.group).getDOMElement)||void 0===n?void 0:n.call(t))&&void 0!==i?i:null}),o=i.filter(function(e){return!!e});if(e)for(var r=function(e){var n=o.some(function(t){return e===t||e.contains(t)});t&&!n?e.setAttribute("inert",""):e.removeAttribute("inert")},s=0,a=Array.from(e.children);s<a.length;s++)r(a[s]);i.forEach(function(e,i){e&&(t&&i<n?e.setAttribute("inert",""):e.removeAttribute("inert"))})},e.prototype.settle=function(e,t){var n,i,o=this;void 0===t&&(t=0),e.focused=!0;var r=null===(i=(n=e.group).getDOMElement)||void 0===i?void 0:i.call(n);if(r){var s=r.ownerDocument;r.contains(s.activeElement)||it(r);var a=r.querySelector("h1, h2, h3");e.accessibleName||!a||r.hasAttribute("aria-labelledby")||(a.id||(a.id="noodl-popup-title-".concat(++tt)),r.setAttribute("aria-labelledby",a.id));var l=Array.from(r.querySelectorAll(et)).find(nt);l?s.activeElement===r&&it(l):t<30&&requestAnimationFrame(function(){return o.open.includes(e)&&o.settle(e,t+1)})}else t<30&&requestAnimationFrame(function(){return o.open.includes(e)&&o.settle(e,t+1)})},e.prototype.focusApp=function(){var e=this.getContainer();return!!e&&(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),it(e))},e}();const rt={ports:[{name:"htmlTitle",displayName:"Title",group:"General",plug:"input",type:"string",default:"Noodl Viewer",tooltip:"The title that web browsers show",ignoreInExport:!0},{name:"headCode",displayName:"Head Code",group:"Custom Code",plug:"input",type:{name:"string",codeeditor:"html"},tooltip:"Add custom code to the &lt;head&gt; tag",ignoreInExport:!0},{name:"navigationPathType",displayName:"URL Path Type",group:"Navigation",plug:"input",type:{name:"enum",enums:[{label:"Hash",value:"hash"},{label:"Path",value:"path"}]},default:"hash"},{name:"bodyScroll",displayName:"Body Scroll",group:"Experimental features",plug:"input",type:{name:"boolean"},tooltip:"Changes so the &lt;body&gt; tag will scroll by default"},{name:"repeaterDisabledWhenUnmounted",displayName:"Disable when unmounted",group:"Experimental features - Repeater",plug:"input",type:{name:"boolean"},tooltip:"Repeater will only create components when it's mounted"},{name:"repeaterCreateComponentsAsync",displayName:"Create asynchronously",group:"Experimental features - Repeater",plug:"input",type:{name:"boolean"},tooltip:"Repeater items will be created in chunks to keep UI responsive"}]};var st=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),at=function(){return at=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},at.apply(this,arguments)};function lt(e,t){var n=t instanceof Error?t.message:String(t);return'The kit node "'.concat(e,'" failed while drawing and shows nothing: ').concat(n)}function ut(e,t){var n=t instanceof Error?t.message:String(t);return'The node "'.concat(e,'" failed while drawing and shows nothing; the rest of the page keeps drawing: ').concat(n)}var ct=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={failed:!1},t}return st(t,e),t.getDerivedStateFromError=function(){return{failed:!0}},t.prototype.componentDidCatch=function(e){var t,n=this.props,i=n.node,o=n.code,r=void 0===o?"kit-node/render-failed":o,s=n.describe,a=(void 0===s?lt:s)(null!==(t=i.name)&&void 0!==t?t:"unknown",e);try{i.raiseRuntimeError&&i.raiseRuntimeError(r,a,{error:String(e)})}catch(e){}},t.prototype.render=function(){return this.state.failed?null:this.props.children},t}(t().Component),dt=Symbol("kit-node-boundary");function pt(e){var n=e,i=e.getReactComponent;return n[dt]||"function"!=typeof i||(e.getReactComponent=function(){return e=i.call(this),n=this,(o=t().forwardRef(function(i,o){return t().createElement(ct,{node:n},t().createElement(e,at(at({},i),{ref:o})))})).displayName="KitNode(".concat("string"==typeof e?e:e.displayName||e.name||"Component",")"),o;var e,n,o},n[dt]=!0),e}var ht=__webpack_require__(1550),ft=["class","code","kind"];const gt=function(){function e(e,t){this.isRunning=!1,this.numBoundingBoxObservers=0,this.callback=e,this.pollDelay=t}return e.prototype.addObserver=function(){this.numBoundingBoxObservers++,this.isRunning||this._startObserver()},e.prototype.removeObserver=function(){this.numBoundingBoxObservers--,0===this.numBoundingBoxObservers&&this._stopObserver()},e.prototype.setTarget=function(e){this.target=e,this.numBoundingBoxObservers>0&&!this.isRunning&&this._startObserver()},e.prototype._startObserver=function(){var e=this;if(!this.isRunning&&this.target){this.isRunning=!0;var t={},n=function(){if(e.target){var i=e.target.getBoundingClientRect();t.x!==i.x&&e.callback("x",i),t.y!==i.y&&e.callback("y",i),t.width!==i.width&&e.callback("width",i),t.height!==i.height&&e.callback("height",i),t=i,e.isRunning&&(e.pollDelay?setTimeout(n,e.pollDelay):window.requestAnimationFrame(n))}else e.isRunning=!1};window.requestAnimationFrame(n)}},e.prototype._stopObserver=function(){this.isRunning=!1},e}();var mt=new Set,yt=new Set,vt=new WeakMap;function bt(e){if(!vt.has(e)){var t=[];e.hasAttribute("tabindex")||(e.setAttribute("tabindex","0"),t.push("tabindex")),e.hasAttribute("aria-roledescription")||(e.setAttribute("aria-roledescription","draggable"),t.push("aria-roledescription")),t.length&&vt.set(e,t)}}function wt(e){if(e._deleted)return null;var t=e.getDOMElement();return t&&t.isConnected?t:null}function _t(e,t){var n,i=(n=e._internal.acceptKind,String(n||"").split(",").map(function(e){return e.trim()}).filter(Boolean));if(0===i.length)return!0;var o=String(t._internal.dragKind||"").trim();return i.includes(o)}function St(e){var t=Number(e._internal.holdTime);return 1e3*(Number.isFinite(t)&&t>=0?t:.5)}function Ot(e,t){e.hasOutput(t)&&e.flagOutputDirty(t)}function Nt(e,t){e.hasOutput(t)&&e.sendSignalOnOutput(t)}function Ct(e){e.context&&e.context.updateDirtyNodes&&e.context.updateDirtyNodes()}var xt=null;function Tt(e){if(!xt&&("mouse"!==e.pointerType||0===e.button)){var t=e.target;if(t&&t instanceof Element&&!t.closest('input, textarea, select, [contenteditable=""], [contenteditable="true"]')){var n=function(e){for(var t=null,n=0,i=Array.from(mt);n<i.length;n++){var o=i[n];if(o._internal.draggable){var r=wt(o);r&&r.contains(e)&&(t&&!t.el.contains(r)||(t={node:o,el:r}))}}return t}(t);if(n){var i,o,r,s=n.el.getBoundingClientRect(),a={phase:"pending",source:n.node,sourceEl:n.el,input:e.pointerType||"mouse",pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,x:e.clientX,y:e.clientY,grabX:e.clientX-s.left,grabY:e.clientY-s.top,index:-1,shifted:new Map};xt=a,an(),i=n.node,o=a.input,("always"===(r=i._internal.holdToDrag||"touch")||"never"!==r&&"mouse"!==o)&&(a.phase="holding",document.documentElement.setAttribute("data-ndl-holding",""),a.ring=function(e,t,n){var i=document.createElement("div");i.setAttribute("data-ndl-hold-ring",""),i.setAttribute("aria-hidden","true");var o=Yt/2-3,r=2*Math.PI*o;return i.innerHTML='<svg width="'.concat(Yt,'" height="').concat(Yt,'" viewBox="0 0 ').concat(Yt," ").concat(Yt,'">')+'<circle cx="'.concat(Yt/2,'" cy="').concat(Yt/2,'" r="').concat(o,'" data-ndl-hold-track />')+'<circle cx="'.concat(Yt/2,'" cy="').concat(Yt/2,'" r="').concat(o,'" data-ndl-hold-fill ')+'style="stroke-dasharray:'.concat(r,";stroke-dashoffset:").concat(r,";animation-duration:").concat(n,'ms" />')+"</svg>",i.style.setProperty("--ndl-hold-circumference",String(r)),Kt(i,e,t),document.body.appendChild(i),i}(e.clientX,e.clientY,St(n.node)),a.holdTimer=setTimeout(function(){xt===a&&"holding"===a.phase&&Ft(a)},St(n.node)))}}}}function kt(e){var t=xt;if(t&&e.pointerId===t.pointerId){t.x=e.clientX,t.y=e.clientY;var n=Math.hypot(e.clientX-t.startX,e.clientY-t.startY);if("holding"!==t.phase){if("pending"===t.phase){if(n<=4)return;Ft(t)}"lifted"===t.phase&&(Xt(t),Ut(t))}else n>8?jt(t):t.ring&&Kt(t.ring,e.clientX,e.clientY)}}function Et(e){var t,n=xt;n&&e.pointerId===n.pointerId&&("lifted"===n.phase?(n.x=e.clientX,n.y=e.clientY,Ut(n),t=function(e){e.stopPropagation(),e.preventDefault()},window.addEventListener("click",t,{capture:!0,once:!0}),setTimeout(function(){return window.removeEventListener("click",t,!0)},0),Mt(n)):jt(n))}function It(e){var t=xt;t&&e.pointerId===t.pointerId&&jt(t)}function Pt(e){xt&&"lifted"===xt.phase&&e.cancelable&&e.preventDefault()}function Rt(e){xt&&"pending"!==xt.phase&&e.preventDefault()}function At(e){xt&&e.preventDefault()}function Dt(e){xt&&"lifted"===xt.phase&&e.preventDefault()}function Ft(e){e.holdTimer&&clearTimeout(e.holdTimer),Jt(e),e.phase="lifted";var t="undefined"!=typeof window&&window.getSelection?window.getSelection():null;t&&t.removeAllRanges&&t.removeAllRanges(),e.sourceEl.setAttribute("data-ndl-drag-source",""),document.documentElement.setAttribute("data-ndl-dragging",""),"keyboard"!==e.input&&(e.copy=function(e){var t=e.sourceEl.getBoundingClientRect(),n=e.sourceEl.cloneNode(!0);n.removeAttribute("data-ndl-drag-source"),n.removeAttribute("id"),n.querySelectorAll("[id]").forEach(function(e){return e.removeAttribute("id")}),n.setAttribute("aria-hidden","true"),n.setAttribute("inert",""),n.setAttribute("data-ndl-drag-copy","");var i=n.style;return i.position="fixed",i.left="".concat(t.left,"px"),i.top="".concat(t.top,"px"),i.width="".concat(t.width,"px"),i.height="".concat(t.height,"px"),i.margin="0",i.boxSizing="border-box",document.body.appendChild(n),n}(e)),e.source._internal.isLifted=!0,Ot(e.source,"isLifted"),Nt(e.source,"pickedUp"),Ct(e.source),"keyboard"!==e.input&&(Xt(e),Ut(e))}function Mt(e){var t=e.zone;if(t){t._internal.droppedValue=e.source._internal.dragValue,t._internal.dropIndex=e.index,Ot(t,"droppedValue"),Ot(t,"dropIndex"),Nt(t,"dropped"),Nt(e.source,"landed");var n=tn(t,e.zoneEl),i=e.index;Vt(e,{settleGap:!0}),Ct(t),Ct(e.source),"keyboard"===e.input&&Zt("Dropped in ".concat(n,", position ").concat(i+1,"."))}else jt(e)}function jt(e){var t="lifted"===e.phase;Vt(e,{settleGap:!1}),t&&(Nt(e.source,"dragCancelled"),Ct(e.source),"keyboard"===e.input&&Zt("Cancelled. ".concat(en(e.sourceEl)," is back where it was.")))}function Vt(e,t){var n=t.settleGap;e.holdTimer&&clearTimeout(e.holdTimer),Jt(e),Wt(e,n),e.copy&&(e.copy.remove(),e.copy=void 0),e.sourceEl.removeAttribute("data-ndl-drag-source"),document.documentElement.removeAttribute("data-ndl-dragging"),e.source._internal.isLifted&&(e.source._internal.isLifted=!1,Ot(e.source,"isLifted")),xt===e&&(xt=null),window.removeEventListener("pointermove",kt,!0),window.removeEventListener("pointerup",Et,!0),window.removeEventListener("pointercancel",It,!0),window.removeEventListener("contextmenu",Rt,!0),window.removeEventListener("dragstart",At,!0),window.removeEventListener("selectstart",Dt,!0)}function Lt(e,t,n){if(t===e.source||e.sourceEl.contains(n))return!0;var i=wt(e.source);return!!i&&i.contains(n)}function Ut(e){var t=function(e,t,n){var i=document.elementFromPoint(t,n);if(!i)return null;for(var o=new Map,r=0,s=Array.from(yt);r<s.length;r++)(l=s[r])._internal.acceptDrops&&(a=wt(l))&&o.set(a,l);for(var a=i;a;a=a.parentElement){var l;if((l=o.get(a))&&!Lt(e,l,a)&&_t(l,e.source))return{node:l,el:a}}return null}(e,e.x,e.y);t?(t.node!==e.zone&&(Wt(e),Bt(e,t.node,t.el)),$t(e,function(e,t,n){var i=e.zoneEl;if(!i)return-1;for(var o=zt(i),r="x"===o?t:n,s=0,a=0,l=qt(e,i);a<l.length;a++){var u=Gt(e,l[a]);("x"===o?u.left+u.width/2:u.top+u.height/2)<r&&s++}return s}(e,e.x,e.y))):e.zone&&Wt(e)}function Bt(e,t,n){e.zone=t,e.zoneEl=n,e.index=-1,n.setAttribute("data-ndl-drop-target",""),t._internal.isDropTarget=!0,Ot(t,"isDropTarget"),Ct(t)}function Wt(e,t){void 0===t&&(t=!1);var n=e.zone,i=e.zoneEl;i&&(t&&i.setAttribute("data-ndl-drop-settle",""),function(e){for(var t=0,n=Array.from(e.shifted);t<n.length;t++){var i=n[t],o=i[0],r=i[1];o.style.translate=r}e.shifted.clear(),e.zoneEl&&(e.zoneEl.removeAttribute("data-ndl-drop-room"),e.zoneEl.style.removeProperty("--ndl-drop-room"))}(e),i.removeAttribute("data-ndl-drop-target"),t&&"undefined"!=typeof window&&window.requestAnimationFrame(function(){return window.requestAnimationFrame(function(){return i.removeAttribute("data-ndl-drop-settle")})})),e.zone=void 0,e.zoneEl=void 0,e.index=-1,n&&n._internal.isDropTarget&&(n._internal.isDropTarget=!1,Ot(n,"isDropTarget"),Ct(n))}function zt(e){var t=getComputedStyle(e).flexDirection;return"row"===t||"row-reverse"===t?"x":"y"}function qt(e,t){for(var n=[],i=0,o=Array.from(Ht(t).children);i<o.length;i++){var r=o[i];if(r instanceof HTMLElement&&r!==e.sourceEl&&!r.hasAttribute("data-ndl-drawing")){var s=getComputedStyle(r);"none"!==s.display&&"absolute"!==s.position&&"fixed"!==s.position&&n.push(r)}}return n}function Ht(e){for(var t=0,n=Array.from(e.children);t<n.length;t++){var i=n[t];if(i instanceof HTMLElement&&i.hasAttribute("data-ndl-slots"))return i}return e}function Gt(e,t){var n=t.getBoundingClientRect(),i=e.shifted.has(t)?function(e){var t=getComputedStyle(e).translate;if(!t||"none"===t)return{x:0,y:0};var n=t.split(/\s+/),i=n[0],o=void 0===i?"0":i,r=n[1],s=void 0===r?"0":r;return{x:parseFloat(o)||0,y:parseFloat(s)||0}}(t):{x:0,y:0};return new DOMRect(n.left-i.x,n.top-i.y,n.width,n.height)}function $t(e,t){e.zone&&e.zoneEl&&t!==e.index&&(e.index=t,!1!==e.zone._internal.makeRoom&&(t===function(e,t){return e.sourceEl.parentElement!==Ht(t)?-1:qt(e,t).filter(function(t){return t.compareDocumentPosition(e.sourceEl)&Node.DOCUMENT_POSITION_FOLLOWING}).length}(e,e.zoneEl)?function(e){for(var t=0,n=Array.from(e.shifted.keys());t<n.length;t++)n[t].style.translate="0px 0px";e.zoneEl&&(e.zoneEl.removeAttribute("data-ndl-drop-room"),e.zoneEl.style.removeProperty("--ndl-drop-room"))}(e):function(e,t,n){var i=zt(t),o=e.sourceEl.getBoundingClientRect(),r=getComputedStyle(t),s=parseFloat("x"===i?r.columnGap:r.rowGap)||0,a=("x"===i?o.width:o.height)+s;t.setAttribute("data-ndl-drop-room",i),t.style.setProperty("--ndl-drop-room","".concat(a,"px")),qt(e,t).forEach(function(t,o){var r=o>=n?a:0;if(!e.shifted.has(t)){if(0===r)return;e.shifted.set(t,t.style.translate)}t.style.translate="x"===i?"".concat(r,"px 0px"):"0px ".concat(r,"px")})}(e,e.zoneEl,t)))}function Xt(e){if(e.copy){var t=e.sourceEl.getBoundingClientRect(),n=e.x-e.grabX-t.left,i=e.y-e.grabY-t.top;e.copy.style.left="".concat(t.left,"px"),e.copy.style.top="".concat(t.top,"px"),e.copy.style.translate="".concat(n,"px ").concat(i,"px")}}var Yt=28;function Kt(e,t,n){e.style.left="".concat(t+14,"px"),e.style.top="".concat(n-14-Yt,"px")}function Jt(e){document.documentElement.removeAttribute("data-ndl-holding"),e.ring&&(e.ring.remove(),e.ring=void 0)}var Qt=null;function Zt(e){"undefined"!=typeof document&&(Qt&&Qt.isConnected||((Qt=document.createElement("div")).setAttribute("role","status"),Qt.setAttribute("aria-live","assertive"),Qt.setAttribute("data-ndl-drag-announcer",""),document.body.appendChild(Qt)),Qt.textContent=e)}function en(e){var t=e.getAttribute("aria-label")||(e.textContent||"").trim().replace(/\s+/g," ");return t.length>60?t.slice(0,57)+"…":t||"item"}function tn(e,t){var n=String(e._internal.dropZoneName||"").trim();if(n)return n;var i=t&&t.getAttribute("aria-label");if(i)return i;var o=nn(e).findIndex(function(t){return t.node===e});return"drop area ".concat(o+1)}function nn(e){for(var t=[],n=0,i=Array.from(yt);n<i.length;n++){var o=i[n];if(o._internal.acceptDrops&&_t(o,e)){var r=wt(o);if(r){var s=r.getBoundingClientRect();t.push({node:o,el:r,left:s.left,top:s.top})}}}return t.sort(function(e,t){return Math.abs(e.top-t.top)>24?e.top-t.top:e.left-t.left})}function on(e){var t=xt;if(!t){if(" "!==e.key&&"Spacebar"!==e.key)return;var n=document.activeElement;if(!n)return;for(var i=null,o=0,r=Array.from(mt);o<r.length;o++){var s=r[o];s._internal.draggable&&wt(s)===n&&(i=s)}if(!i)return;return e.preventDefault(),void function(e,t){var n={phase:"pending",source:e,sourceEl:t,input:"keyboard",pointerId:-1,startX:0,startY:0,x:0,y:0,grabX:0,grabY:0,index:-1,shifted:new Map};xt=n,an(),Ft(n);var i=nn(e).filter(function(e){return!Lt(n,e.node,e.el)}),o=i.filter(function(e){return e.el.contains(t)}),r=o.find(function(e){return!o.some(function(t){return t!==e&&e.el.contains(t.el)})})||i[0];if(r){Bt(n,r.node,r.el);var s=qt(n,r.el).filter(function(e){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING}).length;$t(n,s)}var a=n.zone&&n.zoneEl?" ".concat(tn(n.zone,n.zoneEl),", position ").concat(n.index+1,"."):"";Zt("Picked up ".concat(en(t),".").concat(a," Arrow keys move it, Enter drops it, Escape puts it back."))}(i,n)}if("keyboard"===t.input){t.zone&&!wt(t.zone)&&Wt(t);var a=nn(t.source).filter(function(e){return!Lt(t,e.node,e.el)}),l=a.findIndex(function(e){return e.node===t.zone}),u=function(e){return qt(t,e).length};switch(e.key){case"ArrowDown":case"ArrowUp":if(!t.zoneEl)break;$t(t,Math.max(0,Math.min(u(t.zoneEl),t.index+("ArrowDown"===e.key?1:-1))));break;case"ArrowRight":case"ArrowLeft":if(0===a.length)break;var c="ArrowRight"===e.key?1:-1,d=a[Math.max(0,Math.min(a.length-1,(l<0?0:l)+c))];if(d.node!==t.zone){var p=t.index;Wt(t),Bt(t,d.node,d.el),$t(t,Math.max(0,Math.min(u(d.el),p<0?0:p)))}break;case"Enter":case" ":case"Spacebar":return e.preventDefault(),void Mt(t);case"Escape":return e.preventDefault(),void jt(t);case"Tab":return void jt(t);default:return}e.preventDefault(),t.zone&&t.zoneEl&&Zt("".concat(tn(t.zone,t.zoneEl),", position ").concat(t.index+1," of ").concat(u(t.zoneEl)+1,"."))}else"Escape"===e.key&&"lifted"===t.phase&&(e.preventDefault(),jt(t))}var rn=!1;function sn(){rn||"undefined"==typeof document||(rn=!0,document.addEventListener("pointerdown",Tt,!0),document.addEventListener("keydown",on,!0),window.addEventListener("touchmove",Pt,{capture:!0,passive:!1}),function(){if(!document.querySelector("style[data-ndl-drag-drop]")){var e=document.createElement("style");e.setAttribute("data-ndl-drag-drop",""),e.textContent='\n[data-ndl-drag-source] { opacity: 0.4 !important; }\n[data-ndl-drag-copy] {\n z-index: 2147483646; pointer-events: none; opacity: 0.85;\n box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22); cursor: grabbing;\n}\nhtml[data-ndl-holding] * { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }\nhtml[data-ndl-dragging], html[data-ndl-dragging] * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }\n[data-ndl-drop-target] > * { transition: translate 160ms ease; }\n[data-ndl-drop-room]::after { content: \'\'; display: block; flex: none; pointer-events: none; transition: height 160ms ease, width 160ms ease; }\n[data-ndl-drop-room="y"]::after { height: var(--ndl-drop-room, 0px); }\n[data-ndl-drop-room="x"]::after { width: var(--ndl-drop-room, 0px); }\n[data-ndl-drop-settle] > * { transition: none !important; }\n[data-ndl-hold-ring] {\n position: fixed; z-index: 2147483647; pointer-events: none;\n width: '.concat(Yt,"px; height: ").concat(Yt,"px;\n}\n[data-ndl-hold-ring] svg { transform: rotate(-90deg); display: block; }\n[data-ndl-hold-ring] circle { fill: none; stroke-width: 4; }\n[data-ndl-hold-track] { stroke: rgba(127, 127, 127, 0.3); }\n[data-ndl-hold-fill] {\n stroke: var(--primary, #2563eb); stroke-linecap: round;\n animation-name: ndl-hold-fill; animation-timing-function: linear; animation-fill-mode: forwards;\n}\n@keyframes ndl-hold-fill { to { stroke-dashoffset: 0; } }\n[data-ndl-drag-announcer] {\n position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;\n overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;\n}\n@media (prefers-reduced-motion: reduce) {\n [data-ndl-drop-target] > *, [data-ndl-drop-room]::after { transition: none; }\n}\n"),document.head.appendChild(e)}}())}function an(){window.addEventListener("pointermove",kt,!0),window.addEventListener("pointerup",Et,!0),window.addEventListener("pointercancel",It,!0),window.addEventListener("contextmenu",Rt,!0),window.addEventListener("dragstart",At,!0),window.addEventListener("selectstart",Dt,!0)}function ln(e,t){var n=e;if(n.scrollEnabled&&("row"===n.layout||"column"===n.layout)){var i=null==t?void 0:t.flexWrap;if("wrap"!==i&&"wrap-reverse"!==i)return n.nativeScroll?"native":"iscroll"}}function un(e){return Boolean(e)&&"string"==typeof e&&"%"===e[e.length-1]}function cn(e){return Number(e.slice(0,-1))}function dn(e,t,n){if(!t&&!n)return e;var i="calc(".concat(e);return t&&(i+=" - ".concat(t)),n&&(i+=" - ".concat(n)),i+")"}function pn(e,t,n,i){if(t.parentScroll){var o=cn(e[n]);"iscroll"===t.parentScroll&&(i?e[n]="calc(var(--ndl-scroll-".concat(n,") * ").concat(o/100,")"):(delete e[n],e.flexBasis=0,e.flexGrow=o,e.flexShrink=1));var r="width"===n?"minWidth":"minHeight";i||void 0!==e[r]||(e[r]="min-content")}}var hn={size:function(e,t){"none"===t.parentLayout&&(e.position="absolute"),"explicit"===t.sizeMode?(e.width=t.width,e.height=t.height):"contentHeight"===t.sizeMode?e.width=t.width:"contentWidth"===t.sizeMode&&(e.height=t.height),e.flexShrink=0,"row"===t.parentLayout&&"relative"===e.position?(un(e.width)&&pn(e,t,"width",t.fixedWidth),un(e.width)&&!t.fixedWidth&&(e.flexGrow=cn(e.width),e.flexShrink=1),un(e.height)&&!t.fixedHeight&&(e.height=dn(e.height,e.marginTop,e.marginBottom))):"column"===t.parentLayout&&"relative"===e.position?(un(e.width)&&!t.fixedWidth&&(e.width=dn(e.width,e.marginLeft,e.marginRight)),un(e.height)&&pn(e,t,"height",t.fixedHeight),un(e.height)&&!t.fixedHeight&&(e.flexGrow=cn(e.height),e.flexShrink=1)):"relative"!==e.position&&(un(e.width)&&(e.width=dn(e.width,e.marginLeft,e.marginRight)),un(e.height)&&(e.height=dn(e.height,e.marginTop,e.marginBottom))),function(e,t){var n,i=t.noodlNode;if(i&&"function"==typeof i.setDiagnostic&&i.diagnosticsEnabled){var o=t.parentLayout,r="row"===o?"width":"column"===o?"height":void 0,s=void 0!==r&&void 0!==e.flexGrow&&i.isInputConnected(r)?'"'.concat(r,'" is wired, and the parent stacks its children along that same axis, so the value arrived as a ')+'PERCENTAGE (dimension ports default to "%") and became flex-grow '.concat(e.flexGrow," — a ratio against the ")+"siblings that also grow, not a ".concat("width"===r?"width":"height",". Send a {value, unit} object instead ")+"of a bare number, or give this port a px value in the property panel first: a bare number arriving over a wire is merged into the unit the port is already holding.":null;(null!==(n=i._lastMainAxisGrowDiagnostic)&&void 0!==n?n:null)!==s&&(i._lastMainAxisGrowDiagnostic=s,i.setDiagnostic("dimensions/wired-dimension-becomes-grow",s))}}(e,t)},align:function(e,t){var n=e.position,i=t.alignX,o=t.alignY;"relative"!==n&&(i=i||"left",o=o||"top");var r="",s=t.parentLayout||"column";if(i)if("relative"!==n)"left"===i?e.left=0:"center"===i?(e.left="50%",r+="translateX(-50%) "):e.right=0;else if("relative"===n&&"row"===s)switch(i){case"left":e.marginRight=e.marginRight?e.marginRight:"auto";break;case"center":e.marginRight=e.marginRight?e.marginRight:"auto",e.marginLeft=e.marginLeft?e.marginLeft:"auto";break;case"right":e.marginLeft=e.marginLeft?e.marginLeft:"auto"}else if("relative"===n&&"column"===s)switch(i){case"left":e.alignSelf="flex-start";break;case"center":e.alignSelf="center";break;case"right":e.alignSelf="flex-end"}if(o)if("relative"!==n)"top"===o?e.top=0:"center"===o?(e.top="50%",r+="translateY(-50%)"):e.bottom=0;else if("relative"===n&&"column"===s)switch(o){case"top":e.marginBottom=e.marginBottom?e.marginBottom:"auto";break;case"center":e.marginTop=e.marginTop?e.marginTop:"auto",e.marginBottom=e.marginBottom?e.marginBottom:"auto";break;case"bottom":e.marginTop=e.marginTop?e.marginTop:"auto"}else if("relative"===n&&"row"===s)switch(o){case"top":e.alignSelf="flex-start";break;case"center":e.alignSelf="center";break;case"bottom":e.alignSelf="flex-end"}r&&(e.transform=r+(e.transform||""))}};const fn=hn;var gn=new Set(["noodl-default-styles","noodl-design-tokens"]);function mn(e,t){return e[0]-t[0]||e[1]-t[1]||e[2]-t[2]}function yn(e){for(var t=[],n=0,i=0,o=0;o<e.length;o++){var r=e[o];"("===r||"["===r?n++:")"===r||"]"===r?n--:","===r&&0===n&&(t.push(e.slice(i,o).trim()),i=o+1)}return t.push(e.slice(i).trim()),t.filter(Boolean)}function vn(e){for(var t=[0,0,0],n=0,i=function(e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]},o=function(){for(var t=0,i=n;n<e.length;n++)if("("===e[n])t++;else if(")"===e[n]&&0===--t)return n++,e.slice(i+1,n-1);return e.slice(i+1)},r=function(){for(var t=n;n<e.length&&/[A-Za-z0-9_\-\\ -￿]/.test(e[n]);)n++;return e.slice(t,n)};n<e.length;){var s=e[n];if("#"===s)n++,r(),t[0]++;else if("."===s)n++,r(),t[1]++;else if("["===s){for(;n<e.length&&"]"!==e[n];)n++;n++,t[1]++}else if(":"===s){var a=":"===e[n+1];n+=a?2:1;var l=r().toLowerCase(),u="("===e[n]?o():void 0;if(a||["before","after","first-line","first-letter"].includes(l))t[2]++;else if("where"===l);else if("is"!==l&&"not"!==l&&"has"!==l&&"matches"!==l||void 0===u)t[1]++;else{for(var c=[0,0,0],d=0,p=yn(u);d<p.length;d++){var h=vn(p[d]);mn(h,c)>0&&(c=h)}i(c)}}else"*"===s||/[\s>+~]/.test(s)?n++:/[A-Za-z]/.test(s)?(r(),t[2]++):n++}return t}function bn(e,t){var n=e.ownerNode||t.get(e)||null;return n?n.id&&gn.has(n.id)?null:"LINK"===n.tagName?{kind:"link",href:n.getAttribute("href")||""}:n.id&&n.id.startsWith("style_")?{kind:"css-definition",nodeId:n.id.slice(6)}:{kind:"head"}:{kind:"head"}}function wn(e){if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!0;try{return window.matchMedia(e).matches}catch(e){return!1}}var _n=[0,1,0],Sn=function(e,t){return(e||"").replace(/\s+/g," ").trim().toLowerCase()===(t||"").replace(/\s+/g," ").trim().toLowerCase()};function On(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}function Nn(e){for(var t,n,i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];if(!i.length)return e;var r=i.shift();if(On(e)&&On(r))for(var s in r)On(r[s])?(e[s]||Object.assign(e,((t={})[s]={},t)),Nn(e[s],r[s])):Object.assign(e,((n={})[s]=r[s],n));return Nn.apply(void 0,function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}([e],i,!1))}var Cn=__webpack_require__(7831),xn=["Arial","Arial Black","Courier New","Helvetica","Impact","Lucida Console","Tahoma","Times New Roman"],Tn=function(){function e(){var e=this;this.loadedFontFamilies={},this.fontCssFamiliesAdded={},this.fontCallbacks={},xn.forEach(function(t){e.loadedFontFamilies[t]=!0})}return e.prototype.loadFont=function(e){var t=this;if("undefined"!=typeof document){var n,i=(n=e=(0,Cn.getAbsoluteUrl)(e),n.replace(/\.[^/.]+$/,"")).split("/").pop();if(this.loadedFontFamilies[i])this.fontCallbacks[i]&&this.fontCallbacks[i].forEach(function(e){e()});else if(!this.fontCssFamiliesAdded[i]){this.fontCssFamiliesAdded[i]=!0;var o=document.createElement("style");o.type="text/css";var r=Noodl.Env.BaseUrl||"/";e.startsWith("/")&&(e=e.substring(1)),o.appendChild(document.createTextNode("@font-face { font-family: '"+i+"'; src: url('"+r+e+"'); }\n")),document.head.appendChild(o),"undefined"!=typeof window&&__webpack_require__(3169).load({timeout:6e5,custom:{families:[i]},fontactive:function(e){t.loadedFontFamilies[e]=!0,t.fontCallbacks[e]&&t.fontCallbacks[e].forEach(function(e){e()})}})}}},e.prototype.callWhenFontIsActive=function(e,t){this.loadedFontFamilies[e]?t():(this.fontCallbacks[e]||(this.fontCallbacks[e]=[]),this.fontCallbacks[e].push(t))},e}();const kn=Tn;function En(e){if(null!=e&&""!==e)return(0,Cn.getAbsoluteUrl)(e)}function In(e){var t=e.title,n=e.body,i=e.images,o="<h3>".concat(t,"</h3>");if(n&&(o+=(Array.isArray(n)?n:[n]).map(function(e){return"<p>".concat(e,"</p>")}).join("")),i){var r="";i.forEach(function(e){r+='<div class="popup-layer-image-item">',r+='<img src="../assets/images/tooltips/'.concat(e.src,'">'),e.label&&(r+="<h3>".concat(e.label,"</h3>")),e.body&&(r+="<p>".concat(e.body,"</p>")),r+="</div>"}),o+='<div class="popup-layer-image-row">'.concat(r,"</div>")}return o}Tn.instance=new Tn;var Pn=function(){return Pn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Pn.apply(this,arguments)},Rn=["explicit","contentWidth","contentHeight","contentSize"];function An(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Dn(e){if(null!=e){if("object"==typeof e){var t=e;if("number"!=typeof t.value||!Number.isFinite(t.value))return;return"".concat(t.value).concat(t.unit||"px")}if("number"==typeof e)return Number.isFinite(e)?"".concat(e,"px"):void 0;var n=String(e).trim();if(""!==n)return/^[+-]?(\d+\.?\d*|\.\d+)$/.test(n)?"".concat(n,"px"):n}}function Fn(e,t){for(var n in e.inputCss||(e.inputCss={}),e.defaultCss||(e.defaultCss={}),t)e.inputCss[n]=t[n]}function Mn(e,t,n){for(var i in e[t]||(e[t]={}),n)e[t][i]=n[i]}function jn(e,t){Mn(e,"inputs",t)}function Vn(e,t){Mn(e,"inputProps",t)}function Ln(e,t,n){e.dynamicports||(e.dynamicports=[]),e.dynamicports.push({condition:t,inputs:n})}function Un(e,t){Mn(e,"outputProps",t)}function Bn(e,t){Mn(e,"outputs",t)}function Wn(e,t,n){e.dynamicports||(e.dynamicports=[]),e.dynamicports.push(Pn({condition:t},n))}function zn(e){e._internal.dragDropForgetArmed||(e._internal.dragDropForgetArmed=!0,e.addDeleteListener(function(){return function(e){mt.delete(e),yt.delete(e),xt&&xt.source===e?jt(xt):xt&&xt.zone===e&&Wt(xt)}(e)}))}function qn(e,t){if(!e._internal.acceptFileDrops)return!1;var n=t.dataTransfer&&t.dataTransfer.types;return!!n&&-1!==Array.prototype.indexOf.call(n,"Files")}function Hn(e){e._internal.dragDepth=0,Gn(e,!1)}function Gn(e,t){!!e._internal.isDragOver!==t&&(e._internal.isDragOver=t,e.flagOutputDirty("isDragOver"))}function $n(e){for(var t=0,n=["droppedFile","droppedFiles","droppedFileName","droppedFileType","droppedFileSizeInBytes"];t<n.length;t++){var i=n[t];e.hasOutput(i)&&e.flagOutputDirty(i)}}const Xn={addInputProps:Vn,addInputs:jn,addDynamicInputPorts:Ln,addInputCss:Fn,addSharedVisualInputs:function(e){Fn(e,{opacity:{index:200,group:"Style",displayName:"Opacity",description:"How opaque this element is, from 0 for invisible to 1 for solid",type:"number",default:1,allowVisualStates:!0},mixBlendMode:{index:201,group:"Style",displayName:"Blend Mode",description:"How this element's colours blend with whatever is painted behind it",type:{name:"enum",enums:[{label:"Normal",value:"normal"},{label:"Multiply",value:"multiply"},{label:"Screen",value:"screen"},{label:"Overlay",value:"overlay"},{label:"Darken",value:"darken"},{label:"Lighten",value:"lighten"},{label:"Color Dodge",value:"color-dodge"},{label:"Color Burn",value:"color-burn"},{label:"Hard Light",value:"hard-light"},{label:"Soft Light",value:"soft-light"},{label:"Difference",value:"difference"},{label:"Exclusion",value:"exclusion"},{label:"Hue",value:"hue"},{label:"Saturation",value:"saturation"},{label:"Color",value:"color"},{label:"Luminosity",value:"luminosity"}]},default:"normal",applyDefault:!1,allowVisualStates:!0}}),jn(e,{visible:{index:210,displayName:"Visible",description:"Hides the element while keeping the space it occupies in the layout",group:"Style",default:!0,type:"boolean",set:function(e){e?this.removeStyle(["visibility"]):this.setStyle({visibility:"hidden"})}},zIndex:{index:211,displayName:"zIndex",description:"Paint order among overlapping siblings; higher numbers paint on top",group:"Style",type:"number",allowVisualStates:!0,set:function(e){void 0===e?this.removeStyle(["zIndex"]):this.setStyle({zIndex:Number(e)})}}})},addMarginInputs:function(e){Fn(e,{marginLeft:{index:1,group:"Margin and padding",displayName:"Margin Left",description:"Space outside the element's left edge, between it and its neighbours",type:{name:"number",units:["px","%"],defaultUnit:"px",marginPaddingComp:"margin-left"},allowVisualStates:!0},marginRight:{index:2,group:"Margin and padding",displayName:"Margin Right",description:"Space outside the element's right edge, between it and its neighbours",type:{name:"number",units:["px","%"],defaultUnit:"px",marginPaddingComp:"margin-right"},allowVisualStates:!0},marginTop:{index:3,group:"Margin and padding",displayName:"Margin Top",description:"Space outside the element's top edge, between it and its neighbours",type:{name:"number",units:["px","%"],defaultUnit:"px",marginPaddingComp:"margin-top"},allowVisualStates:!0},marginBottom:{index:4,group:"Margin and padding",displayName:"Margin Bottom",description:"Space outside the element's bottom edge, between it and its neighbours",type:{name:"number",units:["px","%"],defaultUnit:"px",marginPaddingComp:"margin-bottom"},allowVisualStates:!0}})},addPaddingInputs:function(e,t){var n=(t=t||{}).defaults?t.defaults:{},i=t.styleTag;Fn(e,{boxSizing:{index:63,group:"Margin and padding",displayName:"Box Sizing",description:"Whether Width and Height include this element's padding and border, or only its content",default:"border-box",type:{name:"enum",enums:[{value:"border-box",label:"Include padding and border"},{value:"content-box",label:"Content only"}]},allowVisualStates:!0,styleTag:i},paddingLeft:{index:64,group:"Margin and padding",default:n.paddingLeft||0,applyDefault:void 0!==n.paddingLeft,displayName:"Pad Left",description:"Space inside the element's left edge, between it and its content",type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-left"},allowVisualStates:!0,styleTag:i},paddingRight:{index:65,group:"Margin and padding",default:n.paddingRight||0,applyDefault:void 0!==n.paddingRight,displayName:"Pad Right",description:"Space inside the element's right edge, between it and its content",type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-right"},allowVisualStates:!0,styleTag:i},paddingTop:{index:66,group:"Margin and padding",displayName:"Pad Top",description:"Space inside the element's top edge, between it and its content",default:n.paddingTop||0,applyDefault:void 0!==n.paddingTop,type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-top"},allowVisualStates:!0,styleTag:i},paddingBottom:{index:67,group:"Margin and padding",displayName:"Pad Bottom",description:"Space inside the element's bottom edge, between it and its content",default:n.paddingBottom||0,applyDefault:void 0!==n.paddingBottom,type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-bottom"},allowVisualStates:!0,styleTag:i}})},addTransformInputs:function(e){var t=function(e){return null==e||void 0===e.value||null===e.value?void 0:e.value+e.unit};jn(e,{transformX:{group:"Placement",displayName:"Pos X",description:"Moves the element right after layout, without moving its siblings",default:0,index:300,allowVisualStates:!0,type:{name:"number",units:["px","%"],defaultUnit:"px"},set:function(e){this.transforms||(this.transforms={}),this.transforms.x=t(e),this.updateTransform()}},transformY:{group:"Placement",displayName:"Pos Y",description:"Moves the element down after layout, without moving its siblings",default:0,index:301,allowVisualStates:!0,type:{name:"number",units:["px","%"],defaultUnit:"px"},set:function(e){this.transforms||(this.transforms={}),this.transforms.y=t(e),this.updateTransform()}},transformRotation:{index:302,group:"Placement",displayName:"Rotation",description:"Rotates the element clockwise in degrees, without affecting the layout",default:0,allowVisualStates:!0,type:{name:"number",units:["deg"],defaultUnit:"deg"},set:function(e){this.transforms||(this.transforms={}),this.transforms.rotation=t(e),this.updateTransform()}},transformScale:{index:303,group:"Placement",displayName:"Scale",description:"Scales the element about its transform origin; 1 leaves it unscaled",default:1,allowVisualStates:!0,type:{name:"number"},set:function(e){this.transforms||(this.transforms={}),this.transforms.scale=e,this.updateTransform()}},transformOriginX:{index:304,group:"Placement",displayName:"Transform Origin X",description:"Horizontal point the element rotates and scales around, as a fraction of its width",allowVisualStates:!0,type:{name:"number",units:["px","%"],defaultUnit:"%"},default:"50",set:function(e){this.transformOriginX=t(e),this.updateTransformOrigin()}},transformOriginY:{index:305,group:"Placement",displayName:"Transform Origin Y",description:"Vertical point the element rotates and scales around, as a fraction of its height",allowVisualStates:!0,type:{name:"number",units:["px","%"],defaultUnit:"%"},default:"50",set:function(e){this.transformOriginY=t(e),this.updateTransformOrigin()}}}),e.methods||(e.methods={}),e.methods.updateTransform=function(){var e="",t=this.transforms,n=t.x,i=t.y,o=t.rotation,r=t.scale;n&&(e+="translateX(".concat(n,") ")),i&&(e+="translateY(".concat(i,") ")),o&&(e+="rotate(".concat(o,") ")),void 0!==r&&(e+="scale(".concat(r,",").concat(r,")")),this.setStyle({transform:e})},e.methods.updateTransformOrigin=function(){var e=void 0!==this.transformOriginX?this.transformOriginX:"50%",t=void 0!==this.transformOriginY?this.transformOriginY:"50%";this.setStyle({transformOrigin:"".concat(e," ").concat(t)})}},addAlignInputs:function(e){Fn(e,{position:{index:11,displayName:"Position",description:"How the element is placed: In Layout follows its siblings, Absolute ignores them, Sticky pins to the parent edge on overflow, Fixed stays put and takes no space",group:"Layout",type:{name:"enum",enums:[{label:"In Layout",value:"relative"},{label:"Absolute",value:"absolute"},{label:"Sticky",value:"sticky"},{label:"Fixed",value:"fixed"}]},default:"relative"}}),Vn(e,{alignX:{index:5,group:"Alignment",displayName:"Align X",description:"Horizontal alignment of this element within the space its parent gives it",type:{name:"enum",enums:[{label:"Left",value:"left"},{label:"Center",value:"center"},{label:"Right",value:"right"}],alignComp:"horizontal"}},alignY:{index:6,group:"Alignment",displayName:"Align Y",description:"Vertical alignment of this element within the space its parent gives it",type:{name:"enum",enums:[{label:"Top",value:"top"},{label:"Center",value:"center"},{label:"Bottom",value:"bottom"}],alignComp:"vertical"}}}),function(e){e.inputCss.position.tooltip=In({title:"Position",images:[{label:"Relative",body:"Relative to its siblings",src:"position-relative.svg"},{label:"Absolute",body:"Not affected by siblings or parent's layout",src:"position-absolute.svg"},{label:"Sticky",body:"Stick to parent's edge on overflow",src:"position-sticky.svg"},{label:"Fixed",body:"Always stay in the same place and take no space in the layout",src:"position-sticky.svg"}]})}(e)},addPointerEventOutputs:function(e){jn(e,{pointerEventsMode:{index:403,displayName:"Pointer Events Mode",description:"Whether pointer handling is inherited from the parent or set explicitly on this element",type:{name:"enum",enums:[{label:"Inherit",value:"inherit"},{label:"Explicit",value:"explicit"}]},default:"inherit",group:"Pointer Events",set:function(e){if("inherit"===e)this.removeStyle(["pointerEvents"]);else{var t="auto";void 0!==this._internal.pointerEventsEnabled&&(t=this._internal.pointerEventsEnabled?"auto":"none"),this.setStyle({pointerEvents:t})}}},pointerEventsEnabled:{index:404,displayName:"Pointer Events Enabled",description:"When disabled, mouse and touch events pass through to whatever is behind this element",type:"boolean",group:"Pointer Events",default:!0,set:function(e){this._internal.pointerEventsEnabled=!!e,this.setStyle({pointerEvents:this._internal.pointerEventsEnabled?"auto":"none"})}}}),Vn(e,{blockTouch:{index:450,displayName:"Block Pointer Events",description:"Stops every pointer event that lands here from reaching the nodes this one sits inside. Blunt: it takes hover and pointer-down with it, so reach for Click Bubbling first if it is only clicks you want to keep in",group:"Pointer Events",type:"boolean"},clickBubbling:{index:451,displayName:"Click Bubbling",description:"Whether a click here also fires Click on the nodes this one sits inside. Automatic keeps it here as soon as this node's own Click is connected, so a button inside a clickable card runs the button and not the card; Always is the older behaviour where both run; Never keeps every click here, wired or not. Note that an element at zero opacity takes no pointer events at all",group:"Pointer Events",type:{name:"enum",enums:[{label:"Automatic",value:"auto"},{label:"Always",value:"always"},{label:"Never",value:"never"}]},default:"auto"}}),Ln(e,"pointerEventsMode = explicit",["pointerEventsEnabled"]),Un(e,{onClick:{displayName:"Click",description:"Fires when this element is clicked or tapped",group:"Events",type:"signal",propPath:"pointer"},pointerDown:{displayName:"Pointer Down",description:"Fires when a mouse button is pressed or a finger touches this element",group:"Pointer Events",type:"signal",propPath:"pointer",props:{onMouseDown:function(){this.sendSignalOnOutput("pointerDown")},onTouchStart:function(){this.sendSignalOnOutput("pointerDown")}}},pointerUp:{displayName:"Pointer Up",description:"Fires when the mouse button is released or the finger lifts over this element",group:"Pointer Events",type:"signal",propPath:"pointer",props:{onMouseUp:function(){this.sendSignalOnOutput("pointerUp")},onTouchEnd:function(){this.sendSignalOnOutput("pointerUp")},onTouchCancel:function(){this.sendSignalOnOutput("pointerUp")}}},pointerEnter:{displayName:"Pointer Enter",description:"Fires when the pointer moves onto this element, not counting its children",group:"Pointer Events",type:"signal",propPath:"pointer",props:{onMouseEnter:function(){this.sendSignalOnOutput("pointerEnter")}}},hoverStart:{displayName:"Hover Start",description:"Fires when the pointer moves over this element or any of its children",group:"Hover Events",type:"signal",propPath:"pointer",props:{onMouseOver:function(){this.sendSignalOnOutput("hoverStart"),this.setVisualStates(["hover"])}}},hoverEnd:{displayName:"Hover End",description:"Fires when the pointer leaves this element",group:"Hover Events",type:"signal",propPath:"pointer",props:{onMouseLeave:function(){this.sendSignalOnOutput("hoverEnd"),this.setVisualStates([""])}}}}),function(e){e.inputs.pointerEventsMode.tooltip=In({title:"Pointer events mode",body:["Control if mouse and touch events are enabled on this node","- Inherit: Same settings as parent","- Explicit: Enable control on this element"]}),e.inputs.pointerEventsEnabled.tooltip=In({title:"Pointer events enabled",body:["- Enabled: This element will receive mouse and touch events","- Disabled: No mouse or touch events will be captured by this element and the element below will receive it instead"]})}(e)},addFileDropPorts:function(e){e.methods||(e.methods={}),e.methods._fileDropLeftPage=function(){Hn(this)},jn(e,{acceptFileDrops:{index:350,group:"File Drop",displayName:"Accept File Drops",type:"boolean",default:!1,description:"Lets a file dragged from the desktop be dropped onto this element, which reveals the File Drop outputs below",set:function(e){this._internal.acceptFileDrops=!!e,e||Hn(this)}},acceptedFileTypes:{index:351,group:"File Drop",displayName:"Accepted file types",type:"string",description:'Comma-separated extensions or MIME types this element will take — ".png, .jpg" or "image/*"; leave blank to accept every file. A drop of nothing but rejected files fires Files Rejected instead of Files Dropped',set:function(e){this._internal.acceptedFileTypes=e}}}),Wn(e,"acceptFileDrops = true",{inputs:["acceptedFileTypes"],outputs:["filesDropped","filesRejected","droppedFile","droppedFiles","droppedFileName","droppedFileType","droppedFileSizeInBytes","isDragOver"]}),Un(e,{filesDropped:{displayName:"Files Dropped",description:"Fires when one or more accepted files are dropped here, after every File Drop output is up to date",group:"File Drop",type:"signal",propPath:"pointer",props:{onDragEnter:function(e){qn(this,e)&&(e.preventDefault(),this._internal.dragElement!==e.currentTarget&&(this._internal.dragElement=e.currentTarget,this._internal.dragDepth=0),this._internal.dragDepth=(this._internal.dragDepth||0)+1,Gn(this,!0))},onDragOver:function(e){qn(this,e)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},onDragLeave:function(e){qn(this,e)&&(this._internal.dragDepth=Math.max(0,(this._internal.dragDepth||0)-1),0===this._internal.dragDepth&&Gn(this,!1))},onDrop:function(e){var t=this;if(qn(this,e)){e.preventDefault(),e.stopPropagation(),this._internal.dragDepth=0,Gn(this,!1);var n=(e.dataTransfer?Array.from(e.dataTransfer.files||[]):[]).filter(function(e){return function(e,t){var n=String(t||"").split(",").map(function(e){return e.trim().toLowerCase()}).filter(Boolean);if(0===n.length)return!0;var i=(e.name||"").toLowerCase(),o=(e.type||"").toLowerCase();return n.some(function(e){return e.startsWith(".")?i.endsWith(e):e.endsWith("/*")?o.startsWith(e.slice(0,-1)):o===e})}(e,t._internal.acceptedFileTypes)});if(0===n.length)return this._internal.droppedFiles=[],this._internal.droppedFile=void 0,$n(this),void this.sendSignalOnOutput("filesRejected");this._internal.droppedFiles=n,this._internal.droppedFile=n[0],$n(this),this.sendSignalOnOutput("filesDropped")}}}}}),Bn(e,{filesRejected:{displayName:"Files Rejected",description:"Fires when a drop landed here but every file in it was excluded by Accepted file types",group:"File Drop",type:"signal"},droppedFile:{displayName:"File",description:"The first accepted file, in the form an Upload File node takes",group:"File Drop",type:"*",get:function(){return this._internal.droppedFile}},droppedFiles:{displayName:"Files",description:"Every accepted file in the drop, as an array — a drop can carry more than one",group:"File Drop",type:"array",get:function(){return this._internal.droppedFiles}},droppedFileName:{displayName:"File Name",description:"Name of the first accepted file, extension included",group:"File Drop",type:"string",get:function(){return this._internal.droppedFile&&this._internal.droppedFile.name}},droppedFileType:{displayName:"File Type",description:"MIME type the browser reports for the first accepted file, blank for one it does not recognise",group:"File Drop",type:"string",get:function(){return this._internal.droppedFile&&this._internal.droppedFile.type}},droppedFileSizeInBytes:{displayName:"File Size In Bytes",description:"Size of the first accepted file, in bytes",group:"File Drop",type:"number",get:function(){return this._internal.droppedFile&&this._internal.droppedFile.size}},isDragOver:{displayName:"Is Dragging Over",description:"True while a file is being dragged over this element — wire it to a border or background so the drop zone reacts",group:"File Drop",type:"boolean",get:function(){return!!this._internal.isDragOver}}}),function(e){e.inputs.acceptFileDrops.tooltip=In({title:"Accept file drops",body:["Lets a file dragged in from the desktop be dropped onto this element","The File Drop outputs appear once this is on — wire File to an Upload File node, and Is Dragging Over to a border or background so the zone reacts"]}),e.inputs.acceptedFileTypes.tooltip=In({title:"Accepted file types",body:["Comma-separated extensions or MIME types this element will take",'- ".png, .jpg" matches by file name','- "image/*" matches a whole MIME group',"- Blank accepts every file","A drop carrying nothing acceptable fires Files Rejected rather than Files Dropped"]})}(e)},addDragDropPorts:function(e){jn(e,{draggable:{index:360,group:"Drag Source",displayName:"Draggable",type:"boolean",default:!1,description:"Lets a person pick this element up and drop it on an element with Accept Drops on. A see-through copy follows the pointer; the element itself stays put until the graph moves it",set:function(e){this._internal.draggable=!!e,zn(this),function(e,t){if(t)mt.add(e),sn(),(n=e.getDOMElement())&&bt(n);else{mt.delete(e);var n,i=(n=e.getDOMElement())&&vt.get(n);if(n&&i){for(var o=0,r=i;o<r.length;o++){var s=r[o];n.removeAttribute(s)}vt.delete(n)}}}(this,!!e)}},dragValue:{index:361,group:"Drag Source",displayName:"Drag Value",type:"*",description:"What this element carries — usually the id of the item it shows. A drop zone reports it as Dropped Value",set:function(e){this._internal.dragValue=e}},dragKind:{index:362,group:"Drag Source",displayName:"Drag Kind",type:"string",description:'Optional name for what this is — "card", "task". A zone with an Accept Kind only takes sources whose Drag Kind matches',set:function(e){this._internal.dragKind=e}},holdToDrag:{index:363,group:"Drag Source",displayName:"Hold To Drag",type:{name:"enum",enums:[{value:"touch",label:"On touch"},{value:"always",label:"Always"},{value:"never",label:"Never"}]},default:"touch",description:"Whether a press must be held before it picks up. On touch (the default) a finger holds for Hold Time while a ring fills, so a moving finger still scrolls; a mouse picks up as soon as it moves",set:function(e){this._internal.holdToDrag=e}},holdTime:{index:364,group:"Drag Source",displayName:"Hold Time",type:"number",default:.5,description:"How long a held press takes to pick up, in seconds",set:function(e){this._internal.holdTime=e}},acceptDrops:{index:370,group:"Drop Zone",displayName:"Accept Drops",type:"boolean",default:!1,description:"Lets a Draggable element be dropped here, which reveals the Drop Zone outputs. The innermost zone under the pointer takes the drop",set:function(e){var t;this._internal.acceptDrops=!!e,zn(this),t=this,e?(yt.add(t),sn()):(yt.delete(t),xt&&xt.zone===t&&Wt(xt))}},acceptKind:{index:371,group:"Drop Zone",displayName:"Accept Kind",type:"string",description:"Comma-separated Drag Kinds this zone takes; leave blank to take any Draggable. A source of another kind never lights this zone up",set:function(e){this._internal.acceptKind=e}},makeRoom:{index:372,group:"Drop Zone",displayName:"Make Room",type:"boolean",default:!0,description:"Slides the children apart to open a gap where the drop will land, while it hovers. Off keeps the children still and only reports Drop Index",set:function(e){this._internal.makeRoom=!!e}},dropZoneName:{index:373,group:"Drop Zone",displayName:"Zone Name",type:"string",description:'What a screen reader hears this zone called while a card is moved with the keyboard — "Thursday". Falls back to the element\'s accessible label',set:function(e){this._internal.dropZoneName=e}}}),Wn(e,"draggable = true",{inputs:["dragValue","dragKind","holdToDrag","holdTime"],outputs:["pickedUp","landed","dragCancelled","isLifted"]}),Wn(e,"acceptDrops = true",{inputs:["acceptKind","makeRoom","dropZoneName"],outputs:["dropped","droppedValue","dropIndex","isDropTarget"]}),Bn(e,{pickedUp:{displayName:"Picked Up",description:"Fires when this element is lifted — after the hold on touch, on the first move with a mouse, on Space from the keyboard",group:"Drag Source",type:"signal"},landed:{displayName:"Landed",description:"Fires when this element is dropped on a zone that took it, after the zone's Dropped",group:"Drag Source",type:"signal"},dragCancelled:{displayName:"Cancelled",description:"Fires when a lifted element is let go over nothing that takes it, or Escape puts it back",group:"Drag Source",type:"signal"},isLifted:{displayName:"Is Lifted",description:"True while this element is being dragged",group:"Drag Source",type:"boolean",get:function(){return!!this._internal.isLifted}},dropped:{displayName:"Dropped",description:"Fires when a Draggable is dropped here, after Dropped Value and Drop Index are up to date. Move the data here — the engine moves nothing",group:"Drop Zone",type:"signal"},droppedValue:{displayName:"Dropped Value",description:"The Drag Value of the element dropped here",group:"Drop Zone",type:"*",get:function(){return this._internal.droppedValue}},dropIndex:{displayName:"Drop Index",description:"Where among this zone's children it landed, counting from 0 and leaving the dropped element itself out — so it is the index to insert at once it is removed from where it was",group:"Drop Zone",type:"number",get:function(){return this._internal.dropIndex}},isDropTarget:{displayName:"Drag Over",description:"True while something this zone takes is held over it — wire it to a background or border so the zone lights up",group:"Drop Zone",type:"boolean",get:function(){return!!this._internal.isDropTarget}}}),function(e){e.inputs.draggable.tooltip=In({title:"Draggable",body:["Lets a person pick this element up and drop it on an element with Accept Drops on","A see-through copy follows the pointer and the element stays where it is, faded, until the graph moves it — wire the zone's Dropped to the command that does the move","On touch, a press is held for Hold Time while a ring fills; with a mouse it picks up as soon as it moves. Space picks it up from the keyboard"]}),e.inputs.acceptDrops.tooltip=In({title:"Accept drops",body:["Lets a Draggable element be dropped here","Drag Over is true while one is held over this zone; Dropped fires on the drop with Dropped Value and Drop Index","With Make Room on, the children slide apart to show where it will land"]})}(e)},addDimensions:function(e,t){var n=void 0===t?{}:t,i=n.defaultSizeMode,o=void 0===i?"explicit":i,r=n.contentLabel,s=void 0===r?"Content":r,a=n.useDimensionConstraints,l=void 0===a||a,u="sizeMode = explicit OR sizeMode = contentHeight",c="sizeMode = explicit OR sizeMode = contentWidth";"explicit"!==o&&"contentHeight"!==o||(u+=" OR sizeMode NOT SET"),"explicit"!==o&&"contentWidth"!==o||(c+=" OR sizeMode NOT SET"),Ln(e,u,["width"]),Ln(e,c,["height"]),Vn(e,{sizeMode:{index:10,type:{name:"enum",enums:[{value:"explicit",label:"Explicit"},{value:"contentWidth",label:"Content Width"},{value:"contentHeight",label:"Content Height"},{value:"contentSize",label:"Content Size"}],allowEditOnly:!0,sizeComp:"mode"},group:"Dimensions",displayName:"Size Mode",description:"Whether Width and Height are used as given, or the element sizes itself to fit its contents",default:o,allowVisualStates:!0,onChange:function(e){void 0!==e?Rn.includes(e)||this.raiseRuntimeError("dimensions/unknown-size-mode","Unknown Size Mode '".concat(String(e),"'. Expected one of ").concat(Rn.join(", "),".")):this.props.sizeMode=o}},width:{index:11,group:"Dimensions",displayName:"Width",description:"Width of the element; how the value is read depends on Size Mode",type:{name:"dimension",units:["%","px","vw","vh"],defaultUnit:"%"},default:100,allowVisualStates:!0,onChange:function(e){this.props.fixedWidth=e?e.isFixed:void 0}},height:{index:13,group:"Dimensions",displayName:"Height",description:"Height of the element; how the value is read depends on Size Mode",type:{name:"dimension",units:["%","px","vw","vh"],defaultUnit:"%"},default:100,allowVisualStates:!0,onChange:function(e){this.props.fixedHeight=e?e.isFixed:void 0}}}),Noodl.deployed||function(e,t){e.inputProps.sizeMode.tooltip={explicit:{standard:"Explicit width & height",extended:In({title:"Explicit width & height",body:"Set width & height explicitly in pixels(px), percentage(%) or viewport size(vh/vw).",images:[{src:"size-mode-explicit.svg"}]})},contentWidth:{standard:"".concat(t," width & explicit height"),extended:In({title:"".concat(t," width & explicit height"),body:"The width will match the width of the ".concat(t.toLowerCase(),". Height is set explicitly."),images:[{src:"size-mode-content-width.svg"}]})},contentHeight:{standard:"Explicit width & ".concat(t.toLowerCase()," height"),extended:In({title:"Explicit width & ".concat(t.toLowerCase()," height"),body:"The width is set explicitly. The height will match the height of the ".concat(t.toLowerCase()),images:[{src:"size-mode-content-height.svg"}]})},contentSize:{standard:"".concat(t," width & height"),extended:In({title:"".concat(t," width & height"),body:"The width and height will match the size of the ".concat(t.toLowerCase()),images:[{src:"size-mode-content-size.svg"}]})}};var n=["- %: Relative to parents size. If 'fixed' is false this element will resize to share space with siblings. If 'Clip Content' is disabled, it'll also expand to fit the boundaries of all its content","- px: Pixels","- vw: Relative to viewport width. 100 makes the element the same width as the screen","- vh: Relative to viewport height. 100 makes the element the same height as the screen"],i=In({title:"Fixed",body:["- Enabled: Elements will be the exact size set","- Disabled: Element will resize to fill up empty space, or shrink to make space for siblings. Use the dimension constraints, min and max size, to control the boundaries"]});e.inputProps.width.tooltip={dimension:In({title:"Width",body:n}),fixed:i},e.inputProps.height.tooltip={dimension:In({title:"Height",body:n}),fixed:i}}(e,s),l&&(Fn(e,{minWidth:{index:400,group:"Dimension Constraints",displayName:"Min Width",description:"Smallest width the element may shrink to, taking priority over Width",allowVisualStates:!0,type:{name:"number",units:["%","px","vw","vh"],defaultUnit:"%"}},maxWidth:{index:401,group:"Dimension Constraints",displayName:"Max Width",description:"Largest width the element may grow to, taking priority over Width",allowVisualStates:!0,type:{name:"number",units:["%","px","vw","vh"],defaultUnit:"%"}},minHeight:{index:402,group:"Dimension Constraints",displayName:"Min Height",description:"Smallest height the element may shrink to, taking priority over Height",allowVisualStates:!0,type:{name:"number",units:["%","px","vw","vh"],defaultUnit:"%"}},maxHeight:{index:403,group:"Dimension Constraints",displayName:"Max Height",description:"Largest height the element may grow to, taking priority over Height",allowVisualStates:!0,type:{name:"number",units:["%","px","vw","vh"],defaultUnit:"%"}}}),Noodl.deployed||function(e){e.inputCss.minWidth.tooltip=In({title:"Minimum width",body:"This is prioritized over other properties, so the element won't shrink below this size"}),e.inputCss.minHeight.tooltip=In({title:"Minimum height",body:"This is prioritized over other properties, so the element won't shrink below this size"}),e.inputCss.maxWidth.tooltip=In({title:"Maximum width",body:"This is prioritized over other properties, so the element won't grow beyond this size"}),e.inputCss.maxHeight.tooltip=In({title:"Maximum height",body:"This is prioritized over other properties, so the element won't grow beyond this size"})}(e))},_addCornerRadius:function(e,t){var n=(t=t||{}).defaults||{},i=t.styleTag;function o(e,t,i,o){var r,s={group:"corners",tab:i,label:t},a="border".concat(t,"Radius");jn(e,((r={})[a]={index:240+o,displayName:"Corner Radius",editorName:"".concat("Corner Radius"," ").concat(t?"("+t+")":""),description:t?"Rounds the ".concat(An(t)," corner only, overriding Corner Radius"):"Rounds all four corners, except any corner that sets its own radius",group:"Corner Radius",type:{name:"number",units:["px","%"],defaultUnit:"px"},allowVisualStates:!0,default:n[a],tab:s,set:function(e){this._internal.borderRadius[a]=Dn(e),this._updateCornerRadii()}},r))}n.borderRadius||(n.borderRadius=0),o(e,"","corners-all",0),o(e,"TopLeft","corners-top-left",1),o(e,"TopRight","corners-top-right",2),o(e,"BottomRight","corners-bottom-right",3),o(e,"BottomLeft","corners-bottom-left",4),e.methods._updateCornerRadii=function(){var e=this._internal.borderRadius;function t(t,n){var i="border".concat(n,"Radius");t[i]=e[i]||e.borderRadius}var n={};t(n,"TopLeft"),t(n,"TopRight"),t(n,"BottomRight"),t(n,"BottomLeft"),this.setStyle(n,i)};var r=e.initialize;e.initialize=function(){r&&r.call(this),this._internal.borderRadius=Pn({},n),n.borderRadius&&this._updateCornerRadii()}},addBorderInputs:function(e,t){var n=(t=t||{}).defaults||{},i=t.styleTag;function o(e,t,i,o){var r,s="border".concat(t,"Style"),a="border".concat(t,"Width"),l="border".concat(t,"Color"),u="none"!==n.borderStyle?"OR borderStyle NOT SET":"";t?(n[s]&&"none"!==n[s]&&(u+="OR ".concat(s," NOT SET")),Ln(e,"".concat(s," = solid OR ").concat(s," = dashed OR ").concat(s," = dotted OR borderStyle = solid OR borderStyle = dashed OR borderStyle = dotted ").concat(u),["".concat(a),"".concat(l)])):Ln(e,"".concat(s," = solid OR ").concat(s," = dashed OR ").concat(s," = dotted ").concat(u),["".concat(a),"".concat(l)]);var c={group:"border-styles",tab:i,label:t},d=function(e){return"".concat(e," ").concat(t?"("+t+")":"")},p=202+4*o;jn(e,((r={})[s]={index:p+1,displayName:"Border Style",editorName:d("Border Style"),description:t?"Line style for the ".concat(t.toLowerCase()," edge only, overriding Border Style; None hides that edge"):"Line style for all four edges; None hides the border and leaves Border Width and Color inactive",group:"Border Style",allowVisualStates:!0,type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Solid",value:"solid"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"}]},default:n[s],tab:c,set:function(e){this._internal.borders[s]=e,this._updateBorders()}},r[a]={index:p+2,displayName:"Border Width",editorName:d("Border Width"),description:t?"Thickness of the ".concat(t.toLowerCase()," edge in pixels, and it adds to the element's size"):"Thickness of the border in pixels, which adds to the element's size unless Box Sizing accounts for it",group:"Border Style",allowVisualStates:!0,type:{name:"number",units:["px"],defaultUnit:"px"},default:n[a],tab:c,set:function(e){this._internal.borders[a]=Dn(e),this._updateBorders()}},r[l]={index:p+3,displayName:"Border Color",editorName:d("Border Color"),description:t?"Colour of the ".concat(t.toLowerCase()," edge only, overriding Border Color"):"Colour of the border, which has no effect while Border Style is None",group:"Border Style",type:"color",default:n[l],allowVisualStates:!0,tab:c,set:function(e){this._internal.borders[l]=e,this._updateBorders()}},r))}void 0===n.borderStyle&&(n.borderStyle="none"),void 0===n.borderWidth&&(n.borderWidth=2),void 0===n.borderColor&&(n.borderColor="#000000"),o(e,"","borders-all",0),o(e,"Left","borders-left",1),o(e,"Top","borders-top",2),o(e,"Right","borders-right",3),o(e,"Bottom","borders-bottom",4),e.methods._updateBorders=function(){var e=this._internal.borders;function t(t,n){var i="border".concat(n,"Width"),o="border".concat(n,"Color"),r="border".concat(n,"Style");t[i]=e[i]||e.borderWidth,t[o]=e[o]||e.borderColor,t[r]=e[r]||e.borderStyle}var n={};t(n,"Top"),t(n,"Right"),t(n,"Bottom"),t(n,"Left"),this.setStyle(n,i)};var r=e.initialize;e.initialize=function(){r&&r.call(this),this._internal.borders=Pn({},n),("none"!==n.borderStyle||n.borderTopStyle&&"none"!==n.borderTopStyle||n.borderRightStyle&&"none"!==n.borderRightStyle||n.borderBottomStyle&&"none"!==n.borderBottomStyle||n.borderRightStyle&&"none"!==n.borderRightStyle)&&this._updateBorders()},this._addCornerRadius(e,{defaults:n,styleTag:i})},addShadowInputs:function(e,t){var n=(t=t||{}).styleTag;Ln(e,"boxShadowEnabled = true",["boxShadowSource"]),Ln(e,"boxShadowEnabled = true AND boxShadowSource = token",["boxShadowToken"]),Ln(e,"boxShadowEnabled = true AND boxShadowSource != token",["boxShadowOffsetX","boxShadowOffsetY","boxShadowInset","boxShadowBlurRadius","boxShadowSpreadRadius","boxShadowColor"]),jn(e,{boxShadowEnabled:{index:250,group:"Box Shadow",displayName:"Shadow Enabled",description:"Turns the drop shadow on",type:"boolean",default:!1,allowVisualStates:!0,set:function(e){this._internal.boxShadowEnabled=e,this._updateBoxShadow()}},boxShadowSource:{index:250.5,group:"Box Shadow",displayName:"Shadow Source",description:"Where the shadow comes from: Custom builds it from the six fields below; From a style token wears one of the project’s shadow tokens, so every element sharing that token changes together",type:{name:"enum",enums:[{label:"Custom",value:"custom"},{label:"From a style token",value:"token"}]},default:"custom",allowVisualStates:!0,set:function(e){this._internal.boxShadowSource=e,this._updateBoxShadow()}},boxShadowToken:{index:250.7,group:"Box Shadow",displayName:"Shadow Token",description:"The project shadow this element wears, as var(--shadow-md). Pick one from the list; compose new ones in the Styles panel",type:"string",default:"var(--shadow-md)",allowVisualStates:!0,set:function(e){this._internal.boxShadowToken=e,this._updateBoxShadow()}},boxShadowOffsetX:{index:251,group:"Box Shadow",displayName:"Offset X",description:"How far to the right the shadow is cast from the element",default:0,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,set:function(e){this._internal.boxShadowOffsetX=Dn(e)||"0px",this._updateBoxShadow()}},boxShadowOffsetY:{index:252,group:"Box Shadow",displayName:"Offset Y",description:"How far down the shadow is cast from the element",default:0,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,set:function(e){this._internal.boxShadowOffsetY=Dn(e)||"0px",this._updateBoxShadow()}},boxShadowBlurRadius:{index:253,group:"Box Shadow",displayName:"Blur Radius",description:"How soft the shadow edge is; 0 gives a hard edge",default:5,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,set:function(e){this._internal.boxShadowBlurRadius=Dn(e)||"0px",this._updateBoxShadow()}},boxShadowSpreadRadius:{index:254,group:"Box Shadow",displayName:"Spread Radius",description:"How much larger than the element the shadow is drawn",default:2,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,set:function(e){this._internal.boxShadowSpreadRadius=Dn(e)||"0px",this._updateBoxShadow()}},boxShadowInset:{index:255,group:"Box Shadow",displayName:"Inset",description:"Draws the shadow inside the element instead of behind it",type:"boolean",default:!1,allowVisualStates:!0,set:function(e){this._internal.boxShadowInset=e,this._updateBoxShadow()}},boxShadowColor:{index:256,group:"Box Shadow",displayName:"Shadow Color",description:"Colour of the shadow, including how transparent it is",type:"color",default:"#00000033",allowVisualStates:!0,set:function(e){this._internal.boxShadowColor=e,this._updateBoxShadow()}}}),e.methods._updateBoxShadow=function(){var e=this._internal;if(e.boxShadowEnabled&&"token"===e.boxShadowSource){var t="string"==typeof e.boxShadowToken?e.boxShadowToken.trim():"";t?this.setStyle({boxShadow:t},n):this.removeStyle(["boxShadow"],n)}else e.boxShadowEnabled?this.setStyle({boxShadow:"".concat(e.boxShadowInset?"inset ":"").concat(e.boxShadowOffsetX," ").concat(e.boxShadowOffsetY," ").concat(e.boxShadowBlurRadius," ").concat(e.boxShadowSpreadRadius," ").concat(e.boxShadowColor)},n):this.removeStyle(["boxShadow"],n)};var i=e.initialize;e.initialize=function(){i&&i.call(this),this._internal.boxShadowOffsetX=0,this._internal.boxShadowOffsetY=0,this._internal.boxShadowBlurRadius="5px",this._internal.boxShadowSpreadRadius="2px",this._internal.boxShadowColor="#00000033",this._internal.boxShadowSource="custom",this._internal.boxShadowToken="var(--shadow-md)"}},addBackgroundInputs:function(e,t){var n=null==t?void 0:t.styleTag;jn(e,{backgroundImage:{index:202,group:"Style",displayName:"Background Image",description:"A picture painted behind the children. Combine it with Background Gradient to lay a scrim over the picture so text on top stays readable",type:{name:"image"},allowVisualStates:!0,set:function(e){var t=this._internal||(this._internal={}),n=En(e);if(n&&n.startsWith("/")){var i=Noodl.Env&&Noodl.Env.BaseUrl;i&&!n.startsWith(i)&&(n=i+n.substring(1))}t.backgroundImageUrl=n,this._updateBackgroundLayers()}},backgroundGradient:{index:203,group:"Style",displayName:"Gradient",description:'A CSS gradient painted as the ground — normally a design token such as "var(--gradient-brand)". It is drawn ON TOP of Background Image, which is what makes it usable as a legibility scrim',type:{name:"string"},allowVisualStates:!0,set:function(e){var t=this._internal||(this._internal={}),n="string"==typeof e?e.trim():"";t.backgroundGradient=""===n?void 0:n,this._updateBackgroundLayers()}},backgroundSize:{index:204,group:"Style",displayName:"Background Size",description:"How the background picture fills the box. Cover crops it to fill; contain fits it whole",type:{name:"enum",enums:[{label:"Cover",value:"cover"},{label:"Contain",value:"contain"},{label:"Original Size",value:"auto"}]},default:"cover",allowVisualStates:!0,set:function(e){(this._internal||(this._internal={})).backgroundSize=e,this._updateBackgroundLayers()}},backgroundPosition:{index:205,group:"Style",displayName:"Background Position",description:"Which part of the picture stays in view when Cover crops it",type:{name:"enum",enums:[{label:"Center",value:"center"},{label:"Top",value:"top center"},{label:"Bottom",value:"bottom center"},{label:"Left",value:"center left"},{label:"Right",value:"center right"}]},default:"center",allowVisualStates:!0,set:function(e){(this._internal||(this._internal={})).backgroundPosition=e,this._updateBackgroundLayers()}},backdropBlur:{index:206,group:"Style",displayName:"Backdrop Blur",description:"Blurs whatever is painted BEHIND this element, so a translucent panel reads as frosted glass over the ground it sits on. Needs a see-through Background Color to show at all",type:{name:"number",units:["px"],defaultUnit:"px"},default:0,allowVisualStates:!0,set:function(e){var t=Dn(e);void 0===t||0===parseFloat(t)?this.removeStyle(["backdropFilter","WebkitBackdropFilter"],n):this.setStyle({backdropFilter:"blur(".concat(t,")"),WebkitBackdropFilter:"blur(".concat(t,")")},n)}}}),e.methods._updateBackgroundLayers=function(){var e=this._internal||(this._internal={}),t=[];e.backgroundGradient&&t.push(String(e.backgroundGradient)),e.backgroundImageUrl&&t.push('url("'.concat(e.backgroundImageUrl,'")')),0!==t.length?this.setStyle({backgroundImage:t.join(", "),backgroundSize:e.backgroundSize||"cover",backgroundPosition:e.backgroundPosition||"center",backgroundRepeat:"no-repeat"},n):this.removeStyle(["backgroundImage","backgroundSize","backgroundPosition","backgroundRepeat"],n)}},addIconInputs:function(e,t){var n={useIcon:!0,iconColor:"#000000"};(t=t||{}).defaults&&Object.assign(n,t.defaults);var i="useIcon = true";n.useIcon&&(i+=" OR useIcon NOT SET");var o=["iconSourceType","iconSize"];t.enableIconPlacement&&(o.push("iconPlacement"),o.push("iconSpacing")),Ln(e,i,o),n.useIcon?(Ln(e,"#js (params.useIcon===true || params.useIcon===undefined) && params.iconSourceType === 'image'",["iconImageSource"]),Ln(e,"#js (params.useIcon===true || params.useIcon===undefined) && params.iconSourceType === 'icon'",["iconIconSource","iconColor"])):(Ln(e,"useIcon = true AND iconSourceType = image",["iconImageSource"]),Ln(e,"useIcon = true AND iconSourceType = icon",["iconIconSource","iconColor"])),t.hideEnableIconInput||Vn(e,{useIcon:{type:"boolean",group:"Icon",displayName:"Enable Icon",description:"Shows an icon on this element",default:n.useIcon,allowVisualStates:!0,index:20}}),Vn(e,{iconSourceType:{type:{name:"enum",enums:[{label:"Image",value:"image"},{label:"Icon",value:"icon"}]},group:"Icon",displayName:"Type",description:"Whether the icon comes from an installed icon set or from an image file, which decides the source port below",default:"icon",allowVisualStates:!0,index:21},iconIconSource:{type:"icon",displayName:"Icon Source",description:"Which glyph to show, picked from an installed icon set",group:"Icon",allowVisualStates:!0,index:23}}),jn(e,{iconImageSource:{type:"image",displayName:"Image Source",description:"Image file to show instead of an icon-set glyph",group:"Icon",allowVisualStates:!0,index:22,set:function(e){this.props.iconImageSource=(0,Cn.getAbsoluteUrl)(e)}}}),t.enableIconPlacement&&Vn(e,{iconSpacing:{group:"Icon",displayName:"Spacing",description:"Gap between the icon and the text beside it",default:10,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,index:24},iconPlacement:{type:{name:"enum",enums:[{label:"Left",value:"left"},{label:"Right",value:"right"}]},group:"Icon",displayName:"Placement",description:"Which side of the label the icon sits on, with Icon Spacing as the gap between them",default:"left",allowVisualStates:!0,index:25}}),Vn(e,{iconSize:{group:"Icon",displayName:"Size",description:"Height of the icon",default:16,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,index:26},iconColor:{group:"Icon",displayName:"Color",description:"Colour of the icon",editorName:"Icon Color",default:n.iconColor,type:"color",allowVisualStates:!0,index:27}})},addLabelInputs:function(e,t){var n={useLabel:!1};(t=t||{}).defaults&&Object.assign(n,t.defaults);var i=n.useLabel?"useLabel = true OR useLabel NOT SET":"useLabel = true",o=t.styleTag||"",r=["label"].concat(["textStyle","fontFamily","fontSize","fontWeight","fontStyle","color","letterSpacing","lineHeight","textTransform","fontVariantNumeric"].map(function(e){return o+e}));t.enableSpacing&&r.push("labelSpacing"),Ln(e,i,r),Vn(e,{useLabel:{index:18,type:"boolean",displayName:"Enable Label",description:"Shows a text label on this element",group:"Label",default:n.useLabel},label:{type:"string",displayName:"Label",description:"Text shown on this element",group:"Label",default:"Label"}}),t.enableSpacing&&Vn(e,{labelSpacing:{displayName:"Spacing",description:"Gap between the label and the edges around it",group:"Label",type:{name:"number",units:["px"],defaultUnit:"px"},default:10}}),this.addTextStyleInputs(e,Pn(Pn({},t),{group:"Label Text Style",popout:{group:"label-text-style",label:"Text Style",parentGroup:"Label"}}))},addTextStyleInputs:function(e,t){var n,i,o=(t=t||{}).group||"Text Style",r=t.styleTag,s=t.hasOwnProperty("portPrefix")?t.portPrefix:t.styleTag||"",a=s+"textStyle",l=void 0!==t.portIndex?t.portIndex:19;function u(e){return t.displayName?t.displayName+" "+e:e}jn(e,((n={})[a]={index:l,type:{name:"textStyle",childPorts:["fontFamily","fontSize","fontWeight","fontStyle","color","letterSpacing","lineHeight","textTransform","fontVariantNumeric"],childPortPrefix:s},group:o,displayName:"Text Style",editorName:u("Text Style"),description:"Applies one of the project's saved text styles; the individual font ports below override whatever it sets",default:"None",set:function(e){this.props[a]=this.context.styles.getTextStyle(e),this.forceUpdate()},allowVisualStates:!0,popout:t.popout},n[s+"fontFamily"]={index:l+1,type:{name:"font",parentPort:a},group:o,displayName:"Font Family",editorName:u("Font Family"),description:"Typeface to render the text in, either a web-safe family name or a font file added to the project",set:function(e){if(e&&"string"==typeof e){var t=e;t.split(".").length>1&&(kn.instance.loadFont(t),t=(t=t.replace(/\.[^/.]+$/,"")).split("/").pop()),this.setStyle({fontFamily:t},r)}else this.removeStyle(["fontFamily"],r);this.props[a]&&this.forceUpdate()},allowVisualStates:!0,popout:t.popout},n)),Fn(e,((i={})[s+"fontSize"]={index:l+2,group:o,displayName:"Font Size",editorName:u("Font Size"),description:"Height of the text, in pixels",targetStyleProperty:"fontSize",type:{name:"number",units:["px"],defaultUnit:"px",parentPort:a},onChange:function(){this.props[a]&&this.forceUpdate()},allowVisualStates:!0,popout:t.popout,styleTag:r},i[s+"fontWeight"]={index:l+2.5,group:o,displayName:"Font Weight",editorName:u("Font Weight"),description:"How heavy the text is drawn, from 100 (thin) to 900 (black); leave as Auto to use the weight the font family sets",targetStyleProperty:"fontWeight",type:{name:"number",units:[""],defaultUnit:"",parentPort:a},default:"Auto",applyDefault:!1,allowVisualStates:!0,popout:t.popout,styleTag:r,onChange:function(){this.props[a]&&this.forceUpdate()}},i[s+"fontStyle"]={index:l+2.6,group:o,displayName:"Font Style",editorName:u("Font Style"),description:"Renders the text upright or italic",targetStyleProperty:"fontStyle",applyDefault:!1,type:{name:"enum",enums:[{label:"Normal",value:"normal"},{label:"Italic",value:"italic"}],parentPort:a},default:"normal",allowVisualStates:!0,popout:t.popout,styleTag:r,onChange:function(){this.props[a]&&this.forceUpdate()}},i[s+"color"]={index:l+3,type:{name:"color",parentPort:a},displayName:"Color",editorName:u("Color"),description:"Colour of the text itself, not of the element behind it",group:o,targetStyleProperty:"color",allowVisualStates:!0,popout:t.popout,styleTag:r,onChange:function(){this.props[a]&&this.forceUpdate()}},i[s+"letterSpacing"]={index:l+4,group:o,displayName:"Letter Spacing",editorName:u("Letter Spacing"),description:"Extra space added between characters; leave as Auto to use the spacing built into the font",targetStyleProperty:"letterSpacing",type:{name:"number",units:["px","em"],defaultUnit:"px"},allowVisualStates:!0,popout:t.popout,styleTag:r,default:"Auto",applyDefault:!1,onChange:function(){this.props[a]&&this.forceUpdate()}},i[s+"lineHeight"]={index:l+5,group:o,displayName:"Line Height",editorName:u("Line Height"),description:"Vertical space each line of text occupies; leave as Auto to follow the font",targetStyleProperty:"lineHeight",type:{name:"number",units:["","px","%"],defaultUnit:"",parentPort:a},allowVisualStates:!0,onChange:function(){this.props[a]&&this.forceUpdate()},popout:t.popout,styleTag:r,default:"Auto",applyDefault:!1},i[s+"textTransform"]={index:l+6,group:o,displayName:"Case",editorName:u("Case"),description:"Forces the text to upper case, lower case or capitalised without changing the underlying value",applyDefault:!1,targetStyleProperty:"textTransform",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Uppercase",value:"uppercase"},{label:"Lowercase",value:"lowercase"},{label:"Capitalize",value:"capitalize"}],parentPort:a},default:"none",popout:t.popout,styleTag:r,allowVisualStates:!0,onChange:function(){this.props[a]&&this.forceUpdate()}},i[s+"fontVariantNumeric"]={index:l+6.5,group:o,displayName:"Numerals",editorName:u("Numerals"),description:"Tabular draws every digit at the same width so columns of numbers align; Normal follows the font",applyDefault:!1,targetStyleProperty:"fontVariantNumeric",type:{name:"enum",enums:[{label:"Normal",value:"normal"},{label:"Tabular",value:"tabular-nums"}],parentPort:a},default:"normal",popout:t.popout,styleTag:r,allowVisualStates:!0,onChange:function(){this.props[a]&&this.forceUpdate()}},i));var c=s+"fontFamily";e.setup=function(t,n){n.on("nodeAdded."+e.name,function(e){e.parameters[c]&&e.parameters[c].split(".").length>1&&kn.instance.loadFont(e.parameters[c]),e.on("parameterUpdated",function(e){e.name===c&&e.value&&e.value.split(".").length>1&&kn.instance.loadFont(e.value)})})}}};var Yn=__webpack_require__(8454),Kn=__webpack_require__.n(Yn),Jn=__webpack_require__(2793),Qn=__webpack_require__(4038);function Zn(e,t,n,i){e._transitions&&e._transitions[t]&&(e._transitions[t].stop(),delete e._transitions[t]);var o,r=e.getInputValue(t),s=e.getInput(t);if(s&&"color"===s.type){var a=e.context.styles.resolveColor(r),l=e.context.styles.resolveColor(n);if(!(o=function(e,t){var n=[0,0,0,255],i=[0,0,0,255];if(ti(n,e)&&ti(i,t)){e&&"transparent"!==e||(n[0]=i[0],n[1]=i[1],n[2]=i[2]),t&&"transparent"!==t||(i[0]=n[0],i[1]=n[1],i[2]=n[2]);var o=[0,0,0,0];return function(e){return o[0]=Math.floor(Qn.A.linear(n[0],i[0],e)),o[1]=Math.floor(Qn.A.linear(n[1],i[1],e)),o[2]=Math.floor(Qn.A.linear(n[2],i[2],e)),o[3]=Math.floor(Qn.A.linear(n[3],i[3],e)),function(e){return"#"+ii(e[0])+ii(e[1])+ii(e[2])+ii(e[3])}(o)}}}(a,l))){for(var u=0,c=[a,l];u<c.length;u++){var d=c[u];d&&"transparent"!==d&&!(0,Jn.qS)(d)&&ni(e,t,d)}o=function(){return r}}}else"number"==typeof r&&"number"==typeof n?o=ei(r,n):"object"==typeof r&&r.hasOwnProperty("value")&&"object"==typeof n&&n.hasOwnProperty("value")&&(o=ei(r.value,n.value));if(o){e._transitions||(e._transitions={});var p=Kn()(i.curve);e._transitions[t]=e.context.timerScheduler.createTimer({duration:i.dur,onRunning:function(n){var i=o(p.get(n));void 0!==i&&e.queueInput(t,i)},onFinish:function(){delete e._transitions[t],s&&"color"===s.type&&"string"==typeof n&&""!==n&&e.queueInput(t,n)}}),e._transitions[t].start()}else e.queueInput(t,n)}function ei(e,t){return function(n){return Qn.A.linear(e,t,n)}}function ti(e,t){if("transparent"===t||!t)return e[3]=0,!0;var n=(0,Jn.qS)(t);if(!n)return!1;for(var i=0;i<4;++i)e[i]=n[i];return!0}function ni(e,t,n){if(!0===(0,Jn.Z7)(n)){var i=e._warnedUnreadableColors||(e._warnedUnreadableColors={});if(!i[n]){i[n]=!0;var o=e.raiseRuntimeError;"function"==typeof o&&o.call(e,"visual-states/unreadable-color","A visual state sets ".concat(t," to ").concat(JSON.stringify(n),", which is not a colour the browser accepts, ")+"so it is never drawn. Use #RRGGBB, rgb() or var(--token).",{input:t,color:n})}}}function ii(e){var t=e.toString(16);return 1==t.length?"0"+t:t}var oi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ri=function(){return ri=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ri.apply(this,arguments)},si=function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))};function ai(e,t,n){var i=n?e.props[n]:e.props,o=function(n){if(i[n]){var o=i[n];i[n]=function(){o(),t[n].call(e)}}else i[n]=t[n].bind(e)};for(var r in t)o(r);e.forceUpdate()}function li(e,t,n){var i,o;o="signal"===n.type?function(){e.sendSignalOnOutput(t)}:function(){for(var i,o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];e.outputPropValues[t]=n.getValue?(i=n.getValue).call.apply(i,si([e],o,!1)):o[0],e.flagOutputDirty(t),n.onChange&&n.onChange.call(e,e.outputPropValues[t])},ai(e,((i={})[t]=o,i),n.propPath)}function ui(e){return"string"==typeof e&&e.startsWith("var(")}var ci="^data-[a-z0-9][a-z0-9._-]*$",di=new RegExp(ci),pi={name:"namedports/derived",parameter:"dataAttributes",accept:{pattern:ci,rule:'a data attribute name: "data-", then a lowercase letter or digit, then lowercase letters, digits, ".", "_" or "-"',example:"data-testid"},port:{name:"{{*}}",displayName:"{{*}}",type:"string",plug:"input",group:"Data Attributes",description:"Written on this element as {{*}}"}};function hi(e){for(var t=e._dataAttributeNames||[],n=e._dataAttributeValues||{},i=ri({},e.props.dom||{}),o=0,r=Object.keys(i);o<r.length;o++){var s=r[o];s.startsWith("data-")&&delete i[s]}for(var a=0,l=t;a<l.length;a++){var u=l[a],c=n[u];i[u]=null==c?"":"object"==typeof c?JSON.stringify(c):String(c)}e.props.dom=i,e.forceUpdate(),fi(e)}function fi(e){if("undefined"!=typeof document&&e._dataAttributeNames){var t=e.getDOMElement();if(t&&"function"==typeof t.setAttribute){for(var n={},i=e.props.dom||{},o=0,r=e._dataAttributeNames;o<r.length;o++){var s=r[o];s in i&&(n[s]=String(i[s]))}for(var a=0,l=e._appliedDataAttributes||[];a<l.length;a++){var u=l[a];u in n||t.removeAttribute(u)}for(var c=0,d=Object.keys(n);c<d.length;c++){var p=d[c];t.getAttribute(p)!==n[p]&&t.setAttribute(p,n[p])}e._appliedDataAttributes=Object.keys(n)}}}var gi=["nearest","start","center","end"];function mi(e){var t=function(e,t){var n,i,o=e.getDOMElement();if(!o||"function"!=typeof o.scrollIntoView)return"this element has no rendered DOM element — it may not be mounted";for(var r=e.getVisualParentNode();r;r=r.getVisualParentNode()){var s=r.innerReactComponentRef;if(s&&s.iScroll&&(null===(i=null===(n=s.scrollRef)||void 0===n?void 0:n.current)||void 0===i?void 0:i.contains(o))){var a="center"===t||0;return s.iScroll.scrollToElement(o,300,a,a),void s.scrollRef.current.scrollIntoView({behavior:yi(),block:"nearest",inline:"nearest"})}}o.scrollIntoView({behavior:yi(),block:t,inline:t})}(e,gi.includes(e._scrollIntoViewAlign)?e._scrollIntoViewAlign:"nearest");t&&e.raiseRuntimeError("visual/scroll-into-view-failed","Scroll Into View did nothing: ".concat(t))}function yi(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function vi(e,t){for(var n=0,i=t;n<i.length;n++){var o=i[n];Array.isArray(o)?vi(e,o):void 0!==o&&e.push(o)}}var bi=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return oi(n,e),n.prototype.componentDidMount=function(){var e=this.props.noodlNode;e._pendingScrollIntoView&&e.getDOMElement()&&(e._pendingScrollIntoView=!1,mi(e)),fi(e),this.props.noodlNode.didCallTriggerDidMount||this.props.noodlNode.sendSignalOnOutput("didMount")},n.prototype.componentDidUpdate=function(){fi(this.props.noodlNode)},n.prototype.componentWillUnmount=function(){var e,t,n,i;this.props.noodlNode.didCallTriggerDidMount=!1,this.props.noodlNode.sendSignalOnOutput("willUnmount");var o=this.props.noodlNode;if(null===(e=o._leftPage)||void 0===e||e.call(o),null===(t=o._fileDropLeftPage)||void 0===t||t.call(o),null===(i=(n=o.context).setNodeUnmounted)||void 0===i||i.call(n,o),o.currentVisualStates){var r=["hover","pressed","focused"],s=o.currentVisualStates.filter(function(e){return!r.includes(e)});o.setVisualStates(s)}},n.prototype.render=function(){var e=this.props,n=e.noodlNode,i=e.style,o=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}(e,["noodlNode","style"]),r=n.style;i&&(r=ri(ri({},n.style),i));var s,a,l=ri(ri({ref:function(e){n.innerReactComponentRef=e,e&&n._flushPendingInnerActions(),(e instanceof Element||e&&"object"==typeof e&&1===e.nodeType)&&n.setDOMElement(e)},style:r},n.props),o);if(o.className&&n.props.className&&(l.className="".concat(n.props.className," ").concat(o.className)),n.noodlNodeAsProp){l.noodlNode=n;var u=n.getVisualParentNode();u&&u.props.layout&&(l.parentLayout=u.props.layout);var c=u?ln(u.props,u.style):void 0;c&&(l.parentScroll=c)}return n.renderedAtFrame=n.context.frameNumber,n.useFrame&&(void 0!==l.textStyle&&(l.style=r=Object.assign({},l.textStyle,r)),fn.size(r,l),fn.align(r,l)),s=n,a=t().createElement(n.reactComponent,l,n.renderChildren()),t().createElement(ct,{node:s,code:"node/render-failed",describe:ut},a)},n}(t().Component);function wi(e,t,n){var i=e;if(n&&i.getAttribute("noodl-style-tag")!==n&&(i=e.querySelector("[noodl-style-tag=".concat(n,"]"))),i)for(var o in t)i.style[o]=t[o]}var _i=0;function Si(e){var n=e.frame;void 0!==n&&(n.dimensions&&Xn.addDimensions(e,"object"==typeof n.dimensions?n.dimensions:void 0),n.position&&Xn.addTransformInputs(e),n.margins&&Xn.addMarginInputs(e),n.padding&&Xn.addPaddingInputs(e),n.align&&Xn.addAlignInputs(e));var o=e.initialize,r=e.inputs,s=e.inputProps,a=e.inputCss,l=e.outputs,u=e.outputProps,c=e.dynamicports,d=e.defaultCss,p=void 0===d?{}:d,f=e.methods,g=Object.assign({},p),m={};for(var y in a){var v=(V=a[y]).hasOwnProperty("default")&&!1!==V.applyDefault;if(V.styleTag&&!m.hasOwnProperty(V.styleTag)&&(m[V.styleTag]={}),v){var b=V.type,_=b.units&&!ui(V.default)?V.default+b.defaultUnit:V.default;V.styleTag?m[V.styleTag][y]=_:g[y]=_}}function S(e,t){this.clientBoundingRect=t,"x"===e?this.flagOutputDirty("screenPositionX"):"y"===e?this.flagOutputDirty("screenPositionY"):"width"===e?this.flagOutputDirty("boundingWidth"):"height"===e&&this.flagOutputDirty("boundingHeight")}var O=void 0===e.useVariants||e.useVariants,N={name:e.name,docs:e.docs,docsUrl:e.docsUrl,displayNodeName:e.displayNodeName||e.displayName,category:"Visual",deprecated:e.deprecated,replacedBy:e.replacedBy,ssr:e.ssr,allowChildren:void 0===e.allowChildren||e.allowChildren,visualStates:e.visualStates,allowAsExportRoot:e.allowAsExportRoot,singleton:e.singleton,useVariants:O,usePortAsLabel:e.usePortAsLabel,portLabelTruncationMode:e.portLabelTruncationMode,connectionPanel:e.connectionPanel,nodeDoubleClickAction:e.nodeDoubleClickAction,initialize:function(){var t;this.reactKey="key"+_i,_i++,this.children=[],C&&(this.childrenCount=0),this.props={styles:{}},e.noDataAttributes||(t=this.registerInputIfNeeded,this.registerInputIfNeeded=function(e){if(this.hasInput(e)||!di.test(e))return t?t.call(this,e):void 0;this.registerInput(e,{set:function(t){var n,i=this;i._dataAttributeValues=ri(ri({},i._dataAttributeValues||{}),((n={})[e]=t,n)),(i._dataAttributeNames||[]).includes(e)&&hi(i)}})}),this.outputPropValues={},this.style=Object.assign({},g),this._authoredStyle=new Set,this._authoredInputs=new Set;var i={start:g,authoredStyle:this._authoredStyle,authoredInputs:this._authoredInputs};for(var r in this.style[h]=i,m)this.props.styles[r]=Object.assign({},m[r]);this.childIndex=0,this.clientBoundingRect={},this.noodlNodeAsProp=!!e.noodlNodeAsProp;var a=this.context&&this.context.runningInCanvas?300:0;for(var l in this.boundingBoxObserver=new gt(S.bind(this),a),this.wantsToBeMounted=!0,this.useFrame=!!n,s){var c=s[l];c.propPath&&!this.props.hasOwnProperty(c.propPath)&&(this.props[c.propPath]={});var d=c.propPath?this.props[c.propPath]:this.props;if("signal"===c.type)d[l]=0;else if(c.hasOwnProperty("default")){var p=c.type;p.defaultUnit&&void 0!==c.default&&!ui(c.default)?d[l]=c.default+p.defaultUnit:d[l]=c.default}}for(var f in u){var y=u[f];y.propPath&&!this.props.hasOwnProperty(y.propPath)&&(this.props[y.propPath]={}),y.props?ai(this,y.props,y.propPath):li(this,f,y)}this.reactComponentRef=null,this.reactComponent=e.getReactComponent.call(this),o&&o.call(this)},getInspectInfo:e.getInspectInfo,nodeScopeDidInitialize:e.nodeScopeDidInitialize,dynamicports:e.noDataAttributes?c:si(si([],c||[],!0),[pi],!1),runOnValueChange:e.runOnValueChange,inputs:{cssClassName:{index:100010,displayName:"CSS Class",group:"Advanced HTML",type:"string",default:"",description:"Extra CSS class names to put on this element, for styling from a stylesheet you supply",set:function(e){this.props.className=e,this.forceUpdate()}},styleCss:{index:100011,displayName:"CSS Style",group:"Advanced HTML",type:{name:"string",codeeditor:"text",allowEditOnly:!0},default:"/* background-color: red; */",description:"Raw CSS declarations applied to this element, overriding the styling ports above",set:function(e){this.updateAdvancedStyle({content:e})}},dataAttributes:{index:100015,displayName:"Data Attributes",group:"Data Attributes",type:{name:"stringlist",allowEditOnly:!0},description:"data-* names (data-testid) for tests and scripts to find this element by; each gets a value input",set:function(e){this._dataAttributeNames=function(e){return null==e||""===e?[]:(Array.isArray(e)?e.map(function(e){return String(e)}):"string"==typeof e?e.split(","):[]).filter(function(e){return di.test(e)})}(e),hi(this)}},scrollIntoView:{index:100020,displayName:"Scroll Into View",group:"Scroll Into View",type:"signal",description:"Scrolls the page, or the scrolling Group holding this element, until the element can be seen",valueChangedToTrue:function(){if("undefined"!=typeof document){var e=this;e.scheduleAfterInputsHaveUpdated(function(){e.getDOMElement()?mi(e):e._pendingScrollIntoView=!0})}}},scrollIntoViewAlign:{index:100021,displayName:"Scroll Align",group:"Scroll Into View",type:{name:"enum",enums:[{label:"Nearest edge",value:"nearest"},{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"}]},default:"nearest",description:"Where Scroll Into View leaves the element: Nearest edge moves only as far as needed",set:function(e){this._scrollIntoViewAlign=e}}},outputs:{childIndex:{group:"Advanced",displayName:"Child Index",type:"number",description:"This element's position among its parent's children, counting from 0",get:function(){return this.childIndex}},this:{group:"Advanced",displayName:"This",type:"reference",description:"A reference to this node itself, for ports that take a node rather than a value",get:function(){return this}},screenPositionX:{group:"Bounding Box",displayName:"Screen Position X",type:"number",description:"Distance in pixels from the left edge of the window to this element's left edge",get:function(){return this.clientBoundingRect.x},onFirstConnectionAdded:function(){this.boundingBoxObserver.addObserver()},onLastConnectionRemoved:function(){this.boundingBoxObserver.removeObserver()}},screenPositionY:{group:"Bounding Box",displayName:"Screen Position Y",type:"number",description:"Distance in pixels from the top edge of the window to this element's top edge",get:function(){return this.clientBoundingRect.y},onFirstConnectionAdded:function(){this.boundingBoxObserver.addObserver()},onLastConnectionRemoved:function(){this.boundingBoxObserver.removeObserver()}},boundingWidth:{group:"Bounding Box",displayName:"Width",type:"number",description:"Width this element actually ended up with after layout, in pixels",get:function(){return this.clientBoundingRect.width},onFirstConnectionAdded:function(){this.boundingBoxObserver.addObserver()},onLastConnectionRemoved:function(){this.boundingBoxObserver.removeObserver()}},boundingHeight:{group:"Bounding Box",displayName:"Height",type:"number",description:"Height this element actually ended up with after layout, in pixels",get:function(){return this.clientBoundingRect.height},onFirstConnectionAdded:function(){this.boundingBoxObserver.addObserver()},onLastConnectionRemoved:function(){this.boundingBoxObserver.removeObserver()}},didMount:{group:"Mounted",displayName:"Did Mount",type:"signal",description:"Fires once this element has been added to the page and can be measured"},willUnmount:{group:"Mounted",displayName:"Will Unmount",type:"signal",description:"Fires just before this element is removed from the page, while it still exists"}},methods:{updateAdvancedStyle:function(e){var t;this.customCssStyles&&(this.removeStyle(Object.keys(this.customCssStyles)),this.customCssStyles=void 0);for(var n="",i=(e.content||"").replace("\n",""),o="";i.length;){var r=i.indexOf("/*");if(-1===r&&(r=i.length),o+=i.substring(0,r),(i=i.substring(r)).length){var s=i.indexOf("*/");-1===s&&(s=i.length),i=i.substring(s+2)}}function a(e){return e.replace(/^\s+|\s+$/gm,"")}var l=o.split(";").map(a).filter(function(e){return e.length});t={};for(var u=0,c=l;u<c.length;u++){var d=c[u],p=d.split(":").map(a);if(-1!==d.indexOf("\n"))n+="Missing semicolon: "+d.split("\n")[0];else if(2!==p.length)n+="Syntax error: "+d;else{for(var h=p[0].split("-"),f=1;f<h.length;f++)h[f]=h[f][0].toUpperCase()+h[f].substring(1);t[h.join("")]=p[1]}}n?this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"css-parse-waring",{message:"Error in CSS Style<br>"+n}):(this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"css-parse-waring"),t&&this.setStyle(t),this.customCssStyles=t)},setChildIndex:function(e){this.childIndex=e,this.flagOutputDirty("childIndex")},updateChildIndices:function(){for(var e=0,t=0;t<this.children.length;t++){var n=this.children[t];"For Each"!==n.name&&"Component Children"!==n.name||e--,n.setChildIndex&&n.setChildIndex(t+e)}},updateChildrenCount:function(){var e=0;this.children.forEach(function(t){var n;"For Each"===(null===(n=null==t?void 0:t.model)||void 0===n?void 0:n.type)?e+=t.model.children.length:e++}),this.childrenCount=e,this.flagOutputDirty("childrenCount")},addChild:function(e,t){void 0===t&&(t=this.children.length),e.parent=this,this.children.splice(t,0,e),this.cachedChildren=void 0,this.scheduleUpdateChildCountAndIndicies(),this.forceUpdate()},removeChild:function(e){var t=this.children.indexOf(e);-1!==t&&(this.children.splice(t,1),e.parent=void 0,this.cachedChildren=void 0,this.scheduleUpdateChildCountAndIndicies(),this.forceUpdate())},contains:function(e){return-1!==this.children.indexOf(e)||this.children.some(function(t){return t.contains&&t.contains(e)})},scheduleUpdateChildCountAndIndicies:function(){var e=this;this.childrenChangedSinceCount=!0,this.updateChildIndiciesScheduled||(this.updateChildIndiciesScheduled=!0,this.scheduleAfterInputsHaveUpdated(function(){e.childrenChangedSinceCount&&e.updateChildCountAndIndiciesNow(),e.updateChildIndiciesScheduled=!1}))},updateChildCountAndIndiciesNow:function(){this.childrenChangedSinceCount=!1,this.updateChildIndices(),C&&this.updateChildrenCount()},getChildren:function(){return this.children},isChild:function(e){return-1!==this.children.indexOf(e)},getChildRoot:function(){return this},setLayout:function(e){this.props.layout!==e&&(this.props.layout=e,this.cachedChildren=void 0,this.forceUpdate())},forceUpdate:function(){var e=this;!0!==this.forceUpdateScheduled&&(this.forceUpdateScheduled=!0,this.context.eventEmitter.once("frameEnd",function(){e.forceUpdateScheduled=!1,e.renderedAtFrame!==e.context.frameNumber&&e.reactComponentRef&&e.reactComponentRef.setState({})}),this.context.scheduleUpdate())},_rerenderReactNode:function(){this.forceUpdate()},_resetReactVirtualDOM:function(e){e&&(this._inputsResetToDefault||(this._inputsResetToDefault=new Set),this._inputsResetToDefault.add(e)),this.reactKey="key"+_i,_i++;var t=this.getVisualParentNode();t&&(t.cachedChildren=void 0,t.forceUpdate())},triggerDidMount:function(){this.wantsToBeMounted&&!this.didCallTriggerDidMount&&(this.didCallTriggerDidMount=!0,this.hasOutput("didMount")&&this.sendSignalOnOutput("didMount"),this.props.didMount&&this.props.didMount(),this.didMount&&this.didMount()),this.children.forEach(function(e){e.triggerDidMount&&e.triggerDidMount()})},render:function(){var e=this;if(this.wantsToBeMounted)return t().createElement(bi,{key:this.reactKey,noodlNode:this,ref:function(t){e.reactComponentRef=t,t?(fi(e),e._pendingScrollIntoView&&e.getDOMElement()&&(e._pendingScrollIntoView=!1,mi(e)),e._domElement||requestAnimationFrame(function(){e._domElement||e.boundingBoxObserver.setTarget(e.getDOMElement())})):e._domElement||e.boundingBoxObserver.setTarget(null)}})},renderChildren:function(){var e=ln(this.props,this.style);if(e!==this._childrenScrollKey&&(this._childrenScrollKey=e,this.cachedChildren=void 0),!this.cachedChildren){var t=[];vi(t,this.children.map(function(e){return e.render()})),0===t.length?t=null:1===t.length&&(t=t[0]),this.cachedChildren=t}return this.cachedChildren},setStyle:function(e,t){var n=t?this.props.styles[t]:this.style,i=!t&&this._settingDefault;for(var o in e)n[o]=e[o],!t&&this._authoredStyle&&(i?this._authoredStyle.delete(o):this._authoredStyle.add(o));var r=this.getDOMElement();if(r)if(i)this.forceUpdate();else{var s=!1;if(t)s=!0;else{if(e.hasOwnProperty("opacity")&&(s=e.hasOwnProperty("opacity")&&("0"===r.style.opacity&&e.opacity>0||"0"!==r.style.opacity&&0===e.opacity)),e.transform){var a=e.transform,l=this.getVisualParentNode();"absolute"!==this.style.position&&l&&l.style.flexDirection||("center"!==this.props.alignX||r.style.marginLeft&&r.style.marginRight||(a="translateX(-50%) "+a),"center"!==this.props.alignY||r.style.marginTop&&r.style.marginBottom||(a="translateY(-50%) "+a)),e.transform=a}var u=e.hasOwnProperty("marginLeft")||e.hasOwnProperty("marginRight")||e.hasOwnProperty("marginTop")||e.hasOwnProperty("marginBottom");(this.props.width&&"%"===this.props.width[this.props.width.length-1]||this.props.height&&"%"===this.props.height[this.props.height.length-1])&&u&&(s=!0),(e.position||e.flexDirection||e.clip)&&(s=!0),e.hasOwnProperty("pointerEvents")&&(s=!0)}s?this.forceUpdate():wi(r,e,t)}},removeStyle:function(e,t){for(var n=t?this.props.styles[t]:this.style,i=0,o=e;i<o.length;i++)delete n[f=o[i]];var r=this.getDOMElement(),s=!1;if(!t&&r)for(var a={marginTop:!0,marginBottom:!0,marginLeft:!0,marginRight:!0},l=0,u=e;l<u.length;l++)a[f=u[l]]&&(s=!0);var c=!t&&e.includes("pointerEvents");if(c&&r&&(s=!0),r){for(var d={},p=0,h=e;p<h.length;p++){var f=h[p];c&&"pointerEvents"===f||(d[f]="")}wi(r,d,t)}s&&this.forceUpdate()},getStyle:function(e){return this.style[e]},getRef:function(){return this.reactComponentRef},setDOMElement:function(e){var t;this._domElement=e||void 0,this.boundingBoxObserver&&this.boundingBoxObserver.setTarget(e||null),e&&this._pendingScrollIntoView&&(this._pendingScrollIntoView=!1,mi(this)),e&&fi(this),e&&(t=e,mt.has(this)&&bt(t))},withInnerComponent:function(e,t){if(this.innerReactComponentRef)e(this.innerReactComponentRef);else{if(this._pendingInnerActions||(this._pendingInnerActions=[]),this._pendingInnerActions.length>=16){var n=this._pendingInnerActions.shift();n&&n._onDropped&&n._onDropped()}t&&(e._onDropped=t),this._pendingInnerActions.push(e)}},outcomeOnInnerComponent:function(e,t){var n=this,i=this.beginOutcome(),o=t&&t.code||"visual/action-failed";this.withInnerComponent(function(t){var r=e(t);"string"==typeof r?n.reportOutcome(i,"failure",{code:o,message:r}):n.reportOutcome(i,"done")},function(){n.reportOutcome(i,"failure",{code:"visual/action-dropped",message:"This action waited for the element to exist and was discarded after 16 more arrived behind it, so it never ran — the element has not mounted"})})},_flushPendingInnerActions:function(){var e=this._pendingInnerActions;if(e&&0!==e.length){this._pendingInnerActions=[];for(var t=0,n=e;t<n.length;t++)(0,n[t])(this.innerReactComponentRef)}},getDOMElement:function(){if(this._domElement)return this._domElement;var e="undefined"!=typeof Element,t=this.innerReactComponentRef;if(t&&e&&t instanceof Element)return t;var n=this.getRef();if(!n)return null;if(e&&n instanceof Element)return n;var o=i().findDOMNode;if("function"==typeof o)try{return o(n)}catch(e){return null}return null},getVisualParentNode:function(){if(this.parent)return this.parent;for(var e=this.nodeScope.componentOwner;!e.parent&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;return e?e.parent:void 0},setVariant:function(e){var t=this;this._stopStateTransitions(),this.variant=e;var n={};e&&Nn(n,e.parameters),Nn(n,this.model.parameters),this.currentVisualStates&&Nn(n,this.getParametersForStates(this.currentVisualStates));for(var i=0,o=Object.keys(n).filter(function(e){return!t._hasInputBeenSetFromAConnection(e)});i<o.length;i++){var r=o[i];this.registerInputIfNeeded(r),this.hasInput(r)&&this.queueInput(r,n[r])}},getParameter:function(e){return this.model.parameters.hasOwnProperty(e)?this.model.parameters[e]:this.variant&&this.variant.parameters.hasOwnProperty(e)?this.variant.parameters[e]:this.context.getDefaultValueForInput(this.model.type,e)},getParametersForStates:function(e){var t={};if(this.variant)for(var n=0,i=e;n<i.length;n++){var o=i[n];this.variant.stateParameters&&this.variant.stateParameters.hasOwnProperty(o)&&Nn(t,this.variant.stateParameters[o])}for(var r in t)this.model.parameters.hasOwnProperty(r)&&(Oi(t[r])?Nn(t[r],this.model.parameters[r]):t[r]=this.model.parameters[r]);if(this.model.stateParameters)for(var s=0,a=e;s<a.length;s++)o=a[s],this.model.stateParameters.hasOwnProperty(o)&&Nn(t,this.model.stateParameters[o]);return t},_getNewState:function(e,t){var n=t.filter(function(t){return!(e||[]).includes(t)}),i=n.length?n[0]:"neutral";return""===i?"neutral":i},_getDefaultTransition:function(e){return this.model.defaultStateTransitions&&this.model.defaultStateTransitions[e]&&this.model.defaultStateTransitions[e].curve?this.model.defaultStateTransitions[e]:this.variant&&this.variant.defaultStateTransitions&&this.variant.defaultStateTransitions[e]&&this.variant.defaultStateTransitions[e].curve?this.variant.defaultStateTransitions[e]:void 0},_getStateTransition:function(e){var t={};return this.model.stateTransitions&&this.model.stateTransitions[e]&&Object.assign(t,this.model.stateTransitions[e]),this.variant&&this.variant.stateTransitions&&this.variant.stateTransitions[e]&&Object.assign(t,this.variant.stateTransitions[e]),t},setVisualStates:function(e){var t=this;if(this.model&&(!this.currentVisualStates||e.length!==this.currentVisualStates.length||!e.every(function(e,n){return e===t.currentVisualStates[n]}))){var n=this.currentVisualStates?this.getParametersForStates(this.currentVisualStates):{},i=this.getParametersForStates(e),o=this._getNewState(this.currentVisualStates,e);this.currentVisualStates=e;var r={};for(var s in n)i.hasOwnProperty(s)||this._hasInputBeenSetFromAConnection(s)||void 0!==this.getParameter(s)&&(r[s]=this.getParameter(s));for(var s in i)this._hasInputBeenSetFromAConnection(s)||void 0===i[s]||(r[s]=i[s]);var a=this._getDefaultTransition(o),l=this._getStateTransition(o);for(var s in r)l[s]&&l[s].curve?Zn(this,s,r[s],l[s]):!l[s]&&a?Zn(this,s,r[s],a):(this._transitions&&this._transitions[s]&&(this._transitions[s].stop(),delete this._transitions[s]),this.queueInput(s,r[s]))}},_getVisualStates:function(){return this.currentVisualStates||[]},_stopStateTransitions:function(){if(this._transitions)for(var e in this._transitions)this._transitions[e].stop(),delete this._transitions[e]}}};e.noDataAttributes&&delete N.inputs.dataAttributes,O&&(N.inputs.variant={displayName:"Variant",group:"General",description:"Name of a saved variant of this node type to apply, replacing the styling set here",type:{name:"string",allowConnectionsOnly:!0},set:function(e){if(!this.variant||this.variant.name!==e){var t=this.context.variants.getVariant(this.model.type,e);t&&this.setVariant(t)}}}),!1!==e.mountedInput&&(N.inputs.mounted={displayName:"Mounted",index:9999,type:"boolean",group:"General",description:"Removes the element from the page entirely when false, unlike Visible which leaves its space behind. Wired, it counts as true until the first value arrives, so set it to false here to start hidden (a lock, a private screen)",default:!0,set:function(e){if(e=!!e,this.wantsToBeMounted!==e){this.wantsToBeMounted=e;var t=this.getVisualParentNode();t&&(t.cachedChildren=void 0,t.forceUpdate())}}});var C=N.allowChildren||N.displayName;for(var x in C&&(N.outputs.childrenCount={group:"Advanced",displayName:"Children Count",type:"number",description:"How many child elements are currently mounted inside this one",get:function(){return this.childrenCount}}),r)N.inputs[x]=r[x];var k=function(e){var t=s[e];"node"===t.type?(t.type="reference",t.set=function(n){var i=t.propPath?this.props[t.propPath]:this.props;void 0!==n?i[e]=n.render():delete i[e],this.forceUpdate()}):"signal"===t.type?function(e,t){var n=e.valueChangedToTrue;delete e.set,e.valueChangedToTrue=function(){var i=this,o=e.propPath?i.props[e.propPath]:i.props;o[t]=("number"==typeof o[t]?o[t]:0)+1,n&&n.call(this),i.forceUpdate()}}(t,e):function(e,t){if(!e.type)throw new Error("input ".concat(t," is missing a type"));"icon"===function(e){if(!e)return null;var t="string"==typeof e?e:e.name;return"string"==typeof t?t.toLowerCase():null}(e.type)?e.set=function(n){var i=e.propPath?this.props[e.propPath]:this.props,o=function(e,t){return void 0===t&&(t="This icon input"),null==e||"object"==typeof e&&!Array.isArray(e)&&ft.some(function(t){return t in e})?null:"".concat(t," expects an icon, received ").concat((0,ht.bp)(e),". ")+'Nothing will be drawn — pick the glyph with the icon picker, or wire an object of the shape {class, code} (for example {"class":"material-icons","code":"search"}); the class comes from the installed icon set, so a bare name cannot be turned into one.'}(n,e.displayName||t);this.setDiagnostic("visual/icon-source-not-an-icon/"+t,o),void 0===n||o?delete i[t]:i[t]=n,e.onChange&&e.onChange.call(this,n),this.forceUpdate()}:e.type.units?e.set=function(n){var i=e.propPath?this.props[e.propPath]:this.props;ui(n)?i[t]=n:n&&void 0!==n.value&&function(e){if(!e.unit)return!0;var t=e.value;return"number"==typeof t?Number.isFinite(t):"string"==typeof t&&""!==t.trim()&&Number.isFinite(Number(t))}(n)?i[t]=n.value+n.unit:null==n||function(e){if("number"==typeof e)return Number.isNaN(e);if(!e||"object"!=typeof e||!("value"in e))return!1;var t=e.value;return null===t||"number"==typeof t&&Number.isNaN(t)}(n)?delete i[t]:this.raiseRuntimeError("dimensions/not-a-dimension",'"'.concat(e.displayName||t,'" was sent ').concat(JSON.stringify(n),", which is not a size. A size is a ")+"number (read in the unit the port is using, or its default unit when it holds none), or a {value, unit} object. The previous value is kept."),e.onChange&&e.onChange.call(this,n),this.forceUpdate()}:e.set=function(n){var i=e.propPath?this.props[e.propPath]:this.props;void 0!==n?i[t]=n:delete i[t],e.onChange&&e.onChange.call(this,n),this.forceUpdate()}}(t,e),N.inputs[e]=t};for(var E in s)k(E);var I=function(e){var t=a[e],n=t.targetStyleProperty||e,i=t.type;i.units?t.set=function(e){var o,r,s;return ui(e)?(this.setStyle(((o={})[n]=e,o),t.styleTag),void(t.onChange&&t.onChange.call(this,e))):null==e?(this.removeStyle([n],t.styleTag),void(t.onChange&&t.onChange.call(this,e))):("object"!=typeof e&&i.defaultUnit&&(e={value:e,unit:i.defaultUnit}),"object"==typeof e&&void 0!==e.value?this.setStyle(((r={})[n]=e.value+e.unit,r),t.styleTag):void 0!==e?this.setStyle(((s={})[n]=e,s),t.styleTag):this.removeStyle([n],t.styleTag),void(t.onChange&&t.onChange.call(this,e)))}:t.set=function(e){var i;void 0!==e?this.setStyle(((i={})[n]=e,i),t.styleTag):this.removeStyle([n],t.styleTag),t.onChange&&t.onChange.call(this,e)},N.inputs[e]=t};for(var P in a)I(P);for(var R in l)N.outputs[R]=l[R];var A=function(e){var t=u[e];"signal"!==t.type&&(t.get=function(){return this.outputPropValues[e]}),N.outputs[e]=t};for(var D in u)A(D);for(var F in f)N.methods[F]=f[F];var M={};for(var j in a){var V;(V=a[j]).styleTag||(M[j]=w(V.targetStyleProperty||j))}for(var L=0,U=["width","height"];L<U.length;L++){var B=U[L];s&&s[B]&&(M[B]=B)}N.methods.explainStyleSources||(N.methods.explainStyleSources=function(){var e=this.getDOMElement();if(!e)return[];var t={};for(var n in this.customCssStyles||{})t[w(n)]=String(this.customCssStyles[n]);return function(e){for(var t=e.element,n=e.styleTargets,i=e.defaults,o=e.customCss,r=function(e){var t=[],n=e.ownerDocument;if(!n)return t;var i=0,o=function(n,r){for(var s=0;s<n.length;s++){var a=n[s];if(void 0!==a.selectorText&&a.style){for(var l=null,u=0,c=yn(a.selectorText);u<c.length;u++){var d=c[u],p=!1;try{p=e.matches(d)}catch(e){p=!1}if(p){var h=vn(d);(!l||mn(h,l)>0)&&(l=h)}}if(i++,!l)continue;for(var f=0;f<a.style.length;f++){var g=a.style[f];t.push({property:g,value:a.style.getPropertyValue(g).trim(),important:"important"===a.style.getPropertyPriority(g),specificity:l,order:i,selector:a.selectorText,source:r})}}else if(a.cssRules){var m=a.media?a.media.mediaText:a.conditionText;if(a.media&&m&&!wn(m))continue;o(a.cssRules,r)}}},r=new Map;n.querySelectorAll('style, link[rel~="stylesheet"]').forEach(function(e){var t=e.sheet;t&&r.set(t,e)});for(var s=n.styleSheets,a=0;a<s.length;a++){var l=s[a],u=bn(l,r);if(u){var c=void 0;try{c=l.cssRules}catch(e){continue}o(c,u)}}return t}(t),s=t.style,a=[],l=0,u=Object.keys(n);l<u.length;l++){for(var c=u[l],d=n[c],p=s?s.getPropertyValue(d).trim():"",h=!!s&&"important"===s.getPropertyPriority(d),f=o&&void 0!==o[d],g=void 0,m=0,y=r;m<y.length;m++){var v=y[m];v.property===d&&(!g||v.important&&!g.important||v.important===g.important&&mn(v.specificity,g.specificity)>0||v.important===g.important&&0===mn(v.specificity,g.specificity)&&v.order>g.order)&&(g=v)}if(g){var b=null,w=void 0;if(p?(w=p,g.important&&!h&&(b="author")):i&&void 0!==i[d]?(w=i[d],(g.important||mn(g.specificity,_n)>=0)&&(b="default")):b="nothing",b&&!Sn(g.value,w)){a.push({port:c,property:d,value:g.value,selector:g.selector,important:g.important,source:g.source,beats:b,nodeValue:w});continue}}f&&p&&Sn(p,o[d])&&a.push({port:c,property:d,value:p,selector:"",important:h,source:{kind:"css-style"},beats:"author"})}return a}({element:e,styleTargets:M,defaults:T(e),customCss:t})});var W=function(e){var t=N.inputs[e],n=t&&t.set;if("function"!=typeof n||n.__isl008Authored)return"continue";var i=function(t){if(this._inputsResetToDefault&&this._inputsResetToDefault.has(e)){this._inputsResetToDefault.delete(e),this._authoredInputs&&this._authoredInputs.delete(e),this._settingDefault=!0;try{return n.call(this,t)}finally{this._settingDefault=!1}}return this._authoredInputs&&this._authoredInputs.add(e),n.call(this,t)};i.__isl008Authored=!0,t.set=i};for(var z in N.inputs)W(z);return{node:N,setup:e.setup}}function Oi(e){return e&&"object"==typeof e&&!Array.isArray(e)}var Ni=__webpack_require__(5162),Ci=["onClick","onMouseDown","onMouseMove","onMouseUp","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel","onPointerDown","onPointerMove","onPointerUp","onPointerCancel"],xi=["onDragEnter","onDragOver","onDragLeave","onDrop"],Ti=new Set(["onMouseLeave","onMouseOut"]);function ki(e){for(var t=this,n={},i=function(t){e.blockTouch&&!Ti.has(t)?e.pointer&&e.pointer[t]?n[t]=function(n){e.pointer[t](n),n.stopPropagation()}:e[t]?n[t]=function(n){e[t](n),n.stopPropagation()}:n[t]=function(e){e.stopPropagation()}:e[t]?n[t]=e[t]:e.pointer&&(n[t]=e.pointer[t])},o=0,r=Ci;o<r.length;o++)i(l=r[o]);for(var s=0,a=xi;s<a.length;s++){var l=a[s];e.pointer&&e.pointer[l]?n[l]=e.pointer[l]:e[l]&&(n[l]=e[l])}if(!e.blockTouch){var u=e.clickBubbling||"auto",c=n.onClick;(c||"never"===u)&&(n.onClick=function(t){c&&c(t),function(e){var t=e.clickBubbling||"auto";if("always"===t)return!1;if("never"===t)return!0;var n=e.noodlNode;return!(!n||"function"!=typeof n.hasOutput)&&!!n.hasOutput("onClick")&&n.getOutput("onClick").hasConnections()}(e)&&t.stopPropagation()})}if(e.noodlNode){var d=function(i){var o=n[i];o&&(n[i]=function(n){o.call(t,n),e.noodlNode.context.updateDirtyNodes()})};for(var p in n)d(p)}return n}var Ei={};function Ii(e,t,n){for(var i in e[t]||(e[t]={}),n)e[t][i]=n[i]}function Pi(e,t){Ii(e,"inputs",t)}function Ri(e,t){Ii(e,"outputs",t)}var Ai="button, input, select, textarea";const Di=function(e,t,n){if("undefined"!=typeof document)if(Ei[e])(function(e,t){var n;for(n in e)if(e.hasOwnProperty(n)&&e[n]!==t[n])return!1;for(n in t)if(t.hasOwnProperty(n)&&e[n]!==t[n])return!1;return!0})(t,Ei[e].props)||(Ei[e].style.innerHTML=n(e,t),Ei[e].props=Object.assign({},t));else{var i=document.createElement("style");i.innerHTML=n(e,t),document.head.appendChild(i),Ei[e]={style:i,props:Object.assign({},t)}}},Fi=function(e,t){t=t||{},e.visualStates=[{name:"neutral",label:"Neutral"},{name:"hover",label:"Hover"},{name:"pressed",label:"Pressed"},{name:"focused",label:"Focused"},{name:"disabled",label:"Disabled"}],t.checked&&e.visualStates.splice(3,0,{name:"checked",label:"Checked"}),Pi(e,{enabled:{type:"boolean",displayName:"Enabled",group:"General",description:"Lets the user interact with this control; when off it still renders and occupies its space but ignores clicks, touches and typing",default:!0,set:function(e){var t=(e=!!e)!==this._internal.enabled;this.props.enabled=this._internal.enabled=e,t&&(this._updateVisualState(),this.forceUpdate(),this.flagOutputDirty("enabled"))}}}),function(e){Ii(e,"inputProps",{blockTouch:{index:450,displayName:"Block Pointer Events",description:"Stops every pointer event that lands on this control from reaching the nodes it sits inside. Blunt: it takes hover and pointer-down with it, so reach for Click Bubbling first if it is only clicks you want to keep in",type:"boolean",group:"Pointer Events"},clickBubbling:{index:451,displayName:"Click Bubbling",description:"Whether a click on this control also fires Click on the nodes it sits inside. Automatic keeps it here as soon as this control's own Click is connected, so a Favourite button inside a clickable card runs Favourite and not the card; Always is the older behaviour where both run; Never keeps every click here, wired or not",type:{name:"enum",enums:[{label:"Automatic",value:"auto"},{label:"Always",value:"always"},{label:"Never",value:"never"}]},default:"auto",group:"Pointer Events"}})}(e),e.methods._updateVisualState=function(){var e=[];this._internal.enabled&&(this.outputPropValues.hoverState&&e.push("hover"),this.outputPropValues.pressedState&&e.push("pressed"),this.outputPropValues.focusState&&e.push("focused")),t.checked&&this._internal.checked&&e.push("checked"),this._internal.enabled||e.push("disabled"),this.setVisualStates(e)},e.methods._leftPage=function(){var e=this.outputPropValues;e.focusState&&(e.focusState=!1,this.flagOutputDirty("focusState"),this.sendSignalOnOutput("onBlur")),e.hoverState&&(e.hoverState=!1,this.flagOutputDirty("hoverState"),this.sendSignalOnOutput("hoverEnd")),e.pressedState&&(e.pressedState=!1,this.flagOutputDirty("pressedState"))},function(e){Ii(e,"outputProps",{focusState:{displayName:"Focused",group:"States",description:"True while this control holds keyboard focus, so typing and Enter go to it",type:"boolean",props:{onFocus:function(){this.outputPropValues.focusState=!0,this.flagOutputDirty("focusState"),this._updateVisualState()},onBlur:function(){this.outputPropValues.focusState=!1,this.flagOutputDirty("focusState"),this._updateVisualState()}}},onFocus:{displayName:"Focused",group:"Focus Events",description:"Fires the moment this control takes keyboard focus, whether from a click, a tab or a Focus action",type:"signal",props:{onFocus:function(){this.sendSignalOnOutput("onFocus")}}},onBlur:{displayName:"Blurred",group:"Focus Events",description:"Fires when keyboard focus leaves this control, or the control leaves the page while holding it, which is the usual place to validate what was entered",type:"signal",props:{onBlur:function(){this.sendSignalOnOutput("onBlur")}}},hoverState:{displayName:"Hover",group:"States",description:"True while the pointer is over this control; stays false on touch devices with no pointer",type:"boolean",props:{onMouseOver:function(){this.outputPropValues.hoverState=!0,this.flagOutputDirty("hoverState"),this._updateVisualState()},onMouseLeave:function(){this.outputPropValues.hoverState=!1,this.flagOutputDirty("hoverState"),this._updateVisualState()}}},hoverStart:{displayName:"Hover Start",group:"Pointer Events",description:"Fires when the pointer moves onto this control",type:"signal",props:{onMouseOver:function(){this.sendSignalOnOutput("hoverStart")}}},hoverEnd:{displayName:"Hover End",group:"Pointer Events",description:"Fires when the pointer leaves this control, including when it leaves while a button is still held, or when the control leaves the page under it",type:"signal",props:{onMouseLeave:function(){this.sendSignalOnOutput("hoverEnd")}}},pressedState:{displayName:"Pressed",group:"States",description:"True while a mouse button or finger is held down on this control, and false again the moment it is released or slides off",type:"boolean",props:{onMouseDown:function(){this.outputPropValues.pressedState=!0,this.flagOutputDirty("pressedState"),this._updateVisualState()},onTouchStart:function(){this._internal.enabled&&(this.outputPropValues.pressedState=!0,this.flagOutputDirty("pressedState"),this._updateVisualState())},onMouseUp:function(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this._updateVisualState()},onTouchEnd:function(){this._internal.enabled&&(this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this._updateVisualState())},onTouchCancel:function(){this._internal.enabled&&(this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this._updateVisualState())},onMouseLeave:function(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this._updateVisualState()}}},pointerDown:{displayName:"Pointer Down",group:"Pointer Events",description:"Fires as a mouse button or finger goes down on this control, before any click has completed",type:"signal",props:{onMouseDown:function(){this.sendSignalOnOutput("pointerDown")},onTouchStart:function(){this._internal.enabled&&this.sendSignalOnOutput("pointerDown")}}},pointerUp:{displayName:"Pointer Up",group:"Pointer Events",description:"Fires when the mouse button or finger is lifted, and also when a touch is cancelled by the system",type:"signal",props:{onMouseUp:function(){this.sendSignalOnOutput("pointerUp")},onTouchEnd:function(){this._internal.enabled&&this.sendSignalOnOutput("pointerUp")},onTouchCancel:function(){this._internal.enabled&&this.sendSignalOnOutput("pointerUp")}}}})}(e),Ri(e,{enabled:{type:"boolean",displayName:"Enabled",group:"States",description:"Reports back whether this control is currently accepting interaction, following the Enabled input",getter:function(){return this._internal.enabled}}});var n=e.initialize;e.initialize=function(){n&&n.call(this),this.props.enabled=this._internal.enabled=!0,this.outputPropValues.hoverState=this.outputPropValues.focusState=this.outputPropValues.pressedState=!1}},Mi=function(e,t){var n=t.noun;Pi(e,{focus:{type:"signal",group:"Actions",displayName:"Focus",description:"Puts the keyboard on this ".concat(n,", so Enter, Space and the arrow keys go to it"),valueChangedToTrue:function(){var e=this.beginOutcome(),t=!1!==this.context.setNodeFocused(this,!0);this.setDiagnostic("focus/not-mounted",t?null:"Focus arrived while this ".concat(n," was not on the page, so nothing was focused. A Focus is not kept ")+"for later: send it once the ".concat(n," has mounted, for example from its Did Mount or its row’s")),this.reportOutcome(e,t?"done":"unchanged")}},blur:{type:"signal",group:"Actions",displayName:"Blur",description:"Takes the keyboard away from this ".concat(n,", which is what fires Blurred"),valueChangedToTrue:function(){var e=this.beginOutcome();this.context.setNodeFocused(this,!1),this.reportOutcome(e,"done")}}}),e.outputs&&e.outputs.done||Ri(e,(0,Ni.outcomeOutputs)({done:t.done||"Fires when Focus put the keyboard on this ".concat(n,", or Blur took it away"),unchanged:t.unchanged||"Fires when Focus arrived while this ".concat(n," was not on the page, so nothing was focused")})),Ii(e,"methods",{_focusTarget:function(){var e=this.getDOMElement();return e&&e.isConnected?e.matches(Ai)?e:e.querySelector(Ai):null},_focus:function(){var e=this._focusTarget();e&&e.focus()},_blur:function(){var e=this._focusTarget();e&&e.blur()},_canFocus:function(){return!!this._focusTarget()},_hasFocus:function(){var e=this._focusTarget();return!!e&&e.ownerDocument.activeElement===e}})},ji=function(e){return Object.assign({},{onFocus:e.onFocus,onBlur:e.onBlur},ki(e))};var Vi=new WeakMap;function Li(e){if(e&&"function"==typeof e.setDOMElement){var t=Vi.get(e);return t||(t=function(t){return e.setDOMElement(t)},Vi.set(e,t)),t}}function Ui(e){if(e){for(var t,n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];o.startsWith("data-")&&((t||(t={}))[o]=String(e[o]))}return t}}function Bi(e){var t={};if(e)for(var n=0,i=Object.keys(e);n<i.length;n++)t[i[n]]="";return t}function Wi(e){return"string"!=typeof e?"":e.replace(/<script\b[\s\S]*?(?:<\/script\s*>|$)/gi,"").replace(/<foreignObject\b[\s\S]*?(?:<\/foreignObject\s*>|$)/gi,"").replace(/<style\b[\s\S]*?(?:<\/style\s*>|$)/gi,"").replace(/<(animateTransform|animateMotion|animate|discard|set)\b[\s\S]*?(?:\/>|<\/\1\s*>|$)/gi,"").replace(/\son[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/\s(?:xlink:)?href\s*=\s*(?:"(?!#)[^"]*"|'(?!#)[^']*'|(?!["'#])[^\s>]+)/gi,"").replace(/url\(\s*(?:"(?!#)[^")]*"|'(?!#)[^')]*'|(?!["'#])[^)]*)\s*\)/gi,"none")}function zi(e){var t=/(<svg\b[^>]*?)\s(?:width|height)\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi;return e.replace(t,"$1").replace(t,"$1")}function qi(e){var n=e.source,i=e.style,o=e.className;if(null==n)return null;var r,s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(o?function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}([o],e,!0):e).join(" ")};return"sprite"===n.kind?t().createElement("span",{className:s("ndl-icon-glyph","ndl-icon-glyph--sprite"),style:i},t().createElement("svg",{style:Hi,focusable:"false","aria-hidden":"true"},t().createElement("use",{href:n.url+"#"+n.symbolId}))):"inline"===n.kind?t().createElement("span",{className:s("ndl-icon-glyph","ndl-icon-glyph--inline"),style:i,dangerouslySetInnerHTML:{__html:(r=n.svg,zi(Wi(r)))}}):!0===n.codeAsClass?t().createElement("span",{className:s(n.class,n.code),style:i}):t().createElement("span",{className:s(n.class),style:i},n.code)}var Hi={width:"1em",height:"1em",fill:"currentColor",display:"block"},Gi=function(){return Gi=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Gi.apply(this,arguments)};function $i(e){var n=Gi({},e.style);function i(){var n={};return e.useLabel&&("left"===e.iconPlacement||void 0===e.iconPlacement?n.marginRight=e.iconSpacing:n.marginLeft=e.iconSpacing),"image"===e.iconSourceType&&void 0!==e.iconImageSource?(n.width=e.iconSize,n.height=e.iconSize,t().createElement("img",{alt:"",src:e.iconImageSource,style:n})):"icon"===e.iconSourceType&&void 0!==e.iconIconSource?(n.fontSize=e.iconSize,n.color=e.iconColor,t().createElement(qi,{source:e.iconIconSource,style:n})):null}fn.size(n,e),fn.align(n,e),void 0!==e.textStyle&&((n=Object.assign({},e.textStyle,n)).color=e.noodlNode.context.styles.resolveColor(n.color));var o="ndl-controls-button";e.className&&(o=o+" "+e.className);var r=null;e.useLabel&&e.useIcon?r=t().createElement(t().Fragment,null,"left"===e.iconPlacement?i():null,String(e.label),"right"===e.iconPlacement?i():null):e.useLabel?r=String(e.label):e.useIcon&&(r=i());var s=ji(e);if(e.keepsFocus){var a=s.onMouseDown;s.onMouseDown=function(e){e.preventDefault(),a&&a(e)}}var l=y(n);return t().createElement("button",Gi({ref:Li(e.noodlNode)},Ui(e.dom),{className:v(o,l),disabled:!e.enabled},s,{type:e.buttonType,style:n}),r,e.children)}var Xi={name:"net.noodl.controls.button",displayName:"Button",docs:"https://docs.noodl.net/nodes/ui-controls/button",allowChildren:!0,noodlNodeAsProp:!0,usePortAsLabel:"label",portLabelTruncationMode:"length",nodeDoubleClickAction:{focusPort:"label"},connectionPanel:{groupPriority:["General","Style","Actions","Events","States","Mounted","Label","Label Text Style","Hover Events","Pointer Events","Focus Events"]},initialize:function(){this.props.layout="row"},getReactComponent:function(){return $i},inputCss:{backgroundColor:{index:100,displayName:"Background Color",description:"Fill colour behind the label and icon",group:"Style",type:"color",default:"#000000",allowVisualStates:!0}},inputProps:{keepsFocus:{type:"boolean",displayName:"Keeps Focus",group:"General",description:"Leaves the keyboard where it was when this button is clicked, instead of taking it — what a key on an on-screen keypad needs, so the cursor stays in the field being typed into",default:!1}},outputProps:{onClick:{displayName:"Click",group:"Events",description:"Fires when the button is clicked or tapped, and on Enter or Space while it has keyboard focus",type:"signal"}}};Xn.addDimensions(Xi,{defaultSizeMode:"contentSize",contentLabel:"Content"}),Xn.addTextStyleInputs(Xi),Xn.addAlignInputs(Xi),Xn.addTransformInputs(Xi),Xn.addPaddingInputs(Xi),Xn.addMarginInputs(Xi),Xn.addLabelInputs(Xi,{defaults:{useLabel:!0}}),Xn.addIconInputs(Xi,{enableIconPlacement:!0,defaults:{useIcon:!1,iconColor:void 0}}),Xn.addSharedVisualInputs(Xi),Xn.addBorderInputs(Xi),Xn.addShadowInputs(Xi),Fi(Xi),Mi(Xi,{noun:"button"});const Yi=Si(Xi);function Ki(e){return null!==e&&"object"==typeof e?String(e):e}var Ji=function(){return Ji=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ji.apply(this,arguments)};function Qi(n){var i=(0,e.useState)(n.checked),o=i[0],r=i[1];(0,e.useEffect)(function(){r(!!n.checked)},[]),(0,e.useEffect)(function(){r(!!n.checked)},[n.checked,n.checkedWrites]);var s=Ji({},n.style);"none"===n.parentLayout&&(s.position="absolute"),fn.align(s,n);var a={id:n.id,className:[n.className,"ndl-controls-checkbox-2"].join(" "),disabled:!n.enabled,style:{width:n.styles.checkbox.width,height:n.styles.checkbox.height}},l=Ji({display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,position:"relative"},n.styles.checkbox);n.useLabel||(Object.assign(a,ji(n)),Object.assign(l,s));var u=t().createElement("div",Ji({ref:n.useLabel?void 0:Li(n.noodlNode)},n.useLabel?void 0:Ui(n.dom),{className:"ndl-controls-pointer",style:n.useLabel?Ji(Ji({},Bi(s)),l):l,"noodl-style-tag":"checkbox"}),n.useIcon?function(){if(!o)return null;if("image"===n.iconSourceType&&void 0!==n.iconImageSource)return t().createElement("img",{alt:"",src:n.iconImageSource,style:{width:n.iconSize,height:n.iconSize,position:"absolute"}});if("icon"===n.iconSourceType&&void 0!==n.iconIconSource){var e={fontSize:n.iconSize,color:n.iconColor,position:"absolute"};return t().createElement(qi,{source:n.iconIconSource,style:e})}return null}()||function(){var e,i;return o?"image"===n.iconSourceType&&void 0!==n.iconImageSource||"icon"===n.iconSourceType&&void 0!==n.iconIconSource?null:t().createElement("svg",{"aria-hidden":"true","data-ndl-default-check":"true",viewBox:"0 0 16 16",style:{width:n.iconSize,height:n.iconSize,position:"absolute",pointerEvents:"none",color:(null===(e=n.styles.checkbox)||void 0===e?void 0:e.borderTopColor)||(null===(i=n.styles.checkbox)||void 0===i?void 0:i.borderColor)||"currentColor"}},t().createElement("path",{d:"M3.5 8.5l3 3 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})):null}():null,t().createElement("input",Ji({type:"checkbox"},a,{checked:o,onChange:function(e){r(e.target.checked),n.checkedChanged&&n.checkedChanged(e.target.checked)}})));if(n.useLabel){var c=Ji(Ji({marginLeft:n.labelSpacing},n.labeltextStyle),n.styles.label);return n.enabled||(c.cursor="default"),c.color=n.noodlNode.context.styles.resolveColor(c.color),t().createElement("div",Ji({ref:Li(n.noodlNode)},Ui(n.dom),{style:Ji({display:"flex",alignItems:"center"},s)},ji(n)),u,t().createElement("label",{className:"ndl-controls-pointer",style:c,htmlFor:n.id,"noodl-style-tag":"label"},Ki(n.label)))}return t().createElement("div",{style:Ji(Ji({},Bi(s)),{display:"contents"})},u,null)}var Zi=__webpack_require__(1173),eo=function(){return eo=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},eo.apply(this,arguments)},to={name:"net.noodl.controls.checkbox",displayName:"Checkbox",docs:"https://docs.noodl.net/nodes/ui-controls/checkbox",allowChildren:!1,noodlNodeAsProp:!0,nodeDoubleClickAction:{focusPort:"label"},usePortAsLabel:"label",portLabelTruncationMode:"length",connectionPanel:{groupPriority:["General","Style","Actions","Events","States","Mounted","Label","Label Text Style","Hover Events","Pointer Events","Focus Events"]},initialize:function(){var e=this;this.props.sizeMode="explicit",this.props.id="input-"+(0,Zi.A)(),this.props.checked=this._internal.checked=!1,this.props.checkedWrites=0,this.props.checkedChanged=function(t){var n=e._internal.checked!==t;e.props.checked=e._internal.checked=t,e.props.checkedWrites++,n&&(e.flagOutputDirty("checked"),e.sendSignalOnOutput("onChange"),e._updateVisualState())}},getReactComponent:function(){return Qi},inputs:{checked:{type:"boolean",displayName:"Checked",group:"General",description:"Sets whether the box is ticked; setting it from the graph does not fire Changed",default:!1,index:100,set:function(e){var t=(e=!!e)!==this._internal.checked;this.props.checked=this._internal.checked=e,this.props.checkedWrites++,t&&(this.forceUpdate(),this.flagOutputDirty("checked"),this._updateVisualState())}},check:{type:"signal",displayName:"Check",description:"Ticks the box if it is not already ticked, then fires Done — or Unchanged if it already was. Does not fire Changed",group:"Actions",valueChangedToTrue:function(){this.setCheckedByAction(!0)}},uncheck:{type:"signal",displayName:"Uncheck",description:"Unticks the box if it is ticked, then fires Done — or Unchanged if it already was. Does not fire Changed",group:"Actions",valueChangedToTrue:function(){this.setCheckedByAction(!1)}}},inputCss:{backgroundColor:{index:201,displayName:"Background Color",description:"Fill colour of the box itself, behind the tick",group:"Style",type:"color",default:"transparent",applyDefault:!1,allowVisualStates:!0,styleTag:"checkbox"},width:{index:11,group:"Dimensions",displayName:"Width",description:"Width of the box; the label sits beside it and is sized separately",type:{name:"number",units:["px","vw","vh"],defaultUnit:"px"},default:32,allowVisualStates:!0,styleTag:"checkbox"},height:{index:12,group:"Dimensions",displayName:"Height",description:"Height of the box",type:{name:"number",units:["px","vw","vh"],defaultUnit:"px"},default:32,allowVisualStates:!0,styleTag:"checkbox"}},outputs:eo({checked:{type:"boolean",displayName:"Checked",group:"States",description:"Whether the box is currently ticked",getter:function(){return this._internal.checked}},onChange:{displayName:"Changed",group:"Events",description:"Fires when the user ticks or unticks the box; the Checked input and the Check/Uncheck actions do not fire it",type:"signal"}},(0,Ni.outcomeOutputs)({done:"Fires when Check or Uncheck actually flipped the box, when Focus put the keyboard on it, or when Blur took it away",unchanged:"Fires when the box was already in that state, so nothing was flipped and Changed did not fire, or when a Focus arrived while the box was not on the page"})),methods:{setCheckedByAction:function(e){var t=this.beginOutcome();this._internal.checked!==e?(this.props.checked=this._internal.checked=e,this.props.checkedWrites++,this.forceUpdate(),this.flagOutputDirty("checked"),this._updateVisualState(),this.reportOutcome(t,"done")):this.reportOutcome(t,"unchanged")}}};Xn.addAlignInputs(to),Xn.addTransformInputs(to),Xn.addMarginInputs(to),Xn.addPaddingInputs(to),Xn.addIconInputs(to),Xn.addLabelInputs(to,{enableSpacing:!0,styleTag:"label"}),Xn.addSharedVisualInputs(to),Xn.addBorderInputs(to,{defaults:{borderStyle:"solid",borderWidth:2,borderColor:"#000000",borderRadius:3},styleTag:"checkbox"}),Xn.addShadowInputs(to,{styleTag:"checkbox"}),Fi(to,{checked:!0}),Mi(to,{noun:"checkbox"});const no=Si(to);var io=function(){return io=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},io.apply(this,arguments)};function oo(n){var i=(0,e.useState)(n.value),o=i[0],r=i[1];(0,e.useEffect)(function(){r(n.value),n.valueChanged(n.value)},[n.value,n.items,n.valueWrites]);var s=io({},n.style);fn.size(s,n),fn.align(s,n),void 0!==n.textStyle&&((s=Object.assign({},n.textStyle,s)).color=n.noodlNode.context.styles.resolveColor(s.color));var a=n.items&&void 0!==o?n.items.findIndex(function(e){return e.Value===o}):-1,l=s.height,u=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}(s,["height"]);function c(){if("image"===n.iconSourceType&&void 0!==n.iconImageSource)return t().createElement("img",{alt:"",src:n.iconImageSource,style:{width:n.iconSize,height:n.iconSize}});if("icon"===n.iconSourceType&&void 0!==n.iconIconSource){var e={fontSize:n.iconSize,color:n.iconColor};return"left"===n.iconPlacement||void 0===n.iconPlacement?e.marginRight=n.iconSpacing:e.marginLeft=n.iconSpacing,t().createElement(qi,{source:n.iconIconSource,style:e})}return null}var d={id:n.id,className:n.className,style:{inset:0,opacity:0,position:"absolute",textTransform:"inherit",cursor:n.enabled?"":"default","-webkit-appearance":"none"},onClick:n.onClick},p=io(io({display:"flex",alignItems:"center"},n.styles.inputWrapper),{cursor:n.enabled?"":"default"}),h=l&&"%"===l[String(l).length-1];n.useLabel?h?p.flexGrow=1:p.height=l:(Object.assign(p,u),p.height=l);var f=[];n.items&&(f=n.items.map(function(e){return t().createElement("option",{key:e.Value,value:e.Value,disabled:"true"===e.Disabled||!0===e.Disabled||void 0},e.Label)}));var g=!1===n.showChevron?null:t().createElement("span",{style:{display:"flex",alignItems:"center",flexShrink:0,marginLeft:"8px",pointerEvents:"none"}},t().createElement("svg",{width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",focusable:"false","aria-hidden":"true"},t().createElement("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))),m=null;a>=0&&a<n.items.length?m=t().createElement("span",null,n.items[a].Label):n.placeholder&&(m=t().createElement("span",{style:{opacity:n.placeholderOpacity}},Ki(n.placeholder)));var y=t().createElement("div",io({ref:n.useLabel?void 0:Li(n.noodlNode)},n.useLabel?void 0:Ui(n.dom),{className:"ndl-controls-pointer",style:n.useLabel?io(io({},Bi(s)),p):p,"noodl-style-tag":"inputWrapper"}),n.useIcon&&"left"===n.iconPlacement?c():null,t().createElement("div",{style:{width:"100%",height:"100%",alignItems:"center",display:"flex"}},m),n.useIcon&&"right"===n.iconPlacement?c():null,g,t().createElement("select",io({},d,{disabled:!n.enabled,value:f.find(function(e){return e.props.value===o})?o:void 0},ji(n),{onChange:function(e){r(e.target.value),n.valueChanged&&n.valueChanged(e.target.value)}}),t().createElement("option",{value:"",disabled:!0,selected:!0,hidden:!0}),f));if(n.useLabel){var v=io(io({},u),{display:"flex",flexDirection:"column"});return h&&(v.height=l),t().createElement("div",io({ref:Li(n.noodlNode)},Ui(n.dom),{style:v}),t().createElement("label",{htmlFor:n.id,style:io(io(io({},n.labeltextStyle),n.styles.label),{marginBottom:n.labelSpacing}),"noodl-style-tag":"label"},Ki(n.label)),y)}return t().createElement("div",{style:io(io({},Bi(s)),{display:"contents"})},null,y)}var ro=function(){return ro=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ro.apply(this,arguments)},so=[{Label:"Option 1",Value:"Option 1"},{Label:"Option 2",Value:"Option 2"}],ao={name:"net.noodl.controls.options",displayName:"Dropdown",docs:"https://docs.noodl.net/nodes/ui-controls/dropdown",allowChildren:!1,noodlNodeAsProp:!0,usePortAsLabel:"label",nodeDoubleClickAction:{focusPort:"label"},connectionPanel:{groupPriority:["General","Style","Actions","Events","States","Mounted","Text Style","Label","Label Text Style","Hover Events","Pointer Events","Focus Events"]},initialize:function(){var e=this;this._itemsChanged=function(){e.props.items=lo(e._internal.items),e.forceUpdate()},this._unbindItems=function(){var t=e._internal.items;t&&"function"==typeof t.off&&t.off("change",e._itemsChanged)},this.addDeleteListener(function(){e._unbindItems()}),this.props.id="input-"+(0,Zi.A)(),this.props.items=so.map(function(e){return ro({},e)}),this.props.value=this._internal.value=so[0].Value,this.props.valueWrites=0,this.props.valueChanged=function(t){var n=e._internal.value!==t;e.props.value=e._internal.value=t,e.props.valueWrites++,n&&(e.flagOutputDirty("value"),e.sendSignalOnOutput("onChange"))}},getReactComponent:function(){return oo},inputs:{items:{type:"optionslist",displayName:"Items",description:"Options to offer. Type a label per option — the value it sends is the label — or switch the editor to Advanced and give an option its own Value when it must send something different",group:"General",default:so,set:function(e){void 0!==e&&(this._internal.items!==e&&(this._unbindItems(),this._internal.items=e,e&&"function"==typeof e.on&&e.on("change",this._itemsChanged)),this.props.items=lo(this._internal.items),this.forceUpdate())}},value:{type:"string",displayName:"Value",group:"General",description:"Selects the option with this Value; a value matching no option deselects everything. Setting it from the graph does not fire Changed",default:so[0].Value,set:function(e){if(void 0!==e&&"string"!=typeof e){if(void 0===(null==e?void 0:e.toString))return;e=e.toString()}var t=e!==this._internal.value;this.props.value=this._internal.value=e,this.props.valueWrites++,t&&(this.forceUpdate(),this.flagOutputDirty("value"))}}},inputProps:{showChevron:{displayName:"Show Chevron",description:"Draws the small downward arrow at the end of the control that marks it as a dropdown",type:"boolean",default:!0,group:"Style",allowVisualStates:!0},placeholder:{displayName:"Placeholder",description:"Text shown while nothing is selected",type:"string",group:"Placeholder"},placeholderOpacity:{group:"Placeholder",displayName:"Placeholder opacity",description:"How faded the placeholder text is, from 0 to 1",type:"number",default:.5}},outputs:{value:{type:"string",displayName:"Value",group:"States",description:"Value of the option currently selected",getter:function(){return this._internal.value}},onChange:{type:"signal",displayName:"Changed",group:"Events",description:"Fires when the user picks a different option; a value arriving on the Value input does not fire it"}},inputCss:{backgroundColor:{index:100,displayName:"Background Color",description:"Fill colour of the closed dropdown; the open list is drawn by the browser and cannot be styled here",group:"Style",type:"color",default:"transparent",styleTag:"inputWrapper",allowVisualStates:!0}}};function lo(e){return e?"string"==typeof e?uo(e):Array.isArray(e)?e.some(function(e){return null==e||"object"!=typeof e})?e.filter(function(e){return null!=e}).map(function(e){return"object"==typeof e?e:{Label:String(e),Value:String(e)}}):e:[]:e}function uo(e){var t=e;if("string"==typeof t){if(""===t.trim())return[];try{t=JSON.parse(t)}catch(e){return[]}}if(!Array.isArray(t))return[];for(var n=[],i=0,o=t;i<o.length;i++){var r=o[i];if(null!=r)if("object"==typeof r){var s=r,a=void 0!==s.Label?s.Label:s.label,l=void 0!==s.Value?s.Value:s.value;if(void 0===a&&void 0===l)continue;var u=String(void 0!==a?a:l);n.push({Label:u,Value:void 0!==l?String(l):u})}else u=String(r),n.push({Label:u,Value:u})}return n}function co(e,t,n){var i=void 0===t.items?so:uo(t.items);if(0!==i.length){var o=i.map(function(e){return{label:e.Label,value:e.Value}}),r=t.value;"string"!=typeof r||""===r||o.some(function(e){return e.value===r})||o.push({label:"".concat(r," (not in Items)"),value:r}),n.sendDynamicPorts(e,[{name:"value",type:{name:"enum",enums:o},plug:"input",group:"General",displayName:"Value",default:i[0].Value,description:ao.inputs.value.description}])}else n.sendDynamicPorts(e,[])}Xn.addDimensions(ao,{defaultSizeMode:"contentSize",contentLabel:"Content"}),Xn.addAlignInputs(ao),Xn.addTextStyleInputs(ao),Xn.addTransformInputs(ao),Xn.addPaddingInputs(ao,{styleTag:"inputWrapper",defaults:{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6}}),Xn.addMarginInputs(ao),Xn.addIconInputs(ao,{enableIconPlacement:!0,defaults:{useIcon:!1,iconColor:"#000000"}}),Xn.addLabelInputs(ao,{enableSpacing:!0,styleTag:"label"}),Xn.addSharedVisualInputs(ao),Xn.addBorderInputs(ao,{defaults:{borderStyle:"solid",borderWidth:2,borderColor:"#000000",borderRadius:5},styleTag:"inputWrapper"}),Xn.addShadowInputs(ao,{styleTag:"inputWrapper"}),Fi(ao),Mi(ao,{noun:"dropdown"});var po=Si(ao);po.setup=function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded."+ao.name,function(t){co(t.id,t.parameters,e.editorConnection),t.on("parameterUpdated",function(n){"items"!==n.name&&"value"!==n.name||co(t.id,t.parameters,e.editorConnection)})})};const ho=po,fo=t().createContext(null);var go=function(){return go=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},go.apply(this,arguments)};function mo(e){return e&&"%"===e[e.length-1]}function yo(n){var i,o,r=(0,e.useContext)(fo),s=go({},n.style);"none"===n.parentLayout&&(s.position="absolute"),fn.align(s,n);var a=!!r&&r.selected===n.value,l=null!==r;(0,e.useEffect)(function(){l||n.groupMissing&&n.groupMissing()},[l,n.groupMissing]);var u=r?r.click:null,c=(0,e.useRef)(u?u.seq:0);(0,e.useEffect)(function(){var e=!1;u&&u.seq!==c.current&&(c.current=u.seq,e=a?u.by===n.id:u.from===n.value),n.checkedChanged&&n.checkedChanged(a,e)},[a,n.checkedChanged]);var d={id:n.id,disabled:!n.enabled,className:[n.className,"ndl-controls-radio-2"].join(" "),style:{width:n.styles.radio.width,height:n.styles.radio.height}},p=go({display:"flex",alignItems:"center",justifyContent:"center",position:"relative",flexShrink:0},n.styles.radio);n.useLabel?mo(n.styles.radio.width)&&(delete p.width,p.flexGrow=1):(Object.assign(d,ji(n)),Object.assign(p,s));var h=(null===(i=n.styles.radio)||void 0===i?void 0:i.borderTopColor)||(null===(o=n.styles.radio)||void 0===o?void 0:o.borderColor),f=a?n.styles.fill.backgroundColor||h:void 0,g={left:n.fillSpacing,right:n.fillSpacing,top:n.fillSpacing,bottom:n.fillSpacing,backgroundColor:f,borderRadius:"inherit",position:"absolute"},m=t().createElement("div",go({ref:n.useLabel?void 0:Li(n.noodlNode)},n.useLabel?void 0:Ui(n.dom),{className:"ndl-controls-pointer",style:n.useLabel?go(go({},Bi(s)),p):p,"noodl-style-tag":"radio"}),t().createElement("div",{style:g,"noodl-style-tag":"fill"}),n.useIcon?function(){if(!a)return null;if("image"===n.iconSourceType&&void 0!==n.iconImageSource)return t().createElement("img",{alt:"",src:n.iconImageSource,style:{width:n.iconSize,height:n.iconSize}});if("icon"===n.iconSourceType&&void 0!==n.iconIconSource){var e={fontSize:n.iconSize,color:n.iconColor};return t().createElement(qi,{source:n.iconIconSource,style:e,className:"ndl-controls-abs-center"})}return null}():null,t().createElement("input",go({type:"radio",name:r?r.name:void 0},d,{checked:a,onChange:function(e){r&&r.checkedChanged&&r.checkedChanged(n.value,n.id)}})));if(n.useLabel){var y=go(go(go({marginLeft:n.labelSpacing},n.labeltextStyle),n.styles.label),{cursor:n.enabled?void 0:"default"});y.color=n.noodlNode.context.styles.resolveColor(y.color);var v=go({display:"flex",alignItems:"center"},s);return mo(n.styles.radio.width)&&(v.width=n.styles.radio.width),mo(n.styles.radio.height)&&(v.height=n.styles.radio.height),t().createElement("div",go({ref:Li(n.noodlNode)},Ui(n.dom),{style:v},ji(n)),m,t().createElement("label",{className:"ndl-controls-pointer",style:y,htmlFor:n.id,"noodl-style-tag":"label"},Ki(n.label)))}return t().createElement("div",{style:go(go({},Bi(s)),{display:"contents"})},m,null)}var vo={name:"net.noodl.controls.radiobutton",displayName:"Radio Button",docs:"https://docs.noodl.net/nodes/ui-controls/radio-button",allowChildren:!1,noodlNodeAsProp:!0,usePortAsLabel:"label",nodeDoubleClickAction:{focusPort:"label"},connectionPanel:{groupPriority:["General","Style","Fill Style","Actions","Events","States","Mounted","Label","Label Text Style","Hover Events","Pointer Events","Focus Events"]},initialize:function(){var e=this;this.props.sizeMode="explicit",this.props.id="input-"+(0,Zi.A)(),this._internal.checked=!1,this.props.checkedChanged=function(t,n){var i=e._internal.checked!==t;e._internal.checked=t,i&&(e.flagOutputDirty("checked"),e._updateVisualState(),n&&e.sendSignalOnOutput("onChange"))},this.props.groupMissing=function(){e.raiseRuntimeError("radio-button/no-group","This Radio Button is not inside a Radio Button Group, so it cannot be selected and clicking it does nothing — put it inside one")},this.props.styles.fill={}},getReactComponent:function(){return yo},inputs:{fillColor:{index:19,displayName:"Fill Color",description:"Colour of the dot shown inside this button while it is selected",group:"Fill Style",type:"color",allowVisualStates:!0,styleTag:"fill",set:function(e){this.setStyle({backgroundColor:e},"fill")}}},inputProps:{value:{type:"string",displayName:"Value",description:"What this button contributes to its Radio Button Group when selected; the group reports it as its own Value",group:"General",index:100},fillSpacing:{displayName:"Fill Spacing",description:"Gap between the dot and the button edge, so a larger value makes a smaller dot",group:"Fill Style",type:{name:"number",units:["px","vw","vh"],defaultUnit:"px"},allowVisualStates:!0,default:2}},inputCss:{width:{index:11,group:"Dimensions",displayName:"Width",description:"Width of the button; the label sits beside it and is sized separately",type:{name:"number",units:["px","%","vw","vh"],defaultUnit:"px"},default:32,allowVisualStates:!0,styleTag:"radio",onChange:function(){this.forceUpdate()}},height:{index:12,group:"Dimensions",displayName:"Height",description:"Height of the button",type:{name:"number",units:["px","%"],defaultUnit:"px"},default:32,allowVisualStates:!0,styleTag:"radio",onChange:function(){this.forceUpdate()}},backgroundColor:{index:201,displayName:"Background Color",description:"Fill colour of the button itself, behind the dot",group:"Style",type:"color",allowVisualStates:!0,styleTag:"radio",default:"transparent",applyDefault:!1}},outputs:{checked:{type:"boolean",displayName:"Checked",group:"States",description:"Whether this button is the one selected in its Radio Button Group",get:function(){return this._internal.checked}},onChange:{displayName:"Changed",group:"Events",description:"Fires when the user selects or deselects this button; a value arriving on the Radio Button Group's Value input does not fire it",type:"signal"}}};Xn.addAlignInputs(vo),Xn.addTransformInputs(vo),Xn.addMarginInputs(vo),Xn.addPaddingInputs(vo),Xn.addIconInputs(vo),Xn.addLabelInputs(vo,{enableSpacing:!0,styleTag:"label"}),Xn.addSharedVisualInputs(vo),Xn.addBorderInputs(vo,{defaults:{borderStyle:"solid",borderWidth:2,borderRadius:16},styleTag:"radio"}),Xn.addShadowInputs(vo,{styleTag:"radio"}),Fi(vo,{checked:!0}),Mi(vo,{noun:"radio button"});const bo=Si(vo);var wo=function(){return wo=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},wo.apply(this,arguments)};function _o(n){var i=(0,e.useState)({value:n.value,click:null}),o=i[0],r=i[1],s=(0,e.useRef)(0),a={selected:o.value,click:o.click,name:n.name,checkedChanged:function(e,t){var i=++s.current;r(function(n){return{value:e,click:{seq:i,by:t,from:n.value}}}),n.valueChanged&&n.valueChanged(e)}};(0,e.useEffect)(function(){r({value:n.value,click:null})},[n.value,n.valueWrites]);var l=wo({},n.style);fn.size(l,n),fn.align(l,n);var u="ndl-controls-radiobuttongroup";n.className&&(u=u+" "+n.className);var c=y(l);return t().createElement(fo.Provider,{value:a},t().createElement("div",wo({ref:Li(n.noodlNode)},Ui(n.dom),{className:v(u,c),style:l}),n.children))}var So=["row","row-reverse","column","column-reverse","inherit","initial","revert","unset"],Oo={name:"Radio Button Group",displayName:"Radio Button Group",docs:"https://docs.noodl.net/nodes/ui-controls/radio-button-group",allowChildren:!0,noodlNodeAsProp:!0,useVariants:!1,connectionPanel:{groupPriority:["General","Style","Actions","Events","Mounted","States"]},initialize:function(){var e=this;this.props.name="radio-"+(0,Zi.A)(),this.props.valueWrites=0,this.props.valueChanged=function(t){var n=e._internal.value!==t;e._internal.value=t,e.props.value=t,e.props.valueWrites++,n&&(e.forceUpdate(),e.flagOutputDirty("value"),e.sendSignalOnOutput("onChange"))}},getReactComponent:function(){return _o},defaultCss:{display:"flex",position:"relative",flexDirection:"column"},inputs:{flexDirection:{index:11,displayName:"Layout",description:"Stacks the radio buttons inside this group vertically or lays them out in a row",group:"Layout",type:{name:"enum",enums:[{label:"Vertical",value:"column"},{label:"Horizontal",value:"row"}]},default:"column",set:function(e){this.setLayout(e),"none"!==e?this.setStyle({flexDirection:e}):this.removeStyle(["flexDirection"]),this.context.editorConnection&&("none"===e||So.includes(e)?this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"layout-warning"):this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"layout-warning",{message:"Invalid Layout value has to be a valid flex-direction value."})),this.forceUpdate()}},value:{index:20,type:"string",displayName:"Value",group:"General",description:"Selects the radio button whose own Value matches this; setting it from the graph does not fire Changed",set:function(e){if("string"!=typeof e&&void 0!==(null==e?void 0:e.toString)&&(e=e.toString()),"string"==typeof e){var t=e!==this._internal.value;this.props.value=this._internal.value=e,this.props.valueWrites++,t&&(this.forceUpdate(),this.flagOutputDirty("value"))}}}},outputs:{value:{type:"string",displayName:"Value",group:"States",description:"Value of the radio button currently selected, or nothing if none is",getter:function(){return this._internal.value}},onChange:{type:"signal",displayName:"Changed",group:"Events",description:"Fires when the user picks a different radio button; a value arriving on the Value input does not fire it"}},inputProps:{},outputProps:{}};Xn.addDimensions(Oo,{defaultSizeMode:"contentSize",contentLabel:"Content"}),Xn.addAlignInputs(Oo),Xn.addTransformInputs(Oo),Xn.addMarginInputs(Oo),Xn.addPaddingInputs(Oo),Xn.addSharedVisualInputs(Oo);const No=Si(Oo);var Co=function(){return Co=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Co.apply(this,arguments)};function xo(e,t){return".".concat(e,"::-webkit-slider-thumb {\n width: ").concat(t.thumbWidth,";\n}")}function To(e,t,n){function i(e,i){var o="".concat(t,"Border").concat(i,"Width"),r="".concat(t,"Border").concat(i,"Color"),s="".concat(t,"Border").concat(i,"Style"),a=n[o]||n["".concat(t,"BorderWidth")];void 0!==a&&(e["border".concat(i,"Width")]=a);var l=e[r]=n[r]||n["".concat(t,"BorderColor")];void 0!==l&&(e["border".concat(i,"Color")]=l);var u=n[s]||n["".concat(t,"BorderStyle")];void 0!==u&&(e["border".concat(i,"Style")]=u)}i(e,"Top"),i(e,"Right"),i(e,"Bottom"),i(e,"Left")}function ko(e,t,n){var i=n["".concat(t,"BorderRadius")],o=n["".concat(t,"BorderTopLeftRadius")]||i,r=n["".concat(t,"BorderTopRightRadius")]||i,s=n["".concat(t,"BorderBottomRightRadius")]||i,a=n["".concat(t,"BorderBottomLeftRadius")]||i;e.borderRadius="".concat(o," ").concat(r," ").concat(s," ").concat(a)}function Eo(e,t,n){if(n["".concat(t,"BoxShadowEnabled")]){var i=n["".concat(t,"BoxShadowInset")],o=n["".concat(t,"BoxShadowOffsetX")],r=n["".concat(t,"BoxShadowOffsetY")],s=n["".concat(t,"BoxShadowBlurRadius")],a=n["".concat(t,"BoxShadowSpreadRadius")],l=n["".concat(t,"BoxShadowColor")];e.boxShadow="".concat(i?"inset ":"").concat(o," ").concat(r," ").concat(s," ").concat(a," ").concat(l)}}function Io(e){return e&&"x"===e[e.length-1]}function Po(n){var i=(0,e.useState)(n.handle),o=i[0],r=i[1];(0,e.useEffect)(function(){r(n.drawHandle())},[n.valueWrites]);var s=Co({},n.style);fn.size(s,n),fn.align(s,n);var a="ndl-controls-range-"+n._nodeId;Di(a,n,xo);var l="ndl-controls-range2 ".concat(a," ").concat(n.className?n.className:""," "),u={id:n.id,style:{width:"100%",opacity:0},min:n.min,max:n.max};if(n.step&&(u.step=n.step),Io(n.thumbHeight))if(Io(n.trackHeight)){var c=Number(n.thumbHeight.slice(0,-2)),d=Number(n.trackHeight.slice(0,-2));u.style.height=Math.max(c,d)+"px"}else u.style.height=n.thumbHeight;else u.style.height=n.trackHeight;var p=Co({display:"flex",alignItems:"center"},s),h=(o-n.min)/(n.max-n.min),f={position:"absolute",width:"100%",height:n.trackHeight,background:"linear-gradient(to right, ".concat(n.trackActiveColor," 0%, ").concat(n.trackActiveColor," ").concat(100*h,"%, ").concat(n.trackColor," ").concat(100*h,"%, ").concat(n.trackColor," 100%)")};To(f,"track",n),ko(f,"track",n),Eo(f,"track",n);var g={position:"absolute",left:"calc((100% - "+n.thumbWidth+") * "+h+")",width:n.thumbWidth,height:n.thumbHeight,backgroundColor:n.thumbColor};return To(g,"thumb",n),ko(g,"thumb",n),Eo(g,"thumb",n),t().createElement("div",Co({ref:Li(n.noodlNode)},Ui(n.dom),{style:p}),t().createElement("div",{style:f}),t().createElement("div",{style:g}),t().createElement("input",Co({className:l},ji(n),{type:"range"},u,{value:o,disabled:!n.enabled,onChange:function(e){return function(e){r(e),n.updateOutputValue(e)}(Number(e.target.value))}})))}var Ro={group:"thumb-styles",label:"Thumb Styles"},Ao={group:"track-styles",label:"Track Styles"},Do={name:"net.noodl.controls.range",displayNodeName:"Slider",docs:"https://docs.noodl.net/nodes/ui-controls/slider",allowChildren:!1,noodlNodeAsProp:!0,connectionPanel:{groupPriority:["General","Style","Actions","Events","States","Mounted","Hover Events","Pointer Events","Focus Events"]},initialize:function(){var e=this;this.props.sizeMode="contentHeight",this.props.id="input-"+(0,Zi.A)(),this.props.value=this.props.min,this._internal.outputValue=0,this.props.handle=0,this.props.valueWrites=0,this._internal.wordPending=!0,this.props._nodeId=this.id,this.props.updateOutputValue=function(t){return e._reportValue(t,!0)},this.props.drawHandle=function(){var t=e._internal.wordPending?e.props.value:e.props.handle;e._internal.wordPending=!1;var n=Number(function(e,t){var n,i,o=Fo(e.min),r=null!=o?o:0,s=null!==(n=Fo(e.max))&&void 0!==n?n:100,a="number"==typeof t?Number.isFinite(t)?String(t):"":t,l="string"==typeof a&&/^-?(?:\d+|\d*\.\d+)(?:[eE][-+]?\d+)?$/.test(a)?parseFloat(a):void 0,u=void 0!==l&&Number.isFinite(l)?l:void 0,c=void 0===u?s<r?r:(r+s)/2:u,d=void 0===u?c:c<r?r:c>s?s:c;if(s<r)return String(r);var p=e.step?Fo(e.step):void 0,h=void 0!==p&&p>0?p:1,f=null!==(i=null!=o?o:Fo(e.handle))&&void 0!==i?i:0,g=f+Math.round((d-f)/h)*h,m=g>s?g-h:g<r?g+h:g;return String(m<r||m>s?d:m)}(e.props,t));return e._reportValue(n,!1),n},this._reportValue(this.props.value,!1)},getReactComponent:function(){return Po},inputs:{value:{type:"number",displayName:"Value",group:"General",description:"Moves the handle to this value, clamped to Min and Max and rounded to the Step; changing it from the graph does not fire Changed. An empty value leaves the handle where it is",index:100,set:function(e){this._setInputValue(e)}}},outputs:{value:{type:"number",displayName:"Value",group:"States",description:"The value the handle is currently at, between Min and Max, as a number",get:function(){return this._internal.outputValue}},valuePercent:{type:"number",displayName:"Value Percent",group:"States",description:"Where the handle sits as a whole number from 0 to 100, regardless of Min and Max",get:function(){return this._internal.valuePercent}},onChange:{type:"signal",displayName:"Changed",group:"Events",description:"Fires when the user moves the handle; a value arriving on the Value input does not fire it"}},inputProps:{min:{type:"number",displayName:"Min",group:"General",description:"Value at the far left of the track; the current value is clamped up to it if it is below",default:0,index:100,onChange:function(){this._attributeChanged()}},max:{type:"number",displayName:"Max",group:"General",description:"Value at the far right of the track; the current value is clamped down to it if it is above",default:100,index:100,onChange:function(){this._attributeChanged()}},step:{type:"number",displayName:"Step",group:"General",description:"Smallest amount the handle can move by, so the value lands on multiples of it",default:1,index:100,onChange:function(){this._attributeChanged()}},width:{index:11,group:"Dimensions",displayName:"Width",description:"Overall width of the slider, which is the length of the track plus the handle",type:{name:"number",units:["%","px","vw"],defaultUnit:"%"},default:100,allowVisualStates:!0},thumbWidth:{group:"Thumb Style",displayName:"Width",description:"Width of the handle the user drags",type:{name:"number",units:["px","vw","%"],defaultUnit:"px",allowEditOnly:!0},default:16,popout:Ro,allowVisualStates:!0},thumbHeight:{group:"Thumb Style",displayName:"Height",description:"Height of the handle the user drags",type:{name:"number",units:["px","vh","%"],defaultUnit:"px",allowEditOnly:!0},default:16,popout:Ro,allowVisualStates:!0},thumbColor:{group:"Thumb Style",displayName:"Color",description:"Fill colour of the handle",type:{name:"color",allowEditOnly:!0},default:"#000000",popout:Ro,allowVisualStates:!0},trackHeight:{group:"Track Style",displayName:"Height",description:"Thickness of the bar the handle slides along",type:{name:"number",units:["px","vh","%"],defaultUnit:"px",allowEditOnly:!0},default:6,popout:Ao,allowVisualStates:!0},trackColor:{group:"Track Style",displayName:"Inactive Color",description:"Colour of the part of the track the handle has not reached yet",type:{name:"color",allowEditOnly:!0},default:"#f0f0f0",popout:Ao,allowVisualStates:!0},trackActiveColor:{group:"Track Style",displayName:"Active Color",description:"Colour of the part of the track between Min and the handle",type:{name:"color",allowEditOnly:!0},default:"#f0f0f0",popout:Ao,allowVisualStates:!0}},methods:{_reportValue:function(e,t){e="string"==typeof e?parseFloat(e):e,this.props.handle=e,this._internal.outputValue!==e&&(this._internal.outputValue=e,this.flagOutputDirty("value"),t&&this.sendSignalOnOutput("onChange")),this._updateOutputValuePercent(e)},_attributeChanged:function(){var e,t,n=null!==(e=Fo(this.props.min))&&void 0!==e?e:0,i=null!==(t=Fo(this.props.max))&&void 0!==t?t:100;this.setDiagnostic("slider/max-below-min",i<n?"Max ".concat(i," is below Min ").concat(n,", so the handle stays at Min and cannot be moved."):null),this.props.valueWrites++,this.forceUpdate()},_updateOutputValuePercent:function(e){var t,n,i=null!==(t=Fo(this.props.min))&&void 0!==t?t:0,o=null!==(n=Fo(this.props.max))&&void 0!==n?n:100,r=o===i?0:Math.floor((e-i)/(o-i)*100)+0,s=this._internal.valuePercent!==r;this._internal.valuePercent=r,s&&this.flagOutputDirty("valuePercent")},_setInputValue:function(e){if(null!=e&&""!==e){var t=Number(e);Number.isFinite(t)?(this.props.value=t,this._internal.wordPending=!0,this.props.valueWrites++,this.forceUpdate()):this.raiseRuntimeError("slider/value-not-a-number","Value cannot be read as a number (got ".concat(JSON.stringify(e),"), so the handle has not moved."))}}}};function Fo(e){if(null!=e&&"boolean"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e){var t=String(e),n=t.length-t.trimStart().length;if(!/[^\t\n\f\r ]/.test(t.slice(0,n))){var i=parseFloat(t);return Number.isFinite(i)?i:void 0}}}function Mo(e,t){var n=(t=t||{}).defaults||{},i=t.popout;n.borderStyle="none",n.borderWidth=0,n.borderColor="#000000";var o=t.propPrefix[0].toUpperCase()+t.propPrefix.slice(1);function r(e,r,s,a){var l,u=t.propPrefix+"Border".concat(r,"Style"),c=t.propPrefix+"Border".concat(r,"Width"),d=t.propPrefix+"Border".concat(r,"Color"),p="none"!==n.borderStyle?"OR borderStyle NOT SET":"";r?(n[u]&&"none"!==n[u]&&(p+="OR ".concat(u," NOT SET")),Xn.addDynamicInputPorts(e,"".concat(u," = solid OR ").concat(u," = dashed OR ").concat(u," = dotted OR borderStyle = solid OR borderStyle = dashed OR borderStyle = dotted ").concat(p),["".concat(c),"".concat(d)])):Xn.addDynamicInputPorts(e,"".concat(u," = solid OR ").concat(u," = dashed OR ").concat(u," = dotted ").concat(p),["".concat(c),"".concat(d)]);var h={group:t.propPrefix+"-border-styles",tab:s,label:r},f=function(e){return"".concat(o," ").concat(e," ").concat(r?"("+r+")":"")},g=202+4*a,m=o+" Border Style",y="thumb"===t.propPrefix?"the handle you drag":"the bar the handle slides along",v=r?r.toLowerCase():"";Xn.addInputProps(e,((l={})[u]={index:g+1,displayName:"Border Style",editorName:f("Border Style"),description:r?"Line style for the ".concat(v," edge of ").concat(y," only, overriding ").concat(o," Border Style; None hides that edge"):"Line style for all four edges of ".concat(y,"; None hides the border and leaves its Width and Color inactive"),group:m,type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Solid",value:"solid"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"}]},default:n["border".concat(r,"Style")],tab:h,popout:i,allowVisualStates:!0},l[c]={index:g+2,displayName:"Border Width",editorName:f("Border Width"),description:r?"Thickness in pixels of the ".concat(v," edge of ").concat(y,", which has no effect while that edge's Border Style is None"):"Thickness in pixels of the border around ".concat(y,", which has no effect while ").concat(o," Border Style is None"),group:m,type:{name:"number",units:["px"],defaultUnit:"px"},default:n["border".concat(r,"Width")],tab:h,popout:i,allowVisualStates:!0},l[d]={index:g+3,displayName:"Border Color",editorName:f("Border Color"),description:r?"Colour of the ".concat(v," edge of ").concat(y," only, overriding ").concat(o," Border Color"):"Colour of the border around ".concat(y,", which has no effect while ").concat(o," Border Style is None"),group:m,type:"color",default:n["border".concat(r,"Color")],tab:h,popout:i,allowVisualStates:!0},l))}r(e,"","borders-all",0),r(e,"Left","borders-left",1),r(e,"Top","borders-top",2),r(e,"Right","borders-right",3),r(e,"Bottom","borders-bottom",4)}function jo(e,t){var n=(t=t||{}).defaults||{},i=t.popout;n.borderRadius||(n.borderRadius=0);var o=t.propPrefix[0].toUpperCase()+t.propPrefix.slice(1);function r(e,r,s,a){var l,u={group:t.propPrefix+"-corners",tab:s,label:r},c="Border".concat(r,"Radius"),d="thumb"===t.propPrefix?"the handle you drag":"the bar the handle slides along",p=r?r.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase():"";Xn.addInputProps(e,((l={})[t.propPrefix+c]={index:240+a,displayName:"Corner Radius",editorName:"".concat(o," ").concat("Corner Radius"," ").concat(r?"("+r+")":""),description:r?"How rounded the ".concat(p," corner of ").concat(d," is, overriding ").concat(o," Corner Radius"):"How rounded all four corners of ".concat(d," are; half its width and height makes it a circle"),group:o+" Corner Radius",type:{name:"number",units:["px","%"],defaultUnit:"px"},default:n["border".concat(r,"Radius")],tab:u,popout:i},l))}r(e,"","corners-all",0),r(e,"TopLeft","corners-top-left",1),r(e,"TopRight","corners-top-right",2),r(e,"BottomRight","corners-bottom-right",3),r(e,"BottomLeft","corners-bottom-left",4)}function Vo(e,t){var n,i=(t=t||{}).popout,o=t.propPrefix;Xn.addDynamicInputPorts(e,"".concat(o,"BoxShadowEnabled = true"),["".concat(o,"BoxShadowOffsetX"),"".concat(o,"BoxShadowOffsetY"),"".concat(o,"BoxShadowInset"),"".concat(o,"BoxShadowBlurRadius"),"".concat(o,"BoxShadowSpreadRadius"),"".concat(o,"BoxShadowColor")]);var r=t.propPrefix[0].toUpperCase()+t.propPrefix.slice(1),s=function(e){return"".concat(r," ").concat(e)},a="thumb"===t.propPrefix?"the handle you drag":"the bar the handle slides along";Xn.addInputProps(e,((n={})["".concat(o,"BoxShadowEnabled")]={index:250,group:t.group||"Box Shadow",displayName:"Shadow Enabled",editorName:s("Shadow Enabled"),description:"Draws a shadow behind ".concat(a,"; the rest of this group does nothing while it is off"),type:"boolean",allowVisualStates:!0,popout:i},n["".concat(o,"BoxShadowOffsetX")]={index:251,group:t.group||"Box Shadow",displayName:"Offset X",editorName:s("Offset X"),description:"How far right the shadow sits from the element; negative values move it left",default:0,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,popout:i},n["".concat(o,"BoxShadowOffsetY")]={index:252,group:t.group||"Box Shadow",displayName:"Offset Y",editorName:s("Offset Y"),description:"How far down the shadow sits from the element; negative values move it up",default:0,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,popout:i},n["".concat(o,"BoxShadowBlurRadius")]={index:253,group:t.group||"Box Shadow",displayName:"Blur Radius",editorName:s("Blur Radius"),description:"How soft the shadow edge is; 0 gives a hard edge",default:5,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,popout:i},n["".concat(o,"BoxShadowSpreadRadius")]={index:254,group:t.group||"Box Shadow",displayName:"Spread Radius",editorName:s("Spread Radius"),description:"Grows the shadow outwards before it is blurred; negative values shrink it",default:2,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,popout:i},n["".concat(o,"BoxShadowInset")]={index:255,group:t.group||"Box Shadow",displayName:"Inset",editorName:s("Inset"),description:"Draws the shadow inside the element instead of behind it, for a recessed look",type:"boolean",default:!1,allowVisualStates:!0,popout:i},n["".concat(o,"BoxShadowColor")]={index:256,group:t.group||"Box Shadow",displayName:"Shadow Color",editorName:s("Shadow Color"),description:"Colour of the shadow, usually a mostly-transparent black",type:"color",default:"#00000033",allowVisualStates:!0,popout:i},n))}Xn.addAlignInputs(Do),Xn.addTransformInputs(Do),Xn.addMarginInputs(Do),Xn.addPaddingInputs(Do),Xn.addSharedVisualInputs(Do),Mo(Do,{propPrefix:"track",popout:Ao}),jo(Do,{propPrefix:"track",popout:Ao}),Vo(Do,{propPrefix:"track",popout:Ao,group:"Track Box Shadow"}),Mo(Do,{propPrefix:"thumb",popout:Ro}),jo(Do,{propPrefix:"thumb",popout:Ro}),Vo(Do,{propPrefix:"thumb",popout:Ro,group:"Thumb Box Shadow"}),Fi(Do),Mi(Do,{noun:"slider"});const Lo=Si(Do);function Uo(e){return"number"===e?null:""}function Bo(e,t){if("number"!==e)return t;if(""===t||null==t)return null;if("number"==typeof t)return Number.isNaN(t)?null:t;var n=Number(t);return Number.isNaN(n)?null:n}var Wo=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),zo=function(){return zo=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},zo.apply(this,arguments)};function qo(e){e.stopPropagation(),window.removeEventListener("click",qo,!0)}var Ho=function(e){function n(n){var i=e.call(this,n)||this;return i.pendingCaret=null,i.restedTextArea=null,i.hadCaret=!1,i.state={value:null===n.startValue||void 0===n.startValue?"":String(n.startValue)},i.text=i.state.value,i.ref=t().createRef(),i}return Wo(n,e),n.prototype.live=function(e){var t,n=null===(t=this.props.noodlNode)||void 0===t?void 0:t.props;return n&&e in n?n[e]:this.props[e]},n.prototype.setText=function(e,t){var n=null==e?"":String(e);n!==this.text&&(this.pendingCaret=n.length),this.text=n,this.setState({value:n},t),this.props.onTextChanged&&this.props.onTextChanged(Bo(this.live("type"),n))},n.prototype.componentDidMount=function(){var e;this.ref.current.noodlNode=this.props.noodlNode;var t=this.props.noodlNode,n=null===this.props.startValue||void 0===this.props.startValue?"":String(this.props.startValue);(null===(e=null==t?void 0:t._announcedValueIs)||void 0===e?void 0:e.call(t,Bo(this.props.type,n)))||this.setText(this.props.startValue)},n.prototype.render=function(){var e=this,n=zo({},this.props.style);fn.size(n,this.props),fn.align(n,this.props),0===n.opacity&&(n.pointerEvents="none");var i,o=n.height,r=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}(n,["height"]),s=this.props,a=function(){if("image"===s.iconSourceType&&void 0!==s.iconImageSource)return t().createElement("img",{alt:"",src:s.iconImageSource,style:{width:s.iconSize,height:s.iconSize},onClick:function(){return e.focus()}});if("icon"===s.iconSourceType&&void 0!==s.iconIconSource){var n={userSelect:"none",fontSize:s.iconSize,color:s.iconColor};return"left"===s.iconPlacement||void 0===s.iconPlacement?n.marginRight=s.iconSpacing:n.marginLeft=s.iconSpacing,t().createElement(qi,{source:s.iconIconSource,style:n})}return null},l="ndl-controls-textinput "+s.id;s.className&&(l=l+" "+s.className);var u=zo(zo(zo({},s.textStyle),s.styles.input),{width:"100%",height:"100%"});u.color=s.noodlNode.context.styles.resolveColor(u.color);var c=ji(s),d=zo(zo({id:s.id,value:this.state.value},c),{onFocus:function(t){e.hadCaret=!0,c.onFocus&&c.onFocus(t)},disabled:!s.enabled,style:u,className:l,placeholder:s.placeholder,maxLength:s.maxLength,inputMode:s.inputMode||void 0,enterKeyHint:s.enterKeyHint||void 0,onChange:function(t){return e.onChange(t)}});"textArea"!==s.type?i=t().createElement("input",zo({ref:function(t){e.ref.current=t},type:this.props.type},d,{onKeyDown:function(t){return e.onKeyDown(t)},onMouseDown:function(e){var t,n;null===(n=(t=d).onMouseDown)||void 0===n||n.call(t,e),window.addEventListener("click",qo,!0)},"noodl-style-tag":"input"})):(d.style.resize="none",i=t().createElement("textarea",zo({ref:function(t){if(t&&t!==e.restedTextArea){e.restedTextArea=t;try{t.setSelectionRange(t.value.length,t.value.length)}catch(e){}}e.ref.current=t}},d,{onKeyDown:function(t){return e.onKeyDown(t)},"noodl-style-tag":"input"})));var p=zo({display:"flex",alignItems:"center"},s.styles.inputWrapper),h=o&&"%"===o[String(o).length-1];s.useLabel?h?p.flexGrow=1:p.height=o:(Object.assign(p,r),p.height=o),"textArea"!==s.type&&(p.alignItems="center");var f=t().createElement("div",zo({ref:s.useLabel?void 0:Li(this.props.noodlNode)},s.useLabel?void 0:Ui(s.dom),{style:s.useLabel?zo(zo({},Bi(n)),p):p,"noodl-style-tag":"inputWrapper"}),s.useIcon&&"left"===s.iconPlacement?a():null,i,s.useIcon&&"right"===s.iconPlacement?a():null);if(s.useLabel){r.display="flex",r.flexDirection="column",h&&(r.height=o);var g=zo(zo(zo({},s.labeltextStyle),s.styles.label),{marginBottom:s.labelSpacing});return g.color=s.noodlNode.context.styles.resolveColor(g.color),t().createElement("div",zo({ref:Li(this.props.noodlNode)},Ui(s.dom),{style:r}),t().createElement("label",{htmlFor:s.id,style:g,"noodl-style-tag":"label"},Ki(s.label)),f)}return t().createElement("div",{style:zo(zo({},Bi(n)),{display:"contents"})},null,f)},n.prototype.onKeyDown=function(e){"Enter"!==e.key&&13!==e.which||this.props.onEnter&&this.props.onEnter()},n.prototype.onChange=function(e){var t,n,i=e.target.value;null===(n=null===(t=this.props.noodlNode)||void 0===t?void 0:t._typed)||void 0===n||n.call(t,i),this.setText(i),this.pendingCaret=null},n.prototype.componentDidUpdate=function(){this.pendingCaret=null},n.prototype.caret=function(e){var t=this.ref.current;if(t&&this.hadCaret)try{if(null!==t.selectionStart&&null!==t.selectionEnd){if(null!==this.pendingCaret){var n=Math.min(this.pendingCaret,e.length);return{start:n,end:n}}return{start:Math.min(t.selectionStart,e.length),end:Math.min(t.selectionEnd,e.length)}}}catch(e){}return{start:e.length,end:e.length}},n.prototype.edit=function(e,t){var n,i,o,r=this;void 0===t&&(t="");var s=null!==(n=this.text)&&void 0!==n?n:"",a=this.caret(s),l=a.start,u=a.end,c=l,d=t;if("backspace"===e){if(d="",l===u){if(0===l)return!1;var p=Array.from(s.slice(0,l));c=l-p[p.length-1].length}}else{var h=Number(this.live("maxLength"));if(h>0){var f=Math.max(0,h-(s.length-(u-l)));d=Array.from(d).reduce(function(e,t){return e.length+t.length<=f?e+t:e},"")}if(0===d.length)return!1}var g=s.slice(0,c)+d+s.slice(u);if(g===s)return!1;var m=c+d.length;return null===(o=null===(i=this.props.noodlNode)||void 0===i?void 0:i._typed)||void 0===o||o.call(i,g),this.setText(g,function(){var e=r.ref.current;if(e&&r.hasFocus())try{e.setSelectionRange(m,m)}catch(e){}}),this.hasFocus()&&(this.pendingCaret=m),!0},n.prototype.focus=function(){this.ref.current&&this.ref.current.focus()},n.prototype.blur=function(){this.ref.current&&this.ref.current.blur()},n.prototype.hasFocus=function(){return document.activeElement===this.ref.current},n}(t().Component),Go=function(){return Go=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Go.apply(this,arguments)};function $o(e,t){return"\n .".concat(e,"::placeholder {\n opacity: ").concat(t.placeholderOpacity,";\n }\n ")}var Xo={name:"net.noodl.controls.textinput",displayName:"Text Input",docs:"https://docs.noodl.net/nodes/ui-controls/text-input",allowChildren:!1,noodlNodeAsProp:!0,usePortAsLabel:"label",nodeDoubleClickAction:{focusPort:"label"},connectionPanel:{groupPriority:["General","Text","Style","Actions","Events","States","Mounted","Text Style","Label","Label Text Style","Hover Events","Pointer Events","Focus Events"]},runOnValueChange:{controlSignal:"set",inputs:["startValue"]},getReactComponent:function(){return Ho},initialize:function(){this.props.startValue="",this.props.id=this._internal.controlId="input-"+(0,Zi.A)()},inputProps:{type:{displayName:"Type",description:"What kind of value the field accepts, which also changes the on-screen keyboard on touch devices",group:"Text",index:19,type:{name:"enum",enums:[{label:"Text",value:"text"},{label:"Text Area",value:"textArea"},{label:"Email",value:"email"},{label:"Number",value:"number"},{label:"Password",value:"password"},{label:"URL",value:"url"}]},default:"text"},inputMode:{displayName:"Input Mode",description:"Which on-screen keyboard a phone or tablet opens: Decimal for numbers with a decimal key, Telephone for digits, None for no keyboard when the page has its own keypad",group:"Text",index:20,type:{name:"enum",enums:[{label:"Text",value:"text"},{label:"Numeric",value:"numeric"},{label:"Decimal",value:"decimal"},{label:"Telephone",value:"tel"},{label:"Email",value:"email"},{label:"URL",value:"url"},{label:"Search",value:"search"},{label:"None",value:"none"}]}},enterKeyHint:{displayName:"Enter Key Hint",description:"The word on the Enter key of a phone or tablet keyboard, such as Next, Go or Send",group:"Text",index:21,type:{name:"enum",enums:[{label:"Enter",value:"enter"},{label:"Done",value:"done"},{label:"Go",value:"go"},{label:"Next",value:"next"},{label:"Previous",value:"previous"},{label:"Search",value:"search"},{label:"Send",value:"send"}]}},placeholder:{index:22,group:"Text",displayName:"Placeholder",description:"Greyed-out hint shown while the field is empty",default:"",type:{name:"string"}},maxLength:{group:"Text",displayName:"Max length",description:"Largest number of characters the user can type; it does not truncate a value arriving on Text",type:"number",index:24}},inputs:{placeHolderOpacity:{index:23,group:"Text",displayName:"Placeholder opacity",description:"How faded the placeholder text is, from 0 to 1",type:"number",default:.5,set:function(e){var t=this._internal.controlId;Di(t,{placeholderOpacity:e},$o)}},set:{group:"Actions",displayName:"Set",description:"Writes the current Value into the field now. This is additional to Value applying as it arrives; untick Value under Run On Value Change to stop that",type:"signal",valueChangedToTrue:function(){var e=this,t=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(function(){e.reportOutcome(t,e.setText(e._internal.text)?"done":"unchanged")})}},startValue:{index:18,displayName:"Value",type:"*",description:"The value to put in the field. Applied as it arrives, unless you untick it under Run On Value Change, in which case it waits for a Set pulse",group:"Text",set:function(e){if(void 0!==e){var t=null===e?Uo(this.props.type):e;this._internal.text!==t&&(this._internal.text=t,this.shouldRunOnValueChange("startValue")&&this.setText(t))}}},textToInsert:{type:"string",group:"Text",displayName:"Text To Insert",description:"What Insert Text writes, for example the digit on a keypad button",set:function(e){this._internal.textToInsert=null==e?"":String(e)}},insert:{type:"signal",group:"Actions",displayName:"Insert Text",description:"Writes Text To Insert at the caret, replacing any selection, as if it had been typed — even while the field has focus. Max length still applies",valueChangedToTrue:function(){var e=this,t=this.beginOutcome();this.scheduleAfterInputsHaveUpdated(function(){e.reportOutcome(t,e.edit("insert",e._internal.textToInsert||"")?"done":"unchanged")})}},backspace:{type:"signal",group:"Actions",displayName:"Backspace",description:"Deletes the selection, or the character before the caret, as the Backspace key does — even while the field has focus",valueChangedToTrue:function(){var e=this.beginOutcome();this.reportOutcome(e,this.edit("backspace")?"done":"unchanged")}},clear:{type:"signal",group:"Actions",displayName:"Clear",description:"Empties the field",valueChangedToTrue:function(){var e=this.beginOutcome();this.reportOutcome(e,this.clear()?"done":"unchanged")}},focus:{type:"signal",group:"Actions",displayName:"Focus",description:"Puts the keyboard cursor in this field",valueChangedToTrue:function(){var e=this.beginOutcome(),t=!1!==this.context.setNodeFocused(this,!0);this.setDiagnostic("focus/not-mounted",t?null:"Focus arrived while this field was not on the page, so nothing was focused. A Focus is not kept for later: send it once the field has mounted, for example from its row’s Did Mount"),this.reportOutcome(e,t?"done":"unchanged")}},blur:{type:"signal",group:"Actions",displayName:"Blur",description:"Takes keyboard focus away from this field, which is what fires Blurred",valueChangedToTrue:function(){var e=this.beginOutcome();this.context.setNodeFocused(this,!1),this.reportOutcome(e,"done")}},textAlignX:{group:"Text Alignment",index:13,displayName:"Text Horizontal Align",description:"Aligns the typed text within the field",type:{name:"enum",enums:[{label:"left",value:"left"},{label:"center",value:"center"},{label:"right",value:"right"}],alignComp:"justify"},default:"left",set:function(e){switch(e){case"left":this.setStyle({textAlign:"left"},"input");break;case"center":this.setStyle({textAlign:"center"},"input");break;case"right":this.setStyle({textAlign:"right"},"input")}}}},inputCss:{backgroundColor:{index:100,displayName:"Background Color",description:"Fill colour of the field",group:"Style",type:"color",default:"transparent",allowVisualStates:!0,styleTag:"inputWrapper"}},outputProps:{onTextChanged:{group:"General",displayName:"Value",type:"*",description:"What the field currently contains, updated as the user types. A number when Type is Number, otherwise text",index:1,onChange:function(e){this._internal.announced={value:e},this.sendSignalOnOutput("textChanged")}},onEnter:{group:"Events",displayName:"On Enter",description:"Fires when the user presses Enter in the field, which is the usual place to submit",type:"signal"}},outputs:Go({textChanged:{displayName:"Value Changed",type:"signal",group:"General",description:"Fires each time a value is written into the field (Set, Value, Insert Text, Backspace, Clear or the person typing), whether or not it changed. A write made while the field is off the page is announced when the field comes back",index:2}},(0,Ni.outcomeOutputs)({done:"Fires when Set, Clear, Insert Text, Backspace, Focus or Blur did something",unchanged:"Fires when a Set or Clear left the field as it was — most often a Set while the field has focus, which is deliberately absorbed so it cannot overwrite what is being typed — when Insert Text or Backspace had nothing to write (a full Max length, or an empty field), or when a Focus arrived while the field was not on the page"})),methods:{_focus:function(){this.innerReactComponentRef&&this.innerReactComponentRef.focus()},_blur:function(){this.innerReactComponentRef&&this.innerReactComponentRef.blur()},_canFocus:function(){return!!this.innerReactComponentRef},_hasFocus:function(){return!!this.innerReactComponentRef&&this.innerReactComponentRef.hasFocus()},_typed:function(e){this.props.startValue=e},_announcedValueIs:function(e){return void 0!==this._internal.announced&&this._internal.announced.value===e},edit:function(e,t){if(this.innerReactComponentRef)return this.innerReactComponentRef.edit(e,t);var n,i=void 0===this.props.startValue||null===this.props.startValue?"":String(this.props.startValue);if("backspace"===e){var o=Array.from(i);o.pop(),n=o.join("")}else{var r=Number(this.props.maxLength),s=r>0?Math.max(0,r-i.length):1/0;n=i+Array.from(String(null!=t?t:"")).reduce(function(e,t){return e.length+t.length<=s?e+t:e},"")}return n!==i&&(this.props.startValue=n,this.outputPropValues.onTextChanged=Bo(this.props.type,n),this.flagOutputDirty("onTextChanged"),!0)},clear:function(){var e=Uo(this.props.type),t=this.innerReactComponentRef?this.innerReactComponentRef.text:this.props.startValue,n=this._internal.text===e&&this.outputPropValues.onTextChanged===e&&(null==t||""===String(t));return this._internal.text=e,this.props.startValue=e,this.innerReactComponentRef?this.innerReactComponentRef.setText(""):this.outputPropValues.onTextChanged!==e&&(this.outputPropValues.onTextChanged=e,this.flagOutputDirty("onTextChanged")),!n},setText:function(e){if(this.props.startValue=e,this.innerReactComponentRef)return!1===this.innerReactComponentRef.hasFocus()&&(this.innerReactComponentRef.setText(e),!0);var t=Bo(this.props.type,null==e?"":String(e));return this.outputPropValues.onTextChanged!==t&&(this.outputPropValues.onTextChanged=t,this.flagOutputDirty("onTextChanged"),!0)}}};function Yo(e,t,n){var i="number"===t.type?"number":"string";n.sendDynamicPorts(e,[{name:"startValue",type:i,plug:"input",group:"Text",index:18,displayName:"Value"},{name:"onTextChanged",type:i,plug:"output",group:"General",index:1,displayName:"Value"}])}Xn.addDimensions(Xo,{defaultSizeMode:"contentSize",contentLabel:"Value"}),Xn.addIconInputs(Xo,{enableIconPlacement:!0,defaults:{useIcon:!1,iconColor:"#000000"}}),Xn.addLabelInputs(Xo,{enableSpacing:!0,styleTag:"label",displayName:"Label"}),Xn.addTextStyleInputs(Xo,{styleTag:"input",portPrefix:"",portIndex:18,popout:{group:"input-text-style",label:"Text Style",parentGroup:"Text"}}),Xn.addAlignInputs(Xo),Xn.addTransformInputs(Xo),Xn.addPaddingInputs(Xo,{styleTag:"inputWrapper"}),Xn.addMarginInputs(Xo),Xn.addSharedVisualInputs(Xo),Xn.addBorderInputs(Xo,{styleTag:"inputWrapper"}),Xn.addShadowInputs(Xo,{styleTag:"inputWrapper"}),Fi(Xo);var Ko=Si(Xo);Ko.setup=function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.net.noodl.controls.textinput",function(t){Yo(t.id,t.parameters,e.editorConnection),t.on("parameterUpdated",function(n){"type"===n.name&&Yo(t.id,t.parameters,e.editorConnection)})})};const Jo=Ko,Qo=function(){function e(){this.queue=[],this.pendingPromise=!1}return e.prototype.enqueue=function(e){var t=this;return new Promise(function(n,i){t.queue.push({promise:e,resolve:n,reject:i}),t.dequeue()})},e.prototype.dequeue=function(){var e=this;if(this.workingOnPromise)return!1;var t=this.queue.shift();if(!t)return!1;try{this.workingOnPromise=!0,t.promise().then(function(n){e.workingOnPromise=!1,t.resolve(n),e.dequeue()}).catch(function(n){e.workingOnPromise=!1,t.reject(n),e.dequeue()})}catch(e){this.workingOnPromise=!1,t.reject(e),this.dequeue()}return!0},e}();var Zo=__webpack_require__(5104),er=__webpack_require__(4231),tr=function(){return tr=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},tr.apply(this,arguments)},nr=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})},ir=function(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};function or(e){try{return decodeURIComponent(e)}catch(t){return e}}function rr(n){var i=n.didMount,o=n.willUnmount,r=n.style,s=n.children;return(0,e.useEffect)(function(){return i(),function(){o()}},[]),t().createElement("div",tr({ref:Li(n.noodlNode)},Ui(n.dom),{style:r}),s)}var sr={name:"Page Stack",displayNodeName:"Component Stack",category:"Visuals",docs:"https://docs.noodl.net/nodes/component-stack/component-stack-node",ssr:{compat:"partial",note:"The initial stack renders server-side; browser URL/history sync only runs in the browser."},useVariants:!1,noodlNodeAsProp:!0,initialize:function(){var e=this;this._internal.stack=[],this._internal.topPageName="",this._internal.stackDepth=0,this._internal.pageInfo={},this._internal.asyncQueue=new Qo,this.onScheduleReset=function(){e._internal.ownBacks?e._internal.ownBacks-=1:e._internal.useRoutes&&(e._addressShowsTop()||e.scheduleReset())},this.props.didMount=function(){if(!e._internal.isMounted){e._internal.isMounted=!0;var t=e._internal,n=!!t.useRoutes&&"undefined"!=typeof location&&location.href!==t.addressAtUnmount;t.keepAtMount=!!t.keepPagesWhenUnmounted&&t.stack.length>0&&!t.resetOwed&&!n,t.resetOwed=!1,"undefined"!=typeof window&&(window.history&&window.history.pushState?window.addEventListener("popstate",e.onScheduleReset):window.addEventListener("hashchange",e.onScheduleReset)),e._registerPageStack(),t.keepAtMount=!1}},this.props.willUnmount=function(){e._internal.isMounted=!1,e._internal.resetOwed=!1,e._internal.ownBacks=0,e._internal.addressAtUnmount="undefined"!=typeof location?location.href:void 0,"undefined"!=typeof window&&(window.removeEventListener("popstate",e.onScheduleReset),window.removeEventListener("hashchange",e.onScheduleReset)),e._deregisterPageStack()}},getInspectInfo:function(){var e=this;return 0===this._internal.stack.length?"No active page":[{type:"text",value:"Active Components:"}].concat(this._internal.stack.map(function(t){return{type:"text",value:"- "+e._findPage(t.pageId).label}}))},defaultCss:{width:"100%",flex:"1 1 100%",position:"relative",display:"flex",flexDirection:"column",overflow:"hidden"},getReactComponent:function(){return rr},inputs:{name:{type:{name:"string",identifierOf:"PackStack"},displayName:"Name",group:"General",description:"Name the Push and Pop nodes address this stack by; leave it as Main if there is only one",default:"Main",set:function(e){String(e||"Main")!==String(this._internal.name||"Main")?(this._deregisterPageStack(),this._internal.name=e,this._internal.isMounted?this._registerPageStack():this._internal.resetOwed=!0):this._internal.name=e}},useRoutes:{type:"boolean",displayName:"Use Routes",description:"Puts the top component in the browser URL, so back and forward move through the stack",group:"General",default:!1,set:function(e){this._internal.useRoutes=!!e}},keepPagesWhenUnmounted:{type:"boolean",displayName:"Keep Pages When Unmounted",description:"Keeps the stack's components, and what is on them, while Mounted is off, so turning it back on shows the one that was on top. Its Components or Name changing meanwhile, or (with Use Routes) Back or Forward, still starts it again. Off: turning Mounted back on starts at the start component",group:"General",default:!1,set:function(e){this._internal.keepPagesWhenUnmounted=!!e}},clip:{displayName:"Clip Content",description:"Clips a pushed component that is bigger than the stack",type:"boolean",group:"Layout",default:!0,set:function(e){e?this.setStyle({overflow:"hidden"}):this.removeStyle(["overflow"])}},pages:{type:"proplist",displayName:"Components",description:"The components this stack can show, and which of them it starts on",group:"Components",set:function(e){this._internal.pages=Array.isArray(e)?e:void 0,this._internal.isMounted?this.scheduleReset(void 0,!0):this._internal.resetOwed=!0}},reset:{type:"signal",displayName:"Reset",description:"Empties the stack and rebuilds the start component",group:"Actions",valueChangedToTrue:function(){this.scheduleReset(this.beginOutcome(),!0)}}},inputCss:{backgroundColor:{type:"color",displayName:"Background Color",description:"Fill colour behind whichever component is showing",group:"Style",default:"transparent",applyDefault:!1}},outputs:tr(tr({},(0,Ni.outcomeOutputs)({done:"Fires once the stack has been emptied and the start component rebuilt",failure:"Fires when the stack has no components configured, or its start component does not resolve"})),{topPageName:{type:"string",displayName:"Top Component Name",description:"Name of the component currently on top of the stack",group:"General",get:function(){return this._internal.topPageName}},stackDepth:{type:"number",displayName:"Stack Depth",description:"How many components are on the stack, so 1 means only the start component",group:"General",get:function(){return this._internal.stackDepth}}}),methods:{_registerPageStack:function(){Zo.A.instance.registerPageStack(this._internal.name,this)},_deregisterPageStack:function(){Zo.A.instance.deregisterPageStack(this._internal.name,this)},_reportNavigationFailure:function(e,t,n){e.hasFailed&&e.hasFailed(t,n)},_findPage:function(e){var t=this._internal.pageInfo[e]?this._internal.pages.find(function(t){return t.id===e}):void 0;if(t){var n=this._internal.pageInfo[e],i=t;return{component:String(n.component),label:String(i.label),id:String(e),path:void 0!==n.path?String(n.path):void 0}}var o=this._internal.pages.find(function(t){return t.label===e});if(o&&this._internal.pageInfo[o.id])return n=this._internal.pageInfo[o.id],{component:String(n.component),label:String(o.label),id:String(o.id),path:void 0!==n.path?String(n.path):void 0}},_isAlreadyShowing:function(e,t){var n=this._internal.stack;if(!n||0===n.length)return!1;var i=n[n.length-1];if(!i||!i.pageInfo||i.pageInfo.id!==e.id)return!1;var o=i.params||{},r=t||{},s=Object.keys(o),a=Object.keys(r);if(s.length!==a.length)return!1;for(var l=0;l<s.length;l++){var u=s[l];if(!Object.prototype.hasOwnProperty.call(r,u))return!1;if(o[u]!==r[u])return!1}return!0},setPageOutputs:function(e){for(var t in e)this._internal[t]=e[t],this.flagOutputDirty(t)},scheduleReset:function(e,t){var n=this,i=this._internal;void 0!==e&&(void 0===i.pendingResetOutcomes&&(i.pendingResetOutcomes=[]),i.pendingResetOutcomes.push(e)),t&&(i.pendingResetToStart=!0),i.hasScheduledReset||(i.hasScheduledReset=!0,this.scheduleAfterInputsHaveUpdated(function(){i.hasScheduledReset=!1;var e=i.pendingResetOutcomes,t=!!i.pendingResetToStart;i.pendingResetOutcomes=void 0,i.pendingResetToStart=!1,n.reset(e,t)}))},_reportReset:function(e,t,n){if(void 0!==e&&0!==e.length)for(var i=0,o=e;i<o.length;i++){var r=o[i];this.reportOutcome(r,t,n)}else"failure"===t&&n&&this.raiseRuntimeError(n.code,n.message)},createPageContainer:function(){var e=this.nodeScope.createPrimitiveNode("Group");return e.setStyle({flex:"1 0 100%"}),e},reset:function(e,t){void 0===e&&this._internal.keepAtMount||this._internal.asyncQueue.enqueue(this.resetAsync.bind(this,e,t))},resetAsync:function(e,t){return nr(this,void 0,void 0,function(){var n,i,o,r,s,a,l,u,c,d,p;return ir(this,function(h){switch(h.label){case 0:for(n=this.getChildren().slice(),i=0,o=n;i<o.length;i++)r=o[i],this.removeChild(r),this.nodeScope.deleteNode(r);if(void 0===this._internal.pages||0===this._internal.pages.length)return this._resetLeftEmpty(),this._reportReset(e,"failure",{code:"component-stack/no-components",message:'The Component Stack "'.concat(this._internal.name||"Main",'" has no components to show — add them to its Components list')}),[2];if(a={},void 0!==(l=t?void 0:this.matchPageFromUrl())?(s=l.pageId,a=Object.assign({},l.query,l.params)):void 0===(s=this._internal.startPageId)&&(s=this._internal.pages[0].id),void 0===(u=this._findPage(s))||void 0===u.component)return this._resetLeftEmpty(),this._reportReset(e,"failure",{code:"component-stack/component-not-found",message:'The Component Stack "'.concat(this._internal.name||"Main",'" cannot show "').concat(s,'" — check its Start Page against its Components list')}),[2];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.nodeScope.createNode(u.component,(0,Zi.A)())];case 2:return c=h.sent(),[3,4];case 3:return h.sent(),this._resetLeftEmpty(),this._reportReset(e,"failure",{code:"component-stack/component-not-found",message:'The Component Stack "'.concat(this._internal.name||"Main",'" cannot show "').concat(s,'" — its component "').concat(u.component,'" is not in the project')}),[2];case 4:for(d in a)c.setInputValue(d,a[d]);return(p=this.createPageContainer()).addChild(c),this.addChild(p),this._internal.stack=[{from:null,page:p,pageId:s,pageInfo:u,params:a,componentName:this._internal.startPage}],this.updateChildCountAndIndiciesNow(),this.setPageOutputs({topPageName:u.label,stackDepth:this._internal.stack.length}),t&&!this._addressShowsTop()&&(this._internal.stack[0].historyEntry=this._updateUrlWithTopPage("push")),this._reportReset(e,"done"),[2]}})})},_resetLeftEmpty:function(){this._internal.stack=[],this.updateChildCountAndIndiciesNow(),this.setPageOutputs({topPageName:"",stackDepth:0})},getRelativeURL:function(){var e=this._internal.stack[this._internal.stack.length-1];if(void 0!==e){var t=e.pageInfo.path;if(void 0===t){var n=this._internal.pages.find(function(t){return t.id==e.pageInfo.id});if(void 0===n)return;t=n.label.replace(/\s+/g,"-").toLowerCase()}var i=t.match(/{([^}]+)}/g),o=Object.assign({},e.params);if(i)for(var r=0,s=i;r<s.length;r++){var a=s[r],l=a.replace(/[{}]/g,"");void 0!==e.params[l]&&(t=t.replace(a,encodeURIComponent(String(o[l]))),delete o[l])}var u=[];for(var l in o)u.push({name:l,value:o[l]});return t.startsWith("/")&&(t=t.substring(1)),{path:t,query:u}}},getNavigationAbsoluteURL:function(){for(var e,t=this.parent;void 0!==t&&"function"!=typeof t.getNavigationAbsoluteURL;)t=t.getVisualParentNode();e=void 0===t?{path:"",query:[]}:t.getNavigationAbsoluteURL();var n=this.getRelativeURL();return void 0===n?e:{path:e.path+(e.path.endsWith("/")?"":"/")+n.path,query:e.query.concat(n.query)}},_getLocationPath:function(){var e=r().instance.getProjectSettings().navigationPathType;if(void 0===e||"hash"===e){var t=location.hash;return t&&("#"===t[0]&&(t=t.substring(1)),"/"===t[0]&&(t=t.substring(1))),t}var n=location.pathname;return n&&"/"===n[0]&&(n=n.substring(1)),n},_getSearchParams:function(){for(var e,t=/\+/g,n=/([^&=]+)=?([^&]*)/g,i=function(e){return or(e.replace(t," "))},o=location.search.substring(1),r={};e=n.exec(o);)r[i(e[1])]=i(e[2]);return r},getNavigationRemainingPath:function(){return this._internal.remainingNavigationPath},matchPageFromUrl:function(){if(this._internal.useRoutes&&void 0!==this._internal.pages&&0!==this._internal.pages.length){for(var e,t=this.parent;void 0!==t&&"function"!=typeof t.getNavigationRemainingPath;)t=t.getVisualParentNode();if(void 0===t){var n=this._getLocationPath();"/"===n[0]&&(n=n.substring(1)),e=n.split("/")}else e=t.getNavigationRemainingPath();if(void 0!==e)for(var i=this._getSearchParams(),o=0,r=this._internal.pages;o<r.length;o++){var s=r[o],a=this._internal.pageInfo[s.id];if(void 0!==a){var l=a.path;void 0===l&&(l=s.label.replace(/\s+/g,"-").toLowerCase()),"/"===l[0]&&(l=l.substring(1));var u=c(e,l.split("/"));if(u)return this._internal.remainingNavigationPath=u.remainingPathParts,{pageId:s.id,params:u.params,query:i}}}}function c(e,t){for(var n={},i=0;i<t.length;i++){if(void 0===e[i])return;var o=t[i];if("{"===o[0]&&"}"===o[o.length-1])n[o.substring(1,o.length-1)]=or(e[i]);else if(o!==e[i])return}return{params:n,remainingPathParts:e.splice(t.length)}}},_updateUrlWithTopPage:function(e){if(void 0===e&&(e="push"),this._internal.useRoutes&&"undefined"!=typeof window&&void 0!==window.history){var t=this.getNavigationAbsoluteURL(),n=void 0,i=void 0,o=r().instance.getProjectSettings().navigationPathType;void 0===o||"hash"===o?i=t.path:n=t.path;var s=t.query.map(function(e){return encodeURIComponent(e.name)+"="+encodeURIComponent(String(e.value))});void 0===n&&0===s.length&&""!==location.search&&(n=location.pathname);var a=(void 0!==n?n:"")+(s.length>=1?"?"+s.join("&"):"")+(void 0!==i?"#"+i:"");return this._internal.remainingNavigationPath=void 0,"replace"===e?window.history.replaceState({},"",a):window.history.pushState({},"",a),"push"===e}return!1},_addressShowsTop:function(){var e=this._internal.stack[this._internal.stack.length-1];if(void 0===e||void 0===this._internal.pages||0===this._internal.pages.length)return!1;var t=this._internal.remainingNavigationPath,n=this.matchPageFromUrl();this._internal.remainingNavigationPath=t;var i=void 0!==n?n.pageId:void 0!==this._internal.startPageId?this._internal.startPageId:this._internal.pages[0].id,o=this._findPage(i);if(void 0===o||o.id!==e.pageInfo.id)return!1;var r=void 0!==n?Object.assign({},n.query,n.params):{},s=e.params||{},a=Object.keys(s);return a.length===Object.keys(r).length&&a.every(function(e){return Object.prototype.hasOwnProperty.call(r,e)&&String(s[e])===String(r[e])})},replace:function(e){this._internal.asyncQueue.enqueue(this.replaceAsync.bind(this,e))},replaceAsync:function(e){return nr(this,void 0,void 0,function(){var t,n,i,o,r,s,a,l,u,c,d,p=this;return ir(this,function(h){switch(h.label){case 0:if(void 0===this._internal.pages||0===this._internal.pages.length)return[2,this._reportNavigationFailure(e,"push-component-stack/stack-has-no-components",'The Component Stack "'.concat(this._internal.name||"Main",'" has no components to show — its Components list is empty'))];if(this._internal.isTransitioning)return[2,this._reportNavigationFailure(e,"push-component-stack/stack-transitioning","The Component Stack is still animating the previous navigation — this one was dropped")];if(t=e.target||this._internal.pages[0].id,void 0===(n=this._findPage(t))||void 0===n.component)return[2,this._reportNavigationFailure(e,"push-component-stack/component-not-found",'The Component Stack "'.concat(this._internal.name||"Main",'" has no component "').concat(t,'" — check the Target Page against its Components list'))];if(1===this._internal.stack.length&&this._isAlreadyShowing(n,e.params))return e.hasUnchanged?e.hasUnchanged():e.hasNavigated&&e.hasNavigated(),[2];i=this.getChildren().slice(),o=this._internal.stack.length>0?this._internal.stack[this._internal.stack.length-1].page:null,r=e.transition&&e.transition.type||"None",s=!!o&&"None"!==r&&!!er.A[r],a=function(){for(var e=0,t=i;e<t.length;e++){var n=t[e];p.removeChild(n),p.nodeScope.deleteNode(n)}},s||a(),l=this.createPageContainer(),s&&l.setInputValue("position","absolute"),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.nodeScope.createNode(n.component,(0,Zi.A)())];case 2:return u=h.sent(),[3,4];case 3:return h.sent(),this.nodeScope.deleteNode(l),[2,this._reportNavigationFailure(e,"push-component-stack/component-not-found",'The Component Stack "'.concat(this._internal.name||"Main",'" cannot show "').concat(t,'" — its component "').concat(n.component,'" is not in the project'))];case 4:for(c in e.params)u.setInputValue(c,e.params[c]);return l.addChild(u),d=s?new er.A[r](o,l,e.transition):void 0,this._internal.stack=[{from:null,page:l,pageId:t,pageInfo:n,params:e.params,componentName:e.target,transition:d}],this.setPageOutputs({topPageName:n.label,stackDepth:this._internal.stack.length}),this._updateUrlWithTopPage("replace"),d&&(d.forward(0),this._internal.isTransitioning=!0,d.start({end:function(){p._internal.isTransitioning=!1,a(),l.setInputValue("position","relative")}})),this.addChild(l),e.hasNavigated&&e.hasNavigated(),[2]}})})},navigate:function(e){this._internal.asyncQueue.enqueue(this.navigateAsync.bind(this,e))},navigateAsync:function(e){return nr(this,void 0,void 0,function(){var t,n,i,o,r,s,a,l,u,c=this;return ir(this,function(d){switch(d.label){case 0:if(void 0===this._internal.pages||0===this._internal.pages.length)return[2,this._reportNavigationFailure(e,"push-component-stack/stack-has-no-components",'The Component Stack "'.concat(this._internal.name||"Main",'" has no components to show — its Components list is empty'))];if(this._internal.isTransitioning)return[2,this._reportNavigationFailure(e,"push-component-stack/stack-transitioning","The Component Stack is still animating the previous navigation — this one was dropped")];if(t=e.target||this._internal.pages[0].id,void 0===(n=this._findPage(t))||void 0===n.component)return[2,this._reportNavigationFailure(e,"push-component-stack/component-not-found",'The Component Stack "'.concat(this._internal.name||"Main",'" has no component "').concat(t,'" — check the Target Page against its Components list'))];if(this._isAlreadyShowing(n,e.params))return e.hasUnchanged?e.hasUnchanged():e.hasNavigated&&e.hasNavigated(),[2];(i=this.createPageContainer()).setInputValue("position","absolute"),d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.nodeScope.createNode(n.component,(0,Zi.A)())];case 2:return o=d.sent(),[3,4];case 3:return d.sent(),this.nodeScope.deleteNode(i),[2,this._reportNavigationFailure(e,"push-component-stack/component-not-found",'The Component Stack "'.concat(this._internal.name||"Main",'" cannot show "').concat(t,'" — its component "').concat(n.component,'" is not in the project'))];case 4:for(r in e.params)o.setInputValue(r,e.params[r]);if(i.addChild(o),(s=o.nodeScope.getNodesWithType("PageStackNavigateBack"))&&s.length>0)for(a=0;a<s.length;a++)s[a]._setBackCallback(this.back.bind(this));return void 0===(l=this._internal.stack[this._internal.stack.length-1])?(this.nodeScope.deleteNode(i),[2,this._reportNavigationFailure(e,"push-component-stack/stack-empty",'The Component Stack "'.concat(this._internal.name||"Main",'" has no page to push "').concat(t,'" onto — Reset it first'))]):(u={from:l.page,page:i,pageInfo:n,pageId:t,params:e.params,transition:new(er.A[e.transition.type||"Push"]||er.A.None)(l.page,i,e.transition),backCallback:e.backCallback,componentName:e.target},this._internal.stack.push(u),this.setPageOutputs({topPageName:n.label,stackDepth:this._internal.stack.length}),u.historyEntry=this._updateUrlWithTopPage(),u.transition.forward(0),this._internal.isTransitioning=!0,u.transition.start({end:function(){c._internal.isTransitioning=!1,c.removeChild(l.page),i.setInputValue("position","relative")}}),this.addChild(i),e.hasNavigated&&e.hasNavigated(),[2])}})})},back:function(e){var t=this;if(this._internal.stack.length<=1)return{ok:!1,unchanged:!0};if(this._internal.isTransitioning)return{ok:!1,code:"pop-component-stack/transition-in-progress",message:"Ignored — the Component Stack is still animating the previous navigation"};var n=this._internal.stack[this._internal.stack.length-1],i=this._internal.stack[this._internal.stack.length-2].pageId,o=this._findPage(i);return void 0===o?{ok:!1,code:"pop-component-stack/page-not-found",message:'The Component Stack "'.concat(this._internal.name||"Main",'" no longer has the page below ("').concat(i,'") in its Components list — the Pop was refused')}:(n.page.setInputValue("position","absolute"),this.addChild(n.from,0),n.backCallback&&n.backCallback(e.backAction,e.results),this.setPageOutputs({topPageName:o.label,stackDepth:this._internal.stack.length-1}),this._internal.isTransitioning=!0,n.transition.start({end:function(){var e;t._internal.isTransitioning=!1,n.page.setInputValue("position","relative"),t.removeChild(n.page),t.nodeScope.deleteNode(n.page);var i=t._internal.stack.indexOf(n);i>=0&&t._internal.stack.splice(i,1),n.historyEntry&&t._internal.useRoutes&&"undefined"!=typeof window&&void 0!==window.history?(t._internal.ownBacks=(null!==(e=t._internal.ownBacks)&&void 0!==e?e:0)+1,window.history.back()):t._updateUrlWithTopPage("replace")},back:!0}),{ok:!0})},setPageComponent:function(e,t){var n=this._internal;n.pageInfo[e]||(n.pageInfo[e]={}),n.pageInfo[e].component=t},setPagePath:function(e,t){var n=this._internal;n.pageInfo[e]||(n.pageInfo[e]={}),n.pageInfo[e].path="string"==typeof t?t:void 0},setStartPage:function(e){this._internal.startPageId=e},registerInputIfNeeded:function(e){if(!this.hasInput(e))return e.startsWith("pageComp-")?this.registerInput(e,{set:this.setPageComponent.bind(this,e.substring(9))}):e.startsWith("pagePath-")?this.registerInput(e,{set:this.setPagePath.bind(this,e.substring(9))}):"startPage"===e?this.registerInput(e,{set:this.setStartPage.bind(this)}):void 0}},setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.Page Stack",function(e){i(e)});for(var e=0,n=t.getNodesWithType("Page Stack");e<n.length;e++)i(n[e])})}function i(e){function t(){var t=[],i=e.parameters.pages;void 0!==i&&i.length>0&&(i.forEach(function(n){t.push({name:"pageComp-"+n.id,displayName:"Component",editorName:n.label+" | Component",plug:"input",type:"component",group:"Pages",parent:"pages",parentItemId:n.id}),!0===e.parameters.useRoutes&&t.push({name:"pagePath-"+n.id,displayName:"Path",editorName:n.label+" | Path",plug:"input",type:"string",group:"Pages",default:n.label.replace(/\s+/g,"-").toLowerCase(),parent:"pages",parentItemId:n.id})}),t.push({plug:"input",type:{name:"enum",enums:i.map(function(e){return{label:e.label,value:e.id}}),allowEditOnly:!0},group:"General",displayName:"Start Page",name:"startPage",default:i[0].id})),n.sendDynamicPorts(e.id,t)}t(),e.on("parameterUpdated",function(e){"pages"!==e.name&&"useRoutes"!==e.name||t()})}}};const ar=Si(sr);var lr=function(){return lr=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},lr.apply(this,arguments)},ur={group:"seo-og",label:"Open Graph",parentGroup:"Experimental SEO"},cr={group:"seo-twitter",label:"Twitter",parentGroup:"Experimental SEO"},dr=[{isProperty:!0,key:"description",description:"Summary search engines show under the page title in results, usually kept under about 160 characters",displayName:"Description",group:"Experimental SEO"},{isProperty:!0,key:"robots",description:'Instructions for search-engine crawlers, e.g. "noindex, nofollow" to keep this page out of results',displayName:"Robots",group:"Experimental SEO"},{isProperty:!0,key:"og:title",description:"Title shown when this page is shared on Facebook, LinkedIn and most chat apps; falls back to the page title",displayName:"Title",editorName:"OG Title",group:"General",popout:ur},{isProperty:!0,key:"og:description",description:"Summary shown beneath the title when this page is shared",displayName:"Description",editorName:"OG Description",group:"General",popout:ur},{isProperty:!0,key:"og:url",description:"Canonical address of this page, so shares of different URLs are counted as the same page",displayName:"Url",editorName:"OG Url",group:"General",popout:ur},{isProperty:!0,key:"og:type",description:"What kind of thing this page is, which changes how the preview is laid out. The legal values are fixed by the Open Graph protocol, so this is a closed list rather than free text.",displayName:"Type",editorName:"OG Type",group:"General",type:{name:"enum",enums:["website","article","book","profile","video.movie","video.episode","video.tv_show","video.other","music.song","music.album","music.playlist","music.radio_station"].map(function(e){return{label:e,value:e}})},popout:ur},{isProperty:!0,key:"og:image",description:"Image shown in the share preview; it must be an absolute URL, not a project path",displayName:"Image",editorName:"OG Image",group:"Image",popout:ur},{isProperty:!0,key:"og:image:width",description:"Width of the share image in pixels, which lets a preview reserve space before the image loads",displayName:"Image Width",editorName:"OG Image Width",group:"Image",popout:ur},{isProperty:!0,key:"og:image:height",description:"Height of the share image in pixels",displayName:"Image Height",editorName:"OG Image Height",group:"Image",popout:ur},{isProperty:!1,key:"twitter:card",description:"Shape of the preview on X/Twitter. A closed list: anything else is ignored and the card falls back to a small summary.",displayName:"Card",editorName:"Twitter Card",group:"General",type:{name:"enum",enums:["summary","summary_large_image","app","player"].map(function(e){return{label:e,value:e}})},popout:cr},{isProperty:!1,key:"twitter:title",description:"Title shown when this page is shared on X/Twitter; falls back to the Open Graph title",displayName:"Title",editorName:"Twitter Title",group:"General",popout:cr},{isProperty:!1,key:"twitter:description",description:"Summary shown when this page is shared on X/Twitter",displayName:"Description",editorName:"Twitter Description",group:"General",popout:cr},{isProperty:!1,key:"twitter:image",description:"Image shown in the X/Twitter preview; it must be an absolute URL",displayName:"Image",editorName:"Twitter Image",group:"General",popout:cr}];function pr(n){var i=n.children,o=lr({},n.style);fn.size(o,n),fn.align(o,n);var r=function(){dr.forEach(function(e){var t=n.metatags&&n.metatags[e.key];Noodl.SEO.setMeta(e.key,t)})},s="undefined"!=typeof document;s||r(),(0,e.useEffect)(function(){s&&r()});var a=y(o);return t().createElement("div",lr({ref:Li(n.noodlNode)},Ui(n.dom),{style:o,className:v(n.className,a)}),i)}var hr=function(){return hr=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},hr.apply(this,arguments)},fr={name:"Page",displayNodeName:"Page",category:"Visuals",docs:"https://docs.noodl.net/nodes/navigation/page",useVariants:!1,mountedInput:!1,allowAsExportRoot:!1,singleton:!0,connectionPanel:{groupPriority:["General","Mounted"]},initialize:function(){this.props.layout="column"},nodeScopeDidInitialize:function(){this.isInputConnected("onPageReady")&&this.nodeScope.context.eventEmitter.emit("SSR_PageLoading",this.id)},defaultCss:{display:"flex",flexDirection:"column",position:"relative",alignItems:"flex-start",flex:"1 1",alignSelf:"stretch"},getReactComponent:function(){return pr},noodlNodeAsProp:!0,inputs:{title:{index:1,displayName:"Title",description:"The page's title, used as the document title while this page is showing; defaults to the component name",group:"General",type:"string",set:function(e){this._internal.title=e,this._internal.onTitleChanged&&this._internal.onTitleChanged()}},urlPath:{index:2,displayName:"Url Path",description:'The URL pattern that routes to this page, e.g. "product/{productId}" — placeholders become path parameters a Page Inputs node reads',group:"General",type:"string",set:function(e){this._internal.urlPath=e}},keepWhenLeaving:{index:3,displayName:"Keep When Leaving",description:"Keeps this page as it was when someone leaves it through its Router, so coming back shows it as they left it, its components' state included. A kept page stays in memory while hidden, and its Repeat and Delay clocks pause until it shows again. Off: the page is built fresh on every visit",group:"General",type:"boolean",default:!1,set:function(e){this._internal.keepWhenLeaving=!!e}},onPageReady:{displayName:"Page Ready",description:"Pulse this once the page has the data it needs; the SSR server holds the rendered HTML until it fires. Unconnected pages render as soon as the runtime settles",group:"Server Side Rendering",type:"signal",valueChangedToTrue:function(){var e=this.beginOutcome();this.nodeScope.context.eventEmitter.emit("SSR_PageReady",this.id),this.reportOutcome(e,"done")}},sitemapIncluded:{index:80001,displayName:"Included",description:"Lists this page in the generated sitemap",group:"Experimental Sitemap",default:!0,type:{name:"boolean",allowEditOnly:!0}},sitemapChangefreq:{index:80002,displayName:"Change Freq",description:"How often this page changes, as a hint to search-engine crawlers in the sitemap",group:"Experimental Sitemap",default:"weekly",type:{name:"enum",allowEditOnly:!0,enums:[{label:"always",value:"always"},{label:"hourly",value:"hourly"},{label:"daily",value:"daily"},{label:"weekly",value:"weekly"},{label:"monthly",value:"monthly"},{label:"yearly",value:"yearly"},{label:"never",value:"never"}]}},sitemapPriority:{index:80003,displayName:"Priority",description:"This page's importance relative to the rest of the site, from 0 to 1, in the sitemap",group:"Experimental Sitemap",default:.5,type:{name:"number",allowEditOnly:!0}}},outputs:hr({},(0,Ni.outcomeOutputs)({done:"Fires once the page has announced that it is ready to render"})),inputProps:dr.reduce(function(e,t,n){return e[t.key]={index:8e4+n,displayName:t.displayName,editorName:t.editorName||t.displayName,description:t.description,propPath:"metatags",group:t.group,popout:t.popout,type:t.type||"string"},e},{}),methods:{getUrlPath:function(){return this._internal.urlPath},getTitle:function(){return this._internal.title},setTitle:function(e){this._internal.title=e,this._internal.onTitleChanged&&this._internal.onTitleChanged()},setUrlPath:function(e){this._internal.urlPath=e}},setup:function(e,t){if(e.editorConnection&&e.editorConnection.isRunningLocally()){var n=e.editorConnection;t.on("editorImportComplete",function(){t.on("nodeAdded.Page",function(e){i(e)}),t.on("componentRenamed",function(e){var n=t.getNodesWithType("Page").filter(function(t){return e.roots.includes(t.id)});n.length>0&&i(n[0])});for(var e=0,n=t.getNodesWithType("Page");e<n.length;e++)i(n[e])})}function i(e){function t(){var t=[],i=e.component.name.split("/");t.push({name:"title",displayName:"Title",type:"string",group:"General",plug:"input",default:i[i.length-1]});var o=(e.parameters.title||i[i.length-1]).toLowerCase().replace(/[\s:/?#[\]@!$&'()*+,;=%"<>\\^`{|}]+/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");t.push({name:"urlPath",displayName:"Url Path",type:"string",group:"General",plug:"input",default:o}),n.sendDynamicPorts(e.id,t)}t(),e.on("parameterUpdated",function(e){"title"===e.name&&t()})}}};Xn.addPaddingInputs(fr);const gr=Si(fr);var mr=function(){return mr=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},mr.apply(this,arguments)},yr=function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((i=i.apply(e,t||[])).next())})},vr=function(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};function br(n){var i=n.didMount,o=n.willUnmount,r=n.children,s=n.style;return(0,e.useEffect)(function(){return i(),function(){o()}},[]),t().createElement("div",mr({ref:Li(n.noodlNode)},Ui(n.dom),{className:n.className,style:s}),r)}function wr(e){return"/"===e[0]&&(e=e.substring(1)),"/"===e[e.length-1]&&(e=e.substring(0,e.length-1)),e}function _r(e){try{return decodeURIComponent(e)}catch(t){return e}}function Sr(e){if(void 0!==e)return{path:e.path,title:e.title,component:e.component}}var Or=["router/no-pages","router/no-start-page","router/page-not-found","router/component-is-not-a-page"],Nr={name:"Router",displayNodeName:"Page Router",category:"Visuals",docs:"https://docs.noodl.net/nodes/navigation/page-router",allowAsExportRoot:!0,useVariants:!1,noodlNodeAsProp:!0,connectionPanel:{groupPriority:["General","Actions","Events","Mounted"]},initialize:function(){var e=this;this._internal.asyncQueue=new Qo,this.onScheduleReset=function(){e.scheduleReset()},this.props.didMount=function(){e._internal.isMounted||(e._internal.isMounted=!0,"undefined"!=typeof window&&(window.history&&window.history.pushState?window.addEventListener("popstate",e.onScheduleReset):window.addEventListener("hashchange",e.onScheduleReset)),e._registerRouter())},this.props.willUnmount=function(){e._internal.isMounted=!1,"undefined"!=typeof window&&(window.removeEventListener("popstate",e.onScheduleReset),window.removeEventListener("hashchange",e.onScheduleReset)),e._deregisterRouter()},this.props.layout="column",this.addDeleteListener(function(){return e._deleteKeptPages()})},getInspectInfo:function(){return this._internal.currentUrl},defaultCss:{flex:"1 1",alignSelf:"stretch",position:"relative",display:"flex",flexDirection:"column"},getReactComponent:function(){return br},inputs:{name:{type:"string",displayName:"Name",group:"General",description:"Name the Navigate nodes address this router by; leave it blank if there is only one",set:function(e){this._deregisterRouter(),this._internal.name=e,this._internal.isMounted&&this._registerRouter()}},pages:{type:{name:"pages",allowEditOnly:!0},displayName:"Pages",description:"The components this router can show, and which of them is the start page",group:"Pages",set:function(e){this._internal.pages=e,this._internal.isMounted&&this.scheduleReset()}},urlPath:{type:"string",displayName:"Url path",description:"Path segment prefixed to every page of this router, for nesting one router inside another",group:"General",set:function(e){this._internal.urlPath=null===e?void 0:e}},clip:{displayName:"Clip Behavior",description:"What happens when a page is taller than the router: grow to fit it, scroll it, or clip it",type:{name:"enum",enums:[{value:"contentHeight",label:"Expand to content size"},{value:"scroll",label:"Scroll"},{value:"clip",label:"Clip content"}]},group:"Layout",default:"contentHeight",set:function(e){switch(e){case"scroll":this.setStyle({overflow:"auto"});break;case"clip":this.setStyle({overflow:"hidden"});break;default:this.removeStyle(["overflow"])}}},reset:{type:"signal",displayName:"Reset",description:"Re-reads the URL and rebuilds the current page from scratch",group:"Actions",valueChangedToTrue:function(){this.scheduleReset(this.beginOutcome())}}},inputCss:{backgroundColor:{type:"color",displayName:"Background Color",description:"Fill colour behind whichever page is showing",group:"Style",default:"transparent",applyDefault:!1}},outputs:mr(mr({},(0,Ni.outcomeOutputs)({done:"Fires once the page has been rebuilt, or its Page Inputs updated with new parameters",unchanged:"Fires when the Router is already showing that page with those parameters, so nothing needed rebuilding",failure:"Fires when the Router has no Pages, no start page, a start page it does not serve, or a routed component that is not a page"})),{currentPageTitle:{type:"string",group:"General",displayName:"Current Page Title",description:"Title of the page currently showing, taken from the Pages list",getter:function(){return void 0!==this._internal.currentPage?this._internal.currentPage.title:void 0}},currentPageComponent:{type:"string",group:"General",displayName:"Current Page Component",description:"Component name of the page currently showing",getter:function(){return void 0!==this._internal.currentPage?this._internal.currentPage.component:void 0}}}),methods:{_registerRouter:function(){We.u.instance.registerRouter(this._internal.name,this)},_deregisterRouter:function(){We.u.instance.deregisterRouter(this._internal.name,this)},setPageOutputs:function(e){for(var t in e)this._internal[t]=e[t],this.flagOutputDirty(t)},scheduleReset:function(e){var t=this,n=this._internal;void 0!==e&&(void 0===n.pendingResetOutcomes&&(n.pendingResetOutcomes=[]),n.pendingResetOutcomes.push(e)),n.hasScheduledReset||(n.hasScheduledReset=!0,this.scheduleAfterInputsHaveUpdated(function(){n.hasScheduledReset=!1;var e=n.pendingResetOutcomes;n.pendingResetOutcomes=void 0,t.reset(e)}))},_clearResetWarnings:function(e){var t=this.context&&this.context.editorConnection;if(t&&"function"==typeof t.clearWarning){var n=this.nodeScope&&this.nodeScope.componentOwner,i=n&&n.name;if(i)for(var o=0,r=Or;o<r.length;o++){var s=r[o];s!==e&&t.clearWarning(i,this.id,s)}}},_reportReset:function(e,t,n){if(this._clearResetWarnings("failure"===t&&n?n.code:void 0),void 0!==e&&0!==e.length)for(var i=0,o=e;i<o.length;i++){var r=o[i];this.reportOutcome(r,t,n)}else"failure"===t&&n&&this.raiseRuntimeError(n.code,n.message)},_leaveCurrentPage:function(){var e=this.getChildren();for(var t in e){var n=e[t];this.removeChild(n);var i=n._isl004Page;if(i&&Cr(i.content)){this._internal.keptPages||(this._internal.keptPages=new Map);var o=this._internal.keptPages.get(i.key);o&&o!==n&&this.nodeScope.deleteNode(o),xr(i.content,function(e){return e._onPageHidden&&e._onPageHidden()}),this._internal.keptPages.set(i.key,n)}else this.nodeScope.deleteNode(n)}},_takeKeptPage:function(e,t){var n=this._internal.keptPages&&this._internal.keptPages.get(e);if(n){if(this._internal.keptPages.delete(e),Tr(n._isl004Page.params,t))return n;this.nodeScope.deleteNode(n)}},_nameTabFromPage:function(e){var t=this,n=e&&e.nodeScope?e.nodeScope.getNodesWithType("Page"):void 0,i=n&&1===n.length&&n[0]._internal&&"function"==typeof n[0].getTitle?n[0]:void 0,o=function(){if(t._internal.currentPageComponent===e&&t._internal.currentPage){var n=i?i.getTitle():void 0;Noodl.SEO.setTitle(null!=n&&""!==n?String(n):t._internal.currentPage.title)}};i&&(i._internal.onTitleChanged=o),o()},_showKeptPage:function(e){xr(e,function(e){return e._onPageShown&&e._onPageShown()})},_deleteKeptPages:function(){var e=this;this._internal.keptPages&&(this._internal.keptPages.forEach(function(t){return e.nodeScope.deleteNode(t)}),this._internal.keptPages.clear())},createPageContainer:function(){var e=this.nodeScope.createPrimitiveNode("Group");return e.setStyle({flex:"1 0 100%"}),e},reset:function(e){if(void 0===e&&void 0===this._internal.pages&&!this._internal.resetWaitedForInputs)return this._internal.resetWaitedForInputs=!0,void this.scheduleReset();this._internal.resetWaitedForInputs=!1,this._internal.asyncQueue.enqueue(this.resetAsync.bind(this,e))},scrollToTop:function(){var e=this.getDOMElement();e&&(e.scrollTop=0,r().instance.getProjectSettings().bodyScroll&&e.scrollIntoView())},resetAsync:function(e){return yr(this,void 0,void 0,function(){var t,n,i,o,r,s,a,l,u;return vr(this,function(c){switch(c.label){case 0:return n={},(i=this.matchPageFromUrl())&&i.page?(t=i.page.component,n=Object.assign({},i.params,i.query)):(t=void 0!==this._internal.pages?this._internal.pages.startPage:void 0,n=i?Object.assign({},i.params,i.query):{}),void 0===t?(void 0===this._internal.pages?this._reportReset(e,"failure",{code:"router/no-pages",message:"This Router has no Pages configured, so it has nothing to show — add the components it should route between to its Pages list"}):this._reportReset(e,"failure",{code:"router/no-start-page",message:"This Router has no start page, so it has nothing to show on load — pick one in its Pages list"}),[2]):void 0===(o=We.u.instance.getPageInfoForComponent(t))?(this._reportReset(e,"failure",{code:"router/page-not-found",message:'"'.concat(t,"\" is not a page of this Router, so it cannot be shown — check the Router's Pages list")}),[2]):Tr(this._internal.currentPageSnapshot,Sr(o))?(Tr(this._internal.currentParams,n)?this._reportReset(e,"unchanged"):(this._internal.currentParams=n,this._updatePageInputs(this._internal.currentPageComponent.nodeScope,n),this._reportReset(e,"done")),[2]):(this.scrollToTop(),this._leaveCurrentPage(),(r=this._takeKeptPage(t,n))?(a=r._isl004Page.content,[3,3]):[3,1]);case 1:return[4,this.nodeScope.createNode(t,(0,Zi.A)())];case 2:a=c.sent(),c.label=3;case 3:return void 0===(l=(s=a).nodeScope.getNodesWithType("Page"))||1!==l.length?(this.nodeScope.deleteNode(s),this._internal.currentPage=void 0,this._internal.currentPageSnapshot=void 0,this._internal.currentPageComponent=void 0,this.flagOutputDirty("currentPageComponent"),this._reportReset(e,"failure",{code:"router/component-is-not-a-page",message:'"'.concat(t,'" cannot be shown by this Router: a routed component must contain exactly one Page node, and this one has ').concat(void 0===l||0===l.length?"none":l.length)}),[2]):(this._internal.currentPageComponent=s,this._internal.currentPage=o,this._internal.currentPageSnapshot=Sr(o),this._internal.currentParams=n,this.flagOutputDirty("currentPageTitle"),this.flagOutputDirty("currentPageComponent"),this._nameTabFromPage(s),this._updatePageInputs(this._internal.currentPageComponent.nodeScope,n),u=r||this.createPageContainer(),r||(u.addChild(s),u._isl004Page={key:t,params:n,content:s}),this.addChild(u),r&&this._showKeptPage(s),this._reportReset(e,"done"),[2])}})})},_updatePageInputs:function(e,t){for(var n=0,i=e.getNodesWithType("PageInputs");n<i.length;n++)i[n]._setPageParams(t)},getRelativeURL:function(e,t){if(e){var n=e.path;if(void 0!==n){var i=n.match(/{([^}]+)}/g),o=Object.assign({},t);if(i)for(var r=0,s=i;r<s.length;r++){var a=s[r];void 0!==t[u=a.replace(/[{}]/g,"")]&&(n=n.replace(a,encodeURIComponent(o[u])),delete o[u])}var l=[];for(var u in o)l.push({name:u,value:encodeURIComponent(o[u])});return n=wr(n),void 0!==this._internal.urlPath&&(n=wr(this._internal.urlPath)+"/"+n),{path:n,query:l}}}},getNavigationAbsoluteURL:function(e,t){for(var n=this.parent,i={path:"",query:[]};void 0!==n&&"function"!=typeof n.getNavigationAbsoluteURL;)n=n.getVisualParentNode();n&&(i=n.getNavigationAbsoluteURL(n._internal.currentPage,n._internal.currentParams));var o=this.getRelativeURL(e,t);if(o){var r=i.path.endsWith("/")||o.path.startsWith("/");return{path:i.path+(r?"":"/")+o.path,query:i.query.concat(o.query)}}return i},_getLocationPath:function(){var e=r().instance.getProjectSettings().navigationPathType;if(void 0===e||"hash"===e){var t=location.hash;return t&&("#"===t[0]&&(t=t.substring(1)),"/"===t[0]&&(t=t.substring(1))),t}var n=location.pathname;if(n&&"/"===n[0]){var i=Noodl.Env.BaseUrl;if(i){var o=function(e){if(!e.startsWith("/"))try{return new URL(e).pathname.length}catch(e){}return e.length}(i);n=n.substring(o)}else n=n.substring(1)}return n},_getSearchParams:function(){for(var e,t=/\+/g,n=/([^&=]+)=?([^&]*)/g,i=function(e){var n=e.replace(t," ");try{return decodeURIComponent(n)}catch(e){return n}},o=location.search.substring(1),r={};e=n.exec(o);)r[i(e[1])]=i(e[2]);return r},getNavigationRemainingPath:function(){return this._internal.remainingNavigationPath},matchPageFromUrl:function(){for(var e=this.parent;void 0!==e&&"function"!=typeof e.getNavigationRemainingPath;)e=e.getVisualParentNode();var t=void 0;if(void 0===e){var n=this._getLocationPath();"/"===n[0]&&(n=n.substring(1)),t=n.split("/").map(_r)}else t=e.getNavigationRemainingPath();if(void 0!==t){var i=this._getSearchParams(),o=We.u.instance.getPagesForRouter(this._internal.name);if(void 0!==o&&0!==o.length){for(var r,s=9999,a=0,l=o;a<l.length;a++){var u=l[a],c=u.path;if(void 0!==c){c=wr(c),void 0!==this._internal.urlPath&&(c=wr(this._internal.urlPath)+"/"+c);var d=c.split("/"),p=f(t,d),h=Math.abs(d.length-t.length);p&&s>h&&(r={match:p,pageInfo:u},s=h)}}return r?(this._internal.remainingNavigationPath=r.match.remainingPathParts,{page:r.pageInfo,params:r.match.params,query:i}):{page:void 0,params:{},query:i}}}function f(e,t){for(var n={},i=0;i<t.length;i++){var o=t[i];if("{"===o[0]&&"}"===o[o.length-1])void 0!==e[i]&&(n[o.substring(1,o.length-1)]=e[i]);else if(void 0===e[i]||o!==e[i])return}return{params:n,remainingPathParts:e.slice().splice(t.length)}}},_getCompleteUrlToPage:function(e,t){var n,i,o=this.getNavigationAbsoluteURL(e,t),s=r().instance.getProjectSettings().navigationPathType;void 0===s||"hash"===s?i=o.path:n=o.path;var a=o.query.map(function(e){return e.name+"="+e.value});return(void 0!==n?n:"")+(a.length>=1?"?"+a.join("&"):"")+(void 0!==i?"#"+i:"")},_updateUrlWithTopPage:function(){if("undefined"!=typeof window&&void 0!==window.history){this._internal.remainingNavigationPath=void 0;var e=this._getCompleteUrlToPage(this._internal.currentPage,this._internal.currentParams);window.history.pushState({},"",e)}},navigate:function(e){this._internal.asyncQueue.enqueue(this.navigateAsync.bind(this,e))},navigateAsync:function(e){return yr(this,void 0,void 0,function(){var t,n;return vr(this,function(i){switch(i.label){case 0:return void 0===e.target?(e.hasFailed&&e.hasFailed("navigate/no-target-page","No Target Page is set on this Navigate node"),[2]):(t=We.u.instance.getPageInfoForComponent(e.target))?e.openInNewTab?(n=this._getCompleteUrlToPage(t,e.params),"undefined"!=typeof window&&window.open(n,"_blank"),e.hasNavigated&&e.hasNavigated(),[3,3]):[3,1]:(e.hasFailed&&e.hasFailed("navigate/page-not-found",'"'.concat(e.target,"\" is not a page of this Router — check the Target Page against the Router's Pages")),[2]);case 1:return[4,this._navigateInCurrentWindow(t,e)];case 2:i.sent(),i.label=3;case 3:return[2]}})})},_navigateInCurrentWindow:function(e,t){return yr(this,void 0,void 0,function(){return vr(this,function(n){switch(n.label){case 0:return Tr(this._internal.currentPageSnapshot,Sr(e))&&Tr(this._internal.currentParams,t.params)?(t.hasUnchanged&&t.hasUnchanged(),[2]):[4,this._buildPage(e,t)];case 1:return n.sent(),[2]}})})},_buildPage:function(e,t){return yr(this,void 0,void 0,function(){var n,i,o,r,s;return vr(this,function(a){switch(a.label){case 0:return this.scrollToTop(),this._leaveCurrentPage(),n=this._takeKeptPage(t.target,t.params),i=n||this.createPageContainer(),n?(r=n._isl004Page.content,[3,3]):[3,1];case 1:return[4,this.nodeScope.createNode(t.target,(0,Zi.A)())];case 2:r=a.sent(),a.label=3;case 3:return o=r,this._internal.currentPageComponent=o,this._internal.currentPage=e,this._internal.currentPageSnapshot=Sr(e),this._internal.currentParams=t.params,this.flagOutputDirty("currentPageTitle"),this.flagOutputDirty("currentPageComponent"),this._nameTabFromPage(o),void 0!==(s=o.nodeScope.getNodesWithType("PageInputs"))&&s.length>0&&s.forEach(function(e){e._setPageParams(t.params)}),n||(i.addChild(o),i._isl004Page={key:t.target,params:t.params,content:o}),this.addChild(i),n&&this._showKeptPage(o),this._updateUrlWithTopPage(),t.hasNavigated&&t.hasNavigated(),We.u.instance.onNavigated(this._internal.name,e),[2]}})})},registerInputIfNeeded:function(e){this.hasInput(e)}}};function Cr(e){var t=e&&e.nodeScope?e.nodeScope.getNodesWithType("Page"):void 0;return!!(t&&1===t.length&&t[0]._internal&&t[0]._internal.keepWhenLeaving)}function xr(e,t){if(e&&e.nodeScope)for(var n=0,i=e.nodeScope.getAllNodesRecursive();n<i.length;n++)t(i[n])}function Tr(e,t){var n=Object.keys(e||{}),i=Object.keys(t||{});return n.length===i.length&&n.every(function(n){return e[n]===t[n]})}const kr=Si(Nr);var Er=function(){return Er=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Er.apply(this,arguments)},Ir={name:"net.noodl.externallink",displayNodeName:"External Link",docs:"https://docs.noodl.net/nodes/navigation/external-link",category:"Navigation",nodeDoubleClickAction:{focusPort:"link"},inputs:{link:{group:"Values",type:"string",displayName:"Link",description:"Web address to open; one with no scheme is resolved relative to the page the app is served from"},openInNewTab:{group:"Values",type:"boolean",displayName:"Open In New Tab",default:!0,description:"Opens the link in a new tab; when off the current page is replaced and the app unloads"},do:{group:"Actions",type:"signal",displayName:"Do",description:"Opens Link, or fires Failure if there is no Link or the link was opened outside a user action",valueChangedToTrue:function(){var e,t=this.beginOutcome();if("undefined"!=typeof window){var n=this.getInputValue("openInNewTab"),i=n?"noopener,noreferrer":"",o=!0===n||void 0===n?"_blank":"_self",r=this.getInputValue("link");if(null==r||""===r)return this._internal.lastError="No link to open",this.flagOutputDirty("error"),void this.reportOutcome(t,"failure",{code:"external-link/no-link",message:"No link to open"});var s=null===(e=window.navigator)||void 0===e?void 0:e.userActivation,a="_blank"===o&&"boolean"==typeof(null==s?void 0:s.isActive)&&!s.isActive;if(window.open(r,o,i),a)return this._internal.lastError="The browser blocked opening a new tab",this.flagOutputDirty("error"),void this.reportOutcome(t,"failure",{code:"external-link/blocked",message:"The browser blocked opening a new tab — this usually means the link was not opened directly from a user action",detail:{link:r}});this.reportOutcome(t,"done")}else this.reportOutcome(t,"unchanged")}}},outputs:Er(Er({},(0,Ni.outcomeOutputs)({done:"Fires once the link has been handed to the browser. It does not promise a tab appeared — nothing readable in the page does, once Open In New Tab is on. With it off the page is replaced, so nothing downstream of this may still exist",unchanged:"Fires when there is no browser to open a link in — a server-side render, where there is nothing to do and nothing to fail at",failure:"Fires when no Link was set, or when the link was opened outside a user action — the case a browser refuses a new tab for. A tab blocked for any other reason still reports Done"})),{error:{type:"string",displayName:"Error",group:"Error",description:"Why the link could not be opened, set just before Failure fires",getter:function(){return this._internal.lastError}}})};const Pr={node:Ir};var Rr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ar=function(){return Ar=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ar.apply(this,arguments)};function Dr(e,t,n,i){var o=(i-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}function Fr(e,t,n,i,o){o%360==i%360&&(o-=1e-4);var r=Dr(e,t,n,o),s=Dr(e,t,n,i),a=o-i<=180?"0":"1";return["M",r.x,r.y,"A",n,n,0,a,0,s.x,s.y,"L",e,t,"L",r.x,r.y].join(" ")}function Mr(e,t,n){void 0===n&&(n=1);var i=e/2,o=e/2*n,r=t-Math.PI/2;return{x:i+o*Math.cos(r),y:i+o*Math.sin(r)}}function jr(e,t){var n=t.x-e.x,i=t.y-e.y,o=Math.hypot(n,i)||1;return{x:n/o,y:i/o,len:o}}function Vr(e,t){if(!(t>0))return function(e){return e.map(function(e,t){return"".concat(0===t?"M":"L"," ").concat(e.x," ").concat(e.y)}).join(" ")+" Z"}(e);for(var n=e.length,i=[],o=null,r=0;r<n;r++){var s=e[r],a=e[(r-1+n)%n],l=e[(r+1)%n],u=jr(s,a),c=jr(s,l),d=Math.max(-1,Math.min(1,u.x*c.x+u.y*c.y)),p=Math.acos(d),h=Math.tan(p/2);if(!isFinite(h)||h<=1e-6||p>=Math.PI-1e-6)null===o?(o=s,i.push("M ".concat(s.x," ").concat(s.y))):i.push("L ".concat(s.x," ").concat(s.y));else{var f=Math.min(t/h,u.len/2,c.len/2),g=f*h,m={x:s.x+u.x*f,y:s.y+u.y*f},y={x:s.x+c.x*f,y:s.y+c.y*f},v=(s.x-a.x)*(l.y-s.y)-(s.y-a.y)*(l.x-s.x)>0?1:0;null===o?(o=m,i.push("M ".concat(m.x," ").concat(m.y))):i.push("L ".concat(m.x," ").concat(m.y)),i.push("A ".concat(g," ").concat(g," 0 0 ").concat(v," ").concat(y.x," ").concat(y.y))}}return i.join(" ")+" Z"}function Lr(e,t,n){switch(e){case"square":return function(e){return[{x:0,y:0},{x:e,y:0},{x:e,y:e},{x:0,y:e}]}(t);case"triangle":return function(e){return[{x:e/2,y:0},{x:e,y:e},{x:0,y:e}]}(t);case"polygon":return function(e,t){var n=Math.max(3,Math.round(t));return Array.from({length:n},function(t,i){return Mr(e,2*i*Math.PI/n)})}(t,n);default:return function(e,t){for(var n=Math.max(3,Math.round(t)),i=function(e){var t=Math.cos(2*Math.PI/e)/Math.cos(Math.PI/e);return Math.max(.2,Math.min(.9,t))}(n),o=[],r=0;r<n;r++)o.push(Mr(e,2*r*Math.PI/n)),o.push(Mr(e,2*(r+.5)*Math.PI/n,i));return o}(t,n)}}var Ur=function(e){function n(t){return e.call(this,t)||this}return Rr(n,e),n.prototype.render=function(){var e,n,i,o=this.props.shape||"circle",r=this.props.size/2,s=this.props,a=s.startAngle,l=s.endAngle,u=null;if("svg"===o)u=t().createElement("span",{"data-ndl-drawing":"",style:{display:"block",width:this.props.size,height:this.props.size},dangerouslySetInnerHTML:{__html:zi(Wi(this.props.svgSource))}});else if("circle"===o){if(this.props.fillEnabled&&(n=t().createElement("path",{d:Fr(r,r,r,a,l),fill:this.props.fillColor})),this.props.strokeEnabled){var c=this.props,d=c.strokeColor,p=c.strokeWidth,h=c.strokeLineCap,f=function(e,t,n,i,o){o%360==i%360&&(o-=1e-4);var r=Dr(e,t,n,o),s=Dr(e,t,n,i),a=o-i<=180?"0":"1";return["M",r.x,r.y,"A",n,n,0,a,0,s.x,s.y].join(" ")}(r,r,r-this.props.strokeWidth/2,a,l);i=t().createElement("path",{d:f,stroke:d,strokeWidth:p,fill:"transparent",strokeLinecap:h})}}else{var g=function(e){var t=Math.round(Number(null!=e?e:5));return Number.isFinite(t)?Math.min(500,Math.max(3,t)):5}(this.props.points),m=Math.max(0,null!==(e=this.props.cornerRadius)&&void 0!==e?e:0),b=Lr(o,this.props.size,g);if(this.props.fillEnabled&&(n=t().createElement("path",{d:Vr(b,m),fill:this.props.fillColor})),this.props.strokeEnabled){var w=this.props,_=(d=w.strokeColor,function(e,t){if(0===t)return e;var n=e.length,i=e.map(function(i,o){var r=e[(o+1)%n],s=r.x-i.x,a=r.y-i.y,l=Math.hypot(s,a)||1,u=-a/l*t,c=s/l*t;return{p:{x:i.x+u,y:i.y+c},q:{x:r.x+u,y:r.y+c}}});return e.map(function(e,t){var o,r=i[(t-1+n)%n],s=i[t];return null!==(o=function(e,t,n,i){var o=(t.x-e.x)*(i.y-n.y)-(t.y-e.y)*(i.x-n.x);if(Math.abs(o)<1e-6)return null;var r=((n.x-e.x)*(i.y-n.y)-(n.y-e.y)*(i.x-n.x))/o;return{x:e.x+r*(t.x-e.x),y:e.y+r*(t.y-e.y)}}(r.p,r.q,s.p,s.q))&&void 0!==o?o:e})}(b,(p=w.strokeWidth)/2));i=t().createElement("path",{d:Vr(_,Math.max(0,m-p/2)),stroke:d,strokeWidth:p,fill:"transparent"})}}var S=Ar({},this.props.style);fn.size(S,this.props),fn.align(S,this.props),0===S.opacity&&(S.pointerEvents="none");var O=y(S);return t().createElement("div",Ar({ref:Li(this.props.noodlNode),className:v(this.props.className,O)},this.props.dom,ki(this.props),{style:S}),null!=u?u:t().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:this.props.size,height:this.props.size},n,i))},n}(t().Component),Br={name:"Circle",displayName:"Shape",docs:"https://docs.noodl.net/nodes/basic-elements/circle",connectionPanel:{groupPriority:["General","Fill","Stroke","Dimensions","Style","Actions","Events","Mounted","Margin and padding","Pointer Events","Hover Events"]},getReactComponent:function(){return Ur},noodlNodeAsProp:!0,allowChildren:!1,defaultCss:{flexShrink:0,position:"relative",display:"flex"},inputProps:{shape:{displayName:"Shape",description:"Which outline this element draws inside its Size × Size box",default:"circle",group:"General",type:{name:"enum",enums:[{label:"Circle",value:"circle"},{label:"Square",value:"square"},{label:"Triangle",value:"triangle"},{label:"Polygon",value:"polygon"},{label:"Star",value:"star"},{label:"Custom SVG",value:"svg"}]},index:5,allowVisualStates:!0},points:{displayName:"Points",description:"How many sides a Polygon has, or how many points a Star has, from 3 to 500; a value that is not a number draws 5",default:5,group:"General",type:{name:"number"},index:6,allowVisualStates:!0},svgSource:{displayName:"SVG Source",description:"Your own SVG markup, drawn inside the Size box. Script, event handlers, styles, animation and remote references are removed before it renders",default:"",group:"General",type:{name:"string",allowEditOnly:!0,codelanguage:"xml"},index:8,allowVisualStates:!1},cornerRadius:{displayName:"Corner Radius",description:"Rounds the corners of the straight-edged shapes, in pixels; it stops at the roundest the shape can be",default:0,group:"General",type:{name:"number"},index:7,allowVisualStates:!0},size:{displayName:"Size",description:"Diameter of the circle in pixels; it sets both width and height",default:"100",group:"Dimension",type:{name:"number"},index:10,allowVisualStates:!0},fillEnabled:{group:"Fill",displayName:"Fill",description:"Draws the inside of the circle; turn it off for an outline only",default:!0,type:"boolean",index:20,allowVisualStates:!0},fillColor:{group:"Fill",displayName:"Fill Color",description:"Colour of the inside of the circle, which has no effect while Fill is off",default:"red",type:"color",index:21,allowVisualStates:!0},strokeEnabled:{index:23,group:"Stroke",default:!1,displayName:"Stroke",description:"Draws an outline around the circle; the two ports below do nothing while it is off",type:"boolean",allowVisualStates:!0},strokeWidth:{index:24,group:"Stroke",displayName:"Stroke Width",description:"Thickness of the outline in pixels, drawn centred on the circle edge",default:10,type:{name:"number"},allowVisualStates:!0},strokeColor:{index:25,group:"Stroke",displayName:"Stroke Color",description:"Colour of the outline",type:"color",default:"black",allowVisualStates:!0},strokeLineCap:{index:26,group:"Stroke",displayName:"Line Cap",description:"Shape of the outline ends when Start and End Angle make an arc rather than a full circle",type:{name:"enum",enums:[{label:"Butt",value:"butt"},{label:"Round",value:"round"}]},default:"butt",allowVisualStates:!0},startAngle:{displayName:"Start Angle",description:"Where the arc begins, in degrees clockwise from the top",type:"number",default:0,group:"Style",index:198,allowVisualStates:!0},endAngle:{displayName:"End Angle",description:"Where the arc ends, in degrees clockwise from the top; 360 is a full circle",type:"number",default:360,group:"Style",index:199,allowVisualStates:!0}},dynamicports:[{condition:"shape = circle OR shape NOT SET",inputs:["startAngle","endAngle","strokeLineCap"]},{condition:"shape = polygon OR shape = star",inputs:["points"]},{condition:"shape = square OR shape = triangle OR shape = polygon OR shape = star",inputs:["cornerRadius"]},{condition:"shape = svg",inputs:["svgSource"]}]};Xn.addTransformInputs(Br),Xn.addMarginInputs(Br),Xn.addSharedVisualInputs(Br),Xn.addAlignInputs(Br),Xn.addPointerEventOutputs(Br),Xn.addFileDropPorts(Br),Xn.addDragDropPorts(Br);const Wr=Si(Br);var zr=__webpack_require__(2889),qr=function(){return qr=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},qr.apply(this,arguments)};function Hr(e){var t="number"==typeof e?e:parseFloat(e);return Number.isFinite(t)?t:0}function Gr(e){return"number"==typeof e?Number.isFinite(e)?"".concat(e,"px"):"0px":"string"!=typeof e||""===e.trim()?"0px":/^-?\d*\.?\d+$/.test(e.trim())?"".concat(e.trim(),"px"):e}function $r(e){var t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}function Xr(e){var t=e.split(" ").map($r).filter(function(e){return void 0!==e});return t.length?t:[1]}function Yr(e,t,n,i){var o=Kr(e,t,n,i),r=Kr(o.layout,t,n,i);return o.totalFractions===r.totalFractions?o:Yr(r.layout,t,n,i)}function Kr(e,t,n,i){var o=100/e.reduce(function(e,t){return e+t},0),r=e.reduce(function(e,r){return{expected:e.expected+o/100*n*r,min:e.min+t+i}},{expected:0,min:0}),s=e.slice();s.length>1&&r.expected<r.min&&s.pop();var a=s.reduce(function(e,t){return e+t},0);return{layout:s,totalFractions:a,fractionSize:100/a,columnAmount:s.length}}function Jr(e,t,n,i){var o=Hr(t.minWidth),r=Hr(t.marginX);if("number"!=typeof n){var s=Xr(e);return{layout:s,columnAmount:s.length,fractionSize:100/s.reduce(function(e,t){return e+t},0),breakpoint:"Default"}}if("autoFit"===t.sizing)return qr(qr({},function(e,t,n,i){var o=e+n,r=e>0&&o>0?Math.floor((t+n)/o):1,s=Math.max(1,void 0===i?r:Math.min(r,i));return{layout:new Array(s).fill(1),columnAmount:s,fractionSize:100/s}}(o,n,r,i)),{breakpoint:"Default"});var a=function(e,t,n){var i=Hr(t.smallBreakpoint),o=t.smallLayout?Qr(t.smallLayout):null;if(i>0&&o&&n<i)return{breakpoint:"Small",layoutString:o};var r=Hr(t.mediumBreakpoint),s=t.mediumLayout?Qr(t.mediumLayout):null;return r>0&&s&&n<r?{breakpoint:"Medium",layoutString:s}:{breakpoint:"Default",layoutString:e}}(e,t,n),l=Xr(a.layoutString);return qr(qr({},Yr(l,o,n,r)),{breakpoint:a.breakpoint})}function Qr(e){switch(typeof e){case"string":return e.trim()||null;case"number":return String(e).trim()||null;default:return null}}var Zr={marginTop:["marginY"],marginLeft:["marginX"],display:[],flexWrap:[],alignItems:["packing"],justifyContent:["justifyContent"],flexDirection:["direction"],width:["marginX"],boxSizing:[],position:["packing"],height:["packing"]};function es(n){var i,o=(0,e.useState)(null),r=o[0],s=o[1],a=(0,e.useState)(null),l=a[0],u=a[1],c=(0,e.useCallback)(function(e){var t;u(e),null===(t=n.noodlNode)||void 0===t||t.setDOMElement(e)},[]);(0,e.useEffect)(function(){if(l){if("undefined"!=typeof ResizeObserver){var e=new ResizeObserver(function(){var e,t;s((e=l,t=n.marginX,Math.max(0,e.offsetWidth-Hr(t))))});return e.observe(l),function(){e.disconnect()}}}else s(null)},[l,n.marginX]);var d,p,h=(d=n.children,{children:(p=(Array.isArray(d)?d:[d]).filter(function(t){return(0,e.isValidElement)(t)})).filter(function(e){return e.type!==zr.ForEachComponent}),forEachComponents:p.filter(function(e){return e.type===zr.ForEachComponent})}),f=h.children,g=h.forEachComponents,m="masonry"===n.packing,b=(0,e.useRef)([]),w=(0,e.useRef)(1),_=(0,e.useState)(null),S=_[0],O=_[1];(0,e.useLayoutEffect)(function(){if(m){var e=function(){var e=b.current.slice(0,f.length);if(e.length===f.length&&!e.some(function(e){return!e})){var t=function(e,t){var n=new Array(Math.max(1,t)).fill(0);return{tops:e.map(function(e,t){var i=t%n.length,o=n[i];return n[i]=o+e,o}),height:n.reduce(function(e,t){return Math.max(e,t)},0)}}(e.map(function(e){return e.offsetHeight}),w.current);O(function(e){return i=t,null!==(n=e)&&n.height===i.height&&n.tops.length===i.tops.length&&n.tops.every(function(e,t){return e===i.tops[t]})?e:t;var n,i})}};if(e(),"undefined"!=typeof ResizeObserver){var t=new ResizeObserver(e);return b.current.slice(0,f.length).forEach(function(e){return e&&t.observe(e)}),function(){return t.disconnect()}}}else O(null)},[m,f.length,r]);var N=Qr(n.layoutString),C=null===N?null:Jr(N,n,r,f.length),x=null!==(i=null==C?void 0:C.breakpoint)&&void 0!==i?i:"Default";if((0,e.useEffect)(function(){var e,t,i;null===(e=n.onBreakpointChanged)||void 0===e||e.call(n,x),"Medium"===x?null===(t=n.onAtMedium)||void 0===t||t.call(n):"Small"===x&&(null===(i=n.onAtSmall)||void 0===i||i.call(n))},[x]),!n.children)return null;if(null===C)return t().createElement(t().Fragment,null,n.children);var T=C.layout,k=C.columnAmount,E=C.fractionSize;w.current=k;var I=m?function(e,t){for(var n=[],i=0,o=0,r=e;o<r.length;o++){var s=r[o];n.push(i*t),i+=s}return n}(T,E):null,P=m&&null!==S&&S.tops.length===f.length,R=qr(qr(qr({marginTop:"calc(".concat(Gr(n.marginY)," * -1)"),marginLeft:"calc(".concat(Gr(n.marginX)," * -1)"),display:"flex",flexWrap:"wrap",alignItems:m?"flex-start":"stretch",justifyContent:n.justifyContent,flexDirection:n.direction,width:"calc(100% + ".concat(Gr(n.marginX),")"),boxSizing:"border-box"},m?{position:"relative"}:null),P?{height:S.height}:null),n.style),A=y(R,Zr);return t().createElement("div",qr({className:v(["columns-container",n.className].join(" "),A),ref:c},Ui(n.dom),{style:R}),g,f.map(function(e,i){var o,r=i%k;return t().createElement("div",{className:m?"column-item column-item--masonry":"column-item",key:null!==(o=e.key)&&void 0!==o?o:i,ref:m?function(e){b.current[i]=e}:void 0,style:qr({boxSizing:"border-box",paddingTop:n.marginY,paddingLeft:n.marginX,width:T[r]*E+"%",flexShrink:0,flexGrow:0,minWidth:n.minWidth},P?{position:"absolute",top:S.tops[i],left:I[r]+"%"}:null)},e)}))}function ts(e){var t=e.split(" ").filter(function(e){return""!==e});if(0===t.length)return"it has no entries, so one full-width column is rendered";var n=t.filter(function(e){return void 0===$r(e)});if(0!==n.length){var i=n.map(function(e){return JSON.stringify(e)}).join(", ");if(n.length===t.length)return"none of its ".concat(t.length," entries is a positive number (").concat(i,"), so one full-width column is rendered instead");var o=t.length-n.length;return"".concat(i," ").concat(1===n.length?"is not a positive number and is":"are not positive numbers and are"," dropped, ")+"so ".concat(t.length," columns were authored and ").concat(o," ").concat(1===o?"is":"are"," rendered")}}var ns={name:"net.noodl.visual.columns",displayName:"Columns",docs:"https://docs.noodl.net/nodes/basic-elements/columns",allowChildren:!0,noodlNodeAsProp:!0,connectionPanel:{groupPriority:["General","Style","Actions","Events","States","Mounted","Label","Label Text Style","Hover Events","Pointer Events","Focus Events"]},initialize:function(){this.props.layoutString="1 2 1",this.props.minWidth=0,this.props.marginX=16,this.props.marginY=16,this.props.direction="row",this.props.justifyContent="flex-start"},getReactComponent:function(){return es},inputs:{layoutString:{group:"Layout Settings",displayName:"Layout String",description:'Column widths as space-separated proportions, so "1 2 1" makes the middle column twice as wide',type:"string",default:"1 2 1",set:function(e){this.props.layoutString=e,this.revalidateLayoutStrings(),this.forceUpdate()}}},methods:{revalidateLayoutStrings:function(){for(var e=[],t=0,n=[["Layout String",this.props.layoutString],["Medium Layout",this.props.mediumLayout],["Small Layout",this.props.smallLayout]];t<n.length;t++){var i=n[t],o=i[0],r=i[1];if(null!=r&&""!==r)if("string"==typeof r){var s=ts(r);s&&e.push("".concat(o," (").concat(JSON.stringify(r),"): ").concat(s))}else e.push("".concat(o," is ").concat(typeof r,", not a string"))}var a="columns/layout-string-invalid";if(0!==e.length)this.raiseRuntimeError(a,"Columns cannot read every entry of its layout — ".concat(e.join("; "),'. Entries are space-separated positive numbers, so "1 2 1" makes three columns with a double-width middle one.'));else{var l=this.context&&this.context.editorConnection;l&&l.clearWarning&&l.clearWarning(this.nodeScope.componentOwner.name,this.id,a)}}},outputProps:{onBreakpointChanged:{displayName:"Breakpoint",description:"Which layout is in force: Default, Medium or Small. It is Default until the node has been measured, and while Column Sizing is Auto Fit, where no layout string is used",type:"string",group:"Breakpoints"},onAtMedium:{displayName:"At Medium",description:"Fires when the container narrows or widens into the Medium band, once per crossing",type:"signal",group:"Breakpoints"},onAtSmall:{displayName:"At Small",description:"Fires when the container narrows or widens into the Small band, once per crossing",type:"signal",group:"Breakpoints"}},inputProps:{sizing:{group:"Layout Settings",displayName:"Column Sizing",description:"Layout String sets the columns explicitly; Auto Fit derives them from Min Column Width and the space available",type:{name:"enum",enums:[{label:"Layout String",value:"layoutString"},{label:"Auto Fit",value:"autoFit"}]},default:"layoutString"},packing:{group:"Layout Settings",displayName:"Item Packing",description:"Rows makes every item in a row as tall as the tallest; Masonry lets each column pack independently",type:{name:"enum",enums:[{label:"Rows",value:"rows"},{label:"Masonry",value:"masonry"}]},default:"rows",tooltip:{rows:{standard:"Every item in a row is as tall as the tallest one in it",extended:In({title:"Rows",body:"Items fill left to right and wrap. Each row is as tall as its tallest item, so rows line up."})},masonry:{standard:"Items keep their own height and each column packs independently",extended:In({title:"Masonry",body:"Items still fill left to right — item 1 goes in the first column, item 2 in the second, and so on — but each column stacks its own items with no gaps, so nothing waits for the tallest item in its row. Columns are not made equal in height; the reading order is kept instead."})}}},mediumBreakpoint:{group:"Breakpoints",displayName:"Medium Below",description:"Container width below which Medium Layout replaces Layout String; this is the container, not the viewport",type:{name:"number",units:["px"],defaultUnit:"px"}},mediumLayout:{group:"Breakpoints",displayName:"Medium Layout",description:"Layout String to use below Medium Below; leaving it blank makes the breakpoint inert",type:"string",onChange:function(){this.revalidateLayoutStrings()}},smallBreakpoint:{group:"Breakpoints",displayName:"Small Below",description:"Container width below which Small Layout replaces the others; it wins over Medium Below",type:{name:"number",units:["px"],defaultUnit:"px"}},smallLayout:{group:"Breakpoints",displayName:"Small Layout",description:"Layout String to use below Small Below; leaving it blank makes the breakpoint inert. For more bands than these two, install the Advanced Columns prefab from the library — it drives these same inputs from a States node, so each band can set its own layout and gaps",type:"string",tooltip:In({title:"More than two breakpoints",body:["Medium and Small are the two this node has. They swap the layout string and nothing else.","For a third band, or for a different gap at each one, install the <b>Advanced Columns</b> prefab from the library — Prefabs tab of the node picker. It is a Columns node with a States node wired into these same inputs, shipped with four bands already set up, and you add or change a band by editing that States node."]}),onChange:function(){this.revalidateLayoutStrings()}},marginX:{group:"Layout Settings",displayName:"Horizontal Gap",description:"Space between columns, drawn as a gutter rather than as padding on the items",type:{name:"number",units:["px"],defaultUnit:"px"},default:16},marginY:{group:"Layout Settings",displayName:"Vertical Gap",description:"Space between rows",type:{name:"number",units:["px"],defaultUnit:"px"},default:16},minWidth:{group:"Constraints",displayName:"Min Column Width",description:"Columns are dropped from the end rather than shrink below this; with Auto Fit it decides how many there are",type:{name:"number",units:["px"],defaultUnit:"px"},default:0},direction:{group:"Layout Settings",displayName:"Layout Direction",description:"Whether items fill across rows or down columns",type:{name:"enum",enums:[{label:"Horizontal",value:"row"},{label:"Vertical",value:"column"}]},default:"row"},justifyContent:{group:"Justify Content",displayName:"Justify Content",description:"Where the columns sit as a group when they do not fill the container",type:{name:"enum",enums:[{label:"Start",value:"flex-start"},{label:"End",value:"flex-end"},{label:"Center",value:"center"}],alignComp:"align-items"},default:"flex-start"}}};const is=Si(ns);var os=new Map,rs={name:"CSS Definition",docs:"https://docs.noodl.net/nodes/utilities/css-definition",category:"CustomCode",color:"javascript",nodeDoubleClickAction:{focusPort:"Style"},initialize:function(){var e=this;this._internal.style="";var t=this.getStyleRefId();this.addDeleteListener(function(){os.set(t,os.get(t)-1),0===os.get(t)&&(e.removeStyleDeclaration(),os.delete(t))}),os.has(t)||os.set(t,0),os.set(t,os.get(t)+1)},inputs:{style:{index:4005,type:{name:"string",allowEditOnly:!0,codeeditor:"css"},displayName:"Style",group:"Content",default:"",description:"CSS added to the page for as long as this node exists, and removed with it",set:function(e){this.updateStyle(e)}}},outputs:{},methods:{getStyleRefId:function(){return"style_"+this.id},removeStyleDeclaration:function(){if("undefined"!=typeof document){var e=this.getStyleRefId(),t=document.getElementById(e);null!==t&&t.parentNode.removeChild(t)}},updateStyle:function(e){if("undefined"!=typeof document){var t=this._internal,n=this.getStyleRefId();if(t.style=e,null!==e){var i=document.getElementById(n);null===i&&((i=document.createElement("style")).id=n,i.type="text/css",document.head.appendChild(i)),i.innerHTML="\n"+e+"\n"}else this.removeStyleDeclaration()}}}};const ss={node:rs};var as=__webpack_require__(5412),ls=__webpack_require__.n(as),us=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),cs=function(){return cs=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},cs.apply(this,arguments)};function ds(e,t){t.positionX&&t.positionX(e.x),t.positionY&&t.positionY(e.y),t.deltaX&&t.deltaX(e.deltaX),t.deltaY&&t.deltaY(e.deltaY)}function ps(e,t){return e===t||"both"===e}var hs=function(e){function n(n){var i=e.call(this,n)||this;i.wrapperRef=t().createRef(),i.state={x:0,y:0};var o=i;return i.draggableNodeRef={get current(){if(o.wrapperRef.current)return o.wrapperRef.current;var e=o.props.noodlNode,t=e&&e.children&&e.children[0];return t&&t.getDOMElement?t.getDOMElement():null}},i}return us(n,e),n.prototype.reportDrag=function(e,t){var n=ps(t,"x"),i=ps(t,"y");ds({x:n?e.x:this.state.x,y:i?e.y:this.state.y,deltaX:n?e.deltaX:0,deltaY:i?e.deltaY:0},this.props)},n.prototype.positionOn=function(e){return this.mountedAt?this.mountedAt[e]:this.state[e]},n.prototype.snapToPosition=function(e){var t=e.timerScheduler,n=e.propCallback,i=e.duration,o=e.axis,r=e.endValue,s=this;return t.createTimer({duration:void 0===i?300:i,startValue:this.positionOn(o),endValue:r,ease:Qn.A.easeOut,onRunning:function(e){var t,i=this.ease(this.startValue,this.endValue,e);s.setState(((t={})[o]=i,t)),n&&n(i)}}).start()},n.prototype.stopSnapTimers=function(){this.snapToPositionXTimer&&this.snapToPositionXTimer.stop(),this.snapToPositionYTimer&&this.snapToPositionYTimer.stop(),this.snapToPositionXTimer=void 0,this.snapToPositionYTimer=void 0},n.prototype.componentWillUnmount=function(){this.stopSnapTimers()},n.prototype.componentDidMount=function(){var e=this,t=this.props.inputPositionX?this.props.inputPositionX:0,n=this.props.inputPositionY?this.props.inputPositionY:0;this.mountedAt={x:t,y:n},this.setState({x:t,y:n},function(){e.mountedAt=void 0}),ds({x:t,y:n,deltaX:0,deltaY:0},this.props)},n.prototype.componentDidUpdate=function(e){var t=this.props;Object.is(e.inputPositionX,t.inputPositionX)||(this.setState({x:t.inputPositionX}),t.positionX&&t.positionX(t.inputPositionX),t.deltaX&&t.deltaX(t.inputPositionX-e.inputPositionX)),Object.is(e.inputPositionY,t.inputPositionY)||(this.setState({y:t.inputPositionY}),t.positionY&&t.positionY(t.inputPositionY),t.deltaY&&t.deltaY(t.inputPositionY-e.inputPositionY))},n.prototype.snapToPositionX=function(e,t){this.positionOn("x")!==e&&(this.snapToPositionXTimer&&this.snapToPositionXTimer.stop(),this.snapToPositionXTimer=this.snapToPosition({timerScheduler:this.props.noodlNode.context.timerScheduler,propCallback:this.props.positionX,duration:t,axis:"x",endValue:e}))},n.prototype.snapToPositionY=function(e,t){this.positionOn("y")!==e&&(this.snapToPositionYTimer&&this.snapToPositionYTimer.stop(),this.snapToPositionYTimer=this.snapToPosition({timerScheduler:this.props.noodlNode.context.timerScheduler,propCallback:this.props.positionY,duration:t,axis:"y",endValue:e}))},n.prototype.render=function(){var e=this,n=this.props,i=n.useParentBounds?"parent":void 0,o=t().Children.toArray(n.children);if(0===o.length)return null;var r,s=cs(cs({},n.className?{className:n.className}:{}),n.style&&Object.keys(n.style).length>0?{style:n.style}:{}),a=1===o.length?t().cloneElement(o[0],cs({parentLayout:n.parentLayout},s)):t().createElement("div",{ref:this.wrapperRef,className:s.className,style:cs(cs({display:"flex",flexDirection:"column",flexShrink:0},"none"===n.parentLayout?{position:"absolute",left:0,top:0}:{position:"relative"}),s.style)},o.map(function(e){return t().cloneElement(e,{parentLayout:"column"})}));return t().createElement(ls(),{nodeRef:this.draggableNodeRef,axis:n.axis,bounds:i,disabled:(r=n.enabled,!(null==r||r&&"false"!==r)),cancel:"input, textarea, select, button, a, [contenteditable]",scale:n.scale||1,position:{x:this.state.x,y:this.state.y},onStart:function(t,i){e.reportDrag(i,n.axis),n.onStart&&n.onStart(),e.snapToPositionXTimer&&e.snapToPositionXTimer.stop(),e.snapToPositionYTimer&&e.snapToPositionYTimer.stop()},onStop:function(t,i){var o=ps(n.axis,"x")?i.x:e.state.x,r=ps(n.axis,"y")?i.y:e.state.y;e.setState({x:o,y:r}),n.positionX&&n.positionX(o),n.positionY&&n.positionY(r),n.onStop&&n.onStop()},onDrag:function(t,i){e.reportDrag(i,n.axis),n.onDrag&&n.onDrag()}},a)},n}(t().Component),fs=function(){return fs=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},fs.apply(this,arguments)};function gs(e){if(null!=e&&""!==e){var t=Number(e);return Number.isFinite(t)?t:Number.NaN}}var ms={name:"Drag",noDataAttributes:!0,docs:"https://docs.noodl.net/nodes/utilities/drag",allowChildren:!0,noodlNodeAsProp:!0,getReactComponent:function(){return hs},initialize:function(){var e=this;this._internal.snapPositionX=0,this._internal.snapPositionY=0,this._internal.snapDurationX=300,this._internal.snapDurationY=300,this.addDeleteListener(function(){e.innerReactComponentRef&&e.innerReactComponentRef.stopSnapTimers()})},inputs:{"snapToPositionX.do":{group:"Snap To Position X",displayName:"Do",editorName:"Do|Snap To Position X",type:"signal",description:"Animates the element to Value on the X axis; does nothing if it is already there",valueChangedToTrue:function(){var e=this;this.scheduleAfterInputsHaveUpdated(function(){var t=e._internal,n=t.snapPositionX,i=t.snapDurationX;e.outcomeOnInnerComponent(function(e){return e.snapToPositionX(n,i)},{code:"drag/snap-x-failed"})})}},"snapToPositionX.value":{default:0,group:"Snap To Position X",displayName:"Value",editorName:"Value|Snap To Position X",description:"X position the element animates to when Snap To Position X — Do fires. An empty value leaves the current position alone",type:"number",set:function(e){var t=gs(e);void 0!==t&&(Number.isNaN(t)?this.raiseRuntimeError("drag/snap-position-not-a-number","Snap To Position X — Value cannot be read as a number (got ".concat(JSON.stringify(e),"), so the snap position is unchanged.")):this._internal.snapPositionX=t)}},"snapToPositionX.duration":{default:300,group:"Snap To Position X",displayName:"Duration",editorName:"Duration|Snap To Position X",description:"How long the X snap animation takes, in milliseconds",type:"number",set:function(e){this._internal.snapDurationX=e}},"snapToPositionY.do":{group:"Snap To Position Y",displayName:"Do",editorName:"Do|Snap To Position Y",type:"signal",description:"Animates the element to Value on the Y axis; does nothing if it is already there",valueChangedToTrue:function(){var e=this;this.scheduleAfterInputsHaveUpdated(function(){var t=e._internal,n=t.snapPositionY,i=t.snapDurationY;e.outcomeOnInnerComponent(function(e){return e.snapToPositionY(n,i)},{code:"drag/snap-y-failed"})})}},"snapToPositionY.value":{default:0,group:"Snap To Position Y",displayName:"Value",editorName:"Value|Snap To Position Y",description:"Y position the element animates to when Snap To Position Y — Do fires. An empty value leaves the current position alone",type:"number",set:function(e){var t=gs(e);void 0!==t&&(Number.isNaN(t)?this.raiseRuntimeError("drag/snap-position-not-a-number","Snap To Position Y — Value cannot be read as a number (got ".concat(JSON.stringify(e),"), so the snap position is unchanged.")):this._internal.snapPositionY=t)}},"snapToPositionY.duration":{default:300,group:"Snap To Position Y",displayName:"Duration",editorName:"Duration|Snap To Position Y",description:"How long the Y snap animation takes, in milliseconds",type:"number",set:function(e){this._internal.snapDurationY=e}}},inputProps:{enabled:{group:"Drag",displayName:"Enabled",description:'Lets the user drag this element; when off (false, 0, empty or the text "false") it still renders and still responds to the Snap actions',type:"boolean",default:!0},axis:{group:"Drag",displayName:"Axis",description:"Which axes dragging is allowed on",type:{name:"enum",enums:[{label:"X",value:"x"},{label:"Y",value:"y"},{label:"Both",value:"both"}]},default:"x"},useParentBounds:{group:"Drag",displayName:"Constrain to parent",description:"Stops the element being dragged outside its parent's bounds",type:"boolean",default:!0},inputPositionX:{group:"Values",displayName:"Start Drag X",description:"Sets the X position the element starts at, before any dragging",type:{name:"number"},onChange:function(e){"string"==typeof e&&(this.props.inputPositionX=Number(e))}},inputPositionY:{group:"Values",displayName:"Start Drag Y",description:"Sets the Y position the element starts at, before any dragging",type:{name:"number"},onChange:function(e){"string"==typeof e&&(this.props.inputPositionY=Number(e))}},scale:{group:"Values",displayName:"Scale",description:"Divides pointer movement before it becomes element movement, so 2 makes the element move half as far as the pointer",default:1,type:{name:"number"}}},outputProps:fs({onStart:{group:"Events",type:"signal",displayName:"Drag Started",description:"Fires when the user starts dragging"},onStop:{group:"Events",type:"signal",displayName:"Drag Ended",description:"Fires when the user releases the element, including when the pointer leaves the window"},onDrag:{group:"Events",type:"signal",displayName:"Drag Moved",description:"Fires on every frame the element moves while being dragged"},positionX:{group:"Values",displayName:"Drag X",type:"number",description:"Current X position of the element relative to where it started"},positionY:{group:"Values",displayName:"Drag Y",type:"number",description:"Current Y position of the element relative to where it started"},deltaX:{group:"Values",displayName:"Delta X",type:"number",description:"How far the element moved on X since the last Drag Moved"},deltaY:{group:"Values",displayName:"Delta Y",type:"number",description:"How far the element moved on Y since the last Drag Moved"}},(0,Ni.outcomeOutputs)({done:"Fires once a snap animation has been started on the element",failure:"Fires when the snap never reached the element, because it has still not mounted"}))};const ys=Si(ms);var vs=function(e,t){return vs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},vs(e,t)};function bs(e,t){function n(){this.constructor=e}vs(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var ws=function(){return ws=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ws.apply(this,arguments)};function _s(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),o=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i}var Ss=[{sourceKey:"scroller.scrollBehaviorX.currentPos",key:"x"},{sourceKey:"scroller.scrollBehaviorY.currentPos",key:"y"},{sourceKey:"scroller.scrollBehaviorX.hasScroll",key:"hasHorizontalScroll"},{sourceKey:"scroller.scrollBehaviorY.hasScroll",key:"hasVerticalScroll"},{sourceKey:"scroller.scrollBehaviorX.contentSize",key:"scrollerWidth"},{sourceKey:"scroller.scrollBehaviorY.contentSize",key:"scrollerHeight"},{sourceKey:"scroller.scrollBehaviorX.maxScrollPos",key:"maxScrollX"},{sourceKey:"scroller.scrollBehaviorY.maxScrollPos",key:"maxScrollY"},{sourceKey:"scroller.scrollBehaviorX.minScrollPos",key:"minScrollX"},{sourceKey:"scroller.scrollBehaviorY.minScrollPos",key:"minScrollY"},{sourceKey:"scroller.scrollBehaviorX.movingDirection",key:"movingDirectionX"},{sourceKey:"scroller.scrollBehaviorY.movingDirection",key:"movingDirectionY"},{sourceKey:"scroller.scrollBehaviorX.direction",key:"directionX"},{sourceKey:"scroller.scrollBehaviorY.direction",key:"directionY"},{sourceKey:"scroller.actions.enabled",key:"enabled"},{sourceKey:"scroller.animater.pending",key:"pending"},{sourceKey:"scroller.animater.stop",key:"stop"},{sourceKey:"scroller.scrollTo",key:"scrollTo"},{sourceKey:"scroller.scrollBy",key:"scrollBy"},{sourceKey:"scroller.scrollToElement",key:"scrollToElement"},{sourceKey:"scroller.resetPosition",key:"resetPosition"}];function Os(e){console.error("[BScroll warn]: "+e)}var Ns="undefined"!=typeof window,Cs=Ns&&navigator.userAgent.toLowerCase(),xs=!(!Cs||!/wechatdevtools/.test(Cs)),Ts=Cs&&Cs.indexOf("android")>0,ks=function(){if("string"==typeof Cs){var e=/os (\d\d?_\d(_\d)?)/.exec(Cs);if(!e)return!1;var t=e[1].split("_").map(function(e){return parseInt(e,10)});return!!(13===t[0]&&t[1]>=4)}return!1}(),Es=!1;if(Ns)try{var Is={};Object.defineProperty(Is,"passive",{get:function(){Es=!0}}),window.addEventListener("test-passive",function(){},Is)}catch(e){}function Ps(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}var Rs=function(e,t){for(var n in t)e[n]=t[n];return e};function As(e){return null==e}function Ds(e,t,n){return e<t?t:e>n?n:e}var Fs=Ns&&document.createElement("div").style,Ms=function(){if(!Ns)return!1;for(var e=0,t=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}];e<t.length;e++){var n=t[e];if(void 0!==Fs[n.value])return n.key}return!1}();function js(e){return!1===Ms?e:"standard"===Ms?"transitionEnd"===e?"transitionend":e:Ms+e.charAt(0).toUpperCase()+e.substr(1)}function Vs(e){return"string"==typeof e?document.querySelector(e):e}function Ls(e,t,n,i){var o=Es?{passive:!1,capture:!!i}:!!i;e.addEventListener(t,n,o)}function Us(e,t,n,i){e.removeEventListener(t,n,{capture:!!i})}function Bs(e){e.cancelable&&e.preventDefault()}function Ws(e){for(var t=0,n=0;e;)t-=e.offsetLeft,n-=e.offsetTop,e=e.offsetParent;return{left:t,top:n}}Ms&&"standard"!==Ms&&Ms.toLowerCase();var zs=js("transform"),qs=js("transition"),Hs=Ns&&js("perspective")in Fs,Gs=Ns&&("ontouchstart"in window||xs),$s=Ns&&qs in Fs,Xs={transform:zs,transition:qs,transitionTimingFunction:js("transitionTimingFunction"),transitionDuration:js("transitionDuration"),transitionDelay:js("transitionDelay"),transformOrigin:js("transformOrigin"),transitionEnd:js("transitionEnd"),transitionProperty:js("transitionProperty")},Ys={touchstart:1,touchmove:1,touchend:1,touchcancel:1,mousedown:2,mousemove:2,mouseup:2};function Ks(e){if(e instanceof window.SVGElement){var t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}}return{top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth,height:e.offsetHeight}}function Js(e,t){for(var n in t)if(t[n].test(e[n]))return!0;return!1}var Qs=Js;function Zs(e,t){var n;void 0===t&&(t="click"),"mouseup"===e.type?n=e:"touchend"!==e.type&&"touchcancel"!==e.type||(n=e.changedTouches[0]);var i,o={};n&&(o.screenX=n.screenX||0,o.screenY=n.screenY||0,o.clientX=n.clientX||0,o.clientY=n.clientY||0);var r=!0,s=!0,a={ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey};if("undefined"!=typeof MouseEvent)try{i=new MouseEvent(t,Rs(ws({bubbles:r,cancelable:s},a),o))}catch(e){l()}else l();function l(){(i=document.createEvent("Event")).initEvent(t,r,s),Rs(i,o)}i.forwardedTouchEvent=!0,i._constructed=!0,e.target.dispatchEvent(i)}var ea={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(e){return 1+--e*e*e*e*e}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(e){return e*(2-e)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(e){return 1- --e*e*e*e}}},ta=1e3/60,na=Ns&&window;function ia(){}var oa,ra,sa,aa,la=Ns?na.requestAnimationFrame||na.webkitRequestAnimationFrame||na.mozRequestAnimationFrame||na.oRequestAnimationFrame||function(e){return window.setTimeout(e,e.interval||ta)}:ia,ua=Ns?na.cancelAnimationFrame||na.webkitCancelAnimationFrame||na.mozCancelAnimationFrame||na.oCancelAnimationFrame||function(e){window.clearTimeout(e)}:ia,ca=function(e){},da={enumerable:!0,configurable:!0,get:ca,set:ca},pa=function(){function e(e){this.events={},this.eventTypes={},this.registerType(e)}return e.prototype.on=function(e,t,n){return void 0===n&&(n=this),this.hasType(e),this.events[e]||(this.events[e]=[]),this.events[e].push([t,n]),this},e.prototype.once=function(e,t,n){var i=this;void 0===n&&(n=this),this.hasType(e);var o=function(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];i.off(e,o);var a=t.apply(n,r);if(!0===a)return a};return o.fn=t,this.on(e,o),this},e.prototype.off=function(e,t){if(!e&&!t)return this.events={},this;if(e){if(this.hasType(e),!t)return this.events[e]=[],this;var n=this.events[e];if(!n)return this;for(var i=n.length;i--;)(n[i][0]===t||n[i][0]&&n[i][0].fn===t)&&n.splice(i,1);return this}},e.prototype.trigger=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.hasType(e);var i=this.events[e];if(i)for(var o,r=i.length,s=_s(i),a=0;a<r;a++){var l=s[a],u=l[0],c=l[1];if(u&&!0===(o=u.apply(c,t)))return o}},e.prototype.registerType=function(e){var t=this;e.forEach(function(e){t.eventTypes[e]=e})},e.prototype.destroy=function(){this.events={},this.eventTypes={}},e.prototype.hasType=function(e){var t=this.eventTypes;t[e]===e||Os('EventEmitter has used unknown event type: "'+e+'", should be oneof ['+Object.keys(t).map(function(e){return JSON.stringify(e)})+"]")},e}(),ha=function(){function e(e,t){this.wrapper=e,this.events=t,this.addDOMEvents()}return e.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},e.prototype.addDOMEvents=function(){this.handleDOMEvents(Ls)},e.prototype.removeDOMEvents=function(){this.handleDOMEvents(Us)},e.prototype.handleDOMEvents=function(e){var t=this,n=this.wrapper;this.events.forEach(function(i){e(n,i.name,t,!!i.capture)})},e.prototype.handleEvent=function(e){var t=e.type;this.events.some(function(n){return n.name===t&&(n.handler(e),!0)})},e}(),fa=function(e){function t(){var t=e.call(this)||this;return t.startX=0,t.startY=0,t.scrollX=!1,t.scrollY=!0,t.freeScroll=!1,t.directionLockThreshold=0,t.eventPassthrough="",t.click=!1,t.dblclick=!1,t.tap="",t.bounce={top:!0,bottom:!0,left:!0,right:!0},t.bounceTime=800,t.momentum=!0,t.momentumLimitTime=300,t.momentumLimitDistance=15,t.swipeTime=2500,t.swipeBounceTime=500,t.deceleration=.0015,t.flickLimitTime=200,t.flickLimitDistance=100,t.resizePolling=60,t.probeType=0,t.stopPropagation=!1,t.preventDefault=!0,t.preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/},t.tagException={tagName:/^TEXTAREA$/},t.HWCompositing=!0,t.useTransition=!0,t.bindToWrapper=!1,t.bindToTarget=!1,t.disableMouse=Gs,t.disableTouch=!Gs,t.autoBlur=!0,t.autoEndDistance=5,t.outOfBoundaryDampingFactor=1/3,t.specifiedIndexAsContent=0,t.quadrant=1,t}return bs(t,e),t.prototype.merge=function(e){if(!e)return this;for(var t in e)"bounce"!==t?this[t]=e[t]:this.bounce=this.resolveBounce(e[t]);return this},t.prototype.process=function(){return this.translateZ=this.HWCompositing&&Hs?" translateZ(1px)":"",this.useTransition=this.useTransition&&$s,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.scrollX="horizontal"!==this.eventPassthrough&&this.scrollX,this.scrollY="vertical"!==this.eventPassthrough&&this.scrollY,this.freeScroll=this.freeScroll&&!this.eventPassthrough,this.scrollX=!!this.freeScroll||this.scrollX,this.scrollY=!!this.freeScroll||this.scrollY,this.directionLockThreshold=this.eventPassthrough?0:this.directionLockThreshold,this},t.prototype.resolveBounce=function(e){var t={top:!0,right:!0,bottom:!0,left:!0};return"object"==typeof e?Rs(t,e):e?t:{top:!1,right:!1,bottom:!1,left:!1}},t}(function(){}),ga=function(){function e(e,t){this.wrapper=e,this.options=t,this.hooks=new pa(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}return e.prototype.handleDOMEvents=function(){var e=this.options,t=e.bindToWrapper,n=e.disableMouse,i=e.disableTouch,o=e.click,r=this.wrapper,s=t?r:window,a=[],l=[],u=!i,c=!n;o&&a.push({name:"click",handler:this.click.bind(this),capture:!0}),u&&(a.push({name:"touchstart",handler:this.start.bind(this)}),l.push({name:"touchmove",handler:this.move.bind(this)},{name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),c&&(a.push({name:"mousedown",handler:this.start.bind(this)}),l.push({name:"mousemove",handler:this.move.bind(this)},{name:"mouseup",handler:this.end.bind(this)})),this.wrapperEventRegister=new ha(r,a),this.targetEventRegister=new ha(s,l)},e.prototype.beforeHandler=function(e,t){var n=this.options,i=n.preventDefault,o=n.stopPropagation,r=n.preventDefaultException;({start:function(){return i&&!Js(e.target,r)},end:function(){return i&&!Js(e.target,r)},move:function(){return i}})[t]()&&e.preventDefault(),o&&e.stopPropagation()},e.prototype.setInitiated=function(e){void 0===e&&(e=0),this.initiated=e},e.prototype.start=function(e){var t=Ys[e.type];if(!this.initiated||this.initiated===t)if(this.setInitiated(t),Qs(e.target,this.options.tagException))this.setInitiated();else if((2!==t||0===e.button)&&!this.hooks.trigger(this.hooks.eventTypes.beforeStart,e)){this.beforeHandler(e,"start");var n=e.touches?e.touches[0]:e;this.pointX=n.pageX,this.pointY=n.pageY,this.hooks.trigger(this.hooks.eventTypes.start,e)}},e.prototype.move=function(e){if(Ys[e.type]===this.initiated){this.beforeHandler(e,"move");var t=e.touches?e.touches[0]:e,n=t.pageX-this.pointX,i=t.pageY-this.pointY;if(this.pointX=t.pageX,this.pointY=t.pageY,!this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:n,deltaY:i,e})){var o=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,r=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,s=this.pointX-o,a=this.pointY-r,l=this.options.autoEndDistance;(s>document.documentElement.clientWidth-l||a>document.documentElement.clientHeight-l||s<l||a<l)&&this.end(e)}}},e.prototype.end=function(e){Ys[e.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(e,"end"),this.hooks.trigger(this.hooks.eventTypes.end,e))},e.prototype.click=function(e){this.hooks.trigger(this.hooks.eventTypes.click,e)},e.prototype.setContent=function(e){e!==this.wrapper&&(this.wrapper=e,this.rebindDOMEvents())},e.prototype.rebindDOMEvents=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.handleDOMEvents()},e.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},e}(),ma={x:["translateX","px"],y:["translateY","px"]},ya=function(){function e(e){this.setContent(e),this.hooks=new pa(["beforeTranslate","translate"])}return e.prototype.getComputedPosition=function(){var e=window.getComputedStyle(this.content,null)[Xs.transform].split(")")[0].split(", ");return{x:+(e[12]||e[4])||0,y:+(e[13]||e[5])||0}},e.prototype.translate=function(e){var t=[];Object.keys(e).forEach(function(n){if(ma[n]){var i=ma[n][0];if(i){var o=ma[n][1],r=e[n];t.push(i+"("+r+o+")")}}}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,t,e),this.style[Xs.transform]=t.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,e)},e.prototype.setContent=function(e){this.content!==e&&(this.content=e,this.style=e.style)},e.prototype.destroy=function(){this.hooks.destroy()},e}(),va=function(){function e(e,t,n){this.translater=t,this.options=n,this.timer=0,this.hooks=new pa(["move","end","beforeForceStop","forceStop","callStop","time","timeFunction"]),this.setContent(e)}return e.prototype.translate=function(e){this.translater.translate(e)},e.prototype.setPending=function(e){this.pending=e},e.prototype.setForceStopped=function(e){this.forceStopped=e},e.prototype.setCallStop=function(e){this.callStopWhenPending=e},e.prototype.setContent=function(e){this.content!==e&&(this.content=e,this.style=e.style,this.stop())},e.prototype.clearTimer=function(){this.timer&&(ua(this.timer),this.timer=0)},e.prototype.destroy=function(){this.hooks.destroy(),ua(this.timer)},e}(),ba=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return bs(t,e),t.prototype.startProbe=function(e,t){var n=this,i=e,o=function(){var r=n.translater.getComputedPosition();(function(e,t,n,i){var o=function(e,t){var n=e-t;return n>0?-1:n<0?1:0},r=o(t.x,e.x),s=o(t.y,e.y),a=n.x-i.x,l=n.y-i.y;return r*a<=0&&s*l<=0})(e,t,r,i)&&n.hooks.trigger(n.hooks.eventTypes.move,r),n.pending||(n.callStopWhenPending?n.callStopWhenPending=!1:n.hooks.trigger(n.hooks.eventTypes.end,r)),i=r,n.pending&&(n.timer=la(o))};this.callStopWhenPending&&this.setCallStop(!1),ua(this.timer),o()},t.prototype.transitionTime=function(e){void 0===e&&(e=0),this.style[Xs.transitionDuration]=e+"ms",this.hooks.trigger(this.hooks.eventTypes.time,e)},t.prototype.transitionTimingFunction=function(e){this.style[Xs.transitionTimingFunction]=e,this.hooks.trigger(this.hooks.eventTypes.timeFunction,e)},t.prototype.transitionProperty=function(){this.style[Xs.transitionProperty]=Xs.transform},t.prototype.move=function(e,t,n,i){this.setPending(n>0),this.transitionTimingFunction(i),this.transitionProperty(),this.transitionTime(n),this.translate(t);var o=3===this.options.probeType;n&&o&&this.startProbe(e,t),n||(this._reflow=this.content.offsetHeight,o&&this.hooks.trigger(this.hooks.eventTypes.move,t),this.hooks.trigger(this.hooks.eventTypes.end,t))},t.prototype.doStop=function(){var e=this.pending;if(this.setForceStopped(!1),this.setCallStop(!1),e){this.setPending(!1),ua(this.timer);var t=this.translater.getComputedPosition(),n=t.x,i=t.y;this.transitionTime(),this.translate({x:n,y:i}),this.setForceStopped(!0),this.setCallStop(!0),this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:n,y:i})}return e},t.prototype.stop=function(){this.doStop()&&this.hooks.trigger(this.hooks.eventTypes.callStop)},t}(va),wa=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return bs(t,e),t.prototype.move=function(e,t,n,i){if(!n)return this.translate(t),3===this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.move,t),void this.hooks.trigger(this.hooks.eventTypes.end,t);this.animate(e,t,n,i)},t.prototype.animate=function(e,t,n,i){var o=this,r=Ps(),s=r+n,a=3===this.options.probeType,l=function(){var u=Ps();if(u>=s)return o.translate(t),a&&o.hooks.trigger(o.hooks.eventTypes.move,t),void o.hooks.trigger(o.hooks.eventTypes.end,t);var c=i(u=(u-r)/n),d={};Object.keys(t).forEach(function(n){var i=e[n],o=t[n];d[n]=(o-i)*c+i}),o.translate(d),a&&o.hooks.trigger(o.hooks.eventTypes.move,d),o.pending&&(o.timer=la(l)),o.pending||(o.callStopWhenPending?o.callStopWhenPending=!1:o.hooks.trigger(o.hooks.eventTypes.end,t))};this.setPending(!0),this.callStopWhenPending&&this.setCallStop(!1),ua(this.timer),l()},t.prototype.doStop=function(){var e=this.pending;if(this.setForceStopped(!1),this.setCallStop(!1),e){this.setPending(!1),ua(this.timer);var t=this.translater.getComputedPosition();this.setForceStopped(!0),this.setCallStop(!0),this.hooks.trigger(this.hooks.eventTypes.forceStop,t)}return e},t.prototype.stop=function(){this.doStop()&&this.hooks.trigger(this.hooks.eventTypes.callStop)},t}(va),_a=function(){function e(e,t,n){this.wrapper=e,this.options=n,this.hooks=new pa(["beforeComputeBoundary","computeBoundary","momentum","end","ignoreHasScroll"]),this.refresh(t)}return e.prototype.start=function(){this.dist=0,this.setMovingDirection(0),this.setDirection(0)},e.prototype.move=function(e){return e=this.hasScroll?e:0,this.setMovingDirection(e),this.performDampingAlgorithm(e,this.options.outOfBoundaryDampingFactor)},e.prototype.setMovingDirection=function(e){this.movingDirection=e>0?-1:e<0?1:0},e.prototype.setDirection=function(e){this.direction=e>0?-1:e<0?1:0},e.prototype.performDampingAlgorithm=function(e,t){var n=this.currentPos+e;return(n>this.minScrollPos||n<this.maxScrollPos)&&(n=n>this.minScrollPos&&this.options.bounces[0]||n<this.maxScrollPos&&this.options.bounces[1]?this.currentPos+e*t:n>this.minScrollPos?this.minScrollPos:this.maxScrollPos),n},e.prototype.end=function(e){var t={duration:0},n=Math.abs(this.currentPos-this.startPos);if(this.options.momentum&&e<this.options.momentumLimitTime&&n>this.options.momentumLimitDistance){var i=-1===this.direction&&this.options.bounces[0]||1===this.direction&&this.options.bounces[1]?this.wrapperSize:0;t=this.hasScroll?this.momentum(this.currentPos,this.startPos,e,this.maxScrollPos,this.minScrollPos,i,this.options):{destination:this.currentPos,duration:0}}else this.hooks.trigger(this.hooks.eventTypes.end,t);return t},e.prototype.momentum=function(e,t,n,i,o,r,s){void 0===s&&(s=this.options);var a=e-t,l=Math.abs(a)/n,u=s.deceleration,c=s.swipeBounceTime,d=s.swipeTime,p={destination:e+l*l/u*(a<0?-1:1),duration:Math.min(d,2*l/u),rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,p,a),p.destination<i?(p.destination=r?Math.max(i-r/4,i-r/p.rate*l):i,p.duration=c):p.destination>o&&(p.destination=r?Math.min(o+r/4,o+r/p.rate*l):o,p.duration=c),p.destination=Math.round(p.destination),p},e.prototype.updateDirection=function(){var e=this.currentPos-this.absStartPos;this.setDirection(e)},e.prototype.refresh=function(e){var t=this.options.rect,n=t.size,i=t.position,o="static"===window.getComputedStyle(this.wrapper,null).position,r=Ks(this.wrapper);this.wrapperSize=this.wrapper["width"===n?"clientWidth":"clientHeight"],this.setContent(e);var s=Ks(this.content);this.contentSize=s[n],this.relativeOffset=s[i],o&&(this.relativeOffset-=r[i]),this.computeBoundary(),this.setDirection(0)},e.prototype.setContent=function(e){e!==this.content&&(this.content=e,this.resetState())},e.prototype.resetState=function(){this.currentPos=0,this.startPos=0,this.dist=0,this.setDirection(0),this.setMovingDirection(0),this.resetStartPos()},e.prototype.computeBoundary=function(){this.hooks.trigger(this.hooks.eventTypes.beforeComputeBoundary);var e={minScrollPos:0,maxScrollPos:this.wrapperSize-this.contentSize};e.maxScrollPos<0&&(e.maxScrollPos-=this.relativeOffset,0===this.options.specifiedIndexAsContent&&(e.minScrollPos=-this.relativeOffset)),this.hooks.trigger(this.hooks.eventTypes.computeBoundary,e),this.minScrollPos=e.minScrollPos,this.maxScrollPos=e.maxScrollPos,this.hasScroll=this.options.scrollable&&this.maxScrollPos<this.minScrollPos,!this.hasScroll&&this.minScrollPos<this.maxScrollPos&&(this.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize)},e.prototype.updatePosition=function(e){this.currentPos=e},e.prototype.getCurrentPos=function(){return this.currentPos},e.prototype.checkInBoundary=function(){var e=this.adjustPosition(this.currentPos);return{position:e,inBoundary:e===this.getCurrentPos()}},e.prototype.adjustPosition=function(e){return this.hasScroll||this.hooks.trigger(this.hooks.eventTypes.ignoreHasScroll)?e>this.minScrollPos?e=this.minScrollPos:e<this.maxScrollPos&&(e=this.maxScrollPos):e=this.minScrollPos,e},e.prototype.updateStartPos=function(){this.startPos=this.currentPos},e.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},e.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},e.prototype.getAbsDist=function(e){return this.dist+=e,Math.abs(this.dist)},e.prototype.destroy=function(){this.hooks.destroy()},e}(),Sa=((oa={}).yes=function(e){return!0},oa.no=function(e){return Bs(e),!1},oa),Oa=((ra={}).horizontal=((sa={}).yes="horizontal",sa.no="vertical",sa),ra.vertical=((aa={}).yes="vertical",aa.no="horizontal",aa),ra),Na=function(){function e(e,t,n){this.directionLockThreshold=e,this.freeScroll=t,this.eventPassthrough=n,this.reset()}return e.prototype.reset=function(){this.directionLocked=""},e.prototype.checkMovingDirection=function(e,t,n){return this.computeDirectionLock(e,t),this.handleEventPassthrough(n)},e.prototype.adjustDelta=function(e,t){return"horizontal"===this.directionLocked?t=0:"vertical"===this.directionLocked&&(e=0),{deltaX:e,deltaY:t}},e.prototype.computeDirectionLock=function(e,t){""!==this.directionLocked||this.freeScroll||(e>t+this.directionLockThreshold?this.directionLocked="horizontal":t>=e+this.directionLockThreshold?this.directionLocked="vertical":this.directionLocked="none")},e.prototype.handleEventPassthrough=function(e){var t=Oa[this.directionLocked];if(t){if(this.eventPassthrough===t.yes)return Sa.yes(e);if(this.eventPassthrough===t.no)return Sa.no(e)}return!1},e}(),Ca=function(){function e(e,t,n,i,o){this.hooks=new pa(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd","contentNotMoved","detectMovingDirection","coordinateTransformation"]),this.scrollBehaviorX=e,this.scrollBehaviorY=t,this.actionsHandler=n,this.animater=i,this.options=o,this.directionLockAction=new Na(o.directionLockThreshold,o.freeScroll,o.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}return e.prototype.bindActionsHandler=function(){var e=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(t){return!e.enabled||e.handleStart(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(t){var n=t.deltaX,i=t.deltaY,o=t.e;if(!e.enabled)return!0;var r=function(e,t,n){return 2===n?[t,-e]:3===n?[-e,-t]:4===n?[-t,e]:[e,t]}(n,i,e.options.quadrant),s={deltaX:r[0],deltaY:r[1]};return e.hooks.trigger(e.hooks.eventTypes.coordinateTransformation,s),e.handleMove(s.deltaX,s.deltaY,o)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(t){return!e.enabled||e.handleEnd(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(t){e.enabled&&!t._constructed&&e.handleClick(t)})},e.prototype.handleStart=function(e){var t=Ps();this.fingerMoved=!1,this.contentMoved=!1,this.startTime=t,this.directionLockAction.reset(),this.scrollBehaviorX.start(),this.scrollBehaviorY.start(),this.animater.doStop(),this.scrollBehaviorX.resetStartPos(),this.scrollBehaviorY.resetStartPos(),this.hooks.trigger(this.hooks.eventTypes.start,e)},e.prototype.handleMove=function(e,t,n){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,n)){var i=this.scrollBehaviorX.getAbsDist(e),o=this.scrollBehaviorY.getAbsDist(t),r=Ps();if(this.checkMomentum(i,o,r))return!0;if(this.directionLockAction.checkMovingDirection(i,o,n))return this.actionsHandler.setInitiated(),!0;var s=this.directionLockAction.adjustDelta(e,t),a=this.scrollBehaviorX.getCurrentPos(),l=this.scrollBehaviorX.move(s.deltaX),u=this.scrollBehaviorY.getCurrentPos(),c=this.scrollBehaviorY.move(s.deltaY);if(!this.hooks.trigger(this.hooks.eventTypes.detectMovingDirection)){this.fingerMoved||(this.fingerMoved=!0);var d=l!==a||c!==u;this.contentMoved||d||this.hooks.trigger(this.hooks.eventTypes.contentNotMoved),!this.contentMoved&&d&&(this.contentMoved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.contentMoved&&d&&(this.animater.translate({x:l,y:c}),this.dispatchScroll(r))}}},e.prototype.dispatchScroll=function(e){e-this.startTime>this.options.momentumLimitTime&&(this.startTime=e,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),1===this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),this.options.probeType>1&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},e.prototype.checkMomentum=function(e,t,n){return n-this.endTime>this.options.momentumLimitTime&&t<this.options.momentumLimitDistance&&e<this.options.momentumLimitDistance},e.prototype.handleEnd=function(e){if(!this.hooks.trigger(this.hooks.eventTypes.beforeEnd,e)){var t=this.getCurrentPos();if(this.scrollBehaviorX.updateDirection(),this.scrollBehaviorY.updateDirection(),this.hooks.trigger(this.hooks.eventTypes.end,e,t))return!0;t=this.ensureIntegerPos(t),this.animater.translate(t),this.endTime=Ps();var n=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,t,n)}},e.prototype.ensureIntegerPos=function(e){this.ensuringInteger=!0;var t=e.x,n=e.y,i=this.scrollBehaviorX,o=i.minScrollPos,r=i.maxScrollPos,s=this.scrollBehaviorY,a=s.minScrollPos,l=s.maxScrollPos;return t=t>0?Math.ceil(t):Math.floor(t),n=n>0?Math.ceil(n):Math.floor(n),{x:t=Ds(t,r,o),y:n=Ds(n,l,a)}},e.prototype.handleClick=function(e){Js(e.target,this.options.preventDefaultException)||(Bs(e),e.stopPropagation())},e.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},e.prototype.refresh=function(){this.endTime=0},e.prototype.destroy=function(){this.hooks.destroy()},e}();function xa(e,t,n,i){var o=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime","outOfBoundaryDampingFactor","specifiedIndexAsContent"].reduce(function(t,n){return t[n]=e[n],t},{});return o.scrollable=!!e[t],o.bounces=n,o.rect=i,o}function Ta(e,t,n){n.forEach(function(n){var i,o;"string"==typeof n?i=o=n:(i=n.source,o=n.target),e.on(i,function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.trigger.apply(t,_s([o],e))})})}var ka=function(){function e(e,t,n){this.wrapper=e,this.content=t,this.resizeTimeout=0,this.hooks=new pa(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","resize","touchEnd","end","flick","scrollCancel","momentum","scrollTo","minDistanceScroll","scrollToElement","beforeRefresh"]),this.options=n;var i,o=this.options.bounce,r=o.left,s=o.right,a=o.top,l=o.bottom;this.scrollBehaviorX=new _a(e,t,xa(n,"scrollX",[r,s],{size:"width",position:"left"})),this.scrollBehaviorY=new _a(e,t,xa(n,"scrollY",[a,l],{size:"height",position:"top"})),this.translater=new ya(this.content),this.animater=function(e,t,n){var i=n.useTransition,o={};return Object.defineProperty(o,"probeType",{enumerable:!0,configurable:!1,get:function(){return n.probeType}}),i?new ba(e,t,o):new wa(e,t,o)}(this.content,this.translater,this.options),this.actionsHandler=new ga(this.options.bindToTarget?this.content:e,(i=this.options,["click","bindToWrapper","disableMouse","disableTouch","preventDefault","stopPropagation","tagException","preventDefaultException","autoEndDistance"].reduce(function(e,t){return e[t]=i[t],e},{}))),this.actions=new Ca(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var u=this.resize.bind(this);this.resizeRegister=new ha(window,[{name:"orientationchange",handler:u},{name:"resize",handler:u}]),this.registerTransitionEnd(),this.init()}return e.prototype.init=function(){var e=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){e.togglePointerEvents(!0)})},e.prototype.registerTransitionEnd=function(){this.transitionEndRegister=new ha(this.content,[{name:Xs.transitionEnd,handler:this.transitionEnd.bind(this)}])},e.prototype.bindTranslater=function(){var e=this,t=this.translater.hooks;t.on(t.eventTypes.beforeTranslate,function(t){e.options.translateZ&&t.push(e.options.translateZ)}),t.on(t.eventTypes.translate,function(t){var n=e.getCurrentPos();e.updatePositions(t),!0!==e.actions.ensuringInteger?t.x===n.x&&t.y===n.y||e.togglePointerEvents(!1):e.actions.ensuringInteger=!1})},e.prototype.bindAnimater=function(){var e=this;this.animater.hooks.on(this.animater.hooks.eventTypes.end,function(t){e.resetPosition(e.options.bounceTime)||(e.animater.setPending(!1),e.hooks.trigger(e.hooks.eventTypes.scrollEnd,t))}),Ta(this.animater.hooks,this.hooks,[{source:this.animater.hooks.eventTypes.move,target:this.hooks.eventTypes.scroll},{source:this.animater.hooks.eventTypes.forceStop,target:this.hooks.eventTypes.scrollEnd}])},e.prototype.bindActions=function(){var e=this,t=this.actions;Ta(t.hooks,this.hooks,[{source:t.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:t.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:t.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:t.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:t.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:t.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),t.hooks.on(t.hooks.eventTypes.end,function(n,i){return e.hooks.trigger(e.hooks.eventTypes.touchEnd,i),!!e.hooks.trigger(e.hooks.eventTypes.end,i)||!(t.fingerMoved||(e.hooks.trigger(e.hooks.eventTypes.scrollCancel),!e.checkClick(n)))||(e.resetPosition(e.options.bounceTime,ea.bounce)?(e.animater.setForceStopped(!1),!0):void 0)}),t.hooks.on(t.hooks.eventTypes.scrollEnd,function(n,i){var o=Math.abs(n.x-e.scrollBehaviorX.startPos),r=Math.abs(n.y-e.scrollBehaviorY.startPos);if(e.checkFlick(i,o,r))return e.animater.setForceStopped(!1),void e.hooks.trigger(e.hooks.eventTypes.flick);e.momentum(n,i)?e.animater.setForceStopped(!1):(t.contentMoved&&e.hooks.trigger(e.hooks.eventTypes.scrollEnd,n),e.animater.forceStopped&&e.animater.setForceStopped(!1))})},e.prototype.checkFlick=function(e,t,n){if(this.hooks.events.flick.length>1&&e<this.options.flickLimitTime&&t<this.options.flickLimitDistance&&n<this.options.flickLimitDistance&&(n>1||t>1))return!0},e.prototype.momentum=function(e,t){var n={time:0,easing:ea.swiper,newX:e.x,newY:e.y},i=this.scrollBehaviorX.end(t),o=this.scrollBehaviorY.end(t);if(n.newX=As(i.destination)?n.newX:i.destination,n.newY=As(o.destination)?n.newY:o.destination,n.time=Math.max(i.duration,o.duration),this.hooks.trigger(this.hooks.eventTypes.momentum,n,this),n.newX!==e.x||n.newY!==e.y)return(n.newX>this.scrollBehaviorX.minScrollPos||n.newX<this.scrollBehaviorX.maxScrollPos||n.newY>this.scrollBehaviorY.minScrollPos||n.newY<this.scrollBehaviorY.maxScrollPos)&&(n.easing=ea.swipeBounce),this.scrollTo(n.newX,n.newY,n.time,n.easing),!0},e.prototype.checkClick=function(e){var t=this.animater.forceStopped;if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return this.animater.setForceStopped(!1),!0;if(!t){var n=this.options.dblclick,i=!1;if(n&&this.lastClickTime){var o=n.delay,r=void 0===o?300:o;Ps()-this.lastClickTime<r&&(i=!0,function(e){Zs(e,"dblclick")}(e))}return this.options.tap&&function(e,t){var n=document.createEvent("Event");n.initEvent(t,!0,!0),n.pageX=e.pageX,n.pageY=e.pageY,e.target.dispatchEvent(n)}(e,this.options.tap),this.options.click&&!Js(e.target,this.options.preventDefaultException)&&Zs(e),this.lastClickTime=i?null:Ps(),!0}return!1},e.prototype.resize=function(){var e=this;this.actions.enabled&&(Ts&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){e.hooks.trigger(e.hooks.eventTypes.resize)},this.options.resizePolling))},e.prototype.transitionEnd=function(e){e.target===this.content&&this.animater.pending&&(this.animater.transitionTime(),this.resetPosition(this.options.bounceTime,ea.bounce)||(this.animater.setPending(!1),3!==this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos())))},e.prototype.togglePointerEvents=function(e){void 0===e&&(e=!0);for(var t=this.content.children.length?this.content.children:[this.content],n=e?"auto":"none",i=0;i<t.length;i++){var o=t[i];o.isBScrollContainer||(o.style.pointerEvents=n)}},e.prototype.refresh=function(e){var t=this.setContent(e);this.hooks.trigger(this.hooks.eventTypes.beforeRefresh),this.scrollBehaviorX.refresh(e),this.scrollBehaviorY.refresh(e),t&&(this.translater.setContent(e),this.animater.setContent(e),this.transitionEndRegister.destroy(),this.registerTransitionEnd(),this.options.bindToTarget&&this.actionsHandler.setContent(e)),this.actions.refresh(),this.wrapperOffset=Ws(this.wrapper)},e.prototype.setContent=function(e){var t=e!==this.content;return t&&(this.content=e),t},e.prototype.scrollBy=function(e,t,n,i){void 0===n&&(n=0);var o=this.getCurrentPos(),r=o.x,s=o.y;i=i||ea.bounce,e+=r,t+=s,this.scrollTo(e,t,n,i)},e.prototype.scrollTo=function(e,t,n,i,o){void 0===n&&(n=0),void 0===i&&(i=ea.bounce),void 0===o&&(o={start:{},end:{}});var r=this.options.useTransition?i.style:i.fn,s=this.getCurrentPos(),a=ws({x:s.x,y:s.y},o.start),l=ws({x:e,y:t},o.end);if(this.hooks.trigger(this.hooks.eventTypes.scrollTo,l),!function(e,t){for(var n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];if(e[o]!==t[o])return!1}return!0}(a,l)){var u=Math.abs(l.x-a.x),c=Math.abs(l.y-a.y);u<1&&c<1&&(n=0,this.hooks.trigger(this.hooks.eventTypes.minDistanceScroll)),this.animater.move(a,l,n,r)}},e.prototype.scrollToElement=function(e,t,n,i,o){var r=Vs(e),s=Ws(r),a=function(e,t,n){return"number"==typeof e?e:e?Math.round(t/2-n/2):0};n=a(n,r.offsetWidth,this.wrapper.offsetWidth),i=a(i,r.offsetHeight,this.wrapper.offsetHeight);var l=function(e,t,n,i){return e-=t,i.adjustPosition(e-n)};s.left=l(s.left,this.wrapperOffset.left,n,this.scrollBehaviorX),s.top=l(s.top,this.wrapperOffset.top,i,this.scrollBehaviorY),this.hooks.trigger(this.hooks.eventTypes.scrollToElement,r,s)||this.scrollTo(s.left,s.top,t,o)},e.prototype.resetPosition=function(e,t){void 0===e&&(e=0),void 0===t&&(t=ea.bounce);var n=this.scrollBehaviorX.checkInBoundary(),i=n.position,o=n.inBoundary,r=this.scrollBehaviorY.checkInBoundary(),s=r.position,a=r.inBoundary;return!(o&&a||(ks&&this.reflow(),this.scrollTo(i,s,e,t),0))},e.prototype.reflow=function(){this._reflow=this.content.offsetHeight},e.prototype.updatePositions=function(e){this.scrollBehaviorX.updatePosition(e.x),this.scrollBehaviorY.updatePosition(e.y)},e.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},e.prototype.enable=function(){this.actions.enabled=!0},e.prototype.disable=function(){ua(this.animater.timer),this.actions.enabled=!1},e.prototype.destroy=function(){var e=this;["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"].forEach(function(t){return e[t].destroy()})},e}(),Ea=function(e){function t(t,n){var i=e.call(this,["refresh","contentChanged","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,o=Vs(t);return o?(i.plugins={},i.options=(new fa).merge(n).process(),i.setContent(o).valid?(i.hooks=new pa(["refresh","enable","disable","destroy","beforeInitialScrollTo","contentChanged"]),i.init(o),i):i):(Os("Can not resolve the wrapper DOM."),i)}return bs(t,e),t.use=function(e){var n=e.pluginName;return t.plugins.some(function(t){return e===t.ctor})?t:As(n)?(Os("Plugin Class must specify plugin's name in static property by 'pluginName' field."),t):(t.pluginsMap[n]=!0,t.plugins.push({name:n,applyOrder:e.applyOrder,ctor:e}),t)},t.prototype.setContent=function(e){var t=!1,n=!0,i=e.children[this.options.specifiedIndexAsContent];return i?(t=this.content!==i)&&(this.content=i):(Os("The wrapper need at least one child element to be content element to scroll."),n=!1),{valid:n,contentChanged:t}},t.prototype.init=function(e){var t=this;this.wrapper=e,e.isBScrollContainer=!0,this.scroller=new ka(e,this.content,this.options),this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize,function(){t.refresh()}),this.eventBubbling(),this.handleAutoBlur(),this.enable(),this.proxy(Ss),this.applyPlugins(),this.refreshWithoutReset(this.content);var n=this.options,i={x:n.startX,y:n.startY};this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo,i)||this.scroller.scrollTo(i.x,i.y)},t.prototype.applyPlugins=function(){var e=this,n=this.options;t.plugins.sort(function(e,t){var n,i=((n={}).pre=-1,n.post=1,n);return(e.applyOrder?i[e.applyOrder]:0)-(t.applyOrder?i[t.applyOrder]:0)}).forEach(function(t){var i=t.ctor;n[t.name]&&"function"==typeof i&&(e.plugins[t.name]=new i(e))})},t.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.beforeScrollStart,function(){var e=document.activeElement;!e||"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName||e.blur()})},t.prototype.eventBubbling=function(){Ta(this.scroller.hooks,this,[this.eventTypes.beforeScrollStart,this.eventTypes.scrollStart,this.eventTypes.scroll,this.eventTypes.scrollEnd,this.eventTypes.scrollCancel,this.eventTypes.touchEnd,this.eventTypes.flick])},t.prototype.refreshWithoutReset=function(e){this.scroller.refresh(e),this.hooks.trigger(this.hooks.eventTypes.refresh,e),this.trigger(this.eventTypes.refresh,e)},t.prototype.proxy=function(e){var t=this;e.forEach(function(e){var n=e.key,i=e.sourceKey;!function(e,t,n){da.get=function(){return function(e,t){for(var n=t.split("."),i=0;i<n.length-1;i++)if("object"!=typeof(e=e[n[i]])||!e)return;var o=n.pop();return"function"==typeof e[o]?function(){return e[o].apply(e,arguments)}:e[o]}(this,t)},da.set=function(e){!function(e,t,n){for(var i,o=t.split("."),r=0;r<o.length-1;r++)e[i=o[r]]||(e[i]={}),e=e[i];e[o.pop()]=n}(this,t,e)},Object.defineProperty(e,n,da)}(t,i,n)})},t.prototype.refresh=function(){var e=this.setContent(this.wrapper),t=e.contentChanged;if(e.valid){var n=this.content;this.refreshWithoutReset(n),t&&(this.hooks.trigger(this.hooks.eventTypes.contentChanged,n),this.trigger(this.eventTypes.contentChanged,n)),this.scroller.resetPosition()}},t.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},t.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},t.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},t.prototype.eventRegister=function(e){this.registerType(e)},t.plugins=[],t.pluginsMap={},t}(pa);function Ia(e,t){return new Ea(e,t)}Ia.use=Ea.use,Ia.plugins=Ea.plugins,Ia.pluginsMap=Ea.pluginsMap;var Pa=Ia,Ra="undefined"!=typeof window,Aa=Ra&&navigator.userAgent.toLowerCase();Aa&&/wechatdevtools/.test(Aa),Aa&&Aa.indexOf("android"),function(){if("string"==typeof Aa){var e=/os (\d\d?_\d(_\d)?)/.exec(Aa);if(!e)return!1;var t=e[1].split("_").map(function(e){return parseInt(e,10)});13===t[0]&&t[1]}}();var Da=!1;if(Ra)try{var Fa={};Object.defineProperty(Fa,"passive",{get:function(){Da=!0}}),window.addEventListener("test-passive",function(){},Fa)}catch(e){}var Ma=Ra&&document.createElement("div").style,ja=function(){if(!Ra)return!1;for(var e=0,t=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}];e<t.length;e++){var n=t[e];if(void 0!==Ma[n.value])return n.key}return!1}();function Va(e){return!1===ja?e:"standard"===ja?"transitionEnd"===e?"transitionend":e:ja+e.charAt(0).toUpperCase()+e.substr(1)}function La(e,t,n,i){var o=Da?{passive:!1,capture:!!i}:!!i;e.addEventListener(t,n,o)}function Ua(e,t,n,i){e.removeEventListener(t,n,{capture:!!i})}ja&&"standard"!==ja&&ja.toLowerCase(),Va("transform"),Va("transition"),Ra&&Va("perspective"),Va("transitionTimingFunction"),Va("transitionDuration"),Va("transitionDelay"),Va("transformOrigin"),Va("transitionEnd"),Va("transitionProperty");var Ba=function(){function e(e,t){this.wrapper=e,this.events=t,this.addDOMEvents()}return e.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},e.prototype.addDOMEvents=function(){this.handleDOMEvents(La)},e.prototype.removeDOMEvents=function(){this.handleDOMEvents(Ua)},e.prototype.handleDOMEvents=function(e){var t=this,n=this.wrapper;this.events.forEach(function(i){e(n,i.name,t,!!i.capture)})},e.prototype.handleEvent=function(e){var t=e.type;this.events.some(function(n){return n.name===t&&(n.handler(e),!0)})},e}(),Wa=function(){function e(e){this.scroll=e,this.wheelEndTimer=0,this.wheelMoveTimer=0,this.wheelStart=!1,this.init()}return e.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.registerEvent()},e.prototype.handleBScroll=function(){this.scroll.registerType(["alterOptions","mousewheelStart","mousewheelMove","mousewheelEnd"])},e.prototype.handleOptions=function(){var e=!0===this.scroll.options.mouseWheel?{}:this.scroll.options.mouseWheel;this.mouseWheelOpt=function(e,t){for(var n in t)e[n]=t[n];return e}({speed:20,invert:!1,easeTime:300,discreteTime:400,throttleTime:0,dampingFactor:.1},e)},e.prototype.handleHooks=function(){this.hooksFn=[],this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},e.prototype.registerEvent=function(){this.eventRegister=new Ba(this.scroll.scroller.wrapper,[{name:"wheel",handler:this.wheelHandler.bind(this)},{name:"mousewheel",handler:this.wheelHandler.bind(this)},{name:"DOMMouseScroll",handler:this.wheelHandler.bind(this)}])},e.prototype.registerHooks=function(e,t,n){e.on(t,n,this),this.hooksFn.push([e,t,n])},e.prototype.wheelHandler=function(e){if(this.scroll.enabled){this.beforeHandler(e),this.wheelStart||(this.wheelStartHandler(e),this.wheelStart=!0);var t=this.getWheelDelta(e);this.wheelMoveHandler(t),this.wheelEndDetector(t)}},e.prototype.wheelStartHandler=function(e){this.cleanCache();var t=this.scroll.scroller,n=t.scrollBehaviorX,i=t.scrollBehaviorY;n.setMovingDirection(0),i.setMovingDirection(0),n.setDirection(0),i.setDirection(0),this.scroll.trigger(this.scroll.eventTypes.alterOptions,this.mouseWheelOpt),this.scroll.trigger(this.scroll.eventTypes.mousewheelStart)},e.prototype.cleanCache=function(){this.deltaCache=[]},e.prototype.wheelMoveHandler=function(e){var t=this,n=this.mouseWheelOpt,i=n.throttleTime,o=n.dampingFactor;if(i&&this.wheelMoveTimer)this.deltaCache.push(e);else{var r=this.deltaCache.reduce(function(e,t){return{x:e.x+t.x,y:e.y+t.y}},{x:0,y:0});this.cleanCache();var s=this.scroll.scroller,a=s.scrollBehaviorX,l=s.scrollBehaviorY;a.setMovingDirection(-e.directionX),l.setMovingDirection(-e.directionY),a.setDirection(e.x),l.setDirection(e.y);var u=a.performDampingAlgorithm(Math.round(e.x)+r.x,o),c=l.performDampingAlgorithm(Math.round(e.y)+r.x,o);if(!this.scroll.trigger(this.scroll.eventTypes.mousewheelMove,{x:u,y:c})){var d=this.getEaseTime();u===this.scroll.x&&c===this.scroll.y||this.scroll.scrollTo(u,c,d)}i&&(this.wheelMoveTimer=window.setTimeout(function(){t.wheelMoveTimer=0},i))}},e.prototype.wheelEndDetector=function(e){var t=this;window.clearTimeout(this.wheelEndTimer),this.wheelEndTimer=window.setTimeout(function(){t.wheelStart=!1,window.clearTimeout(t.wheelMoveTimer),t.wheelMoveTimer=0,t.scroll.trigger(t.scroll.eventTypes.mousewheelEnd,e)},this.mouseWheelOpt.discreteTime)},e.prototype.getWheelDelta=function(e){var t=this.mouseWheelOpt,n=t.speed,i=0,o=0,r=t.invert?-1:1;switch(!0){case"deltaX"in e:1===e.deltaMode?(i=-e.deltaX*n,o=-e.deltaY*n):(i=-e.deltaX,o=-e.deltaY);break;case"wheelDeltaX"in e:i=e.wheelDeltaX/120*n,o=e.wheelDeltaY/120*n;break;case"wheelDelta"in e:i=o=e.wheelDelta/120*n;break;case"detail"in e:i=o=-e.detail/3*n}return i*=r,o*=r,this.scroll.hasVerticalScroll||(Math.abs(o)>Math.abs(i)&&(i=o),o=0),this.scroll.hasHorizontalScroll||(i=0),{x:i,y:o,directionX:i>0?-1:i<0?1:0,directionY:o>0?-1:o<0?1:0}},e.prototype.beforeHandler=function(e){var t=this.scroll.options,n=t.preventDefault,i=t.stopPropagation,o=t.preventDefaultException;n&&!function(e,t){for(var n in t)if(t[n].test(e[n]))return!0;return!1}(e.target,o)&&function(e){e.cancelable&&e.preventDefault()}(e),i&&e.stopPropagation()},e.prototype.getEaseTime=function(){var e=this.mouseWheelOpt.easeTime;return e<100&&console.error("[BScroll warn]: easeTime should be greater than 100.If mouseWheel easeTime is too small,scrollEnd will be triggered many times."),Math.max(e,100)},e.prototype.destroy=function(){this.eventRegister.destroy(),window.clearTimeout(this.wheelEndTimer),window.clearTimeout(this.wheelMoveTimer),this.hooksFn.forEach(function(e){var t=e[0],n=e[1],i=e[2];t.off(n,i)})},e.pluginName="mouseWheel",e.applyOrder="pre",e}(),za=function(){return za=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},za.apply(this,arguments)},qa="undefined"!=typeof window,Ha=qa&&navigator.userAgent.toLowerCase();Ha&&/wechatdevtools/.test(Ha),Ha&&Ha.indexOf("android"),function(){if("string"==typeof Ha){var e=/os (\d\d?_\d(_\d)?)/.exec(Ha);if(!e)return!1;var t=e[1].split("_").map(function(e){return parseInt(e,10)});13===t[0]&&t[1]}}();var Ga=!1;if(qa)try{var $a={};Object.defineProperty($a,"passive",{get:function(){Ga=!0}}),window.addEventListener("test-passive",function(){},$a)}catch(e){}function Xa(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}function Ya(e,t,n){return e<t?t:e>n?n:e}var Ka=qa&&document.createElement("div").style,Ja=function(){if(!qa)return!1;for(var e=0,t=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}];e<t.length;e++){var n=t[e];if(void 0!==Ka[n.value])return n.key}return!1}();function Qa(e){return!1===Ja?e:"standard"===Ja?"transitionEnd"===e?"transitionend":e:Ja+e.charAt(0).toUpperCase()+e.substr(1)}function Za(e,t,n,i){var o=Ga?{passive:!1,capture:!!i}:!!i;e.addEventListener(t,n,o)}function el(e,t,n,i){e.removeEventListener(t,n,{capture:!!i})}function tl(e){e.cancelable&&e.preventDefault()}Ja&&"standard"!==Ja&&Ja.toLowerCase();var nl=Qa("transform");Qa("transition"),qa&&Qa("perspective");var il=nl,ol=Qa("transitionTimingFunction"),rl=Qa("transitionDuration"),sl=(Qa("transitionDelay"),Qa("transformOrigin"),Qa("transitionEnd"),Qa("transitionProperty"),function(){function e(e){this.events={},this.eventTypes={},this.registerType(e)}return e.prototype.on=function(e,t,n){return void 0===n&&(n=this),this.hasType(e),this.events[e]||(this.events[e]=[]),this.events[e].push([t,n]),this},e.prototype.once=function(e,t,n){var i=this;void 0===n&&(n=this),this.hasType(e);var o=function(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];i.off(e,o);var a=t.apply(n,r);if(!0===a)return a};return o.fn=t,this.on(e,o),this},e.prototype.off=function(e,t){if(!e&&!t)return this.events={},this;if(e){if(this.hasType(e),!t)return this.events[e]=[],this;var n=this.events[e];if(!n)return this;for(var i=n.length;i--;)(n[i][0]===t||n[i][0]&&n[i][0].fn===t)&&n.splice(i,1);return this}},e.prototype.trigger=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.hasType(e);var i=this.events[e];if(i)for(var o,r=i.length,s=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),o=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i}(i),a=0;a<r;a++){var l=s[a],u=l[0],c=l[1];if(u&&!0===(o=u.apply(c,t)))return o}},e.prototype.registerType=function(e){var t=this;e.forEach(function(e){t.eventTypes[e]=e})},e.prototype.destroy=function(){this.events={},this.eventTypes={}},e.prototype.hasType=function(e){var t,n=this.eventTypes;n[e]===e||(t='EventEmitter has used unknown event type: "'+e+'", should be oneof ['+Object.keys(n).map(function(e){return JSON.stringify(e)})+"]",console.error("[BScroll warn]: "+t))},e}()),al=function(){function e(e,t){this.wrapper=e,this.events=t,this.addDOMEvents()}return e.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},e.prototype.addDOMEvents=function(){this.handleDOMEvents(Za)},e.prototype.removeDOMEvents=function(){this.handleDOMEvents(el)},e.prototype.handleDOMEvents=function(e){var t=this,n=this.wrapper;this.events.forEach(function(i){e(n,i.name,t,!!i.capture)})},e.prototype.handleEvent=function(e){var t=e.type;this.events.some(function(n){return n.name===t&&(n.handler(e),!0)})},e}(),ll=function(){function e(e,t){this.indicator=e,this.options=t,this.hooks=new sl(["touchStart","touchMove","touchEnd"]),this.registerEvents()}return e.prototype.registerEvents=function(){var e=this.options,t=e.disableMouse,n=e.disableTouch,i=[],o=[],r=[];t||(i.push({name:"mousedown",handler:this.start.bind(this)}),o.push({name:"mousemove",handler:this.move.bind(this)}),r.push({name:"mouseup",handler:this.end.bind(this)})),n||(i.push({name:"touchstart",handler:this.start.bind(this)}),o.push({name:"touchmove",handler:this.move.bind(this)}),r.push({name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),this.startEventRegister=new al(this.indicator.indicatorEl,i),this.moveEventRegister=new al(window,o),this.endEventRegister=new al(window,r)},e.prototype.BScrollIsDisabled=function(){return!this.indicator.scroll.enabled},e.prototype.start=function(e){if(!this.BScrollIsDisabled()){var t=e.touches?e.touches[0]:e;tl(e),e.stopPropagation(),this.initiated=!0,this.lastPoint=t[this.indicator.keysMap.point],this.hooks.trigger(this.hooks.eventTypes.touchStart)}},e.prototype.move=function(e){if(this.initiated){var t=(e.touches?e.touches[0]:e)[this.indicator.keysMap.point];tl(e),e.stopPropagation();var n=t-this.lastPoint;this.lastPoint=t,this.hooks.trigger(this.hooks.eventTypes.touchMove,n)}},e.prototype.end=function(e){this.initiated&&(this.initiated=!1,tl(e),e.stopPropagation(),this.hooks.trigger(this.hooks.eventTypes.touchEnd))},e.prototype.destroy=function(){this.startEventRegister.destroy(),this.moveEventRegister.destroy(),this.endEventRegister.destroy()},e}(),ul=function(){function e(e,t){this.scroll=e,this.options=t,this.hooksFn=[],this.wrapper=t.wrapper,this.direction=t.direction,this.indicatorEl=this.wrapper.children[0],this.keysMap=this.getKeysMap(),this.handleFade(),this.handleHooks()}return e.prototype.handleFade=function(){this.options.fade&&(this.wrapper.style.opacity="0")},e.prototype.handleHooks=function(){var e=this,t=this.options,n=t.fade,i=t.interactive,o=t.scrollbarTrackClickable,r=this.scroll,s=r.hooks,a=r.scroller.translater.hooks,l=r.scroller.animater.hooks;if(this.registerHooks(s,s.eventTypes.refresh,this.refresh),this.registerHooks(a,a.eventTypes.translate,function(t){var n=e.keysMap.hasScroll;e.scroll[n]&&e.updatePosition(t)}),this.registerHooks(l,l.eventTypes.time,this.transitionTime),this.registerHooks(l,l.eventTypes.timeFunction,this.transitionTimingFunction),n&&(this.registerHooks(r,r.eventTypes.scrollEnd,function(){e.fade()}),this.registerHooks(r,r.eventTypes.scrollStart,function(){e.fade(!0)}),r.eventTypes.mousewheelStart&&r.eventTypes.mousewheelEnd&&(this.registerHooks(r,r.eventTypes.mousewheelStart,function(){e.fade(!0)}),this.registerHooks(r,r.eventTypes.mousewheelMove,function(){e.fade(!0)}),this.registerHooks(r,r.eventTypes.mousewheelEnd,function(){e.fade()}))),i){var u=this.scroll.options,c=u.disableMouse,d=u.disableTouch;this.eventHandler=new ll(this,{disableMouse:c,disableTouch:d});var p=this.eventHandler.hooks;this.registerHooks(p,p.eventTypes.touchStart,this.startHandler),this.registerHooks(p,p.eventTypes.touchMove,this.moveHandler),this.registerHooks(p,p.eventTypes.touchEnd,this.endHandler)}o&&this.bindClick()},e.prototype.registerHooks=function(e,t,n){e.on(t,n,this),this.hooksFn.push([e,t,n])},e.prototype.bindClick=function(){var e=this.wrapper;this.clickEventRegister=new al(e,[{name:"click",handler:this.handleClick.bind(this)}])},e.prototype.handleClick=function(e){var t=this.calculateclickOffsetPos(e),n=this.scroll,i=n.x,o=n.y;i="horizontal"===this.direction?t:i,o="vertical"===this.direction?t:o,this.scroll.scrollTo(i,o,this.options.scrollbarTrackOffsetTime)},e.prototype.calculateclickOffsetPos=function(e){var t=this.keysMap,n=t.point,i=t.domRect,o=this.options.scrollbarTrackOffsetType,r=e[n]-this.wrapperRect[i],s=r<this.currentPos?-1:1,a=0,l=this.currentPos;return"step"===o?a=this.scrollInfo.baseSize*s:(a=0,l=r),this.newPos(l,a,this.scrollInfo)},e.prototype.getKeysMap=function(){return"vertical"===this.direction?{hasScroll:"hasVerticalScroll",size:"height",wrapperSize:"clientHeight",scrollerSize:"scrollerHeight",maxScrollPos:"maxScrollY",pos:"y",point:"pageY",translateProperty:"translateY",domRect:"top"}:{hasScroll:"hasHorizontalScroll",size:"width",wrapperSize:"clientWidth",scrollerSize:"scrollerWidth",maxScrollPos:"maxScrollX",pos:"x",point:"pageX",translateProperty:"translateX",domRect:"left"}},e.prototype.fade=function(e){var t=this.options,n=t.fadeInTime,i=t.fadeOutTime,o=e?n:i,r=this.wrapper;r.style[rl]=o+"ms",r.style.opacity=e?"1":"0"},e.prototype.refresh=function(){var e=this.keysMap.hasScroll,t=this.scroll,n=t.x,i=t.y;if(this.wrapperRect=this.wrapper.getBoundingClientRect(),this.canScroll(t[e])){var o=this.keysMap,r=o.wrapperSize,s=o.scrollerSize,a=o.maxScrollPos;this.scrollInfo=this.refreshScrollInfo(this.wrapper[r],t[s],t[a],this.indicatorEl[r]),this.updatePosition({x:n,y:i})}},e.prototype.transitionTime=function(e){void 0===e&&(e=0),this.indicatorEl.style[rl]=e+"ms"},e.prototype.transitionTimingFunction=function(e){this.indicatorEl.style[ol]=e},e.prototype.canScroll=function(e){return this.wrapper.style.display=e?"block":"none",e},e.prototype.refreshScrollInfo=function(e,t,n,i){var o=Math.max(Math.round(e*e/(t||e||1)),this.options.minSize);this.options.isCustom&&(o=i);var r=e-o;return{baseSize:o,maxScrollPos:r,minScrollPos:0,sizeRatio:r/n}},e.prototype.updatePosition=function(e){var t=this.caculatePosAndSize(e,this.scrollInfo),n=t.pos,i=t.size;this.refreshStyle(i,n),this.currentPos=n},e.prototype.caculatePosAndSize=function(e,t){var n,i=this.keysMap.pos,o=t.sizeRatio,r=t.baseSize,s=t.maxScrollPos,a=t.minScrollPos,l=this.options.minSize,u=Math.round(o*e[i]);return u<a?(n=Math.max(r+3*u,l),u=a):u>s?u=s+r-(n=Math.max(r-3*(u-s),l)):n=r,{pos:u,size:n}},e.prototype.refreshStyle=function(e,t){var n=this.keysMap,i=n.translateProperty,o=n.size,r=this.scroll.options.translateZ;this.indicatorEl.style[o]=e+"px",this.indicatorEl.style[il]=i+"("+t+"px)"+r},e.prototype.startHandler=function(){this.moved=!1,this.startTime=Xa(),this.transitionTime(),this.scroll.scroller.hooks.trigger(this.scroll.scroller.hooks.eventTypes.beforeScrollStart)},e.prototype.moveHandler=function(e){if(this.moved||this.indicatorNotMoved(e)||(this.moved=!0,this.scroll.scroller.hooks.trigger(this.scroll.scroller.hooks.eventTypes.scrollStart)),this.moved){var t=this.newPos(this.currentPos,e,this.scrollInfo);this.syncBScroll(t)}},e.prototype.endHandler=function(){if(this.moved){var e=this.scroll,t=e.x,n=e.y;this.scroll.scroller.hooks.trigger(this.scroll.scroller.hooks.eventTypes.scrollEnd,{x:t,y:n})}},e.prototype.indicatorNotMoved=function(e){var t=this.currentPos,n=this.scrollInfo,i=n.maxScrollPos;return t===n.minScrollPos&&e<=0||t===i&&e>=0},e.prototype.syncBScroll=function(e){var t=Xa(),n=this.scroll,i=n.x,o=n.y,r=n.options,s=n.scroller,a=n.maxScrollY,l=n.minScrollY,u=n.maxScrollX,c=n.minScrollX,d=r.probeType,p=r.momentumLimitTime,h={x:i,y:o};"vertical"===this.direction?h.y=Ya(e,a,l):h.x=Ya(e,u,c),s.translater.translate(h),t-this.startTime>p&&(this.startTime=t,1===d&&s.hooks.trigger(s.hooks.eventTypes.scroll,h)),d>1&&s.hooks.trigger(s.hooks.eventTypes.scroll,h)},e.prototype.newPos=function(e,t,n){var i=n.maxScrollPos,o=n.sizeRatio,r=e+t;return r=Ya(r,n.minScrollPos,i),Math.round(r/o)},e.prototype.destroy=function(){var e=this.options,t=e.interactive,n=e.scrollbarTrackClickable,i=e.isCustom;t&&this.eventHandler.destroy(),n&&this.clickEventRegister.destroy(),i||this.wrapper.parentNode.removeChild(this.wrapper),this.hooksFn.forEach(function(e){var t=e[0],n=e[1],i=e[2];t.off(n,i)}),this.hooksFn.length=0},e}(),cl=function(){function e(e){this.scroll=e,this.handleOptions(),this.createIndicators(),this.handleHooks()}return e.prototype.handleHooks=function(){var e=this,t=this.scroll;t.hooks.on(t.hooks.eventTypes.destroy,function(){for(var t=0,n=e.indicators;t<n.length;t++)n[t].destroy()})},e.prototype.handleOptions=function(){var e=!0===this.scroll.options.scrollbar?{}:this.scroll.options.scrollbar;this.options=function(e,t){for(var n in t)e[n]=t[n];return e}({fade:!0,fadeInTime:250,fadeOutTime:500,interactive:!1,customElements:[],minSize:8,scrollbarTrackClickable:!1,scrollbarTrackOffsetType:"step",scrollbarTrackOffsetTime:300},e)},e.prototype.createIndicators=function(){for(var e,t=this.scroll,n=[],i=["scrollX","scrollY"],o=["horizontal","vertical"],r=this.options.customElements,s=0;s<i.length;s++){var a=i[s];if(t.options[a]){var l=r.shift(),u=o[s],c=!1,d=l||this.createScrollbarElement(u);d!==l?t.wrapper.appendChild(d):c=!0,e=za(za({wrapper:d,direction:u},this.options),{isCustom:c}),n.push(new ul(t,e))}}this.indicators=n},e.prototype.createScrollbarElement=function(e,t){void 0===t&&(t=this.options.scrollbarTrackClickable);var n=document.createElement("div"),i=document.createElement("div");return n.style.cssText="position:absolute;z-index:9999;overflow:hidden;",i.style.cssText="box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px;",i.className="bscroll-indicator","horizontal"===e?(n.style.cssText+="height:7px;left:2px;right:2px;bottom:0;",i.style.height="100%",n.className="bscroll-horizontal-scrollbar"):(n.style.cssText+="width:7px;bottom:2px;top:2px;right:1px;",i.style.width="100%",n.className="bscroll-vertical-scrollbar"),t||(n.style.cssText+="pointer-events:none;"),n.appendChild(i),n},e.pluginName="scrollbar",e}(),dl={duplicateClick:function(e){var t=e[0],n=e[1];t.options.click&&n.options.click&&(n.options.click=!1)},nestedScroll:function(e){var t=e[0],n=e[1],i=t.options.scrollX,o=t.options.scrollY,r=n.options.scrollX,s=n.options.scrollY;i!==r&&o!==s||(e.forEach(function(t,n){var i=e[(n+1)%2];t.on("scrollStart",function(){i.pending&&(i.stop(),i.resetPosition()),function(e){var t=hl(e),n=t.hasHorizontalScroll,i=t.hasVerticalScroll,o=e.scroller,r=o.actions,s=o.scrollBehaviorX,a=o.scrollBehaviorY;r.startTime=+new Date,i?a.startPos=a.currentPos:n&&(s.startPos=s.currentPos)}(i),i.disable()}),t.on("touchEnd",function(){i.enable()})}),n.on("scrollStart",function(){(function(e){var t=hl(e),n=t.hasHorizontalScroll,i=t.hasVerticalScroll,o=e.scroller,r=o.scrollBehaviorX,s=o.scrollBehaviorY,a=e.x>=e.minScrollX&&-1===r.movingDirection,l=e.x<=e.maxScrollX&&1===r.movingDirection,u=e.y>=e.minScrollY&&-1===s.movingDirection,c=e.y<=e.maxScrollY&&1===s.movingDirection;return i?u||c:!!n&&(a||l)})(n)&&(n.disable(),t.enable())}))}};function pl(e,t){for(var n=0,i=e.parentNode;i&&i!==t;)n++,i=i.parentNode;return n}function hl(e){return{hasHorizontalScroll:e.scroller.scrollBehaviorX.hasScroll,hasVerticalScroll:e.scroller.scrollBehaviorY.hasScroll}}const fl=function(){function e(t){var n=e.nestedScroll;return n instanceof e||((n=e.nestedScroll=this).stores=[]),n.setup(t),n.addHooks(t),n}return e.prototype.setup=function(e){this.appendBScroll(e),this.handleContainRelationship(),this.handleCompatible()},e.prototype.addHooks=function(e){var t=this;e.on("destroy",function(){t.teardown(e)})},e.prototype.teardown=function(e){this.removeBScroll(e),this.handleContainRelationship(),this.handleCompatible()},e.prototype.appendBScroll=function(e){this.stores.push(e)},e.prototype.removeBScroll=function(e){var t=this.stores.indexOf(e);-1!==t&&(e.wrapper.isBScrollContainer=void 0,this.stores.splice(t,1))},e.prototype.handleContainRelationship=function(){var e=this.stores;if(e.length<=1)e[0]&&e[0].__parentInfo&&(e[0].__parentInfo=void 0);else for(var t,n,i,o,r=0;r<e.length;r++){n=(t=e[r]).wrapper;for(var s=0;s<e.length;s++)if(o=(i=e[s]).wrapper,t!==i&&o.contains(n))if(t.__parentInfo){var a=pl(n,o);t.__parentInfo.depth>a&&(t.__parentInfo={parent:i,depth:a})}else t.__parentInfo={parent:i,depth:pl(n,o)}}},e.prototype.handleCompatible=function(){var e=this.availableBScrolls(),t=["duplicateClick","nestedScroll"];e.forEach(function(e){t.forEach(function(t){dl[t](e)})})},e.prototype.availableBScrolls=function(){return this.stores.filter(function(e){return!!e.__parentInfo}).map(function(e){return[e.__parentInfo.parent,e]})},e.pluginName="nestedScroll",e}();var gl=__webpack_require__(7685),ml=__webpack_require__.n(gl),yl="undefined"!=typeof window,vl=yl&&navigator.userAgent.toLowerCase();function bl(e,t,n){return e<t?t:e>n?n:e}vl&&/wechatdevtools/.test(vl),vl&&vl.indexOf("android");var wl=yl&&document.createElement("div").style,_l=function(){if(!yl)return!1;var e={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var t in e)if(void 0!==wl[e[t]])return t;return!1}();function Sl(e){return!1===_l?e:"standard"===_l?"transitionEnd"===e?"transitionend":e:_l+e.charAt(0).toUpperCase()+e.substr(1)}function Ol(e){if(e instanceof window.SVGElement){var t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}}return{top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth,height:e.offsetHeight}}function Nl(e,t){e.removeChild(t)}_l&&"standard"!==_l&&_l.toLowerCase(),Sl("transform"),Sl("transition"),yl&&Sl("perspective"),Sl("transitionTimingFunction"),Sl("transitionDuration"),Sl("transitionDelay"),Sl("transformOrigin"),Sl("transitionEnd");var Cl={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(e){return 1+--e*e*e*e*e}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(e){return e*(2-e)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(e){return 1- --e*e*e*e}}},xl=yl&&window;yl&&(xl.requestAnimationFrame||xl.webkitRequestAnimationFrame||xl.mozRequestAnimationFrame||xl.oRequestAnimationFrame),yl&&(xl.cancelAnimationFrame||xl.webkitCancelAnimationFrame||xl.mozCancelAnimationFrame||xl.oCancelAnimationFrame);var Tl=function(){function e(e,t){this.scroll=e,this.slideOpt=t,this.slideEl=null,this.init()}return e.prototype.init=function(){var e=this.scroll.scroller,t=e.scrollBehaviorX,n=e.scrollBehaviorY,i=Ol(e.wrapper),o=Ol(e.content);this.wrapperWidth=i.width,this.wrapperHeight=i.height,this.scrollerHeight=n.hasScroll?o.height:i.height,this.scrollerWidth=t.hasScroll?o.width:i.width;var r=this.slideOpt.stepX||this.wrapperWidth,s=this.slideOpt.stepY||this.wrapperHeight,a=e.content,l=this.slideOpt.el;"string"==typeof l&&(this.slideEl=a.querySelectorAll(l)),this.pages=this.slideEl?this.computePagePosInfoByEl(this.slideEl):this.computePagePosInfo(r,s),this.xLen=this.pages?this.pages.length:0,this.yLen=this.pages&&this.pages[0]?this.pages[0].length:0},e.prototype.hasInfo=function(){return!(!this.pages||!this.pages.length)},e.prototype.getPos=function(e,t){return this.pages[e]?this.pages[e][t]:null},e.prototype.getNearestPage=function(e,t){if(this.hasInfo()){for(var n=0,i=0,o=this.pages.length;n<o-1&&!(e>=this.pages[n][0].cx);n++);for(o=this.pages[n].length;i<o-1&&!(t>=this.pages[0][i].cy);i++);return{pageX:n,pageY:i}}},e.prototype.computePagePosInfo=function(e,t){var n,i,o,r,s=[],a=0,l=0,u=this.scroll.scroller.scrollBehaviorX.maxScrollPos,c=this.scroll.scroller.scrollBehaviorY.maxScrollPos;for(i=Math.round(e/2),o=Math.round(t/2);a>-this.scrollerWidth;){for(s[l]=[],r=0,n=0;n>-this.scrollerHeight;)s[l][r]={x:Math.max(a,u),y:Math.max(n,c),width:e,height:t,cx:a-i,cy:n-o},n-=t,r++;a-=e,l++}return s},e.prototype.computePagePosInfoByEl=function(e){for(var t,n,i,o=[],r=0,s=0,a=0,l=e.length,u=0,c=-1,d=this.scroll.scroller.scrollBehaviorX.maxScrollPos,p=this.scroll.scroller.scrollBehaviorY.maxScrollPos;a<l;a++)i=Ol(e[a]),(0===a||i.left<=Ol(e[a-1]).left)&&(u=0,c++),o[u]||(o[u]=[]),r=Math.max(-i.left,d),s=Math.max(-i.top,p),t=r-Math.round(i.width/2),n=s-Math.round(i.height/2),o[u][c]={x:r,y:s,width:i.width,height:i.height,cx:t,cy:n},r>d&&u++;return o},e}(),kl=function(){function e(e,t){this.scroll=e,this.slideOpt=t}return e.prototype.init=function(){this.currentPage={x:0,y:0,pageX:0,pageY:0},this.pagesPos=new Tl(this.scroll,this.slideOpt),this.checkSlideLoop()},e.prototype.changeCurrentPage=function(e){this.currentPage=e},e.prototype.change2safePage=function(e,t){if(this.pagesPos.hasInfo()){e>=this.pagesPos.xLen?e=this.pagesPos.xLen-1:e<0&&(e=0),t>=this.pagesPos.yLen?t=this.pagesPos.yLen-1:t<0&&(t=0);var n=this.pagesPos.getPos(e,t);return{pageX:e,pageY:t,x:n?n.x:0,y:n?n.y:0}}},e.prototype.getInitPage=function(){return{pageX:this.loopX?1:0,pageY:this.loopY?1:0}},e.prototype.getRealPage=function(e){var t=function(e,t){for(var n=[],i=0;i<t;i++)n.push(i);return n.unshift(t-1),n.push(0),n[e]},n=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var i=0;i<t.length;i++){var o=t[i];for(var r in o)e[r]=o[r]}return e}({},e||this.currentPage);return this.loopX&&(n.pageX=t(n.pageX,this.pagesPos.xLen-2)),this.loopY&&(n.pageY=t(n.pageY,this.pagesPos.yLen-2)),{pageX:n.pageX,pageY:n.pageY}},e.prototype.getPageSize=function(){return this.pagesPos.getPos(this.currentPage.pageX,this.currentPage.pageY)},e.prototype.realPage2Page=function(e,t){if(this.pagesPos.hasInfo()){var n=this.pagesPos.xLen-1,i=this.pagesPos.yLen-1,o=0,r=0;return this.loopX&&(e+=1,o+=1,n-=1),this.loopY&&(t+=1,r+=1,i-=1),{realX:e=bl(e,o,n),realY:t=bl(t,r,i)}}},e.prototype.nextPage=function(){return this.changedPageNum("positive")},e.prototype.prevPage=function(){return this.changedPageNum("negative")},e.prototype.nearestPage=function(e,t,n,i){var o=this.pagesPos.getNearestPage(e,t);if(!o)return{x:0,y:0,pageX:0,pageY:0};var r=o.pageX,s=o.pageY;return r===this.currentPage.pageX&&(r=bl(r+=n,0,this.pagesPos.xLen-1)),s===this.currentPage.pageY&&(s+=i,s=bl(o.pageY,0,this.pagesPos.yLen-1)),{x:this.pagesPos.getPos(r,0).x,y:this.pagesPos.getPos(0,s).y,pageX:r,pageY:s}},e.prototype.getLoopStage=function(){if(!this.needLoop)return"middle";if(this.loopX){if(0===this.currentPage.pageX)return"head";if(this.currentPage.pageX===this.pagesPos.xLen-1)return"tail"}if(this.loopY){if(0===this.currentPage.pageY)return"head";if(this.currentPage.pageY===this.pagesPos.yLen-1)return"tail"}return"middle"},e.prototype.resetLoopPage=function(){if(this.loopX){if(0===this.currentPage.pageX)return{pageX:this.pagesPos.xLen-2,pageY:this.currentPage.pageY};if(this.currentPage.pageX===this.pagesPos.xLen-1)return{pageX:1,pageY:this.currentPage.pageY}}if(this.loopY){if(0===this.currentPage.pageY)return{pageX:this.currentPage.pageX,pageY:this.pagesPos.yLen-2};if(this.currentPage.pageY===this.pagesPos.yLen-1)return{pageX:this.currentPage.pageX,pageY:1}}},e.prototype.isSameWithCurrent=function(e){return e.pageX===this.currentPage.pageX&&e.pageY===this.currentPage.pageY},e.prototype.changedPageNum=function(e){var t=this.currentPage.pageX,n=this.currentPage.pageY;return this.slideX&&(t="negative"===e?t-1:t+1),this.slideY&&(n="negative"===e?n-1:n+1),{pageX:t,pageY:n}},e.prototype.checkSlideLoop=function(){this.needLoop=this.slideOpt.loop,this.pagesPos.xLen>1&&(this.slideX=!0),this.pagesPos.pages[0]&&this.pagesPos.yLen>1&&(this.slideY=!0),this.loopX=this.needLoop&&this.slideX,this.loopY=this.needLoop&&this.slideY,this.slideX&&this.slideY&&console.error("[BScroll warn]: slide does not support two direction at the same time.")},e}(),El=[{key:"next",name:"next"},{key:"prev",name:"prev"},{key:"goToPage",name:"goToPage"},{key:"getCurrentPage",name:"getCurrentPage"}].map(function(e){return{key:e.key,sourceKey:"plugins.slide."+e.name}}),Il=function(){function e(e){this.scroll=e,this.resetLooping=!1,this.isTouching=!1,this.scroll.proxy(El),this.scroll.registerType(["slideWillChange"]),this.slideOpt=this.scroll.options.slide,this.page=new kl(e,this.slideOpt),this.hooksFn=[],this.willChangeToPage={pageX:0,pageY:0},this.init()}return e.prototype.init=function(){var e=this,t=this.slideOpt,n=this.scroll.scroller.content,i=!1;t.loop&&(n.children.length>1?(this.cloneSlideEleForLoop(n),i=!0):t.loop=!1);var o=this.setSlideWidth(n),r=this.setSlideHeight(this.scroll.scroller.wrapper,n),s=o||r,a=this.scroll.hooks,l=this.scroll.scroller.hooks;this.registorHooks(a,"refresh",this.initSlideState),this.registorHooks(a,"destroy",this.destroy),this.registorHooks(l,"momentum",this.modifyScrollMetaHandler),this.registorHooks(this.scroll,"scrollEnd",this.amendCurrentPage),this.registorHooks(l,"beforeStart",this.setTouchFlag),this.registorHooks(l,"scroll",this.scrollMoving),this.registorHooks(l,"resize",this.resize),this.scroll.eventTypes.mousewheelMove&&this.scroll.eventTypes.mousewheelEnd&&(this.registorHooks(this.scroll,"mousewheelMove",function(){return!0}),this.registorHooks(this.scroll,"mousewheelEnd",function(t){1!==t.directionX&&1!==t.directionY||e.next(),-1!==t.directionX&&-1!==t.directionY||e.prev()})),!1!==t.listenFlick&&this.registorHooks(l,"flick",this.flickHandler),i||s?this.scroll.refresh():this.initSlideState()},e.prototype.resize=function(){var e=this,t=this.scroll.scroller.content,n=this.scroll.scroller.wrapper;return clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){e.clearSlideWidth(t),e.clearSlideHeight(t),e.setSlideWidth(t),e.setSlideHeight(n,t),e.scroll.refresh()},this.scroll.options.resizePolling),!0},e.prototype.next=function(e,t){var n=this.page.nextPage(),i=n.pageX,o=n.pageY;this.goTo(i,o,e,t)},e.prototype.prev=function(e,t){var n=this.page.prevPage(),i=n.pageX,o=n.pageY;this.goTo(i,o,e,t)},e.prototype.goToPage=function(e,t,n,i){var o=this.page.realPage2Page(e,t);o&&this.goTo(o.realX,o.realY,n,i)},e.prototype.getCurrentPage=function(){return this.page.getRealPage()},e.prototype.nearestPage=function(e,t){var n=this.scroll.scroller.scrollBehaviorX,i=this.scroll.scroller.scrollBehaviorY,o=!0;return Math.abs(e-n.absStartPos)<=this.thresholdX&&Math.abs(t-i.absStartPos)<=this.thresholdY&&(o=!1),o?this.page.nearestPage(bl(e,n.maxScrollPos,n.minScrollPos),bl(t,i.maxScrollPos,i.minScrollPos),n.direction,i.direction):this.page.currentPage},e.prototype.destroy=function(){var e=this.scroll.scroller.content;if(this.slideOpt.loop){var t=e.children;t.length>2&&(Nl(e,t[t.length-1]),Nl(e,t[0]))}this.hooksFn.forEach(function(e){var t=e[0],n=e[1],i=e[2];t.eventTypes[n]&&t.off(n,i)}),this.hooksFn.length=0},e.prototype.initSlideState=function(){const e=this.page.currentPage;if(this.page.init(),e)this.page.currentPage=e;else{var t=this.page.getInitPage();this.goTo(t.pageX,t.pageY,0)}this.initThreshold()},e.prototype.initThreshold=function(){var e=this.slideOpt.threshold||.1;if(e%1==0)this.thresholdX=e,this.thresholdY=e;else{var t=this.page.getPageSize();t&&(this.thresholdX=Math.round(t.width*e),this.thresholdY=Math.round(t.height*e))}},e.prototype.cloneSlideEleForLoop=function(e){var t,n,i,o=e.children;t=o[o.length-1].cloneNode(!0),(i=(n=e).firstChild)?function(e,t){t.parentNode.insertBefore(e,t)}(t,i):n.appendChild(t),e.appendChild(o[1].cloneNode(!0))},e.prototype.amendCurrentPage=function(){if(this.isTouching=!1,this.slideOpt.loop)if(this.resetLooping)this.resetLooping=!1;else{var e=!1;if(!this.page.loopX||this.scroll.x!==this.scroll.scroller.scrollBehaviorX.minScrollPos&&this.scroll.x!==this.scroll.scroller.scrollBehaviorX.maxScrollPos||(e=!0),!this.page.loopY||this.scroll.y!==this.scroll.scroller.scrollBehaviorY.minScrollPos&&this.scroll.y!==this.scroll.scroller.scrollBehaviorY.maxScrollPos||(e=!0),e){var t=this.scroll.scroller.scrollBehaviorX,n=this.scroll.scroller.scrollBehaviorY,i=this.page.nearestPage(bl(this.scroll.x,t.maxScrollPos,t.minScrollPos),bl(this.scroll.y,n.maxScrollPos,n.minScrollPos),0,0),o={x:i.x,y:i.y,pageX:i.pageX,pageY:i.pageY};this.page.isSameWithCurrent(o)||this.page.changeCurrentPage(o)}var r=this.page.resetLoopPage();if(r)return this.resetLooping=!0,this.goTo(r.pageX,r.pageY,0),!0;this.pageWillChangeTo(this.page.currentPage)}},e.prototype.shouldSetWidthHeight=function(e){var t={width:["scrollX","disableSetWidth"],height:["scrollY","disableSetHeight"]}[e];return!!this.scroll.options[t[0]]&&!this.slideOpt[t[1]]},e.prototype.clearSlideWidth=function(e){if(this.shouldSetWidthHeight("width")){for(var t=e.children,n=0;n<t.length;n++)t[n].removeAttribute("style");e.removeAttribute("style")}},e.prototype.setSlideWidth=function(e){if(!this.shouldSetWidthHeight("width"))return!1;for(var t=e.children,n=t[0].clientWidth,i=0;i<t.length;i++)t[i].style.width=n+"px";return e.style.width=n*t.length+"px",!0},e.prototype.clearSlideHeight=function(e){if(this.shouldSetWidthHeight("height")){for(var t=e.children,n=0;n<t.length;n++)t[n].removeAttribute("style");e.removeAttribute("style")}},e.prototype.setSlideHeight=function(e,t){if(!this.shouldSetWidthHeight("height"))return!1;for(var n=e.clientHeight,i=t.children,o=0;o<i.length;o++)i[o].style.height=n+"px";return t.style.height=n*i.length+"px",!0},e.prototype.goTo=function(e,t,n,i){void 0===t&&(t=0);var o=this.page.change2safePage(e,t);if(o){var r=i||this.slideOpt.easing||Cl.bounce,s=o.x,a=o.y,l=s-this.scroll.scroller.scrollBehaviorX.currentPos,u=a-this.scroll.scroller.scrollBehaviorY.currentPos;(l||u)&&(n=void 0===n?this.getAnimateTime(l,u):n,this.page.changeCurrentPage({x:s,y:a,pageX:o.pageX,pageY:o.pageY}),this.pageWillChangeTo(this.page.currentPage),this.scroll.scroller.scrollTo(s,a,n,r))}},e.prototype.flickHandler=function(){var e=this.scroll.scroller.scrollBehaviorX,t=this.scroll.scroller.scrollBehaviorY,n=e.currentPos-e.startPos,i=t.currentPos-t.startPos,o=this.getAnimateTime(n,i);this.goTo(this.page.currentPage.pageX+e.direction,this.page.currentPage.pageY+t.direction,o)},e.prototype.getAnimateTime=function(e,t){return this.slideOpt.speed?this.slideOpt.speed:Math.max(Math.max(Math.min(Math.abs(e),1e3),Math.min(Math.abs(t),1e3)),300)},e.prototype.modifyScrollMetaHandler=function(e){var t=this.nearestPage(e.newX,e.newY);e.time=this.getAnimateTime(e.newX-t.x,e.newY-t.y),e.newX=t.x,e.newY=t.y,e.easing=this.slideOpt.easing||Cl.bounce,this.page.changeCurrentPage({x:e.newX,y:e.newY,pageX:t.pageX,pageY:t.pageY}),this.pageWillChangeTo(this.page.currentPage)},e.prototype.scrollMoving=function(e){if(this.isTouching){var t=this.nearestPage(e.x,e.y);this.pageWillChangeTo(t)}},e.prototype.pageWillChangeTo=function(e){var t=this.page.getRealPage(e);t.pageX===this.willChangeToPage.pageX&&t.pageY===this.willChangeToPage.pageY||(this.willChangeToPage=t,this.scroll.trigger("slideWillChange",this.willChangeToPage))},e.prototype.setTouchFlag=function(){this.isTouching=!0},e.prototype.registorHooks=function(e,t,n){e.on(t,n,this),this.hooksFn.push([e,t,n])},e.pluginName="slide",e}();const Pl=Il;var Rl,Al=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Dl=function(){return Dl=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Dl.apply(this,arguments)};function Fl(e){return"center"!==e&&"flex-end"!==e&&"end"!==e?e:(void 0===Rl&&(Rl="undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("justify-content","safe center")),Rl?"safe ".concat(e):e)}Pa.use(cl),Pa.use(fl),Pa.use(Wa),Pa.use(Pl);var Ml,jl=function(e){function n(n){var i=e.call(this,n)||this;return i.state={},i.rootRef=function(e){var t;i.scrollRef.current=e,null===(t=i.props.noodlNode)||void 0===t||t.setDOMElement(e),e&&(e.noodlNode=i.props.noodlNode)},i.scrollNeedsToInit=!1,i.scrollRef=t().createRef(),i}return Al(n,e),n.prototype.componentDidMount=function(){this.props.scrollEnabled&&!this.props.nativeScroll&&this.setupIScroll(),this.syncViewObserver()},n.prototype.syncViewObserver=function(){var e,t,n=this,i=this.scrollRef.current;if(!this.props.scrollEnabled||this.props.nativeScroll||!i||"undefined"==typeof ResizeObserver)return null===(e=this.viewObserver)||void 0===e||e.disconnect(),this.viewObserver=void 0,void(this.viewObserved=void 0);this.viewObserver&&this.viewObserved===i||(null===(t=this.viewObserver)||void 0===t||t.disconnect(),this.viewObserved=i,this.viewObserver=new ResizeObserver(function(){return n.measureView()}),this.viewObserver.observe(i),this.measureView())},n.prototype.measureView=function(){var e=this.scrollRef.current;if(e){var t=getComputedStyle(e),n=e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0),i=e.clientHeight-(parseFloat(t.paddingTop)||0)-(parseFloat(t.paddingBottom)||0),o=this.state.view;o&&o.width===n&&o.height===i||this.setState({view:{width:n,height:i}})}},n.prototype.componentWillUnmount=function(){var e;null===(e=this.viewObserver)||void 0===e||e.disconnect(),this.viewObserver=void 0,this.iScroll&&(this.iScroll.destroy(),this.iScroll=void 0)},n.prototype.scrollToIndex=function(e,t){var n=this.scrollRef.current;if(!n)return"the Group has no scrollable element";var i=this.iScroll?n.children[0]:n;if(!i)return"the Group has no scrollable element";var o=i.children[e];if(!o)return"there is no child at index ".concat(JSON.stringify(e)," — the Group has ").concat(i.children.length);this.iScroll?this.iScroll.scrollToElement(o,t,0,0):o.scrollIntoView({behavior:"smooth"})},n.prototype.scrollToElement=function(e,t){if(e){var n="function"==typeof e.getDOMElement?e.getDOMElement():null;if(!n||!n.scrollIntoView)return"the node on Element has no rendered DOM element — it may not be mounted";var i=this.scrollRef.current;if(i&&!i.contains(n))return"the node on Element is not inside this Group, so scrolling it would move a different container";this.iScroll?this.iScroll.scrollToElement(n,t,0,0):n.scrollIntoView({behavior:"smooth"})}},n.prototype.setupIScroll=function(){var e=this,t=this.props.scrollSnapEnabled,n=this.getScrollDirection(),i={disableSetWidth:!0,disableSetHeight:!0,loop:!1},o=this.scrollRef.current;this.iScroll=new Pa(o,{bounceTime:500,swipeBounceTime:300,scrollbar:this.props.showScrollbar?{}:void 0,momentum:!t||!this.props.scrollSnapToEveryItem,bounce:this.props.scrollBounceEnabled&&!(t&&i.loop),scrollX:"x"===n||"both"===n,scrollY:"y"===n||"both"===n,slide:t?i:void 0,probeType:this.props.onScrollPositionChanged?3:1,click:!0,nestedScroll:!0,useTransition:!1});var r=this.iScroll.scroller;r.scrollBehaviorX&&(r.scrollBehaviorX.momentum=ml().bind(r.scrollBehaviorX)),r.scrollBehaviorY&&(r.scrollBehaviorY.momentum=ml().bind(r.scrollBehaviorY)),this.iScroll.on("beforeScrollStart",function(){e.iScroll.refresh()}),this.iScroll.on("scrollStart",function(){e.props.onScrollStart&&e.props.onScrollStart()}),this.iScroll.on("scrollEnd",function(){e.props.onScrollEnd&&e.props.onScrollEnd()}),this.props.onScrollPositionChanged&&this.iScroll.on("scroll",function(){e.props.onScrollPositionChanged("x"===n?-e.iScroll.x:-e.iScroll.y)})},n.prototype.componentDidUpdate=function(e){var t=this;(e.scrollSnapEnabled!==this.props.scrollSnapEnabled||e.onScrollPositionChanged!==this.props.onScrollPositionChanged||e.onScrollStart!==this.props.onScrollStart||e.onScrollEnd!==this.props.onScrollEnd||e.showScrollbar!==this.props.showScrollbar||e.scrollEnabled!==this.props.scrollEnabled||e.nativeScroll!==this.props.nativeScroll||e.scrollSnapToEveryItem!==this.props.scrollSnapToEveryItem||e.layout!==this.props.layout||e.flexWrap!==this.props.flexWrap||e.scrollBounceEnabled!==this.props.scrollBounceEnabled)&&(this.iScroll&&(this.iScroll.destroy(),this.iScroll=void 0),this.scrollNeedsToInit=this.props.scrollEnabled&&!this.props.nativeScroll),this.scrollNeedsToInit&&(this.setupIScroll(),this.scrollNeedsToInit=!1),this.iScroll&&setTimeout(function(){t.iScroll&&t.iScroll.refresh()},0),this.syncViewObserver()},n.prototype.renderIScroll=function(){var e=this.props.style,n=e.flexDirection,i=e.flexWrap,o=e.rowGap,r=e.columnGap,s=e.alignItems,a=e.justifyContent,l={display:"inline-flex",flexShrink:0,flexDirection:n,flexWrap:i,rowGap:o,columnGap:r,alignItems:Fl(s),justifyContent:Fl(a),touchAction:"none"};"row"===n?"wrap"===i?l.width="100%":l.height="100%":"wrap"===i?l.height="100%":l.width="100%","x"===this.getScrollDirection()?l.minWidth="100%":l.minHeight="100%";var u=this.state.view;return u&&Object.assign(l,{"--ndl-scroll-width":"".concat(u.width,"px"),"--ndl-scroll-height":"".concat(u.height,"px")}),t().createElement("div",{className:"scroll-wrapper-internal","data-ndl-slots":"",style:l},this.props.children)},n.prototype.letScrollerSee=function(e){for(var t=this,n={onMouseMove:"move",onMouseUp:"end",onTouchMove:"move",onTouchEnd:"end",onTouchCancel:"end"},i=function(i){var o=e[i];if(!o)return"continue";e[i]=function(e){var r;o(e);var s=null===(r=t.iScroll)||void 0===r?void 0:r.scroller.actionsHandler;null==s||s[n[i]](e.nativeEvent)}},o=0,r=Object.keys(n);o<r.length;o++)i(r[o]);return e},n.prototype.getScrollDirection=function(){return"wrap"===this.props.flexWrap||"wrap-reverse"===this.props.flexWrap?"row"===this.props.layout?"y":"x":"row"===this.props.layout?"x":"y"},n.prototype.render=function(){var e=this.props,n=e.as,i=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}(e,["as"]),o=n||"div",r=i.scrollEnabled&&!i.nativeScroll?this.renderIScroll():i.children,s=Dl({},i.style);if(fn.size(s,i),fn.align(s,i),(i.clip||i.scrollEnabled&&!i.nativeScroll)&&(s.overflowX="hidden",s.overflowY="hidden"),i.scrollEnabled&&(s.justifyContent=Fl(s.justifyContent),s.alignItems=Fl(s.alignItems)),i.scrollEnabled&&i.nativeScroll){var a=this.getScrollDirection();"y"===a?s.overflowY="auto":"x"===a?s.overflowX="auto":"both"===a&&(s.overflowX="auto",s.overflowY="auto")}0===s.opacity&&(s.pointerEvents="none");var l=y(s);return t().createElement(o,Dl({className:v(i.className,l)},i.dom,i.blockTouch?this.letScrollerSee(ki(i)):ki(i),{style:s,ref:this.rootRef}),r)},n}(t().Component),Vl=function(){return Vl=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Vl.apply(this,arguments)},Ll={name:"Group",docs:"https://docs.noodl.net/nodes/basic-elements/group",connectionPanel:{groupPriority:["General","Style","Events","Mounted","Hover Events","Pointer Events","Focus","Scroll"]},initialize:function(){this._internal={scrollElementDuration:500,scrollIndexDuration:500,scrollIndex:0},this.props.layout="column"},getReactComponent:function(){return jl},noodlNodeAsProp:!0,visualStates:[{name:"neutral",label:"Neutral"},{name:"hover",label:"Hover"}],defaultCss:{display:"flex",position:"relative",flexDirection:"column"},inputs:{flexDirection:{index:12,displayName:"Layout",group:"Layout",description:"How children are stacked: None positions them absolutely, Vertical stacks them down, Horizontal across",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Vertical",value:"column"},{label:"Horizontal",value:"row"}]},default:"column",set:function(e){this.setLayout(e),"none"!==e?this.setStyle({flexDirection:e}):this.removeStyle(["flexDirection"]);var t="group/layout-not-a-flex-direction";"none"===e||So.includes(e)?this.context.editorConnection&&this.context.editorConnection.clearWarning&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,t):this.raiseRuntimeError(t,"Layout is ".concat(JSON.stringify(e),", which is not a flex-direction — expected one of ").concat(So.map(function(e){return JSON.stringify(e)}).join(", "),', or "none"')),this.forceUpdate()}},"scrollToIndex.do":{displayName:"Scroll To Index",description:"Scrolls to the child at Index, then fires Done — or Failure with the reason it could not",group:"Scroll To Index",type:"signal",index:505,valueChangedToTrue:function(){var e=this;this.scheduleAfterInputsHaveUpdated(function(){var t=e._internal.scrollIndex,n=e._internal.scrollIndexDuration;e.outcomeOnInnerComponent(function(e){var i=e.scrollToIndex(t,n);return"string"==typeof i?"Scroll To Index did nothing: ".concat(i):void 0},{code:"group/scroll-to-index-failed"})})}},"scrollToElement.do":{displayName:"Scroll To Element",description:"Scrolls to the element on Element; fired in the same frame the Group mounts, it is held until the Group exists rather than dropped",group:"Scroll To Element",type:"signal",index:500,valueChangedToTrue:function(){var e=this;this.scheduleAfterInputsHaveUpdated(function(){var t=e._internal.scrollElement,n=e._internal.scrollElementDuration;e.outcomeOnInnerComponent(function(e){var i=e.scrollToElement(t,n);return"string"==typeof i?"Scroll To Element did nothing: ".concat(i):void 0},{code:"group/scroll-to-element-failed"})})}},"scrollToElement.element":{displayName:"Element",description:"Which element to scroll to, taken from another node's DOM Element output",group:"Scroll To Element",type:"reference",index:501,set:function(e){this._internal.scrollElement=e}},"scrollToElement.duration":{displayName:"Duration",description:"How long the scroll animation takes, in milliseconds; 0 jumps",group:"Scroll To Element",type:"number",default:500,index:502,set:function(e){this._internal.scrollElementDuration=e}},"scrollToIndex.index":{displayName:"Index",description:"Zero-based index of the child to scroll to",group:"Scroll To Index",type:"number",default:0,index:506,set:function(e){this._internal.scrollIndex=e}},"scrollToIndex.duration":{displayName:"Duration",description:"How long the scroll animation takes, in milliseconds; 0 jumps",group:"Scroll To Index",type:"number",default:500,index:507,set:function(e){this._internal.scrollIndexDuration=e}},focus:{displayName:"Focus",type:"signal",description:"Gives this group keyboard focus, so key events reach it",group:"Focus",valueChangedToTrue:function(){var e=this.beginOutcome(),t=!1!==this.context.setNodeFocused(this,!0);this.setDiagnostic("focus/not-mounted",t?null:"Focus arrived while this group was not on the page, so nothing was focused. A Focus is not kept for later: send it once the group has mounted, for example from its Did Mount"),this.reportOutcome(e,t?"done":"unchanged")}}},inputProps:{clip:{index:19,displayName:"Clip Content",description:"Hides any child that overflows the group instead of letting it spill out",type:"boolean",group:"Layout",default:!1},scrollEnabled:{index:54,group:"Scroll",displayName:"Enable Scroll",description:"Lets the user scroll the children when they do not all fit",type:"boolean",default:!1},scrollSnapEnabled:{index:55,displayName:"Snap",description:"Makes scrolling settle on item boundaries rather than anywhere",group:"Scroll",type:"boolean",default:!1},scrollSnapToEveryItem:{index:56,displayName:"Snap To Every Item",description:"Snaps to each item in turn instead of allowing a fast flick past several",group:"Scroll",type:"boolean",default:!1},showScrollbar:{index:57,displayName:"Show Scrollbar",description:"Shows a scrollbar rather than scrolling invisibly",group:"Scroll",type:"boolean",default:!1},scrollBounceEnabled:{index:58,displayName:"Bounce at boundaries",description:"Lets the content overscroll and spring back at the ends",group:"Scroll",type:"boolean",default:!0},nativeScroll:{index:60,group:"Scroll",displayName:"Native platform scroll",description:"Uses the browser's own scrolling, which is smoother; turn it off to get snapping and the Scroll To actions",type:"boolean",default:!0},as:{index:1e5,group:"Advanced HTML",displayName:"Tag",description:"HTML element to render as, which changes nothing visually but matters for screen readers and SEO",type:{name:"enum",enums:[{label:"<div>",value:"div"},{label:"<section>",value:"section"},{label:"<article>",value:"article"},{label:"<aside>",value:"aside"},{label:"<nav>",value:"nav"},{label:"<header>",value:"header"},{label:"<footer>",value:"footer"},{label:"<main>",value:"main"},{label:"<span>",value:"span"}]},default:"div"}},inputCss:{alignItems:{index:13,group:"Align and justify content",displayName:"Align Items",description:"Where children sit across the layout direction",type:{name:"enum",enums:[{label:"Start",value:"flex-start"},{label:"End",value:"flex-end"},{label:"Center",value:"center"},{label:"Stretch",value:"stretch"}],alignComp:"align-items"},default:"flex-start"},justifyContent:{index:14,group:"Align and justify content",displayName:"Justify Content",description:"Where children sit along the layout direction when they do not fill it",type:{name:"enum",enums:[{label:"Start",value:"flex-start"},{label:"End",value:"flex-end"},{label:"Center",value:"center"},{label:"Space Between",value:"space-between"},{label:"Space Around",value:"space-around"},{label:"Space Evenly",value:"space-evenly"}],alignComp:"justify-content"},default:"flex-start",applyDefault:!1},flexWrap:{index:15,displayName:"Multi Line Wrap",description:"Lets children wrap onto another line when they do not fit on one",group:"Layout",type:{name:"enum",enums:[{label:"Off",value:"nowrap"},{label:"On",value:"wrap"},{label:"On Reverse",value:"wrap-reverse"}]},default:"nowrap",onChange:function(e){this.props.flexWrap=e,this.forceUpdate()},applyDefault:!1},alignContent:{index:16,group:"Layout",displayName:"Align Content",description:"Where the wrapped lines sit as a group; only applies once Multi Line Wrap is on",type:{name:"enum",enums:[{label:"Start",value:"flex-start"},{label:"End",value:"flex-end"},{label:"Center",value:"center"},{label:"Space Between",value:"space-between"},{label:"Space Around",value:"space-around"},{label:"Space Evenly",value:"space-evenly"}],alignComp:"align-content"}},rowGap:{index:17,displayName:"Vertical Gap",description:"Space between children on the vertical axis",group:"Layout",type:{name:"number",units:["px","%","em"],defaultUnit:"px"},default:0,applyDefault:!1},columnGap:{index:18,displayName:"Horizontal Gap",description:"Space between children on the horizontal axis",group:"Layout",type:{name:"number",units:["px","%","em"],defaultUnit:"px"},default:0,applyDefault:!1},backgroundColor:{index:201,displayName:"Background Color",description:"Fill colour behind the children",group:"Style",type:"color",default:"transparent",applyDefault:!1,allowVisualStates:!0}},outputProps:{onScrollPositionChanged:{displayName:"Scroll Position",description:"How far the content is scrolled, in pixels from the start",type:"number",group:"Scroll"},onScrollStart:{displayName:"Scroll Start",type:"signal",group:"Scroll",description:"Fires when the user starts scrolling"},onScrollEnd:{displayName:"Scroll End",type:"signal",group:"Scroll",description:"Fires when scrolling settles, including after a flick has coasted to a stop"}},outputs:Vl({focused:{displayName:"Focused",type:"signal",group:"Focus",description:"Fires when this group takes keyboard focus"},focusLost:{displayName:"Focus Lost",type:"signal",group:"Focus",description:"Fires when keyboard focus leaves this group"}},(0,Ni.outcomeOutputs)({done:"Fires once Focus, Scroll To Element or Scroll To Index has been carried out",unchanged:"Fires when Focus arrived while this group was not on the page, so nothing was focused",failure:"Fires when the action did nothing and says why on Error — most often a scroll target that is not inside this group, or a group that has still not mounted"})),dynamicports:[{condition:"flexDirection != none",inputs:["scrollEnabled"]},{condition:"flexDirection != none AND scrollEnabled = true",inputs:["nativeScroll"]},{condition:"flexDirection != none AND scrollEnabled = true AND nativeScroll = false",inputs:["scrollBounceEnabled","scrollSnapEnabled","showScrollbar","scrollToElement.do","scrollToElement.element","scrollToElement.duration","scrollToIndex.do","scrollToIndex.index","scrollToIndex.duration"]},{condition:"flexDirection != none AND scrollEnabled = true AND scrollSnapEnabled = true",inputs:["scrollSnapToEveryItem"]},{condition:"flexDirection != none",inputs:["flexWrap"]},{condition:"flexWrap = wrap OR flexWrap = wrap-reverse",inputs:["alignContent"]},{condition:"flexDirection = row OR flexWrap = wrap OR flexWrap = wrap-reverse",inputs:["columnGap"]},{condition:"flexDirection = column OR flexWrap = wrap OR flexWrap = wrap-reverse",inputs:["rowGap"]}],methods:{_focus:function(){this.sendSignalOnOutput("focused")},_blur:function(){this.sendSignalOnOutput("focusLost")},_canFocus:function(){return!!this.innerReactComponentRef}}};Xn.addDimensions(Ll),Xn.addTransformInputs(Ll),Xn.addSharedVisualInputs(Ll),Xn.addPaddingInputs(Ll),Xn.addMarginInputs(Ll),Xn.addAlignInputs(Ll),Xn.addPointerEventOutputs(Ll),Xn.addFileDropPorts(Ll),Xn.addDragDropPorts(Ll),Xn.addBorderInputs(Ll),Xn.addShadowInputs(Ll),Xn.addBackgroundInputs(Ll),Noodl.deployed||((Ml=Ll).inputProps.clip.tooltip=In({title:"Clip content",body:"Controls if elements that are too big to fit will be clipped",images:[{src:"clip-enabled.svg",label:"Enabled"},{src:"clip-disabled.svg",label:"Disabled"}]}),Ml.inputCss.flexWrap.tooltip=In({title:"Multiline wrap",body:"Elements will wrap to the next line when there's not enough space",images:[{src:"multiline-h.svg",body:"Using a horizontal layout"},{src:"multiline-v.svg",body:"Using a vertical layout"}]}));const Ul=Si(Ll);var Bl=function(){return Bl=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Bl.apply(this,arguments)};function Wl(e){var n=Bl({userSelect:"none"},e.style);fn.size(n,e),fn.align(n,e);var i="ndl-visual-icon";e.className&&(i=i+" "+e.className);var o=y(n);return t().createElement("div",Bl({ref:Li(e.noodlNode)},Ui(e.dom),{className:v(i,o),style:n}),function(){var n={};return"image"===e.iconSourceType&&void 0!==e.iconImageSource?(n.width=e.iconSize,n.height=e.iconSize,t().createElement("img",{alt:"",src:e.iconImageSource,style:n})):"icon"===e.iconSourceType&&void 0!==e.iconIconSource?(n.fontSize=e.iconSize,n.color=e.iconColor,n.lineHeight=1,t().createElement("div",{style:{lineHeight:0}},t().createElement(qi,{source:e.iconIconSource,style:n}))):null}())}var zl={name:"net.noodl.visual.icon",displayName:"Icon",docs:"https://docs.noodl.net/nodes/basic-elements/icon",allowChildren:!1,noodlNodeAsProp:!0,connectionPanel:{groupPriority:["General","Style","Actions","Events","States","Mounted","Hover Events","Pointer Events","Focus Events"]},getReactComponent:function(){return Wl}};Xn.addAlignInputs(zl),Xn.addTransformInputs(zl),Xn.addPaddingInputs(zl),Xn.addMarginInputs(zl),Xn.addIconInputs(zl,{hideEnableIconInput:!0,defaults:{useIcon:!0}}),Xn.addSharedVisualInputs(zl);const ql=Si(zl);var Hl=function(){return Hl=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Hl.apply(this,arguments)};function Gl(e){var n,i=Hl({},e.style);fn.size(i,e),fn.align(i,e),0===i.opacity&&(i.pointerEvents="none");var o=null===(n=e.dom)||void 0===n?void 0:n.src;if(null==o?void 0:o.startsWith("/")){var r=Noodl.Env&&Noodl.Env.BaseUrl;r&&!o.startsWith(r)&&(o=r+o.substring(1))}var s=y(i);return t().createElement("img",Hl({ref:Li(e.noodlNode),className:v(e.className,s)},e.dom,ki(e),{src:o,onError:function(){return function(e,t){var n,i=t?"The image could not be loaded: "+t:"The image could not be loaded — no Source was set";null===(n=e.noodlNode)||void 0===n||n.raiseRuntimeError("image/load-failed",i,{src:t}),e.imageError&&e.imageError(i),e.onError&&e.onError()}(e,o)},style:i}))}var $l={name:"Image",docs:"https://docs.noodl.net/nodes/basic-elements/image",noodlNodeAsProp:!0,visualStates:[{name:"neutral",label:"Neutral"},{name:"hover",label:"Hover"}],connectionPanel:{groupPriority:["General","Image","Style","Actions","Events","Mounted","Pointer Events","Hover Events","Dimensions","Margin and padding"]},initialize:function(){this.props.default=""},getReactComponent:function(){return Gl},getInspectInfo:function(){var e=this.props.dom.srcSet,t=this.props.dom.src?this.props.dom.src.toString():void 0;if(e||t){var n=[];return e&&n.push({type:"text",value:"Source Set: ".concat(e)}),t&&n.push({type:"text",value:e?"Source: ".concat(t):t}),t&&n.push({type:"image",value:t}),n}},allowChildren:!1,defaultCss:{display:"block",flexShrink:0},inputCss:{objectFit:{displayName:"Image Fit",description:"How the image fills its box when the two have different proportions; only available with an explicit size",group:"Dimensions",type:{name:"enum",enums:[{label:"Fill",value:"fill"},{label:"Contain",value:"contain"},{label:"Cover",value:"cover"},{label:"None",value:"none"},{label:"Scale Down",value:"scale-down"}]},default:"contain",allowVisualStates:!0}},dynamicports:[{condition:"sizeMode = explicit",inputs:["objectFit"]}],inputs:{src:{displayName:"Source",group:"Image",type:{name:"image"},index:30,allowVisualStates:!0,description:"URL or project file to display; leave blank to show nothing rather than request a missing image",set:function(e){this.props.dom.src=En(e),this.forceUpdate()}}},inputProps:{srcSet:{displayName:"Source Set",description:'A srcset list letting the browser pick a resolution, e.g. "small.png 480w, large.png 1080w"',placeholder:"small.png 480w, large.png 1080w",group:"Image",propPath:"dom",type:{name:"string"},index:31,allowVisualStates:!0,onChange:function(e){"boolean"==typeof e&&delete this.props.dom.srcSet}},alt:{group:"Image",displayName:"Alternate text",tooltip:"The alt text is used by screen readers, or if the image can't be downloaded or displayed",type:"string",propPath:"dom",index:1e3,default:""}},outputProps:{onLoad:{displayName:"On Load",propPath:"dom",type:"signal",group:"Events",description:"Fires once the image has finished downloading and is on screen"},onError:{displayName:"On Error",type:"signal",group:"Events",description:"Fires when the image could not be loaded, after the reason has been reported on Error"},imageError:{displayName:"Error",type:"string",group:"Error",description:"Why the image could not be loaded, naming the source that failed"}}};Xn.addDimensions($l,{defaultSizeMode:"contentSize",contentLabel:"Image"}),Xn.addTransformInputs($l),Xn.addMarginInputs($l),Xn.addSharedVisualInputs($l),Xn.addAlignInputs($l),Xn.addPointerEventOutputs($l),Xn.addFileDropPorts($l),Xn.addDragDropPorts($l),Xn.addBorderInputs($l),Xn.addShadowInputs($l);const Xl=Si($l);var Yl=function(){return Yl=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Yl.apply(this,arguments)};function Kl(e){var n=e.as||"div",i=Yl(Yl({},e.textStyle),e.style);fn.size(i,e),fn.align(i,e),i.color=e.noodlNode.context.styles.resolveColor(i.color),"ellipsis"===i.textOverflow||"clip"===i.textOverflow?(i.whiteSpace="nowrap",void 0===i.overflow&&(i.overflow="hidden")):(void 0!==i.textOverflow&&delete i.textOverflow,"contentSize"===e.sizeMode||"contentWidth"===e.sizeMode?i.whiteSpace="pre":(i.whiteSpace="pre-wrap",i.overflowWrap="anywhere")),0===i.opacity&&(i.pointerEvents="none");var o,r=y(i);return t().createElement(n,Yl({ref:Li(e.noodlNode),className:v(["ndl-visual-text",e.className].join(" "),r)},e.dom,ki(e),{style:i}),null==(o=e.text)?"":String(o))}var Jl={name:"Text",docs:"https://docs.noodl.net/nodes/basic-elements/text",visualStates:[{name:"neutral",label:"Neutral"},{name:"hover",label:"Hover"}],allowChildren:!1,noodlNodeAsProp:!0,usePortAsLabel:"text",portLabelTruncationMode:"length",connectionPanel:{groupPriority:["General","Text","Text Style","Style","Events","Mounted","Hover Events","Pointer Events"]},nodeDoubleClickAction:{focusPort:"text"},getReactComponent:function(){return Kl},getInspectInfo:function(){return this.props.text},defaultCss:{position:"relative",display:"flex",width:"auto"},inputProps:{text:{index:19,group:"Text",displayName:"Text",description:"The text to show; an empty value renders nothing rather than the words null or undefined",default:"Text",type:{name:"string",multiline:!0}},as:{index:1e5,group:"Advanced HTML",displayName:"Tag",description:"HTML element to render the text as, which changes nothing visually but matters for screen readers and SEO",type:{name:"enum",enums:[{label:"<div>",value:"div"},{label:"<h1>",value:"h1"},{label:"<h2>",value:"h2"},{label:"<h3>",value:"h3"},{label:"<h4>",value:"h4"},{label:"<h5>",value:"h5"},{label:"<h6>",value:"h6"},{label:"<p>",value:"p"},{label:"<span>",value:"span"}]},default:"div"}},inputCss:{wordBreak:{index:27,group:"Text",displayName:"Word Break",applyDefault:!1,type:{name:"enum",enums:[{label:"Normal",value:"normal"},{label:"Break All",value:"break-all"}]},default:"normal"},textOverflow:{index:28,group:"Text",displayName:"Text Overflow",description:"What a line too long for its box does. Needs a width the text can exceed, so it has no effect while the size mode is content-sized",applyDefault:!1,type:{name:"enum",enums:[{label:"Wrap",value:"wrap"},{label:"Clip",value:"clip"},{label:"Ellipsis",value:"ellipsis"}]},default:"wrap"}},inputs:{textAlignX:{group:"Text Alignment",index:13,displayName:"Text Horizontal Align",description:"Aligns the text within its own box on the horizontal axis",type:{name:"enum",enums:[{label:"left",value:"left"},{label:"center",value:"center"},{label:"right",value:"right"}],alignComp:"justify"},default:"left",set:function(e){switch(e){case"left":this.setStyle({textAlign:"left",justifyContent:"flex-start"});break;case"center":this.setStyle({textAlign:"center",justifyContent:"center"});break;case"right":this.setStyle({textAlign:"right",justifyContent:"flex-end"})}}},textAlignY:{group:"Text Alignment",index:14,displayName:"Text Vertical Align",description:"Aligns the text within its own box on the vertical axis, which is only visible when the box is taller than the text",type:{name:"enum",enums:[{label:"Top",value:"top"},{label:"Center",value:"center"},{label:"Bottom",value:"bottom"}],alignComp:"vertical"},default:"top",set:function(e){switch(e){case"top":this.setStyle({alignItems:"flex-start"});break;case"center":this.setStyle({alignItems:"center"});break;case"bottom":this.setStyle({alignItems:"flex-end"})}}}}};Xn.addDimensions(Jl,{defaultSizeMode:"contentHeight",contentLabel:"Text"}),Xn.addTextStyleInputs(Jl),Xn.addAlignInputs(Jl),Xn.addTransformInputs(Jl),Xn.addMarginInputs(Jl),Xn.addSharedVisualInputs(Jl),Xn.addPointerEventOutputs(Jl),Xn.addFileDropPorts(Jl),Xn.addDragDropPorts(Jl),Noodl.deployed||function(e){e.inputCss.wordBreak.tooltip=In({title:"Word break",body:["Control where line breaks are allowed","- Normal: Break on spaces and other whitespace characters","- Break All: Allow line breaks between any two characters, including inside words"]}),e.inputCss.textOverflow.tooltip=In({title:"Text overflow",body:["What a line too long for its box does","- Wrap: Flow onto as many lines as it needs","- Clip: Stay on one line and cut off at the edge","- Ellipsis: Stay on one line and end in a … where it was cut","Clip and Ellipsis need a width the text can exceed, so neither shows while the size mode is content-sized"]})}(Jl);const Ql=Si(Jl);function Zl(e){if(null!=e&&""!==e){var t=Number(e);if(isFinite(t))return Math.max(0,t)}}function eu(e){var t;return null!==(t=Zl(e))&&void 0!==t?t:0}function tu(e){if(null!=e&&""!==e){var t=Number(e);if(isFinite(t))return Math.max(0,Math.floor(t))}}var nu=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),iu=function(){return iu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},iu.apply(this,arguments)},ou=["AbortError"],ru=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return nu(n,e),n.prototype.componentDidUpdate=function(){this.video&&(this.video.muted=this.props.muted,this.video.loop=this.props.loop,this.video.volume=this.props.volume,this.video.autoplay=this.props.autoplay,this.video.controls=this.props.controls)},n.prototype.render=function(){var e=this,n=this.props,i=n.startTime,o=n.endTime,r=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}(n,["startTime","endTime"]),s=function(e,t,n){if("string"!=typeof e||""===e)return e;var i=Zl(t),o=Zl(n),r=null!=i?i:.01;void 0!==o&&o<=r&&(o=void 0);var s=void 0!==i||void 0!==o,a=e.indexOf("#t=");if(!s)return-1===a?"".concat(e,"#t=").concat(.01):e;var l=-1===a?e:e.substring(0,a);return void 0===o?"".concat(l,"#t=").concat(r):"".concat(l,"#t=").concat(r,",").concat(o)}(this.props.src?this.props.src.toString():void 0,i,o);if(s&&s.startsWith("/")){var a=Noodl.Env.BaseUrl;a&&(s=a+s.substring(1))}return t().createElement("video",iu({},r,{playsInline:!0,src:s},ki(this.props),{ref:function(t){e.video=t,e.props.innerRef(t)}}))},n}(t().PureComponent),su=function(e){function n(t){var n=e.call(this,t)||this;return n.wantToPlay=!1,n.canPlay=!1,n}return nu(n,e),n.prototype.componentWillUnmount=function(){this.canPlay=!1},n.prototype.setSourceObject=function(e){this.video.srcObject!==e&&(this.video.srcObject=e,this.canPlay=!1)},n.prototype.reportFailure=function(e,t,n){var i;null===(i=this.props.noodlNode)||void 0===i||i.raiseRuntimeError(e,t,n),this.props.playbackError&&this.props.playbackError(t),this.props.onPlaybackFailure&&this.props.onPlaybackFailure()},n.prototype.startPlayback=function(){var e=this,t=this.video.play();t&&"function"==typeof t.catch&&t.catch(function(t){var n=t&&t.name;-1===ou.indexOf(n)&&e.reportFailure("video/play-rejected","NotAllowedError"===n?"The browser blocked playback: autoplay needs a user gesture, or the video has to be muted":"Playback could not start: "+(t&&t.message?t.message:n),{name:n,message:t&&t.message})})},n.prototype.play=function(){this.wantToPlay=!0,this.canPlay&&this.startPlayback()},n.prototype.restart=function(){var e;this.wantToPlay=!0,this.canPlay&&(this.video.currentTime=eu(null===(e=this.props.dom)||void 0===e?void 0:e.startTime),this.startPlayback())},n.prototype.pause=function(){this.wantToPlay=!1,this.video&&this.video.pause()},n.prototype.reset=function(){var e;this.wantToPlay=!1,this.video&&(this.video.currentTime=eu(null===(e=this.props.dom)||void 0===e?void 0:e.startTime),this.video.pause())},n.prototype.render=function(){var e,n,i,o,r,s,a,l=this,u=this.props,c=iu({},u.style);fn.size(c,u),fn.align(c,u),0===c.opacity&&(c.pointerEvents="none"),c.objectPosition="".concat(u.objectPositionX," ").concat(u.objectPositionY);var d=y(c),p=function(e,t){var n;if(void 0===t&&(t={}),"string"!=typeof e||""===e)return{kind:"file"};var i=null!==(n=tu(t.startTime))&&void 0!==n?n:function(e){var t,n=null!==(t=e.match(/[?&#]t=(?:(\d+)h)?(?:(\d+)m)?(\d+)s?\b/i))&&void 0!==t?t:e.match(/[?&]start=(\d+)/i);if(n){if(2===n.length)return Number(n[1]);var i=n[1],o=n[2],r=n[3];return 3600*(Number(null!=i?i:0)||0)+60*(Number(null!=o?o:0)||0)+(Number(r)||0)}}(e),o=tu(t.endTime),r=t.autoplay,s=t.controls,a=t.loop,l=t.muted,u=function(e){for(var t=0,n=[/(?:youtube\.com|youtube-nocookie\.com)\/watch\?(?:[^#]*&)?v=([A-Za-z0-9_-]{6,})/i,/youtu\.be\/([A-Za-z0-9_-]{6,})/i,/(?:youtube\.com|youtube-nocookie\.com)\/(?:embed|v|shorts)\/([A-Za-z0-9_-]{6,})/i];t<n.length;t++){var i=n[t],o=e.match(i);if(o)return o[1]}return null}(e);if(null!==u){var c=[];return void 0!==i&&c.push("start=".concat(i)),void 0!==o&&(void 0===i||o>i)&&c.push("end=".concat(o)),r?(c.push("autoplay=1"),c.push("mute=1")):l&&c.push("mute=1"),!1===s&&c.push("controls=0"),a&&c.push("loop=1","playlist=".concat(u)),{kind:"iframe",provider:"youtube",url:"https://www.youtube-nocookie.com/embed/".concat(u).concat(c.length?"?".concat(c.join("&")):""),title:"YouTube video player"}}var d=function(e){for(var t=0,n=[/player\.vimeo\.com\/video\/(\d+)/i,/vimeo\.com\/(?:channels\/[^/]+\/)?(\d+)/i];t<n.length;t++){var i=n[t],o=e.match(i);if(o)return o[1]}return null}(e);if(null!==d){c=[],r?c.push("autoplay=1","muted=1"):l&&c.push("muted=1"),!1===s&&c.push("controls=0"),a&&c.push("loop=1");var p=c.length?"?".concat(c.join("&")):"",h=void 0!==i?"#t=".concat(i,"s"):"";return{kind:"iframe",provider:"vimeo",url:"https://player.vimeo.com/video/".concat(d).concat(p).concat(h),title:"Vimeo video player"}}return{kind:"file"}}(null===(e=u.dom)||void 0===e?void 0:e.src,{startTime:null===(n=u.dom)||void 0===n?void 0:n.startTime,endTime:null===(i=u.dom)||void 0===i?void 0:i.endTime,autoplay:null===(o=u.dom)||void 0===o?void 0:o.autoplay,controls:null===(r=u.dom)||void 0===r?void 0:r.controls,loop:null===(s=u.dom)||void 0===s?void 0:s.loop,muted:null===(a=u.dom)||void 0===a?void 0:a.muted});return"iframe"===p.kind?t().createElement("iframe",iu({className:v(u.className,d),style:iu(iu({},c),{border:"none"}),src:p.url,title:p.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",referrerPolicy:"strict-origin-when-cross-origin",allowFullScreen:!0,ref:function(e){var t;null===(t=l.props.noodlNode)||void 0===t||t.setDOMElement(e)}},ki(this.props))):t().createElement(ru,iu({},u.dom,{className:v(u.className,d),style:c,innerRef:function(e){var t;l.video=e,null===(t=l.props.noodlNode)||void 0===t||t.setDOMElement(e),l.props.onVideoElementCreated&&l.props.onVideoElementCreated(e)},onCanPlay:function(){l.canPlay=!0,l.wantToPlay&&l.startPlayback(),l.props.onCanPlay&&l.props.onCanPlay(),l.props.videoWidth&&l.props.videoWidth(l.video.videoWidth),l.props.videoHeight&&l.props.videoHeight(l.video.videoHeight)},onError:function(e){var t=e.target.error;l.reportFailure("video/media-error",t&&t.message?"The video could not be loaded: "+t.message:"The video could not be loaded — check the Source URL and format",{code:t&&t.code,src:e.target.currentSrc})}}))},n}(t().Component),au=function(){return au=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},au.apply(this,arguments)},lu={name:"Video",docs:"https://docs.noodl.net/nodes/basic-elements/video",connectionPanel:{groupPriority:["General","Video","Video Actions","Style","Actions","Events","Mounted","Playback","Pointer Events","Hover Events","Dimensions","Margin and padding"]},getReactComponent:function(){return su},allowChildren:!1,noodlNodeAsProp:!0,defaultCss:{display:"block"},inputs:{srcObject:{displayName:"Source Object",description:"A live MediaStream to play, from a camera or screen capture, instead of a URL",group:"Video",type:"mediastream",default:null,set:function(e){this.withInnerComponent(function(t){return t.setSourceObject(e)})}},play:{type:"signal",group:"Video Actions",displayName:"Play",description:"Starts or resumes playback; fired before the element exists, it is held until the element exists rather than dropped",tooltip:{standard:"Play the video"},valueChangedToTrue:function(){this.outcomeOnInnerComponent(function(e){return e.play()},{code:"video/play-failed"})}},restart:{type:"signal",group:"Video Actions",displayName:"Restart",description:"Seeks to Start Time (the beginning when there is none) and plays, then fires Done",tooltip:{standard:"Restart the video from the beginning"},valueChangedToTrue:function(){this.outcomeOnInnerComponent(function(e){return e.restart()},{code:"video/restart-failed"})}},pause:{type:"signal",group:"Video Actions",displayName:"Pause",description:"Pauses playback",valueChangedToTrue:function(){this.outcomeOnInnerComponent(function(e){return e.pause()},{code:"video/pause-failed"})}},reset:{type:"signal",group:"Video Actions",displayName:"Reset",description:"Stops playback and seeks to Start Time (the beginning when there is none)",valueChangedToTrue:function(){this.outcomeOnInnerComponent(function(e){return e.reset()},{code:"video/reset-failed"})}},src:{displayName:"Source",group:"Video",type:"string",description:"What to play: an mp4, webm or ogg URL, a file in your project, or a YouTube or Vimeo link. A YouTube or Vimeo link is recognised automatically and plays in an embedded player, where Play, Pause, Reset and the failure outputs do not apply. Leave blank to load nothing rather than fail on a missing source",set:function(e){this.props.dom.src=En(e),this.forceUpdate()}},poster:{displayName:"Poster",group:"Video",type:"image",description:"Still image shown until the video has enough data to play; leave blank to show nothing",set:function(e){this.props.dom.poster=En(e),this.forceUpdate()}}},inputProps:{autoplay:{displayName:"Autoplay",description:"Starts playing as soon as the video can; most browsers only allow this while Muted is on. On a YouTube or Vimeo link it is muted automatically for that reason, because an embedded player cannot report that the browser refused",propPath:"dom",group:"Video",type:"boolean"},startTime:{displayName:"Start Time",description:"Seconds into the video to begin at; leave blank to start at the beginning. Works for a video file, for YouTube and for Vimeo",propPath:"dom",group:"Video",type:"number"},endTime:{displayName:"End Time",description:"Seconds at which to stop; leave blank to play to the end. Ignored if it is not later than Start Time, and browsers vary in how strictly they honour it while Loop is on. ⚠️ Approximate on YouTube, and ignored entirely on Vimeo, whose embedded player has no end setting",propPath:"dom",group:"Video",type:"number"},controls:{displayName:"Controls",description:"Shows the browser's own play, seek and volume controls",propPath:"dom",group:"Video",type:"boolean"},volume:{displayName:"Volume",description:"Playback volume from 0 to 1",propPath:"dom",group:"Video",type:"number",default:1},muted:{displayName:"Muted",description:"Silences the video without changing Volume, and is what lets Autoplay work",propPath:"dom",group:"Video",type:"boolean"},loop:{displayName:"Loop",description:"Restarts the video automatically when it reaches the end",propPath:"dom",group:"Video",type:"boolean"},objectPositionX:{displayName:"Video Position X",description:"Which part of the video stays visible horizontally when Object Fit crops it",group:"Video Layout",type:{name:"number",units:["%","px"],defaultUnit:"%"},default:50},objectPositionY:{displayName:"Video Position Y",description:"Which part of the video stays visible vertically when Object Fit crops it",group:"Video Layout",type:{name:"number",units:["%","px"],defaultUnit:"%"},default:50}},inputCss:{objectFit:{displayName:"Object Fit",description:"How the video fills its box when the two have different proportions",group:"Video Layout",type:{name:"enum",enums:[{label:"Contain",value:"contain"},{label:"Cover",value:"cover"},{label:"Fill",value:"fill"},{label:"None",value:"none"}]},default:"contain"}},outputProps:au({onCanPlay:{type:"signal",group:"Events",displayName:"On Can Play",description:"Fires once enough of the video has loaded to start playing"},onTimeUpdate:{group:"Playback",displayName:"Playback Position",description:"How far into the video playback has reached, in seconds",type:"number",propPath:"dom",getValue:function(e){return e.target.currentTime}},onPlay:{group:"Events",displayName:"On Play",type:"signal",propPath:"dom",description:"Fires when playback starts or resumes"},onPause:{group:"Events",displayName:"On Pause",type:"signal",propPath:"dom",description:"Fires when playback pauses"},onPlaybackFailure:{type:"signal",group:"Events",displayName:"Playback Failure",description:"Fires when the video could not be loaded or played, after the reason has been reported on Error"},playbackError:{type:"string",group:"Error",displayName:"Error",description:"Why playback failed — either the browser refused to autoplay, or the source could not be decoded"},onVideoElementCreated:{group:"Advanced",type:"domelement",displayName:"DOM Element",description:"The underlying video element, for a Group to scroll to or a script to reach"},videoWidth:{group:"Playback",type:"number",displayName:"Video Width",description:"Natural width of the video in pixels, known once it has loaded"},videoHeight:{group:"Playback",type:"number",displayName:"Video Height",description:"Natural height of the video in pixels, known once it has loaded"}},(0,Ni.outcomeOutputs)({done:"Fires once a Video Action has been carried out by the element",failure:"Fires when the action never reached the element, because it has still not mounted"}))};Xn.addDimensions(lu,{defaultSizeMode:"contentSize",contentLabel:"Video"}),Xn.addTransformInputs(lu),Xn.addMarginInputs(lu),Xn.addSharedVisualInputs(lu),Xn.addAlignInputs(lu),Xn.addPointerEventOutputs(lu),Xn.addFileDropPorts(lu),Xn.addDragDropPorts(lu),Xn.addBorderInputs(lu);const uu=Si(lu);var cu=__webpack_require__(9638),du=__webpack_require__.n(cu),pu=__webpack_require__(8911),hu=__webpack_require__.n(pu),fu=__webpack_require__(1797),gu=__webpack_require__.n(fu),mu=__webpack_require__(8134),yu=__webpack_require__.n(mu),vu=__webpack_require__(6306),bu=__webpack_require__.n(vu),wu=__webpack_require__(215),_u=__webpack_require__.n(wu),Su=__webpack_require__(2097),Ou={};Ou.styleTagTransform=_u(),Ou.setAttributes=yu(),Ou.insert=gu().bind(null,"head"),Ou.domAPI=hu(),Ou.insertStyleElement=bu(),du()(Su.A,Ou),Su.A&&Su.A.locals&&Su.A.locals;var Nu={};function Cu(e,t,n){for(var i in e[t]||(e[t]={}),n)e[t][i]=n[i]}const xu=function(e,t,n){if("undefined"!=typeof document)if(Nu[e])(function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n]!==t[n])return!1;for(var n in t)if(t.hasOwnProperty(n)&&e[n]!==t[n])return!1;return!0})(t,Nu[e].props)||(Nu[e].style.innerHTML=n(e,t),Nu[e].props=Object.assign({},t));else{var i=document.createElement("style");i.innerHTML=n(e,t),document.head.appendChild(i),Nu[e]={style:i,props:Object.assign({},t)}}},Tu=function(e){!function(e){Cu(e,"inputProps",{blockTouch:{group:"Pointer Events",index:450,displayName:"Block Pointer Events",type:"boolean"},clickBubbling:{group:"Pointer Events",index:451,displayName:"Click Bubbling",type:{name:"enum",enums:[{label:"Automatic",value:"auto"},{label:"Always",value:"always"},{label:"Never",value:"never"}]},default:"auto"}})}(e),function(e){Cu(e,"outputProps",{focusState:{displayName:"Focused",group:"States",type:"boolean",props:{onFocus:function(){this.outputPropValues.focusState=!0,this.flagOutputDirty("focusState"),this.hasOutput("onFocus")&&this.sendSignalOnOutput("onFocus")},onBlur:function(){this.outputPropValues.focusState=!1,this.flagOutputDirty("focusState"),this.hasOutput("onBlur")&&this.sendSignalOnOutput("onBlur")}}},onFocus:{displayName:"Focused",group:"Events",type:"signal",props:{onFocus:function(){this.outputPropValues.focusState=!0,this.flagOutputDirty("focusState"),this.sendSignalOnOutput("onFocus")}}},onBlur:{displayName:"Blurred",group:"Events",type:"signal",props:{onBlur:function(){this.outputPropValues.focusState=!1,this.flagOutputDirty("focusState"),this.sendSignalOnOutput("onBlur")}}},hoverState:{displayName:"Hover",group:"States",type:"boolean",props:{onMouseOver:function(){this.outputPropValues.hoverState=!0,this.flagOutputDirty("hoverState"),this.hasOutput("hoverStart")&&this.sendSignalOnOutput("hoverStart")},onMouseLeave:function(){this.outputPropValues.hoverState=!1,this.flagOutputDirty("hoverState"),this.hasOutput("hoverEnd")&&this.sendSignalOnOutput("hoverEnd")}}},hoverStart:{displayName:"Hover Start",group:"Events",type:"signal",props:{onMouseOver:function(){this.outputPropValues.hoverState=!0,this.flagOutputDirty("hoverState"),this.sendSignalOnOutput("hoverStart")}}},hoverEnd:{displayName:"Hover End",group:"Events",type:"signal",props:{onMouseLeave:function(){this.outputPropValues.hoverState=!1,this.flagOutputDirty("hoverState"),this.sendSignalOnOutput("hoverEnd")}}},pressedState:{displayName:"Pressed",group:"States",type:"boolean",props:{onMouseDown:function(){this.outputPropValues.pressedState=!0,this.flagOutputDirty("pressedState"),this.hasOutput("pointerDown")&&this.sendSignalOnOutput("pointerDown")},onTouchStart:function(){this.outputPropValues.pressedState=!0,this.flagOutputDirty("pressedState"),this.hasOutput("pointerDown")&&this.sendSignalOnOutput("pointerDown")},onMouseUp:function(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this.hasOutput("pointerUp")&&this.sendSignalOnOutput("pointerUp")},onTouchEnd:function(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this.hasOutput("pointerUp")&&this.sendSignalOnOutput("pointerUp")},onTouchCancel:function(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this.hasOutput("pointerUp")&&this.sendSignalOnOutput("pointerUp")}}},pointerDown:{displayName:"Pointer Down",group:"Events",type:"signal",props:{onMouseDown:function(){this.outputPropValues.pressedState=!0,this.flagOutputDirty("pressedState"),this.sendSignalOnOutput("pointerDown")},onTouchStart:function(){this.outputPropValues.pressedState=!0,this.flagOutputDirty("pressedState"),this.sendSignalOnOutput("pointerDown")}}},pointerUp:{displayName:"Pointer Up",group:"Events",type:"signal",props:{onMouseUp:function(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this.sendSignalOnOutput("pointerUp")},onTouchEnd:function(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this.sendSignalOnOutput("pointerUp")},onTouchCancel:function(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this.sendSignalOnOutput("pointerUp")}}}})}(e)},ku=function(e){return Object.assign({},{onFocus:e.onFocus,onBlur:e.onBlur},ki(e))};var Eu=function(){return Eu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Eu.apply(this,arguments)};function Iu(n){(0,e.useEffect)(function(){n.focusChanged&&n.focusChanged(!1),n.hoverChanged&&n.hoverChanged(!1),n.pressedChanged&&n.pressedChanged(!1)},[]);var i=Eu({},n.style);fn.size(i,n),fn.align(i,n),void 0!==n.textStyle&&(i=Object.assign({},n.textStyle,i)),n.boxShadowEnabled&&(i.boxShadow="".concat(n.boxShadowInset?"inset ":"").concat(n.boxShadowOffsetX," ").concat(n.boxShadowOffsetY," ").concat(n.boxShadowBlurRadius," ").concat(n.boxShadowSpreadRadius," ").concat(n.boxShadowColor));var o="ndl-controls-button";return n.className&&(o=o+" "+n.className),t().createElement("button",Eu({className:o},Ui(n.dom),{disabled:!n.enabled},ku(n),{type:n.buttonType,style:i}),n.label,n.children)}var Pu={name:"Button",deprecated:!0,replacedBy:"net.noodl.controls.button",docs:"https://docs.noodl.net/nodes/visual/button",allowChildren:!0,noodlNodeAsProp:!0,initialize:function(){this.outputPropValues.hoverState=this.outputPropValues.focusState=this.outputPropValues.pressedState=!1,this.props.id=this._internal.controlId="input-"+(0,Zi.A)(),this.props.enabled=this._internal.enabled=!0},getReactComponent:function(){return Iu},inputs:{enabled:{type:"boolean",displayName:"Enabled",group:"General",default:!0,set:function(e){var t=(e=!!e)!==this._internal.enabled;this.props.enabled=this._internal.enabled=e,t&&(this.forceUpdate(),this.flagOutputDirty("enabled"))}},textStyle:{index:20,type:"textStyle",group:"Text",displayName:"Text Style",default:"None",set:function(e){this.props.textStyle=this.context.styles.getTextStyle(e),this.forceUpdate()}},fontFamily:{index:21,type:"font",group:"Text",displayName:"Font Family",set:function(e){if(e){var t=e;t.split(".").length>1&&(t=(t=t.replace(/\.[^/.]+$/,"")).split("/").pop()),this.setStyle({fontFamily:t})}else this.removeStyle(["fontFamily"]);this.props.textStyle&&this.forceUpdate()}}},outputs:{controlId:{type:"string",displayName:"Control Id",group:"General",getter:function(){return this._internal.controlId}},enabled:{type:"boolean",displayName:"Enabled",group:"States",getter:function(){return this._internal.enabled}}},inputCss:{fontSize:{index:21,group:"Text",displayName:"Font Size",type:{name:"number",units:["px"],defaultUnit:"px"},onChange:function(){this.props.textStyle&&this.forceUpdate()}},color:{index:24,group:"Text",displayName:"Color",type:"color",default:"#FFFFFF"},backgroundColor:{index:100,displayName:"Background Color",group:"Style",type:"color",default:"#000000"},paddingLeft:{index:64,group:"Margin and padding",default:20,applyDefault:!1,displayName:"Pad Left",type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-left"}},paddingRight:{index:65,group:"Margin and padding",default:20,applyDefault:!1,displayName:"Pad Right",type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-right"}},paddingTop:{index:66,group:"Margin and padding",displayName:"Pad Top",default:5,applyDefault:!1,type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-top"}},paddingBottom:{index:67,group:"Margin and padding",displayName:"Pad Bottom",default:5,applyDefault:!1,type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-bottom"}},borderRadius:{index:202,displayName:"Border Radius",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:0,applyDefault:!1},borderStyle:{index:203,displayName:"Border Style",group:"Style",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Solid",value:"solid"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"}]},default:"none",applyDefault:!1},borderWidth:{index:204,displayName:"Border Width",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:0,applyDefault:!1},borderColor:{index:205,displayName:"Border Color",group:"Style",type:"color",default:"#000000"}},inputProps:{label:{type:"string",displayName:"Label",group:"General",default:"Label"},buttonType:{type:{name:"enum",enums:[{label:"Button",value:"button"},{label:"Submit",value:"submit"}]},displayName:"Type",default:"button",group:"General"},boxShadowEnabled:{index:250,group:"Box Shadow",displayName:"Shadow Enabled",type:"boolean",default:!1},boxShadowOffsetX:{index:251,group:"Box Shadow",displayName:"Offset X",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowOffsetY:{index:252,group:"Box Shadow",displayName:"Offset Y",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowBlurRadius:{index:253,group:"Box Shadow",displayName:"Blur Radius",default:5,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowSpreadRadius:{index:254,group:"Box Shadow",displayName:"Spread Radius",default:2,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowInset:{index:255,group:"Box Shadow",displayName:"Inset",type:"boolean",default:!1},boxShadowColor:{index:256,group:"Box Shadow",displayName:"Shadow Color",type:"color",default:"rgba(0,0,0,0.2)"}},outputProps:{onClick:{displayName:"Click",group:"Events",type:"signal"}},dynamicports:[{condition:"boxShadowEnabled = true",inputs:["boxShadowOffsetX","boxShadowOffsetY","boxShadowInset","boxShadowBlurRadius","boxShadowSpreadRadius","boxShadowColor"]}],methods:{}};Xn.addDimensions(Pu,{defaultSizeMode:"contentSize",contentLabel:"Content",useDimensionConstraints:!1}),Xn.addAlignInputs(Pu),Xn.addTransformInputs(Pu),Xn.addMarginInputs(Pu),Xn.addSharedVisualInputs(Pu),Tu(Pu);var Ru=Si(Pu);Ru.setup=function(e,t){t.on("nodeAdded.Button",function(e){e.parameters.fontFamily&&e.parameters.fontFamily.split(".").length>1&&kn.instance.loadFont(e.parameters.fontFamily),e.on("parameterUpdated",function(e){"fontFamily"===e.name&&e.value&&e.value.split(".").length>1&&kn.instance.loadFont(e.value)})})};const Au=Ru;var Du=function(){return Du=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Du.apply(this,arguments)};function Fu(e,t){return"\n .".concat(e,":checked {\n background-color: ").concat(t.checkedBackgroundColor,";\n } \n ")}function Mu(n){var i=(0,e.useState)(n.checked),o=i[0],r=i[1];(0,e.useEffect)(function(){r(!!n.checked)},[]),(0,e.useEffect)(function(){r(!!n.checked)},[n.checked]);var s=Du({},n.style);fn.size(s,n),fn.align(s,n),n.boxShadowEnabled&&(s.boxShadow="".concat(n.boxShadowInset?"inset ":"").concat(n.boxShadowOffsetX," ").concat(n.boxShadowOffsetY," ").concat(n.boxShadowBlurRadius," ").concat(n.boxShadowSpreadRadius," ").concat(n.boxShadowColor));var a={id:n.id,style:s};xu("ndl-controls-checkbox-"+n._nodeId,{checkedBackgroundColor:n.checkedBackgroundColor},Fu);var l="ndl-controls-checkbox-"+n._nodeId+" ndl-controls-checkbox";return n.className&&(l=l+" "+n.className),t().createElement("input",Du({className:l},Ui(n.dom),{type:"checkbox"},a,ku(n),{checked:o,disabled:!n.enabled,onChange:function(e){r(e.target.checked),n.checkedChanged&&n.checkedChanged(e.target.checked)}}))}var ju={name:"Checkbox",deprecated:!0,replacedBy:"net.noodl.controls.checkbox",displayName:"Checkbox",docs:"https://docs.noodl.net/nodes/visual/checkbox",allowChildren:!1,noodlNodeAsProp:!0,initialize:function(){var e=this;this.props.sizeMode="explicit",this.props.id=this._internal.controlId="input-"+(0,Zi.A)(),this.props.enabled=this._internal.enabled=!0,this.props.checked=this._internal.checked=!1,this.props._nodeId=this.id,this.outputPropValues.hoverState=this.outputPropValues.focusState=this.outputPropValues.pressedState=!1,this.props.checkedChanged=function(t){var n=e._internal.checked!==t;e._internal.checked=t,n&&(e.flagOutputDirty("checked"),e.sendSignalOnOutput("onChange"))}},getReactComponent:function(){return Mu},inputs:{enabled:{type:"boolean",displayName:"Enabled",group:"General",default:!0,set:function(e){var t=(e=!!e)!==this._internal.enabled;this.props.enabled=this._internal.enabled=e,t&&(this.forceUpdate(),this.flagOutputDirty("enabled"))}},checked:{type:"boolean",displayName:"Checked",group:"General",default:!1,set:function(e){var t=(e=!!e)!==this._internal.checked;this.props.checked=this._internal.checked=e,t&&(this.forceUpdate(),this.flagOutputDirty("checked"))}}},outputs:{controlId:{type:"string",displayName:"Control Id",group:"General",getter:function(){return this._internal.controlId}},enabled:{type:"boolean",displayName:"Enabled",group:"States",getter:function(){return this._internal.enabled}},checked:{type:"boolean",displayName:"Checked",group:"States",getter:function(){return this._internal.checked}},onChange:{displayName:"Changed",group:"Events",type:"signal"}},inputProps:{width:{index:11,group:"Dimensions",displayName:"Width",type:{name:"number",units:["%","px","vw"],defaultUnit:"px"},default:32},height:{index:12,group:"Dimensions",displayName:"Height",type:{name:"number",units:["%","px","vh"],defaultUnit:"px"},default:32},checkedBackgroundColor:{displayName:"Background color",group:"Checked Style",type:{name:"color",allowEditOnly:!0},default:"#000000"},boxShadowEnabled:{index:250,group:"Box Shadow",displayName:"Shadow Enabled",type:"boolean",default:!1},boxShadowOffsetX:{index:251,group:"Box Shadow",displayName:"Offset X",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowOffsetY:{index:252,group:"Box Shadow",displayName:"Offset Y",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowBlurRadius:{index:253,group:"Box Shadow",displayName:"Blur Radius",default:5,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowSpreadRadius:{index:254,group:"Box Shadow",displayName:"Spread Radius",default:2,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowInset:{index:255,group:"Box Shadow",displayName:"Inset",type:"boolean",default:!1},boxShadowColor:{index:256,group:"Box Shadow",displayName:"Shadow Color",type:"color",default:"rgba(0,0,0,0.2)"}},inputCss:{backgroundColor:{index:201,displayName:"Background Color",group:"Style",type:"color"},borderRadius:{index:202,displayName:"Border Radius",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:2,applyDefault:!1},borderStyle:{index:203,displayName:"Border Style",group:"Style",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Solid",value:"solid"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"}]},default:"solid",applyDefault:!1},borderWidth:{index:204,displayName:"Border Width",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:1,applyDefault:!1},borderColor:{index:205,displayName:"Border Color",group:"Style",type:"color",default:"#000000"}},outputProps:{},methods:{}};Xn.addAlignInputs(ju),Xn.addTransformInputs(ju),Xn.addMarginInputs(ju),Xn.addSharedVisualInputs(ju),Tu(ju);const Vu=Si(ju);var Lu=function(){return Lu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Lu.apply(this,arguments)};function Uu(e){var n=Lu({},e.style);fn.size(n,e),fn.align(n,e);var i="ndl-controls-fieldset";return e.className&&(i=i+" "+e.className),t().createElement("fieldset",Lu({className:i},Ui(e.dom),{style:n}),e.children)}var Bu={name:"Field Set",docs:"https://docs.noodl.net/nodes/visual/fieldset",allowChildren:!0,noodlNodeAsProp:!0,deprecated:!0,initialize:function(){},defaultCss:{display:"flex",position:"relative",flexDirection:"column"},getReactComponent:function(){return Uu},inputs:{flexDirection:{index:11,displayName:"Layout",group:"Layout",type:{name:"enum",enums:[{label:"Vertical",value:"column"},{label:"Horizontal",value:"row"}]},default:"column",set:function(e){this.setLayout(e),"none"!==e?this.setStyle({flexDirection:e}):this.removeStyle(["flexDirection"]),this.context.editorConnection&&("none"===e||So.includes(e)?this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"layout-warning"):this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"layout-warning",{message:"Invalid Layout value has to be a valid flex-direction value."})),this.forceUpdate()}}},inputProps:{},outputProps:{}};Xn.addDimensions(Bu,{defaultSizeMode:"contentSize",contentLabel:"Content"}),Xn.addAlignInputs(Bu),Xn.addTransformInputs(Bu),Xn.addMarginInputs(Bu),Xn.addPaddingInputs(Bu),Xn.addSharedVisualInputs(Bu);const Wu=Si(Bu);var zu=function(){return zu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},zu.apply(this,arguments)};function qu(e){var n=zu({},e.style);fn.size(n,e),fn.align(n,e);var i="ndl-controls-form";return e.className&&(i=i+" "+e.className),t().createElement("form",zu({className:i},Ui(e.dom),{style:n,onSubmit:function(t){t.preventDefault(),e.onSubmit&&e.onSubmit()}}),e.children)}var Hu={name:"Form",docs:"https://docs.noodl.net/nodes/visual/form",allowChildren:!0,noodlNodeAsProp:!0,deprecated:!0,initialize:function(){},defaultCss:{display:"flex",position:"relative",flexDirection:"column"},getReactComponent:function(){return qu},inputs:{flexDirection:{index:11,displayName:"Layout",group:"Layout",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Vertical",value:"column"},{label:"Horizontal",value:"row"}]},default:"column",set:function(e){this.setLayout(e),"none"!==e?this.setStyle({flexDirection:e}):this.removeStyle(["flexDirection"]),this.context.editorConnection&&("none"===e||So.includes(e)?this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"layout-warning"):this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"layout-warning",{message:"Invalid Layout value has to be a valid flex-direction value."})),this.forceUpdate()}}},inputProps:{},outputProps:{onSubmit:{type:"signal",displayName:"Submit",group:"Events"}}};Xn.addDimensions(Hu,{defaultSizeMode:"contentSize",contentLabel:"Content"}),Xn.addAlignInputs(Hu),Xn.addTransformInputs(Hu),Xn.addMarginInputs(Hu),Xn.addPaddingInputs(Hu),Xn.addSharedVisualInputs(Hu);const Gu=Si(Hu);var $u=function(){return $u=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},$u.apply(this,arguments)};function Xu(e){var n=$u({},e.style);fn.size(n,e),fn.align(n,e),void 0!==e.textStyle&&(n=Object.assign({},e.textStyle,n));var i={for:e.for,onClick:e.onClick},o="ndl-controls-label";return e.className&&(o=o+" "+e.className),t().createElement("label",$u({className:o,style:n},i,Ui(e.dom)),e.text)}var Yu={name:"Label",displayName:"Label",docs:"https://docs.noodl.net/nodes/visual/label",allowChildren:!0,noodlNodeAsProp:!0,deprecated:!0,replacedBy:"Text",getReactComponent:function(){return Xu},defaultCss:{position:"relative",display:"flex"},inputProps:{for:{type:"string",displayName:"For",group:"General"},text:{type:"string",displayName:"Text",group:"General"}}};Xn.addDimensions(Yu,{defaultSizeMode:"contentSize",contentLabel:"Content"}),Xn.addAlignInputs(Yu),Xn.addTextStyleInputs(Yu),Xn.addTransformInputs(Yu),Xn.addMarginInputs(Yu),Xn.addSharedVisualInputs(Yu),Xn.addBorderInputs(Yu);const Ku=Si(Yu);var Ju=function(){return Ju=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ju.apply(this,arguments)};function Qu(n){var i=(0,e.useState)(n.value),o=i[0],r=i[1];(0,e.useEffect)(function(){r(n.value)},[]),(0,e.useEffect)(function(){r(n.value)},[n.value]);var s=Ju({},n.style);fn.size(s,n),fn.align(s,n),void 0!==n.textStyle&&(s=Object.assign({},n.textStyle,s)),n.boxShadowEnabled&&(s.boxShadow="".concat(n.boxShadowInset?"inset ":"").concat(n.boxShadowOffsetX," ").concat(n.boxShadowOffsetY," ").concat(n.boxShadowBlurRadius," ").concat(n.boxShadowSpreadRadius," ").concat(n.boxShadowColor));var a=void 0===o||""===o||void 0===n.items?-1:n.items.findIndex(function(e){return e.Value===o}),l={id:n.id,style:s,onClick:n.onClick},u="ndl-controls-select";return n.className&&(u=u+" "+n.className),t().createElement("select",Ju({className:u},Ui(n.dom),{ref:function(e){e&&(e.selectedIndex=a)}},l,{disabled:!n.enabled,value:o},ku(n),{onChange:function(e){r(e.target.value),n.valueChanged&&n.valueChanged(e.target.value)}}),void 0!==n.items?n.items.map(function(e){return t().createElement("option",{value:e.Value,disabled:"true"===e.Disabled||!0===e.Disabled||void 0,selected:e.Value===o},e.Label)}):null)}var Zu={name:"Options",deprecated:!0,replacedBy:"net.noodl.controls.options",displayName:"Options",docs:"https://docs.noodl.net/nodes/visual/options",allowChildren:!1,noodlNodeAsProp:!0,initialize:function(){var e=this;this._itemsChanged=function(){e.forceUpdate()},this.props.id=this._internal.controlId="input-"+(0,Zi.A)(),this.props.enabled=this._internal.enabled=!0,this.outputPropValues.hoverState=this.outputPropValues.focusState=this.outputPropValues.pressedState=!1,this.props.valueChanged=function(t){var n=e._internal.value!==t;e._internal.value=t,n&&(e.flagOutputDirty("value"),e.sendSignalOnOutput("onChange"))}},getReactComponent:function(){return Qu},inputs:{enabled:{type:"boolean",displayName:"Enabled",group:"General",default:!0,set:function(e){var t=(e=!!e)!==this._internal.enabled;this.props.enabled=this._internal.enabled=e,t&&(this.forceUpdate(),this.flagOutputDirty("enabled"))}},items:{type:"array",displayName:"Items",group:"General",set:function(e){this._internal.items!==e&&void 0!==this._internal.items&&this._internal.items.off("change",this._itemsChanged),this._internal.items=e,this._internal.items.on("change",this._itemsChanged),this.props.items=this._internal.items}},value:{type:"*",displayName:"Value",group:"General",set:function(e){if(void 0!==e&&"string"!=typeof e){if(void 0===e.toString)return;e=e.toString()}var t=e!==this._internal.value;this.props.value=this._internal.value=e,t&&(this.forceUpdate(),this.flagOutputDirty("value"))}},textStyle:{index:20,type:"textStyle",group:"Text",displayName:"Text Style",default:"None",set:function(e){this.props.textStyle=this.context.styles.getTextStyle(e),this.forceUpdate()}},fontFamily:{index:21,type:"font",group:"Text",displayName:"Font Family",set:function(e){if(e){var t=e;t.split(".").length>1&&(t=(t=t.replace(/\.[^/.]+$/,"")).split("/").pop()),this.setStyle({fontFamily:t})}else this.removeStyle(["fontFamily"]);this.props.textStyle&&this.forceUpdate()}}},outputs:{controlId:{type:"string",displayName:"Control Id",group:"General",getter:function(){return this._internal.controlId}},enabled:{type:"boolean",displayName:"Enabled",group:"States",getter:function(){return this._internal.enabled}},value:{type:"string",displayName:"Value",group:"States",getter:function(){return this._internal.value}},onChange:{type:"signal",displayName:"Changed",group:"Events"}},inputCss:{fontSize:{index:21,group:"Text",displayName:"Font Size",type:{name:"number",units:["px"],defaultUnit:"px"},onChange:function(){this.props.textStyle&&this.forceUpdate()}},color:{index:24,group:"Text",displayName:"Color",type:"color"},backgroundColor:{index:100,displayName:"Background Color",group:"Style",type:"color",default:"transparent"},borderRadius:{index:202,displayName:"Border Radius",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:0,applyDefault:!1},borderStyle:{index:203,displayName:"Border Style",group:"Style",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Solid",value:"solid"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"}]},default:"solid",applyDefault:!1},borderWidth:{index:204,displayName:"Border Width",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:1,applyDefault:!1},borderColor:{index:205,displayName:"Border Color",group:"Style",type:"color",default:"#000000"}},inputProps:{boxShadowEnabled:{index:250,group:"Box Shadow",displayName:"Shadow Enabled",type:"boolean",default:!1},boxShadowOffsetX:{index:251,group:"Box Shadow",displayName:"Offset X",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowOffsetY:{index:252,group:"Box Shadow",displayName:"Offset Y",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowBlurRadius:{index:253,group:"Box Shadow",displayName:"Blur Radius",default:5,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowSpreadRadius:{index:254,group:"Box Shadow",displayName:"Spread Radius",default:2,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowInset:{index:255,group:"Box Shadow",displayName:"Inset",type:"boolean",default:!1},boxShadowColor:{index:256,group:"Box Shadow",displayName:"Shadow Color",type:"color",default:"rgba(0,0,0,0.2)"}},outputProps:{},dynamicports:[{condition:"boxShadowEnabled = true",inputs:["boxShadowOffsetX","boxShadowOffsetY","boxShadowInset","boxShadowBlurRadius","boxShadowSpreadRadius","boxShadowColor"]}],methods:{}};Xn.addDimensions(Zu,{defaultSizeMode:"contentSize",contentLabel:"Content"}),Xn.addAlignInputs(Zu),Xn.addTransformInputs(Zu),Xn.addPaddingInputs(Zu),Xn.addMarginInputs(Zu),Xn.addSharedVisualInputs(Zu),Tu(Zu);var ec=Si(Zu);ec.setup=function(e,t){t.on("nodeAdded.Options",function(e){e.parameters.fontFamily&&e.parameters.fontFamily.split(".").length>1&&kn.instance.loadFont(e.parameters.fontFamily),e.on("parameterUpdated",function(e){"fontFamily"===e.name&&e.value&&e.value.split(".").length>1&&kn.instance.loadFont(e.value)})})};const tc=ec;var nc=function(){return nc=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},nc.apply(this,arguments)};function ic(e,t){return"\n .".concat(e,":checked {\n background-color: ").concat(t.checkedBackgroundColor,";\n } \n ")}function oc(n){var i=(0,e.useContext)(fo),o=nc({},n.style);fn.size(o,n),fn.align(o,n),n.boxShadowEnabled&&(o.boxShadow="".concat(n.boxShadowInset?"inset ":"").concat(n.boxShadowOffsetX," ").concat(n.boxShadowOffsetY," ").concat(n.boxShadowBlurRadius," ").concat(n.boxShadowSpreadRadius," ").concat(n.boxShadowColor));var r={id:n.id,style:o};n.checkedChanged&&n.checkedChanged(!!i&&i.selected===n.value),xu("ndl-controls-radiobutton-"+n._nodeId,{checkedBackgroundColor:n.checkedBackgroundColor},ic);var s="ndl-controls-radiobutton-"+n._nodeId+" ndl-controls-radiobutton";return n.className&&(s=s+" "+n.className),t().createElement("input",nc({className:s},Ui(n.dom),ku(n),{type:"radio",name:i?i.name:void 0},r,{disabled:!n.enabled,checked:!!i&&i.selected===n.value,onChange:function(){i&&i.checkedChanged&&i.checkedChanged(n.value)}}))}var rc={name:"Radio Button",deprecated:!0,replacedBy:"net.noodl.controls.radiobutton",displayName:"Radio Button",docs:"https://docs.noodl.net/nodes/visual/radiobutton",allowChildren:!1,noodlNodeAsProp:!0,initialize:function(){var e=this;this.props.sizeMode="explicit",this.props.id=this._internal.controlId="input-"+(0,Zi.A)(),this.props.enabled=this._internal.enabled=!0,this.props._nodeId=this.id,this._internal.checked=!1,this.outputPropValues.hoverState=this.outputPropValues.focusState=this.outputPropValues.pressedState=!1,this.props.checkedChanged=function(t){var n=e._internal.checked!==t;e._internal.checked=t,n&&e.flagOutputDirty("checked")}},getReactComponent:function(){return oc},inputs:{enabled:{type:"boolean",displayName:"Enabled",group:"General",default:!0,set:function(e){var t=(e=!!e)!==this._internal.enabled;this.props.enabled=this._internal.enabled=e,t&&(this.forceUpdate(),this.flagOutputDirty("enabled"))}}},outputs:{controlId:{type:"string",displayName:"Control Id",group:"General",getter:function(){return this._internal.controlId}},enabled:{type:"boolean",displayName:"Enabled",group:"States",getter:function(){return this._internal.enabled}},checked:{type:"boolean",displayName:"Checked",group:"States",getter:function(){return this._internal.checked}}},inputProps:{value:{type:"string",displayName:"Value",group:"General"},width:{index:11,group:"Dimensions",displayName:"Width",type:{name:"number",units:["%","px","vw"],defaultUnit:"px"},default:32},height:{index:12,group:"Dimensions",displayName:"Height",type:{name:"number",units:["%","px","vh"],defaultUnit:"px"},default:32},checkedBackgroundColor:{displayName:"Background color",group:"Checked Style",type:{name:"color",allowEditOnly:!0},default:"#000000"},boxShadowEnabled:{index:250,group:"Box Shadow",displayName:"Shadow Enabled",type:"boolean",default:!1},boxShadowOffsetX:{index:251,group:"Box Shadow",displayName:"Offset X",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowOffsetY:{index:252,group:"Box Shadow",displayName:"Offset Y",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowBlurRadius:{index:253,group:"Box Shadow",displayName:"Blur Radius",default:5,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowSpreadRadius:{index:254,group:"Box Shadow",displayName:"Spread Radius",default:2,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowInset:{index:255,group:"Box Shadow",displayName:"Inset",type:"boolean",default:!1},boxShadowColor:{index:256,group:"Box Shadow",displayName:"Shadow Color",type:"color",default:"rgba(0,0,0,0.2)"}},inputCss:{backgroundColor:{index:201,displayName:"Background Color",group:"Style",type:"color"},borderRadius:{index:202,displayName:"Border Radius",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:16,applyDefault:!1},borderStyle:{index:203,displayName:"Border Style",group:"Style",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Solid",value:"solid"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"}]},default:"solid",applyDefault:!1},borderWidth:{index:204,displayName:"Border Width",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:1,applyDefault:!1},borderColor:{index:205,displayName:"Border Color",group:"Style",type:"color",default:"#000000"}},outputProps:{},methods:{}};Xn.addAlignInputs(rc),Xn.addTransformInputs(rc),Xn.addMarginInputs(rc),Xn.addSharedVisualInputs(rc),Tu(rc);const sc=Si(rc);var ac=function(){return ac=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ac.apply(this,arguments)};function lc(e,t){return"\n .".concat(e,"::-webkit-slider-thumb {\n width: ").concat(t.thumbWidth,";\n height: ").concat(t.thumbHeight,";\n background: ").concat(t.thumbColor,";\n border: 0;\n border-radius: ").concat(t.thumbRadius,";\n cursor: pointer;\n -webkit-appearance: none;\n margin-top:calc(").concat(t.trackHeight,"/2 - ").concat(t.thumbHeight,"/2);\n }\n \n .").concat(e,"::-moz-range-thumb {\n width: ").concat(t.thumbWidth,";\n height: ").concat(t.thumbHeight,";\n background: ").concat(t.thumbColor,";\n border: none;\n border-radius: ").concat(t.thumbRadius,";\n cursor: pointer;\n }\n \n .").concat(e,"::-ms-thumb {\n width: ").concat(t.thumbWidth,";\n height: ").concat(t.thumbHeight,";\n background: ").concat(t.thumbColor,";\n border: none;\n border-radius: ").concat(t.thumbRadius,";\n cursor: pointer;\n margin-top: 0px;\n }\n \n .").concat(e,"::-webkit-slider-runnable-track {\n background: ").concat(t.trackColor,";\n border: none;\n width: 100%;\n height: ").concat(t.trackHeight,";\n cursor: pointer;\n margin-top:0px;\n }\n \n .").concat(e,":focus::-webkit-slider-runnable-track {\n background: ").concat(t.trackColor,";\n }\n \n .").concat(e,"::-moz-range-track {\n background: ").concat(t.trackColor,";\n border: none;\n width: 100%;\n height: ").concat(t.trackHeight,";\n cursor: pointer;\n }\n \n .").concat(e,"::-ms-track {\n background: transparent;\n border:none;\n color: transparent;\n width: 100%;\n height: ").concat(t.trackHeight,";\n cursor: pointer;\n }\n \n .").concat(e,"::-ms-fill-lower {\n background: ").concat(t.trackColor,";\n border: none;\n }\n .").concat(e,"::-ms-fill-upper {\n background: ").concat(t.trackColor,";\n border: none;\n } \n ")}function uc(n){var i=(0,e.useState)(n.value),o=i[0],r=i[1];(0,e.useEffect)(function(){r(n.value)},[]),(0,e.useEffect)(function(){r(n.value)},[n.value]);var s=ac({},n.style);fn.size(s,n),fn.align(s,n);var a={id:n.id,min:n.min,max:n.max,step:n.step,style:s};xu("ndl-controls-range-"+n._nodeId,n,lc);var l="ndl-controls-range-"+n._nodeId+" ndl-controls-range";return n.className&&(l=l+" "+n.className),t().createElement("input",ac({className:l},Ui(n.dom),ku(n),{type:"range"},a,{value:o,disabled:!n.enabled,onChange:function(e){r(e.target.value),n.valueChanged&&n.valueChanged(e.target.value)}}))}var cc={name:"Range",deprecated:!0,replacedBy:"net.noodl.controls.range",docs:"https://docs.noodl.net/nodes/visual/range",allowChildren:!1,noodlNodeAsProp:!0,initialize:function(){var e=this;this.props.sizeMode="explicit",this.props.id=this._internal.controlId="input-"+(0,Zi.A)(),this.props.enabled=this._internal.enabled=!0,this._internal.value=this.props.value=this.props.min,this.props._nodeId=this.id,this.props.valueChanged=function(t){t="string"==typeof t?parseFloat(t):t;var n=e._internal.value!==t;e._internal.value=t,e._updateValuePercent(t),n&&(e.flagOutputDirty("value"),e.sendSignalOnOutput("onChange"))},this.props.valueChanged(this.props.value),this.outputPropValues.hoverState=this.outputPropValues.focusState=this.outputPropValues.pressedState=!1},getReactComponent:function(){return uc},inputs:{enabled:{type:"boolean",displayName:"Enabled",group:"General",default:!0,set:function(e){var t=(e=!!e)!==this._internal.enabled;this.props.enabled=this._internal.enabled=e,t&&(this.forceUpdate(),this.flagOutputDirty("enabled"))}},value:{type:"string",displayName:"Value",group:"General",set:function(e){var t=e!==this._internal.value;this.props.value=this._internal.value=e,this._updateValuePercent(e),t&&(this.forceUpdate(),this.flagOutputDirty("value"))}}},outputs:{controlId:{type:"string",displayName:"Control Id",group:"General",getter:function(){return this._internal.controlId}},enabled:{type:"boolean",displayName:"Enabled",group:"States",getter:function(){return this._internal.enabled}},value:{type:"number",displayName:"Value",group:"States",getter:function(){return this._internal.value}},valuePercent:{type:"number",displayName:"Value Percent",group:"States",getter:function(){return this._internal.valuePercent}},onChange:{type:"signal",displayName:"Changed",group:"Events"}},inputProps:{min:{type:"number",displayName:"Min",group:"General",default:0},max:{type:"number",displayName:"Max",group:"General",default:100},step:{type:"number",displayName:"Step",group:"General",default:1},width:{index:11,group:"Dimensions",displayName:"Width",type:{name:"number",units:["%","px","vw"],defaultUnit:"%"},default:100},height:{index:12,group:"Dimensions",displayName:"Height",type:{name:"number",units:["%","px","vh"],defaultUnit:"%"},default:100},thumbWidth:{group:"Thumb Style",displayName:"Width",type:{name:"number",units:["px","vw","%"],defaultUnit:"px",allowEditOnly:!0},default:16},thumbHeight:{group:"Thumb Style",displayName:"Height",type:{name:"number",units:["px","vh","%"],defaultUnit:"px",allowEditOnly:!0},default:16},thumbRadius:{group:"Thumb Style",displayName:"Radius",type:{name:"number",units:["px","%"],defaultUnit:"px",allowEditOnly:!0},default:8},thumbColor:{group:"Thumb Style",displayName:"Color",type:{name:"color",allowEditOnly:!0},default:"#000000"},trackHeight:{group:"Track Style",displayName:"Height",type:{name:"number",units:["px","vh","%"],defaultUnit:"px",allowEditOnly:!0},default:6},trackColor:{group:"Track Style",displayName:"Color",type:{name:"color",allowEditOnly:!0},default:"#f0f0f0"}},inputCss:{backgroundColor:{index:201,displayName:"Background Color",group:"Style",type:"color"},borderRadius:{index:202,displayName:"Border Radius",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:1,applyDefault:!1},borderStyle:{index:203,displayName:"Border Style",group:"Style",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Solid",value:"solid"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"}]},default:"none",applyDefault:!1},borderWidth:{index:204,displayName:"Border Width",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:1,applyDefault:!1},borderColor:{index:205,displayName:"Border Color",group:"Style",type:"color",default:"#000000"}},outputProps:{},methods:{_updateValuePercent:function(e){var t=this.props.min,n=this.props.max,i=Math.floor((e-t)/(n-t)*100),o=this._internal.valuePercentChanged!==i;this._internal.valuePercent=i,o&&this.flagOutputDirty("valuePercent")}}};Xn.addAlignInputs(cc),Xn.addTransformInputs(cc),Xn.addMarginInputs(cc),Xn.addSharedVisualInputs(cc),Tu(cc);const dc=Si(cc);var pc=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),hc=function(){return hc=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},hc.apply(this,arguments)};function fc(e){e.stopPropagation(),window.removeEventListener("click",fc,!0)}var gc=function(e){function n(n){var i=e.call(this,n)||this;return i.state={value:n.startValue},i.ref=t().createRef(),i}return pc(n,e),n.prototype.setText=function(e){this.setState({value:e}),this.props.onTextChanged&&this.props.onTextChanged(e)},n.prototype.componentDidMount=function(){this.ref.current.noodlNode=this.props.noodlNode,this.setText(this.props.startValue)},n.prototype.render=function(){var e=this,n=hc(hc({},this.props.textStyle),this.props.style);fn.size(n,this.props),fn.align(n,this.props),0===n.opacity&&(n.pointerEvents="none");var i=this.props,o=hc(hc(hc(hc({id:i.id,value:this.state.value},ku(i)),{disabled:!i.enabled,style:n,className:i.className,placeholder:i.placeholder}),Ui(i.dom)),{onChange:function(t){return e.onChange(t)}});return"textArea"!==this.props.type?t().createElement("input",hc({ref:this.ref,type:this.props.type},o,{onKeyDown:function(t){return e.onKeyDown(t)},onMouseDown:function(){return window.addEventListener("click",fc,!0)}})):(o.style.resize="none",t().createElement("textarea",hc({ref:this.ref},o,{onKeyDown:function(t){return e.onKeyDown(t)}})))},n.prototype.onKeyDown=function(e){"Enter"!==e.key&&13!==e.which||this.props.onEnter&&this.props.onEnter()},n.prototype.onChange=function(e){var t=e.target.value;this.setText(t)},n.prototype.focus=function(){this.ref.current&&this.ref.current.focus()},n.prototype.blur=function(){this.ref.current&&this.ref.current.blur()},n}(t().Component),mc={name:"Text Input",deprecated:!0,replacedBy:"net.noodl.controls.textinput",docs:"https://docs.noodl.net/nodes/visual/text-input",allowChildren:!1,noodlNodeAsProp:!0,getReactComponent:function(){return gc},defaultCss:{outline:"none",borderStyle:"solid",padding:0},initialize:function(){this.props.startValue="",this.props.id=this._internal.controlId="input-"+(0,Zi.A)(),this.props.enabled=this._internal.enabled=!0,this.outputPropValues.hoverState=this.outputPropValues.focusState=this.outputPropValues.pressedState=!1},inputProps:{type:{displayName:"Type",group:"Text",index:19,type:{name:"enum",enums:[{label:"Text",value:"text"},{label:"Text Area",value:"textArea"},{label:"Email",value:"email"},{label:"Number",value:"number"},{label:"Password",value:"password"},{label:"URL",value:"url"}]},default:"text"},placeholder:{index:22,group:"Text",displayName:"Placeholder",default:"",type:{name:"string"}},boxShadowEnabled:{index:250,group:"Box Shadow",displayName:"Shadow Enabled",type:"boolean",default:!1},boxShadowOffsetX:{index:251,group:"Box Shadow",displayName:"Offset X",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowOffsetY:{index:252,group:"Box Shadow",displayName:"Offset Y",default:0,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowBlurRadius:{index:253,group:"Box Shadow",displayName:"Blur Radius",default:5,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowSpreadRadius:{index:254,group:"Box Shadow",displayName:"Spread Radius",default:2,type:{name:"number",units:["px"],defaultUnit:"px"}},boxShadowInset:{index:255,group:"Box Shadow",displayName:"Inset",type:"boolean",default:!1},boxShadowColor:{index:256,group:"Box Shadow",displayName:"Shadow Color",type:"color",default:"rgba(0,0,0,0.2)"}},inputs:{enabled:{type:"boolean",displayName:"Enabled",group:"General",default:!0,set:function(e){var t=(e=!!e)!==this._internal.enabled;this.props.enabled=this._internal.enabled=e,t&&(this.forceUpdate(),this.flagOutputDirty("enabled"))}},set:{group:"Actions",displayName:"Set",type:"signal",valueChangedToTrue:function(){var e=this;this.scheduleAfterInputsHaveUpdated(function(){e.setText(e._internal.text)})}},startValue:{index:18,displayName:"Text",type:"string",group:"Text",set:function(e){this._internal.text!==e&&(this._internal.text=e,!1===this.isInputConnected("set")&&this.setText(e))}},textStyle:{index:19,type:"textStyle",group:"Text",displayName:"Text Style",default:"None",set:function(e){this.props.textStyle=this.context.styles.getTextStyle(e),this.forceUpdate()}},fontFamily:{index:20,type:"font",group:"Text",displayName:"Font Family",set:function(e){if(e){var t=e;t.split(".").length>1&&(t=(t=t.replace(/\.[^/.]+$/,"")).split("/").pop()),this.setStyle({fontFamily:t})}else this.removeStyle(["fontFamily"]);this.props.textStyle&&this.forceUpdate()}},clear:{type:"signal",group:"Actions",displayName:"Clear",valueChangedToTrue:function(){this.setText("")}},focus:{type:"signal",group:"Actions",displayName:"Focus",valueChangedToTrue:function(){this.context.setNodeFocused(this,!0)}},blur:{type:"signal",group:"Actions",displayName:"Blur",valueChangedToTrue:function(){this.context.setNodeFocused(this,!1)}}},inputCss:{fontSize:{index:21,group:"Text",displayName:"Font Size",type:{name:"number",units:["px"],defaultUnit:"px"},onChange:function(){this.props.textStyle&&this.forceUpdate()}},color:{index:99,type:"color",displayName:"Font Color",group:"Style"},backgroundColor:{index:100,displayName:"Background Color",group:"Style",type:"color",default:"transparent"},borderColor:{index:101,displayName:"Border Color",group:"Style",type:"color",default:"black"},borderWidth:{index:102,displayName:"Border Width",group:"Style",type:{name:"number",units:["px"],defaultUnit:"px"},default:0}},outputs:{controlId:{type:"string",displayName:"Control Id",group:"General",getter:function(){return this._internal.controlId}},enabled:{type:"boolean",displayName:"Enabled",group:"States",getter:function(){return this._internal.enabled}}},outputProps:{onTextChanged:{group:"Values",displayName:"Text",type:"string"},onEnter:{group:"Events",displayName:"On Enter",type:"signal"}},dynamicports:[{condition:"boxShadowEnabled = true",inputs:["boxShadowOffsetX","boxShadowOffsetY","boxShadowInset","boxShadowBlurRadius","boxShadowSpreadRadius","boxShadowColor"]}],methods:{_focus:function(){this.innerReactComponentRef&&this.innerReactComponentRef.focus()},_blur:function(){this.innerReactComponentRef&&this.innerReactComponentRef.blur()},setText:function(e){this.props.startValue=e,this.innerReactComponentRef?this.innerReactComponentRef.setText(e):this.outputPropValues.onTextChanged!==e&&(this.outputPropValues.onTextChanged=e,this.flagOutputDirty("onTextChanged"))}}};Xn.addDimensions(mc,{defaultSizeMode:"contentSize",contentLabel:"Text"}),Xn.addAlignInputs(mc),Xn.addTransformInputs(mc),Xn.addPaddingInputs(mc),Xn.addMarginInputs(mc),Xn.addSharedVisualInputs(mc),Tu(mc);var yc=Si(mc);yc.setup=function(e,t){t.on("nodeAdded.Text Input",function(e){e.parameters.fontFamily&&e.parameters.fontFamily.split(".").length>1&&kn.instance.loadFont(e.parameters.fontFamily),e.on("parameterUpdated",function(e){"fontFamily"===e.name&&e.value&&e.value.split(".").length>1&&kn.instance.loadFont(e.value)})})};const vc=yc;function bc(e){[__webpack_require__(3497),__webpack_require__(5749),__webpack_require__(7269),__webpack_require__(7089),__webpack_require__(8477),__webpack_require__(2324),__webpack_require__(5533),__webpack_require__(6645),__webpack_require__(1964),__webpack_require__(2889),__webpack_require__(3952),__webpack_require__(1952),__webpack_require__(4229),__webpack_require__(2657),__webpack_require__(7269),__webpack_require__(4361),__webpack_require__(2620),__webpack_require__(3272),__webpack_require__(6074),__webpack_require__(3745),__webpack_require__(4942),__webpack_require__(3766),__webpack_require__(7600),__webpack_require__(5230),__webpack_require__(1033),__webpack_require__(2400),__webpack_require__(5496),__webpack_require__(3395),__webpack_require__(2394),__webpack_require__(3752),__webpack_require__(1829),__webpack_require__(295),__webpack_require__(6328),__webpack_require__(3231),__webpack_require__(5954),__webpack_require__(1340),__webpack_require__(2045),__webpack_require__(9469),__webpack_require__(1136),__webpack_require__(5768),__webpack_require__(7064),__webpack_require__(7646),__webpack_require__(7123),__webpack_require__(4959),__webpack_require__(8338),__webpack_require__(6825),__webpack_require__(1270),__webpack_require__(9472),__webpack_require__(4e3),__webpack_require__(4111),__webpack_require__(6196),__webpack_require__(6241),__webpack_require__(2623),__webpack_require__(568)].forEach(function(t){e.registerNode(t.default||t)}),e.registerNode(ss),e.registerNode(Ul),e.registerNode(Ql),e.registerNode(Xl),e.registerNode(ql),e.registerNode(Wr),e.registerNode(uu),e.registerNode(ys),e.registerNode(Pr),e.registerNode(is),e.registerNode(Au),e.registerNode(Vu),e.registerNode(sc),e.registerNode(tc),e.registerNode(dc),e.registerNode(Ku),e.registerNode(vc),e.registerNode(Gu),e.registerNode(Wu),e.registerNode(Yi),e.registerNode(no),e.registerNode(No),e.registerNode(bo),e.registerNode(ho),e.registerNode(Lo),e.registerNode(Jo),e.registerNode(ar),e.registerNode(gr),e.registerNode(kr)}var wc=function(){function e(e){var t=e.graphModel,n=e.nodeRegister,i=e.getNodeScope,o=this;this.getNodeScope=i,this.graphModel=t,this.nodeRegister=n,this.setStyles(t.getMetaData("styles")||{}),t.on("metadataChanged.styles",function(e){return o.setStyles(e)})}return e.prototype.setStyles=function(e){this.styles=e;var t=e.text||{};for(var n in Object.values(t).filter(function(e){return e.fontFamily}).forEach(function(e){var t=e.fontFamily;t.split(".").length>1&&(kn.instance.loadFont(t),t=(t=t.replace(/\.[^/.]+$/,"")).split("/").pop(),e.fontFamily=t)}),t){var i=t[n];for(var o in i){var r=i[o];"object"==typeof r&&(i[o]=r.value+r.unit)}}for(var s in t)(i=t[s]).hasOwnProperty("color")&&!i.color&&delete i.color;var a=this.getNodeScope&&this.getNodeScope();if(a){for(var l=this.graphModel.getVariants(),u=function(e){c._variantHasInputsWithTypes(e,["color","textStyle"])&&a.getAllNodesWithVariantRecursive(e).forEach(function(t){return t.setVariant(e)})},c=this,d=0,p=l;d<p.length;d++)u(p[d]);["color","textStyle"].forEach(function(e){(function(e,t){var n=[];return e.getAllNodesRecursive().forEach(function(e){var i=[];for(var o in e._inputs)e._inputs[o].type===t&&i.push(o);i.length&&n.push({node:e,inputs:i})}),n})(a,e).forEach(function(e){var t=e.node;e.inputs.forEach(function(e){t.getInputValue(e)&&t.setInputValue(e,t.getInputValue(e))})})})}},e.prototype.resolveColor=function(e){return this.styles.colors&&this.styles.colors[e]||e},e.prototype.getTextStyle=function(e){return this.styles.text&&this.styles.text[e]||{}},e.prototype._variantHasInputsWithTypes=function(e,t){if(this.nodeRegister.hasNode(e.typename)){var n=this.nodeRegister.getNodeMetadata(e.typename),i=new Set(Object.keys(e.parameters));for(var o in e.stateParameters)Object.keys(e.stateParameters[o]).forEach(function(e){return i.add(e)});for(var r=0,s=Array.from(i);r<s.length;r++){var a=s[r],l=n.inputs[a]&&n.inputs[a].type;if(t.includes(l))return!0}return!1}},e}();const _c=wc;function Sc(e,t){if(t.reactNodes){const e=[];for(const n of t.reactNodes)e.push(Si(pt(n)));const n=t.nodes||[];t.nodes=n.concat(e)}try{return e.registerModule(t),null}catch(e){const n=e&&e.message?e.message:String(e),i=/rest of the app/i.test(n)?"":" The rest of the app is unaffected.";return console.error(`${n}${i}`),{module:t.name||"Unknown Module",reason:"registration-failed",message:n}}}"undefined"!=typeof window&&window.NoodlEditor&&(window.NoodlEditorInspectorAPI={enabled:!1,inspector:null,setInspector(e){this.inspector=e,this.enabled?this.inspector.enable():this.inspector.disable()},setEnabled(e){this.enabled=e,this.inspector&&(this.enabled?this.inspector.enable():this.inspector.disable()),window.NoodlEditorHighlightAPI.highlighter&&(window.NoodlEditorHighlightAPI.highlighter.setWindowSelected(e),window.NoodlEditorHighlightAPI.highlighter.setDesignMode(e))}},window.NoodlEditorHighlightAPI={highlighter:null,setHighlighter(e){this.highlighter=e,this.highlighter.setWindowSelected(window.NoodlEditorInspectorAPI.enabled),this.highlighter.setDesignMode(window.NoodlEditorInspectorAPI.enabled)},selectNode(e){this.highlighter.deselectNodes();const t=Array.isArray(e)?e:e&&"null"!==e?[e]:null;t&&t.length?this.highlighter.selectNodesAtPath(t):window.NoodlEditorInspectorAPI.enabled&&this.highlighter.setWindowSelected(!0)},showPlacement(e){if(!this.highlighter)return;const t=Array.isArray(e)?e:e&&"null"!==e?[e]:null;t&&t.length?this.highlighter.showPlacementAtPath(t):this.highlighter.clearPlacement()},hoverNode(e){this.highlighter&&(this.highlighter.disableHighlight(),Array.isArray(e)&&e.length&&this.highlighter.highlightNodesAtPath(e))},setTransformOriginFocus(e){this.highlighter&&this.highlighter.setTransformOriginFocus(e)},explainStyle(e){if(!this.highlighter)return[];const t=Array.isArray(e)?e:e?[e]:[];if(!t.length)return[];try{return JSON.parse(JSON.stringify(this.highlighter.explainStyleAtPath(t)))}catch(e){return[]}}});class Oc extends t().Component{constructor(e){super(e),this.state={popups:[]};const{noodlRuntime:n}=e;this.runningDeployed=void 0!==this.props.projectData,this.focusTracker=new c,this.containerRef=t().createRef(),this.popupDialogs=new ot(()=>this.containerRef.current),this.onDocumentKeyDown=this.onDocumentKeyDown.bind(this),n.context.setNodeFocused=this.setNodeFocused.bind(this),n.context.setNodeUnmounted=e=>this.focusTracker.nodeUnmounted(e);const i="undefined"!=typeof document&&-1!==document.location.href.indexOf("forceDebugger=true")||Noodl.enableDebugInspectors;n.setDebugInspectorsEnabled(i),n.context.setPopupCallbacks({onShow:(e,t)=>{this.popupDialogs.shown(e,t);const i=this.state.popups.concat([e]);n.getProjectSettings().bodyScroll&&1===i.length&&(document.body.style.width=document.body.clientWidth+"px",document.body.style.top=`-${window.scrollY}px`,document.body.style.position="fixed"),this.setState({popups:i})},onClose:e=>{this.popupDialogs.closed(e);const t=this.state.popups.filter(t=>t!==e);if(this.setState({popups:t}),n.getProjectSettings().bodyScroll&&0===t.length){const e=document.body.style.top;document.body.style.position="",document.body.style.top="",document.body.style.width="100%",window.scrollTo(0,-1*parseInt(e||"0"))}}}),bc(n),Qe(n),n.setProjectSettings(rt);const o=[];if(this.props.noodlModules)for(const e of this.props.noodlModules){const t=Sc(n,e);t&&o.push(t)}if(n.setModuleFailures){const e="undefined"!=typeof window&&window.__noodl_module_failures||[];n.setModuleFailures(e.concat(o))}if(n.eventEmitter.on("rootComponentUpdated",()=>{requestAnimationFrame(()=>this.forceUpdate())}),n.graphModel.on("projectSettingsChanged",e=>{"undefined"!=typeof document&&(e.bodyScroll?document.body.classList.add("body-scroll"):document.body.classList.remove("body-scroll"))}),this.styles=new _c({graphModel:n.graphModel,getNodeScope:()=>n.context.rootComponent&&n.context.rootComponent.nodeScope,nodeRegister:n.context.nodeRegister}),n.context.styles=this.styles,this.state.waitingForExport=!this.runningDeployed,this.runningDeployed){this.props.noodlRuntime.setData(this.props.projectData);const e=Object.keys(this.props.projectData.componentIndex);e.length<30&&setTimeout(()=>{this.props.noodlRuntime.prefetchBundles(e,3)},1e4)}else n.graphModel.on("editorImportComplete",()=>{this.setState({waitingForExport:!1})}),this.connectToEditor();this.focusTracker.reset()}connectToEditor(){const{noodlRuntime:e}=this.props,t=((Noodl.host||location.protocol+"//"+location.host)+location.pathname+(location.search?location.search:"")).replace("http","ws");var n,i;e.connectToEditor(t),this.highlightedNodes=new Map,this.isUpdatingHighlights=!1,"undefined"!=typeof window&&window.NoodlEditor&&(this.highlighter=new Ne(e),NoodlEditorHighlightAPI.setHighlighter(this.highlighter),this.inspector=new Ee({onDisableHighlight:()=>this.highlighter.disableHighlight(),onHighlight:(e,t)=>this.highlighter.highlightNodesAtPath(t),onInspect:(e,t)=>{t&&NoodlEditor.inspectPaths?NoodlEditor.inspectPaths(t):NoodlEditor.inspectNodes(e)}}),NoodlEditorInspectorAPI.setInspector(this.inspector)),e.editorConnection.on("debuggingEnabledChanged",t=>{e.setDebugInspectorsEnabled(t)}),n=e,(i=e.editorConnection).on("injectInput",function(e){var t=e;t&&t.clientId===i.clientId&&i.sendInputResult(function(e,t,n){var i,o=function(e,n,i){return{requestId:t.requestId,ok:e,matched:n,message:i}},r=0;try{if(!t.nodeId&&!t.selector)return o(!1,0,"No target: pass a nodeId (preferred) or a CSS selector.");var s=function(e,t,n){if(t.selector)return n?Array.prototype.slice.call(n.querySelectorAll(t.selector)):[];if(!t.nodeId)return[];if(!e.rootComponent)return[];for(var i=[],o=0,r=e.rootComponent.nodeScope.getNodesWithIdRecursive(t.nodeId);o<r.length;o++){var s=r[o],a=s.getDOMElement&&s.getDOMElement();a&&i.push(a)}return i}(e,t,n);if(r=s.length,0===s.length){if(t.selector)return o(!1,0,'No element matches the selector "'.concat(t.selector,'".'));if(!e.rootComponent)return o(!1,0,"The app has no root component yet — is it still loading?");var a=e.rootComponent.nodeScope.getNodesWithIdRecursive(t.nodeId);return 0===a.length?o(!1,0,"No node with id ".concat(t.nodeId," is running. It may be on a page that is not open.")):o(!1,0,"Node ".concat(t.nodeId," is running (").concat(a.length," instance(s)) but renders no DOM element, so it cannot receive input."))}var l=null!==(i=t.index)&&void 0!==i?i:0,u=s[l];if(!u)return o(!1,s.length,"index ".concat(l," is out of range — ").concat(s.length," instance(s) matched."));var c=s.length>1&&void 0===t.index?" ⚠️ ".concat(s.length,' instances matched (a Repeater row, most likely); acted on index 0. Pass "index" to choose.'):"";return"click"===t.action?(function(e){var t=e.getBoundingClientRect(),n={bubbles:!0,cancelable:!0,view:"undefined"!=typeof window?window:void 0,clientX:t.left+t.width/2,clientY:t.top+t.height/2,button:0,buttons:1};"function"==typeof PointerEvent&&e.dispatchEvent(new PointerEvent("pointerdown",Te(Te({},n),{pointerId:1,isPrimary:!0}))),e.dispatchEvent(new MouseEvent("mousedown",n)),"function"==typeof e.focus&&e.focus(),"function"==typeof PointerEvent&&e.dispatchEvent(new PointerEvent("pointerup",Te(Te({},n),{buttons:0,pointerId:1,isPrimary:!0}))),e.dispatchEvent(new MouseEvent("mouseup",Te(Te({},n),{buttons:0}))),e.dispatchEvent(new MouseEvent("click",Te(Te({},n),{buttons:0})))}(u),o(!0,s.length,"Clicked <".concat(u.tagName.toLowerCase(),">.")+c)):"setText"===t.action?"string"!=typeof t.value?o(!1,s.length,'setText needs a "value" string.'):function(e,t){var n=(e.tagName||"").toLowerCase();if("input"!==n&&"textarea"!==n)return!1;var i="input"===n?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,o=Object.getOwnPropertyDescriptor(i,"value");return o&&o.set?o.set.call(e,t):e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),!0}(u,t.value)?o(!0,s.length,"Set the text of <".concat(u.tagName.toLowerCase(),">.")+c):o(!1,s.length,"<".concat(u.tagName.toLowerCase(),"> is not an input or textarea, so it has no text to set.")):o(!1,s.length,'Unknown action "'.concat(t.action,'".'))}catch(e){return o(!1,r,"The input could not be delivered: "+(e&&e.message||String(e)))}}(n,t,"undefined"!=typeof document?document:void 0))}),this.graphWarnings=new d(e.graphModel,e.editorConnection)}setNodeFocused(e,t){return this.focusTracker.setNodeFocused(e,t)}get focusedNoodlNodes(){return this.focusTracker.nodes}onClickCapture(e){this.focusTracker.onClickCapture(e.target)}componentDidMount(){document.addEventListener("keydown",this.onDocumentKeyDown)}componentDidUpdate(e,t){t.popups!==this.state.popups&&this.popupDialogs.afterRender()}componentWillUnmount(){document.removeEventListener("keydown",this.onDocumentKeyDown),this.popupDialogs.dispose()}onDocumentKeyDown(e){"Escape"!==e.key||e.defaultPrevented||0===this.state.popups.length||this.props.noodlRuntime.context.cancelTopPopup()&&e.preventDefault()}render(){const e=this.props.noodlRuntime.rootComponent;if(this.state.waitingForExport)return null;if(!e)return this.runningDeployed?null:t().createElement("div",{style:{overflowY:"auto",padding:"24px",fontFamily:"Open Sans",fontSize:"16px",width:"100vw",height:"100vh",backgroundColor:"#F57569"}},t().createElement("div",{style:{marginBottom:"50px",fontWeight:"bold",display:"flex",alignItems:"center"}},t().createElement("span",null,"ERROR"),t().createElement("img",{src:"ndl_assets/noodl-logo-black.svg",style:{marginLeft:"auto"}})),t().createElement("div",{style:{margin:"0 auto",alignItems:"center",display:"flex",flexDirection:"column"}},t().createElement("div",{style:{fontSize:"24px",textAlign:"center",marginBottom:"50px"}},"No ",t().createElement("img",{src:"ndl_assets/home-icon.svg",style:{marginRight:"-6px"}})," ",t().createElement("span",{style:{fontWeight:"bold"}},"HOME")," component selected"),t().createElement("div",{style:{textAlign:"center"}},"Click ",t().createElement("span",{style:{fontWeight:"bold"}},"Make home")," as shown below."),t().createElement("img",{style:{marginTop:"24px"},srcSet:"ndl_assets/make-home-instructions@2x.png 2x"})));if(this.props.noodlRuntime.getProjectSettings().bodyScroll){const n={margin:0,padding:0,minHeight:"100vh",alignSelf:"stretch",display:"flex",flexDirection:"column"};return t().createElement("div",{ref:this.containerRef,style:n,onClickCapture:e=>this.onClickCapture(e)},t().createElement("div",{style:{...n,isolation:"isolate"}},e.render()),this.state.popups.length?t().createElement("div",{style:{...n,isolation:"isolate"}},this.state.popups.map(e=>e.render())):null)}return t().createElement("div",{ref:this.containerRef,style:{margin:0,padding:0,overflow:"clip",width:"100%",height:"100%"},onClickCapture:e=>this.onClickCapture(e)},e.render(),this.state.popups.map(e=>e.render()))}}var Nc=__webpack_require__(5711);String.prototype.matchAll||(String.prototype.matchAll=function(e){var t=new RegExp(e,"g"),n=[],i=this.match(t);for(var o in i){var r=i[o];n[o]=r.match(new RegExp(e))}return n});let Cc=null;function xc(){return"undefined"==typeof window?{type:"browser",platform:{requestUpdate:e=>setImmediate(e),getCurrentTime:()=>0,objectToString:e=>JSON.stringify(e,null,2),isSSRServer:()=>!0},componentFilter:e=>!e.name.startsWith("/#__cloud__/")}:{type:"browser",platform:{requestUpdate:e=>window.requestAnimationFrame(e),getCurrentTime:()=>window.performance.now(),objectToString:e=>JSON.stringify(e,null,2)},componentFilter:e=>!e.name.startsWith("/#__cloud__/")}}const Tc={render(e,n,{isLocal:o=!1}){const c=xc();o&&(c.platform.isRunningLocally=()=>!0);const d=function(){var e="undefined"!=typeof location?location.search:"";if(!e)return null;var t=new URLSearchParams(e),n=t.get("noodl-sandbox");return n?{sessionId:n,clientId:"sandbox-"+n,useSampleData:"real"!==t.get("noodl-sandbox-data"),signedIn:"out"!==t.get("noodl-sandbox-auth")}:null}();d&&(c.editorClientId=d.clientId,d.useSampleData&&(u||(u=(0,s.p)(function(){var e;return null===(e=r().instance)||void 0===e?void 0:e.getMetaData(l.a)}))));const p=new(r())(c);d&&d.useSampleData&&function(e,t){var n,i=function(){return(0,a.jr)(e.getMetaData(l.a),{cloudservices:e.getMetaData("cloudservices"),backendServices:e.getMetaData("backendServices")},t)};null===(n=e.graphModel)||void 0===n||n.on("metadataChanged",i),i()}(p,d.signedIn),Cc&&Cc.unmount(),Cc=i().createRoot(e),Cc.render(t().createElement(Oc,{noodlRuntime:p,noodlModules:n},null))},renderDeployed(e,t,n){"1"===e.getAttribute("data-ssr")&&e.children.length>0?this._hydrateDeployed(e,t,n).catch(i=>{console.error("Noodl: SSR hydration failed, falling back to client render.",i),this._createRootDeployed(e,t,n)}):this._createRootDeployed(e,t,n)},_createRootDeployed(e,t,n){Cc&&Cc.unmount(),Cc=i().createRoot(e),Cc.render(this.createElement(t,n))},async _hydrateDeployed(e,n,o){const s=new(r())({...xc(),runDeployed:!0}),a=window.fetch,l=window.XMLHttpRequest,u=(0,Nc.createFetchTracker)(a.bind(window)),c=(0,Nc.createXhrTracker)(l);try{window.fetch=u.fetch,window.XMLHttpRequest=c.XMLHttpRequest;const e=(0,Nc.createPageReadyGate)(s.context.eventEmitter);await function(e,t,n){if(bc(e),Qe(e),e.setProjectSettings(rt),t)for(const n of t)Sc(e,n);const i=new _c({graphModel:e.graphModel,getNodeScope:()=>e.context.rootComponent&&e.context.rootComponent.nodeScope,nodeRegister:e.context.nodeRegister});e.context.styles=i;const o=e.setData(n);return e._disableLoad=!0,o}(s,n,o),s.rootComponent&&s.rootComponent.triggerDidMount();const t={isIdle:()=>u.isIdle()&&c.isIdle()};await(0,Nc.settle)(s,t),e.hasPendingPages()&&(await e.whenReady(1e4)||console.warn("Noodl: page(s) never signalled Page Ready within 10000ms before hydration: "+e.pendingPageIds().join(", ")),await(0,Nc.settle)(s,t))}finally{window.fetch=a,window.XMLHttpRequest=l}Cc&&Cc.unmount(),Cc=i().hydrateRoot(e,t().createElement(Oc,{noodlRuntime:s,noodlModules:n,projectData:o},null))},unmount(){Cc&&(Cc.unmount(),Cc=null)},createElement(e,n){const i=new(r())({...xc(),runDeployed:!0});return t().createElement(Oc,{noodlRuntime:i,noodlModules:e,projectData:n},null)}};window.ELECTRON_DISABLE_SECURITY_WARNINGS=!0,window.Noodl._viewerReact=Tc})()})();