Files
fluxscape/packages/noodl-editor/src/external/viewer/noodl.viewer.js
2024-12-20 15:26:16 +01:00

3 lines
877 KiB
JavaScript

/*! For license information please see noodl.viewer.js.LICENSE.txt */
(()=>{var __webpack_modules__={260:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Collection:()=>Collection,ComponentModel:()=>ComponentModel,EditorConnection:()=>EditorConnection,GraphModel:()=>GraphModel,JavascriptNodeParser:()=>JavascriptNodeParser,Model:()=>Model,ModelScope:()=>ModelScope,Node:()=>Node$1,NodeContext:()=>NodeContext,NodeModel:()=>NodeModel,NodeScope:()=>NodeScope,Services:()=>Services,TimerScheduler:()=>TimerScheduler,createRecordsAPI:()=>createRecordsAPI,createSetter:()=>createSetter,default:()=>NoodlRuntime$1,defineNode:()=>defineNode,extend:()=>extend,getAbsoluteUrl:()=>getAbsoluteUrl,guid:()=>guid,logJavaScriptNodeError:()=>logJavaScriptNodeError,randomString:()=>randomString});var eventemitter3__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6822),lodash_difference__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(8779),lodash_difference__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(lodash_difference__WEBPACK_IMPORTED_MODULE_1__);class NodeRegister{constructor(e){this._constructors={},this.context=e}register(e){const t=e.metadata.name;this._constructors[t]=e}createNode(e,t,n){if(!this._constructors.hasOwnProperty(e))throw new Error("Unknown node type with name "+e);return this._constructors[e](this.context,t,n)}getNodeMetadata(e){if(!this._constructors.hasOwnProperty(e))throw new Error("Unknown node type with name "+e);return this._constructors[e].metadata}hasNode(e){return this._constructors.hasOwnProperty(e)}getInputType(e,t){var n,o;return null===(o=null===(n=this.getNodeMetadata(e).inputs)||void 0===n?void 0:n[t])||void 0===o?void 0:o.type}}class Timer{constructor(e,t){this._hasCalledOnStart=!1,this._wasStopped=!1,this._start=0,this._durationLeft=0,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]}start(){return this._isRunning&&this.stop(),this.scheduler.scheduleTimer(this),this}stop(){this.scheduler.stopTimer(this),this._hasCalledOnStart=!1,this._isRunning=!1,this._wasStopped=!0}isRunning(){return this._isRunning}durationLeft(){return this._durationLeft}}class TimerScheduler{constructor(e){this.requestFrame=e,this.runningTimers=[],this.newTimers=[]}createTimer(e){return new Timer(this,e)}scheduleTimer(e){-1===this.newTimers.indexOf(e)&&(0===e.repeatCount&&(e.repeatCount=1e5),this.newTimers.push(e),this.requestFrame())}stopTimer(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))}runTimers(e){var t,n;const o=[],i=[],s=[];let r;const a=this.runningTimers.length;let l;for(r=0;r<a;++r)s[r]=this.runningTimers[r];for(r=0;r<a;++r)if(l=s[r],l&&e>=l._start){let t;!1===l._hasCalledOnStart&&l.onStart&&(l.onStart(),l._hasCalledOnStart=!0),t=l.duration>0?(e-l._start)/(l.duration*l.repeatCount):1,l._durationLeft=l.duration*(1-t);let n=t*l.repeatCount-Math.floor(t*l.repeatCount);t>=1&&(n=1),l.onRunning&&l.onRunning(n),t<1&&l._isRunning?o.push(l):l._wasStopped||i.push(l)}else o.push(l);for(this.runningTimers=o,r=0;r<i.length;++r)i[r]._isRunning=!1,i[r]._hasCalledOnStart=!1,null===(n=null===(t=i[r])||void 0===t?void 0:t.onFinish)||void 0===n||n.call(t);if(this.newTimers.length>0){for(r=0;r<this.newTimers.length;++r)l=this.newTimers[r],l._start=e+l.delay,l._isRunning=!0,l._wasStopped=!1,this.runningTimers.push(l),0===l.delay&&(l.onStart&&(l.onStart(),l._hasCalledOnStart=!0),l.onRunning&&l.onRunning(0));this.newTimers.length=0}}hasPendingTimers(){return this.runningTimers.length>0||this.newTimers.length>0}}class Variants{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&&t)return this.graphModel.getVariant(e,t)}onVariantUpdated(e){const t=this.getNodeScope();if(!t)return;const n=t.getNodesWithTypeRecursive(e.typename).filter((t=>"object"==typeof t.variant?t.variant.name===e.name:"string"==typeof t.variant?t.variant===e.name:t.model&&t.model.variant===e.name));for(const t of n)t.setVariant(e)}}class OutputProperty{constructor(e){if(this.valuesSendThisIteration=0,!e.owner)throw new Error("Owner must be set");this.getter=e.getter||(()=>{}),this.connections=[],this._owner=e.owner,this._name=e.name,this.onFirstConnectionAdded=e.onFirstConnectionAdded,this.onLastConnectionRemoved=e.onLastConnectionRemoved}get name(){return this._name}get owner(){return this._owner}get value(){return this.getter.call(this.owner)}get id(){return this._id||(this._id=this.owner.id+this.name),this._id}registerConnection(e,t){this.connections.push({node:e,inputPortName:t}),1===this.connections.length&&this.onFirstConnectionAdded&&this.onFirstConnectionAdded.call(this.owner)}deregisterConnection(e,t){for(let n=0;n<this.connections.length;n++){const o=this.connections[n];if(o.node===e&&o.inputPortName===t){this.connections.splice(n,1);break}}0===this.connections.length&&this.onLastConnectionRemoved&&this.onLastConnectionRemoved.call(this.owner)}flagDependeesDirty(e){for(let e=0,t=this.connections.length;e<t;e++)this.connections[e].node.flagDirty()}sendValue(e){this._lastUpdateIteration!==this.owner._updatedAtIteration?(this._lastUpdateIteration=this.owner._updatedAtIteration,this.valuesSendThisIteration=0):this.valuesSendThisIteration++,this.valuesSendThisIteration>500&&(this.owner._cyclicLoop=!0);for(let t=0,n=this.connections.length;t<n;t++){const n=this.connections[t];n.node._setValueFromConnection(n.inputPortName,e)}}hasConnections(){return this.connections.length>0}}class Node$1{constructor(e,t){this.updateOnDirtyFlagging=!0,this.children=[],this._internal={},this._dirty=!1,this._inputs={},this._inputValues={},this._outputs={},this._inputConnections={},this._outputList=[],this._isUpdating=!1,this._inputValuesQueue={},this._afterInputsHaveUpdatedCallbacks=[],this._signalsSentThisUpdate={},this._deleted=!1,this._deleteListeners=[],this._isFirstUpdate=!0,this._valuesFromConnections={},this._updateIteration=0,this.id=t,this.context=e}getInputValue(e){return this._inputValues[e]}registerInput(e,t){var n;if(this.hasInput(e))throw new Error("Input property "+e+" already registered");if(this._inputs[e]=t,t.type&&"object"==typeof t.type&&"units"in t.type){const o=t.type.defaultUnit||(null===(n=t.type.units)||void 0===n?void 0:n[0])||"";this._inputValues[e]={value:t.default,type:o}}else t.hasOwnProperty("default")&&(this._inputValues[e]=t.default)}deregisterInput(e){if(!1===this.hasInput(e))throw new Error("Input property "+e+" doesn't exist");delete this._inputs[e],delete this._inputValues[e]}registerInputs(e){for(const t in e)this.registerInput(t,e[t])}getInput(e){if(!1!==this.hasInput(e))return this._inputs[e];console.log("Node "+this.name+": Invalid input property "+e)}hasInput(e){return e in this._inputs}registerInputIfNeeded(e){}setInputValue(name,value){var _a,_b,_c,_d,_e;const input=this.getInput(name);if(input){if("object"==typeof input.type&&"array"===input.type.name&&"string"==typeof value)try{const e=JSON.parse(value);input.set.call(this,e),input.value=e,this._inputValues[name]=e}catch(e){}else input.set.call(this,value),input.value=value,this._inputValues[name]=value;if("color"===input.type&&this.context&&this.context.styles)value=this.context.styles.resolveColor(value);else if("array"===input.type&&"string"==typeof value)try{value=eval(value),null===(_a=this.context.editorConnection)||void 0===_a||_a.clearWarning(null===(_c=null===(_b=this.nodeScope)||void 0===_b?void 0:_b.componentOwner)||void 0===_c?void 0:_c.name,this.id,"invalid-array-"+name)}catch(e){const t=e;value=[],console.log(e),this.context.editorConnection&&this.context.editorConnection.sendWarning(null===(_e=null===(_d=this.nodeScope)||void 0===_d?void 0:_d.componentOwner)||void 0===_e?void 0:_e.name,this.id,"invalid-array-"+name,{showGlobally:!0,message:"Invalid array<br>"+t.toString()})}input.set.call(this,value)}else console.log("node doesn't have input",name)}hasOutput(e){return e in this._outputs}registerOutput(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,onFirstConnectionAdded:t.onFirstConnectionAdded,onLastConnectionRemoved:t.onLastConnectionRemoved});this._outputs[e]=n,this._outputList.push(n)}deregisterOutput(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];const n=this._outputList.indexOf(t);this._outputList.splice(n,1)}registerOutputs(e){for(const t in e)this.registerOutput(t,e[t])}registerOutputIfNeeded(){}getOutput(e){if(!1===this.hasOutput(e))throw new Error("Node "+this.name+" doesn't have a port named "+e);return this._outputs[e]}connectInput(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);const o=t.getOutput(n);if(o.registerConnection(this,e),this._inputConnections[e]||(this._inputConnections[e]=[]),this._inputConnections[e].push(o),t._signalsSentThisUpdate[n])this._setValueFromConnection(e,!0),this._setValueFromConnection(e,!1);else{const t=o.value;void 0!==t&&(this._setValueFromConnection(e,t),this.context&&this.context.connectionSentValue(o,o.value))}this.flagDirty()}removeInputConnection(e,t,n){if(!this._inputConnections[e])throw new Error("Node removeInputConnection: Input doesn't exist");const o=this._inputConnections[e];for(let i=0;i<o.length;i++){const s=o[i];if(s.owner.id===t&&s.name===n){o.splice(i,1),s.owner.getOutput(n).deregisterConnection(this,e);break}}0===o.length&&delete this._valuesFromConnections[e]}isInputConnected(e){return!!this._inputConnections.hasOwnProperty(e)&&this._inputConnections[e].some((e=>{var t;if("Component Inputs"!==e.owner.name)return!0;const n=null===(t=e.owner.nodeScope)||void 0===t?void 0:t.componentOwner;return null==n?void 0:n.isInputConnected(e.name)}))}update(){var e,t,n,o;if(!this._isUpdating&&!1!==this._dirty){this._updatedAtIteration!==this.context.updateIteration&&(this._updatedAtIteration=this.context.updateIteration,this._updateIteration=0,this._cyclicLoop&&(this._cyclicLoop=!1)),this._isUpdating=!0;try{for(;this._dirty&&!this._cyclicLoop;){this._updateDependencies(),this._dirty=!1;const e=Object.keys(this._inputValuesQueue);let t=!0;for(;t&&!this._cyclicLoop;){t=!1;for(let n=0;n<e.length;n++){const o=e[n],i=this._inputValuesQueue[o];i.length>0&&(this.setInputValue(o,i.shift()),i.length>0&&(t=!0))}const n=this._afterInputsHaveUpdatedCallbacks;this._afterInputsHaveUpdatedCallbacks=[];for(let e=0;e<n.length;e++)n[e].call(this)}this._updateIteration++,this._updateIteration>=100&&(this._cyclicLoop=!0)}}catch(e){throw this._isUpdating=!1,e}this._cyclicLoop&&(this.context.scheduleNextFrame((()=>{this.context.nodeIsDirty(this)})),this.context.editorConnection&&!this._cyclicWarningSent&&this.context.isWarningTypeEnabled("cyclicLoops")&&(this.context.editorConnection.sendWarning(null===(t=null===(e=this.nodeScope)||void 0===e?void 0:e.componentOwner)||void 0===t?void 0:t.name,this.id,"cyclic-loop",{showGlobally:!0,message:"Cyclic loop detected"}),this._cyclicWarningSent=!0,console.log("cycle detected",{id:this.id,name:this.name,component:null===(o=null===(n=this.nodeScope)||void 0===n?void 0:n.componentOwner)||void 0===o?void 0:o.name}))),this._isFirstUpdate=!1,this._isUpdating=!1}}_updateDependencies(){for(const e in this._inputConnections){const t=this._inputConnections[e];for(let e=0;e<t.length;++e)t[e].owner.update()}}flagDirty(){this._dirty||(this._dirty=!0,this.updateOnDirtyFlagging&&this._performDirtyUpdate())}_performDirtyUpdate(){this.context&&this.context.nodeIsDirty(this);for(let e=0;e<this._outputList.length;++e)this._outputList[e].flagDependeesDirty()}sendValue(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)}flagOutputDirty(e){const t=this.getOutput(e);this.sendValue(e,t.value)}flagAllOutputsDirty(){for(const e of this._outputList)this.sendValue(e.name,e.value)}sendSignalOnOutput(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.sendValue(!0),t.sendValue(!1),this._signalsSentThisUpdate[e]=!0,this.scheduleAfterInputsHaveUpdated((function(){this._signalsSentThisUpdate[e]=!1})),this.context&&this.context.connectionSentSignal(t)}_setValueFromConnection(e,t){this._valuesFromConnections[e]=t,this.queueInput(e,t)}_hasInputBeenSetFromAConnection(e){return this._valuesFromConnections.hasOwnProperty(e)}queueInput(e,t){if(this._inputValuesQueue[e]||(this._inputValuesQueue[e]=[]),this._isFirstUpdate){const n=this._inputValuesQueue[e][0];!0===n||(n instanceof Object&&n.unit&&t instanceof Object==0&&(t={value:t,unit:n.unit}),this._inputValuesQueue[e].length=0)}this._inputValuesQueue[e].push(t),this.flagDirty()}scheduleAfterInputsHaveUpdated(e){this._afterInputsHaveUpdatedCallbacks.push(e),this.flagDirty()}setNodeModel(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)}addDeleteListener(e){this._deleteListeners.push(e)}_onNodeDeleted(){this.model&&(this.model.removeListenersWithRef(this),this.model=void 0),this._deleted=!0;for(const e of this._deleteListeners)e.call(this)}_onNodeModelParameterUpdated(e){var t;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)}else this.queueInput(e.name,e.value);else{let n;const o=this.variant;"object"==typeof o&&(e.state?o&&o.stateParameters.hasOwnProperty(e.state)&&o.stateParameters[e.state].hasOwnProperty(e.name)?n=o.stateParameters[e.state][e.name]:(null===(t=this.model)||void 0===t?void 0:t.parameters.hasOwnProperty(e.name))?n=this.model.parameters[e.name]:o&&o.parameters.hasOwnProperty(e.name)&&(n=o.parameters[e.name]):o&&o.parameters.hasOwnProperty(e.name)&&(n=o.parameters[e.name])),void 0===n&&(n=this.context.getDefaultValueForInput(this.model.type,e.name),this._resetReactVirtualDOM&&this._resetReactVirtualDOM()),this.queueInput(e.name,n)}}_onNodeModelVariantUpdated(e){this.setVariant(e)}setVariant(e){this.variant=e}}function getAbsoluteUrl(e){if(null==e||""===e)return window.Noodl.baseUrl||"/";const t=String(e);return!t||"/"===t[0]||t.includes("://")||t.startsWith("data:")?t:(window.Noodl.baseUrl||"/")+t}function logJavaScriptNodeError(e){"string"==typeof e?console.log("Error in JS node run code.",e):e instanceof Error&&console.log("Error in JS node run code.",Object.getPrototypeOf(e).constructor.name+": "+e.message,e.stack)}function guid(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function randomString(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}class NodeScope{constructor(e,t){this.context=e,this.nodes={},this.componentOwner=t,this.componentInstanceChildren={}}verifyData(e,t){t.forEach((t=>{if(!e[t])throw new Error("Missing "+t)}))}addConnection(e){try{this.verifyData(e,["sourceId","sourcePort","targetId","targetPort"])}catch(e){throw new Error("Error in connection: "+e.message)}try{const t=this.getNodeWithId(e.sourceId),n=this.getNodeWithId(e.targetId);n.registerInputIfNeeded(e.targetPort),t.registerOutputIfNeeded(e.sourcePort),n.connectInput(e.targetPort,t,e.sourcePort)}catch(e){console.error(e.message)}}setNodeParameters(e,t){const n=this.context.variants.getVariant(t.type,t.variant);if(n)e.setVariant(n);else{const n=t.parameters||{};let o=Object.keys(n);if(this.context.nodeRegister.hasNode(e.name)){const t=this.context.nodeRegister.getNodeMetadata(e.name);t.inputs&&o.sort(((e,n)=>{var o,i;const s=t.inputs[e],r=t.inputs[n];return(null!==(o=null==r?void 0:r.inputPriority)&&void 0!==o?o:0)-(null!==(i=null==s?void 0:s.inputPriority)&&void 0!==i?i:0)}))}o.forEach((t=>{e.registerInputIfNeeded(t),!1!==e.hasInput(t)&&e.queueInput(t,n[t])}))}}async createNodeFromModel(e,t){if("Component Children"===e.type){if(e.parent){const t=this.getNodeWithId(e.parent.id);this.componentOwner.setChildRoot(t)}return}let n;try{n=await this.createNode(e.type,e.id),n.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}insertNodeInTree(e,t){if(!t.parent)throw new Error("Cannot insert node without parent");const n=this.getNodeWithId(t.parent.id),o=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,o)}getNodeWithId(e){if(!this.nodes.hasOwnProperty(e))throw new Error("Unknown node id "+e);return this.nodes[e]}hasNodeWithId(e){return this.nodes.hasOwnProperty(e)}createPrimitiveNode(e,t,n){if(t||(t=guid()),this.nodes.hasOwnProperty(t))throw Error("duplicate id "+t);const o=this.context.nodeRegister.createNode(e,t,this);if(n)for(const e in n)o[e]=n[e];return this.nodes[t]=o,o}async createNode(e,t,n){if(t||(t=guid()),this.nodes.hasOwnProperty(t))throw Error("duplicate id "+t);let o;if(this.context.nodeRegister.hasNode(e)){if(o=this.context.nodeRegister.createNode(e,t,this),n)for(const e in n)o[e]=n[e]}else o=await this.context.createComponentInstanceNode(e,t,this,n),this.componentInstanceChildren[t]=o;return this.nodes[t]=o,o}getNodesWithIdRecursive(e){const t=[];return function e(t,n,o){t.nodes.hasOwnProperty(n)&&o.push(t.nodes[n]),Object.keys(t.nodes).filter((e=>t.nodes[e]instanceof ComponentInstanceNode)).forEach((i=>{const s=t.nodes[i].nodeScope;s&&e(s,n,o)}))}(this,e,t),t}getNodesWithType(e){return Object.keys(this.nodes).filter((t=>this.nodes[t].name===e)).map((e=>this.nodes[e]))}getNodesWithTypeRecursive(e){let t=[];return(()=>{t=t.concat(this.getNodesWithType(e)),Object.keys(this.nodes).filter((e=>this.nodes[e]instanceof ComponentInstanceNode)).forEach((n=>{const o=this.nodes[n];if(o&&o.nodeScope){const n=o.nodeScope.getNodesWithTypeRecursive(e);t=t.concat(n)}}))})(),t}getAllNodesRecursive(){let e=[];return(()=>{e=e.concat(Object.values(this.nodes)),Object.keys(this.nodes).filter((e=>this.nodes[e]instanceof ComponentInstanceNode)).forEach((t=>{const n=this.nodes[t];if(n&&n.nodeScope){const t=n.nodeScope.getAllNodesRecursive();e=e.concat(t)}}))})(),e}getAllNodesWithVariantRecursive(e){return this.getAllNodesRecursive().filter((t=>t.variant===e))}onNodeModelRemoved(e){const t=this.getNodeWithId(e.id);e.parent&&this.getNodeWithId(e.parent.id).removeChild(t),t._onNodeDeleted(),delete this.nodes[t.id],delete this.componentInstanceChildren[t.id]}removeConnection(e){this.getNodeWithId(e.targetId).removeInputConnection(e.targetPort,e.sourceId,e.sourcePort)}async setComponentModel(e){var t;this.componentModel=e;const n=[];for(const t of e.getAllNodes()){const e=await this.createNodeFromModel(t,!1);e&&n.push(e)}e.getAllConnections().forEach((e=>this.addConnection(e))),n.forEach((e=>e.updateOnDirtyFlagging=!0)),n.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),e.on("nodeParentWillBeRemoved",(e=>{if("Component Children"===e.type)return void(e.parent&&this.componentOwner.setChildRoot(null));const t=this.getNodeWithId(e.id);t.parent&&t.parent.removeChild(t)}),this),e.on("nodeParentUpdated",(e=>{if("Component Children"===e.type){const t=e.parent?this.getNodeWithId(e.parent.id):null;this.componentOwner.setChildRoot(t)}else{const t=this.getNodeWithId(e.id);this.insertNodeInTree(t,e)}}),this),e.on("nodeRemoved",(e=>{"Component Children"!==e.type&&this.onNodeModelRemoved(e)}),this);for(const e in this.nodes){const n=this.nodes[e];null===(t=null==n?void 0:n.nodeScopeDidInitialize)||void 0===t||t.call(n)}}reset(){this.componentModel&&(this.componentModel.removeListenersWithRef(this),this.componentModel=void 0),Object.keys(this.nodes).forEach((e=>{this.nodes.hasOwnProperty(e)&&this.deleteNode(this.nodes[e])}))}deleteNode(e){if(this.nodes.hasOwnProperty(e.id)){if(e.parent&&e.parent.removeChild(e),e.getChildren&&e.getChildren().forEach((t=>{e.removeChild(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=>{this.nodes.hasOwnProperty(e.targetId)&&this.nodes.hasOwnProperty(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)}sendEventFromThisScope(e,t,n,o){var i,s;if(o){const n=this.getNodesWithType("Event Receiver").filter((t=>t.getChannelName()===e));for(let e=0;e<n.length;e++)if(n[e].handleEvent(t))return!0}if("parent"===n&&this.componentOwner.parentNodeScope){const o=this.componentOwner.parent?this.componentOwner.parent.nodeScope:this.componentOwner.parentNodeScope;return!!o&&o.sendEventFromThisScope(e,t,n,!0)}if("children"===n){const o=this.nodes;for(const s in o){const r=o[s].children;if(r)for(const o of r)if(o.name&&this.context.hasComponentModelWithName(o.name)&&(null===(i=o.nodeScope)||void 0===i?void 0:i.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!1;const o=n.nodes;for(const n in o){const i=o[n].children;if(i){const n=i.filter((e=>e.name&&this.context.hasComponentModelWithName(e.name)&&e.nodeScope!==this));for(const o of n)if(null===(s=o.nodeScope)||void 0===s?void 0:s.sendEventFromThisScope(e,t,void 0,!0))return!0}}}return!1}}let componentIdCounter=0;class ComponentInstanceNode extends Node$1{constructor(e,t,n){super(e,t),this.nodeScope=new NodeScope(e,this),this.parentNodeScope=n,this._internal={childRoot:null,componentOutputValues:{},componentOutputs:[],componentInputs:[],inputValues:{},roots:[],instanceId:"__$ndl_componentInstaceId"+componentIdCounter},this.nodeScope.modelScope=n?n.modelScope:void 0,componentIdCounter++}async setComponentModel(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(){this.componentModel&&(this.componentModel.removeListenersWithRef(this),this.componentModel=void 0),this.nodeScope.reset(),super._onNodeDeleted()}registerComponentInputPort(e){this.registerInput(e.name,{set:function(t){this._internal.inputValues[e.name]=t,this._internal.componentInputs.forEach((function(t){t.registerOutputIfNeeded(e.name),t.flagOutputDirty(e.name)}))}})}registerComponentOutputPort(e){this.registerOutput(e.name,{getter(){return this._internal.componentOutputValues[e.name]}})}setOutputFromComponentOutput(e,t){var n,o;!1!==this.hasOutput(e)&&(null===(o=null===(n=this._internal.creatorCallbacks)||void 0===n?void 0:n.onOutputChanged)||void 0===o||o.call(n,e,t,this._internal.componentOutputValues[e]),this._internal.componentOutputValues[e]=t,this.flagOutputDirty(e))}setChildRoot(e){const t=this._internal.childRoot,n=e;if(this._internal.childRoot=n,this.model&&this.model.children){const e=this.parentNodeScope,o=this.model.children.filter((e=>"Component Children"!==e.type)).map((t=>null==e?void 0:e.getNodeWithId(t.id)));if(t)for(let e=0;e<o.length;e++)t.isChild(o[e])&&t.removeChild(o[e]);if(n)for(let e=0;e<o.length;e++){const t=o[e],n=t.model.parent.children.indexOf(t.model);this.addChild(t,n)}}}getChildRootIndex(){var e,t;if(!(null===(t=null===(e=this._internal.childRoot)||void 0===e?void 0:e.model)||void 0===t?void 0:t.children))return 0;const n=this._internal.childRoot.model.children;for(let e=0;e<n.length;e++)if("Component Children"===n[e].type)return e;return 0}getChildRoot(){return this._internal.childRoot?this._internal.childRoot:null}getRoots(){return this._internal.roots}triggerDidMount(){this._internal.roots.forEach((e=>{var t;null===(t=e.triggerDidMount)||void 0===t||t.call(e)}))}render(){return 0===this._internal.roots.length?null:this._internal.roots[0].render()}setChildIndex(e){this.getRoots().forEach((t=>{var n;return null===(n=t.setChildIndex)||void 0===n?void 0:n.call(t,e)}))}addChild(e,t){this.getChildRoot().addChild(e,t+this.getChildRootIndex())}removeChild(e){this.getChildRoot().removeChild(e)}getChildren(){const e=this.getChildRoot();return e?e.getChildren():[]}isChild(e){return!!this.getChildRoot()&&this.getChildRoot().isChild(e)}contains(e){return this.getRoots().some((t=>{var n;return null===(n=t.contains)||void 0===n?void 0:n.call(t,e)}))}_performDirtyUpdate(){super._performDirtyUpdate();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(){const e=this._internal.roots[0];return e?e.getRef():void 0}update(){super.update(),this._internal.componentOutputs.forEach((function(e){e.update()}))}forceUpdate(){this.parent&&(this.parent.cachedChildren=void 0,this.parent.forceUpdate())}getInstanceId(){return this._internal.instanceId}}class NodeContext{constructor(e={}){var t;this.isUpdating=!1;const n=!!e.hasOwnProperty("runningInEditor")&&e.runningInEditor;this._dirtyNodes=[],this.callbacksAfterUpdate=[],this.graphModel=e.graphModel,this.platform=e.platform,this.eventEmitter=new eventemitter3__WEBPACK_IMPORTED_MODULE_0__.b,this.eventSenderEmitter=new eventemitter3__WEBPACK_IMPORTED_MODULE_0__.b,this.globalValues={},this.globalsEventEmitter=new eventemitter3__WEBPACK_IMPORTED_MODULE_0__.b,this.runningInEditor=!!n,this.currentFrameTime=0,this.frameNumber=0,this.updateIteration=0,this.nodeRegister=new NodeRegister(this),this.timerScheduler=new TimerScheduler(this.scheduleUpdate.bind(this)),this.componentModels={},this.debugInspectorsEnabled=!1,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 Variants({graphModel:this.graphModel,getNodeScope:()=>this.rootComponent?this.rootComponent.nodeScope:null}),this.editorConnection&&(this.editorConnection.on("debugInspectorsUpdated",(e=>{this.onDebugInspectorsUpdated(e)})),null===(t=this.editorConnection)||void 0===t||t.on("getConnectionValue",(({clientId:e,connectionId:t})=>{var n,o;if((null===(n=this.editorConnection)||void 0===n?void 0:n.clientId)!==e)return;const i=this._outputHistory[t];null===(o=this.editorConnection)||void 0===o||o.sendConnectionValue(t,i?i.value:void 0)})))}setRootComponent(e){this.rootComponent=e}getCurrentTime(){return this.platform.getCurrentTime()}onDebugInspectorsUpdated(e){this.debugInspectorsEnabled&&(e=e.map((e=>{if("connection"===e.type&&e.connection){const t=e.connection;e.id=t.fromId+t.fromProperty}else"node"===e.type&&e.nodeId&&(e.id=e.nodeId);return e})),this.debugInspectors={},e.forEach((e=>this.debugInspectors[e.id]=e)),this.sendDebugInspectorValues())}updateDirtyNodes(){let e,t,n=!0,o=0;for(this.updateIteration++,this.isUpdating=!0;n&&o<10;){const i=this._dirtyNodes;for(this._dirtyNodes=[],e=0,t=i.length;e<t;++e)try{i[e]._deleted||i[e].update()}catch(e){console.error(e)}const s=this.callbacksAfterUpdate;for(this.callbacksAfterUpdate=[],e=0,t=s.length;e<t;e++)try{s[e]()}catch(e){console.error(e)}n=this.callbacksAfterUpdate.length>0||this._dirtyNodes.length>0,o++}this.isUpdating=!1}update(){this.frameNumber++,this.updateDirtyNodes(),this.timerScheduler.hasPendingTimers()&&(this.scheduleUpdate(),this.timerScheduler.runTimers(this.currentFrameTime)),this.debugInspectorsEnabled&&this.sendDebugInspectorValues()}reset(){this.eventEmitter.emit("applicationDataReloaded");const 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()}nodeIsDirty(e){this._dirtyNodes.push(e),this.scheduleUpdate()}scheduleUpdate(){this.eventEmitter.emit("scheduleUpdate")}scheduleAfterUpdate(e){this.callbacksAfterUpdate.push(e),this.scheduleUpdate()}scheduleNextFrame(e){this.eventEmitter.once("frameStart",e),this.scheduleUpdate()}setGlobalValue(e,t){this.globalValues[e]=t,this.globalsEventEmitter.emit(e)}getGlobalValue(e){return this.globalValues[e]}registerComponentModel(e){if(this.componentModels.hasOwnProperty(e.name))throw new Error("Duplicate component name "+e.name);this.componentModels[e.name]=e,e.on("renamed",(t=>{delete this.componentModels[t.oldName],this.componentModels[t.newName]=e}),this)}deregisterComponentModel(e){this.componentModels.hasOwnProperty(e.name)&&(this.componentModels[e.name].removeListenersWithRef(this),delete this.componentModels[e.name])}async fetchComponentBundle(e){const t=async e=>{const t=`${window.Noodl.Env.BaseUrl||"/"}noodl_bundles/${e}.json`,n=await fetch(t);if(404===n.status)throw new Error("Component not found "+e);const o=await n.json();for(const e of o)!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}}async getComponentModel(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]}hasComponentModelWithName(e){return this.componentModels.hasOwnProperty(e)}async createComponentInstanceNode(e,t,n,o){const i=new ComponentInstanceNode(this,t,n);if(i.name=e,o)for(const e in o)i[e]=o[e];const s=await this.getComponentModel(e);return await i.setComponentModel(s),i}_formatConnectionValue(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}connectionSentValue(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 o=[];e.connections.forEach((t=>{o.push(e.owner.id+e.name+t.node.id+t.inputPortName)})),this.connectionsToPulse[e.id]={timestamp:n,connections:o},this.connectionsToPulseChanged=!0,!1===this.connectionPulsingCallbackScheduled&&(this.connectionPulsingCallbackScheduled=!0,setTimeout(this.clearOldConnectionPulsing.bind(this),100))}connectionSentSignal(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)}clearDebugInspectors(){var e;this.debugInspectors={},this.connectionsToPulse={},null===(e=this.editorConnection)||void 0===e||e.sendPulsingConnections(this.connectionsToPulse)}clearOldConnectionPulsing(){var e;this.connectionPulsingCallbackScheduled=!1;const t=this.getCurrentTime();Object.keys(this.connectionsToPulse).forEach((e=>{const n=this.connectionsToPulse[e];t-n.timestamp>100&&(this.connectionsToPulseChanged=!0,delete this.connectionsToPulse[e])})),this.connectionsToPulseChanged&&(this.connectionsToPulseChanged=!1,null===(e=this.editorConnection)||void 0===e||e.sendPulsingConnections(this.connectionsToPulse)),Object.keys(this.connectionsToPulse).length>0&&(this.connectionPulsingCallbackScheduled=!0,setTimeout(this.clearOldConnectionPulsing.bind(this),500))}_getDebugInspectorValueForNode(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}}}sendDebugInspectorValues(){var e,t;const n=[];for(const e in this.debugInspectors){const t=this.debugInspectors[e];if("connection"===t.type&&this._outputHistory.hasOwnProperty(e)){const t=this._outputHistory[e].value;n.push({type:"connection",id:e,value:this._formatConnectionValue(t)})}else if("node"===t.type){const t=this._getDebugInspectorValueForNode(e);t&&n.push(t)}}n.length>0&&(null===(e=this.editorConnection)||void 0===e||e.sendDebugInspectorValues(n)),this.connectionsToPulseChanged&&(this.connectionsToPulseChanged=!1,null===(t=this.editorConnection)||void 0===t||t.sendPulsingConnections(this.connectionsToPulse))}setDebugInspectorsEnabled(e){this.debugInspectorsEnabled=e,this.editorConnection,e&&this.sendDebugInspectorValues()}sendGlobalEventFromEventSender(e,t){this.eventSenderEmitter.emit(e,t)}setPopupCallbacks(e){this.onShowPopup=e.onShow,this.onClosePopup=e.onClose}async showPopup(e,t,n){if(!this.onShowPopup)return;const o=this.rootComponent.nodeScope,i=await o.createNode(e);for(const e in t)i.setInputValue(e,t[e]);i.popupParent=(null==n?void 0:n.senderNode)||null;const s=o.createPrimitiveNode("Group");s.setInputValue("flexDirection","node"),s.setInputValue("cssClassName","noodl-popup");const r=this.graphModel.getSettings().bodyScroll;s.setInputValue("position",r?"fixed":"absolute");const a=i.nodeScope.getNodesWithType("NavigationClosePopup");if(a&&a.length>0)for(let e=0;e<a.length;e++)a[e]._setCloseCallback(((e,t)=>{this.scheduleNextFrame((()=>{var i,r;o.hasNodeWithId(s.id)&&(null===(i=this.onClosePopup)||void 0===i||i.call(this,s),o.deleteNode(s),null===(r=null==n?void 0:n.onClosePopup)||void 0===r||r.call(n,e,t||{}))}))}));this.onShowPopup(s),requestAnimationFrame((()=>{s.addChild(i)}))}setWarningTypes(e){Object.assign(this.warningTypes,e)}isWarningTypeEnabled(e){return!this.warningTypes.hasOwnProperty(e)||!!this.warningTypes[e]}getDefaultValueForInput(e,t){var n;if(!1===this.nodeRegister.hasNode(e))return;const o=null===(n=this.nodeRegister.getNodeMetadata(e).inputs)||void 0===n?void 0:n[t];return o?o.type.defaultUnit?{value:o.default,unit:o.type.defaultUnit}:o.default:void 0}}class EventSender{constructor(){this.listeners={},this.listenersWithRefs={}}on(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))}removeListenersWithRef(e){Object.keys(this.listenersWithRefs).forEach((t=>{const n=this.listenersWithRefs[t];n.has(e)&&n.delete(e)}))}removeAllListeners(e){e?(delete this.listeners[e],delete this.listenersWithRefs[e]):(this.listeners={},this.listenersWithRefs={})}async emit(e,t){const n=this.listeners[e];if(n){const e=[...n];for(const n of e)await Promise.resolve(n(t))}const o=this.listenersWithRefs[e];if(o)for(const[e,n]of o)for(const o of n)await Promise.resolve(o.call(e,t))}}class ActiveWarnings{constructor(){this.currentWarnings=new Map}setWarning(e,t,n){if(this.currentWarnings.has(e)){const o=this.currentWarnings.get(e);return!(o&&o[t]===n||(o&&(o[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)}}class EditorConnection extends EventSender{constructor(e={}){var t,n;super(),this.clientId="",this.dynamicPortsHash={},this.serviceRequests={},this.runtimeType=e.runtimeType,this.platform=e.platform||{getCurrentTime:()=>Date.now()},this.ws=(null===(t=e.platform)||void 0===t?void 0:t.webSocketClass)||("undefined"!=typeof WebSocket?WebSocket:void 0),this.wsOptions=null===(n=e.platform)||void 0===n?void 0:n.webSocketOptions,this.reconnectOnClose=!0,this.enableDebugger=!1,this.lastSendTimestamp=0,this.sendQueue=[],this.sendTimer=void 0,this.activeWarnings=new ActiveWarnings}isRunningLocally(){return this.platform.isRunningLocally&&this.platform.isRunningLocally()||"undefined"!=typeof document&&("localhost"===document.location.hostname||"127.0.0.1"===document.location.hostname)}connect(e){this.socket=this.wsOptions?new this.ws(e,this.wsOptions):new this.ws(e),this.socket.addEventListener("open",(()=>{var e;this.clientId=guid(),null===(e=this.socket)||void 0===e||e.send(JSON.stringify({cmd:"register",type:"viewer",clientId:this.clientId})),this.emit("connected")})),this.socket.addEventListener("close",(t=>{this.reconnectOnClose&&this.reconnect(e),console.log("Editor connection closed",t.code,t.reason),this.emit("connectionClosed")})),this.socket.addEventListener("error",(()=>{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(),n=JSON.parse(t);let o;"registered"===n.cmd||("export"===n.cmd?(o=JSON.parse(n.content),"full"===n.type&&n.target===this.clientId&&this.emit("exportDataFull",o)):"hoverStart"===n.cmd?this.emit("hoverStart",n.content.id):"hoverEnd"===n.cmd?this.emit("hoverEnd",n.content.id):"refresh"===n.cmd?this.emit("reload"):"debugInspectors"===n.cmd?this.debugInspectorsEnabled&&(o=JSON.parse(n.content),this.emit("debugInspectorsUpdated",o.inspectors)):"debuggingEnabled"===n.cmd?this.isRunningLocally()&&(o=JSON.parse(n.content),this.emit("debuggingEnabledChanged",o.enabled)):"getConnectionValue"===n.cmd?this.isRunningLocally()&&(o=JSON.parse(n.content),await this.emit("getConnectionValue",{clientId:o.clientId,connectionId:o.connectionId})):"modelUpdate"===n.cmd?await this.emit("modelUpdate",n.content):"publish"===n.cmd||("noodlModules"===n.cmd?this.emit("noodlModules",JSON.parse(n.content)):"mqttUpdate"===n.cmd?this.emit("mqttUpdate",n.content):"activeComponentChanged"===n.cmd?this.emit("activeComponentChanged",n.component):console.log("Command not implemented",n)))}))}reconnect(e){setTimeout((()=>{this.connect(e)}),2e3)}isConnected(){return void 0!==this.socket&&this.socket.readyState===this.ws.OPEN}getCircularReplacer(){const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return"[Circular]";e.add(n)}return n}}send(e){const t=this.platform.getCurrentTime(),n=t-this.lastSendTimestamp,o=e=>{var t,n;try{null===(t=this.socket)||void 0===t||t.send(JSON.stringify(e))}catch(t){if(t.message&&t.message.startsWith("Converting circular"))try{null===(n=this.socket)||void 0===n||n.send(JSON.stringify(e,this.getCircularReplacer()))}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(!1!==this.isConnected()){for(let e=0;e<this.sendQueue.length;e+=50){const t=this.sendQueue.slice(e,e+50);o(t)}this.sendQueue=[],this.sendTimer=void 0,this.lastSendTimestamp=this.platform.getCurrentTime()}}),100))):(this.lastSendTimestamp=t,o(e))}sendInspectId(e){this.send({cmd:"select",type:"viewer",content:JSON.stringify({id:e})})}sendSelectComponent(e){this.send({cmd:"select",type:"viewer",content:JSON.stringify({componentName:e})})}sendPulsingConnections(e){const t=[];Object.keys(e).forEach((n=>{const o=e[n];t.push(...o.connections)})),this.send({cmd:"connectiondebugpulse",type:"viewer",content:JSON.stringify({connectionsToPulse:t})})}sendDebugInspectorValues(e){this.send({cmd:"debuginspectorvalues",type:"viewer",content:{inspectors:e}})}sendConnectionValue(e,t){this.send({cmd:"connectionValue",type:"viewer",content:{connectionId:e,value:t}})}_detectRename(e,t){if(!e||!t)return;if(e.length!==t.length)return;const n={};for(let o=0;o<e.length;o++){if(-1===t.indexOf(e[o])){if(n.before)return;n.before=e[o]}if(-1===e.indexOf(t[o])){if(n.after)return;n.after=t[o]}}return n.before&&n.after?{before:n.before,after:n.after}:void 0}sendDynamicPorts(e,t,n){const o=JSON.stringify(t);if(this.dynamicPortsHash[e]!==o){if(this.dynamicPortsHash[e]&&t&&n&&n.detectRenamed){const o=Array.isArray(n.detectRenamed)?n.detectRenamed:[n.detectRenamed],i=[];o.forEach((n=>{let o=JSON.parse(this.dynamicPortsHash[e]),s=[...t];n.prefix&&(o=o.filter((e=>e.name.startsWith(n.prefix))),s=s.filter((e=>e.name.startsWith(n.prefix)))),n.plug&&(o=o.filter((e=>e.plug===n.plug)),s=s.filter((e=>e.plug===n.plug))),s=s.map((e=>e.name.substring((n.prefix||"").length))),o=o.map((e=>e.name.substring((n.prefix||"").length)));const r=this._detectRename(o,s);r&&i.push({plug:n.plug,patterns:[(n.prefix||"")+"{{*}}"],before:r.before,after:r.after})})),i.length>0&&(n.renamed=i),delete n.detectRenamed}this.dynamicPortsHash[e]=o,this.send({cmd:"instanceports",type:"viewer",content:JSON.stringify({nodeid:e,ports:t,options:n})})}}sendWarning(e,t,n,o){this.activeWarnings.setWarning(t,n,o)&&this.send({cmd:"showwarning",type:"viewer",content:JSON.stringify({componentName:e,nodeId:t,key:n,warning:o})})}clearWarning(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})})}clearWarnings(e,t){this.activeWarnings.clearWarnings(t)&&this.send({cmd:"clearwarnings",type:"viewer",content:JSON.stringify({componentName:e,nodeId:t})})}sendPatches(e){this.send({cmd:"patchproject",type:"viewer",content:JSON.stringify(e)})}requestFullExport(){this.send({cmd:"register",type:"viewer"})}requestNoodlModules(){this.send({cmd:"getNoodlModules",type:"viewer"})}sendServiceRequest(e,t){e.token=guid(),e.clientId=this.clientId,this.serviceRequests[e.token]=t,this.send(e)}close(){var e;this.reconnectOnClose=!1,!1!==this.isConnected()&&(null===(e=this.socket)||void 0===e||e.close())}sendNodeLibrary(e){this.send({cmd:"nodelibrary",type:"viewer",runtimeType:this.runtimeType,content:e,clientId:this.clientId})}sendComponentMetadata(e,t,n){this.send({cmd:"componentMetadata",type:"viewer",content:JSON.stringify({componentName:e,key:t,data:n})})}sendProjectMetadata(e,t){this.send({cmd:"projectMetadata",type:"viewer",content:JSON.stringify({key:e,data:t})})}}function formatDynamicPorts(e){var t,n;const o=[];for(const i of e.dynamicports||[])if(i.ports||i.template||i.port||i.channelPort)o.push(i);else if(i.inputs||i.outputs){const s=[];if(i.inputs)for(const n of i.inputs){const o=null===(t=e.inputs)||void 0===t?void 0:t[n];o&&s.push(formatPort(n,o,"input"))}if(i.outputs)for(const t of i.outputs){const o=null===(n=e.outputs)||void 0===n?void 0:n[t];o&&s.push(formatPort(t,o,"output"))}const r={name:i.name||"conditionalports/basic",condition:i.condition,ports:s};o.push(r)}return o}function formatPort(e,t,n){const o={name:e,type:t.type,plug:n};return t.group&&(o.group=t.group),t.displayName&&(o.displayName=t.displayName),t.description&&(o.description=t.description),t.editorName&&(o.editorName=t.editorName),void 0!==t.default&&(o.default=t.default),t.hasOwnProperty("index")&&(o.index=t.index),t.tooltip&&(o.tooltip=t.tooltip),t.tab&&(o.tab=t.tab),t.popout&&(o.popout=t.popout),t.allowVisualStates&&(o.allowVisualStates=t.allowVisualStates),o}function generateNodeLibrary(e){const t={typecasts:[{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:[]},{from:"enum",to:[]},{from:"object",to:[]},{from:"domelement",to:[]},{from:"reference",to:[]},{from:"font",to:[]},{from:"textStyle",to:["string"]},{from:"collection",to:["array"]},{from:"array",to:["collection"]}],dynamicports:[{type:"conditionalports",name:"basic"},{type:"expand",name:"basic"}],colors:{nodes:{component:{base:"#643D8B",baseHighlighted:"#79559b",header:"#4E2877",headerHighlighted:"#643d8b",outline:"#4E2877",outlineHighlighted:"#b58900",text:"#dbd0e4"},visual:{base:"#315272",baseHighlighted:"#4d6784",header:"#173E5D",headerHighlighted:"#315272",outline:"#173E5D",outlineHighlighted:"#b58900",text:"#cfd5de"},data:{base:"#465524",baseHighlighted:"#5b6a37",header:"#314110",headerHighlighted:"#465524",outline:"#314110",outlineHighlighted:"#b58900",text:"#d2d6c5"},javascript:{base:"#7E3660",baseHighlighted:"#944e74",header:"#67214B",headerHighlighted:"#7e3660",outline:"#67214B",outlineHighlighted:"#d57bab",text:"#e4cfd9"},default:{base:"#4C4F59",baseHighlighted:"#62656e",header:"#373B45",headerHighlighted:"#4c4f59",outline:"#373B45",outlineHighlighted:"#b58900",text:"#d3d4d6"}},connections:{signal:{normal:"#006f82",highlighted:"#7ec2cf",pulsing:"#ffffff"},default:{normal:"#875d00",highlighted:"#e5ae32",pulsing:"#ffffff"}}},nodetypes:[{name:"Component Children",shortDesc:"This node is a placeholder for where children of this component will be inserted.",docs:"https://docs.noodl.net/nodes/component-utilities/component-children",color:"component",allowAsChild:!0,category:"Visual",haveComponentChildren:["Visual"]}]},n=Object.keys(e._constructors);n.forEach((function(n){const o=e._constructors[n].metadata,i={name:n,searchTags:o.searchTags};t.nodetypes.push(i),o.version&&(i.version=o.version),o.displayNodeName&&(i.displayNodeName=o.displayNodeName),o.nodeDoubleClickAction&&(i.nodeDoubleClickAction=o.nodeDoubleClickAction),o.shortDesc&&(i.shortDesc=o.shortDesc),o.module&&(i.module=o.module),o.deprecated&&(i.deprecated=!0),o.haveComponentPorts&&(i.haveComponentPorts=!0),"Visual"===o.category&&(i.allowAsChild=!0,i.allowAsExportRoot=!0,i.color="visual"),void 0!==o.allowAsExportRoot&&(i.allowAsExportRoot=o.allowAsExportRoot),o.allowChildren&&(i.allowChildrenWithCategory=["Visual"],i.color="visual"),o.allowChildrenWithCategory&&(i.allowChildrenWithCategory=o.allowChildrenWithCategory),o.singleton&&(i.singleton=!0),o.allowAsChild&&(i.allowAsChild=!0),o.docs&&(i.docs=o.docs),o.shortDocs?i.shortDocs=o.shortDocs:o.docs&&0===o.docs.indexOf("https://docs.noodl.net")&&(i.shortDocs=o.docs.replace("/#","")+"-short.md"),i.category=o.category,o.panels&&(i.panels=o.panels),o.usePortAsLabel&&(i.usePortAsLabel=o.usePortAsLabel,i.portLabelTruncationMode=o.portLabelTruncationMode),o.color&&(i.color=o.color),o.dynamicports&&(i.dynamicports=formatDynamicPorts(o)),o.exportDynamicPorts&&(i.exportDynamicPorts=o.exportDynamicPorts),o.visualStates&&(i.visualStates=o.visualStates),o.useVariants&&(i.useVariants=o.useVariants),o.connectionPanel&&(i.connectionPanel=o.connectionPanel),i.ports=[];const s=i.dynamicports||[],r={},a={};s.filter((e=>void 0!==e.channelPort)).forEach((e=>{a[e.channelPort.plug+"/"+e.channelPort.name]=!0})),s.length&&(i.dynamicports=s),Object.keys(o.inputs||{}).forEach((function(e){var t;if(r.hasOwnProperty("input/"+e)||a.hasOwnProperty("input/"+e))return;const n=null===(t=o.inputs)||void 0===t?void 0:t[e];n&&!1!==n.exportToEditor&&(i.ports||(i.ports=[]),i.ports.push(formatPort(e,n,"input")))})),Object.keys(o.outputs||{}).forEach((function(e){var t;if(r.hasOwnProperty("output/"+e)||a.hasOwnProperty("output/"+e))return;const n=null===(t=o.outputs)||void 0===t?void 0:t[e];n&&function(e,t){const n={name:e,type:t.type,plug:"output"};t.group&&(n.group=t.group),t.displayName&&(n.displayName=t.displayName),t.editorName&&(n.editorName=t.editorName),t.hasOwnProperty("index")&&(n.index=t.index),i.ports||(i.ports=[]),i.ports.push(n)}(e,n)}))})),t.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","Color Blend","Number Remapper","Counter","Drag","net.noodl.animatetovalue"]},{name:"Logic",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:"System",items:["Screen Resolution","Open File Picker"]},{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"]},{name:"Cloud Data",items:["DbModel2","NewDbModelProperties","FilterDBModels","SetDbModelProperties","DbCollection2","DeleteDbModelProperties","AddDbModelRelation","RemoveDbModelRelation","Cloud File","Upload File","CloudFunction2","DbConfig"]},{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"]},{name:"External Data",items:["REST2"]}]},{name:"Custom Code",description:"Custom JavaScript and CSS",type:"javascript",subCategories:[{name:"",items:["Expression","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"]}]}]};const o=[];return n.forEach((t=>{e._constructors[t].metadata.module&&o.push(t)})),o.length&&(t.nodeIndex.moduleNodes=[{name:"",items:o}]),t}function addModuleSettings(e,t){for(let n=0;n<t.length;n++){const o=t[n];o.settings&&o.settings.forEach((t=>{e.ports.push(t)}))}}function generateProjectSettings(e,t){const n={dynamicports:[],ports:[]};return addModuleSettings(n,t),n}class NodeModel extends EventSender{constructor(e,t){super(),this.id=e,this.type=t,this.inputs=[],this.outputs=[],this.children=[],this.parameters={},this.inputPorts={},this.outputPorts={}}setParameter(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})}setParameters(e){Object.keys(e).forEach((t=>{this.setParameter(t,e[t])}))}setStateParameters(e){this.stateParameters=e}setStateTransitions(e){this.stateTransitions=e}setStateTransitionParamter(e,t,n){this.stateTransitions||(this.stateTransitions={}),t?this.stateTransitions[n][e]=t:delete this.stateTransitions[n][e]}setDefaultStateTransition(e,t){this.defaultStateTransitions||(this.defaultStateTransitions={}),this.defaultStateTransitions[t]=e}addInputPort(e){this.inputPorts[e.name]=e,this.emit("inputPortAdded",e)}getInputPort(e){return this.inputPorts[e]}getInputPorts(){return this.inputPorts}removeInputPortWithName(e){if(this.inputPorts.hasOwnProperty(e)){const t=this.inputPorts[e];delete this.inputPorts[e],this.emit("inputPortRemoved",t)}}updateInputPortTypes(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")}addOutputPort(e){this.outputPorts[e.name]=e,this.emit("outputPortAdded",e)}getOutputPort(e){return this.outputPorts[e]}getOutputPorts(){return this.outputPorts}removeOutputPortWithName(e){if(this.outputPorts.hasOwnProperty(e)){const t=this.outputPorts[e];delete this.outputPorts[e],this.emit("outputPortRemoved",t)}}updateOutputPortTypes(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")}addChild(e,t){e.parent=this,void 0===t?this.children.push(e):this.children.splice(t,0,e),this.emit("childAdded",e)}removeChild(e){e.parent=void 0;const t=this.children.indexOf(e);this.children.splice(t,1),this.emit("childRemoved",e)}reset(){this.removeAllListeners()}setVariant(e){this.variant=e,this.emit("variantUpdated",e)}static createFromExportData(e){const t=new NodeModel(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((e=>{"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}}class ComponentModel extends EventSender{constructor(e){super(),this.name=e,this.nodes={},this.connections=[],this.roots=[],this.inputPorts={},this.outputPorts={},this.metadata={}}async addNode(e){e.component=this,this.nodes[e.id]=e,await this.emit("nodeAdded",e)}hasNodeWithId(e){return void 0!==this.getNodeWithId(e)}getNodeWithId(e){if(e)return this.nodes[e]}getAllNodes(){return Object.values(this.nodes)}getNodesWithType(e){const t=[];return Object.keys(this.nodes).forEach((n=>{const o=this.nodes[n];o.type===e&&t.push(o)})),t}addConnection(e){if(this.connections.push(e),this.emit("connectionAdded",e),e.targetId){const t=this.getNodeWithId(e.targetId);t&&t.emit("inputConnectionAdded",e)}}removeConnection(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&&(this.connections.splice(t,1),this.emit("connectionRemoved",e),e.targetId)){const t=this.getNodeWithId(e.targetId);t&&t.emit("inputConnectionRemoved",e)}}getConnectionsFromPort(e,t){return this.connections.filter((n=>n.sourceId===e&&n.sourcePort===t))}getConnectionsToPort(e,t){return this.connections.filter((n=>n.targetId===e&&n.targetPort===t))}getConnectionsFrom(e){return this.connections.filter((t=>t.sourceId===e))}getConnectionsTo(e){return this.connections.filter((t=>t.targetId===e))}addRootId(e){e&&-1===this.roots.indexOf(e)&&(this.roots.push(e),this.emit("rootAdded",e))}removeRootId(e){const t=this.roots.indexOf(e);-1!==t&&(this.roots.splice(t,1),this.emit("rootRemoved",e))}getRoots(){return this.roots}async removeNodeWithId(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,void 0),-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}getAllConnections(){return this.connections}getInputPorts(){return this.inputPorts}getOutputPorts(){return this.outputPorts}addInputPort(e){this.inputPorts[e.name]=e,this.emit("inputPortAdded",e)}addOutputPort(e){this.outputPorts[e.name]=e,this.emit("outputPortAdded",e)}removeOutputPortWithName(e){if(this.outputPorts.hasOwnProperty(e)){const t=this.outputPorts[e];delete this.outputPorts[e],this.emit("outputPortRemoved",t)}}removeInputPortWithName(e){if(this.inputPorts.hasOwnProperty(e)){const t=this.inputPorts[e];delete this.inputPorts[e],this.emit("inputPortRemoved",t)}}updateInputPortTypes(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")}updateOutputPortTypes(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")}renameInputPortOnNodeWithId(e,t,n){const o=this.getConnectionsToPort(e,t);o.forEach(this.removeConnection.bind(this));const i=this.getNodeWithId(e);if(!i)return;const s={...i.getInputPort(t)};s&&(i.removeInputPortWithName(t),s.name=n,i.addInputPort(s)),o.forEach((e=>{e.targetPort=n})),o.forEach(this.addConnection.bind(this))}renameOutputPortOnNodeWithId(e,t,n){const o=this.getConnectionsFromPort(e,t);o.forEach(this.removeConnection.bind(this));const i=this.getNodeWithId(e);if(!i)return;const s={...i.getOutputPort(t)};i.removeOutputPortWithName(t),s.name=n,i.addOutputPort(s),o.forEach((e=>{e.sourcePort=n})),o.forEach(this.addConnection.bind(this))}setNodeParent(e,t,n){e&&(-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)))}async importEditorNodeData(e,t,n){const o=NodeModel.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)}}async reset(){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")}rename(e){const t=this.name;this.name=e,this.emit("renamed",{oldName:t,newName:e})}setMetadata(e,t){this.metadata[e]=t}getMetadata(e){return e?this.metadata[e]:this.metadata}static async createFromExportData(e){const t=new ComponentModel(e.name);if(e.metadata)for(const n in e.metadata)t.setMetadata(n,e.metadata[n]);if(e.ports&&e.ports.forEach((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}}class GraphModel extends EventSender{constructor(){super(),this.componentToBundleMap=new Map,this.variants=[],this.components={},this.settings={},this.metadata={}}async importComponentFromEditorData(e){const t=await ComponentModel.createFromExportData(e);this.addComponent(t)}getBundleContainingComponent(e){return this.componentToBundleMap.get(e)}getBundlesContainingSheet(e){const t=new Set;for(const n of this.componentToBundleMap.keys()){const o=0!==n.indexOf("/#");(o&&"Default"===e||!o&&0===n.indexOf("/#"+e))&&t.add(this.componentToBundleMap.get(n))}return Array.from(t)}getBundleDependencies(e){const t=new Set,n=e=>{var o;const i=null===(o=this.componentIndex)||void 0===o?void 0:o[e];if(i)for(const e of i.dependencies)t.has(e)||(t.add(e),n(e))};return n(e),Array.from(t)}async importEditorData(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);for(const t of e.components)await this.importComponentFromEditorData(t);this.setRootComponentName(e.rootComponent)}setRootComponentName(e){this.rootComponent=e,this.emit("rootComponentNameUpdated",e)}getNodesWithType(e){let t=[];const n=Object.keys(this.components);for(let o=0;o<n.length;o++){const i=this.components[n[o]];t=t.concat(i.getNodesWithType(e))}return t}getComponentWithName(e){return this.components[e]}hasComponentWithName(e){return!!this.components[e]}getAllComponents(){return Object.keys(this.components).map((e=>this.components[e]))}getAllNodes(){let e=[];const t=Object.keys(this.components);for(let n=0;n<t.length;n++){const o=this.components[t[n]];e=e.concat(o.getAllNodes())}return e}addComponent(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),this.emit("componentAdded",e)}async removeComponentWithName(e){if(!e)return;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)}renameComponent(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)}_addComponentPorts(e){if(this.components.hasOwnProperty(e.type)){const t=this.components[e.type],n=t.getInputPorts(),o=t.getOutputPorts();Object.keys(n).forEach((t=>{e.addInputPort(n[t])})),Object.keys(o).forEach((t=>{e.addOutputPort(o[t])}))}}_onNodeAdded(e){this._addComponentPorts(e),this.emit("nodeAdded",e),this.emit("nodeAdded."+e.type,e)}_onNodeRemoved(e){this.emit("nodeRemoved",e),this.emit("nodeRemoved."+e.type,e)}_onNodeWasRemoved(e){this.emit("nodeWasRemoved",e),this.emit("nodeWasRemoved."+e.type,e)}async reset(){for(const e of Object.keys(this.components))await this.removeComponentWithName(e);this.setSettings({})}isEmpty(){return 0===Object.keys(this.components).length}setSettings(e){this.settings=e,this.emit("projectSettingsChanged",e)}getSettings(){return this.settings}setAllMetaData(e){for(const t in e)this.setMetaData(t,e[t])}setMetaData(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))}getMetaData(e){return e?this.metadata[e]:this.metadata}getVariants(){return this.variants||[]}getVariant(e,t){return this.variants.find((n=>n.name===t&&n.typename===e))}updateVariant(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)}updateVariantParameter(e,t,n,o,i){const s=this.getVariant(t,e);s?(i?(s.stateParameters.hasOwnProperty(i)||(s.stateParameters[i]={}),void 0===o?delete s.stateParameters[i][n]:s.stateParameters[i][n]=o):void 0===o?delete s.parameters[n]:s.parameters[n]=o,this.emit("variantUpdated",s)):console.log("updateVariantParameter: can't find variant",e,t)}updateVariantDefaultStateTransition(e,t,n,o){const i=this.getVariant(t,e);i&&(i.defaultStateTransitions[o]=n,this.emit("variantUpdated",i))}updateVariantStateTransition(e){const{variantTypeName:t,variantName:n,state:o,parameterName:i,curve:s}=e,r=this.getVariant(t,n);r&&(r.stateTransitions[o]||(r.stateTransitions[o]={}),r.stateTransitions[o][i]=s)}deleteVariant(e,t){const n=this.variants.findIndex((n=>n.name===t&&n.typename===e));-1!==n&&this.variants.splice(n,1)}}function difference(e,t){const n=new Set(t);return e.filter((e=>!n.has(e)))}async function handleEvent(e,t,n){function o(t,n){const o={},s={};n.forEach((e=>{"input"!==e.plug&&"input/output"!==e.plug||(o[e.name]=e),"output"!==e.plug&&"input/output"!==e.plug||(s[e.name]=e)}));const r=Object.keys(t.getInputPorts()),a=difference(r,Object.keys(o)),l=difference(Object.keys(o),r);t.updateInputPortTypes(o),a.forEach(t.removeInputPortWithName.bind(t)),l.forEach((n=>{var s;t.addInputPort(o[n]),t instanceof NodeModel&&(null===(s=t.parameters)||void 0===s?void 0:s.hasOwnProperty(n))&&i(e.rootComponent.nodeScope,t,n,t.parameters[n])})),t.updateOutputPortTypes(s);const d=Object.keys(t.getOutputPorts()),u=difference(d,Object.keys(s)),c=difference(Object.keys(s),d);u.forEach(t.removeOutputPortWithName.bind(t)),c.forEach((e=>{t.addOutputPort(s[e])}))}function i(e,t,n,o){e.getNodesWithIdRecursive(t.id).forEach((e=>{e.queueInput(n,o)}))}let s;if(n.componentName&&(s=t.getComponentWithName(n.componentName),!s))return;if(!s)throw new Error("Component model not found");const r={nodeAdded:e=>{null==s||s.importEditorNodeData(e.model,e.parentId,e.childIndex)},nodeRemoved:async e=>{(null==s?void 0:s.hasNodeWithId(e.model.id))&&await s.removeNodeWithId(e.model.id)},connectionAdded:e=>{null==s||s.addConnection(e.model)},connectionRemoved:t=>{if(!s)return;s.removeConnection(t.model);const n=s.getNodeWithId(t.model.targetId);if(0===s.getConnectionsToPort(n.id,t.model.targetId).length){let o=n.parameters[t.model.targetPort];void 0===o&&(o=e.getDefaultValueForInput(n.type,t.model.targetPort)),i(e.rootComponent.nodeScope,n,t.model.targetPort,o)}},parameterChanged:e=>{if(!s)return;const t=s.getNodeWithId(e.nodeId);if(void 0!==t){if(e.parameters){const n=new Set([...Object.keys(e.parameters),...Object.keys(e.oldParameters)]);for(const o of n)t.setParameter(o,e.parameters[o])}e.parameterName&&t.setParameter(e.parameterName,e.parameterValue,e.state)}else console.log("parameterChanged: Unknown node id",e)},nodeAttached:e=>{s&&s.setNodeParent(s.getNodeWithId(e.nodeId),s.getNodeWithId(e.parentId),e.childIndex)},nodeDetached:e=>{s&&(s.setNodeParent(s.getNodeWithId(e.nodeId),null),s.addRootId(e.nodeId))},componentAdded:e=>{t.importComponentFromEditorData(e.model)},componentRemoved:async e=>{await t.removeComponentWithName(e.componentName)},rootAdded:e=>{null==s||s.addRootId(e.nodeId)},portAdded:t=>{if(!s)return;const n=s.getNodeWithId(t.nodeId);t.port&&n&&("input"!==t.port.plug&&"input/output"!==t.port.plug||(n.addInputPort(t.port),n.parameters.hasOwnProperty(t.port.name)&&i(e.rootComponent.nodeScope,n,t.port.name,n.parameters[t.port.name])),"output"!==t.port.plug&&"input/output"!==t.port.plug||n.addOutputPort(t.port))},portRemoved:e=>{if(!s)return;const t=s.getNodeWithId(e.nodeId);e.port&&t&&("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:e=>{if(!e.port||!s)return;"input"!==e.port.plug&&"input/output"!==e.port.plug||e.nodeId&&e.oldName&&s.renameInputPortOnNodeWithId(e.nodeId,e.oldName,e.port.name),e.nodeId&&e.oldName&&("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"===(null==n?void 0:n.type)?(s.addInputPort(e.port),t.getNodesWithType(s.name).forEach((t=>{var n;t.component.renameInputPortOnNodeWithId(t.id,e.oldName,null===(n=e.port)||void 0===n?void 0:n.name)})),s.removeInputPortWithName(e.oldName)):"Component Outputs"===(null==n?void 0:n.type)&&(s.addOutputPort(e.port),t.getNodesWithType(s.name).forEach((t=>{var n;t.component.renameOutputPortOnNodeWithId(t.id,e.oldName,null===(n=e.port)||void 0===n?void 0:n.name)})),s.removeOutputPortWithName(e.oldName))},componentPortsUpdated:e=>{s&&o(s,e.ports)},instancePortsChanged:e=>{if(!s.hasNodeWithId(e.nodeId))return;const t=s.getNodeWithId(e.nodeId);t&&o(t,e.ports)},componentRenamed:e=>{t.renameComponent(e.oldName,e.newName)},settingsChanged:e=>{t.setSettings(e.settings)},metadataChanged:e=>{t.setMetaData(e.key,e.data)},componentMetadataChanged:e=>{const n=t.getComponentWithName(e.componentName);n&&n.setMetadata(e.key,e.data)},variantParametersChanged: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 o=t.getVariant(n.variantTypeName,n.variantName);e.rootComponent.nodeScope.getAllNodesWithVariantRecursive(o).forEach((e=>{e.queueInput(n.parameterName,e.getParameter(n.parameterName))}))}},variantDeleted:e=>{t.deleteVariant(e.variantTypeName,e.variantName)},variantChanged:e=>{const n=s.getNodeWithId(e.nodeId);if(n){const o=t.getVariant(n.type,e.variantName);n.setVariant(o)}},variantRenamed:e=>{const n=t.getVariant(e.variantTypeName,e.oldVariantName);(null==n?void 0:n.variantName)&&(n.name=n.variantName)},defaultStateTransitionChanged:e=>{const t=s.getNodeWithId(e.nodeId);null==t||t.setDefaultStateTransition(e.curve,e.state)},stateTransitionsChanged:e=>{const t=s.getNodeWithId(e.nodeId);t&&e.parameterName&&t.setStateTransitionParamter(e.parameterName,e.curve,e.state)},variantDefaultStateTransitionChanged:e=>{t.updateVariantDefaultStateTransition(e.variantName,e.variantTypeName,e.curve,e.state)},variantStateTransitionsChanged:e=>{t.updateVariantStateTransition(e)},routerIndexChanged:e=>{t.routerIndex=e.data}};r.hasOwnProperty(n.type)?(await r[n.type](n),e.scheduleUpdate()):console.log("Unknown event",n)}class Services{}function createSetter(e){let t=!1;return function(n){(n=!!n)&&!1===t&&e.valueChangedToTrue.call(this),t=n}}async function asyncPool(e,t,n){const o=[],i=[];for(const s of t){const r=Promise.resolve().then((()=>n(s,t)));if(o.push(r),e<=t.length){const t=r.then((()=>{i.splice(i.indexOf(t),1)}));i.push(t),i.length>=e&&await Promise.race(i)}}return Promise.all(o)}function registerInput(e,t,n,o){if(e.hasOwnProperty(n))throw new Error("Input property "+n+" already registered");o.set||o.valueChangedToTrue||(o.set=()=>{}),o.set&&(e[n]={set:o.set},["color","textStyle","array"].forEach((t=>{!o.type||o.type!==t&&o.type.name!==t||(e[n].type=t)}))),o.setUnitType&&(e[n].setUnitType=o.setUnitType),t.inputs=t.inputs||{},t.inputs[n]={displayName:o.displayName,editorName:o.editorName,group:o.group,type:o.type,default:o.default,index:o.index,exportToEditor:!o.hasOwnProperty("exportToEditor")||o.exportToEditor,inputPriority:o.inputPriority||0,tooltip:o.tooltip,tab:o.tab,popout:o.popout,allowVisualStates:o.allowVisualStates,nodeDoubleClickAction:o.nodeDoubleClickAction},o.valueChangedToTrue&&(t.inputs[n].type={name:"signal",allowConnectionsOnly:!0})}function registerInputs(e,t,n){Object.keys(n).forEach((function(o){registerInput(e,t,o,n[o])}))}function registerNumberedInputs(e,t){for(const n of Object.keys(t))registerNumberedInput(e,n,t[n])}function registerNumberedInput(e,t,n){const o=e.registerInputIfNeeded;e.registerInputIfNeeded=function(i){if(o&&o.call(e,i),e.hasInput(i)||!i.startsWith(t))return;const s=Number(i.slice(t.length+1));e.registerInput(i,{type:n.type,set:n.createSetter.call(e,s)})}}function registerOutputsMetadata(e,t){Object.keys(t).forEach((function(n){const o=t[n];e.outputs=e.outputs||{},e.outputs[n]={displayName:o.displayName,editorName:o.editorName,group:o.group,type:o.type,index:o.index,exportToEditor:!o.hasOwnProperty("exportToEditor")||o.exportToEditor}}))}function initializeDefaultValues(e,t){Object.keys(t).forEach((n=>{const o=t[n].default;void 0!==o&&(t[n].type.defaultUnit?e[n]={unit:t[n].type.defaultUnit,value:o}:e[n]=o)}))}function defineNode(e){if(!e.category)throw new Error("Node must have a category");if(!e.name)throw new Error("Node must have a 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,haveComponentPorts:e.haveComponentPorts,version:e.version,module:e.module,docs:e.docs,allowAsExportRoot:e.allowAsExportRoot,nodeDoubleClickAction:e.nodeDoubleClickAction,searchTags:e.searchTags};e._internal=e._internal||{},e.prototypeExtensions=e.methods||e.prototypeExtensions||{},e.inputs=e.inputs||{},e.outputs=e.outputs||{},e.initialize=e.initialize||function(){};const n={};registerInputs(n,t,e.inputs),registerOutputsMetadata(t,e.outputs);class o extends Node$1{constructor(e,t){super(e,t)}}e.prototypeExtensions&&Object.keys(e.prototypeExtensions).forEach((function(t){e.prototypeExtensions[t].value||(e.prototypeExtensions[t]={value:e.prototypeExtensions[t]})})),Object.defineProperties(o.prototype,e.prototypeExtensions),Object.defineProperty(o.prototype,"name",{value:e.name}),e.getInspectInfo&&(o.prototype.getInspectInfo=e.getInspectInfo),e.nodeScopeDidInitialize&&(o.prototype.nodeScopeDidInitialize=e.nodeScopeDidInitialize);const i=function(s,r,a){var l;const d=new o(s,r);if(d._inputs=Object.create(n),e.inputs)return Object.keys(e.inputs).forEach((function(t){const n=e.inputs[t];n.valueChangedToTrue&&(d._inputs[t]={set:createSetter({valueChangedToTrue:n.valueChangedToTrue})})})),e.outputs?(Object.keys(e.outputs).forEach((function(t){const n=e.outputs[t];"signal"===n.type?d.registerOutput(t,{getter(){}}):d.registerOutput(t,n)})),e.numberedInputs&&registerNumberedInputs(d,e.numberedInputs),d.nodeScope=a,initializeDefaultValues(d._inputValues,t.inputs||{}),null===(l=e.initialize)||void 0===l||l.call(d),d):(Object.assign(i,{metadata:t}),e.numberedInputs&&registerSetupFunctionForNumberedInputs(i,e.name,e.numberedInputs),i)};return i.metadata=t,i}function registerSetupFunctionForNumberedInputs(e,t,n){const o=Object.keys(n);o.length&&(e.setupNumberedInputDynamicPorts=function(e,i){const s=e.editorConnection;function r(e){const t=o.map((t=>function(e,t,n){const o=e.component.getConnectionsTo(e.id).map((e=>e.targetPort)),i=Object.keys(e.parameters).concat(o).filter((e=>e.startsWith(t+" "))),s=(i.length?1+Math.max(...i.map((e=>Number(e.slice(t.length+1))))):0)+1,r=[];for(let e=0;e<s;e++){const o={name:t+" "+e,displayName:(n.displayPrefix||t)+" "+e,type:n.type,plug:"input",group:n.group};n.hasOwnProperty("index")&&(o.index=n.index+e),r.push(o)}return r}(e,t,n[t]))).flat();null==s||s.sendDynamicPorts(e.id,t)}s&&s.isRunningLocally()&&i.on("nodeAdded."+t,(e=>{r(e),e.on("parameterUpdated",(()=>{r(e)})),e.on("inputConnectionAdded",(()=>{r(e)})),e.on("inputConnectionRemoved",(()=>{r(e)}))}))})}function extend(e,t){for(const n in t)if("initialize"===n&&e.initialize){const n=e.initialize;e.initialize=function(){n.call(this),t.initialize.call(this)}}else t[n]&&t[n].constructor===Object?e[n]=extend(e[n]||{},t[n]):t[n]&&t[n].constructor===Array&&e[n]&&e[n].constructor==Array?e[n]=e[n].concat(t[n]):e[n]=t[n];return e}Services.events=new eventemitter3__WEBPACK_IMPORTED_MODULE_0__.b;const node$y={name:"Component Inputs",shortDesc:"This node is used to define the inputs of a component.",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(){var e;return{type:"value",value:null===(e=this.nodeScope)||void 0===e?void 0:e.componentOwner._internal.inputValues}},color:"component",haveComponentPorts:!0,category:"Component Utilities",methods:{registerOutputIfNeeded(e){this.hasOutput(e)||this.registerOutput(e,{getter(){var t;return null===(t=this.nodeScope)||void 0===t?void 0:t.componentOwner._internal.inputValues[e]}})},_updateDependencies(){var e,t;null===(t=null===(e=this.nodeScope)||void 0===e?void 0:e.componentOwner)||void 0===t||t.update()}}};var componentinputs=Object.freeze({__proto__:null,node:node$y});const node$x={category:"Component Utilities",name:"Component Outputs",shortDesc:"This node is used to define the outputs of a component.",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(t){var n,o;null===(o=null===(n=this.nodeScope)||void 0===n?void 0:n.componentOwner)||void 0===o||o.setOutputFromComponentOutput(e,t)}})}}};var componentoutputs=Object.freeze({__proto__:null,node:node$x});class Model{constructor(e,t){this.id=e,this.data=t}static get(e){return void 0===e&&(e=Model.guid()),Model.models[e]||(Model.models[e]=new Model(e,{}),Model.proxies[e]=new Proxy(Model.models[e],Model._modelProxyHandler)),Model.proxies[e]}static create(e){const t=e||{},n=Model.get(t.id);for(const e in t)"id"!==e&&n.set(e,t[e]);return n}static exists(e){return void 0!==Model.models[e]}static instanceOf(e){return e instanceof Model||e.target instanceof Model}static guid(){return randomString(10)}on(e,t){this.listeners||(this.listeners={}),this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}off(e,t){if(!this.listeners)return;if(!this.listeners[e])return;const n=this.listeners[e].indexOf(t);-1!==n&&this.listeners[e].splice(n,1)}notify(e,t){if(!this.listeners)return;if(!this.listeners[e])return;const n=this.listeners[e].slice();for(let e=0;e<n.length;e++)n[e](t)}setAll(e){for(const t in e)if("id"!==t&&this.data[t]!==e[t]){const n=this.data[t];this.data[t]=e[t],this.notify("change",{name:t,value:e[t],old:n})}}fill(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})}}set(e,t,n){if((null==n?void 0:n.resolve)&&-1!==e.indexOf(".")){const n=e.split(".");let o=this;for(let e=0;e<n.length-1;e++){const t=o.get(n[e]);if(!Model.instanceOf(t))return;o=t}return void o.set(n[n.length-1],t)}const o=null==n?void 0:n.forceChange,i=this.data[e];this.data[e]=t,!o&&i===t||(null==n?void 0:n.silent)||this.notify("change",{name:e,value:t,old:i})}getId(){return this.id}get(e,t){if((null==t?void 0:t.resolve)&&-1!==e.indexOf(".")){const t=e.split(".");let n=this;for(let e=0;e<t.length-1;e++){const o=n.get(t[e]);if(!Model.instanceOf(o))return;n=o}return n.get(t[t.length-1])}return this.data[e]}toJSON(){return Object.assign({},this.data,{id:this.id})}}Model._models={},Model.models=Model._models,Model.proxies={},Model._modelProxyHandler={get:function(e,t,n){return"function"==typeof e[t]?e[t].bind(e):t in e?Reflect.get(e,t,n):e.get(t.toString())},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.toString(),n)}return!0},ownKeys:e=>Reflect.ownKeys(e.data),getOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e.data,t.toString())};class ModelScope{constructor(){this.models={},this.proxies={}}get(e){return void 0===e&&(e=Model.guid()),this.models[e]||(this.models[e]=new Model(e,{}),this.proxies[e]=new Proxy(this.models[e],Model._modelProxyHandler)),this.proxies[e]}create(e){const t=e||{},n=this.get(t.id);for(const e in t)"id"!==e&&n.set(e,t[e]);return n}exists(e){return void 0!==this.models[e]}instanceOf(e){return e instanceof Model||e.target instanceof Model}guid(){return randomString(10)}reset(){this.models={},this.proxies={},delete this._cloudStore}}function sendSignalOnInput(e,t){e.queueInput(t,!0),e.queueInput(t,!1)}const node$w={name:"RunTasks",displayNodeName:"Run Tasks",docs:"https://docs.noodl.net/nodes/data/run-tasks",color:"data",category:"Data",initialize(){this._internal={queuedOperations:[],state:"idle",maxRunningTasks:10,activeTasks:new Map}},inputs:{items:{group:"Data",displayName:"Items",type:"array",set(e){e&&e!==this._internal.items&&(this._internal.items=e)}},stopOnFailure:{group:"General",displayName:"Stop On Failure",type:"boolean",default:!1,set(e){this._internal.stopOnFailure=e}},maxRunningTasks:{group:"General",displayName:"Max Running Tasks",type:"number",default:10,set(e){this._internal.maxRunningTasks=e}},taskTemplate:{type:"component",displayName:"Template",group:"General",set(e){this._internal.template=e}},run:{group:"General",displayName:"Do",type:"signal",valueChangedToTrue(){this.scheduleRun()}},abort:{group:"General",displayName:"Abort",type:"signal",valueChangedToTrue(){this.scheduleAbort()}}},outputs:{success:{type:"signal",group:"Events",displayName:"Success"},failure:{type:"signal",group:"Events",displayName:"Failure"},done:{type:"signal",group:"Events",displayName:"Done"},aborted:{type:"signal",group:"Events",displayName:"Aborted"}},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()}))})))},async createTaskComponent(e){const t=this._internal,n=(this.nodeScope.modelScope||Model).create(e),o=await this.nodeScope.createNode(t.template,guid(),{_forEachModel:n,_forEachNode:this}),i=o.isInputConnected.bind(o);o.isInputConnected=e=>"Do"===e||i(e),o.hasInput("Id")&&o.setInputValue("Id",n.getId()),o.hasInput("id")&&o.setInputValue("id",n.getId());for(const e in o._inputs)void 0!==n.data[e]&&o.setInputValue(e,n.data[e]);return o._internal.creatorCallbacks={onOutputChanged:(e,t,i)=>{!1!==i&&void 0!==i||!0!==t||this.itemOutputSignalTriggered(e,n,o)}},o},async startTask(e){const t=this._internal;try{const n=await this.createTaskComponent(e);t.runningTasks++,sendSignalOnInput(n,"Do"),t.activeTasks.set(n.id,n)}catch(e){console.log(e)}},async run(){const e=this._internal;if(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&&e.template&&e.items){e.state="running",e.numTasks=e.items.length,e.failedTasks=0,e.completedTasks=0,e.queuedTasks=[].concat(e.items),e.runningTasks=0,0===e.items.length&&(this.sendSignalOnOutput("success"),e.state="idle");for(let t=0;t<Math.min(e.maxRunningTasks,e.queuedTasks.length);t++){const t=e.queuedTasks.shift();if(!t)break;this.startTask(t)}}},abort(){this._internal.state="aborted"},itemOutputSignalTriggered(e,t,n){const o=this._internal;if("idle"===o.state)return;const i=()=>{if("aborted"===o.state)return this.sendSignalOnOutput("aborted"),void(o.state="idle");if(o.completedTasks===o.numTasks)0===o.failedTasks?this.sendSignalOnOutput("success"):this.sendSignalOnOutput("failure"),this.sendSignalOnOutput("done"),o.state="idle";else if(o.stopOnFailure)if(0===o.failedTasks){o.runningTasks++;const e=o.queuedTasks.shift();e&&this.startTask(e)}else this.sendSignalOnOutput("failure"),this.sendSignalOnOutput("aborted");else{o.runningTasks++;const e=o.queuedTasks.shift();e&&this.startTask(e)}};"Success"===e?(o.completedTasks++,o.runningTasks--,i()):"Failure"===e&&(o.completedTasks++,o.failedTasks++,o.runningTasks--,i()),o.activeTasks.delete(n.id),this.nodeScope.deleteNode(n)},_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)this.nodeScope.deleteNode(e);this._internal.activeTasks.clear()},_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this._deleteAllTasks()}};var runtasks=Object.freeze({__proto__:null,node:node$w});const defaultRequestScript="//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//*Inputs and *Outputs contain the inputs and outputs of the node.\n",defaultResponseScript="// 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",node$v={name:"REST2",displayNodeName:"REST",docs:"https://docs.noodl.net/nodes/data/rest",category:"Data",color:"data",searchTags:["http","request","fetch"],initialize(){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(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(e){this._internal.method=e}},requestScript:{type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},displayName:"Request",default:defaultRequestScript,group:"Scripts",set(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:defaultResponseScript,group:"Scripts",set(e){try{this._internal.responseFunc=new Function("Inputs","Outputs","Response",e)}catch(e){console.log(e)}}},fetch:{type:"signal",displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleFetch()}},cancel:{type:"signal",displayName:"Cancel",group:"Actions",valueChangedToTrue(){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(e){return this._internal.outputValues[e]},setScriptInputValue(e,t){return this._internal.inputValues[e]=t},registerOutputIfNeeded(e){if(!this.hasOutput(e))return e.startsWith("out-")?this.registerOutput(e,{getter:this.getScriptOutputValue.bind(this,e.substring(4))}):void 0},registerInputIfNeeded(e){if(!this.hasInput(e))return e.startsWith("in-")?this.registerInput(e,{set:this.setScriptInputValue.bind(this,e.substring(3))}):void 0},scheduleFetch(){const e=this._internal;e.hasScheduledFetch||(e.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated(this.doFetch.bind(this)))},doResponse(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(e){let t=e.resource;if(Object.keys(e.parameters).length>0){const n=Object.keys(e.parameters).map((t=>t+"="+encodeURIComponent(e.parameters[t])));t+="?"+n.join("&")}if("undefined"==typeof _noodl_cloud_runtime_version){const n=new XMLHttpRequest;this._xhr=n,n.open(e.method,t,!0);for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);n.onreadystatechange=()=>{let t=!1;if(4===n.readyState){const o=n.status,i=n.getResponseHeader("content-type"),s=n.response;if(delete this._xhr,i){i=i.toLowerCase();const n=-1!==i.indexOf("json")?JSON.parse(s):s;this.doResponse(o,n,e),t=!0}!1===t&&this.doResponse(o,s,e)}},n.onerror=()=>{delete this._xhr,this.sendSignalOnOutput("failure")},n.onabort=()=>{delete this._xhr,this.sendSignalOnOutput("canceled")},e.content?(n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify(e.content))):n.send()}else{const n={...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(){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(){"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."})}}};function parseScriptForErrors(e,t,n,o,i,s){if(!i.editorConnection)return;if(i.editorConnection.clearWarning(o.component.name,o.id,"rest-run-waring-"+n),void 0===e)return void i.editorConnection.clearWarning(o.component.name,o.id,"rest-parse-waring-"+n);try{new Function(...t,e),i.editorConnection.clearWarning(o.component.name,o.id,"rest-parse-waring-"+n)}catch(e){i.editorConnection.sendWarning(o.component.name,o.id,"rest-parse-waring-"+n,{message:"<strong>"+n+"</strong>: "+e.message,showGlobally:!0})}function r(e){return void 0!==s.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=>{r("in-"+e)||s.push({name:"in-"+e,displayName:e,plug:"input",type:"*",group:"Inputs"})}))}const d=a.match(/Outputs\.[A-Za-z0-9]+/g);if(d){const e={};d.forEach((t=>{e[t.substring(8)]=!0})),Object.keys(e).forEach((e=>{r("out-"+e)||s.push({name:"out-"+e,displayName:e,plug:"output",type:"*",group:"Outputs"})}))}}function setup$a(e,t){function n(t){function n(){if(!t.parameters)return;const n=[];function o(e){for(let t=0;t<n.length;t++)if(n[t].name===e&&"input"===n[t].plug)return!0;return!1}if(t.parameters.resource){const e=t.parameters.resource.match(/\{[A-Za-z0-9_]*\}/g);if(e)for(const t of e){const e=t.replace("{","").replace("}","");o("in-"+e)||n.push({name:"in-"+e,displayName:e,type:"string",plug:"input",group:"Inputs"})}}t.parameters.requestScript&&parseScriptForErrors(t.parameters.requestScript,["Inputs","Outputs","Request"],"Request script",t,e,n),t.parameters.responseScript&&parseScriptForErrors(t.parameters.responseScript,["Inputs","Outputs","Response"],"Response script",t,e,n),e.editorConnection.sendDynamicPorts(t.id,n)}n(),t.on("parameterUpdated",(()=>{n()}))}e.editorConnection&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.REST2",(e=>{n(e)}));for(const e of t.getNodesWithType("REST2"))n(e)}))}var restnode=Object.freeze({__proto__:null,node:node$v,setup:setup$a});const node$u={name:"Expression",docs:"https://docs.noodl.net/nodes/math/expression",usePortAsLabel:"expression",category:"CustomCode",color:"javascript",nodeDoubleClickAction:{focusPort:"Expression"},searchTags:["javascript"],initialize(){const e=this._internal;e.scope={},e.hasScheduledEvaluation=!1,e.code=void 0,e.cachedValue=0,e.currentExpression="",e.compiledFunction=void 0,e.inputNames=[],e.inputValues=[]},getInspectInfo(){return this._internal.cachedValue},inputs:{expression:{group:"General",inputPriority:1,type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},displayName:"Expression",set(e){const t=this._internal;t.currentExpression=functionPreamble+"return ("+e+");",t.compiledFunction=void 0;const n=parsePorts(e),o=lodash_difference__WEBPACK_IMPORTED_MODULE_1___default()(n,t.inputNames),i=lodash_difference__WEBPACK_IMPORTED_MODULE_1___default()(t.inputNames,n),s=this;i.forEach((function(e){s.deregisterInput(e),delete t.scope[e]})),o.forEach((function(e){s.hasInput(e)||(s.registerInput(e,{set(n){t.scope[e]=n,this.isInputConnected("run")||this._scheduleEvaluateExpression()}}),t.scope[e]=0,s._inputValues[e]=0)})),t.inputNames=Object.keys(t.scope),this.isInputConnected("run")||this._scheduleEvaluateExpression()}},run:{group:"Actions",displayName:"Run",type:"signal",valueChangedToTrue(){this._scheduleEvaluateExpression()}}},outputs:{result:{group:"Result",type:"*",displayName:"Result",getter(){return this._internal.currentExpression?this._internal.cachedValue:0}},isTrue:{group:"Result",type:"boolean",displayName:"Is True",getter(){return!!this._internal.currentExpression&&!!this._internal.cachedValue}},isFalse:{group:"Result",type:"boolean",displayName:"Is False",getter(){return!this._internal.currentExpression||!this._internal.cachedValue}},isTrueEv:{group:"Events",type:"signal",displayName:"On True"},isFalseEv:{group:"Events",type:"signal",displayName:"On False"}},prototypeExtensions:{registerInputIfNeeded(e){this.hasInput(e)||(this._internal.scope[e]=0,this._inputValues[e]=0,this.registerInput(e,{set(t){this._internal.scope[e]=t,this.isInputConnected("run")||this._scheduleEvaluateExpression()}}))},_scheduleEvaluateExpression(){const e=this._internal;!1===e.hasScheduledEvaluation&&(e.hasScheduledEvaluation=!0,this.flagDirty(),this.scheduleAfterInputsHaveUpdated((function(){const t=e.cachedValue;e.cachedValue=this._calculateExpression(),t!==e.cachedValue&&(this.flagOutputDirty("result"),this.flagOutputDirty("isTrue"),this.flagOutputDirty("isFalse")),e.cachedValue?this.sendSignalOnOutput("isTrueEv"):this.sendSignalOnOutput("isFalseEv"),e.hasScheduledEvaluation=!1})))},_calculateExpression(){const e=this._internal;e.compiledFunction||(e.compiledFunction=this._compileFunction());for(let t=0;t<e.inputNames.length;++t){const n=e.scope[e.inputNames[t]];e.inputValues[t]=n}try{if(!e.compiledFunction)throw new Error("Compiled function is undefined");return e.compiledFunction.apply(null,e.inputValues)}catch(e){e instanceof Error&&console.error("Error in expression:",e.message)}},_compileFunction(){const e=this._internal.currentExpression,t=Object.keys(this._internal.scope),n=e+t.join(" ");if(!compiledFunctionsCache[n]){t.push(e);try{compiledFunctionsCache[n]=construct(Function,t)}catch(e){e instanceof Error&&console.error("Failed to compile JS function",e.message)}}return compiledFunctionsCache[n]}}},functionPreamble=["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;"].join("");function construct(e,t){function n(){return e.apply(this,t)}return n.prototype=e.prototype,new n}const compiledFunctionsCache={},portsToIgnore=["min","max","cos","sin","tan","sqrt","pi","round","floor","ceil","abs","random","Math","window","document","undefined","Vars","true","false","null","Boolean"];function parsePorts(e){const t=[];function n(e){-1===portsToIgnore.indexOf(e)&&(t.some((t=>t===e))||t.push(e))}const o=(e=e.replace(/\"([^\"]*)\"/g,"").replace(/\'([^\']*)\'/g,"")).matchAll(/[a-zA-Z\_\$][a-zA-Z0-9\.\_\$]*/g);for(const e of o){let t=e[0];-1!==t.indexOf(".")&&(t=t.split(".")[0]),n(t)}return t}function updatePorts$7(e,t,n){const o=parsePorts(t).map((e=>({group:"Parameters",name:e,type:{name:"*",editAsType:"string"},plug:"input"})));n.sendDynamicPorts(e,o)}function evalCompileWarnings(e,t){try{new Function(t.parameters.expression),e.clearWarning(t.component.name,t.id,"expression-compile-error")}catch(n){n instanceof Error&&e.sendWarning(t.component.name,t.id,"expression-compile-error",{message:n.message})}}function setup$9(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Expression",(t=>{t.parameters.expression&&(updatePorts$7(t.id,t.parameters.expression,e.editorConnection),evalCompileWarnings(e.editorConnection,t)),t.on("parameterUpdated",(n=>{"expression"===n.name&&(updatePorts$7(t.id,t.parameters.expression,e.editorConnection),evalCompileWarnings(e.editorConnection,t))}))}))}var expression=Object.freeze({__proto__:null,node:node$u,setup:setup$9});const userFunctionsCache={};class JavascriptNodeParser{constructor(e,t){this.inputs={},this.outputs={},this.code=e;const n=t?t.node:void 0;this._initializeAPIs();let o=userFunctionsCache[e];if(!o)try{o=new Function(["define","script","Node","Component"],JavascriptNodeParser.getCodePrefix()+e),userFunctionsCache[e]=o}catch(e){this.error=e instanceof Error?e.message:String(e),console.error(e)}if(o)try{o(this.define.bind(this),this.script.bind(this),this.apis.Node,n?JavascriptNodeParser.getComponentScopeForNode(n):{}),this._afterSourced()}catch(e){this.error=e instanceof Error?e.message:String(e),console.error(e)}}define(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}script(e){const t=_scriptExtend(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}_initializeAPIs(){this.apis={Node:{Inputs:{},Outputs:{},Signals:{},Setters:{}}}}_afterSourced(){if(void 0!==this.definedObject)return;const e=this.apis.Node;if(this.inputs=Object.assign({},e.Inputs||{}),this.outputs=Object.assign({},e.Outputs||{}),this.setup=function(t,n){const o=this;e.setOutputs=function(e){for(const t in e)n[t]=e[t],o.flagOutputDirty(t)},e.OnInit&&e.OnInit.apply(this)},this.destroy=e.OnDestroy||this.destroy,this.change=(t,n,o)=>{for(const n in o)"function"==typeof e.Setters[n]&&e.Setters[n](t[n]);"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(const t in e.Signals)"function"==typeof e.Signals[t]&&(this.inputs[t]="signal",this.definedObject[t]=e.Signals[t])}getPorts(){const e=[];return Object.keys(this.inputs).forEach((t=>{const n=this.inputs[t],o={name:t,plug:"input",type:void 0,group:"Inputs"};"string"==typeof n?o.type={name:n}:Object.assign(o,n),e.push(o)})),Object.keys(this.outputs).forEach((t=>{e.push({name:t,type:{name:this.outputs[t]},plug:"output",group:"Outputs"})})),JavascriptNodeParser.parseAndAddPortsFromScript(this.code,e,{}),e}static createFromCode(e,t){return new JavascriptNodeParser(e,t)}static createFromURL(e,t,n){e=getAbsoluteUrl(e);const o=new XMLHttpRequest;o.open("GET",e,!0),o.onreadystatechange=function(){4!==this.readyState&&this.readyState!==XMLHttpRequest.DONE||t(new JavascriptNodeParser(this.response))},o.onerror=function(){console.log("Failed to request",e)},o.send()}static parseAndAddPortsFromScript(e,t,n){function o(e,n){if(null==e)return;const o={};for(const t of e){let e=t[1];void 0!==e&&(o[e]=!0)}Object.keys(o).forEach((e=>{var o;("string"==typeof(o={name:n.prefix+e,plug:n.plug})?void 0===t.find((e=>e.name===o)):void 0===t.find((e=>e.name===o.name&&e.plug===o.plug)))&&t.push({name:n.prefix+e,displayName:e,plug:n.plug,type:n.type,group:n.group})}))}n.skipInputs||(o(e.matchAll(/Inputs\.([A-Za-z0-9_]+)/g),{type:n.inputType||"*",plug:"input",group:n.inputGroup||"Inputs",prefix:n.inputPrefix||""}),o(e.matchAll(/Inputs\s*\[\s*(?:'|")(.*)(?:'|")\s*\]/g),{type:n.inputType||"*",plug:"input",group:n.inputGroup||"Inputs",prefix:n.inputPrefix||""})),n.skipOutputs||(n.skipOutputSignals||(o(e.matchAll(/Outputs\.([A-Za-z0-9]+)\s*\(\s*\)/g),{type:"signal",plug:"output",group:"Outputs",prefix:n.outputPrefix||""}),o(e.matchAll(/Outputs\s*\[\s*(?:'|")(.*)(?:'|")\s*\]\(\s*\)/g),{type:"signal",plug:"output",group:"Outputs",prefix:n.outputPrefix||""})),n.skipRegularOutputs||(o(e.matchAll(/Outputs\.([A-Za-z0-9_]+)/g),{type:"*",plug:"output",group:"Outputs",prefix:n.outputPrefix||""}),o(e.matchAll(/Outputs\s*\[\s*\"([^\"]*)\"\s*\]/g),{type:"*",plug:"output",group:"Outputs",prefix:n.outputPrefix||""})))}static getCodePrefix(){return"const Script = (typeof Node !== 'undefined')?Node:undefined;\n"}static createNoodlAPI(){return"undefined"!=typeof window&&void 0!==window.Noodl?window.Noodl:{}}static getComponentScopeForNode(e){const t=e.nodeScope.componentOwner.getInstanceId();if(void 0===_componentScopes[t]){_componentScopes[t]={};const n=(e.nodeScope.modelScope||Model).get("componentState"+t);_componentScopes[t].Object=n}const n=_findParentComponentStateModelId(e),o=void 0!==n?(e.nodeScope.modelScope||Model).get(n):void 0;return _componentScopes[t].ParentObject=o,_componentScopes[t].RepeaterObject=_findForEachModel(e),_componentScopes[t]}}function _scriptExtend(e){const t={inputs:e.inputs||{},outputs:e.outputs||{},setup:function(t,n){if(this.inputs=t,this.outputs=n,this.setOutputs=function(e){for(const t in e)this.outputs[t]=e[t],this.flagOutputDirty(t)},e.methods)for(const t in e.methods)this[t]=e.methods[t];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;const o=this._oldInputs||{};if(e.changed)for(const n in t)if(t[n]!==o[n]){const i=e.changed[n];"function"==typeof i&&i.apply(this,[t[n],o[n]])}this._oldInputs=Object.assign({},t)}};if(e.signals)for(const n in e.signals)t[n]=e.signals[n],t.inputs[n]="signal";return t}const _componentScopes={};function _findParentComponentStateModelId(e){const t=function e(t){let n;if(t.getRoots().length>0){const e=t.getRoots()[0];e.getVisualParentNode?e.getVisualParentNode()&&(n=e.getVisualParentNode().nodeScope.componentOwner):e.parentNodeScope&&(n=t.parentNodeScope.componentOwner)}else t.parentNodeScope&&(n=t.parentNodeScope.componentOwner);if(n&&n.nodeScope&&n.nodeScope.componentOwner!==t)return n.nodeScope.getNodesWithType("net.noodl.ComponentObject").length>0||n.nodeScope.getNodesWithType("Component State").length>0?n:e(n)}(e.nodeScope.componentOwner);if(t)return"componentState"+t.getInstanceId()}function _findForEachModel(e){let t=e.nodeScope.componentOwner;for(;void 0!==t&&void 0===t._forEachModel&&t.parentNodeScope;)t=t.parentNodeScope.componentOwner;return void 0!==t?t._forEachModel:void 0}const node$t={name:"JavaScriptFunction",displayNodeName:"Function",docs:"https://docs.noodl.net/nodes/javascript/function",category:"CustomCode",color:"javascript",nodeDoubleClickAction:{focusPort:"Script"},searchTags:["javascript"],exportDynamicPorts:!0,initialize:function(){this._internal={},this._internal.inputValues={},this._internal.outputValues={},this._internal.inputTypes={},this._internal.outputTypes={},this._internal.outputValuesProxy=new Proxy(this._internal.outputValues,{set:(e,t,n)=>(this._deleted||n!==this._internal.outputValues[t]&&(this.registerOutputIfNeeded("out-"+t),this._internal.outputValues[t]=n,this.flagOutputDirty("out-"+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",set(e){}},scriptOutputs:{type:{name:"proplist",allowEditOnly:!0},group:"Script Outputs",set(e){}},functionScript:{displayName:"Script",plug:"input",type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},group:"General",set(e){void 0!==e?(this._internal.func=this.parseScript(e),this.isInputConnected("run")||this.scheduleRun()):this._internal.func=void 0}},run:{type:"signal",displayName:"Run",group:"Actions",valueChangedToTrue:function(){this.scheduleRun()}}},outputs:{},methods:{scheduleRun(){this.runScheduled||(this.runScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.runScheduled=!1,this._deleted||this.runScript()})))},async runScript(){const e=this._internal.func;if(void 0===e)return;const t=this._internal.inputValues,n=this._internal.outputValuesProxy;for(const e in this.model.outputPorts)if(this._isSignalType(e)){const t=()=>{this.hasOutput(e)&&this.sendSignalOnOutput(e)};this._internal.outputValues[e.substring(4)]=t,this._internal.outputValues[e.substring(4)].send=t}try{await e.apply(this._internal._this,[t,n,JavascriptNodeParser.createNoodlAPI(this.nodeScope.modelScope),JavascriptNodeParser.getComponentScopeForNode(this)])}catch(e){logJavaScriptNodeError(e),this.context.editorConnection&&this.context.isWarningTypeEnabled("javascriptExecution")&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"js-function-run-waring",{showGlobally:!0,message:e.message,stack:e.stack})}},setScriptInputValue(e,t){this._internal.inputValues[e]=t,this.isInputConnected("run")||this.scheduleRun()},getScriptOutputValue(e){if(!this._isSignalType(e))return this._internal.outputValues[e]},setScriptInputType(e,t){this._internal.inputTypes[e]=t},setScriptOutputType(e,t){this._internal.outputTypes[e]=t},parseScript(e){let t;try{t=new(0,Object.getPrototypeOf((async function(){})).constructor)("Inputs","Outputs","Noodl","Component",JavascriptNodeParser.getCodePrefix()+e)}catch(e){console.log("Error while parsing action script: "+e)}return t},_isSignalType(e){return this.model.outputPorts[e]&&"signal"===this.model.outputPorts[e].type},registerInputIfNeeded(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)}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(e){if(!this.hasOutput(e))return e.startsWith("out-")?this.registerOutput(e,{getter:this.getScriptOutputValue.bind(this,e.substring(4))}):void 0}}};function _parseScriptForErrorsAndPorts(e,t,n,o,i){if(o.editorConnection.clearWarning(n.component.name,n.id,"js-function-run-waring"),void 0!==e){try{new(0,Object.getPrototypeOf((async function(){})).constructor)("Inputs","Outputs","Noodl","Component",e),o.editorConnection.clearWarning(n.component.name,n.id,"js-function-parse-waring")}catch(e){o.editorConnection.sendWarning(n.component.name,n.id,"js-function-parse-waring",{showGlobally:!0,message:e.message})}JavascriptNodeParser.parseAndAddPortsFromScript(e,i,{inputPrefix:"in-",outputPrefix:"out-"})}else o.editorConnection.clearWarning(n.component.name,n.id,"js-function-parse-waring")}const inputTypeEnums=[{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"}];function setup$8(e,t){function n(t){function n(){var n;const o=[],i=inputTypeEnums.concat([{value:"signal",label:"Signal"}]);void 0!==t.parameters.scriptOutputs&&t.parameters.scriptOutputs.length>0&&t.parameters.scriptOutputs.forEach((e=>{o.push({name:"outtype-"+e.label,displayName:"Type",editorName:e.label+" | Type",plug:"input",type:{name:"enum",enums:i,allowEditOnly:!0},default:"string",parent:"scriptOutputs",parentItemId:e.id}),o.push({name:"out-"+e.label,displayName:e.label,plug:"output",type:t.parameters["outtype-"+e.label]||"*",group:"Outputs"})})),void 0!==t.parameters.scriptInputs&&t.parameters.scriptInputs.length>0&&t.parameters.scriptInputs.forEach((e=>{o.push({name:"intype-"+e.label,displayName:"Type",editorName:e.label+" | Type",plug:"input",type:{name:"enum",enums:inputTypeEnums,allowEditOnly:!0},default:"string",parent:"scriptInputs",parentItemId:e.id}),o.push({name:"in-"+e.label,displayName:e.label,plug:"input",type:t.parameters["intype-"+e.label]||"string",group:"Inputs"})})),_parseScriptForErrorsAndPorts(t.parameters.functionScript,"Script ",t,e,o),o.forEach((e=>{"signal"===e.type&&"output"===e.plug&&(t.outputPorts[e.name]=e)})),null===(n=e.editorConnection)||void 0===n||n.sendDynamicPorts(t.id,o)}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)}))}var simplejavascript=Object.freeze({__proto__:null,node:node$t,setup:setup$8});Object.prototype.hasOwnProperty.call(Array.prototype,"items")||Object.defineProperty(Array.prototype,"items",{enumerable:!1,get(){return this},set(e){this.set(e)}}),Object.defineProperty(Array.prototype,"each",{enumerable:!1,writable:!1,value:Array.prototype.forEach}),Object.prototype.hasOwnProperty.call(Array.prototype,"size")||Object.defineProperty(Array.prototype,"size",{enumerable:!1,writable:!1,value:function(){return this.length}}),Object.prototype.hasOwnProperty.call(Array.prototype,"get")||Object.defineProperty(Array.prototype,"get",{enumerable:!1,writable:!1,value:function(e){return this[e]}}),Object.prototype.hasOwnProperty.call(Array.prototype,"getId")||Object.defineProperty(Array.prototype,"getId",{enumerable:!1,writable:!1,value:function(){return this._id}}),Object.prototype.hasOwnProperty.call(Array.prototype,"id")||Object.defineProperty(Array.prototype,"id",{enumerable:!1,get(){return this.getId()}}),Object.prototype.hasOwnProperty.call(Array.prototype,"set")||Object.defineProperty(Array.prototype,"set",{enumerable:!1,writable:!1,value:function(e){let t,n;if(e===this)return;function o(e){const t={},n=e.length;for(let o=0;o<n;o++){const n=e[o];t[n.getId()]=n}return t}const i=[];for(t=(e=e||[]).length,n=0;n<t;n++){const t=e[n];Model.instanceOf(t)?i.push(t):i.push(Model.create(t))}const s=this.items,r=o(s),a=o(i);for(t=s.length,n=0;n<t;n++)a.hasOwnProperty(s[n].getId())||(this.removeAtIndex(n),n--,t--);for(n=0;n<Math.min(s.length,i.length);n++)s[n]!==i[n]&&(r.hasOwnProperty(i[n].getId())&&this.remove(i[n]),this.addAtIndex(i[n],n));for(n=s.length;n<i.length;n++)this.add(i[n])}}),Object.prototype.hasOwnProperty.call(Array.prototype,"notify")||Object.defineProperty(Array.prototype,"notify",{enumerable:!1,writable:!1,value:async function(e,t){if(!this._listeners)return;if(!this._listeners[e])return;const n=this._listeners[e].slice();for(let e=0;e<n.length;e++)await n[e](t)}}),Object.prototype.hasOwnProperty.call(Array.prototype,"contains")||Object.defineProperty(Array.prototype,"contains",{enumerable:!1,writable:!1,value:function(e){return-1!==this.indexOf(e)}}),Object.prototype.hasOwnProperty.call(Array.prototype,"add")||Object.defineProperty(Array.prototype,"add",{enumerable:!1,writable:!1,value:async function(e){this.contains(e)||(this.items.push(e),await this.notify("add",{item:e,index:this.items.length-1}),await this.notify("change"),e.notify("add",{collection:this}))}}),Object.prototype.hasOwnProperty.call(Array.prototype,"remove")||Object.defineProperty(Array.prototype,"remove",{enumerable:!1,writable:!1,value:function(e){const t=this.items.indexOf(e);-1!==t&&this.removeAtIndex(t)}}),Object.prototype.hasOwnProperty.call(Array.prototype,"addAtIndex")||Object.defineProperty(Array.prototype,"addAtIndex",{enumerable:!1,writable:!1,value:async function(e,t){this.contains(e)||(this.items.splice(t,0,e),await this.notify("add",{item:e,index:t}),await this.notify("change"),e.notify("add",{collection:this,index:t}))}}),Object.prototype.hasOwnProperty.call(Array.prototype,"removeAtIndex")||Object.defineProperty(Array.prototype,"removeAtIndex",{enumerable:!1,writable:!1,value:async function(e){const t=this.items[e];this.items.splice(e,1),await this.notify("remove",{item:t,index:e}),await this.notify("change"),await t.notify("remove",{collection:this})}}),Object.prototype.hasOwnProperty.call(Array.prototype,"on")||Object.defineProperty(Array.prototype,"on",{enumerable:!1,writable:!1,value:function(e,t){this._listeners||Object.defineProperty(this,"_listeners",{enumerable:!1,writable:!1,value:{}}),this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}}),Object.prototype.hasOwnProperty.call(Array.prototype,"off")||Object.defineProperty(Array.prototype,"off",{enumerable:!1,writable:!1,value:function(e,t){if(!this._listeners)return;if(!this._listeners[e])return;const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}});class Collection extends Array{static create(e){const t=Model.guid();return Collection._collections[t]=new Collection,Object.defineProperty(Collection._collections[t],"_id",{enumerable:!1,writable:!1,value:t}),e&&Collection._collections[t].set(e),Collection._collections[t]}static get(e){return void 0===e&&(e=Model.guid()),Collection._collections[e]||(Collection._collections[e]=new Collection,Object.defineProperty(Collection._collections[e],"_id",{enumerable:!1,writable:!1,value:e})),Collection._collections[e]}static instanceOf(e){return e instanceof Collection}static exists(e){return void 0!==Collection._collections[e]}}Collection._collections={};class CloudFile{constructor({name:e,url:t}){this.name=e,this.url=t}getUrl(){return this.url}getName(){return this.name}toString(){return this.url}}const _protectedFields={_common:["_createdAt","_updatedAt","objectId"],_User:["_email_verify_token"]};function _removeProtectedFields(e,t){const n=Object.assign({},e);return _protectedFields._common.forEach((e=>delete n[e])),t&&_protectedFields[t]&&_protectedFields[t].forEach((e=>delete n[e])),n}class CloudStore{static get instance(){return void 0===CloudStore._instance&&(CloudStore._instance=new CloudStore),CloudStore._instance}static get collections(){return void 0===CloudStore._collections&&(CloudStore._collections={},(NoodlRuntime$1.instance.getMetaData("dbCollections")||[]).forEach((e=>{CloudStore._collections&&(CloudStore._collections[e.name]=e)})),(NoodlRuntime$1.instance.getMetaData("systemCollections")||[]).forEach((e=>{CloudStore._collections&&(CloudStore._collections[e.name]=e)}))),CloudStore._collections}constructor(e){this._initCloudServices(),this.events=new eventemitter3__WEBPACK_IMPORTED_MODULE_0__.b,this.modelScope=e||Model}_fromJSON(e,t){return CloudStore._fromJSON(e,t,this.modelScope)}_deserializeJSON(e,t){return CloudStore._deserializeJSON(e,t,this.modelScope)}_serializeObject(e,t){return CloudStore._serializeObject(e,t,this.modelScope)}_initCloudServices(){CloudStore._collections=void 0;const e=NoodlRuntime$1.instance.getMetaData("cloudservices");e&&(this.appId=e.appId,this.endpoint=e.endpoint);const t=NoodlRuntime$1.instance.getMetaData("dbVersionMajor");this.dbVersionMajor=t}on(e,t,n){this.events.on.apply(this.events,[e,t,n])}off(e,t,n,o){this.events.off.apply(this.events,[e,t,n,o])}_makeRequest(e,t){if(!this.appId)throw new Error("App ID is not set");if("undefined"==typeof _noodl_cloud_runtime_version){const n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){let e;try{e=JSON.parse(n.response||n.responseText)}catch(e){}200===n.status||201===n.status?t.success(e):t.error(e||{error:n.responseText,status:n.status})}},n.open(t.method||"GET",this.endpoint+e,!0),n.setRequestHeader("X-Parse-Application-Id",this.appId),"undefined"!=typeof _noodl_cloudservices&&n.setRequestHeader("X-Parse-Master-Key",_noodl_cloudservices.masterKey);const o=localStorage["Parse/"+this.appId+"/currentUser"];if(void 0!==o)try{const e=JSON.parse(o);n.setRequestHeader("X-Parse-Session-Token",e.sessionToken)}catch(e){}t.onUploadProgress&&(n.upload.onprogress=e=>{t.onUploadProgress&&t.onUploadProgress(e)}),t.content instanceof File?n.send(t.content):(n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify(t.content)))}else{const n="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.endpoint:this.endpoint,o="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.appId:this.appId,i="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.masterKey:void 0;fetch(n+e,{method:t.method||"GET",headers:{"X-Parse-Application-Id":o,"X-Parse-Master-Key":i,"Content-Type":"application/json"},body:JSON.stringify(t.content)}).then((e=>{200===e.status||201===e.status?"DELETE"===t.method?t.success(void 0):e.json().then((e=>t.success(e))).catch((e=>t.error({error:"CloudStore: Failed to get json result."}))):"DELETE"===t.method?t.error({error:"Failed to delete."}):e.json().then((e=>t.error(e))).catch((e=>t.error({error:"Failed to fetch."})))})).catch((e=>{t.error({error:e.message})}))}}query(e){this._makeRequest("/classes/"+e.collection,{method:"POST",content:{_method:"GET",where:e.where,limit:e.limit,skip:e.skip,include:Array.isArray(e.include)?e.include.join(","):e.include,keys:Array.isArray(e.select)?e.select.join(","):e.select,order:Array.isArray(e.sort)?e.sort.join(","):e.sort,count:e.count},success:function(t){e.success(t.results,t.count)},error:function(){e.error()}})}aggregate(e){const t=[];if(!e.group)return void e.error("You need to provide group option.");e.limit&&t.push("limit="+e.limit),e.skip&&t.push("skip="+e.skip);const n={};Object.keys(e.group).forEach((t=>{const o={},i=e.group[t];void 0!==i.avg?o.$avg="$"+i.avg:void 0!==i.sum?o.$sum="$"+i.sum:void 0!==i.max?o.$max="$"+i.max:void 0!==i.min?o.$min="$"+i.min:void 0!==i.distinct&&(o.$addToSet="$"+i.distinct),n[t]=o})),this.dbVersionMajor&&this.dbVersionMajor>4?(n._id=null,e.where&&t.push("$match="+encodeURIComponent(JSON.stringify(e.where))),t.push("$group="+JSON.stringify(n))):(n.objectId=null,e.where&&t.push("match="+encodeURIComponent(JSON.stringify(e.where))),t.push("group="+JSON.stringify(n))),this._makeRequest("/aggregate/"+e.collection+(t.length>0?"?"+t.join("&"):""),{success:function(t){const n={};t.results&&1===t.results.length?(Object.keys(e.group).forEach((e=>{n[e]=t.results[0][e]})),e.success(n)):e.success({})},error:function(){e.error()}})}count(e){const t=[];e.where&&t.push("where="+encodeURIComponent(JSON.stringify(e.where))),t.push("limit=0"),t.push("count=1"),this._makeRequest("/classes/"+e.collection+(t.length>0?"?"+t.join("&"):""),{success:function(t){e.success(t.count)},error:function(){e.error()}})}distinct(e){const t=[];e.where&&t.push("where="+encodeURIComponent(JSON.stringify(e.where))),t.push("distinct="+e.property),this._makeRequest("/aggregate/"+e.collection+(t.length>0?"?"+t.join("&"):""),{success:function(t){e.success(t.results)},error:function(){e.error()}})}fetch(e){const t=[];e.include&&t.push("include="+(Array.isArray(e.include)?e.include.join(","):e.include)),e.keys&&t.push("keys="+(Array.isArray(e.keys)?e.keys.join(","):e.keys)),e.excludeKeys&&t.push("excludeKeys="+(Array.isArray(e.excludeKeys)?e.excludeKeys.join(","):e.excludeKeys)),this._makeRequest("/classes/"+e.collection+"/"+e.objectId+(t.length>0?"?"+t.join("&"):""),{method:"GET",success:t=>{e.success(t),this.events.emit("fetch",{type:"fetch",objectId:e.objectId,object:t,collection:e.collection})},error:function(t){e.error(t.error)}})}create(e){this._makeRequest("/classes/"+e.collection,{method:"POST",content:Object.assign(_removeProtectedFields(CloudStore._serializeObject(e.data,e.collection),e.collection),{ACL:e.acl}),success:t=>{const n=Object.assign({},e.data,t);e.success(n),this.events.emit("create",{type:"create",objectId:e.objectId,object:n,collection:e.collection})},error:function(t){e.error(t.error)}})}increment(e){const t={};for(let n in e.properties)t[n]={__op:"Increment",amount:e.properties[n]};this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"PUT",content:t,success:t=>{e.success(t)},error:function(t){e.error(t.error)}})}save(e){const t=Object.assign({},e.data);delete t.createdAt,delete t.updatedAt,this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"PUT",content:Object.assign(_removeProtectedFields(CloudStore._serializeObject(t,e.collection),e.collection),{ACL:e.acl}),success:t=>{e.success(t),this.events.emit("save",{type:"save",objectId:e.objectId,object:Object.assign({},e.data,t),collection:e.collection})},error:function(t){e.error(t.error)}})}delete(e){this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"DELETE",success:()=>{e.success(),this.events.emit("delete",{type:"delete",objectId:e.objectId,collection:e.collection})},error:function(t){e.error(t.error)}})}addRelation(e){if(!e.key)throw new Error("Key is required");const t={};t[e.key]={__op:"AddRelation",objects:[{__type:"Pointer",objectId:e.targetObjectId,className:e.targetClass}]},this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"PUT",content:t,success:function(t){e.success(t)},error:function(t){e.error(t.error)}})}removeRelation(e){if(!e.key)throw new Error("Key is required");const t={};t[e.key]={__op:"RemoveRelation",objects:[{__type:"Pointer",objectId:e.targetObjectId,className:e.targetClass}]},this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"PUT",content:t,success:function(t){e.success(t)},error:function(t){e.error(t.error)}})}uploadFile(e){if(!e.file)throw new Error("File is required");this._makeRequest("/files/"+e.file.name,{method:"POST",content:e.file,contentType:e.file.type,success:t=>e.success(Object.assign({},e.data,t)),error:t=>e.error(t),onUploadProgress:e.onUploadProgress})}deleteFile(e){if(!e.file)throw new Error("File is required");this._makeRequest("/files/"+e.file.name,{method:"DELETE",success:t=>e.success(Object.assign({},e.data,t)),error:t=>e.error(t)})}static forScope(e){return void 0===e?CloudStore.instance:(e._cloudStore||(e._cloudStore=new CloudStore(e)),e._cloudStore)}static invalidateCollections(){_collections=void 0}static _fromJSON(e,t,n){const o=(n||Model).get(e.objectId);let i;o._class=t,void 0!==t&&void 0!==CloudStore._collections[t]&&(i=CloudStore._collections[t].schema);for(const t in e){if("objectId"===t||"ACL"===t)continue;const s=i&&i.properties&&i.properties[t]?i.properties[t].type:void 0;o.set(t,CloudStore._deserializeJSON(e[t],s,n))}return o}static _serializeObject(e,t,n){let o;CloudStore._collections[t]&&(o=CloudStore._collections[t].schema);for(const t in e){const i=o&&o.properties&&o.properties[t]?o.properties[t].type:void 0;if(void 0===e[t]||null===e[t]);else if("Pointer"===i&&"string"==typeof e[t])e[t]={__type:"Pointer",className:o.properties[t].targetClass,objectId:e[t]};else if("Pointer"===i&&"object"==typeof e[t]&&(n||Model).instanceOf(e[t]))e[t]={__type:"Pointer",className:o.properties[t].targetClass,objectId:e[t].getId()};else if("Date"===i&&("string"==typeof e[t]||e[t]instanceof Date))e[t]={__type:"Date",iso:e[t]instanceof Date?e[t].toISOString():e[t]};else if("File"===i&&e[t]instanceof CloudFile){const n=e[t];e[t]={__type:"File",url:n.getUrl(),name:n.getName()}}else"Array"===i&&"string"==typeof e[t]&&Collection.exists(e[t])?e[t]=_toJSON(Collection.get(e[t])):"Object"===i&&"string"==typeof e[t]&&(n||Model).exists(e[t])?e[t]=_toJSON((n||Model).get(e[t])):"GeoPoint"===i&&"object"==typeof e[t]?e[t]={__type:"GeoPoint",latitude:Number(e[t].latitude),longitude:Number(e[t].longitude)}:e[t]=_toJSON(e[t])}return e}static _deserializeJSON(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 CloudFile(e);if("GeoPoint"===t&&"GeoPoint"===e.__type)return{latitude:e.latitude,longitude:e.longitude};if(_isArrayOfObjects(e)){const t=[];for(let o=0;o<e.length;o++)t.push(CloudStore._deserializeJSON(e[o],void 0,n));const o=Collection.get();return o.set(t),o}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,CloudStore._fromJSON(t,e.className,n)}if("object"==typeof e&&null!==e){const t=(n||Model).get();for(const o in e)t.set(o,CloudStore._deserializeJSON(e[o],void 0,n));return t}return e}}}}function _isArrayOfObjects(e){if(!Array.isArray(e))return!1;for(let t=0;t<e.length;t++)if("object"!=typeof e[t]||null===e[t])return!1;return!0}function _toJSON(e){if(e instanceof Model){const t={};for(const n in e.data)t[n]=_toJSON(e.data[n]);return t}if(e instanceof Collection){const t=[];return e.items.forEach((e=>{t.push(_toJSON(e))})),t}return e}function convertVisualFilter(e,t){const n=t.queryParameters;if(void 0!==e.combinator&&void 0!==e.rules){if(0===e.rules.length)return;if(1===e.rules.length)return convertVisualFilter(e.rules[0],t);{const n={},o="$"+e.combinator;return n[o]=[],e.rules.forEach((e=>{const i=convertVisualFilter(e,t);void 0!==i&&n[o].push(i)})),n}}if("related to"===e.operator){const t=void 0!==e.input?n[e.input]:void 0;if(void 0===t)return;return{$relatedTo:{object:{__type:"Pointer",objectId:t,className:e.relatedTo},key:e.relationProperty}}}{const o={};let i,s,r=void 0!==e.input?n[e.input]:e.value;if("exist"===e.operator)return o[e.property]={$exists:!0},o;if("not exist"===e.operator)return o[e.property]={$exists:!1},o;if(void 0===r)return;return CloudStore._collections[t.collectionName]&&(s=CloudStore._collections[t.collectionName].schema),"Date"===(s&&s.properties&&s.properties[e.property]?s.properties[e.property].type:void 0)&&(r instanceof Date||(r=new Date(r.toString())),r={__type:"Date",iso:r.toISOString()}),"greater than"===e.operator?i={$gt:r}:"greater than or equal to"===e.operator?i={$gte:r}:"less than"===e.operator?i={$lt:r}:"less than or equal to"===e.operator?i={$lte:r}:"equal to"===e.operator?i={$eq:r}:"not equal to"===e.operator?i={$ne:r}:"points to"===e.operator?i={$eq:{__type:"Pointer",objectId:r,className:s&&s.properties&&s.properties[e.property]?s.properties[e.property].targetClass:void 0}}:"contain"===e.operator&&(i={$regex:r,$options:"i"}),o[e.property]=i,o}}function matchesQuery(e,t){let n=!0;return void 0===t||(void 0!==t.$and?t.$and.forEach((t=>{n=n&&matchesQuery(e,t)})):void 0!==t.$or?(n=!1,t.$or.forEach((t=>{n=n||matchesQuery(e,t)}))):Object.keys(t).forEach((o=>{if("objectId"===o)void 0!==t[o].$eq?n=n&&e.getId()===t[o].$eq:void 0!==t[o].$in&&(n=n&&-1!==t[o].$in.indexOf(e.getId()));else if("$relatedTo"===o)n=!1;else{const i=e.get(o);void 0!==t[o].$eq&&"Pointer"===t[o].$eq.__type?n=n&&i===t[o].$eq.objectId:void 0!==t[o].$eq?n=n&&i==t[o].$eq:void 0!==t[o].$ne?n=n&&i!=t[o].$ne:void 0!==t[o].$lt?n=n&&i<t[o].$lt:void 0!==t[o].$lte?n=n&&i<=t[o].$lt:void 0!==t[o].$gt?n=n&&i>t[o].$gt:void 0!==t[o].$gte?n=n&&i>=t[o].$gte:void 0!==t[o].$exists?n=n&&void 0!==i:void 0!==t[o].$in?n=n&&-1!==t[o].$in.indexOf(i):void 0!==t[o].$nin?n=n&&-1===t[o].$in.indexOf(i):void 0!==t[o].$regex&&(n=n&&new RegExp(t[o].$regex,t[o].$options).test(i))}})),n)}function compareObjects(e,t,n){for(let o=0;o<e.length;o++){let i=e[o];if("-"===i[0]){let e=i.substring(1);if(t.get(e)>n.get(e))return-1;if(t.get(e)<n.get(e))return 1}else{if(t.get(i)>n.get(i))return 1;if(t.get(i)<n.get(i))return-1}}return 0}function convertVisualSorting(e){return e.map((e=>("descending"===e.order?"-":"")+e.property))}function _value(e){return e instanceof Date&&"function"==typeof e.toISOString?{__type:"Date",iso:e.toISOString()}:e}function convertFilterOp(e,t){var n,o,i,s,r,a;const l=Object.keys(e);if(0===l.length)return{};if(1!==l.length)return null===(n=null==t?void 0:t.error)||void 0===n?void 0:n.call(t,"Filter must only have one key found "+l.join(","));const d={},u=l[0];if(void 0!==e.and&&Array.isArray(e.and))d.$and=e.and.map((e=>convertFilterOp(e,t)));else if(void 0!==e.or&&Array.isArray(e.or))d.$or=e.or.map((e=>convertFilterOp(e,t)));else if(void 0!==e.idEqualTo)d.objectId={$eq:e.idEqualTo};else if(void 0!==e.idContainedIn)d.objectId={$in:e.idContainedIn};else if(void 0!==e.relatedTo){const n=e.relatedTo.id;if(void 0===n)return null===(o=null==t?void 0:t.error)||void 0===o?void 0:o.call(t,"Must provide id in relatedTo filter");const a=e.relatedTo.key;if(void 0===a)return null===(i=null==t?void 0:t.error)||void 0===i?void 0:i.call(t,"Must provide key in relatedTo filter");const l=e.relatedTo.className||(null===(s=(t.modelScope||Model).get(n))||void 0===s?void 0:s._class);if(void 0===l)return null===(r=null==t?void 0:t.error)||void 0===r?void 0:r.call(t,"Must preload the Pointer or include className");d.$relatedTo={object:{__type:"Pointer",objectId:n,className:l},key:a}}else if("object"==typeof e[u]){const n=e[u];if(void 0!==n.equalTo)d[u]={$eq:_value(n.equalTo)};else if(void 0!==n.notEqualTo)d[u]={$ne:_value(n.notEqualTo)};else if(void 0!==n.lessThan)d[u]={$lt:_value(n.lessThan)};else if(void 0!==n.greaterThan)d[u]={$gt:_value(n.greaterThan)};else if(void 0!==n.lessThanOrEqualTo)d[u]={$lte:_value(n.lessThanOrEqualTo)};else if(void 0!==n.greaterThanOrEqualTo)d[u]={$gte:_value(n.greaterThanOrEqualTo)};else if(void 0!==n.exists)d[u]={$exists:n.exists};else if(void 0!==n.containedIn)d[u]={$in:n.containedIn};else if(void 0!==n.notContainedIn)d[u]={$nin:n.notContainedIn};else if(void 0!==n.pointsTo){let e=null;CloudStore._collections[t.collectionName]&&(e=CloudStore._collections[t.collectionName].schema);const o=e&&e.properties&&e.properties[u]?e.properties[u].targetClass:void 0;"Relation"===(e&&e.properties&&e.properties[u]?e.properties[u].type:void 0)?d[u]={__type:"Pointer",objectId:n.pointsTo,className:o}:Array.isArray(n.pointsTo)?d[u]={$in:n.pointsTo.map((e=>({__type:"Pointer",objectId:e,className:o})))}:d[u]={$eq:{__type:"Pointer",objectId:n.pointsTo,className:o}}}else if(void 0!==n.matchesRegex)d[u]={$regex:n.matchesRegex,$options:n.options};else if(void 0!==n.text&&void 0!==n.text.search){const e=n.text.search;d[u]="string"==typeof e?{$text:{$search:{$term:e,$caseSensitive:!1}}}:{$text:{$search:{$term:e.term,$language:e.language,$caseSensitive:e.caseSensitive,$diacriticSensitive:e.diacriticSensitive}}}}else if(void 0!==n.nearSphere){const e=n.nearSphere;d[u]={$nearSphere:{__type:"GeoPoint",latitude:e.latitude,longitude:e.longitude},$maxDistanceInMiles:e.maxDistanceInMiles,$maxDistanceInKilometers:e.maxDistanceInKilometers,$maxDistanceInRadians:e.maxDistanceInRadians}}else if(void 0!==n.withinBox){const e=n.withinBox;d[u]={$within:{$box:e.map((e=>({__type:"GeoPoint",latitude:e.latitude,longitude:e.longitude})))}}}else if(void 0!==n.withinPolygon){const e=n.withinPolygon;d[u]={$geoWithin:{$polygon:e.map((e=>({__type:"GeoPoint",latitude:e.latitude,longitude:e.longitude})))}}}}else null===(a=null==t?void 0:t.error)||void 0===a||a.call(t,"Unrecognized filter keys "+l.join(","));return d}const node$s={name:"DbCollection2",docs:"https://docs.noodl.net/nodes/data/cloud-data/query-records",displayName:"Query Records",category:"Cloud Services",usePortAsLabel:"collectionName",color:"data",initialize(){const e=this;this._internal.queryParameters={};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){var n,o;if(!0!==e.isInputConnected("storageFetch")&&void 0!==e._internal.collection&&t.collection===e._internal.name)if("create"===t.type){const o=Model.get(t.object.objectId);void 0!==o&&matchesQuery(o,null===(n=e._internal.currentQuery)||void 0===n?void 0:n.where)&&s(o)}else if("save"===t.type){const n=Model.get(t.objectId);if(void 0!==n){const t=matchesQuery(n,null===(o=e._internal.currentQuery)||void 0===o?void 0:o.where);!t&&e._internal.collection.contains(n)?(e._internal.collection.remove(n),e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty")):t&&!e._internal.collection.contains(n)&&s(n)}}else if("delete"===t.type){const n=Model.get(t.objectId);void 0!==n&&(e._internal.collection.remove(n),e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty"))}function s(t){var n,o;if(void 0!==(null===(n=e._internal.currentQuery)||void 0===n?void 0:n.sort)){for(let n=0;n<e._internal.collection.size()&&!(compareObjects(e._internal.currentQuery.sort,e._internal.collection.get(n),t)>0);n++);e._internal.collection.addAtIndex(t,i)}else e._internal.collection.add(t);let s=e._internal.collection.size();void 0!==(null===(o=e._internal.currentQuery)||void 0===o?void 0:o.limit)&&s>e._internal.currentQuery.limit&&e._internal.collection.remove(e._internal.collection.get(void 0!==e._internal.currentQuery.sort&&"-"===e._internal.currentQuery.sort[0][0]?s-1:0)),e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty")}};const n=CloudStore.forScope(this.nodeScope.modelScope);n.on("save",this._internal.cloudStoreEvents),n.on("create",this._internal.cloudStoreEvents),n.on("delete",this._internal.cloudStoreEvents),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",getter:function(){return this._internal.collection}},firstItemId:{type:"string",displayName:"First Record Id",group:"General",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",getter:function(){return!this._internal.collection||0===this._internal.collection.size()}},count:{type:"number",displayName:"Count",group:"General",getter:function(){return this._internal.collection?this._internal.collection.size():0}},fetched:{group:"Events",type:"signal",displayName:"Success"},failure:{group:"Events",type:"signal",displayName:"Failure"},error:{type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}},prototypeExtensions:{setCollectionName:function(e){this._internal.name=e,!1===this.isInputConnected("storageFetch")&&this.scheduleFetch()},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)},_onNodeDeleted:function(){Node.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection();const e=CloudStore.forScope(this.nodeScope.modelScope);e.off("insert",this._internal.cloudStoreEvents),e.off("delete",this._internal.cloudStoreEvents),e.off("save",this._internal.cloudStoreEvents)},setError:function(e){this._internal.err=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure")},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=Collection.get(),t=this.getStorageFilter(),n=this.getStorageLimit(),o=this.getStorageSkip(),i=this.getStorageFetchTotalCount();this._internal.currentQuery={where:t.where,sort:t.sort,limit:n,skip:o},CloudStore.forScope(this.nodeScope.modelScope).query({collection:this._internal.name,where:t.where,sort:t.sort,limit:n,skip:o,count:i,success:(t,n)=>{void 0!==t&&e.set(t.map((e=>CloudStore._fromJSON(e,this._internal.name,this.nodeScope.modelScope)))),void 0!==n&&(this._internal.storageSettings.storageTotalCount=n,this.hasOutput("storageTotalCount")&&this.flagOutputDirty("storageTotalCount")),this.setCollection(e),this.sendSignalOnOutput("fetched")},error:t=>{this.setCollection(e),this.setError(t||"Failed to fetch.")}})},getStorageFilter:function(){var e;const t=this._internal.storageSettings;if(void 0===t.storageFilterType||"simple"===t.storageFilterType)return{where:void 0!==this._internal.visualFilter?convertVisualFilter(this._internal.visualFilter,{queryParameters:this._internal.queryParameters,collectionName:this._internal.name}):void 0,sort:void 0!==this._internal.visualSorting?convertVisualSorting(this._internal.visualSorting):void 0};if("json"===t.storageFilterType){if(!this._internal.filterFunc)try{let e=t.storageJSONFilter;e=e.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""),this._internal.filterVariables=e.match(/\$[A-Za-z0-9]+/g)||[];const n=["filter","where","sort","Inputs"].concat(this._internal.filterVariables).concat([e]);this._internal.filterFunc=Function.apply(null,n)}catch(e){this._internal.filterFunc=void 0,console.log("Error while parsing filter script: "+e)}if(!this._internal.filterFunc)return;let n={},o=[];const i=this,s=function(e){n=convertFilterOp(e,{collectionName:i._internal.name,error:function(e){i.context.editorConnection.sendWarning(i.nodeScope.componentOwner.name,i.id,"query-collection-filter",{message:e})}})},r=function(e){o=e},a={};for(const e in t)e.startsWith("storageFilterValue-")&&(a[e.substring(19)]=t[e]);const l=[s,s,r,a];null===(e=this._internal.filterVariables)||void 0===e||e.forEach((e=>{l.push(t["storageFilterValue-"+e.substring(1)])}));try{this._internal.filterFunc.apply(this,l)}catch(e){console.log("Error while running filter script: "+e)}return{where: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(){return this._internal.storageSettings[e]}})},setVisualFilter:function(e){this._internal.visualFilter=e,!1===this.isInputConnected("storageFetch")&&this.scheduleFetch()},setVisualSorting:function(e){this._internal.visualSorting=e,!1===this.isInputConnected("storageFetch")&&this.scheduleFetch()},setQueryParameter:function(e,t){this._internal.queryParameters[e]=t,!1===this.isInputConnected("storageFetch")&&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))});const t={storageFetch:this.scheduleFetch.bind(this)};if(t[e])return this.registerInput(e,{set:createSetter({valueChangedToTrue:t[e]})});const n={collectionName:this.setCollectionName.bind(this),visualFilter:this.setVisualFilter.bind(this),visualSort:this.setVisualSorting.bind(this)};if(n[e])return this.registerInput(e,{set:n[e]});this.registerInput(e,{set(t){this._internal.storageSettings[e]=t,!1===this.isInputConnected("storageFetch")&&this.scheduleFetch()}})}}},_defaultJSONQuery="// Write your query script here, check out the reference documentation for examples\nwhere({ })\n";function updatePorts$6(e,t,n,o){const i=[],s=o.getMetaData("dbCollections"),r=o.getMetaData("systemCollections");if(i.push({name:"collectionName",type:{name:"enum",enums:[{label:"User",value:"_User"},{label:"Role",value:"_Role"}].concat(void 0!==s?s.map((e=>({value:e.name,label:e.name}))):[]),allowEditOnly:!0},displayName:"Class",plug:"input",group:"General"}),i.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"}),i.push({type:{name:"boolean"},plug:"input",group:"Limit",name:"storageEnableLimit",displayName:"Use limit"}),t.storageEnableLimit&&(i.push({type:{name:"number"},default:10,plug:"input",group:"Limit",name:"storageLimit",displayName:"Limit"}),i.push({type:{name:"number"},default:0,plug:"input",group:"Limit",name:"storageSkip",displayName:"Skip"})),i.push({type:{name:"signal"},plug:"input",group:"Actions",name:"storageFetch",displayName:"Do"}),i.push({type:{name:"boolean"},plug:"input",group:"Total Count",name:"storageEnableCount",displayName:"Fetch total count"}),t.storageEnableCount&&i.push({type:{name:"number"},plug:"output",group:"General",name:"storageTotalCount",displayName:"Total Count"}),void 0===t.storageFilterType||"simple"===t.storageFilterType){if(void 0!==t.collectionName){let e=s&&s.find((e=>e.name===t.collectionName));if(void 0===e&&r&&(e=r.find((e=>e.name===t.collectionName))),e&&e.schema&&e.schema.properties){const n=JSON.parse(JSON.stringify(e.schema));null==s||s.forEach(_findRelations.bind(null,t,n)),null==r||r.forEach(_findRelations.bind(null,t,n)),i.push({name:"visualFilter",plug:"input",type:{name:"query-filter",schema:n,allowEditOnly:!0},displayName:"Filter",group:"Filter"}),i.push({name:"visualSort",plug:"input",type:{name:"query-sorting",schema:n,allowEditOnly:!0},displayName:"Sort",group:"Sorting"})}if(void 0!==t.visualFilter){const e={};_collectInputs$1(e,t.visualFilter),Object.keys(e).forEach((e=>{i.push({name:"qp-"+e,plug:"input",type:{name:"*"},displayName:e,group:"Query Parameters"})}))}}}else if("json"===t.storageFilterType){i.push({type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},plug:"input",group:"Filter",name:"storageJSONFilter",default:_defaultJSONQuery,displayName:"Filter"});let e=String(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=>{i.push({name:"storageFilterValue-"+e.substring(1),displayName:e.substring(1),group:"Filter Values",plug:"input",type:{name:"*",allowConnectionsOnly:!0}})}))}JavascriptNodeParser.parseAndAddPortsFromScript(e,i,{inputPrefix:"storageFilterValue-",inputGroup:"Filter Values",inputType:{name:"*",allowConnectionsOnly:!0},skipOutputs:!0})}}n.sendDynamicPorts(e,i)}function setup$7(e,t){function n(n){updatePorts$6(n.id,n.parameters,e.editorConnection,t),n.on("parameterUpdated",(function(o){(o.name.startsWith("storage")||"visualFilter"===o.name||"collectionName"===o.name)&&updatePorts$6(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.dbCollections",(function(){CloudStore.invalidateCollections(),updatePorts$6(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.systemCollections",(function(){CloudStore.invalidateCollections(),updatePorts$6(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.cloudservices",(function(){CloudStore.instance._initCloudServices()}))}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)}))}function _collectInputs$1(e,t){void 0!==t&&(void 0!==t.rules?t.rules.forEach((t=>_collectInputs$1(e,t))):void 0!==t.input&&(e[t.input]=!0))}function _findRelations(e,t,n){if(void 0!==n.schema&&void 0!==n.schema.properties)for(const o in n.schema.properties){const i=n.schema.properties[o];"Relation"===i.type&&i.targetClass===e.collectionName&&(void 0===t.relations&&(t.relations={}),void 0===t.relations[n.name]&&(t.relations[n.name]=[]),t.relations[n.name].push({property:o}))}}var dbcollectionnode2=Object.freeze({__proto__:null,node:node$s,setup:setup$7});const node$r={name:"DbModel2",docs:"https://docs.noodl.net/nodes/data/cloud-data/record",displayNodeName:"Record",shortDesc:"Database model",category:"Cloud Services",usePortAsLabel:"collectionName",color:"data",dynamicports:[{name:"conditionalports/extended",condition:"idSource = explicit OR idSource NOT SET",inputs:["modelId"]}],initialize:function(){const e=this._internal;e.inputValues={},e.relationModelIds={};const t=this;this._internal.onModelChangedCallback=function(e){t.isInputConnected("fetch")||(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",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}},fetched:{type:"signal",displayName:"Fetched",group:"Events"},changed:{type:"signal",displayName:"Changed",group:"Events"},failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",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",set(e){"foreach"===e&&this.scheduleAfterInputsHaveUpdated((()=>{let e=this.nodeScope.componentOwner;for(;void 0!==e&&void 0===e._forEachModel&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;this.setModel(void 0!==e?e._forEachModel:void 0)}))}},modelId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Id",group:"General",set(e){e instanceof Model?e=e.getId():"object"==typeof e&&(e=Model.create(e).getId()),this._internal.modelId=e,!1===this.isInputConnected("fetch")?this.setModelID(e):this.flagOutputDirty("id")}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleFetch()}}},methods:{setCollectionID(e){this._internal.collectionId=e},setModelID(e){const t=(this.nodeScope.modelScope||Model).get(e);this.setModel(t)},setModel(e){this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),this._internal.model=e,this.flagOutputDirty("id"),e.on("change",this._internal.onModelChangedCallback);for(const t in e.data)this.hasOutput("prop-"+t)&&this.flagOutputDirty("prop-"+t);this.sendSignalOnOutput("fetched")},_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},scheduleOnce(e,t){const n=this,o="hasScheduled"+e;this._internal[o]||(this._internal[o]=!0,this.scheduleAfterInputsHaveUpdated((function(){n._internal[o]=!1,t()})))},setError(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"storage-op-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"storage-op-warning")},scheduleFetch(){const e=this,t=this._internal;this.scheduleOnce("Fetch",(function(){if(void 0===t.modelId||""===t.modelId)return void e.setError("Missing Id.");const n=CloudStore.forScope(e.nodeScope.modelScope);n.fetch({collection:t.collectionId,objectId:t.modelId,success:function(o){const i=n._fromJSON(o,t.collectionId);t.model!==i&&(t.model&&t.model.off("change",t.onModelChangedCallback),t.model=i,i.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")},error:function(t){e.setError(t||"Failed to fetch.")}})}))},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:userOutputGetter$1.bind(this,e.substring(5))})},registerInputIfNeeded:function(e){if(this.hasInput(e))return;const t={};if(t[e])return this.registerInput(e,{set:createSetter({valueChangedToTrue:t[e]})});const n={collectionName:this.setCollectionID.bind(this)};if(n[e])return this.registerInput(e,{set:n[e]});e.startsWith("prop-")&&this.registerInput(e,{set:userInputSetter$1.bind(this,e.substring(5))})}}};function userOutputGetter$1(e){return this._internal.model?this._internal.model.get(e,{resolve:!0}):void 0}function userInputSetter$1(e,t){this._internal.inputValues[e]=t}function updatePorts$5(e,t,n,o){const i=[],s=o.getMetaData("dbCollections"),r=o.getMetaData("systemCollections");if(i.push({name:"collectionName",displayName:"Class",group:"General",type:{name:"enum",enums:[{label:"User",value:"_User"},{label:"Role",value:"_Role"}].concat(void 0!==s?s.map((e=>({value:e.name,label:e.name}))):[]),allowEditOnly:!0},plug:"input"}),t.collectionName&&s){let e=s.find((e=>e.name===t.collectionName));if(void 0===e&&r&&(e=r.find((e=>e.name===t.collectionName))),e&&e.schema&&e.schema.properties){const t=e.schema.properties;for(const e in t){const n=t[e];if(!i.find((t=>t.name===e))&&"Relation"!==n.type){const t={String:"string",Boolean:"boolean",Number:"number",Date:"date"};i.push({type:{name:t[n.type]?t[n.type]:"*"},plug:"output",group:"Properties",name:"prop-"+e,displayName:e}),i.push({type:"signal",plug:"output",group:"Changed Events",displayName:e+" Changed",name:"changed-"+e})}}}}n.sendDynamicPorts(e,i)}function setup$6(e,t){function n(n){updatePorts$5(n.id,n.parameters,e.editorConnection,t),n.on("parameterUpdated",(function(){updatePorts$5(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.dbCollections",(function(){CloudStore.invalidateCollections(),updatePorts$5(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.systemCollections",(function(){CloudStore.invalidateCollections(),updatePorts$5(n.id,n.parameters,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)}))}var dbmodelnode2=Object.freeze({__proto__:null,node:node$r,setup:setup$6});function _addBaseInfo$1(e,t){const n=void 0===t||t.includeInputProperties,o=void 0!==t&&t.includeRelations;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,{failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}}),Object.assign(e.node.methods,{scheduleOnce:function(e,t){const n=this,o="hasScheduled"+e;this._internal[o]||(this._internal[o]=!0,this.scheduleAfterInputsHaveUpdated((function(){n._internal[o]=!1,t()})))},checkWarningsBeforeCloudOp(){return this.clearWarnings(),!!this._internal.collectionId||(this.setError("No class name specified"),!1)},setError:function(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"storage-op-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"storage-op-warning")}}),Object.assign(e,{setup:function(t,i){function s(s){function r(){var r;const a=[],l=i.getMetaData("dbCollections"),d=i.getMetaData("systemCollections"),u=s.parameters;if(a.push({name:"collectionName",displayName:"Class",group:"General",type:{name:"enum",enums:[{label:"User",value:"_User"},{label:"Role",value:"_Role"}].concat(void 0!==l?l.map((e=>({value:e.name,label:e.name}))):[]),allowEditOnly:!0},plug:"input"}),o&&u.collectionName&&l){let e=l.find((e=>e.name===u.collectionName));if(void 0===e&&d&&(e=d.find((e=>e.name===u.collectionName))),e&&e.schema&&e.schema.properties){const t=e.schema.properties,n=Object.keys(t).filter((e=>"Relation"===t[e].type)).map((e=>({label:e,value:e})));a.push({name:"relationProperty",displayName:"Relation",group:"General",type:{name:"enum",enums:n,allowEditOnly:!0},plug:"input"})}}if(n&&u.collectionName&&l){const e={String:"string",Boolean:"boolean",Number:"number",Date:"date"};let t=l.find((e=>e.name===u.collectionName));if(void 0===t&&d&&(t=d.find((e=>e.name===u.collectionName))),t&&t.schema&&t.schema.properties){const n=t.schema.properties;for(const t in n){const o=n[t];a.find((e=>e.name===t))||a.push({type:{name:e[o.type]?e[o.type]:"*"},plug:"input",group:"Properties",name:"prop-"+t,displayName:t})}}}null===(r=e._additionalDynamicPorts)||void 0===r||r.call(e,s,a,i),t.editorConnection.sendDynamicPorts(s.id,a)}r(),s.on("parameterUpdated",(function(){r()})),i.on("metadataChanged.dbCollections",(function(){CloudStore.invalidateCollections(),r()})),i.on("metadataChanged.systemCollections",(function(){CloudStore.invalidateCollections(),r()}))}t.editorConnection&&t.editorConnection.isRunningLocally()&&i.on("editorImportComplete",(()=>{i.on("nodeAdded."+e.node.name,(function(e){s(e)}));for(const t of i.getNodesWithType(e.node.name))s(t)}))}})}function _addModelId$1(e,t){const n=Object.assign({},e.node.methods),o=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||{}}),o&&(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"]}]),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",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){"foreach"===e&&this.scheduleAfterInputsHaveUpdated((()=>{let e=this.nodeScope.componentOwner;for(;void 0!==e&&void 0===e._forEachModel&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;this.setModel(void 0!==e?e._forEachModel:void 0)}))}},modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",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",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}}}),Object.assign(e.node.methods,{setCollectionID:function(e){this._internal.collectionId=e,this.clearWarnings()},setModelID:function(e){const t=(this.nodeScope.modelScope||Model).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))}})}function _addInputProperties$1(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.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}})}function _addRelationProperty(e){const t=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.inputs,{targetId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Target Record Id",group:"General",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}})}function _getCurrentUser(e){if("undefined"!=typeof _noodl_cloud_runtime_version)return e.get("Request").UserId;{const t=localStorage["Parse/"+CloudStore.instance.appId+"/currentUser"];if(void 0!==t){let n;try{n=JSON.parse(t)}catch(e){}return void 0!==n?n.objectId:void 0}}}function _addAccessControl(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(){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",set(e){this._internal.accessControlRules=e}}});const o=e._additionalDynamicPorts;e._additionalDynamicPorts=function(e,t,n){void 0!==e.parameters.accessControl&&e.parameters.accessControl.length>0&&e.parameters.accessControl.forEach((n=>{const o="acl-"+n.id;t.push({name:o+"-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[o+"-target"]?t.push({name:o+"-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[o+"-target"]&&"user"!==e.parameters[o+"-target"]||t.push({name:o+"-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:o+"-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:o+"-write",displayName:"Write",editorName:n.label+" | Write",group:n.label+" Access Rule",plug:"input",type:{name:"boolean"},default:!0,parent:"accessControl",parentItemId:n.id})})),o&&o(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))},_getACL:function(){let e={};function t(e){return{read:void 0===e.read||e.read,write:void 0===e.write||e.write}}const n=_getCurrentUser(this.nodeScope.modelScope);return void 0!==this._internal.accessControlRules&&this._internal.accessControlRules.forEach((o=>{const i=this._internal.accessControl[o.id];if(void 0===i)void 0!==n&&(e[n]={write:!0,read:!0});else if("everyone"===i.target)e["*"]=t(i);else if("user"===i.target){const o=i.userid||n;e[o]=t(i)}else"role"===i.target&&(e["role:"+i.role]=t(i))})),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}})}const SetDbModelPropertiedNodeDefinition={node:{name:"SetDbModelProperties",category:"",docs:"https://docs.noodl.net/nodes/data/cloud-data/set-record-properties",displayNodeName:"Set Record Properties",usePortAsLabel:"collectionName",dynamicports:[{name:"conditionalports/extended",condition:"storeType = cloud OR storeType NOT SET",inputs:["storeProperties"]}],inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){void 0===this._internal.storeType||"cloud"===this._internal.storeType?this.scheduleSave():this.scheduleStore()}},storeProperties:{displayName:"Properties to store",group:"General",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",type:{name:"enum",enums:[{label:"Cloud and local",value:"cloud"},{label:"Local only",value:"local"}]},default:"cloud",set:function(e){this._internal.storeType=e}}},outputs:{stored:{type:"signal",displayName:"Success",group:"Events"}},methods:{scheduleSave(){const e=this,t=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("StorageSave",(function(){if(!t.model)return void e.setError("Missing Record Id");const n=t.model;for(const e in t.inputValues)n.set(e,t.inputValues[e],{resolve:!0});CloudStore.forScope(e.nodeScope.modelScope).save({collection:t.collectionId,objectId:n.getId(),data:"all"===t.storeProperties?n.data:t.inputValues,acl:e._getACL(),success:function(t){for(const e in t)n.set(e,t[e]);e.sendSignalOnOutput("stored")},error:function(t){e.setError(t||"Failed to save.")}})}))},scheduleStore(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{if(this.hasScheduledStore=!1,e.model){for(const t in e.inputValues)e.model.set(t,e.inputValues[t],{resolve:!0});this.sendSignalOnOutput("stored")}}))}}}};_addBaseInfo$1(SetDbModelPropertiedNodeDefinition),_addModelId$1(SetDbModelPropertiedNodeDefinition),_addInputProperties$1(SetDbModelPropertiedNodeDefinition),_addAccessControl(SetDbModelPropertiedNodeDefinition);const node$q=SetDbModelPropertiedNodeDefinition.node;var setdbmodelpropertiesnode=Object.freeze({__proto__:null,node:node$q});const DeleteDbModelPropertiedNodeDefinition={node:{name:"DeleteDbModelProperties",category:"",docs:"https://docs.noodl.net/nodes/data/cloud-data/delete-record",displayNodeName:"Delete Record",shortDesc:"Stores any amount of properties and can be used standalone or together with Collections and For Each nodes.",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.storageDelete()}}},outputs:{deleted:{type:"signal",displayName:"Success",group:"Events"}},methods:{storageDelete(){const e=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("StorageDelete",(()=>{e.model?CloudStore.forScope(this.nodeScope.ModelScope).delete({collection:e.collectionId,objectId:e.model.getId(),success:()=>{e.model.notify("delete"),this.sendSignalOnOutput("deleted")},error:e=>{this.setError(e||"Failed to delete.")}}):this.setError("Missing Record Id")}))}}}};_addBaseInfo$1(DeleteDbModelPropertiedNodeDefinition,{includeInputProperties:!1}),_addModelId$1(DeleteDbModelPropertiedNodeDefinition);const node$p=DeleteDbModelPropertiedNodeDefinition.node;var deletedbmodelpropertiesnode=Object.freeze({__proto__:null,node:node$p});const NewDbModelPropertiedNodeDefinition={node:{name:"NewDbModelProperties",category:"",docs:"https://docs.noodl.net/nodes/data/cloud-data/create-new-record",displayName:"Create New Record",usePortAsLabel:"collectionName",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.storageInsert()}},sourceObjectId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Source Object Id",group:"General",set(e){e instanceof Model&&(e=e.getId()),this._internal.sourceObjectId=e}}},outputs:{created:{type:"signal",displayName:"Success",group:"Events"}},methods:{storageInsert(){const e=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("StorageInsert",(()=>{const t=Object.assign({},e.sourceObjectId?(this.nodeScope.modelScope||Model).get(e.sourceObjectId).data:{},e.inputValues),n=CloudStore.forScope(this.nodeScope.modelScope);n.create({collection:e.collectionId,data:t,acl:this._getACL(),success:t=>{const o=n._fromJSON(t,e.collectionId);this.setModel(o),this.sendSignalOnOutput("created")},error:e=>{this.setError(e||"Failed to insert.")}})}))}}}};_addBaseInfo$1(NewDbModelPropertiedNodeDefinition),_addModelId$1(NewDbModelPropertiedNodeDefinition,{includeOutputs:!0}),_addInputProperties$1(NewDbModelPropertiedNodeDefinition),_addAccessControl(NewDbModelPropertiedNodeDefinition);const node$o=NewDbModelPropertiedNodeDefinition.node;var newdbmodelpropertiesnode=Object.freeze({__proto__:null,node:node$o});const AddDbModelRelationNodeDefinition$1={node:{name:"AddDbModelRelation",category:"Data",docs:"https://docs.noodl.net/nodes/data/cloud-data/add-record-relation",displayNodeName:"Add Record Relation",usePortAsLabel:"collectionName",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleAddRelation()}}},outputs:{relationAdded:{type:"signal",displayName:"Success",group:"Events"}},methods:{validateInputs(){if(!this.context.editorConnection)return;const e=e=>{this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"add-relation",{message:e})};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)"):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"add-relation")},scheduleAddRelation(){const e=this,t=this._internal;this.scheduleOnce("StorageAddRelation",(function(){if(e.validateInputs(),!t.model)return;const n=t.model,o=t.targetModelId;void 0!==o&&CloudStore.forScope(e.nodeScope.modelScope).addRelation({collection:t.collectionId,objectId:n.getId(),key:t.relationProperty,targetObjectId:o,targetClass:(e.nodeScope.modelScope||Model).get(o)._class,success:function(t){for(const e in t)n.set(e,t[e]);e.sendSignalOnOutput("relationAdded")},error:function(t){e.setError(t||"Failed to add relation.")}})}))}}}};_addBaseInfo$1(AddDbModelRelationNodeDefinition$1,{includeRelations:!0}),_addModelId$1(AddDbModelRelationNodeDefinition$1),_addRelationProperty(AddDbModelRelationNodeDefinition$1);const node$n=AddDbModelRelationNodeDefinition$1.node;var dbmodelnodeAddrelation=Object.freeze({__proto__:null,node:node$n});const AddDbModelRelationNodeDefinition={node:{name:"RemoveDbModelRelation",category:"",docs:"https://docs.noodl.net/nodes/data/cloud-data/remove-record-relation",displayName:"Remove Record Relation",usePortAsLabel:"collectionName",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleRemoveRelation()}}},outputs:{relationRemoved:{type:"signal",displayName:"Success",group:"Events"}},methods:{validateInputs(){if(!this.context.editorConnection)return;const e=e=>{this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"add-relation",{message:e})};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)"):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"add-relation")},scheduleRemoveRelation(){const e=this,t=this._internal;this.scheduleOnce("StorageRemoveRelation",(function(){if(e.validateInputs(),!t.model)return;const n=t.model,o=t.targetModelId;void 0!==o&&CloudStore.forScope(e.nodeScope.modelScope).removeRelation({collection:t.collectionId,objectId:n.getId(),key:t.relationProperty,targetObjectId:o,targetClass:(e.nodeScope.modelScope||Model).get(o)._class,success:function(t){for(const e in t)n.set(e,t[e]);e.sendSignalOnOutput("relationRemoved")},error:function(t){e.setError(t||"Failed to remove relation.")}})}))}}}};_addBaseInfo$1(AddDbModelRelationNodeDefinition,{includeRelations:!0}),_addModelId$1(AddDbModelRelationNodeDefinition),_addRelationProperty(AddDbModelRelationNodeDefinition);const node$m=AddDbModelRelationNodeDefinition.node;var dbmodelnodeRemoverelation=Object.freeze({__proto__:null,node:node$m});const node$l={name:"FilterDBModels",docs:"https://docs.noodl.net/nodes/data/cloud-data/filter-records",displayNodeName:"Filter Records",shortDesc:"Filter, sort and limit array",category:"Data",color:"data",initialize(){const e=this;this._internal.collectionChangedCallback=function(){!0!==e.isInputConnected("filter")&&e.scheduleFilter()},this._internal.cloudStoreEvents=function(t){!0!==e.isInputConnected("filter")&&void 0!==e._internal.visualFilter&&void 0!==e._internal.collection&&t.collection===e._internal.collectionName&&void 0!==t.objectId&&e._internal.collection.contains(Model.get(t.objectId))&&e.scheduleFilter()},CloudStore.instance.on("save",this._internal.cloudStoreEvents),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",set(e){this.bindCollection(e),!1===this.isInputConnected("filter")&&this.scheduleFilter()}},enabled:{type:"boolean",group:"General",displayName:"Enabled",default:!0,set(e){this._internal.enabled=e,!1===this.isInputConnected("filter")&&this.scheduleFilter()}},filter:{type:"signal",group:"Actions",displayName:"Filter",valueChangedToTrue(){this.scheduleFilter()}}},outputs:{items:{type:"array",displayName:"Items",group:"General",getter(){return this._internal.filteredCollection}},firstItemId:{type:"string",displayName:"First Record Id",group:"General",getter(){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",getter(){return this._internal.filteredCollection?this._internal.filteredCollection.size():0}},modified:{group:"Events",type:"signal",displayName:"Filtered"}},prototypeExtensions:{unbindCurrentCollection(){const e=this._internal.collection;e&&(e.off("change",this._internal.collectionChangedCallback),this._internal.collection=void 0)},bindCollection(e){this.unbindCurrentCollection(),this._internal.collection=e,e&&e.on("change",this._internal.collectionChangedCallback)},_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection(),CloudStore.instance.off("save",this._internal.cloudStoreEvents)},getLimit(){const e=this._internal.filterSettings;return e.filterEnableLimit?e.filterLimit||10:void 0},getSkip(){const e=this._internal.filterSettings;return e.filterEnableLimit?e.filterSkip||0:void 0},scheduleFilter(){this.collectionChangedScheduled||(this.collectionChangedScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{if(this.collectionChangedScheduled=!1,!this._internal.collection)return;let e=[].concat(this._internal.collection.items);if(this._internal.enabled){const t=this._internal.visualFilter;if(void 0!==t){const n=convertVisualFilter(t,{queryParameters:this._internal.filterParameters,collectionName:this._internal.collectionName});n&&(e=e.filter((e=>matchesQuery(e,n))))}const n=this._internal.visualSorting;if(void 0!==n&&n.length>0){const t=convertVisualSorting(n);t&&e.sort(compareObjects.bind(this,t))}const o=this.getSkip();o&&(e=e.slice(o,e.length));const i=this.getLimit();i&&(e=e.slice(0,i))}this._internal.filteredCollection=Collection.create(e),this.sendSignalOnOutput("modified"),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("items"),this.flagOutputDirty("count")})))},setCollectionName(e){this._internal.collectionName=e},setVisualFilter(e){this._internal.visualFilter=e,!1===this.isInputConnected("filter")&&this.scheduleFilter()},setVisualSorting(e){this._internal.visualSorting=e,!1===this.isInputConnected("filter")&&this.scheduleFilter()},setFilterParameter:function(e,t){this._internal.filterParameters[e]=t,!1===this.isInputConnected("filter")&&this.scheduleFilter()},registerInputIfNeeded(e){if(!this.hasInput(e))return"collectionName"===e?this.registerInput(e,{set:this.setCollectionName.bind(this)}):"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.registerInput(e,{set(t){this._internal.filterSettings[e]=t,!1===this.isInputConnected("filter")&&this.scheduleFilter()}})}}};function updatePorts$4(e,t,n,o){const i=[];if(i.push({name:"collectionName",type:{name:"enum",enums:void 0!==o?o.map((e=>({value:e.name,label:e.name}))):[],allowEditOnly:!0},displayName:"Class",plug:"input",group:"General"}),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"})),void 0!==t.collectionName){const e=o.find((e=>e.name===t.collectionName));if(e&&e.schema&&e.schema.properties){const t=JSON.parse(JSON.stringify(e.schema)),n={Boolean:!0,String:!0,Date:!0,Number:!0,Pointer:!0};for(const e in t.properties)n[t.properties[e].type]||delete t.properties[e];i.push({name:"visualFilter",plug:"input",type:{name:"query-filter",schema:t,allowEditOnly:!0},displayName:"Filter",group:"Filter"}),i.push({name:"visualSorting",plug:"input",type:{name:"query-sorting",schema:t,allowEditOnly:!0},displayName:"Sorting",group:"Sorting"})}if(void 0!==t.visualFilter){const e={};_collectInputs(e,t.visualFilter),Object.keys(e).forEach((e=>{i.push({name:"fp-"+e,plug:"input",type:"*",displayName:e,group:"Filter Parameters"})}))}}n.sendDynamicPorts(e,i)}function setup$5(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.FilterDBModels",(function(n){updatePorts$4(n.id,n.parameters,e.editorConnection,t.getMetaData("dbCollections")),n.on("parameterUpdated",(function(){updatePorts$4(n.id,n.parameters,e.editorConnection,t.getMetaData("dbCollections"))})),t.on("metadataChanged.dbCollections",(function(t){CloudStore.invalidateCollections(),updatePorts$4(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.systemCollections",(function(t){CloudStore.invalidateCollections(),updatePorts$4(n.id,n.parameters,e.editorConnection,t)}))}))}function _collectInputs(e,t){void 0!==t&&(void 0!==t.rules?t.rules.forEach((t=>_collectInputs(e,t))):void 0!==t.input&&(e[t.input]=!0))}var filterdbmodelsnode=Object.freeze({__proto__:null,node:node$l,setup:setup$5});const node$k={name:"Model2",docs:"https://docs.noodl.net/nodes/data/object/object-node",displayNodeName:"Object",shortDesc:"Stores any amount of properties and can be used standalone or together with Collections and For Each nodes.",category:"Data",usePortAsLabel:"modelId",color:"data",dynamicports:[{name:"conditionalports/extended",condition:"idSource = explicit OR idSource NOT SET",inputs:["modelId"]}],initialize(){const e=this._internal;e.inputValues={},e.dirtyValues={},e.onModelChangedCallback=e=>{!0!==this.isInputConnected("fetch")&&(this.hasOutput("prop-"+e.name)&&this.flagOutputDirty("prop-"+e.name),this.hasOutput("changed-"+e.name)&&this.sendSignalOnOutput("changed-"+e.name),this.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",getter(){return this._internal.model?this._internal.model.getId():this._internal.modelId}},changed:{type:"signal",displayName:"Changed",group:"Events"},fetched:{type:"signal",displayName:"Fetched",group:"Events"}},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",set(e){"foreach"===e&&this.scheduleAfterInputsHaveUpdated((()=>{let e=this.nodeScope.componentOwner;for(;void 0!==e&&void 0===e._forEachModel&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;this.setModel(void 0!==e?e._forEachModel:void 0)}))}},modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",set(e){e instanceof Model?e=e.getId():"object"==typeof e&&(e=Model.create(e).getId()),this._internal.modelId=e,!1===this.isInputConnected("fetch")?this.setModelID(e):this.flagOutputDirty("id")}},properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",set(e){}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleSetModel()}}},prototypeExtensions:{scheduleStore(){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(){this.hasScheduledSetModel||(this.hasScheduledSetModel=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledSetModel=!1,this.setModelID(this._internal.modelId)})))},setModelID(e){const t=(this.nodeScope.modelScope||Model).get(e);this.setModel(t),this.sendSignalOnOutput("fetched")},setModel(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)}},_onNodeDeleted(){this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},registerOutputIfNeeded(e){this.hasOutput(e)||e.startsWith("prop-")&&this.registerOutput(e,{getter:userOutputGetter.bind(this,e.substring(5))})},registerInputIfNeeded(e){this.hasInput(e)||e.startsWith("prop-")&&this.registerInput(e,{set:userInputSetter.bind(this,e.substring(5))})}}};function userOutputGetter(e){return this._internal.model?this._internal.model.get(e,{resolve:!0}):void 0}function userInputSetter(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 updatePorts$3(e,t,n){const o=[],i=t.properties;if(i){const e=i?i.split(","):void 0;if(e)for(const t of e)o.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:"prop-"+t,displayName:t}),o.push({type:"signal",plug:"output",group:"Changed Events",displayName:t+" Changed",name:"changed-"+t})}n.sendDynamicPorts(e,o,{detectRenamed:{plug:"input/output"}})}function setup$4(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Model2",(function(t){updatePorts$3(t.id,t.parameters,e.editorConnection),t.on("parameterUpdated",(function(){updatePorts$3(t.id,t.parameters,e.editorConnection)}))}))}var modelnode2=Object.freeze({__proto__:null,node:node$k,setup:setup$4});function _addBaseInfo(e){Object.assign(e.node,{category:"Data",color:"data"})}function _addModelId(e,t){const n=void 0===t||t.includeInputs,o=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"]}]),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",set(e){"foreach"===e&&this.scheduleAfterInputsHaveUpdated((()=>{let e=this.nodeScope.componentOwner;for(;void 0!==e&&void 0===e._forEachModel&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;this.setModel(void 0!==e?e._forEachModel:void 0)}))}},modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",set:function(e){e instanceof Model&&(e=e.getId()),this._internal.modelId=e,this.setModelID(e)}}})),o&&Object.assign(e.node.outputs,{id:{type:"string",displayName:"Id",group:"General",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}}}),Object.assign(e.node.methods,{setModelID:function(e){const t=(this.nodeScope.modelScope||Model).get(e);this.setModel(t)},setModel:function(e){this._internal.model=e,this.flagOutputDirty("id")}}),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=[],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:"*"}];let i=t.parameters.properties;if(i){i=i?i.split(","):void 0;for(const e of i)n.push({type:{name:void 0===t.parameters["type-"+e]?"*":t.parameters["type-"+e]},plug:"input",group:"Property Values",displayName:e,name:"prop-"+e}),n.push({type:{name:"enum",enums:o,allowEditOnly:!0},plug:"input",group:"Property Types",displayName:e,default:"*",name:"type-"+e})}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",set:function(){}}}),Object.assign(def.node.methods,{_pushInputValues:function(model){const internal=this._internal,_defaultValueForType={boolean:!1,string:"",number:0,date:new Date},_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){this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"invalid-array-"+i);try{value=eval(value)}catch(e){-1!==value.indexOf("[")||-1!==value.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(value)}}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})}else model.set(i,_defaultValueForType[internal.inputTypes[i]],{resolve:!0})}},scheduleStore:function(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledStore=!1,e.model&&(this._pushInputValues(e.model),this.sendSignalOnOutput("stored"))}))},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 SetModelPropertiedNodeDefinition={node:{name:"SetModelProperties",category:"",docs:"https://docs.noodl.net/nodes/data/object/set-object-properties",displayNodeName:"Set Object Properties",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleStore()}}},outputs:{stored:{type:"signal",displayName:"Done",group:"Events"}}}};_addBaseInfo(SetModelPropertiedNodeDefinition),_addModelId(SetModelPropertiedNodeDefinition),_addInputProperties(SetModelPropertiedNodeDefinition);const node$j=SetModelPropertiedNodeDefinition.node;var setmodelpropertiesnode=Object.freeze({__proto__:null,node:node$j});const NewModelNodeDefinition={node:{name:"NewModel",category:"",docs:"https://docs.noodl.net/nodes/data/object/create-new-object",displayNodeName:"Create New Object",inputs:{new:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleNew()}}},outputs:{created:{type:"signal",displayName:"Done",group:"Events"}},methods:{scheduleNew(){this.hasScheduledNew||(this.hasScheduledNew=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledNew=!1;const e=(this.nodeScope.modelScope||Model).get();this._pushInputValues(e),this.setModel(e),this.sendSignalOnOutput("created")})))}}}};_addBaseInfo(NewModelNodeDefinition),_addModelId(NewModelNodeDefinition,{includeOutputs:!0}),_addInputProperties(NewModelNodeDefinition);const node$i=NewModelNodeDefinition.node;var newmodelnode=Object.freeze({__proto__:null,node:node$i});const node$h={name:"Cloud File",docs:"https://docs.noodl.net/nodes/data/cloud-data/cloud-file",category:"Cloud Services",color:"data",getInspectInfo(){var e;return null===(e=this._internal.cloudFile)||void 0===e?void 0:e.getUrl()},outputs:{url:{type:"string",displayName:"URL",group:"General",getter(){var e;return null===(e=this._internal.cloudFile)||void 0===e?void 0:e.getUrl()}},name:{type:"string",displayName:"Name",group:"General",getter(){if(!this._internal.cloudFile)return;const e=this._internal.cloudFile.getName().split("_");return 1===e.length?e[0]:e.slice(1).join("_")}}},inputs:{file:{type:"cloudfile",displayName:"Cloud File",group:"General",set(e){e instanceof CloudFile&&(this._internal.cloudFile=e,this.flagOutputDirty("name"),this.flagOutputDirty("url"))}}}};var cloudfilenode=Object.freeze({__proto__:null,node:node$h});class ConfigService{constructor(){this.cacheDuration=9e5}_makeRequest(e,t){if("undefined"==typeof _noodl_cloud_runtime_version){const n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){let e;try{e=JSON.parse(n.response)}catch(e){}200===n.status||201===n.status?t.success(e):t.error(e||{error:n.responseText,status:n.status})}};const o=NoodlRuntime$1.instance.getMetaData("cloudservices"),i=o.appId,s=o.endpoint;n.open("GET",s+e,!0),n.setRequestHeader("X-Parse-Application-Id",i),n.send()}else{const n="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.endpoint:this.endpoint,o="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.appId:this.appId,i="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.masterKey:void 0;fetch(n+e,{method:"GET",headers:{"X-Parse-Application-Id":o,"X-Parse-Master-Key":i}}).then((e=>{200===e.status||201===e.status?e.json().then((e=>t.success(e))).catch((e=>t.error({error:"Config: Failed to get json result."}))):e.json().then((e=>t.error(e))).catch((e=>t.error({error:"Failed to fetch."})))})).catch((e=>{t.error({error:e.message})}))}}_getConfig(){return new Promise(((e,t)=>{this._makeRequest("/config",{success:t=>{e(t.params||{})},error:e=>{t(e)}})}))}async getConfig(){return this.configCachePending?this.configCachePending:this.configCache?(this.ttl&&Date.now()>this.ttl&&this._getConfig().then((e=>{this.configCache=e,this.ttl=Date.now()+this.cacheDuration})),this.configCache):(this.configCachePending=this._getConfig(),this.configCache=await this.configCachePending,delete this.configCachePending,this.ttl=Date.now()+this.cacheDuration,this.configCache)}clearCache(){delete this.configCache}}ConfigService.instance=new ConfigService;const ConfigNodeDefinition={name:"DbConfig",docs:"https://docs.noodl.net/nodes/data/cloud-data/config",displayNodeName:"Config",category:"Cloud Services",usePortAsLabel:"configKey",color:"data",initialize:function(){const e=this._internal;ConfigService.instance.getConfig().then((t=>{e.config=t,this.hasOutput("value")&&this.flagOutputDirty("value")}))},getInspectInfo(){const e=this.getValue();return void 0===e?"[No Value]":[{type:"value",value:e}]},methods:{getValue:function(){const e=this._internal;return e.useDevValue&&this.context.editorConnection&&this.context.editorConnection.isRunningLocally()?e.devValue:void 0!==e.config&&void 0!==e.configKey?e.config[e.configKey]:void 0},setInternal:function(e,t){this._internal[e]=t,this.hasOutput("value")&&this.flagOutputDirty("value")},registerOutputIfNeeded:function(e){if(!this.hasOutput(e))return"value"===e?this.registerOutput(e,{getter:this.getValue.bind(this)}):void 0},registerInputIfNeeded:function(e){if(!this.hasInput(e))return"configKey"===e||"useDevValue"===e||"devValue"===e?this.registerInput(e,{set:this.setInternal.bind(this,e)}):void 0}}},node$g=ConfigNodeDefinition;function setup$3(e,t){function n(n){const o=[];e.editorConnection.clearWarning(n.component.name,n.id,"dbconfig-warning");const i=t.getMetaData("dbConfigSchema");let s;if(i){const t=void 0!==__webpack_require__.g._noodl_cloud_runtime_version;o.push({name:"configKey",displayName:"Parameter",group:"General",type:{name:"enum",enums:Object.keys(i).filter((e=>t||!i[e].masterKeyOnly)).map((e=>({value:e,label:e}))),allowEditOnly:!0},plug:"input"}),void 0!==n.parameters.configKey&&i&&i[n.parameters.configKey]?(s=i[n.parameters.configKey].type,"string"!==s&&"boolean"!==s&&"number"!==s&&"object"!==s&&"array"!==s||(o.push({name:"useDevValue",displayName:"Enable",group:"Local Override",type:"boolean",default:!1,plug:"input"}),!0===n.parameters.useDevValue&&o.push({name:"devValue",displayName:"Value",group:"Local Override",type:s,plug:"input"}))):void 0!==n.parameters.configKey&&e.editorConnection.sendWarning(n.component.name,n.id,"dbconfig-warning",{showGlobally:!0,message:n.parameters.configKey+" config parameter is missing, add it to your cloud service."})}else e.editorConnection.sendWarning(n.component.name,n.id,"dbconfig-warning",{showGlobally:!0,message:"You need an active cloud service."});o.push({name:"value",displayName:"Value",group:"General",type:s||"*",plug:"output"}),e.editorConnection.sendDynamicPorts(n.id,o)}function o(e){n(e),e.on("parameterUpdated",(function(){n(e)})),t.on("metadataChanged.dbConfigSchema",(function(){ConfigService.instance.clearCache(),n(e)}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.DbConfig",(function(e){o(e)}));for(const e of t.getNodesWithType("DbConfig"))o(e)}))}var dbconfig=Object.freeze({__proto__:null,node:node$g,setup:setup$3});function createDefinition(e){return{name:e.name,docs:e.docs,shortDesc:e.shortDesc,nodeDoubleClickAction:e.nodeDoubleClickAction,category:"Variables",initialize(){this._internal.currentValue=e.startValue,this._internal.latestValue=0},getInspectInfo(){return[{type:"color"===e.type.name?"color":"text",value:this._internal.currentValue}]},inputs:{value:{type:e.type,displayName:"Value",default:e.startValue,set(e){!1===this.isInputConnected("saveValue")?this.setValueTo(e):this._internal.latestValue=e}},saveValue:{displayName:"Set",valueChangedToTrue(){this.scheduleAfterInputsHaveUpdated((function(){this.setValueTo(this._internal.latestValue),this.sendSignalOnOutput("stored")}))}}},outputs:{savedValue:{type:e.type.name,displayName:"Value",getter(){return this._internal.currentValue}},changed:{type:"signal",displayName:"Changed"},stored:{type:"signal",displayName:"Stored"}},prototypeExtensions:{setValueTo(t){t=e.cast(t);const n=this._internal.currentValue!==t;this._internal.currentValue=t,n&&(this.flagOutputDirty("savedValue"),this.sendSignalOnOutput("changed"),e.onChanged&&e.onChanged.call(this))}}}}const node$f=createDefinition({name:"Number",docs:"https://docs.noodl.net/nodes/data/number",startValue:0,nodeDoubleClickAction:{focusPort:"value"},type:{name:"number"},cast:e=>Number(e)});var number=Object.freeze({__proto__:null,node:node$f});const StringNode=createDefinition({name:"String",docs:"https://docs.noodl.net/nodes/data/string",shortDesc:"Contains a string (text).",startValue:"",nodeDoubleClickAction:{focusPort:"value"},type:{name:"string"},cast:e=>String(e),onChanged:function(){this.flagOutputDirty("length")}});extend(StringNode,{usePortAsLabel:"value",portLabelTruncationMode:"length",outputs:{length:{type:"number",displayName:"Length",getter:function(){return this._internal.currentValue.length}}}});const node$e=StringNode;var string=Object.freeze({__proto__:null,node:node$e});const node$d=createDefinition({name:"Boolean",docs:"https://docs.noodl.net/nodes/data/boolean",startValue:!1,type:{name:"boolean"},cast:e=>Boolean(e)});var boolean=Object.freeze({__proto__:null,node:node$d});const node$c={name:"Condition",docs:"https://docs.noodl.net/nodes/utilities/logic/condition",category:"Logic",initialize(){},getInspectInfo(){const e=this.getInputValue("condition");let t;return t=void 0===e?"[No input]":e,[{type:"value",value:t}]},inputs:{condition:{type:"boolean",displayName:"Condition",group:"General",set(e){this.isInputConnected("eval")||this.scheduleEvaluate()}},eval:{type:"signal",displayName:"Evaluate",group:"Actions",valueChangedToTrue(){this.scheduleEvaluate()}}},outputs:{ontrue:{type:"signal",displayName:"On True",group:"Events"},onfalse:{type:"signal",displayName:"On False",group:"Events"},result:{type:"boolean",displayName:"Is True",group:"Booleans",getter(){return!!this.getInputValue("condition")}},isfalse:{type:"boolean",displayName:"Is False",group:"Booleans",getter(){return!this.getInputValue("condition")}}},methods:{scheduleEvaluate(){this.scheduleAfterInputsHaveUpdated((()=>{this.flagOutputDirty("result"),this.flagOutputDirty("isfalse");const e=this.getInputValue("condition");this.sendSignalOnOutput(e?"ontrue":"onfalse")}))}}};var condition=Object.freeze({__proto__:null,node:node$c});function and(e){return e.length>0&&!1===e.some((e=>!e))}const node$b={name:"And",docs:"https://docs.noodl.net/nodes/logic/and",category:"Logic",initialize(){this._internal={inputs:[]}},getInspectInfo(){return and(this._internal.inputs)},numberedInputs:{input:{displayPrefix:"Input",type:"boolean",createSetter:e=>function(t){const n=!!t;if(this._internal.inputs[e]===n)return;this._internal.inputs[e]=n;const o=and(this._internal.inputs);this._internal.result!==o&&(this._internal.result=o,this.flagOutputDirty("result"))}}},outputs:{result:{type:"boolean",displayName:"Result",get(){return this._internal.result}}}};var and$1=Object.freeze({__proto__:null,node:node$b});function isTrue(e){return!!e}const node$a={name:"Or",docs:"https://docs.noodl.net/nodes/logic/or",category:"Logic",initialize(){this._internal.inputs=[]},getInspectInfo(){return this._internal.inputs.some(isTrue)},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:{type:"boolean",displayName:"Result",getter:function(){return this._internal.inputs.some(isTrue)}}}};var or=Object.freeze({__proto__:null,node:node$a});const node$9={name:"Boolean To String",docs:"https://docs.noodl.net/nodes/utilities/boolean-to-string",category:"Utilities",initialize(){this._internal.inputs=[],this._internal.currentSelectedIndex=0,this._internal.indexChanged=!1,this._internal.trueString="",this._internal.falseString=""},inputs:{trueString:{displayName:"String for true",type:"string",set(e){this._internal.trueString!==e&&(this._internal.trueString=e,this._internal.currentInput&&this.flagOutputDirty("currentValue"))}},falseString:{displayName:"String for false",type:"string",set(e){this._internal.falseString!==e&&(this._internal.falseString=e,this._internal.currentInput||this.flagOutputDirty("currentValue"))}},input:{type:{name:"boolean"},displayName:"Selector",set(e){this._internal.currentInput!==e&&(this._internal.currentInput=e,this.flagOutputDirty("currentValue"),this.sendSignalOnOutput("inputChanged"))}}},outputs:{currentValue:{type:"string",displayName:"Current Value",group:"Value",getter(){return this._internal.currentInput?this._internal.trueString:this._internal.falseString}},inputChanged:{type:"signal",displayName:"Selector Changed",group:"Signals"}}};var booleantostring=Object.freeze({__proto__:null,node:node$9});const node$8={name:"Date To String",docs:"https://docs.noodl.net/nodes/utilities/date-to-string",category:"Utilities",initialize(){this._internal.formatString="{year}-{month}-{date}"},inputs:{formatString:{displayName:"Format",type:"string",default:"{year}-{month}-{date}",set(e){this._internal.formatString!==e&&(this._internal.formatString=e,void 0!==this._internal.currentInput&&(this._format(),this.flagOutputDirty("currentValue")))}},input:{type:{name:"date"},displayName:"Date",set(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:"Value",getter(){return this._internal.dateString}},inputChanged:{type:"signal",displayName:"Date Changed",group:"Signals"},onError:{type:"signal",displayName:"Invalid Date",group:"Signals"}},methods:{_format(){try{const e=this._internal.currentInput,t=this._internal.formatString,n=("0"+e.getDate()).slice(-2),o=("0"+(e.getMonth()+1)).slice(-2),i=new Intl.DateTimeFormat("en-US",{month:"short"}).format(e),s=e.getFullYear(),r=s.toString().substring(2),a=("0"+e.getHours()).slice(-2),l=("0"+e.getMinutes()).slice(-2),d=("0"+e.getSeconds()).slice(-2);this._internal.dateString=t.replace(/\{date\}/g,n).replace(/\{month\}/g,String(o)).replace(/\{monthShort\}/g,i).replace(/\{year\}/g,String(s)).replace(/\{yearShort\}/g,String(r)).replace(/\{hours\}/g,String(a)).replace(/\{minutes\}/g,String(l)).replace(/\{seconds\}/g,String(d))}catch(e){this._internal.dateString="",this.flagOutputDirty("onError")}this.flagOutputDirty("currentValue"),this.sendSignalOnOutput("inputChanged")}}};var datetostring=Object.freeze({__proto__:null,node:node$8});const node$7={name:"String Mapper",docs:"https://docs.noodl.net/nodes/string-manipulation/string-mapper",category:"Utilities",initialize(){this._internal={inputs:[],mappings:[]}},getInspectInfo(){return this._internal.mappedString},numberedInputs:{input:{type:"string",displayPrefix:"Input",group:"Inputs",index:10,createSetter:e=>function(t){t=void 0===t?"":String(t),this._internal.inputs[e]=t,this.scheduleMapping()}},output:{type:"string",displayPrefix:"Mapping",index:1001,group:"Mappings",createSetter:e=>function(t){t=void 0===t?"":String(t),this._internal.mappings[e]=t,this.scheduleMapping()}}},inputs:{inputString:{type:{name:"string"},index:1,displayName:"Input String",set(e){this._internal.currentInputString=void 0!==e?String(e):void 0,this.scheduleMapping()}},defaultMapping:{type:"string",displayName:"Default",index:1e3,group:"Mappings",set(e){this._internal.defaultMapping=e,this.scheduleMapping()}}},outputs:{mappedString:{type:"string",displayName:"Mapped String",group:"Value",getter(){return this._internal.mappedString}}},prototypeExtensions:{doMapping(){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(){const e=this._internal;e.hasScheduledFetch||(e.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated(this.doMapping.bind(this)))}}};var stringmapper=Object.freeze({__proto__:null,node:node$7});function invert(e){if(void 0!==e)return!e}const node$6={name:"Inverter",docs:"https://docs.noodl.net/nodes/logic/inverter",category:"Logic",initialize(){this._internal.currentValue=void 0},getInspectInfo(){return String(invert(this._internal.currentValue))},inputs:{value:{type:{name:"boolean"},displayName:"Value",set(e){this._internal.currentValue=e,this.flagOutputDirty("result")}}},outputs:{result:{type:"boolean",displayName:"Result",getter(){return invert(this._internal.currentValue)}}}};var inverter=Object.freeze({__proto__:null,node:node$6});const node$5={name:"Substring",docs:"https://docs.noodl.net/nodes/string-manipulation/substring",category:"String Manipulation",initialize(){var e=this._internal;e.startIndex=0,e.endIndex=-1,e.cachedResult="",e.inputString="",e.resultDirty=!1},inputs:{start:{type:"number",displayName:"Start",default:0,set(e){this._internal.startIndex=e,this._internal.resultDirty=!0,this.flagOutputDirty("result")}},end:{type:"number",displayName:"End",default:0,set(e){this._internal.endIndex=e,this._internal.resultDirty=!0,this.flagOutputDirty("result")}},string:{type:{name:"string"},displayName:"String",default:"",set(e){const t=String(e);this._internal.inputString=t,this._internal.resultDirty=!0,this.flagOutputDirty("result")}}},outputs:{result:{type:"string",displayName:"Result",getter(){var e=this._internal;return e.resultDirty&&(-1===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}}}};var substring=Object.freeze({__proto__:null,node:node$5});const node$4={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:{type:{name:"string",multiline:!0},displayName:"Format",set(e){this._internal.format!==e&&(this._internal.format=e,this._internal.resultDirty=!0,this.scheduleFormat())}}},outputs:{formatted:{type:"string",displayName:"Formatted",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 o=[];n&&(o=n.map((e=>e.replace("{","").replace("}","")))),o.forEach((n=>{const o=e.inputValues[n];t=t.replace("{"+n+"}",void 0!==o?o:"")})),e.cachedResult=t,e.resultDirty=!1}return e.cachedResult},registerInputIfNeeded(e){this.hasInput(e)||this.registerInput(e,{set(t){this._internal.inputValues[e]!==t&&(this._internal.inputValues[e]=t,this._internal.resultDirty=!0,this.scheduleFormat())}})},scheduleFormat(){this.formatScheduled||(this.formatScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.formatValue(),this.flagOutputDirty("formatted"),this.formatScheduled=!1})))}}};function updatePorts$2(e,t,n){const o=(t.match(/\{[A-Za-z0-9_]*\}/g)||[]).map((e=>e.replace("{","").replace("}",""))).filter(((e,t,n)=>n.indexOf(e)===t)).map((e=>({name:e,type:"string",plug:"input"})));n.sendDynamicPorts(e,o)}function setup$2(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.String Format",(t=>{t.parameters.format&&updatePorts$2(t.id,t.parameters.format,e.editorConnection),t.on("parameterUpdated",(n=>{"format"===n.name&&updatePorts$2(t.id,t.parameters.format,e.editorConnection)}))}))}var stringformat=Object.freeze({__proto__:null,node:node$4,setup:setup$2});const node$3={name:"Counter",docs:"https://docs.noodl.net/nodes/math/counter",category:"Math",initialize(){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",valueChangedToTrue(){this._internal.limitsEnabled&&this._internal.currentValue>=this._internal.limitsMax||(this._internal.currentValue++,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"))}},decrease:{group:"Actions",displayName:"Decrease Count",valueChangedToTrue(){this._internal.limitsEnabled&&this._internal.currentValue<=this._internal.limitsMin||(this._internal.currentValue--,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"))}},reset:{group:"Actions",displayName:"Reset To Start",valueChangedToTrue(){0!==this.currentValue&&(this._internal.currentValue=this._internal.startValue,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"))}},startValue:{type:"number",displayName:"Start Value",default:0,set(e){this._internal.startValue=Number(e),!1===this._internal.startValueSet&&(this._internal.startValueSet=!0,this._internal.currentValue=this._internal.startValue,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"))}},limitsMin:{type:{name:"number"},displayName:"Min Value",group:"Limits",default:0,set(e){this._internal.limitsMin=Number(e)}},limitsMax:{type:{name:"number"},displayName:"Max Value",group:"Limits",default:0,set(e){this._internal.limitsMax=Number(e)}},limitsEnabled:{type:{name:"boolean"},displayName:"Limits Enabled",group:"Limits",default:!1,set(e){this._internal.limitsEnabled=!!e}}},outputs:{currentCount:{displayName:"Current Count",type:"number",getter(){return this._internal.currentValue}},countChanged:{displayName:"Count Changed",type:"signal"}}};var counter=Object.freeze({__proto__:null,node:node$3});const node$2={name:"Unique Id",docs:"https://docs.noodl.net/nodes/utilities/unique-id",category:"String Manipulation",initialize(){this._internal.guid=guid()},getInspectInfo(){return this._internal.guid},inputs:{new:{displayName:"New",valueChangedToTrue:function(){this._internal.guid=guid(),this.flagOutputDirty("guid")}}},outputs:{guid:{type:"string",displayName:"Id",getter:function(){return this._internal.guid}}},prototypeExtensions:{}};var uniqueid=Object.freeze({__proto__:null,node:node$2});const node$1={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(){this._internal.userProperties={}},outputs:{success:{type:"signal",displayName:"Success",group:"Events"},failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",getter(){return this._internal.error}}},inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleStore()}},email:{displayName:"Email",type:"string",group:"General",set(e){this._internal.email=e}},username:{displayName:"Username",type:"string",group:"General",set(e){this._internal.username=e}}},methods:{setError(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"user-set-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"user-set-warning")},scheduleStore(){const e=this._internal;!0!==this.storeScheduled&&(this.storeScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.storeScheduled=!1,NoodlRuntime.Services.UserService.forScope(this.nodeScope.modelScope).setUserProperties({email:this._internal.email,username:this._internal.username,properties:e.userProperties,success:()=>{this.sendSignalOnOutput("success")},error:e=>{this.setError(e)}})})))},setUserProperty(e,t){this._internal.userProperties[e]=t},registerInputIfNeeded(e){if(!this.hasInput(e))return e.startsWith("prop-")?this.registerInput(e,{set:this.setUserProperty.bind(this,e.substring(5))}):void 0}}};function updatePorts$1(e,t,n,o){const i=[];if(o){const e=o.find((e=>"_User"===e.name));if(e&&e.schema&&e.schema.properties){const t=e.schema.properties,n="undefined"==typeof _noodl_cloud_runtime_version?["authData","createdAt","updatedAt","email","username","emailVerified","password"]:["authData","createdAt","updatedAt","email","username"];for(const e in t){if(-1!==n.indexOf(e))continue;const o=t[e];if(!i.find((t=>t.name===e)))if("Relation"===o.type);else{const t={String:"string",Boolean:"boolean",Number:"number",Date:"date"};i.push({type:{name:t[o.type]?t[o.type]:"*"},plug:"input",group:"Properties",name:"prop-"+e,displayName:e})}}}}n.sendDynamicPorts(e,i)}function setup$1(e,t){function n(n){updatePorts$1(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections")),n.on("parameterUpdated",(function(o){updatePorts$1(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections"))})),t.on("metadataChanged.systemCollections",(function(t){updatePorts$1(n.id,n.parameters,e.editorConnection,t)}))}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)}))}var setuserproperties=Object.freeze({__proto__:null,node:node$1,setup:setup$1});const node={name:"net.noodl.user.User",docs:"https://docs.noodl.net/nodes/data/user/user-node",displayNodeName:"User",category:"Cloud Services",color:"data",initialize(){const e=this;this._internal.onModelChangedCallback=function(t){e.isInputConnected("fetch")||(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=NoodlRuntime.Services.UserService.forScope(this.nodeScope.modelScope);this.setUserModel(t.current),t.on("loggedIn",(()=>{this.setUserModel(t.current),this.hasOutput("loggedIn")&&this.sendSignalOnOutput("loggedIn")})),t.on("sessionGained",(()=>{this.setUserModel(t.current)})),t.on("loggedOut",(()=>{this.setUserModel(void 0),this.hasOutput("loggedOut")&&this.sendSignalOnOutput("loggedOut")})),t.on("sessionLost",(()=>{this.setUserModel(void 0),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",getter(){return void 0!==this._internal.model?this._internal.model.getId():void 0}},fetched:{type:"signal",displayName:"Fetched",group:"Events"},changed:{type:"signal",displayName:"Changed",group:"Events"},failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",getter(){return this._internal.error}},username:{type:"string",displayName:"Username",group:"General",getter(){return void 0!==this._internal.model?this._internal.model.get("username"):void 0}},email:{type:"string",displayName:"Email",group:"General",getter(){return void 0!==this._internal.model?this._internal.model.get("email"):void 0}},authenticated:{type:"boolean",displayName:"Authenticated",group:"General",getter(){return void 0!==this._internal.model}}},inputs:{fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleFetch()}}},methods:{_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},scheduleOnce(e,t){const n=this,o="hasScheduled"+e;this._internal[o]||(this._internal[o]=!0,this.scheduleAfterInputsHaveUpdated((function(){n._internal[o]=!1,t()})))},setError(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"user-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"user-warning")},setUserModel(e){const t=this._internal;if(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"),e)for(const t in e.data)this.hasOutput("prop-"+t)&&this.flagOutputDirty("prop-"+t)},scheduleFetch(){this._internal,this.scheduleOnce("Fetch",(()=>{const e=NoodlRuntime.Services.UserService.forScope(this.nodeScope.modelScope);e.fetchCurrentUser({success:t=>{this.setUserModel(e.current),this.sendSignalOnOutput("fetched")},error:e=>{this.setError(e||"Failed to fetch.")}})}))},registerOutputIfNeeded(e){this.hasOutput(e)||("loggedOut"!==e&&"loggedIn"!==e&&"sessionLost"!==e?e.startsWith("prop-")&&this.registerOutput(e,{getter:this.getUserProperty.bind(this,e.substring(5))}):this.registerOutput(e,{getter:()=>{}}))},getUserProperty(e){return void 0!==this._internal.model?this._internal.model.get(e):void 0}}};function updatePorts(e,t,n,o){const i=[];if(o){const e=o.find((e=>"_User"===e.name));if(e&&e.schema&&e.schema.properties){const t=e.schema.properties,n=["authData","password","username","email"];for(const e in t){if(-1!==n.indexOf(e))continue;const o=t[e];if(!i.find((t=>t.name===e)))if("Relation"===o.type);else{const t={String:"string",Boolean:"boolean",Number:"number",Date:"date"};i.push({type:{name:t[o.type]?t[o.type]:"*"},plug:"output",group:"Properties",name:"prop-"+e,displayName:e}),i.push({type:"signal",plug:"output",group:"Changed Events",displayName:e+" Changed",name:"changed-"+e})}}}}"undefined"==typeof _noodl_cloud_runtime_version&&(i.push({plug:"output",name:"loggedIn",type:"signal",displayName:"Logged In",group:"Events"}),i.push({plug:"output",name:"loggedOut",type:"signal",displayName:"Logged Out",group:"Events"}),i.push({plug:"output",name:"sessionLost",type:"signal",displayName:"Session Lost",group:"Events"})),n.sendDynamicPorts(e,i)}function setup(e,t){function n(n){updatePorts(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections")),n.on("parameterUpdated",(function(o){updatePorts(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections"))})),t.on("metadataChanged.systemCollections",(function(t){updatePorts(n.id,n.parameters,e.editorConnection,t)}))}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)}))}var user=Object.freeze({__proto__:null,node,setup});function registerNodes(e){[componentinputs,componentoutputs,runtasks,restnode,expression,simplejavascript,dbcollectionnode2,dbmodelnode2,setdbmodelpropertiesnode,deletedbmodelpropertiesnode,newdbmodelpropertiesnode,dbmodelnodeAddrelation,dbmodelnodeRemoverelation,filterdbmodelsnode,modelnode2,setmodelpropertiesnode,newmodelnode,cloudfilenode,dbconfig,number,string,boolean,condition,and$1,or,booleantostring,datetostring,stringmapper,inverter,substring,stringformat,counter,uniqueid,setuserproperties,user].forEach((t=>e.registerNode(t)))}class NoodlRuntime$1{constructor(e){if(e.platform=e.platform||{},NoodlRuntime$1.instance=this,this.type=e.type||"browser",this.noodlModules=[],this.eventEmitter=new eventemitter3__WEBPACK_IMPORTED_MODULE_0__.b,this.updateScheduled=!1,this.rootComponent=null,this._currentLoadedData=null,this.isWaitingForExport=!0,this.graphModel=new GraphModel,this.errorHandlers=[],this.frameNumber=0,this.dontCreateRootComponent=!!e.dontCreateRootComponent,this.componentFilter=e.componentFilter,this.runningInEditor=!e.runDeployed,this.platform={requestUpdate:e.platform.requestUpdate,getCurrentTime:e.platform.getCurrentTime,webSocketOptions:e.platform.webSocketOptions,objectToString:e.platform.objectToString},!e.platform.requestUpdate)throw new Error("platform.requestUpdate must be set");if(!e.platform.getCurrentTime)throw new Error("platform.getCurrentTime must be set");this.editorConnection=new EditorConnection({platform:e.platform,runtimeType:this.type}),this.context=new NodeContext({runningInEditor:!e.runDeployed,editorConnection:this.editorConnection,platform:this.platform,graphModel:this.graphModel}),this.context.eventEmitter.on("scheduleUpdate",this.scheduleUpdate.bind(this)),e.runDeployed||this._setupEditorCommunication(e),this.registerGraphModelListeners(),registerNodes(this)}async prefetchBundles(e,t){await asyncPool(t,e,(async e=>{await this.context.fetchComponentBundle(e)}))}_setupEditorCommunication(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 o=Object.keys(e);return Object.keys(n).every((e=>-1!==o.indexOf(e)))&&o.every((o=>t(e[o],n[o])))}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("metadataUpdate",this.onMetaDataUpdateReceived.bind(this)),this.editorConnection.on("connected",(()=>{this.sendNodeLibrary()}))}setDebugInspectorsEnabled(e){this.context.setDebugInspectorsEnabled(e)}registerModule(e){if(e.nodes)for(let t of e.nodes)t.node||(t={node:t}),t.node.module=e.name||"Unknown Module",this.registerNode(t);this.noodlModules.push(e)}registerGraphModelListeners(){this.graphModel.on("componentAdded",(e=>{this.context.registerComponentModel(e)}),this),this.graphModel.on("componentRemoved",(e=>{this.context.deregisterComponentModel(e)}),this)}reload(){location.reload()}registerNode(e){if(e.node){const t=defineNode(e.node);this.context.nodeRegister.register(t),t.setupNumberedInputDynamicPorts&&t.setupNumberedInputDynamicPorts(this.context,this.graphModel)}else this.context.nodeRegister.register(e.node);e.setup&&e.setup(this.context,this.graphModel)}async _setRootComponent(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",null),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"))}async setData(e){if(!this._disableLoad){this._currentLoadedData=e,await this.graphModel.importEditorData(e);for(const e of this.noodlModules)"function"==typeof e.setup&&e.setup();!0!==this.dontCreateRootComponent&&(await this._setRootComponent(this.graphModel.rootComponent||null),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()}}scheduleUpdate(){var e,t;this.updateScheduled||(this.updateScheduled=!0,null===(t=(e=this.platform).requestUpdate)||void 0===t||t.call(e,this._doUpdate.bind(this)))}_doUpdate(){this.updateScheduled=!1,this.context.currentFrameTime=this.platform.getCurrentTime(),this.context.eventEmitter.emit("frameStart"),this.context.update(),this.context.eventEmitter.emit("frameEnd"),this.frameNumber++}setProjectSettings(e){this.projectSettings=e}getNodeLibrary(){const e=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=generateNodeLibrary(this.context.nodeRegister);return t.projectsettings=e,JSON.stringify(t,null,3)}sendNodeLibrary(){const e=this.getNodeLibrary();this.lastSentNodeLibrary!==e&&(this.lastSentNodeLibrary=e,this.editorConnection.sendNodeLibrary(e))}connectToEditor(e){this.editorConnection.connect(e)}onMetaDataUpdateReceived(e){this.graphModel.isEmpty()||handleEvent(this.context,this.graphModel,e)}async onModelUpdateReceived(e){this.isWaitingForExport||("projectInstanceChanged"===e.type?this.reload():!1===this.graphModel.isEmpty()&&await handleEvent(this.context,this.graphModel,e))}addErrorHandler(e){this.errorHandlers.push(e)}reportError(e){this.errorHandlers.forEach((t=>{t(e)}))}getProjectSettings(){return this.graphModel.getSettings()}getMetaData(e){return this.graphModel.getMetaData(e)}}function createRecordsAPI(e){let t;const n=()=>(t||(t=new CloudStore(e)),t);return{async query(t,o,i){if(void 0===t)throw new Error("'className' is undefined");return new Promise(((s,r)=>{n().query({collection:t,where:convertFilterOp(o||{},{collectionName:t,error:e=>r(e),modelScope:e}),limit:null==i?void 0:i.limit,sort:null==i?void 0:i.sort,skip:null==i?void 0:i.skip,include:null==i?void 0:i.include,select:null==i?void 0:i.select,count:null==i?void 0:i.count,success:(e,o)=>{const i=e.map((e=>n()._fromJSON(e,t)));s(void 0!==o?{results:i,count:o}:i)},error:e=>{r(Error(e||"Failed to query."))}})}))},async count(t,o){if(void 0===t)throw new Error("'className' is undefined");return new Promise(((i,s)=>{n().count({collection:t,where:o?convertFilterOp(o||{},{collectionName:t,error:e=>s(e),modelScope:e}):void 0,success:e=>{i(e)},error:e=>{s(Error(e||"Failed to query."))}})}))},async distinct(t,o,i){if(void 0===t)throw new Error("'className' is undefined");return new Promise(((s,r)=>{n().distinct({collection:t,property:o,where:i?convertFilterOp(i||{},{collectionName:t,error:e=>r(e),modelScope:e}):void 0,success:e=>{s(e)},error:e=>{r(Error(e||"Failed to query."))}})}))},async aggregate(t,o,i){if(void 0===t)throw new Error("'className' is undefined");return new Promise(((s,r)=>{n().aggregate({collection:t,group:o,where:i?convertFilterOp(i||{},{collectionName:t,error:e=>r(e),modelScope:e}):void 0,success:e=>{s(e)},error:e=>{r(Error(e||"Failed to aggregate."))}})}))},async fetch(t,o){if(void 0===t)return Promise.reject(new Error("'objectOrId' is undefined."));const i="string"==typeof t?t:t.getId(),s=(null==o?void 0:o.className)||(e||Model).get(i)._class;return new Promise(((e,t)=>{if(!s)return t("No class name specified");n().fetch({collection:s,objectId:i,keys:null==o?void 0:o.keys,include:null==o?void 0:o.include,excludeKeys:null==o?void 0:o.excludeKeys,success:function(t){const o=n()._fromJSON(t,s);e(o)},error:function(e){t(Error(e||"Failed to fetch."))}})}))},async increment(t,o,i){if(void 0===t)return Promise.reject(new Error("'objectOrId' is undefined."));const s="string"==typeof t?t:t.getId(),r=(null==i?void 0:i.className)||(e||Model).get(s)._class;return new Promise(((e,t)=>{if(!r)return t("No class name specified");n().increment({collection:r,objectId:s,properties:o,success:t=>{n()._fromJSON(Object.assign({objectId:s},t),r),e()},error:e=>{t(Error(e||"Failed to increment."))}})}))},async save(t,o,i){if(void 0===t)return Promise.reject(new Error("'objectOrId' is undefined."));const s="string"==typeof t?t:t.getId(),r=(null==i?void 0:i.className)||(e||Model).get(s)._class,a=(e||Model).get(s);return o&&Object.keys(o).forEach((e=>{a.set(e,o[e])})),new Promise(((e,t)=>{if(!r)return t("No class name specified");n().save({collection:r,objectId:s,data:o||a.data,acl:null==i?void 0:i.acl,success:t=>{n()._fromJSON(Object.assign({objectId:s},t),r),e()},error:e=>{t(Error(e||"Failed to save."))}})}))},async create(e,t,o){if(void 0===e)throw new Error("'className' is undefined");return new Promise(((i,s)=>{n().create({collection:e,data:t,acl:null==o?void 0:o.acl,success:t=>{const o=n()._fromJSON(t,e);i(o)},error:e=>{s(Error(e||"Failed to insert."))}})}))},async delete(t,o){if(void 0===t)return Promise.reject(new Error("'objectOrId' is undefined."));const i="string"==typeof t?t:t.getId(),s=(null==o?void 0:o.className)||(e||Model).get(i)._class;return new Promise(((t,o)=>{if(!s)return o("No class name specified");n().delete({collection:s,objectId:i,success:()=>{(e||Model).get(i).notify("delete"),t()},error:e=>{o(Error(e||"Failed to delete."))}})}))},async addRelation(t){var o,i;const s=t.recordId||(null===(o=t.record)||void 0===o?void 0:o.getId()),r=t.className||(e||Model).get(s)._class,a=t.targetRecordId||(null===(i=t.targetRecord)||void 0===i?void 0:i.getId()),l=t.targetClassName||(e||Model).get(a)._class;return new Promise(((e,o)=>r?l?void n().addRelation({collection:r,objectId:s,key:t.key,targetObjectId:a,targetClass:l,success:()=>{e()},error:e=>{o(Error(e||"Failed to add relation."))}}):o("No target class name specified"):o("No class name specified")))},async removeRelation(t){var o,i;const s=t.recordId||(null===(o=t.record)||void 0===o?void 0:o.getId()),r=t.className||(e||Model).get(s)._class,a=t.targetRecordId||(null===(i=t.targetRecord)||void 0===i?void 0:i.getId()),l=t.targetClassName||(e||Model).get(a)._class;return new Promise(((e,o)=>r?l?void n().removeRelation({collection:r,objectId:s,key:t.key,targetObjectId:a,targetClass:l,success:()=>{e()},error:e=>{o(Error(e||"Failed to add relation."))}}):o("No target class name specified"):o("No class name specified")))}}}NoodlRuntime$1.Services=Services,NoodlRuntime$1.Node=Node$1,NoodlRuntime$1.NodeDefinition={defineNode},NoodlRuntime$1.EdgeTriggeredInput=createSetter},1150:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function o(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,o,s,r){if("function"!=typeof o)throw new TypeError("The listener must be a function");var a=new i(o,s||e,r),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,o,i=[];if(0===this._eventsCount)return i;for(o in e=this._events)t.call(e,o)&&i.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var i=0,s=o.length,r=new Array(s);i<s;i++)r[i]=o[i].fn;return r},a.prototype.listenerCount=function(e){var t=n?n+e:e,o=this._events[t];return o?o.fn?1:o.length:0},a.prototype.emit=function(e,t,o,i,s,r){var a=n?n+e:e;if(!this._events[a])return!1;var l,d,u=this._events[a],c=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,o),!0;case 4:return u.fn.call(u.context,t,o,i),!0;case 5:return u.fn.call(u.context,t,o,i,s),!0;case 6:return u.fn.call(u.context,t,o,i,s,r),!0}for(d=1,l=new Array(c-1);d<c;d++)l[d-1]=arguments[d];u.fn.apply(u.context,l)}else{var p,h=u.length;for(d=0;d<h;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),c){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,t);break;case 3:u[d].fn.call(u[d].context,t,o);break;case 4:u[d].fn.call(u[d].context,t,o,i);break;default:if(!l)for(p=1,l=new Array(c-1);p<c;p++)l[p-1]=arguments[p];u[d].fn.apply(u[d].context,l)}}return!0},a.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,o,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return r(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||i&&!a.once||o&&a.context!==o||r(this,s);else{for(var l=0,d=[],u=a.length;l<u;l++)(a[l].fn!==t||i&&!a[l].once||o&&a[l].context!==o)&&d.push(a[l]);d.length?this._events[s]=1===d.length?d[0]:d:r(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&r(this,t)):(this._events=new o,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a},8779:(e,t,n)=>{var o="__lodash_hash_undefined__",i=/^\[object .+?Constructor\]$/,s="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,r="object"==typeof self&&self&&self.Object===Object&&self,a=s||r||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,o=-1;++o<n;)if(t(e[o],o,e))return o;return-1}(e,c);for(var n=-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}(e,t)>-1}function d(e,t,n){for(var o=-1,i=e?e.length:0;++o<i;)if(n(t,e[o]))return!0;return!1}function u(e,t){for(var n=-1,o=t.length,i=e.length;++n<o;)e[i+n]=t[n];return e}function c(e){return e!=e}function p(e,t){return e.has(t)}var h,m=Array.prototype,g=Function.prototype,f=Object.prototype,y=a["__core-js_shared__"],v=(h=/[^.]+$/.exec(y&&y.keys&&y.keys.IE_PROTO||""))?"Symbol(src)_1."+h:"",b=g.toString,_=f.hasOwnProperty,S=f.toString,C=RegExp("^"+b.call(_).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),N=a.Symbol,O=f.propertyIsEnumerable,I=m.splice,w=N?N.isConcatSpreadable:void 0,P=Math.max,x=j(a,"Map"),E=j(Object,"create");function T(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function A(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function k(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function D(e){var t=-1,n=e?e.length:0;for(this.__data__=new k;++t<n;)this.add(e[t])}function R(e,t){for(var n,o,i=e.length;i--;)if((n=e[i][0])===(o=t)||n!=n&&o!=o)return i;return-1}function M(e,t,n,o,i){var s=-1,r=e.length;for(n||(n=F),i||(i=[]);++s<r;){var a=e[s];t>0&&n(a)?t>1?M(a,t-1,n,o,i):u(i,a):o||(i[i.length]=a)}return i}function V(e,t){var n,o,i=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function j(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){if(!z(e)||v&&v in e)return!1;var t=q(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?C:i;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 F(e){return B(e)||function(e){return $(e)&&_.call(e,"callee")&&(!O.call(e,"callee")||"[object Arguments]"==S.call(e))}(e)||!!(w&&e&&e[w])}T.prototype.clear=function(){this.__data__=E?E(null):{}},T.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},T.prototype.get=function(e){var t=this.__data__;if(E){var n=t[e];return n===o?void 0:n}return _.call(t,e)?t[e]:void 0},T.prototype.has=function(e){var t=this.__data__;return E?void 0!==t[e]:_.call(t,e)},T.prototype.set=function(e,t){return this.__data__[e]=E&&void 0===t?o:t,this},A.prototype.clear=function(){this.__data__=[]},A.prototype.delete=function(e){var t=this.__data__,n=R(t,e);return!(n<0||(n==t.length-1?t.pop():I.call(t,n,1),0))},A.prototype.get=function(e){var t=this.__data__,n=R(t,e);return n<0?void 0:t[n][1]},A.prototype.has=function(e){return R(this.__data__,e)>-1},A.prototype.set=function(e,t){var n=this.__data__,o=R(n,e);return o<0?n.push([e,t]):n[o][1]=t,this},k.prototype.clear=function(){this.__data__={hash:new T,map:new(x||A),string:new T}},k.prototype.delete=function(e){return V(this,e).delete(e)},k.prototype.get=function(e){return V(this,e).get(e)},k.prototype.has=function(e){return V(this,e).has(e)},k.prototype.set=function(e,t){return V(this,e).set(e,t),this},D.prototype.add=D.prototype.push=function(e){return this.__data__.set(e,o),this},D.prototype.has=function(e){return this.__data__.has(e)};var U,W,L=(U=function(e,t){return $(e)?function(e,t,n,o){var i,s=-1,r=l,a=!0,u=e.length,c=[],h=t.length;if(!u)return c;n&&(t=function(e,t){for(var n=-1,o=e?e.length:0,i=Array(o);++n<o;)i[n]=t(e[n],n,e);return i}(t,(i=n,function(e){return i(e)}))),o?(r=d,a=!1):t.length>=200&&(r=p,a=!1,t=new D(t));e:for(;++s<u;){var m=e[s],g=n?n(m):m;if(m=o||0!==m?m:0,a&&g==g){for(var f=h;f--;)if(t[f]===g)continue e;c.push(m)}else r(t,g,o)||c.push(m)}return c}(e,M(t,1,$,!0)):[]},W=P(void 0===W?U.length-1:W,0),function(){for(var e=arguments,t=-1,n=P(e.length-W,0),o=Array(n);++t<n;)o[t]=e[W+t];t=-1;for(var i=Array(W+1);++t<W;)i[t]=e[t];return i[W]=o,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)}(U,this,i)}),B=Array.isArray;function $(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)&&!q(e)}(e)}function q(e){var t=z(e)?S.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}function z(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=L},8972:e=>{var t=.1,n="function"==typeof Float32Array;function o(e,t){return 1-3*t+3*e}function i(e,t){return 3*t-6*e}function s(e){return 3*e}function r(e,t,n){return((o(t,n)*e+i(t,n))*e+s(t))*e}function a(e,t,n){return 3*o(t,n)*e*e+2*i(t,n)*e+s(t)}function l(e,t,o,i){if(4===arguments.length)return new l([e,t,o,i]);if(!(this instanceof l))return new l(e);if(!e||4!==e.length)throw new Error("BezierEasing: points must contains 4 values");for(var s=0;s<4;++s)if("number"!=typeof e[s]||isNaN(e[s])||!isFinite(e[s]))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],o=this._p[2],i=this._p[3];return this._precomputed||this._precompute(),t===n&&o===i?e:0===e?0:1===e?1:r(this._getTForX(e),n,i)},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],o=this._p[3];this._precomputed=!0,e===t&&n===o||this._calcSampleValues()},_calcSampleValues:function(){for(var e=this._p[0],n=this._p[2],o=0;o<11;++o)this._mSampleValues[o]=r(o*t,e,n)},_getTForX:function(e){for(var n=this._p[0],o=this._p[2],i=this._mSampleValues,s=0,l=1;10!==l&&i[l]<=e;++l)s+=t;var d=s+(e-i[--l])/(i[l+1]-i[l])*t,u=a(d,n,o);return u>=.001?function(e,t,n,o){for(var i=0;i<4;++i){var s=a(t,n,o);if(0===s)return t;t-=(r(t,n,o)-e)/s}return t}(e,d,n,o):0===u?d:function(e,t,n,o,i){var s,a,l=0;do{(s=r(a=t+(n-t)/2,o,i)-e)>0?n=a:t=a}while(Math.abs(s)>1e-7&&++l<10);return a}(e,s,s+t,n,o)}},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},53:(e,t,n)=>{"use strict";function o(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=o(e[t]))&&(i&&(i+=" "),i+=n);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function i(){for(var e,t,n=0,i="";n<arguments.length;)(e=arguments[n++])&&(t=o(e))&&(i&&(i+=" "),i+=t);return i}n.r(t),n.d(t,{clsx:()=>i,default:()=>s});const s=i},4960:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var o=n(4991),i=n.n(o),s=n(6314),r=n.n(s)()(i());r.push([e.id,".ndl-visual-text {\r\n font-weight: 400;\r\n margin: 0;\r\n}\r\n\r\n.ndl-controls-pointer,\r\n.ndl-controls-pointer * {\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-abs-center {\r\n position: absolute;\r\n transform: translate(-50%, -50%);\r\n left: 50%;\r\n top: 50%;\r\n}\r\n\r\n/** Button **/\r\n.ndl-controls-button {\r\n outline: none;\r\n border: none;\r\n color: white;\r\n background-color: black;\r\n padding: 5px 20px 5px 20px;\r\n cursor: pointer;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.ndl-controls-button:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** Deprecated checkbox **/\r\n.ndl-controls-checkbox {\r\n margin: 0;\r\n border: 1px solid #000000;\r\n border-radius: 0;\r\n background-color: transparent;\r\n -webkit-appearance: none;\r\n outline: none;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-checkbox:checked {\r\n background-color: #000000;\r\n}\r\n\r\n.ndl-controls-checkbox:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** Deprecated radio button **/\r\n.ndl-controls-radiobutton {\r\n margin: 0;\r\n border: 1px solid #000000;\r\n border-radius: 16px;\r\n background-color: transparent;\r\n -webkit-appearance: none;\r\n outline: none;\r\n width: 32px;\r\n height: 32px;\r\n display: block;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-radiobutton:checked {\r\n background-color: #000000;\r\n}\r\n\r\n.ndl-controls-radiobutton:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** New radio button **/\r\n.ndl-controls-radio-2 {\r\n opacity: 0;\r\n position: absolute;\r\n margin: 0;\r\n}\r\n\r\n.ndl-controls-radio-2:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** New checkbox **/\r\n.ndl-controls-checkbox-2 {\r\n opacity: 0;\r\n position: absolute;\r\n margin: 0;\r\n}\r\n\r\n.ndl-controls-checkbox-2:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** Options **/\r\n.ndl-controls-select {\r\n -webkit-appearance: none;\r\n appearance: none;\r\n background-color: transparent;\r\n border: 1px solid #000000;\r\n border-radius: 0;\r\n padding: 0 1em 0 0;\r\n margin: 0;\r\n width: 100%;\r\n font-family: inherit;\r\n font-size: inherit;\r\n cursor: inherit;\r\n line-height: inherit;\r\n\r\n /* Stack above custom arrow */\r\n z-index: 1;\r\n\r\n /* Remove dropdown arrow in IE10 & IE11\r\n @link https://www.filamentgroup.com/lab/select-css.html */\r\n /* &::-ms-expand {\r\n display: none;\r\n }*/\r\n\r\n /* Remove focus outline, will add on alternate element */\r\n outline: none;\r\n}\r\n\r\n.ndl-controls-select:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** Range **/\r\n.ndl-controls-range2 {\r\n margin: 0;\r\n padding: 0;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n outline: none;\r\n border: none;\r\n background: transparent;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range2::-webkit-slider-thumb {\r\n height: 100%;\r\n border: 0;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n}\r\n\r\n.ndl-controls-range2::-moz-range-thumb {\r\n height: 100%;\r\n border: 0;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n}\r\n\r\n.ndl-controls-range2::-webkit-slider-runnable-track {\r\n border: none;\r\n height: 100%;\r\n}\r\n\r\n.ndl-controls-range2::-moz-range-track {\r\n border: none;\r\n height: 100%;\r\n}\r\n\r\n.ndl-controls-range2:disabled {\r\n cursor: default;\r\n}\r\n\r\n/* Old range */\r\n\r\n.ndl-controls-range {\r\n margin: 0;\r\n padding: 0;\r\n -webkit-appearance: none;\r\n outline: none;\r\n border: none;\r\n background-color: transparent;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range::-webkit-slider-thumb {\r\n width: 16px;\r\n height: 16px;\r\n background: #000000;\r\n border: 0;\r\n border-radius: 8px;\r\n cursor: pointer;\r\n -webkit-appearance: none;\r\n margin-top: -5px;\r\n}\r\n\r\n.ndl-controls-range::-moz-range-thumb {\r\n width: 16px;\r\n height: 16px;\r\n background: #000000;\r\n border: none;\r\n border-radius: 8px;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range::-ms-thumb {\r\n width: 16px;\r\n height: 16px;\r\n background: #000000;\r\n border: none;\r\n border-radius: 8px;\r\n cursor: pointer;\r\n margin-top: 0px;\r\n /*Needed to keep the Edge thumb centred*/\r\n}\r\n\r\n.ndl-controls-range::-webkit-slider-runnable-track {\r\n background: #f0f0f0;\r\n border: none;\r\n width: 100%;\r\n height: 6px;\r\n cursor: pointer;\r\n top: 4px;\r\n margin-top: 5px;\r\n}\r\n\r\n.ndl-controls-range:focus::-webkit-slider-runnable-track {\r\n background: #f0f0f0;\r\n}\r\n\r\n.ndl-controls-range::-moz-range-track {\r\n background: #f0f0f0;\r\n border: none;\r\n width: 100%;\r\n height: 6px;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range::-ms-track {\r\n background: transparent;\r\n border-color: transparent;\r\n border-width: 5px 0;\r\n color: transparent;\r\n width: 100%;\r\n height: 6px;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range::-ms-fill-lower {\r\n background: #f0f0f0;\r\n border: none;\r\n}\r\n.ndl-controls-range::-ms-fill-upper {\r\n background: #f0f0f0;\r\n border: none;\r\n}\r\n\r\n/** Field Set **/\r\n.ndl-controls-fieldset {\r\n outline: none;\r\n border: none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n/** Text Input **/\r\n.ndl-controls-textinput {\r\n outline: none;\r\n border-style: none;\r\n background-color: transparent;\r\n}\r\n\r\n.ndl-controls-textinput::placeholder {\r\n color: inherit;\r\n opacity: 0.5;\r\n}\r\n","",{version:3,sources:["webpack://./src/assets/style.css"],names:[],mappings:"AAAA;EACE,gBAAgB;EAChB,SAAS;AACX;;AAEA;;EAEE,eAAe;AACjB;;AAEA;EACE,kBAAkB;EAClB,gCAAgC;EAChC,SAAS;EACT,QAAQ;AACV;;AAEA,aAAa;AACb;EACE,aAAa;EACb,YAAY;EACZ,YAAY;EACZ,uBAAuB;EACvB,0BAA0B;EAC1B,eAAe;EACf,aAAa;EACb,mBAAmB;EACnB,uBAAuB;AACzB;AACA;EACE,eAAe;AACjB;;AAEA,0BAA0B;AAC1B;EACE,SAAS;EACT,yBAAyB;EACzB,gBAAgB;EAChB,6BAA6B;EAC7B,wBAAwB;EACxB,aAAa;EACb,eAAe;AACjB;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,eAAe;AACjB;;AAEA,8BAA8B;AAC9B;EACE,SAAS;EACT,yBAAyB;EACzB,mBAAmB;EACnB,6BAA6B;EAC7B,wBAAwB;EACxB,aAAa;EACb,WAAW;EACX,YAAY;EACZ,cAAc;EACd,eAAe;AACjB;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,eAAe;AACjB;;AAEA,uBAAuB;AACvB;EACE,UAAU;EACV,kBAAkB;EAClB,SAAS;AACX;;AAEA;EACE,eAAe;AACjB;;AAEA,mBAAmB;AACnB;EACE,UAAU;EACV,kBAAkB;EAClB,SAAS;AACX;;AAEA;EACE,eAAe;AACjB;;AAEA,cAAc;AACd;EACE,wBAAwB;EACxB,gBAAgB;EAChB,6BAA6B;EAC7B,yBAAyB;EACzB,gBAAgB;EAChB,kBAAkB;EAClB,SAAS;EACT,WAAW;EACX,oBAAoB;EACpB,kBAAkB;EAClB,eAAe;EACf,oBAAoB;;EAEpB,6BAA6B;EAC7B,UAAU;;EAEV;+DAC6D;EAC7D;;MAEI;;EAEJ,wDAAwD;EACxD,aAAa;AACf;;AAEA;EACE,eAAe;AACjB;;AAEA,YAAY;AACZ;EACE,SAAS;EACT,UAAU;EACV,wBAAwB;EACxB,gBAAgB;EAChB,aAAa;EACb,YAAY;EACZ,uBAAuB;EACvB,eAAe;AACjB;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,wBAAwB;EACxB,gBAAgB;AAClB;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,wBAAwB;EACxB,gBAAgB;AAClB;;AAEA;EACE,YAAY;EACZ,YAAY;AACd;;AAEA;EACE,YAAY;EACZ,YAAY;AACd;;AAEA;EACE,eAAe;AACjB;;AAEA,cAAc;;AAEd;EACE,SAAS;EACT,UAAU;EACV,wBAAwB;EACxB,aAAa;EACb,YAAY;EACZ,6BAA6B;EAC7B,eAAe;AACjB;;AAEA;EACE,WAAW;EACX,YAAY;EACZ,mBAAmB;EACnB,SAAS;EACT,kBAAkB;EAClB,eAAe;EACf,wBAAwB;EACxB,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,YAAY;EACZ,mBAAmB;EACnB,YAAY;EACZ,kBAAkB;EAClB,eAAe;AACjB;;AAEA;EACE,WAAW;EACX,YAAY;EACZ,mBAAmB;EACnB,YAAY;EACZ,kBAAkB;EAClB,eAAe;EACf,eAAe;EACf,wCAAwC;AAC1C;;AAEA;EACE,mBAAmB;EACnB,YAAY;EACZ,WAAW;EACX,WAAW;EACX,eAAe;EACf,QAAQ;EACR,eAAe;AACjB;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,mBAAmB;EACnB,YAAY;EACZ,WAAW;EACX,WAAW;EACX,eAAe;AACjB;;AAEA;EACE,uBAAuB;EACvB,yBAAyB;EACzB,mBAAmB;EACnB,kBAAkB;EAClB,WAAW;EACX,WAAW;EACX,eAAe;AACjB;;AAEA;EACE,mBAAmB;EACnB,YAAY;AACd;AACA;EACE,mBAAmB;EACnB,YAAY;AACd;;AAEA,gBAAgB;AAChB;EACE,aAAa;EACb,YAAY;EACZ,SAAS;EACT,UAAU;AACZ;;AAEA,iBAAiB;AACjB;EACE,aAAa;EACb,kBAAkB;EAClB,6BAA6B;AAC/B;;AAEA;EACE,cAAc;EACd,YAAY;AACd",sourcesContent:[".ndl-visual-text {\r\n font-weight: 400;\r\n margin: 0;\r\n}\r\n\r\n.ndl-controls-pointer,\r\n.ndl-controls-pointer * {\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-abs-center {\r\n position: absolute;\r\n transform: translate(-50%, -50%);\r\n left: 50%;\r\n top: 50%;\r\n}\r\n\r\n/** Button **/\r\n.ndl-controls-button {\r\n outline: none;\r\n border: none;\r\n color: white;\r\n background-color: black;\r\n padding: 5px 20px 5px 20px;\r\n cursor: pointer;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.ndl-controls-button:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** Deprecated checkbox **/\r\n.ndl-controls-checkbox {\r\n margin: 0;\r\n border: 1px solid #000000;\r\n border-radius: 0;\r\n background-color: transparent;\r\n -webkit-appearance: none;\r\n outline: none;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-checkbox:checked {\r\n background-color: #000000;\r\n}\r\n\r\n.ndl-controls-checkbox:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** Deprecated radio button **/\r\n.ndl-controls-radiobutton {\r\n margin: 0;\r\n border: 1px solid #000000;\r\n border-radius: 16px;\r\n background-color: transparent;\r\n -webkit-appearance: none;\r\n outline: none;\r\n width: 32px;\r\n height: 32px;\r\n display: block;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-radiobutton:checked {\r\n background-color: #000000;\r\n}\r\n\r\n.ndl-controls-radiobutton:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** New radio button **/\r\n.ndl-controls-radio-2 {\r\n opacity: 0;\r\n position: absolute;\r\n margin: 0;\r\n}\r\n\r\n.ndl-controls-radio-2:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** New checkbox **/\r\n.ndl-controls-checkbox-2 {\r\n opacity: 0;\r\n position: absolute;\r\n margin: 0;\r\n}\r\n\r\n.ndl-controls-checkbox-2:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** Options **/\r\n.ndl-controls-select {\r\n -webkit-appearance: none;\r\n appearance: none;\r\n background-color: transparent;\r\n border: 1px solid #000000;\r\n border-radius: 0;\r\n padding: 0 1em 0 0;\r\n margin: 0;\r\n width: 100%;\r\n font-family: inherit;\r\n font-size: inherit;\r\n cursor: inherit;\r\n line-height: inherit;\r\n\r\n /* Stack above custom arrow */\r\n z-index: 1;\r\n\r\n /* Remove dropdown arrow in IE10 & IE11\r\n @link https://www.filamentgroup.com/lab/select-css.html */\r\n /* &::-ms-expand {\r\n display: none;\r\n }*/\r\n\r\n /* Remove focus outline, will add on alternate element */\r\n outline: none;\r\n}\r\n\r\n.ndl-controls-select:disabled {\r\n cursor: default;\r\n}\r\n\r\n/** Range **/\r\n.ndl-controls-range2 {\r\n margin: 0;\r\n padding: 0;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n outline: none;\r\n border: none;\r\n background: transparent;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range2::-webkit-slider-thumb {\r\n height: 100%;\r\n border: 0;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n}\r\n\r\n.ndl-controls-range2::-moz-range-thumb {\r\n height: 100%;\r\n border: 0;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n}\r\n\r\n.ndl-controls-range2::-webkit-slider-runnable-track {\r\n border: none;\r\n height: 100%;\r\n}\r\n\r\n.ndl-controls-range2::-moz-range-track {\r\n border: none;\r\n height: 100%;\r\n}\r\n\r\n.ndl-controls-range2:disabled {\r\n cursor: default;\r\n}\r\n\r\n/* Old range */\r\n\r\n.ndl-controls-range {\r\n margin: 0;\r\n padding: 0;\r\n -webkit-appearance: none;\r\n outline: none;\r\n border: none;\r\n background-color: transparent;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range::-webkit-slider-thumb {\r\n width: 16px;\r\n height: 16px;\r\n background: #000000;\r\n border: 0;\r\n border-radius: 8px;\r\n cursor: pointer;\r\n -webkit-appearance: none;\r\n margin-top: -5px;\r\n}\r\n\r\n.ndl-controls-range::-moz-range-thumb {\r\n width: 16px;\r\n height: 16px;\r\n background: #000000;\r\n border: none;\r\n border-radius: 8px;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range::-ms-thumb {\r\n width: 16px;\r\n height: 16px;\r\n background: #000000;\r\n border: none;\r\n border-radius: 8px;\r\n cursor: pointer;\r\n margin-top: 0px;\r\n /*Needed to keep the Edge thumb centred*/\r\n}\r\n\r\n.ndl-controls-range::-webkit-slider-runnable-track {\r\n background: #f0f0f0;\r\n border: none;\r\n width: 100%;\r\n height: 6px;\r\n cursor: pointer;\r\n top: 4px;\r\n margin-top: 5px;\r\n}\r\n\r\n.ndl-controls-range:focus::-webkit-slider-runnable-track {\r\n background: #f0f0f0;\r\n}\r\n\r\n.ndl-controls-range::-moz-range-track {\r\n background: #f0f0f0;\r\n border: none;\r\n width: 100%;\r\n height: 6px;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range::-ms-track {\r\n background: transparent;\r\n border-color: transparent;\r\n border-width: 5px 0;\r\n color: transparent;\r\n width: 100%;\r\n height: 6px;\r\n cursor: pointer;\r\n}\r\n\r\n.ndl-controls-range::-ms-fill-lower {\r\n background: #f0f0f0;\r\n border: none;\r\n}\r\n.ndl-controls-range::-ms-fill-upper {\r\n background: #f0f0f0;\r\n border: none;\r\n}\r\n\r\n/** Field Set **/\r\n.ndl-controls-fieldset {\r\n outline: none;\r\n border: none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n/** Text Input **/\r\n.ndl-controls-textinput {\r\n outline: none;\r\n border-style: none;\r\n background-color: transparent;\r\n}\r\n\r\n.ndl-controls-textinput::placeholder {\r\n color: inherit;\r\n opacity: 0.5;\r\n}\r\n"],sourceRoot:""}]);const a=r},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,o){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(o)for(var s=0;s<this.length;s++){var r=this[s][0];null!=r&&(i[r]=!0)}for(var a=0;a<e.length;a++){var l=[].concat(e[a]);o&&i[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l))}},t}},4991:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}e.exports=function(e){var n=function(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var o,i,s=[],r=!0,a=!1;try{for(n=n.call(e);!(r=(o=n.next()).done)&&(s.push(o.value),!t||s.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==n.return||n.return()}finally{if(a)throw i}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?t(e,n):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e,4),o=n[1],i=n[3];if(!i)return o;if("function"==typeof btoa){var s=btoa(unescape(encodeURIComponent(JSON.stringify(i)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),a="/*# ".concat(r," */"),l=i.sources.map((function(e){return"/*# sourceURL=".concat(i.sourceRoot||"").concat(e," */")}));return[o].concat(l).concat([a]).join("\n")}return[o].join("\n")}},7007:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,o=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 i=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,o){function i(n){e.removeListener(t,s),o(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}g(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var r=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?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,o){var i,s,r,d;if(a(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),r=s[t]),void 0===r)r=s[t]=n,++e._eventsCount;else if("function"==typeof r?r=s[t]=o?[n,r]:[r,n]:o?r.unshift(n):r.push(n),(i=l(e))>0&&r.length>i&&!r.warned){r.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=r.length,d=u,console&&console.warn&&console.warn(d)}return e}function u(){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 c(e,t,n){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=u.bind(o);return i.listener=n,o.wrapFn=i,i}function p(e,t,n){var o=e._events;if(void 0===o)return[];var i=o[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]: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}(i):m(i,i.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 m(e,t){for(var n=new Array(t),o=0;o<t;++o)n[o]=e[o];return n}function g(e,t,n,o){if("function"==typeof e.on)o.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 i(s){o.once&&e.removeEventListener(t,i),n(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return r},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");r=e}}),s.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},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(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},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,s=this._events;if(void 0!==s)i=i&&void 0===s.error;else if(!i)return!1;if(i){var r;if(t.length>0&&(r=t[0]),r instanceof Error)throw r;var a=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw a.context=r,a}var l=s[e];if(void 0===l)return!1;if("function"==typeof l)o(l,this,t);else{var d=l.length,u=m(l,d);for(n=0;n<d;++n)o(u[n],this,t)}return!0},s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,c(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,c(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,o,i,s,r;if(a(t),void 0===(o=this._events))return this;if(void 0===(n=o[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){r=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(o[e]=n[0]),void 0!==o.removeListener&&this.emit("removeListener",e,r||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,o;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 i,s=Object.keys(n);for(o=0;o<s.length;++o)"removeListener"!==(i=s[o])&&this.removeAllListeners(i);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(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},2694:(e,t,n)=>{"use strict";var o=n(6925);function i(){}function s(){}s.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,s,r){if(r!==o){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:s,resetWarningCache:i};return n.PropTypes=n,n}},5556:(e,t,n)=>{e.exports=n(2694)()},6925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},6027:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return u.default}}),t.default=void 0;var o=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var r=i?Object.getOwnPropertyDescriptor(e,s):null;r&&(r.get||r.set)?Object.defineProperty(o,s,r):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}(n(1594)),i=p(n(5556)),s=p(n(5206)),r=p(n(53)),a=n(1089),l=n(1726),d=n(7056),u=p(n(6888)),c=p(n(8696));function p(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},m.apply(this,arguments)}function g(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||null===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:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class f extends o.Component{static getDerivedStateFromProps(e,t){let{position:n}=e,{prevPropsPosition:o}=t;return!n||o&&n.x===o.x&&n.y===o.y?null:((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:n,prevPropsPosition:o}),{x:n.x,y:n.y,prevPropsPosition:{...n}})}constructor(e){super(e),g(this,"onDragStart",((e,t)=>{if((0,c.default)("Draggable: onDragStart: %j",t),!1===this.props.onStart(e,(0,l.createDraggableData)(this,t)))return!1;this.setState({dragging:!0,dragged:!0})})),g(this,"onDrag",((e,t)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",t);const n=(0,l.createDraggableData)(this,t),o={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){const{x:e,y:t}=o;o.x+=this.state.slackX,o.y+=this.state.slackY;const[i,s]=(0,l.getBoundPosition)(this,o.x,o.y);o.x=i,o.y=s,o.slackX=this.state.slackX+(e-o.x),o.slackY=this.state.slackY+(t-o.y),n.x=o.x,n.y=o.y,n.deltaX=o.x-this.state.x,n.deltaY=o.y-this.state.y}if(!1===this.props.onDrag(e,n))return!1;this.setState(o)})),g(this,"onDragStop",((e,t)=>{if(!this.state.dragging)return!1;if(!1===this.props.onStop(e,(0,l.createDraggableData)(this,t)))return!1;(0,c.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.setState({dragging:!1})}findDOMNode(){var e,t;return null!==(e=null===(t=this.props)||void 0===t||null===(t=t.nodeRef)||void 0===t?void 0:t.current)&&void 0!==e?e:s.default.findDOMNode(this)}render(){const{axis:e,bounds:t,children:n,defaultPosition:i,defaultClassName:s,defaultClassNameDragging:d,defaultClassNameDragged:c,position:p,positionOffset:h,scale:g,...f}=this.props;let y={},v=null;const b=!Boolean(p)||this.state.dragging,_=p||i,S={x:(0,l.canDragX)(this)&&b?this.state.x:_.x,y:(0,l.canDragY)(this)&&b?this.state.y:_.y};this.state.isElementSVG?v=(0,a.createSVGTransform)(S,h):y=(0,a.createCSSTransform)(S,h);const C=(0,r.default)(n.props.className||"",s,{[d]:this.state.dragging,[c]:this.state.dragged});return o.createElement(u.default,m({},f,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),o.cloneElement(o.Children.only(n),{className:C,style:{...n.props.style,...y},transform:v}))}}t.default=f,g(f,"displayName","Draggable"),g(f,"propTypes",{...u.default.propTypes,axis:i.default.oneOf(["both","x","y","none"]),bounds:i.default.oneOfType([i.default.shape({left:i.default.number,right:i.default.number,top:i.default.number,bottom:i.default.number}),i.default.string,i.default.oneOf([!1])]),defaultClassName:i.default.string,defaultClassNameDragging:i.default.string,defaultClassNameDragged:i.default.string,defaultPosition:i.default.shape({x:i.default.number,y:i.default.number}),positionOffset:i.default.shape({x:i.default.oneOfType([i.default.number,i.default.string]),y:i.default.oneOfType([i.default.number,i.default.string])}),position:i.default.shape({x:i.default.number,y:i.default.number}),className:d.dontSetMe,style:d.dontSetMe,transform:d.dontSetMe}),g(f,"defaultProps",{...u.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})},6888:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var r=i?Object.getOwnPropertyDescriptor(e,s):null;r&&(r.get||r.set)?Object.defineProperty(o,s,r):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}(n(1594)),i=u(n(5556)),s=u(n(5206)),r=n(1089),a=n(1726),l=n(7056),d=u(n(8696));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function p(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||null===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:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const h={start:"touchstart",move:"touchmove",stop:"touchend"},m={start:"mousedown",move:"mousemove",stop:"mouseup"};let g=m;class f extends o.Component{constructor(){super(...arguments),p(this,"dragging",!1),p(this,"lastX",NaN),p(this,"lastY",NaN),p(this,"touchIdentifier",null),p(this,"mounted",!1),p(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,r.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,r.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;"touchstart"===e.type&&e.preventDefault();const o=(0,r.getTouchIdentifier)(e);this.touchIdentifier=o;const i=(0,a.getControlPosition)(e,o,this);if(null==i)return;const{x:s,y:l}=i,u=(0,a.createCoreData)(this,s,l);(0,d.default)("DraggableCore: handleDragStart: %j",u),(0,d.default)("calling",this.props.onStart),!1!==this.props.onStart(e,u)&&!1!==this.mounted&&(this.props.enableUserSelectHack&&(0,r.addUserSelectStyles)(n),this.dragging=!0,this.lastX=s,this.lastY=l,(0,r.addEvent)(n,g.move,this.handleDrag),(0,r.addEvent)(n,g.stop,this.handleDragStop))})),p(this,"handleDrag",(e=>{const t=(0,a.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:o}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=o-this.lastY;if([e,t]=(0,a.snapToGrid)(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,o=this.lastY+t}const i=(0,a.createCoreData)(this,n,o);if((0,d.default)("DraggableCore: handleDrag: %j",i),!1!==this.props.onDrag(e,i)&&!1!==this.mounted)this.lastX=n,this.lastY=o;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)}})),p(this,"handleDragStop",(e=>{if(!this.dragging)return;const t=(0,a.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:o}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=o-this.lastY||0;[e,t]=(0,a.snapToGrid)(this.props.grid,e,t),n=this.lastX+e,o=this.lastY+t}const i=(0,a.createCoreData)(this,n,o);if(!1===this.props.onStop(e,i)||!1===this.mounted)return!1;const s=this.findDOMNode();s&&this.props.enableUserSelectHack&&(0,r.removeUserSelectStyles)(s.ownerDocument),(0,d.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,s&&((0,d.default)("DraggableCore: Removing handlers"),(0,r.removeEvent)(s.ownerDocument,g.move,this.handleDrag),(0,r.removeEvent)(s.ownerDocument,g.stop,this.handleDragStop))})),p(this,"onMouseDown",(e=>(g=m,this.handleDragStart(e)))),p(this,"onMouseUp",(e=>(g=m,this.handleDragStop(e)))),p(this,"onTouchStart",(e=>(g=h,this.handleDragStart(e)))),p(this,"onTouchEnd",(e=>(g=h,this.handleDragStop(e))))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,r.addEvent)(e,h.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,r.removeEvent)(t,m.move,this.handleDrag),(0,r.removeEvent)(t,h.move,this.handleDrag),(0,r.removeEvent)(t,m.stop,this.handleDragStop),(0,r.removeEvent)(t,h.stop,this.handleDragStop),(0,r.removeEvent)(e,h.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,r.removeUserSelectStyles)(t)}}findDOMNode(){var e,t;return null!==(e=this.props)&&void 0!==e&&e.nodeRef?null===(t=this.props)||void 0===t||null===(t=t.nodeRef)||void 0===t?void 0:t.current:s.default.findDOMNode(this)}render(){return o.cloneElement(o.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}t.default=f,p(f,"displayName","DraggableCore"),p(f,"propTypes",{allowAnyClick:i.default.bool,children:i.default.node.isRequired,disabled:i.default.bool,enableUserSelectHack:i.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:i.default.arrayOf(i.default.number),handle:i.default.string,cancel:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number,className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),p(f,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})},5794:(e,t,n)=>{"use strict";const{default:o,DraggableCore:i}=n(6027);e.exports=o,e.exports.default=o,e.exports.DraggableCore=i},1089:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addClassName=d,t.addEvent=function(e,t,n,o){if(!e)return;const i={capture:!0,...o};e.addEventListener?e.addEventListener(t,n,i):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&&d(e.body,"react-draggable-transparent-selection")},t.createCSSTransform=function(e,t){const n=l(e,t,"px");return{[(0,i.browserPrefixToKey)("transform",i.default)]:n}},t.createSVGTransform=function(e,t){return l(e,t,"")},t.getTouch=function(e,t){return e.targetTouches&&(0,o.findInArray)(e.targetTouches,(e=>t===e.identifier))||e.changedTouches&&(0,o.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=l,t.innerHeight=function(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,o.int)(n.paddingTop),t-=(0,o.int)(n.paddingBottom),t},t.innerWidth=function(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,o.int)(n.paddingLeft),t-=(0,o.int)(n.paddingRight),t},t.matchesSelector=a,t.matchesSelectorAndParentsTo=function(e,t,n){let o=e;do{if(a(o,t))return!0;if(o===n)return!1;o=o.parentNode}while(o);return!1},t.offsetXYFromParent=function(e,t,n){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-o.left)/n,y:(e.clientY+t.scrollTop-o.top)/n}},t.outerHeight=function(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,o.int)(n.borderTopWidth),t+=(0,o.int)(n.borderBottomWidth),t},t.outerWidth=function(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,o.int)(n.borderLeftWidth),t+=(0,o.int)(n.borderRightWidth),t},t.removeClassName=u,t.removeEvent=function(e,t,n,o){if(!e)return;const i={capture:!0,...o};e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},t.removeUserSelectStyles=function(e){if(e)try{if(e.body&&u(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){}};var o=n(7056),i=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var a=i?Object.getOwnPropertyDescriptor(e,r):null;a&&(a.get||a.set)?Object.defineProperty(o,r,a):o[r]=e[r]}return o.default=e,n&&n.set(e,o),o}(n(3514));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}let r="";function a(e,t){return r||(r=(0,o.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],(function(t){return(0,o.isFunction)(e[t])}))),!!(0,o.isFunction)(e[r])&&e[r](t)}function l(e,t,n){let{x:o,y:i}=e,s="translate(".concat(o).concat(n,",").concat(i).concat(n,")");if(t){const e="".concat("string"==typeof t.x?t.x:t.x+n),o="".concat("string"==typeof t.y?t.y:t.y+n);s="translate(".concat(e,", ").concat(o,")")+s}return s}function d(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function u(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}},3514:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.browserPrefixToKey=i,t.browserPrefixToStyle=function(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e},t.default=void 0,t.getPrefix=o;const n=["Moz","Webkit","O","ms"];function o(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";const o=null===(e=window.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.style;if(!o)return"";if(t in o)return"";for(let e=0;e<n.length;e++)if(i(t,n[e])in o)return n[e];return""}function i(e,t){return t?"".concat(t).concat(function(e){let t="",n=!0;for(let o=0;o<e.length;o++)n?(t+=e[o].toUpperCase(),n=!1):"-"===e[o]?n=!0:t+=e[o];return t}(e)):e}t.default=o()},8696:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){}},1726:(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 i=!(0,o.isNum)(e.lastX),r=s(e);return i?{node:r,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:r,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:r}=e.props;r="string"==typeof r?r:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(r);const a=s(e);if("string"==typeof r){const{ownerDocument:e}=a,t=e.defaultView;let n;if(n="parent"===r?a.parentNode:e.querySelector(r),!(n instanceof t.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const s=n,l=t.getComputedStyle(a),d=t.getComputedStyle(s);r={left:-a.offsetLeft+(0,o.int)(d.paddingLeft)+(0,o.int)(l.marginLeft),top:-a.offsetTop+(0,o.int)(d.paddingTop)+(0,o.int)(l.marginTop),right:(0,i.innerWidth)(s)-(0,i.outerWidth)(a)-a.offsetLeft+(0,o.int)(d.paddingRight)-(0,o.int)(l.marginRight),bottom:(0,i.innerHeight)(s)-(0,i.outerHeight)(a)-a.offsetTop+(0,o.int)(d.paddingBottom)-(0,o.int)(l.marginBottom)}}return(0,o.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,o.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,o.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,o.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]},t.getControlPosition=function(e,t,n){const o="number"==typeof t?(0,i.getTouch)(e,t):null;if("number"==typeof t&&!o)return null;const r=s(n),a=n.props.offsetParent||r.offsetParent||r.ownerDocument.body;return(0,i.offsetXYFromParent)(o||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 o=n(7056),i=n(1089);function s(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}},7056:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dontSetMe=function(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))},t.findInArray=function(e,t){for(let n=0,o=e.length;n<o;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)}},5072:(e,t,n)=>{"use strict";var o,i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function r(e){for(var t=-1,n=0;n<s.length;n++)if(s[n].identifier===e){t=n;break}return t}function a(e,t){for(var n={},o=[],i=0;i<e.length;i++){var a=e[i],l=t.base?a[0]+t.base:a[0],d=n[l]||0,u="".concat(l," ").concat(d);n[l]=d+1;var c=r(u),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==c?(s[c].references++,s[c].updater(p)):s.push({identifier:u,updater:g(p,t),references:1}),o.push(u)}return o}function l(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var s=n.nc;s&&(o.nonce=s)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var r=i(e.insert||"head");if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function c(e,t,n,o){var i=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,i);else{var s=document.createTextNode(i),r=e.childNodes;r[t]&&e.removeChild(r[t]),r.length?e.insertBefore(s,r[t]):e.appendChild(s)}}function p(e,t,n){var o=n.css,i=n.media,s=n.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var h=null,m=0;function g(e,t){var n,o,i;if(t.singleton){var s=m++;n=h||(h=l(t)),o=c.bind(null,n,s,!1),i=c.bind(null,n,s,!0)}else n=l(t),o=p.bind(null,n,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o));var n=a(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var i=r(n[o]);s[i].references--}for(var l=a(e,t),d=0;d<n.length;d++){var u=r(n[d]);0===s[u].references&&(s[u].updater(),s.splice(u,1))}n=l}}}},9678:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});class o{constructor({name:e,url:t}){this.name=e,this.url=t}getUrl(){return this.url}getName(){return this.name}toString(){return this.url}}},3795:(e,t,n)=>{"use strict";n.d(t,{D:()=>u});var o=n(8763),i=n(3200),s=n(9678),r=n(6822),a=n(7031);const l={_common:["_createdAt","_updatedAt","objectId"],_User:["_email_verify_token"]};function d(e,t){const n=Object.assign({},e);return l._common.forEach((e=>delete n[e])),t&&l[t]&&l[t].forEach((e=>delete n[e])),n}class u{static get instance(){return void 0===u._instance&&(u._instance=new u),u._instance}static get collections(){return void 0===u._collections&&(u._collections={},(a.A.instance.getMetaData("dbCollections")||[]).forEach((e=>{u._collections&&(u._collections[e.name]=e)})),(a.A.instance.getMetaData("systemCollections")||[]).forEach((e=>{u._collections&&(u._collections[e.name]=e)}))),u._collections}constructor(e){this._initCloudServices(),this.events=new r.b,this.modelScope=e||o.K}_fromJSON(e,t){return u._fromJSON(e,t,this.modelScope)}_deserializeJSON(e,t){return u._deserializeJSON(e,t,this.modelScope)}_serializeObject(e,t){return u._serializeObject(e,t,this.modelScope)}_initCloudServices(){u._collections=void 0;const e=a.A.instance.getMetaData("cloudservices");e&&(this.appId=e.appId,this.endpoint=e.endpoint);const t=a.A.instance.getMetaData("dbVersionMajor");this.dbVersionMajor=t}on(e,t,n){this.events.on.apply(this.events,[e,t,n])}off(e,t,n,o){this.events.off.apply(this.events,[e,t,n,o])}_makeRequest(e,t){if(!this.appId)throw new Error("App ID is not set");if("undefined"==typeof _noodl_cloud_runtime_version){const n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){let e;try{e=JSON.parse(n.response||n.responseText)}catch(e){}200===n.status||201===n.status?t.success(e):t.error(e||{error:n.responseText,status:n.status})}},n.open(t.method||"GET",this.endpoint+e,!0),n.setRequestHeader("X-Parse-Application-Id",this.appId),"undefined"!=typeof _noodl_cloudservices&&n.setRequestHeader("X-Parse-Master-Key",_noodl_cloudservices.masterKey);const o=localStorage["Parse/"+this.appId+"/currentUser"];if(void 0!==o)try{const e=JSON.parse(o);n.setRequestHeader("X-Parse-Session-Token",e.sessionToken)}catch(e){}t.onUploadProgress&&(n.upload.onprogress=e=>{t.onUploadProgress&&t.onUploadProgress(e)}),t.content instanceof File?n.send(t.content):(n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify(t.content)))}else{const n="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.endpoint:this.endpoint,o="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.appId:this.appId,i="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.masterKey:void 0;fetch(n+e,{method:t.method||"GET",headers:{"X-Parse-Application-Id":o,"X-Parse-Master-Key":i,"Content-Type":"application/json"},body:JSON.stringify(t.content)}).then((e=>{200===e.status||201===e.status?"DELETE"===t.method?t.success(void 0):e.json().then((e=>t.success(e))).catch((e=>t.error({error:"CloudStore: Failed to get json result."}))):"DELETE"===t.method?t.error({error:"Failed to delete."}):e.json().then((e=>t.error(e))).catch((e=>t.error({error:"Failed to fetch."})))})).catch((e=>{t.error({error:e.message})}))}}query(e){this._makeRequest("/classes/"+e.collection,{method:"POST",content:{_method:"GET",where:e.where,limit:e.limit,skip:e.skip,include:Array.isArray(e.include)?e.include.join(","):e.include,keys:Array.isArray(e.select)?e.select.join(","):e.select,order:Array.isArray(e.sort)?e.sort.join(","):e.sort,count:e.count},success:function(t){e.success(t.results,t.count)},error:function(){e.error()}})}aggregate(e){const t=[];if(!e.group)return void e.error("You need to provide group option.");e.limit&&t.push("limit="+e.limit),e.skip&&t.push("skip="+e.skip);const n={};Object.keys(e.group).forEach((t=>{const o={},i=e.group[t];void 0!==i.avg?o.$avg="$"+i.avg:void 0!==i.sum?o.$sum="$"+i.sum:void 0!==i.max?o.$max="$"+i.max:void 0!==i.min?o.$min="$"+i.min:void 0!==i.distinct&&(o.$addToSet="$"+i.distinct),n[t]=o})),this.dbVersionMajor&&this.dbVersionMajor>4?(n._id=null,e.where&&t.push("$match="+encodeURIComponent(JSON.stringify(e.where))),t.push("$group="+JSON.stringify(n))):(n.objectId=null,e.where&&t.push("match="+encodeURIComponent(JSON.stringify(e.where))),t.push("group="+JSON.stringify(n))),this._makeRequest("/aggregate/"+e.collection+(t.length>0?"?"+t.join("&"):""),{success:function(t){const n={};t.results&&1===t.results.length?(Object.keys(e.group).forEach((e=>{n[e]=t.results[0][e]})),e.success(n)):e.success({})},error:function(){e.error()}})}count(e){const t=[];e.where&&t.push("where="+encodeURIComponent(JSON.stringify(e.where))),t.push("limit=0"),t.push("count=1"),this._makeRequest("/classes/"+e.collection+(t.length>0?"?"+t.join("&"):""),{success:function(t){e.success(t.count)},error:function(){e.error()}})}distinct(e){const t=[];e.where&&t.push("where="+encodeURIComponent(JSON.stringify(e.where))),t.push("distinct="+e.property),this._makeRequest("/aggregate/"+e.collection+(t.length>0?"?"+t.join("&"):""),{success:function(t){e.success(t.results)},error:function(){e.error()}})}fetch(e){const t=[];e.include&&t.push("include="+(Array.isArray(e.include)?e.include.join(","):e.include)),e.keys&&t.push("keys="+(Array.isArray(e.keys)?e.keys.join(","):e.keys)),e.excludeKeys&&t.push("excludeKeys="+(Array.isArray(e.excludeKeys)?e.excludeKeys.join(","):e.excludeKeys)),this._makeRequest("/classes/"+e.collection+"/"+e.objectId+(t.length>0?"?"+t.join("&"):""),{method:"GET",success:t=>{e.success(t),this.events.emit("fetch",{type:"fetch",objectId:e.objectId,object:t,collection:e.collection})},error:function(t){e.error(t.error)}})}create(e){this._makeRequest("/classes/"+e.collection,{method:"POST",content:Object.assign(d(u._serializeObject(e.data,e.collection),e.collection),{ACL:e.acl}),success:t=>{const n=Object.assign({},e.data,t);e.success(n),this.events.emit("create",{type:"create",objectId:e.objectId,object:n,collection:e.collection})},error:function(t){e.error(t.error)}})}increment(e){const t={};for(let n in e.properties)t[n]={__op:"Increment",amount:e.properties[n]};this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"PUT",content:t,success:t=>{e.success(t)},error:function(t){e.error(t.error)}})}save(e){const t=Object.assign({},e.data);delete t.createdAt,delete t.updatedAt,this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"PUT",content:Object.assign(d(u._serializeObject(t,e.collection),e.collection),{ACL:e.acl}),success:t=>{e.success(t),this.events.emit("save",{type:"save",objectId:e.objectId,object:Object.assign({},e.data,t),collection:e.collection})},error:function(t){e.error(t.error)}})}delete(e){this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"DELETE",success:()=>{e.success(),this.events.emit("delete",{type:"delete",objectId:e.objectId,collection:e.collection})},error:function(t){e.error(t.error)}})}addRelation(e){if(!e.key)throw new Error("Key is required");const t={};t[e.key]={__op:"AddRelation",objects:[{__type:"Pointer",objectId:e.targetObjectId,className:e.targetClass}]},this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"PUT",content:t,success:function(t){e.success(t)},error:function(t){e.error(t.error)}})}removeRelation(e){if(!e.key)throw new Error("Key is required");const t={};t[e.key]={__op:"RemoveRelation",objects:[{__type:"Pointer",objectId:e.targetObjectId,className:e.targetClass}]},this._makeRequest("/classes/"+e.collection+"/"+e.objectId,{method:"PUT",content:t,success:function(t){e.success(t)},error:function(t){e.error(t.error)}})}uploadFile(e){if(!e.file)throw new Error("File is required");this._makeRequest("/files/"+e.file.name,{method:"POST",content:e.file,contentType:e.file.type,success:t=>e.success(Object.assign({},e.data,t)),error:t=>e.error(t),onUploadProgress:e.onUploadProgress})}deleteFile(e){if(!e.file)throw new Error("File is required");this._makeRequest("/files/"+e.file.name,{method:"DELETE",success:t=>e.success(Object.assign({},e.data,t)),error:t=>e.error(t)})}static forScope(e){return void 0===e?u.instance:(e._cloudStore||(e._cloudStore=new u(e)),e._cloudStore)}static invalidateCollections(){_collections=void 0}static _fromJSON(e,t,n){const i=(n||o.K).get(e.objectId);let s;i._class=t,void 0!==t&&void 0!==u._collections[t]&&(s=u._collections[t].schema);for(const t in e){if("objectId"===t||"ACL"===t)continue;const o=s&&s.properties&&s.properties[t]?s.properties[t].type:void 0;i.set(t,u._deserializeJSON(e[t],o,n))}return i}static _serializeObject(e,t,n){let r;u._collections[t]&&(r=u._collections[t].schema);for(const t in e){const a=r&&r.properties&&r.properties[t]?r.properties[t].type:void 0;if(void 0===e[t]||null===e[t]);else if("Pointer"===a&&"string"==typeof e[t])e[t]={__type:"Pointer",className:r.properties[t].targetClass,objectId:e[t]};else if("Pointer"===a&&"object"==typeof e[t]&&(n||o.K).instanceOf(e[t]))e[t]={__type:"Pointer",className:r.properties[t].targetClass,objectId:e[t].getId()};else if("Date"===a&&("string"==typeof e[t]||e[t]instanceof Date))e[t]={__type:"Date",iso:e[t]instanceof Date?e[t].toISOString():e[t]};else if("File"===a&&e[t]instanceof s.A){const n=e[t];e[t]={__type:"File",url:n.getUrl(),name:n.getName()}}else"Array"===a&&"string"==typeof e[t]&&i.p.exists(e[t])?e[t]=c(i.p.get(e[t])):"Object"===a&&"string"==typeof e[t]&&(n||o.K).exists(e[t])?e[t]=c((n||o.K).get(e[t])):"GeoPoint"===a&&"object"==typeof e[t]?e[t]={__type:"GeoPoint",latitude:Number(e[t].latitude),longitude:Number(e[t].longitude)}:e[t]=c(e[t])}return e}static _deserializeJSON(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.A(e);if("GeoPoint"===t&&"GeoPoint"===e.__type)return{latitude:e.latitude,longitude:e.longitude};if(function(e){if(!Array.isArray(e))return!1;for(let t=0;t<e.length;t++)if("object"!=typeof e[t]||null===e[t])return!1;return!0}(e)){const t=[];for(let o=0;o<e.length;o++)t.push(u._deserializeJSON(e[o],void 0,n));const o=i.p.get();return o.set(t),o}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,u._fromJSON(t,e.className,n)}if("object"==typeof e&&null!==e){const t=(n||o.K).get();for(const o in e)t.set(o,u._deserializeJSON(e[o],void 0,n));return t}return e}}}}function c(e){if(e instanceof o.K){const t={};for(const n in e.data)t[n]=c(e.data[n]);return t}if(e instanceof i.p){const t=[];return e.items.forEach((e=>{t.push(c(e))})),t}return e}},3200:(e,t,n)=>{"use strict";n.d(t,{p:()=>i});var o=n(8763);Object.prototype.hasOwnProperty.call(Array.prototype,"items")||Object.defineProperty(Array.prototype,"items",{enumerable:!1,get(){return this},set(e){this.set(e)}}),Object.defineProperty(Array.prototype,"each",{enumerable:!1,writable:!1,value:Array.prototype.forEach}),Object.prototype.hasOwnProperty.call(Array.prototype,"size")||Object.defineProperty(Array.prototype,"size",{enumerable:!1,writable:!1,value:function(){return this.length}}),Object.prototype.hasOwnProperty.call(Array.prototype,"get")||Object.defineProperty(Array.prototype,"get",{enumerable:!1,writable:!1,value:function(e){return this[e]}}),Object.prototype.hasOwnProperty.call(Array.prototype,"getId")||Object.defineProperty(Array.prototype,"getId",{enumerable:!1,writable:!1,value:function(){return this._id}}),Object.prototype.hasOwnProperty.call(Array.prototype,"id")||Object.defineProperty(Array.prototype,"id",{enumerable:!1,get(){return this.getId()}}),Object.prototype.hasOwnProperty.call(Array.prototype,"set")||Object.defineProperty(Array.prototype,"set",{enumerable:!1,writable:!1,value:function(e){let t,n;if(e===this)return;function i(e){const t={},n=e.length;for(let o=0;o<n;o++){const n=e[o];t[n.getId()]=n}return t}const s=[];for(t=(e=e||[]).length,n=0;n<t;n++){const t=e[n];o.K.instanceOf(t)?s.push(t):s.push(o.K.create(t))}const r=this.items,a=i(r),l=i(s);for(t=r.length,n=0;n<t;n++)l.hasOwnProperty(r[n].getId())||(this.removeAtIndex(n),n--,t--);for(n=0;n<Math.min(r.length,s.length);n++)r[n]!==s[n]&&(a.hasOwnProperty(s[n].getId())&&this.remove(s[n]),this.addAtIndex(s[n],n));for(n=r.length;n<s.length;n++)this.add(s[n])}}),Object.prototype.hasOwnProperty.call(Array.prototype,"notify")||Object.defineProperty(Array.prototype,"notify",{enumerable:!1,writable:!1,value:async function(e,t){if(!this._listeners)return;if(!this._listeners[e])return;const n=this._listeners[e].slice();for(let e=0;e<n.length;e++)await n[e](t)}}),Object.prototype.hasOwnProperty.call(Array.prototype,"contains")||Object.defineProperty(Array.prototype,"contains",{enumerable:!1,writable:!1,value:function(e){return-1!==this.indexOf(e)}}),Object.prototype.hasOwnProperty.call(Array.prototype,"add")||Object.defineProperty(Array.prototype,"add",{enumerable:!1,writable:!1,value:async function(e){this.contains(e)||(this.items.push(e),await this.notify("add",{item:e,index:this.items.length-1}),await this.notify("change"),e.notify("add",{collection:this}))}}),Object.prototype.hasOwnProperty.call(Array.prototype,"remove")||Object.defineProperty(Array.prototype,"remove",{enumerable:!1,writable:!1,value:function(e){const t=this.items.indexOf(e);-1!==t&&this.removeAtIndex(t)}}),Object.prototype.hasOwnProperty.call(Array.prototype,"addAtIndex")||Object.defineProperty(Array.prototype,"addAtIndex",{enumerable:!1,writable:!1,value:async function(e,t){this.contains(e)||(this.items.splice(t,0,e),await this.notify("add",{item:e,index:t}),await this.notify("change"),e.notify("add",{collection:this,index:t}))}}),Object.prototype.hasOwnProperty.call(Array.prototype,"removeAtIndex")||Object.defineProperty(Array.prototype,"removeAtIndex",{enumerable:!1,writable:!1,value:async function(e){const t=this.items[e];this.items.splice(e,1),await this.notify("remove",{item:t,index:e}),await this.notify("change"),await t.notify("remove",{collection:this})}}),Object.prototype.hasOwnProperty.call(Array.prototype,"on")||Object.defineProperty(Array.prototype,"on",{enumerable:!1,writable:!1,value:function(e,t){this._listeners||Object.defineProperty(this,"_listeners",{enumerable:!1,writable:!1,value:{}}),this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}}),Object.prototype.hasOwnProperty.call(Array.prototype,"off")||Object.defineProperty(Array.prototype,"off",{enumerable:!1,writable:!1,value:function(e,t){if(!this._listeners)return;if(!this._listeners[e])return;const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}});class i extends Array{static create(e){const t=o.K.guid();return i._collections[t]=new i,Object.defineProperty(i._collections[t],"_id",{enumerable:!1,writable:!1,value:t}),e&&i._collections[t].set(e),i._collections[t]}static get(e){return void 0===e&&(e=o.K.guid()),i._collections[e]||(i._collections[e]=new i,Object.defineProperty(i._collections[e],"_id",{enumerable:!1,writable:!1,value:e})),i._collections[e]}static instanceOf(e){return e instanceof i}static exists(e){return void 0!==i._collections[e]}}i._collections={}},1142:(e,t,n)=>{"use strict";function o(e){let t=!1;return function(n){(n=!!n)&&!1===t&&e.valueChangedToTrue.call(this),t=n}}n.d(t,{i:()=>o})},8763:(e,t,n)=>{"use strict";n.d(t,{K:()=>i});var o=n(6351);class i{constructor(e,t){this.id=e,this.data=t}static get(e){return void 0===e&&(e=i.guid()),i.models[e]||(i.models[e]=new i(e,{}),i.proxies[e]=new Proxy(i.models[e],i._modelProxyHandler)),i.proxies[e]}static create(e){const t=e||{},n=i.get(t.id);for(const e in t)"id"!==e&&n.set(e,t[e]);return n}static exists(e){return void 0!==i.models[e]}static instanceOf(e){return e instanceof i||e.target instanceof i}static guid(){return(0,o.DU)(10)}on(e,t){this.listeners||(this.listeners={}),this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}off(e,t){if(!this.listeners)return;if(!this.listeners[e])return;const n=this.listeners[e].indexOf(t);-1!==n&&this.listeners[e].splice(n,1)}notify(e,t){if(!this.listeners)return;if(!this.listeners[e])return;const n=this.listeners[e].slice();for(let e=0;e<n.length;e++)n[e](t)}setAll(e){for(const t in e)if("id"!==t&&this.data[t]!==e[t]){const n=this.data[t];this.data[t]=e[t],this.notify("change",{name:t,value:e[t],old:n})}}fill(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})}}set(e,t,n){if((null==n?void 0:n.resolve)&&-1!==e.indexOf(".")){const n=e.split(".");let o=this;for(let e=0;e<n.length-1;e++){const t=o.get(n[e]);if(!i.instanceOf(t))return;o=t}return void o.set(n[n.length-1],t)}const o=null==n?void 0:n.forceChange,s=this.data[e];this.data[e]=t,!o&&s===t||(null==n?void 0:n.silent)||this.notify("change",{name:e,value:t,old:s})}getId(){return this.id}get(e,t){if((null==t?void 0:t.resolve)&&-1!==e.indexOf(".")){const t=e.split(".");let n=this;for(let e=0;e<t.length-1;e++){const o=n.get(t[e]);if(!i.instanceOf(o))return;n=o}return n.get(t[t.length-1])}return this.data[e]}toJSON(){return Object.assign({},this.data,{id:this.id})}}i._models={},i.models=i._models,i.proxies={},i._modelProxyHandler={get:function(e,t,n){return"function"==typeof e[t]?e[t].bind(e):t in e?Reflect.get(e,t,n):e.get(t.toString())},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.toString(),n)}return!0},ownKeys:e=>Reflect.ownKeys(e.data),getOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e.data,t.toString())}},2908:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{b:()=>Node});var _outputproperty__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(900);class Node{constructor(e,t){this.updateOnDirtyFlagging=!0,this.children=[],this._internal={},this._dirty=!1,this._inputs={},this._inputValues={},this._outputs={},this._inputConnections={},this._outputList=[],this._isUpdating=!1,this._inputValuesQueue={},this._afterInputsHaveUpdatedCallbacks=[],this._signalsSentThisUpdate={},this._deleted=!1,this._deleteListeners=[],this._isFirstUpdate=!0,this._valuesFromConnections={},this._updateIteration=0,this.id=t,this.context=e}getInputValue(e){return this._inputValues[e]}registerInput(e,t){var n;if(this.hasInput(e))throw new Error("Input property "+e+" already registered");if(this._inputs[e]=t,t.type&&"object"==typeof t.type&&"units"in t.type){const o=t.type.defaultUnit||(null===(n=t.type.units)||void 0===n?void 0:n[0])||"";this._inputValues[e]={value:t.default,type:o}}else t.hasOwnProperty("default")&&(this._inputValues[e]=t.default)}deregisterInput(e){if(!1===this.hasInput(e))throw new Error("Input property "+e+" doesn't exist");delete this._inputs[e],delete this._inputValues[e]}registerInputs(e){for(const t in e)this.registerInput(t,e[t])}getInput(e){if(!1!==this.hasInput(e))return this._inputs[e];console.log("Node "+this.name+": Invalid input property "+e)}hasInput(e){return e in this._inputs}registerInputIfNeeded(e){}setInputValue(name,value){var _a,_b,_c,_d,_e;const input=this.getInput(name);if(input){if("object"==typeof input.type&&"array"===input.type.name&&"string"==typeof value)try{const e=JSON.parse(value);input.set.call(this,e),input.value=e,this._inputValues[name]=e}catch(e){}else input.set.call(this,value),input.value=value,this._inputValues[name]=value;if("color"===input.type&&this.context&&this.context.styles)value=this.context.styles.resolveColor(value);else if("array"===input.type&&"string"==typeof value)try{value=eval(value),null===(_a=this.context.editorConnection)||void 0===_a||_a.clearWarning(null===(_c=null===(_b=this.nodeScope)||void 0===_b?void 0:_b.componentOwner)||void 0===_c?void 0:_c.name,this.id,"invalid-array-"+name)}catch(e){const t=e;value=[],console.log(e),this.context.editorConnection&&this.context.editorConnection.sendWarning(null===(_e=null===(_d=this.nodeScope)||void 0===_d?void 0:_d.componentOwner)||void 0===_e?void 0:_e.name,this.id,"invalid-array-"+name,{showGlobally:!0,message:"Invalid array<br>"+t.toString()})}input.set.call(this,value)}else console.log("node doesn't have input",name)}hasOutput(e){return e in this._outputs}registerOutput(e,t){if(this.hasOutput(e))throw new Error("Output property "+e+" already registered");const n=new _outputproperty__WEBPACK_IMPORTED_MODULE_0__.V({owner:this,getter:t.get||t.getter,name:e,onFirstConnectionAdded:t.onFirstConnectionAdded,onLastConnectionRemoved:t.onLastConnectionRemoved});this._outputs[e]=n,this._outputList.push(n)}deregisterOutput(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];const n=this._outputList.indexOf(t);this._outputList.splice(n,1)}registerOutputs(e){for(const t in e)this.registerOutput(t,e[t])}registerOutputIfNeeded(){}getOutput(e){if(!1===this.hasOutput(e))throw new Error("Node "+this.name+" doesn't have a port named "+e);return this._outputs[e]}connectInput(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);const o=t.getOutput(n);if(o.registerConnection(this,e),this._inputConnections[e]||(this._inputConnections[e]=[]),this._inputConnections[e].push(o),t._signalsSentThisUpdate[n])this._setValueFromConnection(e,!0),this._setValueFromConnection(e,!1);else{const t=o.value;void 0!==t&&(this._setValueFromConnection(e,t),this.context&&this.context.connectionSentValue(o,o.value))}this.flagDirty()}removeInputConnection(e,t,n){if(!this._inputConnections[e])throw new Error("Node removeInputConnection: Input doesn't exist");const o=this._inputConnections[e];for(let i=0;i<o.length;i++){const s=o[i];if(s.owner.id===t&&s.name===n){o.splice(i,1),s.owner.getOutput(n).deregisterConnection(this,e);break}}0===o.length&&delete this._valuesFromConnections[e]}isInputConnected(e){return!!this._inputConnections.hasOwnProperty(e)&&this._inputConnections[e].some((e=>{var t;if("Component Inputs"!==e.owner.name)return!0;const n=null===(t=e.owner.nodeScope)||void 0===t?void 0:t.componentOwner;return null==n?void 0:n.isInputConnected(e.name)}))}update(){var e,t,n,o;if(!this._isUpdating&&!1!==this._dirty){this._updatedAtIteration!==this.context.updateIteration&&(this._updatedAtIteration=this.context.updateIteration,this._updateIteration=0,this._cyclicLoop&&(this._cyclicLoop=!1)),this._isUpdating=!0;try{for(;this._dirty&&!this._cyclicLoop;){this._updateDependencies(),this._dirty=!1;const e=Object.keys(this._inputValuesQueue);let t=!0;for(;t&&!this._cyclicLoop;){t=!1;for(let n=0;n<e.length;n++){const o=e[n],i=this._inputValuesQueue[o];i.length>0&&(this.setInputValue(o,i.shift()),i.length>0&&(t=!0))}const n=this._afterInputsHaveUpdatedCallbacks;this._afterInputsHaveUpdatedCallbacks=[];for(let e=0;e<n.length;e++)n[e].call(this)}this._updateIteration++,this._updateIteration>=100&&(this._cyclicLoop=!0)}}catch(e){throw this._isUpdating=!1,e}this._cyclicLoop&&(this.context.scheduleNextFrame((()=>{this.context.nodeIsDirty(this)})),this.context.editorConnection&&!this._cyclicWarningSent&&this.context.isWarningTypeEnabled("cyclicLoops")&&(this.context.editorConnection.sendWarning(null===(t=null===(e=this.nodeScope)||void 0===e?void 0:e.componentOwner)||void 0===t?void 0:t.name,this.id,"cyclic-loop",{showGlobally:!0,message:"Cyclic loop detected"}),this._cyclicWarningSent=!0,console.log("cycle detected",{id:this.id,name:this.name,component:null===(o=null===(n=this.nodeScope)||void 0===n?void 0:n.componentOwner)||void 0===o?void 0:o.name}))),this._isFirstUpdate=!1,this._isUpdating=!1}}_updateDependencies(){for(const e in this._inputConnections){const t=this._inputConnections[e];for(let e=0;e<t.length;++e)t[e].owner.update()}}flagDirty(){this._dirty||(this._dirty=!0,this.updateOnDirtyFlagging&&this._performDirtyUpdate())}_performDirtyUpdate(){this.context&&this.context.nodeIsDirty(this);for(let e=0;e<this._outputList.length;++e)this._outputList[e].flagDependeesDirty()}sendValue(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)}flagOutputDirty(e){const t=this.getOutput(e);this.sendValue(e,t.value)}flagAllOutputsDirty(){for(const e of this._outputList)this.sendValue(e.name,e.value)}sendSignalOnOutput(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.sendValue(!0),t.sendValue(!1),this._signalsSentThisUpdate[e]=!0,this.scheduleAfterInputsHaveUpdated((function(){this._signalsSentThisUpdate[e]=!1})),this.context&&this.context.connectionSentSignal(t)}_setValueFromConnection(e,t){this._valuesFromConnections[e]=t,this.queueInput(e,t)}_hasInputBeenSetFromAConnection(e){return this._valuesFromConnections.hasOwnProperty(e)}queueInput(e,t){if(this._inputValuesQueue[e]||(this._inputValuesQueue[e]=[]),this._isFirstUpdate){const n=this._inputValuesQueue[e][0];!0===n||(n instanceof Object&&n.unit&&t instanceof Object==0&&(t={value:t,unit:n.unit}),this._inputValuesQueue[e].length=0)}this._inputValuesQueue[e].push(t),this.flagDirty()}scheduleAfterInputsHaveUpdated(e){this._afterInputsHaveUpdatedCallbacks.push(e),this.flagDirty()}setNodeModel(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)}addDeleteListener(e){this._deleteListeners.push(e)}_onNodeDeleted(){this.model&&(this.model.removeListenersWithRef(this),this.model=void 0),this._deleted=!0;for(const e of this._deleteListeners)e.call(this)}_onNodeModelParameterUpdated(e){var t;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)}else this.queueInput(e.name,e.value);else{let n;const o=this.variant;"object"==typeof o&&(e.state?o&&o.stateParameters.hasOwnProperty(e.state)&&o.stateParameters[e.state].hasOwnProperty(e.name)?n=o.stateParameters[e.state][e.name]:(null===(t=this.model)||void 0===t?void 0:t.parameters.hasOwnProperty(e.name))?n=this.model.parameters[e.name]:o&&o.parameters.hasOwnProperty(e.name)&&(n=o.parameters[e.name]):o&&o.parameters.hasOwnProperty(e.name)&&(n=o.parameters[e.name])),void 0===n&&(n=this.context.getDefaultValueForInput(this.model.type,e.name),this._resetReactVirtualDOM&&this._resetReactVirtualDOM()),this.queueInput(e.name,n)}}_onNodeModelVariantUpdated(e){this.setVariant(e)}setVariant(e){this.variant=e}}},4281:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{BO:()=>_addBaseInfo,D3:()=>_addInputProperties,Gs:()=>_addModelId});var _collection__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3200),_model__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(8763);function _addBaseInfo(e){Object.assign(e.node,{category:"Data",color:"data"})}function _addModelId(e,t){const n=void 0===t||t.includeInputs,o=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"]}]),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",set(e){"foreach"===e&&this.scheduleAfterInputsHaveUpdated((()=>{let e=this.nodeScope.componentOwner;for(;void 0!==e&&void 0===e._forEachModel&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;this.setModel(void 0!==e?e._forEachModel:void 0)}))}},modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",set:function(e){e instanceof _model__WEBPACK_IMPORTED_MODULE_1__.K&&(e=e.getId()),this._internal.modelId=e,this.setModelID(e)}}})),o&&Object.assign(e.node.outputs,{id:{type:"string",displayName:"Id",group:"General",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}}}),Object.assign(e.node.methods,{setModelID:function(e){const t=(this.nodeScope.modelScope||_model__WEBPACK_IMPORTED_MODULE_1__.K).get(e);this.setModel(t)},setModel:function(e){this._internal.model=e,this.flagOutputDirty("id")}}),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=[],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:"*"}];let i=t.parameters.properties;if(i){i=i?i.split(","):void 0;for(const e of i)n.push({type:{name:void 0===t.parameters["type-"+e]?"*":t.parameters["type-"+e]},plug:"input",group:"Property Values",displayName:e,name:"prop-"+e}),n.push({type:{name:"enum",enums:o,allowEditOnly:!0},plug:"input",group:"Property Types",displayName:e,default:"*",name:"type-"+e})}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",set:function(){}}}),Object.assign(def.node.methods,{_pushInputValues:function(model){const internal=this._internal,_defaultValueForType={boolean:!1,string:"",number:0,date:new Date},_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){this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"invalid-array-"+i);try{value=eval(value)}catch(e){-1!==value.indexOf("[")||-1!==value.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__WEBPACK_IMPORTED_MODULE_0__.p.get(value)}}void 0!==internal.inputTypes[i]&&"object"===internal.inputTypes[i]&&"string"==typeof value&&(value=(this.nodeScope.modelScope||_model__WEBPACK_IMPORTED_MODULE_1__.K).get(value)),model.set(i,value,{resolve:!0})}else model.set(i,_defaultValueForType[internal.inputTypes[i]],{resolve:!0})}},scheduleStore:function(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledStore=!1,e.model&&(this._pushInputValues(e.model),this.sendSignalOnOutput("stored"))}))},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}})}},900:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});class o{constructor(e){if(this.valuesSendThisIteration=0,!e.owner)throw new Error("Owner must be set");this.getter=e.getter||(()=>{}),this.connections=[],this._owner=e.owner,this._name=e.name,this.onFirstConnectionAdded=e.onFirstConnectionAdded,this.onLastConnectionRemoved=e.onLastConnectionRemoved}get name(){return this._name}get owner(){return this._owner}get value(){return this.getter.call(this.owner)}get id(){return this._id||(this._id=this.owner.id+this.name),this._id}registerConnection(e,t){this.connections.push({node:e,inputPortName:t}),1===this.connections.length&&this.onFirstConnectionAdded&&this.onFirstConnectionAdded.call(this.owner)}deregisterConnection(e,t){for(let n=0;n<this.connections.length;n++){const o=this.connections[n];if(o.node===e&&o.inputPortName===t){this.connections.splice(n,1);break}}0===this.connections.length&&this.onLastConnectionRemoved&&this.onLastConnectionRemoved.call(this.owner)}flagDependeesDirty(e){for(let e=0,t=this.connections.length;e<t;e++)this.connections[e].node.flagDirty()}sendValue(e){this._lastUpdateIteration!==this.owner._updatedAtIteration?(this._lastUpdateIteration=this.owner._updatedAtIteration,this.valuesSendThisIteration=0):this.valuesSendThisIteration++,this.valuesSendThisIteration>500&&(this.owner._cyclicLoop=!0);for(let t=0,n=this.connections.length;t<n;t++){const n=this.connections[t];n.node._setValueFromConnection(n.inputPortName,e)}}hasConnections(){return this.connections.length>0}}},7031:(e,t,n)=>{"use strict";n.d(t,{A:()=>rn});var o={};n.r(o),n.d(o,{node:()=>de});var s={};n.r(s),n.d(s,{node:()=>ue});var r={};n.r(r),n.d(r,{node:()=>pe});var a={};n.r(a),n.d(a,{node:()=>he,setup:()=>ge});var l={};n.r(l),n.d(l,{node:()=>ve,setup:()=>Ie});var d={};n.r(d),n.d(d,{node:()=>Ee,setup:()=>Ae});var u={};n.r(u),n.d(u,{node:()=>We,setup:()=>$e});var c={};n.r(c),n.d(c,{node:()=>He,setup:()=>Je});var p={};n.r(p),n.d(p,{node:()=>ot});var h={};n.r(h),n.d(h,{node:()=>st});var m={};n.r(m),n.d(m,{node:()=>at});var g={};n.r(g),n.d(g,{node:()=>dt});var f={};n.r(f),n.d(f,{node:()=>ct});var y={};n.r(y),n.d(y,{node:()=>pt,setup:()=>mt});var v={};n.r(v),n.d(v,{node:()=>ft,setup:()=>_t});var b={};n.r(b),n.d(b,{node:()=>Nt});var _={};n.r(_),n.d(_,{node:()=>It});var S={};n.r(S),n.d(S,{node:()=>Pt});var C={};n.r(C),n.d(C,{node:()=>Et,setup:()=>Tt});var N={};n.r(N),n.d(N,{node:()=>kt});var O={};n.r(O),n.d(O,{node:()=>Rt});var I={};n.r(I),n.d(I,{node:()=>Mt});var w={};n.r(w),n.d(w,{node:()=>Vt});var P={};n.r(P),n.d(P,{node:()=>Ft});var x={};n.r(x),n.d(x,{node:()=>Wt});var E={};n.r(E),n.d(E,{node:()=>Lt});var T={};n.r(T),n.d(T,{node:()=>Bt});var A={};n.r(A),n.d(A,{node:()=>$t});var k={};n.r(k),n.d(k,{node:()=>zt});var D={};n.r(D),n.d(D,{node:()=>Ht});var R={};n.r(R),n.d(R,{node:()=>Gt,setup:()=>Yt});var M={};n.r(M),n.d(M,{node:()=>Jt});var V={};n.r(V),n.d(V,{node:()=>Kt});var j={};n.r(j),n.d(j,{node:()=>Qt,setup:()=>en});var F={};n.r(F),n.d(F,{node:()=>tn,setup:()=>on});var U=n(6822);class W{constructor(e){this._constructors={},this.context=e}register(e){const t=e.metadata.name;this._constructors[t]=e}createNode(e,t,n){if(!this._constructors.hasOwnProperty(e))throw new Error("Unknown node type with name "+e);return this._constructors[e](this.context,t,n)}getNodeMetadata(e){if(!this._constructors.hasOwnProperty(e))throw new Error("Unknown node type with name "+e);return this._constructors[e].metadata}hasNode(e){return this._constructors.hasOwnProperty(e)}getInputType(e,t){var n,o;return null===(o=null===(n=this.getNodeMetadata(e).inputs)||void 0===n?void 0:n[t])||void 0===o?void 0:o.type}}class L{constructor(e,t){this._hasCalledOnStart=!1,this._wasStopped=!1,this._start=0,this._durationLeft=0,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]}start(){return this._isRunning&&this.stop(),this.scheduler.scheduleTimer(this),this}stop(){this.scheduler.stopTimer(this),this._hasCalledOnStart=!1,this._isRunning=!1,this._wasStopped=!0}isRunning(){return this._isRunning}durationLeft(){return this._durationLeft}}class B{constructor(e){this.requestFrame=e,this.runningTimers=[],this.newTimers=[]}createTimer(e){return new L(this,e)}scheduleTimer(e){-1===this.newTimers.indexOf(e)&&(0===e.repeatCount&&(e.repeatCount=1e5),this.newTimers.push(e),this.requestFrame())}stopTimer(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))}runTimers(e){var t,n;const o=[],i=[],s=[];let r;const a=this.runningTimers.length;let l;for(r=0;r<a;++r)s[r]=this.runningTimers[r];for(r=0;r<a;++r)if(l=s[r],l&&e>=l._start){let t;!1===l._hasCalledOnStart&&l.onStart&&(l.onStart(),l._hasCalledOnStart=!0),t=l.duration>0?(e-l._start)/(l.duration*l.repeatCount):1,l._durationLeft=l.duration*(1-t);let n=t*l.repeatCount-Math.floor(t*l.repeatCount);t>=1&&(n=1),l.onRunning&&l.onRunning(n),t<1&&l._isRunning?o.push(l):l._wasStopped||i.push(l)}else o.push(l);for(this.runningTimers=o,r=0;r<i.length;++r)i[r]._isRunning=!1,i[r]._hasCalledOnStart=!1,null===(n=null===(t=i[r])||void 0===t?void 0:t.onFinish)||void 0===n||n.call(t);if(this.newTimers.length>0){for(r=0;r<this.newTimers.length;++r)l=this.newTimers[r],l._start=e+l.delay,l._isRunning=!0,l._wasStopped=!1,this.runningTimers.push(l),0===l.delay&&(l.onStart&&(l.onStart(),l._hasCalledOnStart=!0),l.onRunning&&l.onRunning(0));this.newTimers.length=0}}hasPendingTimers(){return this.runningTimers.length>0||this.newTimers.length>0}}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&&t)return this.graphModel.getVariant(e,t)}onVariantUpdated(e){const t=this.getNodeScope();if(!t)return;const n=t.getNodesWithTypeRecursive(e.typename).filter((t=>"object"==typeof t.variant?t.variant.name===e.name:"string"==typeof t.variant?t.variant===e.name:t.model&&t.model.variant===e.name));for(const t of n)t.setVariant(e)}}var q=n(2908),z=n(6351);class H{constructor(e,t){this.context=e,this.nodes={},this.componentOwner=t,this.componentInstanceChildren={}}verifyData(e,t){t.forEach((t=>{if(!e[t])throw new Error("Missing "+t)}))}addConnection(e){try{this.verifyData(e,["sourceId","sourcePort","targetId","targetPort"])}catch(e){throw new Error("Error in connection: "+e.message)}try{const t=this.getNodeWithId(e.sourceId),n=this.getNodeWithId(e.targetId);n.registerInputIfNeeded(e.targetPort),t.registerOutputIfNeeded(e.sourcePort),n.connectInput(e.targetPort,t,e.sourcePort)}catch(e){console.error(e.message)}}setNodeParameters(e,t){const n=this.context.variants.getVariant(t.type,t.variant);if(n)e.setVariant(n);else{const n=t.parameters||{};let o=Object.keys(n);if(this.context.nodeRegister.hasNode(e.name)){const t=this.context.nodeRegister.getNodeMetadata(e.name);t.inputs&&o.sort(((e,n)=>{var o,i;const s=t.inputs[e],r=t.inputs[n];return(null!==(o=null==r?void 0:r.inputPriority)&&void 0!==o?o:0)-(null!==(i=null==s?void 0:s.inputPriority)&&void 0!==i?i:0)}))}o.forEach((t=>{e.registerInputIfNeeded(t),!1!==e.hasInput(t)&&e.queueInput(t,n[t])}))}}async createNodeFromModel(e,t){if("Component Children"===e.type){if(e.parent){const t=this.getNodeWithId(e.parent.id);this.componentOwner.setChildRoot(t)}return}let n;try{n=await this.createNode(e.type,e.id),n.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}insertNodeInTree(e,t){if(!t.parent)throw new Error("Cannot insert node without parent");const n=this.getNodeWithId(t.parent.id),o=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,o)}getNodeWithId(e){if(!this.nodes.hasOwnProperty(e))throw new Error("Unknown node id "+e);return this.nodes[e]}hasNodeWithId(e){return this.nodes.hasOwnProperty(e)}createPrimitiveNode(e,t,n){if(t||(t=(0,z.Os)()),this.nodes.hasOwnProperty(t))throw Error("duplicate id "+t);const o=this.context.nodeRegister.createNode(e,t,this);if(n)for(const e in n)o[e]=n[e];return this.nodes[t]=o,o}async createNode(e,t,n){if(t||(t=(0,z.Os)()),this.nodes.hasOwnProperty(t))throw Error("duplicate id "+t);let o;if(this.context.nodeRegister.hasNode(e)){if(o=this.context.nodeRegister.createNode(e,t,this),n)for(const e in n)o[e]=n[e]}else o=await this.context.createComponentInstanceNode(e,t,this,n),this.componentInstanceChildren[t]=o;return this.nodes[t]=o,o}getNodesWithIdRecursive(e){const t=[];return function e(t,n,o){t.nodes.hasOwnProperty(n)&&o.push(t.nodes[n]),Object.keys(t.nodes).filter((e=>t.nodes[e]instanceof X)).forEach((i=>{const s=t.nodes[i].nodeScope;s&&e(s,n,o)}))}(this,e,t),t}getNodesWithType(e){return Object.keys(this.nodes).filter((t=>this.nodes[t].name===e)).map((e=>this.nodes[e]))}getNodesWithTypeRecursive(e){let t=[];return(()=>{t=t.concat(this.getNodesWithType(e)),Object.keys(this.nodes).filter((e=>this.nodes[e]instanceof X)).forEach((n=>{const o=this.nodes[n];if(o&&o.nodeScope){const n=o.nodeScope.getNodesWithTypeRecursive(e);t=t.concat(n)}}))})(),t}getAllNodesRecursive(){let e=[];return(()=>{e=e.concat(Object.values(this.nodes)),Object.keys(this.nodes).filter((e=>this.nodes[e]instanceof X)).forEach((t=>{const n=this.nodes[t];if(n&&n.nodeScope){const t=n.nodeScope.getAllNodesRecursive();e=e.concat(t)}}))})(),e}getAllNodesWithVariantRecursive(e){return this.getAllNodesRecursive().filter((t=>t.variant===e))}onNodeModelRemoved(e){const t=this.getNodeWithId(e.id);e.parent&&this.getNodeWithId(e.parent.id).removeChild(t),t._onNodeDeleted(),delete this.nodes[t.id],delete this.componentInstanceChildren[t.id]}removeConnection(e){this.getNodeWithId(e.targetId).removeInputConnection(e.targetPort,e.sourceId,e.sourcePort)}async setComponentModel(e){var t;this.componentModel=e;const n=[];for(const t of e.getAllNodes()){const e=await this.createNodeFromModel(t,!1);e&&n.push(e)}e.getAllConnections().forEach((e=>this.addConnection(e))),n.forEach((e=>e.updateOnDirtyFlagging=!0)),n.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),e.on("nodeParentWillBeRemoved",(e=>{if("Component Children"===e.type)return void(e.parent&&this.componentOwner.setChildRoot(null));const t=this.getNodeWithId(e.id);t.parent&&t.parent.removeChild(t)}),this),e.on("nodeParentUpdated",(e=>{if("Component Children"===e.type){const t=e.parent?this.getNodeWithId(e.parent.id):null;this.componentOwner.setChildRoot(t)}else{const t=this.getNodeWithId(e.id);this.insertNodeInTree(t,e)}}),this),e.on("nodeRemoved",(e=>{"Component Children"!==e.type&&this.onNodeModelRemoved(e)}),this);for(const e in this.nodes){const n=this.nodes[e];null===(t=null==n?void 0:n.nodeScopeDidInitialize)||void 0===t||t.call(n)}}reset(){this.componentModel&&(this.componentModel.removeListenersWithRef(this),this.componentModel=void 0),Object.keys(this.nodes).forEach((e=>{this.nodes.hasOwnProperty(e)&&this.deleteNode(this.nodes[e])}))}deleteNode(e){if(this.nodes.hasOwnProperty(e.id)){if(e.parent&&e.parent.removeChild(e),e.getChildren&&e.getChildren().forEach((t=>{e.removeChild(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=>{this.nodes.hasOwnProperty(e.targetId)&&this.nodes.hasOwnProperty(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)}sendEventFromThisScope(e,t,n,o){var i,s;if(o){const n=this.getNodesWithType("Event Receiver").filter((t=>t.getChannelName()===e));for(let e=0;e<n.length;e++)if(n[e].handleEvent(t))return!0}if("parent"===n&&this.componentOwner.parentNodeScope){const o=this.componentOwner.parent?this.componentOwner.parent.nodeScope:this.componentOwner.parentNodeScope;return!!o&&o.sendEventFromThisScope(e,t,n,!0)}if("children"===n){const o=this.nodes;for(const s in o){const r=o[s].children;if(r)for(const o of r)if(o.name&&this.context.hasComponentModelWithName(o.name)&&(null===(i=o.nodeScope)||void 0===i?void 0:i.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!1;const o=n.nodes;for(const n in o){const i=o[n].children;if(i){const n=i.filter((e=>e.name&&this.context.hasComponentModelWithName(e.name)&&e.nodeScope!==this));for(const o of n)if(null===(s=o.nodeScope)||void 0===s?void 0:s.sendEventFromThisScope(e,t,void 0,!0))return!0}}}return!1}}let G=0;class X extends q.b{constructor(e,t,n){super(e,t),this.nodeScope=new H(e,this),this.parentNodeScope=n,this._internal={childRoot:null,componentOutputValues:{},componentOutputs:[],componentInputs:[],inputValues:{},roots:[],instanceId:"__$ndl_componentInstaceId"+G},this.nodeScope.modelScope=n?n.modelScope:void 0,G++}async setComponentModel(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(){this.componentModel&&(this.componentModel.removeListenersWithRef(this),this.componentModel=void 0),this.nodeScope.reset(),super._onNodeDeleted()}registerComponentInputPort(e){this.registerInput(e.name,{set:function(t){this._internal.inputValues[e.name]=t,this._internal.componentInputs.forEach((function(t){t.registerOutputIfNeeded(e.name),t.flagOutputDirty(e.name)}))}})}registerComponentOutputPort(e){this.registerOutput(e.name,{getter(){return this._internal.componentOutputValues[e.name]}})}setOutputFromComponentOutput(e,t){var n,o;!1!==this.hasOutput(e)&&(null===(o=null===(n=this._internal.creatorCallbacks)||void 0===n?void 0:n.onOutputChanged)||void 0===o||o.call(n,e,t,this._internal.componentOutputValues[e]),this._internal.componentOutputValues[e]=t,this.flagOutputDirty(e))}setChildRoot(e){const t=this._internal.childRoot,n=e;if(this._internal.childRoot=n,this.model&&this.model.children){const e=this.parentNodeScope,o=this.model.children.filter((e=>"Component Children"!==e.type)).map((t=>null==e?void 0:e.getNodeWithId(t.id)));if(t)for(let e=0;e<o.length;e++)t.isChild(o[e])&&t.removeChild(o[e]);if(n)for(let e=0;e<o.length;e++){const t=o[e],n=t.model.parent.children.indexOf(t.model);this.addChild(t,n)}}}getChildRootIndex(){var e,t;if(!(null===(t=null===(e=this._internal.childRoot)||void 0===e?void 0:e.model)||void 0===t?void 0:t.children))return 0;const n=this._internal.childRoot.model.children;for(let e=0;e<n.length;e++)if("Component Children"===n[e].type)return e;return 0}getChildRoot(){return this._internal.childRoot?this._internal.childRoot:null}getRoots(){return this._internal.roots}triggerDidMount(){this._internal.roots.forEach((e=>{var t;null===(t=e.triggerDidMount)||void 0===t||t.call(e)}))}render(){return 0===this._internal.roots.length?null:this._internal.roots[0].render()}setChildIndex(e){this.getRoots().forEach((t=>{var n;return null===(n=t.setChildIndex)||void 0===n?void 0:n.call(t,e)}))}addChild(e,t){this.getChildRoot().addChild(e,t+this.getChildRootIndex())}removeChild(e){this.getChildRoot().removeChild(e)}getChildren(){const e=this.getChildRoot();return e?e.getChildren():[]}isChild(e){return!!this.getChildRoot()&&this.getChildRoot().isChild(e)}contains(e){return this.getRoots().some((t=>{var n;return null===(n=t.contains)||void 0===n?void 0:n.call(t,e)}))}_performDirtyUpdate(){super._performDirtyUpdate();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(){const e=this._internal.roots[0];return e?e.getRef():void 0}update(){super.update(),this._internal.componentOutputs.forEach((function(e){e.update()}))}forceUpdate(){this.parent&&(this.parent.cachedChildren=void 0,this.parent.forceUpdate())}getInstanceId(){return this._internal.instanceId}}class Y{constructor(e={}){var t;this.isUpdating=!1;const n=!!e.hasOwnProperty("runningInEditor")&&e.runningInEditor;this._dirtyNodes=[],this.callbacksAfterUpdate=[],this.graphModel=e.graphModel,this.platform=e.platform,this.eventEmitter=new U.b,this.eventSenderEmitter=new U.b,this.globalValues={},this.globalsEventEmitter=new U.b,this.runningInEditor=!!n,this.currentFrameTime=0,this.frameNumber=0,this.updateIteration=0,this.nodeRegister=new W(this),this.timerScheduler=new B(this.scheduleUpdate.bind(this)),this.componentModels={},this.debugInspectorsEnabled=!1,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 $({graphModel:this.graphModel,getNodeScope:()=>this.rootComponent?this.rootComponent.nodeScope:null}),this.editorConnection&&(this.editorConnection.on("debugInspectorsUpdated",(e=>{this.onDebugInspectorsUpdated(e)})),null===(t=this.editorConnection)||void 0===t||t.on("getConnectionValue",(({clientId:e,connectionId:t})=>{var n,o;if((null===(n=this.editorConnection)||void 0===n?void 0:n.clientId)!==e)return;const i=this._outputHistory[t];null===(o=this.editorConnection)||void 0===o||o.sendConnectionValue(t,i?i.value:void 0)})))}setRootComponent(e){this.rootComponent=e}getCurrentTime(){return this.platform.getCurrentTime()}onDebugInspectorsUpdated(e){this.debugInspectorsEnabled&&(e=e.map((e=>{if("connection"===e.type&&e.connection){const t=e.connection;e.id=t.fromId+t.fromProperty}else"node"===e.type&&e.nodeId&&(e.id=e.nodeId);return e})),this.debugInspectors={},e.forEach((e=>this.debugInspectors[e.id]=e)),this.sendDebugInspectorValues())}updateDirtyNodes(){let e,t,n=!0,o=0;for(this.updateIteration++,this.isUpdating=!0;n&&o<10;){const i=this._dirtyNodes;for(this._dirtyNodes=[],e=0,t=i.length;e<t;++e)try{i[e]._deleted||i[e].update()}catch(e){console.error(e)}const s=this.callbacksAfterUpdate;for(this.callbacksAfterUpdate=[],e=0,t=s.length;e<t;e++)try{s[e]()}catch(e){console.error(e)}n=this.callbacksAfterUpdate.length>0||this._dirtyNodes.length>0,o++}this.isUpdating=!1}update(){this.frameNumber++,this.updateDirtyNodes(),this.timerScheduler.hasPendingTimers()&&(this.scheduleUpdate(),this.timerScheduler.runTimers(this.currentFrameTime)),this.debugInspectorsEnabled&&this.sendDebugInspectorValues()}reset(){this.eventEmitter.emit("applicationDataReloaded");const 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()}nodeIsDirty(e){this._dirtyNodes.push(e),this.scheduleUpdate()}scheduleUpdate(){this.eventEmitter.emit("scheduleUpdate")}scheduleAfterUpdate(e){this.callbacksAfterUpdate.push(e),this.scheduleUpdate()}scheduleNextFrame(e){this.eventEmitter.once("frameStart",e),this.scheduleUpdate()}setGlobalValue(e,t){this.globalValues[e]=t,this.globalsEventEmitter.emit(e)}getGlobalValue(e){return this.globalValues[e]}registerComponentModel(e){if(this.componentModels.hasOwnProperty(e.name))throw new Error("Duplicate component name "+e.name);this.componentModels[e.name]=e,e.on("renamed",(t=>{delete this.componentModels[t.oldName],this.componentModels[t.newName]=e}),this)}deregisterComponentModel(e){this.componentModels.hasOwnProperty(e.name)&&(this.componentModels[e.name].removeListenersWithRef(this),delete this.componentModels[e.name])}async fetchComponentBundle(e){const t=async e=>{const t=`${window.Noodl.Env.BaseUrl||"/"}noodl_bundles/${e}.json`,n=await fetch(t);if(404===n.status)throw new Error("Component not found "+e);const o=await n.json();for(const e of o)!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}}async getComponentModel(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]}hasComponentModelWithName(e){return this.componentModels.hasOwnProperty(e)}async createComponentInstanceNode(e,t,n,o){const i=new X(this,t,n);if(i.name=e,o)for(const e in o)i[e]=o[e];const s=await this.getComponentModel(e);return await i.setComponentModel(s),i}_formatConnectionValue(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}connectionSentValue(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 o=[];e.connections.forEach((t=>{o.push(e.owner.id+e.name+t.node.id+t.inputPortName)})),this.connectionsToPulse[e.id]={timestamp:n,connections:o},this.connectionsToPulseChanged=!0,!1===this.connectionPulsingCallbackScheduled&&(this.connectionPulsingCallbackScheduled=!0,setTimeout(this.clearOldConnectionPulsing.bind(this),100))}connectionSentSignal(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)}clearDebugInspectors(){var e;this.debugInspectors={},this.connectionsToPulse={},null===(e=this.editorConnection)||void 0===e||e.sendPulsingConnections(this.connectionsToPulse)}clearOldConnectionPulsing(){var e;this.connectionPulsingCallbackScheduled=!1;const t=this.getCurrentTime();Object.keys(this.connectionsToPulse).forEach((e=>{const n=this.connectionsToPulse[e];t-n.timestamp>100&&(this.connectionsToPulseChanged=!0,delete this.connectionsToPulse[e])})),this.connectionsToPulseChanged&&(this.connectionsToPulseChanged=!1,null===(e=this.editorConnection)||void 0===e||e.sendPulsingConnections(this.connectionsToPulse)),Object.keys(this.connectionsToPulse).length>0&&(this.connectionPulsingCallbackScheduled=!0,setTimeout(this.clearOldConnectionPulsing.bind(this),500))}_getDebugInspectorValueForNode(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}}}sendDebugInspectorValues(){var e,t;const n=[];for(const e in this.debugInspectors){const t=this.debugInspectors[e];if("connection"===t.type&&this._outputHistory.hasOwnProperty(e)){const t=this._outputHistory[e].value;n.push({type:"connection",id:e,value:this._formatConnectionValue(t)})}else if("node"===t.type){const t=this._getDebugInspectorValueForNode(e);t&&n.push(t)}}n.length>0&&(null===(e=this.editorConnection)||void 0===e||e.sendDebugInspectorValues(n)),this.connectionsToPulseChanged&&(this.connectionsToPulseChanged=!1,null===(t=this.editorConnection)||void 0===t||t.sendPulsingConnections(this.connectionsToPulse))}setDebugInspectorsEnabled(e){this.debugInspectorsEnabled=e,this.editorConnection,e&&this.sendDebugInspectorValues()}sendGlobalEventFromEventSender(e,t){this.eventSenderEmitter.emit(e,t)}setPopupCallbacks(e){this.onShowPopup=e.onShow,this.onClosePopup=e.onClose}async showPopup(e,t,n){if(!this.onShowPopup)return;const o=this.rootComponent.nodeScope,i=await o.createNode(e);for(const e in t)i.setInputValue(e,t[e]);i.popupParent=(null==n?void 0:n.senderNode)||null;const s=o.createPrimitiveNode("Group");s.setInputValue("flexDirection","node"),s.setInputValue("cssClassName","noodl-popup");const r=this.graphModel.getSettings().bodyScroll;s.setInputValue("position",r?"fixed":"absolute");const a=i.nodeScope.getNodesWithType("NavigationClosePopup");if(a&&a.length>0)for(let e=0;e<a.length;e++)a[e]._setCloseCallback(((e,t)=>{this.scheduleNextFrame((()=>{var i,r;o.hasNodeWithId(s.id)&&(null===(i=this.onClosePopup)||void 0===i||i.call(this,s),o.deleteNode(s),null===(r=null==n?void 0:n.onClosePopup)||void 0===r||r.call(n,e,t||{}))}))}));this.onShowPopup(s),requestAnimationFrame((()=>{s.addChild(i)}))}setWarningTypes(e){Object.assign(this.warningTypes,e)}isWarningTypeEnabled(e){return!this.warningTypes.hasOwnProperty(e)||!!this.warningTypes[e]}getDefaultValueForInput(e,t){var n;if(!1===this.nodeRegister.hasNode(e))return;const o=null===(n=this.nodeRegister.getNodeMetadata(e).inputs)||void 0===n?void 0:n[t];return o?o.type.defaultUnit?{value:o.default,unit:o.type.defaultUnit}:o.default:void 0}}class J{constructor(){this.listeners={},this.listenersWithRefs={}}on(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))}removeListenersWithRef(e){Object.keys(this.listenersWithRefs).forEach((t=>{const n=this.listenersWithRefs[t];n.has(e)&&n.delete(e)}))}removeAllListeners(e){e?(delete this.listeners[e],delete this.listenersWithRefs[e]):(this.listeners={},this.listenersWithRefs={})}async emit(e,t){const n=this.listeners[e];if(n){const e=[...n];for(const n of e)await Promise.resolve(n(t))}const o=this.listenersWithRefs[e];if(o)for(const[e,n]of o)for(const o of n)await Promise.resolve(o.call(e,t))}}class K{constructor(){this.currentWarnings=new Map}setWarning(e,t,n){if(this.currentWarnings.has(e)){const o=this.currentWarnings.get(e);return!(o&&o[t]===n||(o&&(o[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)}}class Q extends J{constructor(e={}){var t,n;super(),this.clientId="",this.dynamicPortsHash={},this.serviceRequests={},this.runtimeType=e.runtimeType,this.platform=e.platform||{getCurrentTime:()=>Date.now()},this.ws=(null===(t=e.platform)||void 0===t?void 0:t.webSocketClass)||("undefined"!=typeof WebSocket?WebSocket:void 0),this.wsOptions=null===(n=e.platform)||void 0===n?void 0:n.webSocketOptions,this.reconnectOnClose=!0,this.enableDebugger=!1,this.lastSendTimestamp=0,this.sendQueue=[],this.sendTimer=void 0,this.activeWarnings=new K}isRunningLocally(){return this.platform.isRunningLocally&&this.platform.isRunningLocally()||"undefined"!=typeof document&&("localhost"===document.location.hostname||"127.0.0.1"===document.location.hostname)}connect(e){this.socket=this.wsOptions?new this.ws(e,this.wsOptions):new this.ws(e),this.socket.addEventListener("open",(()=>{var e;this.clientId=(0,z.Os)(),null===(e=this.socket)||void 0===e||e.send(JSON.stringify({cmd:"register",type:"viewer",clientId:this.clientId})),this.emit("connected")})),this.socket.addEventListener("close",(t=>{this.reconnectOnClose&&this.reconnect(e),console.log("Editor connection closed",t.code,t.reason),this.emit("connectionClosed")})),this.socket.addEventListener("error",(()=>{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(),n=JSON.parse(t);let o;"registered"===n.cmd||("export"===n.cmd?(o=JSON.parse(n.content),"full"===n.type&&n.target===this.clientId&&this.emit("exportDataFull",o)):"hoverStart"===n.cmd?this.emit("hoverStart",n.content.id):"hoverEnd"===n.cmd?this.emit("hoverEnd",n.content.id):"refresh"===n.cmd?this.emit("reload"):"debugInspectors"===n.cmd?this.debugInspectorsEnabled&&(o=JSON.parse(n.content),this.emit("debugInspectorsUpdated",o.inspectors)):"debuggingEnabled"===n.cmd?this.isRunningLocally()&&(o=JSON.parse(n.content),this.emit("debuggingEnabledChanged",o.enabled)):"getConnectionValue"===n.cmd?this.isRunningLocally()&&(o=JSON.parse(n.content),await this.emit("getConnectionValue",{clientId:o.clientId,connectionId:o.connectionId})):"modelUpdate"===n.cmd?await this.emit("modelUpdate",n.content):"publish"===n.cmd||("noodlModules"===n.cmd?this.emit("noodlModules",JSON.parse(n.content)):"mqttUpdate"===n.cmd?this.emit("mqttUpdate",n.content):"activeComponentChanged"===n.cmd?this.emit("activeComponentChanged",n.component):console.log("Command not implemented",n)))}))}reconnect(e){setTimeout((()=>{this.connect(e)}),2e3)}isConnected(){return void 0!==this.socket&&this.socket.readyState===this.ws.OPEN}getCircularReplacer(){const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return"[Circular]";e.add(n)}return n}}send(e){const t=this.platform.getCurrentTime(),n=t-this.lastSendTimestamp,o=e=>{var t,n;try{null===(t=this.socket)||void 0===t||t.send(JSON.stringify(e))}catch(t){if(t.message&&t.message.startsWith("Converting circular"))try{null===(n=this.socket)||void 0===n||n.send(JSON.stringify(e,this.getCircularReplacer()))}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(!1!==this.isConnected()){for(let e=0;e<this.sendQueue.length;e+=50){const t=this.sendQueue.slice(e,e+50);o(t)}this.sendQueue=[],this.sendTimer=void 0,this.lastSendTimestamp=this.platform.getCurrentTime()}}),100))):(this.lastSendTimestamp=t,o(e))}sendInspectId(e){this.send({cmd:"select",type:"viewer",content:JSON.stringify({id:e})})}sendSelectComponent(e){this.send({cmd:"select",type:"viewer",content:JSON.stringify({componentName:e})})}sendPulsingConnections(e){const t=[];Object.keys(e).forEach((n=>{const o=e[n];t.push(...o.connections)})),this.send({cmd:"connectiondebugpulse",type:"viewer",content:JSON.stringify({connectionsToPulse:t})})}sendDebugInspectorValues(e){this.send({cmd:"debuginspectorvalues",type:"viewer",content:{inspectors:e}})}sendConnectionValue(e,t){this.send({cmd:"connectionValue",type:"viewer",content:{connectionId:e,value:t}})}_detectRename(e,t){if(!e||!t)return;if(e.length!==t.length)return;const n={};for(let o=0;o<e.length;o++){if(-1===t.indexOf(e[o])){if(n.before)return;n.before=e[o]}if(-1===e.indexOf(t[o])){if(n.after)return;n.after=t[o]}}return n.before&&n.after?{before:n.before,after:n.after}:void 0}sendDynamicPorts(e,t,n){const o=JSON.stringify(t);if(this.dynamicPortsHash[e]!==o){if(this.dynamicPortsHash[e]&&t&&n&&n.detectRenamed){const o=Array.isArray(n.detectRenamed)?n.detectRenamed:[n.detectRenamed],i=[];o.forEach((n=>{let o=JSON.parse(this.dynamicPortsHash[e]),s=[...t];n.prefix&&(o=o.filter((e=>e.name.startsWith(n.prefix))),s=s.filter((e=>e.name.startsWith(n.prefix)))),n.plug&&(o=o.filter((e=>e.plug===n.plug)),s=s.filter((e=>e.plug===n.plug))),s=s.map((e=>e.name.substring((n.prefix||"").length))),o=o.map((e=>e.name.substring((n.prefix||"").length)));const r=this._detectRename(o,s);r&&i.push({plug:n.plug,patterns:[(n.prefix||"")+"{{*}}"],before:r.before,after:r.after})})),i.length>0&&(n.renamed=i),delete n.detectRenamed}this.dynamicPortsHash[e]=o,this.send({cmd:"instanceports",type:"viewer",content:JSON.stringify({nodeid:e,ports:t,options:n})})}}sendWarning(e,t,n,o){this.activeWarnings.setWarning(t,n,o)&&this.send({cmd:"showwarning",type:"viewer",content:JSON.stringify({componentName:e,nodeId:t,key:n,warning:o})})}clearWarning(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})})}clearWarnings(e,t){this.activeWarnings.clearWarnings(t)&&this.send({cmd:"clearwarnings",type:"viewer",content:JSON.stringify({componentName:e,nodeId:t})})}sendPatches(e){this.send({cmd:"patchproject",type:"viewer",content:JSON.stringify(e)})}requestFullExport(){this.send({cmd:"register",type:"viewer"})}requestNoodlModules(){this.send({cmd:"getNoodlModules",type:"viewer"})}sendServiceRequest(e,t){e.token=(0,z.Os)(),e.clientId=this.clientId,this.serviceRequests[e.token]=t,this.send(e)}close(){var e;this.reconnectOnClose=!1,!1!==this.isConnected()&&(null===(e=this.socket)||void 0===e||e.close())}sendNodeLibrary(e){this.send({cmd:"nodelibrary",type:"viewer",runtimeType:this.runtimeType,content:e,clientId:this.clientId})}sendComponentMetadata(e,t,n){this.send({cmd:"componentMetadata",type:"viewer",content:JSON.stringify({componentName:e,key:t,data:n})})}sendProjectMetadata(e,t){this.send({cmd:"projectMetadata",type:"viewer",content:JSON.stringify({key:e,data:t})})}}function Z(e,t,n){const o={name:e,type:t.type,plug:n};return t.group&&(o.group=t.group),t.displayName&&(o.displayName=t.displayName),t.description&&(o.description=t.description),t.editorName&&(o.editorName=t.editorName),void 0!==t.default&&(o.default=t.default),t.hasOwnProperty("index")&&(o.index=t.index),t.tooltip&&(o.tooltip=t.tooltip),t.tab&&(o.tab=t.tab),t.popout&&(o.popout=t.popout),t.allowVisualStates&&(o.allowVisualStates=t.allowVisualStates),o}class ee extends J{constructor(e,t){super(),this.id=e,this.type=t,this.inputs=[],this.outputs=[],this.children=[],this.parameters={},this.inputPorts={},this.outputPorts={}}setParameter(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})}setParameters(e){Object.keys(e).forEach((t=>{this.setParameter(t,e[t])}))}setStateParameters(e){this.stateParameters=e}setStateTransitions(e){this.stateTransitions=e}setStateTransitionParamter(e,t,n){this.stateTransitions||(this.stateTransitions={}),t?this.stateTransitions[n][e]=t:delete this.stateTransitions[n][e]}setDefaultStateTransition(e,t){this.defaultStateTransitions||(this.defaultStateTransitions={}),this.defaultStateTransitions[t]=e}addInputPort(e){this.inputPorts[e.name]=e,this.emit("inputPortAdded",e)}getInputPort(e){return this.inputPorts[e]}getInputPorts(){return this.inputPorts}removeInputPortWithName(e){if(this.inputPorts.hasOwnProperty(e)){const t=this.inputPorts[e];delete this.inputPorts[e],this.emit("inputPortRemoved",t)}}updateInputPortTypes(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")}addOutputPort(e){this.outputPorts[e.name]=e,this.emit("outputPortAdded",e)}getOutputPort(e){return this.outputPorts[e]}getOutputPorts(){return this.outputPorts}removeOutputPortWithName(e){if(this.outputPorts.hasOwnProperty(e)){const t=this.outputPorts[e];delete this.outputPorts[e],this.emit("outputPortRemoved",t)}}updateOutputPortTypes(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")}addChild(e,t){e.parent=this,void 0===t?this.children.push(e):this.children.splice(t,0,e),this.emit("childAdded",e)}removeChild(e){e.parent=void 0;const t=this.children.indexOf(e);this.children.splice(t,1),this.emit("childRemoved",e)}reset(){this.removeAllListeners()}setVariant(e){this.variant=e,this.emit("variantUpdated",e)}static createFromExportData(e){const t=new ee(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((e=>{"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}}class te extends J{constructor(e){super(),this.name=e,this.nodes={},this.connections=[],this.roots=[],this.inputPorts={},this.outputPorts={},this.metadata={}}async addNode(e){e.component=this,this.nodes[e.id]=e,await this.emit("nodeAdded",e)}hasNodeWithId(e){return void 0!==this.getNodeWithId(e)}getNodeWithId(e){if(e)return this.nodes[e]}getAllNodes(){return Object.values(this.nodes)}getNodesWithType(e){const t=[];return Object.keys(this.nodes).forEach((n=>{const o=this.nodes[n];o.type===e&&t.push(o)})),t}addConnection(e){if(this.connections.push(e),this.emit("connectionAdded",e),e.targetId){const t=this.getNodeWithId(e.targetId);t&&t.emit("inputConnectionAdded",e)}}removeConnection(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&&(this.connections.splice(t,1),this.emit("connectionRemoved",e),e.targetId)){const t=this.getNodeWithId(e.targetId);t&&t.emit("inputConnectionRemoved",e)}}getConnectionsFromPort(e,t){return this.connections.filter((n=>n.sourceId===e&&n.sourcePort===t))}getConnectionsToPort(e,t){return this.connections.filter((n=>n.targetId===e&&n.targetPort===t))}getConnectionsFrom(e){return this.connections.filter((t=>t.sourceId===e))}getConnectionsTo(e){return this.connections.filter((t=>t.targetId===e))}addRootId(e){e&&-1===this.roots.indexOf(e)&&(this.roots.push(e),this.emit("rootAdded",e))}removeRootId(e){const t=this.roots.indexOf(e);-1!==t&&(this.roots.splice(t,1),this.emit("rootRemoved",e))}getRoots(){return this.roots}async removeNodeWithId(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,void 0),-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}getAllConnections(){return this.connections}getInputPorts(){return this.inputPorts}getOutputPorts(){return this.outputPorts}addInputPort(e){this.inputPorts[e.name]=e,this.emit("inputPortAdded",e)}addOutputPort(e){this.outputPorts[e.name]=e,this.emit("outputPortAdded",e)}removeOutputPortWithName(e){if(this.outputPorts.hasOwnProperty(e)){const t=this.outputPorts[e];delete this.outputPorts[e],this.emit("outputPortRemoved",t)}}removeInputPortWithName(e){if(this.inputPorts.hasOwnProperty(e)){const t=this.inputPorts[e];delete this.inputPorts[e],this.emit("inputPortRemoved",t)}}updateInputPortTypes(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")}updateOutputPortTypes(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")}renameInputPortOnNodeWithId(e,t,n){const o=this.getConnectionsToPort(e,t);o.forEach(this.removeConnection.bind(this));const i=this.getNodeWithId(e);if(!i)return;const s={...i.getInputPort(t)};s&&(i.removeInputPortWithName(t),s.name=n,i.addInputPort(s)),o.forEach((e=>{e.targetPort=n})),o.forEach(this.addConnection.bind(this))}renameOutputPortOnNodeWithId(e,t,n){const o=this.getConnectionsFromPort(e,t);o.forEach(this.removeConnection.bind(this));const i=this.getNodeWithId(e);if(!i)return;const s={...i.getOutputPort(t)};i.removeOutputPortWithName(t),s.name=n,i.addOutputPort(s),o.forEach((e=>{e.sourcePort=n})),o.forEach(this.addConnection.bind(this))}setNodeParent(e,t,n){e&&(-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)))}async importEditorNodeData(e,t,n){const o=ee.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)}}async reset(){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")}rename(e){const t=this.name;this.name=e,this.emit("renamed",{oldName:t,newName:e})}setMetadata(e,t){this.metadata[e]=t}getMetadata(e){return e?this.metadata[e]:this.metadata}static async createFromExportData(e){const t=new te(e.name);if(e.metadata)for(const n in e.metadata)t.setMetadata(n,e.metadata[n]);if(e.ports&&e.ports.forEach((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}}class ne extends J{constructor(){super(),this.componentToBundleMap=new Map,this.variants=[],this.components={},this.settings={},this.metadata={}}async importComponentFromEditorData(e){const t=await te.createFromExportData(e);this.addComponent(t)}getBundleContainingComponent(e){return this.componentToBundleMap.get(e)}getBundlesContainingSheet(e){const t=new Set;for(const n of this.componentToBundleMap.keys()){const o=0!==n.indexOf("/#");(o&&"Default"===e||!o&&0===n.indexOf("/#"+e))&&t.add(this.componentToBundleMap.get(n))}return Array.from(t)}getBundleDependencies(e){const t=new Set,n=e=>{var o;const i=null===(o=this.componentIndex)||void 0===o?void 0:o[e];if(i)for(const e of i.dependencies)t.has(e)||(t.add(e),n(e))};return n(e),Array.from(t)}async importEditorData(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);for(const t of e.components)await this.importComponentFromEditorData(t);this.setRootComponentName(e.rootComponent)}setRootComponentName(e){this.rootComponent=e,this.emit("rootComponentNameUpdated",e)}getNodesWithType(e){let t=[];const n=Object.keys(this.components);for(let o=0;o<n.length;o++){const i=this.components[n[o]];t=t.concat(i.getNodesWithType(e))}return t}getComponentWithName(e){return this.components[e]}hasComponentWithName(e){return!!this.components[e]}getAllComponents(){return Object.keys(this.components).map((e=>this.components[e]))}getAllNodes(){let e=[];const t=Object.keys(this.components);for(let n=0;n<t.length;n++){const o=this.components[t[n]];e=e.concat(o.getAllNodes())}return e}addComponent(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),this.emit("componentAdded",e)}async removeComponentWithName(e){if(!e)return;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)}renameComponent(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)}_addComponentPorts(e){if(this.components.hasOwnProperty(e.type)){const t=this.components[e.type],n=t.getInputPorts(),o=t.getOutputPorts();Object.keys(n).forEach((t=>{e.addInputPort(n[t])})),Object.keys(o).forEach((t=>{e.addOutputPort(o[t])}))}}_onNodeAdded(e){this._addComponentPorts(e),this.emit("nodeAdded",e),this.emit("nodeAdded."+e.type,e)}_onNodeRemoved(e){this.emit("nodeRemoved",e),this.emit("nodeRemoved."+e.type,e)}_onNodeWasRemoved(e){this.emit("nodeWasRemoved",e),this.emit("nodeWasRemoved."+e.type,e)}async reset(){for(const e of Object.keys(this.components))await this.removeComponentWithName(e);this.setSettings({})}isEmpty(){return 0===Object.keys(this.components).length}setSettings(e){this.settings=e,this.emit("projectSettingsChanged",e)}getSettings(){return this.settings}setAllMetaData(e){for(const t in e)this.setMetaData(t,e[t])}setMetaData(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))}getMetaData(e){return e?this.metadata[e]:this.metadata}getVariants(){return this.variants||[]}getVariant(e,t){return this.variants.find((n=>n.name===t&&n.typename===e))}updateVariant(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)}updateVariantParameter(e,t,n,o,i){const s=this.getVariant(t,e);s?(i?(s.stateParameters.hasOwnProperty(i)||(s.stateParameters[i]={}),void 0===o?delete s.stateParameters[i][n]:s.stateParameters[i][n]=o):void 0===o?delete s.parameters[n]:s.parameters[n]=o,this.emit("variantUpdated",s)):console.log("updateVariantParameter: can't find variant",e,t)}updateVariantDefaultStateTransition(e,t,n,o){const i=this.getVariant(t,e);i&&(i.defaultStateTransitions[o]=n,this.emit("variantUpdated",i))}updateVariantStateTransition(e){const{variantTypeName:t,variantName:n,state:o,parameterName:i,curve:s}=e,r=this.getVariant(t,n);r&&(r.stateTransitions[o]||(r.stateTransitions[o]={}),r.stateTransitions[o][i]=s)}deleteVariant(e,t){const n=this.variants.findIndex((n=>n.name===t&&n.typename===e));-1!==n&&this.variants.splice(n,1)}}function oe(e,t){const n=new Set(t);return e.filter((e=>!n.has(e)))}async function ie(e,t,n){function o(t,n){const o={},s={};n.forEach((e=>{"input"!==e.plug&&"input/output"!==e.plug||(o[e.name]=e),"output"!==e.plug&&"input/output"!==e.plug||(s[e.name]=e)}));const r=Object.keys(t.getInputPorts()),a=oe(r,Object.keys(o)),l=oe(Object.keys(o),r);t.updateInputPortTypes(o),a.forEach(t.removeInputPortWithName.bind(t)),l.forEach((n=>{var s;t.addInputPort(o[n]),t instanceof ee&&(null===(s=t.parameters)||void 0===s?void 0:s.hasOwnProperty(n))&&i(e.rootComponent.nodeScope,t,n,t.parameters[n])})),t.updateOutputPortTypes(s);const d=Object.keys(t.getOutputPorts()),u=oe(d,Object.keys(s)),c=oe(Object.keys(s),d);u.forEach(t.removeOutputPortWithName.bind(t)),c.forEach((e=>{t.addOutputPort(s[e])}))}function i(e,t,n,o){e.getNodesWithIdRecursive(t.id).forEach((e=>{e.queueInput(n,o)}))}let s;if(n.componentName&&(s=t.getComponentWithName(n.componentName),!s))return;if(!s)throw new Error("Component model not found");const r={nodeAdded:e=>{null==s||s.importEditorNodeData(e.model,e.parentId,e.childIndex)},nodeRemoved:async e=>{(null==s?void 0:s.hasNodeWithId(e.model.id))&&await s.removeNodeWithId(e.model.id)},connectionAdded:e=>{null==s||s.addConnection(e.model)},connectionRemoved:t=>{if(!s)return;s.removeConnection(t.model);const n=s.getNodeWithId(t.model.targetId);if(0===s.getConnectionsToPort(n.id,t.model.targetId).length){let o=n.parameters[t.model.targetPort];void 0===o&&(o=e.getDefaultValueForInput(n.type,t.model.targetPort)),i(e.rootComponent.nodeScope,n,t.model.targetPort,o)}},parameterChanged:e=>{if(!s)return;const t=s.getNodeWithId(e.nodeId);if(void 0!==t){if(e.parameters){const n=new Set([...Object.keys(e.parameters),...Object.keys(e.oldParameters)]);for(const o of n)t.setParameter(o,e.parameters[o])}e.parameterName&&t.setParameter(e.parameterName,e.parameterValue,e.state)}else console.log("parameterChanged: Unknown node id",e)},nodeAttached:e=>{s&&s.setNodeParent(s.getNodeWithId(e.nodeId),s.getNodeWithId(e.parentId),e.childIndex)},nodeDetached:e=>{s&&(s.setNodeParent(s.getNodeWithId(e.nodeId),null),s.addRootId(e.nodeId))},componentAdded:e=>{t.importComponentFromEditorData(e.model)},componentRemoved:async e=>{await t.removeComponentWithName(e.componentName)},rootAdded:e=>{null==s||s.addRootId(e.nodeId)},portAdded:t=>{if(!s)return;const n=s.getNodeWithId(t.nodeId);t.port&&n&&("input"!==t.port.plug&&"input/output"!==t.port.plug||(n.addInputPort(t.port),n.parameters.hasOwnProperty(t.port.name)&&i(e.rootComponent.nodeScope,n,t.port.name,n.parameters[t.port.name])),"output"!==t.port.plug&&"input/output"!==t.port.plug||n.addOutputPort(t.port))},portRemoved:e=>{if(!s)return;const t=s.getNodeWithId(e.nodeId);e.port&&t&&("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:e=>{if(!e.port||!s)return;"input"!==e.port.plug&&"input/output"!==e.port.plug||e.nodeId&&e.oldName&&s.renameInputPortOnNodeWithId(e.nodeId,e.oldName,e.port.name),e.nodeId&&e.oldName&&("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"===(null==n?void 0:n.type)?(s.addInputPort(e.port),t.getNodesWithType(s.name).forEach((t=>{var n;t.component.renameInputPortOnNodeWithId(t.id,e.oldName,null===(n=e.port)||void 0===n?void 0:n.name)})),s.removeInputPortWithName(e.oldName)):"Component Outputs"===(null==n?void 0:n.type)&&(s.addOutputPort(e.port),t.getNodesWithType(s.name).forEach((t=>{var n;t.component.renameOutputPortOnNodeWithId(t.id,e.oldName,null===(n=e.port)||void 0===n?void 0:n.name)})),s.removeOutputPortWithName(e.oldName))},componentPortsUpdated:e=>{s&&o(s,e.ports)},instancePortsChanged:e=>{if(!s.hasNodeWithId(e.nodeId))return;const t=s.getNodeWithId(e.nodeId);t&&o(t,e.ports)},componentRenamed:e=>{t.renameComponent(e.oldName,e.newName)},settingsChanged:e=>{t.setSettings(e.settings)},metadataChanged:e=>{t.setMetaData(e.key,e.data)},componentMetadataChanged:e=>{const n=t.getComponentWithName(e.componentName);n&&n.setMetadata(e.key,e.data)},variantParametersChanged: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 o=t.getVariant(n.variantTypeName,n.variantName);e.rootComponent.nodeScope.getAllNodesWithVariantRecursive(o).forEach((e=>{e.queueInput(n.parameterName,e.getParameter(n.parameterName))}))}},variantDeleted:e=>{t.deleteVariant(e.variantTypeName,e.variantName)},variantChanged:e=>{const n=s.getNodeWithId(e.nodeId);if(n){const o=t.getVariant(n.type,e.variantName);n.setVariant(o)}},variantRenamed:e=>{const n=t.getVariant(e.variantTypeName,e.oldVariantName);(null==n?void 0:n.variantName)&&(n.name=n.variantName)},defaultStateTransitionChanged:e=>{const t=s.getNodeWithId(e.nodeId);null==t||t.setDefaultStateTransition(e.curve,e.state)},stateTransitionsChanged:e=>{const t=s.getNodeWithId(e.nodeId);t&&e.parameterName&&t.setStateTransitionParamter(e.parameterName,e.curve,e.state)},variantDefaultStateTransitionChanged:e=>{t.updateVariantDefaultStateTransition(e.variantName,e.variantTypeName,e.curve,e.state)},variantStateTransitionsChanged:e=>{t.updateVariantStateTransition(e)},routerIndexChanged:e=>{t.routerIndex=e.data}};r.hasOwnProperty(n.type)?(await r[n.type](n),e.scheduleUpdate()):console.log("Unknown event",n)}class se{}se.events=new U.b;var re=n(1142);function ae(e,t,n){const o=e.registerInputIfNeeded;e.registerInputIfNeeded=function(i){if(o&&o.call(e,i),e.hasInput(i)||!i.startsWith(t))return;const s=Number(i.slice(t.length+1));e.registerInput(i,{type:n.type,set:n.createSetter.call(e,s)})}}function le(e){if(!e.category)throw new Error("Node must have a category");if(!e.name)throw new Error("Node must have a 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,haveComponentPorts:e.haveComponentPorts,version:e.version,module:e.module,docs:e.docs,allowAsExportRoot:e.allowAsExportRoot,nodeDoubleClickAction:e.nodeDoubleClickAction,searchTags:e.searchTags};e._internal=e._internal||{},e.prototypeExtensions=e.methods||e.prototypeExtensions||{},e.inputs=e.inputs||{},e.outputs=e.outputs||{},e.initialize=e.initialize||function(){};const n={};(function(e,t,n){Object.keys(n).forEach((function(o){!function(e,t,n,o){if(e.hasOwnProperty(n))throw new Error("Input property "+n+" already registered");o.set||o.valueChangedToTrue||(o.set=()=>{}),o.set&&(e[n]={set:o.set},["color","textStyle","array"].forEach((t=>{!o.type||o.type!==t&&o.type.name!==t||(e[n].type=t)}))),o.setUnitType&&(e[n].setUnitType=o.setUnitType),t.inputs=t.inputs||{},t.inputs[n]={displayName:o.displayName,editorName:o.editorName,group:o.group,type:o.type,default:o.default,index:o.index,exportToEditor:!o.hasOwnProperty("exportToEditor")||o.exportToEditor,inputPriority:o.inputPriority||0,tooltip:o.tooltip,tab:o.tab,popout:o.popout,allowVisualStates:o.allowVisualStates,nodeDoubleClickAction:o.nodeDoubleClickAction},o.valueChangedToTrue&&(t.inputs[n].type={name:"signal",allowConnectionsOnly:!0})}(e,t,o,n[o])}))})(n,t,e.inputs),function(e,t){Object.keys(t).forEach((function(n){const o=t[n];e.outputs=e.outputs||{},e.outputs[n]={displayName:o.displayName,editorName:o.editorName,group:o.group,type:o.type,index:o.index,exportToEditor:!o.hasOwnProperty("exportToEditor")||o.exportToEditor}}))}(t,e.outputs);class o extends q.b{constructor(e,t){super(e,t)}}e.prototypeExtensions&&Object.keys(e.prototypeExtensions).forEach((function(t){e.prototypeExtensions[t].value||(e.prototypeExtensions[t]={value:e.prototypeExtensions[t]})})),Object.defineProperties(o.prototype,e.prototypeExtensions),Object.defineProperty(o.prototype,"name",{value:e.name}),e.getInspectInfo&&(o.prototype.getInspectInfo=e.getInspectInfo),e.nodeScopeDidInitialize&&(o.prototype.nodeScopeDidInitialize=e.nodeScopeDidInitialize);const i=function(s,r,a){var l;const d=new o(s,r);if(d._inputs=Object.create(n),e.inputs)return Object.keys(e.inputs).forEach((function(t){const n=e.inputs[t];n.valueChangedToTrue&&(d._inputs[t]={set:(0,re.i)({valueChangedToTrue:n.valueChangedToTrue})})})),e.outputs?(Object.keys(e.outputs).forEach((function(t){const n=e.outputs[t];"signal"===n.type?d.registerOutput(t,{getter(){}}):d.registerOutput(t,n)})),e.numberedInputs&&function(e,t){for(const n of Object.keys(t))ae(e,n,t[n])}(d,e.numberedInputs),d.nodeScope=a,u=d._inputValues,c=t.inputs||{},Object.keys(c).forEach((e=>{const t=c[e].default;void 0!==t&&(c[e].type.defaultUnit?u[e]={unit:c[e].type.defaultUnit,value:t}:u[e]=t)})),null===(l=e.initialize)||void 0===l||l.call(d),d):(Object.assign(i,{metadata:t}),e.numberedInputs&&function(e,t,n){const o=Object.keys(n);o.length&&(e.setupNumberedInputDynamicPorts=function(e,i){const s=e.editorConnection;function r(e){const t=o.map((t=>function(e,t,n){const o=e.component.getConnectionsTo(e.id).map((e=>e.targetPort)),i=Object.keys(e.parameters).concat(o).filter((e=>e.startsWith(t+" "))),s=(i.length?1+Math.max(...i.map((e=>Number(e.slice(t.length+1))))):0)+1,r=[];for(let e=0;e<s;e++){const o={name:t+" "+e,displayName:(n.displayPrefix||t)+" "+e,type:n.type,plug:"input",group:n.group};n.hasOwnProperty("index")&&(o.index=n.index+e),r.push(o)}return r}(e,t,n[t]))).flat();null==s||s.sendDynamicPorts(e.id,t)}s&&s.isRunningLocally()&&i.on("nodeAdded."+t,(e=>{r(e),e.on("parameterUpdated",(()=>{r(e)})),e.on("inputConnectionAdded",(()=>{r(e)})),e.on("inputConnectionRemoved",(()=>{r(e)}))}))})}(i,e.name,e.numberedInputs),i);var u,c};return i.metadata=t,i}const de={name:"Component Inputs",shortDesc:"This node is used to define the inputs of a component.",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(){var e;return{type:"value",value:null===(e=this.nodeScope)||void 0===e?void 0:e.componentOwner._internal.inputValues}},color:"component",haveComponentPorts:!0,category:"Component Utilities",methods:{registerOutputIfNeeded(e){this.hasOutput(e)||this.registerOutput(e,{getter(){var t;return null===(t=this.nodeScope)||void 0===t?void 0:t.componentOwner._internal.inputValues[e]}})},_updateDependencies(){var e,t;null===(t=null===(e=this.nodeScope)||void 0===e?void 0:e.componentOwner)||void 0===t||t.update()}}},ue={category:"Component Utilities",name:"Component Outputs",shortDesc:"This node is used to define the outputs of a component.",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(t){var n,o;null===(o=null===(n=this.nodeScope)||void 0===n?void 0:n.componentOwner)||void 0===o||o.setOutputFromComponentOutput(e,t)}})}}};var ce=n(8763);const pe={name:"RunTasks",displayNodeName:"Run Tasks",docs:"https://docs.noodl.net/nodes/data/run-tasks",color:"data",category:"Data",initialize(){this._internal={queuedOperations:[],state:"idle",maxRunningTasks:10,activeTasks:new Map}},inputs:{items:{group:"Data",displayName:"Items",type:"array",set(e){e&&e!==this._internal.items&&(this._internal.items=e)}},stopOnFailure:{group:"General",displayName:"Stop On Failure",type:"boolean",default:!1,set(e){this._internal.stopOnFailure=e}},maxRunningTasks:{group:"General",displayName:"Max Running Tasks",type:"number",default:10,set(e){this._internal.maxRunningTasks=e}},taskTemplate:{type:"component",displayName:"Template",group:"General",set(e){this._internal.template=e}},run:{group:"General",displayName:"Do",type:"signal",valueChangedToTrue(){this.scheduleRun()}},abort:{group:"General",displayName:"Abort",type:"signal",valueChangedToTrue(){this.scheduleAbort()}}},outputs:{success:{type:"signal",group:"Events",displayName:"Success"},failure:{type:"signal",group:"Events",displayName:"Failure"},done:{type:"signal",group:"Events",displayName:"Done"},aborted:{type:"signal",group:"Events",displayName:"Aborted"}},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()}))})))},async createTaskComponent(e){const t=this._internal,n=(this.nodeScope.modelScope||ce.K).create(e),o=await this.nodeScope.createNode(t.template,(0,z.Os)(),{_forEachModel:n,_forEachNode:this}),i=o.isInputConnected.bind(o);o.isInputConnected=e=>"Do"===e||i(e),o.hasInput("Id")&&o.setInputValue("Id",n.getId()),o.hasInput("id")&&o.setInputValue("id",n.getId());for(const e in o._inputs)void 0!==n.data[e]&&o.setInputValue(e,n.data[e]);return o._internal.creatorCallbacks={onOutputChanged:(e,t,i)=>{!1!==i&&void 0!==i||!0!==t||this.itemOutputSignalTriggered(e,n,o)}},o},async startTask(e){const t=this._internal;try{const o=await this.createTaskComponent(e);t.runningTasks++,(n=o).queueInput("Do",!0),n.queueInput("Do",!1),t.activeTasks.set(o.id,o)}catch(e){console.log(e)}var n},async run(){const e=this._internal;if(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&&e.template&&e.items){e.state="running",e.numTasks=e.items.length,e.failedTasks=0,e.completedTasks=0,e.queuedTasks=[].concat(e.items),e.runningTasks=0,0===e.items.length&&(this.sendSignalOnOutput("success"),e.state="idle");for(let t=0;t<Math.min(e.maxRunningTasks,e.queuedTasks.length);t++){const t=e.queuedTasks.shift();if(!t)break;this.startTask(t)}}},abort(){this._internal.state="aborted"},itemOutputSignalTriggered(e,t,n){const o=this._internal;if("idle"===o.state)return;const i=()=>{if("aborted"===o.state)return this.sendSignalOnOutput("aborted"),void(o.state="idle");if(o.completedTasks===o.numTasks)0===o.failedTasks?this.sendSignalOnOutput("success"):this.sendSignalOnOutput("failure"),this.sendSignalOnOutput("done"),o.state="idle";else if(o.stopOnFailure)if(0===o.failedTasks){o.runningTasks++;const e=o.queuedTasks.shift();e&&this.startTask(e)}else this.sendSignalOnOutput("failure"),this.sendSignalOnOutput("aborted");else{o.runningTasks++;const e=o.queuedTasks.shift();e&&this.startTask(e)}};"Success"===e?(o.completedTasks++,o.runningTasks--,i()):"Failure"===e&&(o.completedTasks++,o.failedTasks++,o.runningTasks--,i()),o.activeTasks.delete(n.id),this.nodeScope.deleteNode(n)},_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)this.nodeScope.deleteNode(e);this._internal.activeTasks.clear()},_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this._deleteAllTasks()}},he={name:"REST2",displayNodeName:"REST",docs:"https://docs.noodl.net/nodes/data/rest",category:"Data",color:"data",searchTags:["http","request","fetch"],initialize(){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(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(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//*Inputs and *Outputs contain the inputs and outputs of the node.\n",group:"Scripts",set(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(e){try{this._internal.responseFunc=new Function("Inputs","Outputs","Response",e)}catch(e){console.log(e)}}},fetch:{type:"signal",displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleFetch()}},cancel:{type:"signal",displayName:"Cancel",group:"Actions",valueChangedToTrue(){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(e){return this._internal.outputValues[e]},setScriptInputValue(e,t){return this._internal.inputValues[e]=t},registerOutputIfNeeded(e){if(!this.hasOutput(e))return e.startsWith("out-")?this.registerOutput(e,{getter:this.getScriptOutputValue.bind(this,e.substring(4))}):void 0},registerInputIfNeeded(e){if(!this.hasInput(e))return e.startsWith("in-")?this.registerInput(e,{set:this.setScriptInputValue.bind(this,e.substring(3))}):void 0},scheduleFetch(){const e=this._internal;e.hasScheduledFetch||(e.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated(this.doFetch.bind(this)))},doResponse(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(e){let t=e.resource;if(Object.keys(e.parameters).length>0){const n=Object.keys(e.parameters).map((t=>t+"="+encodeURIComponent(e.parameters[t])));t+="?"+n.join("&")}if("undefined"==typeof _noodl_cloud_runtime_version){const n=new XMLHttpRequest;this._xhr=n,n.open(e.method,t,!0);for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);n.onreadystatechange=()=>{let t=!1;if(4===n.readyState){const o=n.status,i=n.getResponseHeader("content-type"),s=n.response;if(delete this._xhr,i){i=i.toLowerCase();const n=-1!==i.indexOf("json")?JSON.parse(s):s;this.doResponse(o,n,e),t=!0}!1===t&&this.doResponse(o,s,e)}},n.onerror=()=>{delete this._xhr,this.sendSignalOnOutput("failure")},n.onabort=()=>{delete this._xhr,this.sendSignalOnOutput("canceled")},e.content?(n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify(e.content))):n.send()}else{const n={...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(){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(){"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."})}}};function me(e,t,n,o,i,s){if(!i.editorConnection)return;if(i.editorConnection.clearWarning(o.component.name,o.id,"rest-run-waring-"+n),void 0===e)return void i.editorConnection.clearWarning(o.component.name,o.id,"rest-parse-waring-"+n);try{new Function(...t,e),i.editorConnection.clearWarning(o.component.name,o.id,"rest-parse-waring-"+n)}catch(e){i.editorConnection.sendWarning(o.component.name,o.id,"rest-parse-waring-"+n,{message:"<strong>"+n+"</strong>: "+e.message,showGlobally:!0})}function r(e){return void 0!==s.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=>{r("in-"+e)||s.push({name:"in-"+e,displayName:e,plug:"input",type:"*",group:"Inputs"})}))}const d=a.match(/Outputs\.[A-Za-z0-9]+/g);if(d){const e={};d.forEach((t=>{e[t.substring(8)]=!0})),Object.keys(e).forEach((e=>{r("out-"+e)||s.push({name:"out-"+e,displayName:e,plug:"output",type:"*",group:"Outputs"})}))}}function ge(e,t){function n(t){function n(){if(!t.parameters)return;const n=[];function o(e){for(let t=0;t<n.length;t++)if(n[t].name===e&&"input"===n[t].plug)return!0;return!1}if(t.parameters.resource){const e=t.parameters.resource.match(/\{[A-Za-z0-9_]*\}/g);if(e)for(const t of e){const e=t.replace("{","").replace("}","");o("in-"+e)||n.push({name:"in-"+e,displayName:e,type:"string",plug:"input",group:"Inputs"})}}t.parameters.requestScript&&me(t.parameters.requestScript,["Inputs","Outputs","Request"],"Request script",t,e,n),t.parameters.responseScript&&me(t.parameters.responseScript,["Inputs","Outputs","Response"],"Response script",t,e,n),e.editorConnection.sendDynamicPorts(t.id,n)}n(),t.on("parameterUpdated",(()=>{n()}))}e.editorConnection&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.REST2",(e=>{n(e)}));for(const e of t.getNodesWithType("REST2"))n(e)}))}var fe=n(8779),ye=n.n(fe);const ve={name:"Expression",docs:"https://docs.noodl.net/nodes/math/expression",usePortAsLabel:"expression",category:"CustomCode",color:"javascript",nodeDoubleClickAction:{focusPort:"Expression"},searchTags:["javascript"],initialize(){const e=this._internal;e.scope={},e.hasScheduledEvaluation=!1,e.code=void 0,e.cachedValue=0,e.currentExpression="",e.compiledFunction=void 0,e.inputNames=[],e.inputValues=[]},getInspectInfo(){return this._internal.cachedValue},inputs:{expression:{group:"General",inputPriority:1,type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},displayName:"Expression",set(e){const t=this._internal;t.currentExpression=be+"return ("+e+");",t.compiledFunction=void 0;const n=Ce(e),o=ye()(n,t.inputNames),i=ye()(t.inputNames,n),s=this;i.forEach((function(e){s.deregisterInput(e),delete t.scope[e]})),o.forEach((function(e){s.hasInput(e)||(s.registerInput(e,{set(n){t.scope[e]=n,this.isInputConnected("run")||this._scheduleEvaluateExpression()}}),t.scope[e]=0,s._inputValues[e]=0)})),t.inputNames=Object.keys(t.scope),this.isInputConnected("run")||this._scheduleEvaluateExpression()}},run:{group:"Actions",displayName:"Run",type:"signal",valueChangedToTrue(){this._scheduleEvaluateExpression()}}},outputs:{result:{group:"Result",type:"*",displayName:"Result",getter(){return this._internal.currentExpression?this._internal.cachedValue:0}},isTrue:{group:"Result",type:"boolean",displayName:"Is True",getter(){return!!this._internal.currentExpression&&!!this._internal.cachedValue}},isFalse:{group:"Result",type:"boolean",displayName:"Is False",getter(){return!this._internal.currentExpression||!this._internal.cachedValue}},isTrueEv:{group:"Events",type:"signal",displayName:"On True"},isFalseEv:{group:"Events",type:"signal",displayName:"On False"}},prototypeExtensions:{registerInputIfNeeded(e){this.hasInput(e)||(this._internal.scope[e]=0,this._inputValues[e]=0,this.registerInput(e,{set(t){this._internal.scope[e]=t,this.isInputConnected("run")||this._scheduleEvaluateExpression()}}))},_scheduleEvaluateExpression(){const e=this._internal;!1===e.hasScheduledEvaluation&&(e.hasScheduledEvaluation=!0,this.flagDirty(),this.scheduleAfterInputsHaveUpdated((function(){const t=e.cachedValue;e.cachedValue=this._calculateExpression(),t!==e.cachedValue&&(this.flagOutputDirty("result"),this.flagOutputDirty("isTrue"),this.flagOutputDirty("isFalse")),e.cachedValue?this.sendSignalOnOutput("isTrueEv"):this.sendSignalOnOutput("isFalseEv"),e.hasScheduledEvaluation=!1})))},_calculateExpression(){const e=this._internal;e.compiledFunction||(e.compiledFunction=this._compileFunction());for(let t=0;t<e.inputNames.length;++t){const n=e.scope[e.inputNames[t]];e.inputValues[t]=n}try{if(!e.compiledFunction)throw new Error("Compiled function is undefined");return e.compiledFunction.apply(null,e.inputValues)}catch(e){e instanceof Error&&console.error("Error in expression:",e.message)}},_compileFunction(){const e=this._internal.currentExpression,t=Object.keys(this._internal.scope),n=e+t.join(" ");if(!_e[n]){t.push(e);try{_e[n]=function(e,t){function n(){return e.apply(this,t)}return n.prototype=e.prototype,new n}(Function,t)}catch(e){e instanceof Error&&console.error("Failed to compile JS function",e.message)}}return _e[n]}}},be=["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;"].join(""),_e={},Se=["min","max","cos","sin","tan","sqrt","pi","round","floor","ceil","abs","random","Math","window","document","undefined","Vars","true","false","null","Boolean"];function Ce(e){const t=[];function n(e){-1===Se.indexOf(e)&&(t.some((t=>t===e))||t.push(e))}const o=(e=e.replace(/\"([^\"]*)\"/g,"").replace(/\'([^\']*)\'/g,"")).matchAll(/[a-zA-Z\_\$][a-zA-Z0-9\.\_\$]*/g);for(const e of o){let t=e[0];-1!==t.indexOf(".")&&(t=t.split(".")[0]),n(t)}return t}function Ne(e,t,n){const o=Ce(t).map((e=>({group:"Parameters",name:e,type:{name:"*",editAsType:"string"},plug:"input"})));n.sendDynamicPorts(e,o)}function Oe(e,t){try{new Function(t.parameters.expression),e.clearWarning(t.component.name,t.id,"expression-compile-error")}catch(n){n instanceof Error&&e.sendWarning(t.component.name,t.id,"expression-compile-error",{message:n.message})}}function Ie(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Expression",(t=>{t.parameters.expression&&(Ne(t.id,t.parameters.expression,e.editorConnection),Oe(e.editorConnection,t)),t.on("parameterUpdated",(n=>{"expression"===n.name&&(Ne(t.id,t.parameters.expression,e.editorConnection),Oe(e.editorConnection,t))}))}))}const we={};class Pe{constructor(e,t){this.inputs={},this.outputs={},this.code=e;const n=t?t.node:void 0;this._initializeAPIs();let o=we[e];if(!o)try{o=new Function(["define","script","Node","Component"],Pe.getCodePrefix()+e),we[e]=o}catch(e){this.error=e instanceof Error?e.message:String(e),console.error(e)}if(o)try{o(this.define.bind(this),this.script.bind(this),this.apis.Node,n?Pe.getComponentScopeForNode(n):{}),this._afterSourced()}catch(e){this.error=e instanceof Error?e.message:String(e),console.error(e)}}define(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}script(e){const t=function(e){const t={inputs:e.inputs||{},outputs:e.outputs||{},setup:function(t,n){if(this.inputs=t,this.outputs=n,this.setOutputs=function(e){for(const t in e)this.outputs[t]=e[t],this.flagOutputDirty(t)},e.methods)for(const t in e.methods)this[t]=e.methods[t];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;const o=this._oldInputs||{};if(e.changed)for(const n in t)if(t[n]!==o[n]){const i=e.changed[n];"function"==typeof i&&i.apply(this,[t[n],o[n]])}this._oldInputs=Object.assign({},t)}};if(e.signals)for(const 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}_initializeAPIs(){this.apis={Node:{Inputs:{},Outputs:{},Signals:{},Setters:{}}}}_afterSourced(){if(void 0!==this.definedObject)return;const e=this.apis.Node;if(this.inputs=Object.assign({},e.Inputs||{}),this.outputs=Object.assign({},e.Outputs||{}),this.setup=function(t,n){const o=this;e.setOutputs=function(e){for(const t in e)n[t]=e[t],o.flagOutputDirty(t)},e.OnInit&&e.OnInit.apply(this)},this.destroy=e.OnDestroy||this.destroy,this.change=(t,n,o)=>{for(const n in o)"function"==typeof e.Setters[n]&&e.Setters[n](t[n]);"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(const t in e.Signals)"function"==typeof e.Signals[t]&&(this.inputs[t]="signal",this.definedObject[t]=e.Signals[t])}getPorts(){const e=[];return Object.keys(this.inputs).forEach((t=>{const n=this.inputs[t],o={name:t,plug:"input",type:void 0,group:"Inputs"};"string"==typeof n?o.type={name:n}:Object.assign(o,n),e.push(o)})),Object.keys(this.outputs).forEach((t=>{e.push({name:t,type:{name:this.outputs[t]},plug:"output",group:"Outputs"})})),Pe.parseAndAddPortsFromScript(this.code,e,{}),e}static createFromCode(e,t){return new Pe(e,t)}static createFromURL(e,t,n){e=(0,z.Lo)(e);const o=new XMLHttpRequest;o.open("GET",e,!0),o.onreadystatechange=function(){4!==this.readyState&&this.readyState!==XMLHttpRequest.DONE||t(new Pe(this.response))},o.onerror=function(){console.log("Failed to request",e)},o.send()}static parseAndAddPortsFromScript(e,t,n){function o(e,n){if(null==e)return;const o={};for(const t of e){let e=t[1];void 0!==e&&(o[e]=!0)}Object.keys(o).forEach((e=>{var o;("string"==typeof(o={name:n.prefix+e,plug:n.plug})?void 0===t.find((e=>e.name===o)):void 0===t.find((e=>e.name===o.name&&e.plug===o.plug)))&&t.push({name:n.prefix+e,displayName:e,plug:n.plug,type:n.type,group:n.group})}))}n.skipInputs||(o(e.matchAll(/Inputs\.([A-Za-z0-9_]+)/g),{type:n.inputType||"*",plug:"input",group:n.inputGroup||"Inputs",prefix:n.inputPrefix||""}),o(e.matchAll(/Inputs\s*\[\s*(?:'|")(.*)(?:'|")\s*\]/g),{type:n.inputType||"*",plug:"input",group:n.inputGroup||"Inputs",prefix:n.inputPrefix||""})),n.skipOutputs||(n.skipOutputSignals||(o(e.matchAll(/Outputs\.([A-Za-z0-9]+)\s*\(\s*\)/g),{type:"signal",plug:"output",group:"Outputs",prefix:n.outputPrefix||""}),o(e.matchAll(/Outputs\s*\[\s*(?:'|")(.*)(?:'|")\s*\]\(\s*\)/g),{type:"signal",plug:"output",group:"Outputs",prefix:n.outputPrefix||""})),n.skipRegularOutputs||(o(e.matchAll(/Outputs\.([A-Za-z0-9_]+)/g),{type:"*",plug:"output",group:"Outputs",prefix:n.outputPrefix||""}),o(e.matchAll(/Outputs\s*\[\s*\"([^\"]*)\"\s*\]/g),{type:"*",plug:"output",group:"Outputs",prefix:n.outputPrefix||""})))}static getCodePrefix(){return"const Script = (typeof Node !== 'undefined')?Node:undefined;\n"}static createNoodlAPI(){return"undefined"!=typeof window&&void 0!==window.Noodl?window.Noodl:{}}static getComponentScopeForNode(e){const t=e.nodeScope.componentOwner.getInstanceId();if(void 0===xe[t]){xe[t]={};const n=(e.nodeScope.modelScope||ce.K).get("componentState"+t);xe[t].Object=n}const n=function(e){const t=function e(t){let n;if(t.getRoots().length>0){const e=t.getRoots()[0];e.getVisualParentNode?e.getVisualParentNode()&&(n=e.getVisualParentNode().nodeScope.componentOwner):e.parentNodeScope&&(n=t.parentNodeScope.componentOwner)}else t.parentNodeScope&&(n=t.parentNodeScope.componentOwner);if(n&&n.nodeScope&&n.nodeScope.componentOwner!==t)return n.nodeScope.getNodesWithType("net.noodl.ComponentObject").length>0||n.nodeScope.getNodesWithType("Component State").length>0?n:e(n)}(e.nodeScope.componentOwner);if(t)return"componentState"+t.getInstanceId()}(e),o=void 0!==n?(e.nodeScope.modelScope||ce.K).get(n):void 0;return xe[t].ParentObject=o,xe[t].RepeaterObject=function(e){let t=e.nodeScope.componentOwner;for(;void 0!==t&&void 0===t._forEachModel&&t.parentNodeScope;)t=t.parentNodeScope.componentOwner;return void 0!==t?t._forEachModel:void 0}(e),xe[t]}}const xe={},Ee={name:"JavaScriptFunction",displayNodeName:"Function",docs:"https://docs.noodl.net/nodes/javascript/function",category:"CustomCode",color:"javascript",nodeDoubleClickAction:{focusPort:"Script"},searchTags:["javascript"],exportDynamicPorts:!0,initialize:function(){this._internal={},this._internal.inputValues={},this._internal.outputValues={},this._internal.inputTypes={},this._internal.outputTypes={},this._internal.outputValuesProxy=new Proxy(this._internal.outputValues,{set:(e,t,n)=>(this._deleted||n!==this._internal.outputValues[t]&&(this.registerOutputIfNeeded("out-"+t),this._internal.outputValues[t]=n,this.flagOutputDirty("out-"+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",set(e){}},scriptOutputs:{type:{name:"proplist",allowEditOnly:!0},group:"Script Outputs",set(e){}},functionScript:{displayName:"Script",plug:"input",type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},group:"General",set(e){void 0!==e?(this._internal.func=this.parseScript(e),this.isInputConnected("run")||this.scheduleRun()):this._internal.func=void 0}},run:{type:"signal",displayName:"Run",group:"Actions",valueChangedToTrue:function(){this.scheduleRun()}}},outputs:{},methods:{scheduleRun(){this.runScheduled||(this.runScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.runScheduled=!1,this._deleted||this.runScript()})))},async runScript(){const e=this._internal.func;if(void 0===e)return;const t=this._internal.inputValues,n=this._internal.outputValuesProxy;for(const e in this.model.outputPorts)if(this._isSignalType(e)){const t=()=>{this.hasOutput(e)&&this.sendSignalOnOutput(e)};this._internal.outputValues[e.substring(4)]=t,this._internal.outputValues[e.substring(4)].send=t}try{await e.apply(this._internal._this,[t,n,Pe.createNoodlAPI(this.nodeScope.modelScope),Pe.getComponentScopeForNode(this)])}catch(e){(0,z.Ql)(e),this.context.editorConnection&&this.context.isWarningTypeEnabled("javascriptExecution")&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"js-function-run-waring",{showGlobally:!0,message:e.message,stack:e.stack})}},setScriptInputValue(e,t){this._internal.inputValues[e]=t,this.isInputConnected("run")||this.scheduleRun()},getScriptOutputValue(e){if(!this._isSignalType(e))return this._internal.outputValues[e]},setScriptInputType(e,t){this._internal.inputTypes[e]=t},setScriptOutputType(e,t){this._internal.outputTypes[e]=t},parseScript(e){let t;try{t=new(0,Object.getPrototypeOf((async function(){})).constructor)("Inputs","Outputs","Noodl","Component",Pe.getCodePrefix()+e)}catch(e){console.log("Error while parsing action script: "+e)}return t},_isSignalType(e){return this.model.outputPorts[e]&&"signal"===this.model.outputPorts[e].type},registerInputIfNeeded(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)}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(e){if(!this.hasOutput(e))return e.startsWith("out-")?this.registerOutput(e,{getter:this.getScriptOutputValue.bind(this,e.substring(4))}):void 0}}},Te=[{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"}];function Ae(e,t){function n(t){function n(){var n;const o=[],i=Te.concat([{value:"signal",label:"Signal"}]);void 0!==t.parameters.scriptOutputs&&t.parameters.scriptOutputs.length>0&&t.parameters.scriptOutputs.forEach((e=>{o.push({name:"outtype-"+e.label,displayName:"Type",editorName:e.label+" | Type",plug:"input",type:{name:"enum",enums:i,allowEditOnly:!0},default:"string",parent:"scriptOutputs",parentItemId:e.id}),o.push({name:"out-"+e.label,displayName:e.label,plug:"output",type:t.parameters["outtype-"+e.label]||"*",group:"Outputs"})})),void 0!==t.parameters.scriptInputs&&t.parameters.scriptInputs.length>0&&t.parameters.scriptInputs.forEach((e=>{o.push({name:"intype-"+e.label,displayName:"Type",editorName:e.label+" | Type",plug:"input",type:{name:"enum",enums:Te,allowEditOnly:!0},default:"string",parent:"scriptInputs",parentItemId:e.id}),o.push({name:"in-"+e.label,displayName:e.label,plug:"input",type:t.parameters["intype-"+e.label]||"string",group:"Inputs"})})),function(e,t,n,o,i){if(o.editorConnection.clearWarning(n.component.name,n.id,"js-function-run-waring"),void 0!==e){try{new(0,Object.getPrototypeOf((async function(){})).constructor)("Inputs","Outputs","Noodl","Component",e),o.editorConnection.clearWarning(n.component.name,n.id,"js-function-parse-waring")}catch(e){o.editorConnection.sendWarning(n.component.name,n.id,"js-function-parse-waring",{showGlobally:!0,message:e.message})}Pe.parseAndAddPortsFromScript(e,i,{inputPrefix:"in-",outputPrefix:"out-"})}else o.editorConnection.clearWarning(n.component.name,n.id,"js-function-parse-waring")}(t.parameters.functionScript,0,t,e,o),o.forEach((e=>{"signal"===e.type&&"output"===e.plug&&(t.outputPorts[e.name]=e)})),null===(n=e.editorConnection)||void 0===n||n.sendDynamicPorts(t.id,o)}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)}))}var ke=n(3200),De=n(3795);function Re(e,t){const n=t.queryParameters;if(void 0!==e.combinator&&void 0!==e.rules){if(0===e.rules.length)return;if(1===e.rules.length)return Re(e.rules[0],t);{const n={},o="$"+e.combinator;return n[o]=[],e.rules.forEach((e=>{const i=Re(e,t);void 0!==i&&n[o].push(i)})),n}}if("related to"===e.operator){const t=void 0!==e.input?n[e.input]:void 0;if(void 0===t)return;return{$relatedTo:{object:{__type:"Pointer",objectId:t,className:e.relatedTo},key:e.relationProperty}}}{const o={};let i,s,r=void 0!==e.input?n[e.input]:e.value;if("exist"===e.operator)return o[e.property]={$exists:!0},o;if("not exist"===e.operator)return o[e.property]={$exists:!1},o;if(void 0===r)return;return De.D._collections[t.collectionName]&&(s=De.D._collections[t.collectionName].schema),"Date"===(s&&s.properties&&s.properties[e.property]?s.properties[e.property].type:void 0)&&(r instanceof Date||(r=new Date(r.toString())),r={__type:"Date",iso:r.toISOString()}),"greater than"===e.operator?i={$gt:r}:"greater than or equal to"===e.operator?i={$gte:r}:"less than"===e.operator?i={$lt:r}:"less than or equal to"===e.operator?i={$lte:r}:"equal to"===e.operator?i={$eq:r}:"not equal to"===e.operator?i={$ne:r}:"points to"===e.operator?i={$eq:{__type:"Pointer",objectId:r,className:s&&s.properties&&s.properties[e.property]?s.properties[e.property].targetClass:void 0}}:"contain"===e.operator&&(i={$regex:r,$options:"i"}),o[e.property]=i,o}}function Me(e,t){let n=!0;return void 0===t||(void 0!==t.$and?t.$and.forEach((t=>{n=n&&Me(e,t)})):void 0!==t.$or?(n=!1,t.$or.forEach((t=>{n=n||Me(e,t)}))):Object.keys(t).forEach((o=>{if("objectId"===o)void 0!==t[o].$eq?n=n&&e.getId()===t[o].$eq:void 0!==t[o].$in&&(n=n&&-1!==t[o].$in.indexOf(e.getId()));else if("$relatedTo"===o)n=!1;else{const i=e.get(o);void 0!==t[o].$eq&&"Pointer"===t[o].$eq.__type?n=n&&i===t[o].$eq.objectId:void 0!==t[o].$eq?n=n&&i==t[o].$eq:void 0!==t[o].$ne?n=n&&i!=t[o].$ne:void 0!==t[o].$lt?n=n&&i<t[o].$lt:void 0!==t[o].$lte?n=n&&i<=t[o].$lt:void 0!==t[o].$gt?n=n&&i>t[o].$gt:void 0!==t[o].$gte?n=n&&i>=t[o].$gte:void 0!==t[o].$exists?n=n&&void 0!==i:void 0!==t[o].$in?n=n&&-1!==t[o].$in.indexOf(i):void 0!==t[o].$nin?n=n&&-1===t[o].$in.indexOf(i):void 0!==t[o].$regex&&(n=n&&new RegExp(t[o].$regex,t[o].$options).test(i))}})),n)}function Ve(e,t,n){for(let o=0;o<e.length;o++){let i=e[o];if("-"===i[0]){let e=i.substring(1);if(t.get(e)>n.get(e))return-1;if(t.get(e)<n.get(e))return 1}else{if(t.get(i)>n.get(i))return 1;if(t.get(i)<n.get(i))return-1}}return 0}function je(e){return e.map((e=>("descending"===e.order?"-":"")+e.property))}function Fe(e){return e instanceof Date&&"function"==typeof e.toISOString?{__type:"Date",iso:e.toISOString()}:e}function Ue(e,t){var n,o,i,s,r,a;const l=Object.keys(e);if(0===l.length)return{};if(1!==l.length)return null===(n=null==t?void 0:t.error)||void 0===n?void 0:n.call(t,"Filter must only have one key found "+l.join(","));const d={},u=l[0];if(void 0!==e.and&&Array.isArray(e.and))d.$and=e.and.map((e=>Ue(e,t)));else if(void 0!==e.or&&Array.isArray(e.or))d.$or=e.or.map((e=>Ue(e,t)));else if(void 0!==e.idEqualTo)d.objectId={$eq:e.idEqualTo};else if(void 0!==e.idContainedIn)d.objectId={$in:e.idContainedIn};else if(void 0!==e.relatedTo){const n=e.relatedTo.id;if(void 0===n)return null===(o=null==t?void 0:t.error)||void 0===o?void 0:o.call(t,"Must provide id in relatedTo filter");const a=e.relatedTo.key;if(void 0===a)return null===(i=null==t?void 0:t.error)||void 0===i?void 0:i.call(t,"Must provide key in relatedTo filter");const l=e.relatedTo.className||(null===(s=(t.modelScope||ce.K).get(n))||void 0===s?void 0:s._class);if(void 0===l)return null===(r=null==t?void 0:t.error)||void 0===r?void 0:r.call(t,"Must preload the Pointer or include className");d.$relatedTo={object:{__type:"Pointer",objectId:n,className:l},key:a}}else if("object"==typeof e[u]){const n=e[u];if(void 0!==n.equalTo)d[u]={$eq:Fe(n.equalTo)};else if(void 0!==n.notEqualTo)d[u]={$ne:Fe(n.notEqualTo)};else if(void 0!==n.lessThan)d[u]={$lt:Fe(n.lessThan)};else if(void 0!==n.greaterThan)d[u]={$gt:Fe(n.greaterThan)};else if(void 0!==n.lessThanOrEqualTo)d[u]={$lte:Fe(n.lessThanOrEqualTo)};else if(void 0!==n.greaterThanOrEqualTo)d[u]={$gte:Fe(n.greaterThanOrEqualTo)};else if(void 0!==n.exists)d[u]={$exists:n.exists};else if(void 0!==n.containedIn)d[u]={$in:n.containedIn};else if(void 0!==n.notContainedIn)d[u]={$nin:n.notContainedIn};else if(void 0!==n.pointsTo){let e=null;De.D._collections[t.collectionName]&&(e=De.D._collections[t.collectionName].schema);const o=e&&e.properties&&e.properties[u]?e.properties[u].targetClass:void 0;"Relation"===(e&&e.properties&&e.properties[u]?e.properties[u].type:void 0)?d[u]={__type:"Pointer",objectId:n.pointsTo,className:o}:Array.isArray(n.pointsTo)?d[u]={$in:n.pointsTo.map((e=>({__type:"Pointer",objectId:e,className:o})))}:d[u]={$eq:{__type:"Pointer",objectId:n.pointsTo,className:o}}}else if(void 0!==n.matchesRegex)d[u]={$regex:n.matchesRegex,$options:n.options};else if(void 0!==n.text&&void 0!==n.text.search){const e=n.text.search;d[u]="string"==typeof e?{$text:{$search:{$term:e,$caseSensitive:!1}}}:{$text:{$search:{$term:e.term,$language:e.language,$caseSensitive:e.caseSensitive,$diacriticSensitive:e.diacriticSensitive}}}}else if(void 0!==n.nearSphere){const e=n.nearSphere;d[u]={$nearSphere:{__type:"GeoPoint",latitude:e.latitude,longitude:e.longitude},$maxDistanceInMiles:e.maxDistanceInMiles,$maxDistanceInKilometers:e.maxDistanceInKilometers,$maxDistanceInRadians:e.maxDistanceInRadians}}else if(void 0!==n.withinBox){const e=n.withinBox;d[u]={$within:{$box:e.map((e=>({__type:"GeoPoint",latitude:e.latitude,longitude:e.longitude})))}}}else if(void 0!==n.withinPolygon){const e=n.withinPolygon;d[u]={$geoWithin:{$polygon:e.map((e=>({__type:"GeoPoint",latitude:e.latitude,longitude:e.longitude})))}}}}else null===(a=null==t?void 0:t.error)||void 0===a||a.call(t,"Unrecognized filter keys "+l.join(","));return d}const We={name:"DbCollection2",docs:"https://docs.noodl.net/nodes/data/cloud-data/query-records",displayName:"Query Records",category:"Cloud Services",usePortAsLabel:"collectionName",color:"data",initialize(){const e=this;this._internal.queryParameters={};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){var n,o;if(!0!==e.isInputConnected("storageFetch")&&void 0!==e._internal.collection&&t.collection===e._internal.name)if("create"===t.type){const o=ce.K.get(t.object.objectId);void 0!==o&&Me(o,null===(n=e._internal.currentQuery)||void 0===n?void 0:n.where)&&s(o)}else if("save"===t.type){const n=ce.K.get(t.objectId);if(void 0!==n){const t=Me(n,null===(o=e._internal.currentQuery)||void 0===o?void 0:o.where);!t&&e._internal.collection.contains(n)?(e._internal.collection.remove(n),e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty")):t&&!e._internal.collection.contains(n)&&s(n)}}else if("delete"===t.type){const n=ce.K.get(t.objectId);void 0!==n&&(e._internal.collection.remove(n),e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty"))}function s(t){var n,o;if(void 0!==(null===(n=e._internal.currentQuery)||void 0===n?void 0:n.sort)){for(let n=0;n<e._internal.collection.size()&&!(Ve(e._internal.currentQuery.sort,e._internal.collection.get(n),t)>0);n++);e._internal.collection.addAtIndex(t,i)}else e._internal.collection.add(t);let s=e._internal.collection.size();void 0!==(null===(o=e._internal.currentQuery)||void 0===o?void 0:o.limit)&&s>e._internal.currentQuery.limit&&e._internal.collection.remove(e._internal.collection.get(void 0!==e._internal.currentQuery.sort&&"-"===e._internal.currentQuery.sort[0][0]?s-1:0)),e.flagOutputDirty("items"),e.flagOutputDirty("count"),e.flagOutputDirty("firstItemId"),e.flagOutputDirty("isEmpty")}};const n=De.D.forScope(this.nodeScope.modelScope);n.on("save",this._internal.cloudStoreEvents),n.on("create",this._internal.cloudStoreEvents),n.on("delete",this._internal.cloudStoreEvents),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",getter:function(){return this._internal.collection}},firstItemId:{type:"string",displayName:"First Record Id",group:"General",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",getter:function(){return!this._internal.collection||0===this._internal.collection.size()}},count:{type:"number",displayName:"Count",group:"General",getter:function(){return this._internal.collection?this._internal.collection.size():0}},fetched:{group:"Events",type:"signal",displayName:"Success"},failure:{group:"Events",type:"signal",displayName:"Failure"},error:{type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}},prototypeExtensions:{setCollectionName:function(e){this._internal.name=e,!1===this.isInputConnected("storageFetch")&&this.scheduleFetch()},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)},_onNodeDeleted:function(){Node.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection();const e=De.D.forScope(this.nodeScope.modelScope);e.off("insert",this._internal.cloudStoreEvents),e.off("delete",this._internal.cloudStoreEvents),e.off("save",this._internal.cloudStoreEvents)},setError:function(e){this._internal.err=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure")},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=ke.p.get(),t=this.getStorageFilter(),n=this.getStorageLimit(),o=this.getStorageSkip(),i=this.getStorageFetchTotalCount();this._internal.currentQuery={where:t.where,sort:t.sort,limit:n,skip:o},De.D.forScope(this.nodeScope.modelScope).query({collection:this._internal.name,where:t.where,sort:t.sort,limit:n,skip:o,count:i,success:(t,n)=>{void 0!==t&&e.set(t.map((e=>De.D._fromJSON(e,this._internal.name,this.nodeScope.modelScope)))),void 0!==n&&(this._internal.storageSettings.storageTotalCount=n,this.hasOutput("storageTotalCount")&&this.flagOutputDirty("storageTotalCount")),this.setCollection(e),this.sendSignalOnOutput("fetched")},error:t=>{this.setCollection(e),this.setError(t||"Failed to fetch.")}})},getStorageFilter:function(){var e;const t=this._internal.storageSettings;if(void 0===t.storageFilterType||"simple"===t.storageFilterType)return{where:void 0!==this._internal.visualFilter?Re(this._internal.visualFilter,{queryParameters:this._internal.queryParameters,collectionName:this._internal.name}):void 0,sort:void 0!==this._internal.visualSorting?je(this._internal.visualSorting):void 0};if("json"===t.storageFilterType){if(!this._internal.filterFunc)try{let e=t.storageJSONFilter;e=e.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""),this._internal.filterVariables=e.match(/\$[A-Za-z0-9]+/g)||[];const n=["filter","where","sort","Inputs"].concat(this._internal.filterVariables).concat([e]);this._internal.filterFunc=Function.apply(null,n)}catch(e){this._internal.filterFunc=void 0,console.log("Error while parsing filter script: "+e)}if(!this._internal.filterFunc)return;let n={},o=[];const i=this,s=function(e){n=Ue(e,{collectionName:i._internal.name,error:function(e){i.context.editorConnection.sendWarning(i.nodeScope.componentOwner.name,i.id,"query-collection-filter",{message:e})}})},r=function(e){o=e},a={};for(const e in t)e.startsWith("storageFilterValue-")&&(a[e.substring(19)]=t[e]);const l=[s,s,r,a];null===(e=this._internal.filterVariables)||void 0===e||e.forEach((e=>{l.push(t["storageFilterValue-"+e.substring(1)])}));try{this._internal.filterFunc.apply(this,l)}catch(e){console.log("Error while running filter script: "+e)}return{where: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(){return this._internal.storageSettings[e]}})},setVisualFilter:function(e){this._internal.visualFilter=e,!1===this.isInputConnected("storageFetch")&&this.scheduleFetch()},setVisualSorting:function(e){this._internal.visualSorting=e,!1===this.isInputConnected("storageFetch")&&this.scheduleFetch()},setQueryParameter:function(e,t){this._internal.queryParameters[e]=t,!1===this.isInputConnected("storageFetch")&&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))});const t={storageFetch:this.scheduleFetch.bind(this)};if(t[e])return this.registerInput(e,{set:(0,re.i)({valueChangedToTrue:t[e]})});const n={collectionName:this.setCollectionName.bind(this),visualFilter:this.setVisualFilter.bind(this),visualSort:this.setVisualSorting.bind(this)};if(n[e])return this.registerInput(e,{set:n[e]});this.registerInput(e,{set(t){this._internal.storageSettings[e]=t,!1===this.isInputConnected("storageFetch")&&this.scheduleFetch()}})}}},Le="// Write your query script here, check out the reference documentation for examples\nwhere({ })\n";function Be(e,t,n,o){const i=[],s=o.getMetaData("dbCollections"),r=o.getMetaData("systemCollections");if(i.push({name:"collectionName",type:{name:"enum",enums:[{label:"User",value:"_User"},{label:"Role",value:"_Role"}].concat(void 0!==s?s.map((e=>({value:e.name,label:e.name}))):[]),allowEditOnly:!0},displayName:"Class",plug:"input",group:"General"}),i.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"}),i.push({type:{name:"boolean"},plug:"input",group:"Limit",name:"storageEnableLimit",displayName:"Use limit"}),t.storageEnableLimit&&(i.push({type:{name:"number"},default:10,plug:"input",group:"Limit",name:"storageLimit",displayName:"Limit"}),i.push({type:{name:"number"},default:0,plug:"input",group:"Limit",name:"storageSkip",displayName:"Skip"})),i.push({type:{name:"signal"},plug:"input",group:"Actions",name:"storageFetch",displayName:"Do"}),i.push({type:{name:"boolean"},plug:"input",group:"Total Count",name:"storageEnableCount",displayName:"Fetch total count"}),t.storageEnableCount&&i.push({type:{name:"number"},plug:"output",group:"General",name:"storageTotalCount",displayName:"Total Count"}),void 0===t.storageFilterType||"simple"===t.storageFilterType){if(void 0!==t.collectionName){let e=s&&s.find((e=>e.name===t.collectionName));if(void 0===e&&r&&(e=r.find((e=>e.name===t.collectionName))),e&&e.schema&&e.schema.properties){const n=JSON.parse(JSON.stringify(e.schema));null==s||s.forEach(ze.bind(null,t,n)),null==r||r.forEach(ze.bind(null,t,n)),i.push({name:"visualFilter",plug:"input",type:{name:"query-filter",schema:n,allowEditOnly:!0},displayName:"Filter",group:"Filter"}),i.push({name:"visualSort",plug:"input",type:{name:"query-sorting",schema:n,allowEditOnly:!0},displayName:"Sort",group:"Sorting"})}if(void 0!==t.visualFilter){const e={};qe(e,t.visualFilter),Object.keys(e).forEach((e=>{i.push({name:"qp-"+e,plug:"input",type:{name:"*"},displayName:e,group:"Query Parameters"})}))}}}else if("json"===t.storageFilterType){i.push({type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},plug:"input",group:"Filter",name:"storageJSONFilter",default:Le,displayName:"Filter"});let e=String(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=>{i.push({name:"storageFilterValue-"+e.substring(1),displayName:e.substring(1),group:"Filter Values",plug:"input",type:{name:"*",allowConnectionsOnly:!0}})}))}Pe.parseAndAddPortsFromScript(e,i,{inputPrefix:"storageFilterValue-",inputGroup:"Filter Values",inputType:{name:"*",allowConnectionsOnly:!0},skipOutputs:!0})}}n.sendDynamicPorts(e,i)}function $e(e,t){function n(n){Be(n.id,n.parameters,e.editorConnection,t),n.on("parameterUpdated",(function(o){(o.name.startsWith("storage")||"visualFilter"===o.name||"collectionName"===o.name)&&Be(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.dbCollections",(function(){De.D.invalidateCollections(),Be(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.systemCollections",(function(){De.D.invalidateCollections(),Be(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.cloudservices",(function(){De.D.instance._initCloudServices()}))}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)}))}function qe(e,t){void 0!==t&&(void 0!==t.rules?t.rules.forEach((t=>qe(e,t))):void 0!==t.input&&(e[t.input]=!0))}function ze(e,t,n){if(void 0!==n.schema&&void 0!==n.schema.properties)for(const o in n.schema.properties){const i=n.schema.properties[o];"Relation"===i.type&&i.targetClass===e.collectionName&&(void 0===t.relations&&(t.relations={}),void 0===t.relations[n.name]&&(t.relations[n.name]=[]),t.relations[n.name].push({property:o}))}}const He={name:"DbModel2",docs:"https://docs.noodl.net/nodes/data/cloud-data/record",displayNodeName:"Record",shortDesc:"Database model",category:"Cloud Services",usePortAsLabel:"collectionName",color:"data",dynamicports:[{name:"conditionalports/extended",condition:"idSource = explicit OR idSource NOT SET",inputs:["modelId"]}],initialize:function(){const e=this._internal;e.inputValues={},e.relationModelIds={};const t=this;this._internal.onModelChangedCallback=function(e){t.isInputConnected("fetch")||(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",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}},fetched:{type:"signal",displayName:"Fetched",group:"Events"},changed:{type:"signal",displayName:"Changed",group:"Events"},failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",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",set(e){"foreach"===e&&this.scheduleAfterInputsHaveUpdated((()=>{let e=this.nodeScope.componentOwner;for(;void 0!==e&&void 0===e._forEachModel&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;this.setModel(void 0!==e?e._forEachModel:void 0)}))}},modelId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Id",group:"General",set(e){e instanceof ce.K?e=e.getId():"object"==typeof e&&(e=ce.K.create(e).getId()),this._internal.modelId=e,!1===this.isInputConnected("fetch")?this.setModelID(e):this.flagOutputDirty("id")}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleFetch()}}},methods:{setCollectionID(e){this._internal.collectionId=e},setModelID(e){const t=(this.nodeScope.modelScope||ce.K).get(e);this.setModel(t)},setModel(e){this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),this._internal.model=e,this.flagOutputDirty("id"),e.on("change",this._internal.onModelChangedCallback);for(const t in e.data)this.hasOutput("prop-"+t)&&this.flagOutputDirty("prop-"+t);this.sendSignalOnOutput("fetched")},_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},scheduleOnce(e,t){const n=this,o="hasScheduled"+e;this._internal[o]||(this._internal[o]=!0,this.scheduleAfterInputsHaveUpdated((function(){n._internal[o]=!1,t()})))},setError(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"storage-op-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"storage-op-warning")},scheduleFetch(){const e=this,t=this._internal;this.scheduleOnce("Fetch",(function(){if(void 0===t.modelId||""===t.modelId)return void e.setError("Missing Id.");const n=De.D.forScope(e.nodeScope.modelScope);n.fetch({collection:t.collectionId,objectId:t.modelId,success:function(o){const i=n._fromJSON(o,t.collectionId);t.model!==i&&(t.model&&t.model.off("change",t.onModelChangedCallback),t.model=i,i.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")},error:function(t){e.setError(t||"Failed to fetch.")}})}))},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:Ge.bind(this,e.substring(5))})},registerInputIfNeeded:function(e){if(this.hasInput(e))return;const t={};if(t[e])return this.registerInput(e,{set:(0,re.i)({valueChangedToTrue:t[e]})});const n={collectionName:this.setCollectionID.bind(this)};if(n[e])return this.registerInput(e,{set:n[e]});e.startsWith("prop-")&&this.registerInput(e,{set:Xe.bind(this,e.substring(5))})}}};function Ge(e){return this._internal.model?this._internal.model.get(e,{resolve:!0}):void 0}function Xe(e,t){this._internal.inputValues[e]=t}function Ye(e,t,n,o){const i=[],s=o.getMetaData("dbCollections"),r=o.getMetaData("systemCollections");if(i.push({name:"collectionName",displayName:"Class",group:"General",type:{name:"enum",enums:[{label:"User",value:"_User"},{label:"Role",value:"_Role"}].concat(void 0!==s?s.map((e=>({value:e.name,label:e.name}))):[]),allowEditOnly:!0},plug:"input"}),t.collectionName&&s){let e=s.find((e=>e.name===t.collectionName));if(void 0===e&&r&&(e=r.find((e=>e.name===t.collectionName))),e&&e.schema&&e.schema.properties){const t=e.schema.properties;for(const e in t){const n=t[e];if(!i.find((t=>t.name===e))&&"Relation"!==n.type){const t={String:"string",Boolean:"boolean",Number:"number",Date:"date"};i.push({type:{name:t[n.type]?t[n.type]:"*"},plug:"output",group:"Properties",name:"prop-"+e,displayName:e}),i.push({type:"signal",plug:"output",group:"Changed Events",displayName:e+" Changed",name:"changed-"+e})}}}}n.sendDynamicPorts(e,i)}function Je(e,t){function n(n){Ye(n.id,n.parameters,e.editorConnection,t),n.on("parameterUpdated",(function(){Ye(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.dbCollections",(function(){De.D.invalidateCollections(),Ye(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.systemCollections",(function(){De.D.invalidateCollections(),Ye(n.id,n.parameters,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)}))}function Ke(e,t){const n=void 0===t||t.includeInputProperties,o=void 0!==t&&t.includeRelations;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,{failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}}),Object.assign(e.node.methods,{scheduleOnce:function(e,t){const n=this,o="hasScheduled"+e;this._internal[o]||(this._internal[o]=!0,this.scheduleAfterInputsHaveUpdated((function(){n._internal[o]=!1,t()})))},checkWarningsBeforeCloudOp(){return this.clearWarnings(),!!this._internal.collectionId||(this.setError("No class name specified"),!1)},setError:function(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"storage-op-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"storage-op-warning")}}),Object.assign(e,{setup:function(t,i){function s(s){function r(){var r;const a=[],l=i.getMetaData("dbCollections"),d=i.getMetaData("systemCollections"),u=s.parameters;if(a.push({name:"collectionName",displayName:"Class",group:"General",type:{name:"enum",enums:[{label:"User",value:"_User"},{label:"Role",value:"_Role"}].concat(void 0!==l?l.map((e=>({value:e.name,label:e.name}))):[]),allowEditOnly:!0},plug:"input"}),o&&u.collectionName&&l){let e=l.find((e=>e.name===u.collectionName));if(void 0===e&&d&&(e=d.find((e=>e.name===u.collectionName))),e&&e.schema&&e.schema.properties){const t=e.schema.properties,n=Object.keys(t).filter((e=>"Relation"===t[e].type)).map((e=>({label:e,value:e})));a.push({name:"relationProperty",displayName:"Relation",group:"General",type:{name:"enum",enums:n,allowEditOnly:!0},plug:"input"})}}if(n&&u.collectionName&&l){const e={String:"string",Boolean:"boolean",Number:"number",Date:"date"};let t=l.find((e=>e.name===u.collectionName));if(void 0===t&&d&&(t=d.find((e=>e.name===u.collectionName))),t&&t.schema&&t.schema.properties){const n=t.schema.properties;for(const t in n){const o=n[t];a.find((e=>e.name===t))||a.push({type:{name:e[o.type]?e[o.type]:"*"},plug:"input",group:"Properties",name:"prop-"+t,displayName:t})}}}null===(r=e._additionalDynamicPorts)||void 0===r||r.call(e,s,a,i),t.editorConnection.sendDynamicPorts(s.id,a)}r(),s.on("parameterUpdated",(function(){r()})),i.on("metadataChanged.dbCollections",(function(){De.D.invalidateCollections(),r()})),i.on("metadataChanged.systemCollections",(function(){De.D.invalidateCollections(),r()}))}t.editorConnection&&t.editorConnection.isRunningLocally()&&i.on("editorImportComplete",(()=>{i.on("nodeAdded."+e.node.name,(function(e){s(e)}));for(const t of i.getNodesWithType(e.node.name))s(t)}))}})}function Qe(e,t){const n=Object.assign({},e.node.methods),o=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||{}}),o&&(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"]}]),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",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){"foreach"===e&&this.scheduleAfterInputsHaveUpdated((()=>{let e=this.nodeScope.componentOwner;for(;void 0!==e&&void 0===e._forEachModel&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;this.setModel(void 0!==e?e._forEachModel:void 0)}))}},modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",set:function(e){e instanceof ce.K&&(e=e.getId()),this._internal.modelId=e,this.setModelID(e)}}})),i&&Object.assign(e.node.outputs,{id:{type:"string",displayName:"Id",group:"General",getter:function(){return this._internal.model?this._internal.model.getId():this._internal.modelId}}}),Object.assign(e.node.methods,{setCollectionID:function(e){this._internal.collectionId=e,this.clearWarnings()},setModelID:function(e){const t=(this.nodeScope.modelScope||ce.K).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))}})}function Ze(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.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}})}function et(e){const t=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.inputs,{targetId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Target Record Id",group:"General",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}})}function tt(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(){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",set(e){this._internal.accessControlRules=e}}});const o=e._additionalDynamicPorts;e._additionalDynamicPorts=function(e,t,n){void 0!==e.parameters.accessControl&&e.parameters.accessControl.length>0&&e.parameters.accessControl.forEach((n=>{const o="acl-"+n.id;t.push({name:o+"-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[o+"-target"]?t.push({name:o+"-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[o+"-target"]&&"user"!==e.parameters[o+"-target"]||t.push({name:o+"-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:o+"-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:o+"-write",displayName:"Write",editorName:n.label+" | Write",group:n.label+" Access Rule",plug:"input",type:{name:"boolean"},default:!0,parent:"accessControl",parentItemId:n.id})})),o&&o(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))},_getACL:function(){let e={};function t(e){return{read:void 0===e.read||e.read,write:void 0===e.write||e.write}}const n=function(e){if("undefined"!=typeof _noodl_cloud_runtime_version)return e.get("Request").UserId;{const e=localStorage["Parse/"+De.D.instance.appId+"/currentUser"];if(void 0!==e){let t;try{t=JSON.parse(e)}catch(e){}return void 0!==t?t.objectId:void 0}}}(this.nodeScope.modelScope);return void 0!==this._internal.accessControlRules&&this._internal.accessControlRules.forEach((o=>{const i=this._internal.accessControl[o.id];if(void 0===i)void 0!==n&&(e[n]={write:!0,read:!0});else if("everyone"===i.target)e["*"]=t(i);else if("user"===i.target){const o=i.userid||n;e[o]=t(i)}else"role"===i.target&&(e["role:"+i.role]=t(i))})),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}})}const nt={node:{name:"SetDbModelProperties",category:"",docs:"https://docs.noodl.net/nodes/data/cloud-data/set-record-properties",displayNodeName:"Set Record Properties",usePortAsLabel:"collectionName",dynamicports:[{name:"conditionalports/extended",condition:"storeType = cloud OR storeType NOT SET",inputs:["storeProperties"]}],inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){void 0===this._internal.storeType||"cloud"===this._internal.storeType?this.scheduleSave():this.scheduleStore()}},storeProperties:{displayName:"Properties to store",group:"General",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",type:{name:"enum",enums:[{label:"Cloud and local",value:"cloud"},{label:"Local only",value:"local"}]},default:"cloud",set:function(e){this._internal.storeType=e}}},outputs:{stored:{type:"signal",displayName:"Success",group:"Events"}},methods:{scheduleSave(){const e=this,t=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("StorageSave",(function(){if(!t.model)return void e.setError("Missing Record Id");const n=t.model;for(const e in t.inputValues)n.set(e,t.inputValues[e],{resolve:!0});De.D.forScope(e.nodeScope.modelScope).save({collection:t.collectionId,objectId:n.getId(),data:"all"===t.storeProperties?n.data:t.inputValues,acl:e._getACL(),success:function(t){for(const e in t)n.set(e,t[e]);e.sendSignalOnOutput("stored")},error:function(t){e.setError(t||"Failed to save.")}})}))},scheduleStore(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{if(this.hasScheduledStore=!1,e.model){for(const t in e.inputValues)e.model.set(t,e.inputValues[t],{resolve:!0});this.sendSignalOnOutput("stored")}}))}}}};Ke(nt),Qe(nt),Ze(nt),tt(nt);const ot=nt.node,it={node:{name:"DeleteDbModelProperties",category:"",docs:"https://docs.noodl.net/nodes/data/cloud-data/delete-record",displayNodeName:"Delete Record",shortDesc:"Stores any amount of properties and can be used standalone or together with Collections and For Each nodes.",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.storageDelete()}}},outputs:{deleted:{type:"signal",displayName:"Success",group:"Events"}},methods:{storageDelete(){const e=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("StorageDelete",(()=>{e.model?De.D.forScope(this.nodeScope.ModelScope).delete({collection:e.collectionId,objectId:e.model.getId(),success:()=>{e.model.notify("delete"),this.sendSignalOnOutput("deleted")},error:e=>{this.setError(e||"Failed to delete.")}}):this.setError("Missing Record Id")}))}}}};Ke(it,{includeInputProperties:!1}),Qe(it);const st=it.node,rt={node:{name:"NewDbModelProperties",category:"",docs:"https://docs.noodl.net/nodes/data/cloud-data/create-new-record",displayName:"Create New Record",usePortAsLabel:"collectionName",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.storageInsert()}},sourceObjectId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Source Object Id",group:"General",set(e){e instanceof ce.K&&(e=e.getId()),this._internal.sourceObjectId=e}}},outputs:{created:{type:"signal",displayName:"Success",group:"Events"}},methods:{storageInsert(){const e=this._internal;this.checkWarningsBeforeCloudOp()&&this.scheduleOnce("StorageInsert",(()=>{const t=Object.assign({},e.sourceObjectId?(this.nodeScope.modelScope||ce.K).get(e.sourceObjectId).data:{},e.inputValues),n=De.D.forScope(this.nodeScope.modelScope);n.create({collection:e.collectionId,data:t,acl:this._getACL(),success:t=>{const o=n._fromJSON(t,e.collectionId);this.setModel(o),this.sendSignalOnOutput("created")},error:e=>{this.setError(e||"Failed to insert.")}})}))}}}};Ke(rt),Qe(rt,{includeOutputs:!0}),Ze(rt),tt(rt);const at=rt.node,lt={node:{name:"AddDbModelRelation",category:"Data",docs:"https://docs.noodl.net/nodes/data/cloud-data/add-record-relation",displayNodeName:"Add Record Relation",usePortAsLabel:"collectionName",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleAddRelation()}}},outputs:{relationAdded:{type:"signal",displayName:"Success",group:"Events"}},methods:{validateInputs(){if(!this.context.editorConnection)return;const e=e=>{this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"add-relation",{message:e})};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)"):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"add-relation")},scheduleAddRelation(){const e=this,t=this._internal;this.scheduleOnce("StorageAddRelation",(function(){if(e.validateInputs(),!t.model)return;const n=t.model,o=t.targetModelId;void 0!==o&&De.D.forScope(e.nodeScope.modelScope).addRelation({collection:t.collectionId,objectId:n.getId(),key:t.relationProperty,targetObjectId:o,targetClass:(e.nodeScope.modelScope||ce.K).get(o)._class,success:function(t){for(const e in t)n.set(e,t[e]);e.sendSignalOnOutput("relationAdded")},error:function(t){e.setError(t||"Failed to add relation.")}})}))}}}};Ke(lt,{includeRelations:!0}),Qe(lt),et(lt);const dt=lt.node,ut={node:{name:"RemoveDbModelRelation",category:"",docs:"https://docs.noodl.net/nodes/data/cloud-data/remove-record-relation",displayName:"Remove Record Relation",usePortAsLabel:"collectionName",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleRemoveRelation()}}},outputs:{relationRemoved:{type:"signal",displayName:"Success",group:"Events"}},methods:{validateInputs(){if(!this.context.editorConnection)return;const e=e=>{this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"add-relation",{message:e})};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)"):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"add-relation")},scheduleRemoveRelation(){const e=this,t=this._internal;this.scheduleOnce("StorageRemoveRelation",(function(){if(e.validateInputs(),!t.model)return;const n=t.model,o=t.targetModelId;void 0!==o&&De.D.forScope(e.nodeScope.modelScope).removeRelation({collection:t.collectionId,objectId:n.getId(),key:t.relationProperty,targetObjectId:o,targetClass:(e.nodeScope.modelScope||ce.K).get(o)._class,success:function(t){for(const e in t)n.set(e,t[e]);e.sendSignalOnOutput("relationRemoved")},error:function(t){e.setError(t||"Failed to remove relation.")}})}))}}}};Ke(ut,{includeRelations:!0}),Qe(ut),et(ut);const ct=ut.node,pt={name:"FilterDBModels",docs:"https://docs.noodl.net/nodes/data/cloud-data/filter-records",displayNodeName:"Filter Records",shortDesc:"Filter, sort and limit array",category:"Data",color:"data",initialize(){const e=this;this._internal.collectionChangedCallback=function(){!0!==e.isInputConnected("filter")&&e.scheduleFilter()},this._internal.cloudStoreEvents=function(t){!0!==e.isInputConnected("filter")&&void 0!==e._internal.visualFilter&&void 0!==e._internal.collection&&t.collection===e._internal.collectionName&&void 0!==t.objectId&&e._internal.collection.contains(ce.K.get(t.objectId))&&e.scheduleFilter()},De.D.instance.on("save",this._internal.cloudStoreEvents),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",set(e){this.bindCollection(e),!1===this.isInputConnected("filter")&&this.scheduleFilter()}},enabled:{type:"boolean",group:"General",displayName:"Enabled",default:!0,set(e){this._internal.enabled=e,!1===this.isInputConnected("filter")&&this.scheduleFilter()}},filter:{type:"signal",group:"Actions",displayName:"Filter",valueChangedToTrue(){this.scheduleFilter()}}},outputs:{items:{type:"array",displayName:"Items",group:"General",getter(){return this._internal.filteredCollection}},firstItemId:{type:"string",displayName:"First Record Id",group:"General",getter(){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",getter(){return this._internal.filteredCollection?this._internal.filteredCollection.size():0}},modified:{group:"Events",type:"signal",displayName:"Filtered"}},prototypeExtensions:{unbindCurrentCollection(){const e=this._internal.collection;e&&(e.off("change",this._internal.collectionChangedCallback),this._internal.collection=void 0)},bindCollection(e){this.unbindCurrentCollection(),this._internal.collection=e,e&&e.on("change",this._internal.collectionChangedCallback)},_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection(),De.D.instance.off("save",this._internal.cloudStoreEvents)},getLimit(){const e=this._internal.filterSettings;return e.filterEnableLimit?e.filterLimit||10:void 0},getSkip(){const e=this._internal.filterSettings;return e.filterEnableLimit?e.filterSkip||0:void 0},scheduleFilter(){this.collectionChangedScheduled||(this.collectionChangedScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{if(this.collectionChangedScheduled=!1,!this._internal.collection)return;let e=[].concat(this._internal.collection.items);if(this._internal.enabled){const t=this._internal.visualFilter;if(void 0!==t){const n=Re(t,{queryParameters:this._internal.filterParameters,collectionName:this._internal.collectionName});n&&(e=e.filter((e=>Me(e,n))))}const n=this._internal.visualSorting;if(void 0!==n&&n.length>0){const t=je(n);t&&e.sort(Ve.bind(this,t))}const o=this.getSkip();o&&(e=e.slice(o,e.length));const i=this.getLimit();i&&(e=e.slice(0,i))}this._internal.filteredCollection=ke.p.create(e),this.sendSignalOnOutput("modified"),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("items"),this.flagOutputDirty("count")})))},setCollectionName(e){this._internal.collectionName=e},setVisualFilter(e){this._internal.visualFilter=e,!1===this.isInputConnected("filter")&&this.scheduleFilter()},setVisualSorting(e){this._internal.visualSorting=e,!1===this.isInputConnected("filter")&&this.scheduleFilter()},setFilterParameter:function(e,t){this._internal.filterParameters[e]=t,!1===this.isInputConnected("filter")&&this.scheduleFilter()},registerInputIfNeeded(e){if(!this.hasInput(e))return"collectionName"===e?this.registerInput(e,{set:this.setCollectionName.bind(this)}):"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.registerInput(e,{set(t){this._internal.filterSettings[e]=t,!1===this.isInputConnected("filter")&&this.scheduleFilter()}})}}};function ht(e,t,n,o){const i=[];if(i.push({name:"collectionName",type:{name:"enum",enums:void 0!==o?o.map((e=>({value:e.name,label:e.name}))):[],allowEditOnly:!0},displayName:"Class",plug:"input",group:"General"}),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"})),void 0!==t.collectionName){const e=o.find((e=>e.name===t.collectionName));if(e&&e.schema&&e.schema.properties){const t=JSON.parse(JSON.stringify(e.schema)),n={Boolean:!0,String:!0,Date:!0,Number:!0,Pointer:!0};for(const e in t.properties)n[t.properties[e].type]||delete t.properties[e];i.push({name:"visualFilter",plug:"input",type:{name:"query-filter",schema:t,allowEditOnly:!0},displayName:"Filter",group:"Filter"}),i.push({name:"visualSorting",plug:"input",type:{name:"query-sorting",schema:t,allowEditOnly:!0},displayName:"Sorting",group:"Sorting"})}if(void 0!==t.visualFilter){const e={};gt(e,t.visualFilter),Object.keys(e).forEach((e=>{i.push({name:"fp-"+e,plug:"input",type:"*",displayName:e,group:"Filter Parameters"})}))}}n.sendDynamicPorts(e,i)}function mt(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.FilterDBModels",(function(n){ht(n.id,n.parameters,e.editorConnection,t.getMetaData("dbCollections")),n.on("parameterUpdated",(function(){ht(n.id,n.parameters,e.editorConnection,t.getMetaData("dbCollections"))})),t.on("metadataChanged.dbCollections",(function(t){De.D.invalidateCollections(),ht(n.id,n.parameters,e.editorConnection,t)})),t.on("metadataChanged.systemCollections",(function(t){De.D.invalidateCollections(),ht(n.id,n.parameters,e.editorConnection,t)}))}))}function gt(e,t){void 0!==t&&(void 0!==t.rules?t.rules.forEach((t=>gt(e,t))):void 0!==t.input&&(e[t.input]=!0))}const ft={name:"Model2",docs:"https://docs.noodl.net/nodes/data/object/object-node",displayNodeName:"Object",shortDesc:"Stores any amount of properties and can be used standalone or together with Collections and For Each nodes.",category:"Data",usePortAsLabel:"modelId",color:"data",dynamicports:[{name:"conditionalports/extended",condition:"idSource = explicit OR idSource NOT SET",inputs:["modelId"]}],initialize(){const e=this._internal;e.inputValues={},e.dirtyValues={},e.onModelChangedCallback=e=>{!0!==this.isInputConnected("fetch")&&(this.hasOutput("prop-"+e.name)&&this.flagOutputDirty("prop-"+e.name),this.hasOutput("changed-"+e.name)&&this.sendSignalOnOutput("changed-"+e.name),this.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",getter(){return this._internal.model?this._internal.model.getId():this._internal.modelId}},changed:{type:"signal",displayName:"Changed",group:"Events"},fetched:{type:"signal",displayName:"Fetched",group:"Events"}},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",set(e){"foreach"===e&&this.scheduleAfterInputsHaveUpdated((()=>{let e=this.nodeScope.componentOwner;for(;void 0!==e&&void 0===e._forEachModel&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;this.setModel(void 0!==e?e._forEachModel:void 0)}))}},modelId:{type:{name:"string",identifierOf:"ModelName",identifierDisplayName:"Object Ids"},displayName:"Id",group:"General",set(e){e instanceof ce.K?e=e.getId():"object"==typeof e&&(e=ce.K.create(e).getId()),this._internal.modelId=e,!1===this.isInputConnected("fetch")?this.setModelID(e):this.flagOutputDirty("id")}},properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",set(e){}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleSetModel()}}},prototypeExtensions:{scheduleStore(){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(){this.hasScheduledSetModel||(this.hasScheduledSetModel=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledSetModel=!1,this.setModelID(this._internal.modelId)})))},setModelID(e){const t=(this.nodeScope.modelScope||ce.K).get(e);this.setModel(t),this.sendSignalOnOutput("fetched")},setModel(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)}},_onNodeDeleted(){this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},registerOutputIfNeeded(e){this.hasOutput(e)||e.startsWith("prop-")&&this.registerOutput(e,{getter:yt.bind(this,e.substring(5))})},registerInputIfNeeded(e){this.hasInput(e)||e.startsWith("prop-")&&this.registerInput(e,{set:vt.bind(this,e.substring(5))})}}};function yt(e){return this._internal.model?this._internal.model.get(e,{resolve:!0}):void 0}function vt(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 bt(e,t,n){const o=[],i=t.properties;if(i){const e=i?i.split(","):void 0;if(e)for(const t of e)o.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:"prop-"+t,displayName:t}),o.push({type:"signal",plug:"output",group:"Changed Events",displayName:t+" Changed",name:"changed-"+t})}n.sendDynamicPorts(e,o,{detectRenamed:{plug:"input/output"}})}function _t(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Model2",(function(t){bt(t.id,t.parameters,e.editorConnection),t.on("parameterUpdated",(function(){bt(t.id,t.parameters,e.editorConnection)}))}))}var St=n(4281);const Ct={node:{name:"SetModelProperties",category:"",docs:"https://docs.noodl.net/nodes/data/object/set-object-properties",displayNodeName:"Set Object Properties",inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleStore()}}},outputs:{stored:{type:"signal",displayName:"Done",group:"Events"}}}};St.BO(Ct),St.Gs(Ct),St.D3(Ct);const Nt=Ct.node,Ot={node:{name:"NewModel",category:"",docs:"https://docs.noodl.net/nodes/data/object/create-new-object",displayNodeName:"Create New Object",inputs:{new:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleNew()}}},outputs:{created:{type:"signal",displayName:"Done",group:"Events"}},methods:{scheduleNew(){this.hasScheduledNew||(this.hasScheduledNew=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledNew=!1;const e=(this.nodeScope.modelScope||ce.K).get();this._pushInputValues(e),this.setModel(e),this.sendSignalOnOutput("created")})))}}}};St.BO(Ot),St.Gs(Ot,{includeOutputs:!0}),St.D3(Ot);const It=Ot.node;var wt=n(9678);const Pt={name:"Cloud File",docs:"https://docs.noodl.net/nodes/data/cloud-data/cloud-file",category:"Cloud Services",color:"data",getInspectInfo(){var e;return null===(e=this._internal.cloudFile)||void 0===e?void 0:e.getUrl()},outputs:{url:{type:"string",displayName:"URL",group:"General",getter(){var e;return null===(e=this._internal.cloudFile)||void 0===e?void 0:e.getUrl()}},name:{type:"string",displayName:"Name",group:"General",getter(){if(!this._internal.cloudFile)return;const e=this._internal.cloudFile.getName().split("_");return 1===e.length?e[0]:e.slice(1).join("_")}}},inputs:{file:{type:"cloudfile",displayName:"Cloud File",group:"General",set(e){e instanceof wt.A&&(this._internal.cloudFile=e,this.flagOutputDirty("name"),this.flagOutputDirty("url"))}}}};class xt{constructor(){this.cacheDuration=9e5}_makeRequest(e,t){if("undefined"==typeof _noodl_cloud_runtime_version){const n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){let e;try{e=JSON.parse(n.response)}catch(e){}200===n.status||201===n.status?t.success(e):t.error(e||{error:n.responseText,status:n.status})}};const o=rn.instance.getMetaData("cloudservices"),i=o.appId,s=o.endpoint;n.open("GET",s+e,!0),n.setRequestHeader("X-Parse-Application-Id",i),n.send()}else{const n="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.endpoint:this.endpoint,o="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.appId:this.appId,i="undefined"!=typeof _noodl_cloudservices?_noodl_cloudservices.masterKey:void 0;fetch(n+e,{method:"GET",headers:{"X-Parse-Application-Id":o,"X-Parse-Master-Key":i}}).then((e=>{200===e.status||201===e.status?e.json().then((e=>t.success(e))).catch((e=>t.error({error:"Config: Failed to get json result."}))):e.json().then((e=>t.error(e))).catch((e=>t.error({error:"Failed to fetch."})))})).catch((e=>{t.error({error:e.message})}))}}_getConfig(){return new Promise(((e,t)=>{this._makeRequest("/config",{success:t=>{e(t.params||{})},error:e=>{t(e)}})}))}async getConfig(){return this.configCachePending?this.configCachePending:this.configCache?(this.ttl&&Date.now()>this.ttl&&this._getConfig().then((e=>{this.configCache=e,this.ttl=Date.now()+this.cacheDuration})),this.configCache):(this.configCachePending=this._getConfig(),this.configCache=await this.configCachePending,delete this.configCachePending,this.ttl=Date.now()+this.cacheDuration,this.configCache)}clearCache(){delete this.configCache}}xt.instance=new xt;const Et={name:"DbConfig",docs:"https://docs.noodl.net/nodes/data/cloud-data/config",displayNodeName:"Config",category:"Cloud Services",usePortAsLabel:"configKey",color:"data",initialize:function(){const e=this._internal;xt.instance.getConfig().then((t=>{e.config=t,this.hasOutput("value")&&this.flagOutputDirty("value")}))},getInspectInfo(){const e=this.getValue();return void 0===e?"[No Value]":[{type:"value",value:e}]},methods:{getValue:function(){const e=this._internal;return e.useDevValue&&this.context.editorConnection&&this.context.editorConnection.isRunningLocally()?e.devValue:void 0!==e.config&&void 0!==e.configKey?e.config[e.configKey]:void 0},setInternal:function(e,t){this._internal[e]=t,this.hasOutput("value")&&this.flagOutputDirty("value")},registerOutputIfNeeded:function(e){if(!this.hasOutput(e))return"value"===e?this.registerOutput(e,{getter:this.getValue.bind(this)}):void 0},registerInputIfNeeded:function(e){if(!this.hasInput(e))return"configKey"===e||"useDevValue"===e||"devValue"===e?this.registerInput(e,{set:this.setInternal.bind(this,e)}):void 0}}};function Tt(e,t){function o(o){const i=[];e.editorConnection.clearWarning(o.component.name,o.id,"dbconfig-warning");const s=t.getMetaData("dbConfigSchema");let r;if(s){const t=void 0!==n.g._noodl_cloud_runtime_version;i.push({name:"configKey",displayName:"Parameter",group:"General",type:{name:"enum",enums:Object.keys(s).filter((e=>t||!s[e].masterKeyOnly)).map((e=>({value:e,label:e}))),allowEditOnly:!0},plug:"input"}),void 0!==o.parameters.configKey&&s&&s[o.parameters.configKey]?(r=s[o.parameters.configKey].type,"string"!==r&&"boolean"!==r&&"number"!==r&&"object"!==r&&"array"!==r||(i.push({name:"useDevValue",displayName:"Enable",group:"Local Override",type:"boolean",default:!1,plug:"input"}),!0===o.parameters.useDevValue&&i.push({name:"devValue",displayName:"Value",group:"Local Override",type:r,plug:"input"}))):void 0!==o.parameters.configKey&&e.editorConnection.sendWarning(o.component.name,o.id,"dbconfig-warning",{showGlobally:!0,message:o.parameters.configKey+" config parameter is missing, add it to your cloud service."})}else e.editorConnection.sendWarning(o.component.name,o.id,"dbconfig-warning",{showGlobally:!0,message:"You need an active cloud service."});i.push({name:"value",displayName:"Value",group:"General",type:r||"*",plug:"output"}),e.editorConnection.sendDynamicPorts(o.id,i)}function i(e){o(e),e.on("parameterUpdated",(function(){o(e)})),t.on("metadataChanged.dbConfigSchema",(function(){xt.instance.clearCache(),o(e)}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.DbConfig",(function(e){i(e)}));for(const e of t.getNodesWithType("DbConfig"))i(e)}))}function At(e){return{name:e.name,docs:e.docs,shortDesc:e.shortDesc,nodeDoubleClickAction:e.nodeDoubleClickAction,category:"Variables",initialize(){this._internal.currentValue=e.startValue,this._internal.latestValue=0},getInspectInfo(){return[{type:"color"===e.type.name?"color":"text",value:this._internal.currentValue}]},inputs:{value:{type:e.type,displayName:"Value",default:e.startValue,set(e){!1===this.isInputConnected("saveValue")?this.setValueTo(e):this._internal.latestValue=e}},saveValue:{displayName:"Set",valueChangedToTrue(){this.scheduleAfterInputsHaveUpdated((function(){this.setValueTo(this._internal.latestValue),this.sendSignalOnOutput("stored")}))}}},outputs:{savedValue:{type:e.type.name,displayName:"Value",getter(){return this._internal.currentValue}},changed:{type:"signal",displayName:"Changed"},stored:{type:"signal",displayName:"Stored"}},prototypeExtensions:{setValueTo(t){t=e.cast(t);const n=this._internal.currentValue!==t;this._internal.currentValue=t,n&&(this.flagOutputDirty("savedValue"),this.sendSignalOnOutput("changed"),e.onChanged&&e.onChanged.call(this))}}}}const kt=At({name:"Number",docs:"https://docs.noodl.net/nodes/data/number",startValue:0,nodeDoubleClickAction:{focusPort:"value"},type:{name:"number"},cast:e=>Number(e)}),Dt=At({name:"String",docs:"https://docs.noodl.net/nodes/data/string",shortDesc:"Contains a string (text).",startValue:"",nodeDoubleClickAction:{focusPort:"value"},type:{name:"string"},cast:e=>String(e),onChanged:function(){this.flagOutputDirty("length")}});!function e(t,n){for(const o in n)if("initialize"===o&&t.initialize){const e=t.initialize;t.initialize=function(){e.call(this),n.initialize.call(this)}}else n[o]&&n[o].constructor===Object?t[o]=e(t[o]||{},n[o]):n[o]&&n[o].constructor===Array&&t[o]&&t[o].constructor==Array?t[o]=t[o].concat(n[o]):t[o]=n[o];return t}(Dt,{usePortAsLabel:"value",portLabelTruncationMode:"length",outputs:{length:{type:"number",displayName:"Length",getter:function(){return this._internal.currentValue.length}}}});const Rt=Dt,Mt=At({name:"Boolean",docs:"https://docs.noodl.net/nodes/data/boolean",startValue:!1,type:{name:"boolean"},cast:e=>Boolean(e)}),Vt={name:"Condition",docs:"https://docs.noodl.net/nodes/utilities/logic/condition",category:"Logic",initialize(){},getInspectInfo(){const e=this.getInputValue("condition");let t;return t=void 0===e?"[No input]":e,[{type:"value",value:t}]},inputs:{condition:{type:"boolean",displayName:"Condition",group:"General",set(e){this.isInputConnected("eval")||this.scheduleEvaluate()}},eval:{type:"signal",displayName:"Evaluate",group:"Actions",valueChangedToTrue(){this.scheduleEvaluate()}}},outputs:{ontrue:{type:"signal",displayName:"On True",group:"Events"},onfalse:{type:"signal",displayName:"On False",group:"Events"},result:{type:"boolean",displayName:"Is True",group:"Booleans",getter(){return!!this.getInputValue("condition")}},isfalse:{type:"boolean",displayName:"Is False",group:"Booleans",getter(){return!this.getInputValue("condition")}}},methods:{scheduleEvaluate(){this.scheduleAfterInputsHaveUpdated((()=>{this.flagOutputDirty("result"),this.flagOutputDirty("isfalse");const e=this.getInputValue("condition");this.sendSignalOnOutput(e?"ontrue":"onfalse")}))}}};function jt(e){return e.length>0&&!1===e.some((e=>!e))}const Ft={name:"And",docs:"https://docs.noodl.net/nodes/logic/and",category:"Logic",initialize(){this._internal={inputs:[]}},getInspectInfo(){return jt(this._internal.inputs)},numberedInputs:{input:{displayPrefix:"Input",type:"boolean",createSetter:e=>function(t){const n=!!t;if(this._internal.inputs[e]===n)return;this._internal.inputs[e]=n;const o=jt(this._internal.inputs);this._internal.result!==o&&(this._internal.result=o,this.flagOutputDirty("result"))}}},outputs:{result:{type:"boolean",displayName:"Result",get(){return this._internal.result}}}};function Ut(e){return!!e}const Wt={name:"Or",docs:"https://docs.noodl.net/nodes/logic/or",category:"Logic",initialize(){this._internal.inputs=[]},getInspectInfo(){return this._internal.inputs.some(Ut)},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:{type:"boolean",displayName:"Result",getter:function(){return this._internal.inputs.some(Ut)}}}},Lt={name:"Boolean To String",docs:"https://docs.noodl.net/nodes/utilities/boolean-to-string",category:"Utilities",initialize(){this._internal.inputs=[],this._internal.currentSelectedIndex=0,this._internal.indexChanged=!1,this._internal.trueString="",this._internal.falseString=""},inputs:{trueString:{displayName:"String for true",type:"string",set(e){this._internal.trueString!==e&&(this._internal.trueString=e,this._internal.currentInput&&this.flagOutputDirty("currentValue"))}},falseString:{displayName:"String for false",type:"string",set(e){this._internal.falseString!==e&&(this._internal.falseString=e,this._internal.currentInput||this.flagOutputDirty("currentValue"))}},input:{type:{name:"boolean"},displayName:"Selector",set(e){this._internal.currentInput!==e&&(this._internal.currentInput=e,this.flagOutputDirty("currentValue"),this.sendSignalOnOutput("inputChanged"))}}},outputs:{currentValue:{type:"string",displayName:"Current Value",group:"Value",getter(){return this._internal.currentInput?this._internal.trueString:this._internal.falseString}},inputChanged:{type:"signal",displayName:"Selector Changed",group:"Signals"}}},Bt={name:"Date To String",docs:"https://docs.noodl.net/nodes/utilities/date-to-string",category:"Utilities",initialize(){this._internal.formatString="{year}-{month}-{date}"},inputs:{formatString:{displayName:"Format",type:"string",default:"{year}-{month}-{date}",set(e){this._internal.formatString!==e&&(this._internal.formatString=e,void 0!==this._internal.currentInput&&(this._format(),this.flagOutputDirty("currentValue")))}},input:{type:{name:"date"},displayName:"Date",set(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:"Value",getter(){return this._internal.dateString}},inputChanged:{type:"signal",displayName:"Date Changed",group:"Signals"},onError:{type:"signal",displayName:"Invalid Date",group:"Signals"}},methods:{_format(){try{const e=this._internal.currentInput,t=this._internal.formatString,n=("0"+e.getDate()).slice(-2),o=("0"+(e.getMonth()+1)).slice(-2),i=new Intl.DateTimeFormat("en-US",{month:"short"}).format(e),s=e.getFullYear(),r=s.toString().substring(2),a=("0"+e.getHours()).slice(-2),l=("0"+e.getMinutes()).slice(-2),d=("0"+e.getSeconds()).slice(-2);this._internal.dateString=t.replace(/\{date\}/g,n).replace(/\{month\}/g,String(o)).replace(/\{monthShort\}/g,i).replace(/\{year\}/g,String(s)).replace(/\{yearShort\}/g,String(r)).replace(/\{hours\}/g,String(a)).replace(/\{minutes\}/g,String(l)).replace(/\{seconds\}/g,String(d))}catch(e){this._internal.dateString="",this.flagOutputDirty("onError")}this.flagOutputDirty("currentValue"),this.sendSignalOnOutput("inputChanged")}}},$t={name:"String Mapper",docs:"https://docs.noodl.net/nodes/string-manipulation/string-mapper",category:"Utilities",initialize(){this._internal={inputs:[],mappings:[]}},getInspectInfo(){return this._internal.mappedString},numberedInputs:{input:{type:"string",displayPrefix:"Input",group:"Inputs",index:10,createSetter:e=>function(t){t=void 0===t?"":String(t),this._internal.inputs[e]=t,this.scheduleMapping()}},output:{type:"string",displayPrefix:"Mapping",index:1001,group:"Mappings",createSetter:e=>function(t){t=void 0===t?"":String(t),this._internal.mappings[e]=t,this.scheduleMapping()}}},inputs:{inputString:{type:{name:"string"},index:1,displayName:"Input String",set(e){this._internal.currentInputString=void 0!==e?String(e):void 0,this.scheduleMapping()}},defaultMapping:{type:"string",displayName:"Default",index:1e3,group:"Mappings",set(e){this._internal.defaultMapping=e,this.scheduleMapping()}}},outputs:{mappedString:{type:"string",displayName:"Mapped String",group:"Value",getter(){return this._internal.mappedString}}},prototypeExtensions:{doMapping(){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(){const e=this._internal;e.hasScheduledFetch||(e.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated(this.doMapping.bind(this)))}}};function qt(e){if(void 0!==e)return!e}const zt={name:"Inverter",docs:"https://docs.noodl.net/nodes/logic/inverter",category:"Logic",initialize(){this._internal.currentValue=void 0},getInspectInfo(){return String(qt(this._internal.currentValue))},inputs:{value:{type:{name:"boolean"},displayName:"Value",set(e){this._internal.currentValue=e,this.flagOutputDirty("result")}}},outputs:{result:{type:"boolean",displayName:"Result",getter(){return qt(this._internal.currentValue)}}}},Ht={name:"Substring",docs:"https://docs.noodl.net/nodes/string-manipulation/substring",category:"String Manipulation",initialize(){var e=this._internal;e.startIndex=0,e.endIndex=-1,e.cachedResult="",e.inputString="",e.resultDirty=!1},inputs:{start:{type:"number",displayName:"Start",default:0,set(e){this._internal.startIndex=e,this._internal.resultDirty=!0,this.flagOutputDirty("result")}},end:{type:"number",displayName:"End",default:0,set(e){this._internal.endIndex=e,this._internal.resultDirty=!0,this.flagOutputDirty("result")}},string:{type:{name:"string"},displayName:"String",default:"",set(e){const t=String(e);this._internal.inputString=t,this._internal.resultDirty=!0,this.flagOutputDirty("result")}}},outputs:{result:{type:"string",displayName:"Result",getter(){var e=this._internal;return e.resultDirty&&(-1===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}}}},Gt={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:{type:{name:"string",multiline:!0},displayName:"Format",set(e){this._internal.format!==e&&(this._internal.format=e,this._internal.resultDirty=!0,this.scheduleFormat())}}},outputs:{formatted:{type:"string",displayName:"Formatted",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 o=[];n&&(o=n.map((e=>e.replace("{","").replace("}","")))),o.forEach((n=>{const o=e.inputValues[n];t=t.replace("{"+n+"}",void 0!==o?o:"")})),e.cachedResult=t,e.resultDirty=!1}return e.cachedResult},registerInputIfNeeded(e){this.hasInput(e)||this.registerInput(e,{set(t){this._internal.inputValues[e]!==t&&(this._internal.inputValues[e]=t,this._internal.resultDirty=!0,this.scheduleFormat())}})},scheduleFormat(){this.formatScheduled||(this.formatScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.formatValue(),this.flagOutputDirty("formatted"),this.formatScheduled=!1})))}}};function Xt(e,t,n){const o=(t.match(/\{[A-Za-z0-9_]*\}/g)||[]).map((e=>e.replace("{","").replace("}",""))).filter(((e,t,n)=>n.indexOf(e)===t)).map((e=>({name:e,type:"string",plug:"input"})));n.sendDynamicPorts(e,o)}function Yt(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.String Format",(t=>{t.parameters.format&&Xt(t.id,t.parameters.format,e.editorConnection),t.on("parameterUpdated",(n=>{"format"===n.name&&Xt(t.id,t.parameters.format,e.editorConnection)}))}))}const Jt={name:"Counter",docs:"https://docs.noodl.net/nodes/math/counter",category:"Math",initialize(){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",valueChangedToTrue(){this._internal.limitsEnabled&&this._internal.currentValue>=this._internal.limitsMax||(this._internal.currentValue++,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"))}},decrease:{group:"Actions",displayName:"Decrease Count",valueChangedToTrue(){this._internal.limitsEnabled&&this._internal.currentValue<=this._internal.limitsMin||(this._internal.currentValue--,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"))}},reset:{group:"Actions",displayName:"Reset To Start",valueChangedToTrue(){0!==this.currentValue&&(this._internal.currentValue=this._internal.startValue,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"))}},startValue:{type:"number",displayName:"Start Value",default:0,set(e){this._internal.startValue=Number(e),!1===this._internal.startValueSet&&(this._internal.startValueSet=!0,this._internal.currentValue=this._internal.startValue,this.flagOutputDirty("currentCount"),this.sendSignalOnOutput("countChanged"))}},limitsMin:{type:{name:"number"},displayName:"Min Value",group:"Limits",default:0,set(e){this._internal.limitsMin=Number(e)}},limitsMax:{type:{name:"number"},displayName:"Max Value",group:"Limits",default:0,set(e){this._internal.limitsMax=Number(e)}},limitsEnabled:{type:{name:"boolean"},displayName:"Limits Enabled",group:"Limits",default:!1,set(e){this._internal.limitsEnabled=!!e}}},outputs:{currentCount:{displayName:"Current Count",type:"number",getter(){return this._internal.currentValue}},countChanged:{displayName:"Count Changed",type:"signal"}}},Kt={name:"Unique Id",docs:"https://docs.noodl.net/nodes/utilities/unique-id",category:"String Manipulation",initialize(){this._internal.guid=(0,z.Os)()},getInspectInfo(){return this._internal.guid},inputs:{new:{displayName:"New",valueChangedToTrue:function(){this._internal.guid=(0,z.Os)(),this.flagOutputDirty("guid")}}},outputs:{guid:{type:"string",displayName:"Id",getter:function(){return this._internal.guid}}},prototypeExtensions:{}},Qt={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(){this._internal.userProperties={}},outputs:{success:{type:"signal",displayName:"Success",group:"Events"},failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",getter(){return this._internal.error}}},inputs:{store:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleStore()}},email:{displayName:"Email",type:"string",group:"General",set(e){this._internal.email=e}},username:{displayName:"Username",type:"string",group:"General",set(e){this._internal.username=e}}},methods:{setError(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"user-set-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"user-set-warning")},scheduleStore(){const e=this._internal;!0!==this.storeScheduled&&(this.storeScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.storeScheduled=!1,NoodlRuntime.Services.UserService.forScope(this.nodeScope.modelScope).setUserProperties({email:this._internal.email,username:this._internal.username,properties:e.userProperties,success:()=>{this.sendSignalOnOutput("success")},error:e=>{this.setError(e)}})})))},setUserProperty(e,t){this._internal.userProperties[e]=t},registerInputIfNeeded(e){if(!this.hasInput(e))return e.startsWith("prop-")?this.registerInput(e,{set:this.setUserProperty.bind(this,e.substring(5))}):void 0}}};function Zt(e,t,n,o){const i=[];if(o){const e=o.find((e=>"_User"===e.name));if(e&&e.schema&&e.schema.properties){const t=e.schema.properties,n="undefined"==typeof _noodl_cloud_runtime_version?["authData","createdAt","updatedAt","email","username","emailVerified","password"]:["authData","createdAt","updatedAt","email","username"];for(const e in t){if(-1!==n.indexOf(e))continue;const o=t[e];if(!i.find((t=>t.name===e)))if("Relation"===o.type);else{const t={String:"string",Boolean:"boolean",Number:"number",Date:"date"};i.push({type:{name:t[o.type]?t[o.type]:"*"},plug:"input",group:"Properties",name:"prop-"+e,displayName:e})}}}}n.sendDynamicPorts(e,i)}function en(e,t){function n(n){Zt(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections")),n.on("parameterUpdated",(function(o){Zt(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections"))})),t.on("metadataChanged.systemCollections",(function(t){Zt(n.id,n.parameters,e.editorConnection,t)}))}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)}))}const tn={name:"net.noodl.user.User",docs:"https://docs.noodl.net/nodes/data/user/user-node",displayNodeName:"User",category:"Cloud Services",color:"data",initialize(){const e=this;this._internal.onModelChangedCallback=function(t){e.isInputConnected("fetch")||(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=NoodlRuntime.Services.UserService.forScope(this.nodeScope.modelScope);this.setUserModel(t.current),t.on("loggedIn",(()=>{this.setUserModel(t.current),this.hasOutput("loggedIn")&&this.sendSignalOnOutput("loggedIn")})),t.on("sessionGained",(()=>{this.setUserModel(t.current)})),t.on("loggedOut",(()=>{this.setUserModel(void 0),this.hasOutput("loggedOut")&&this.sendSignalOnOutput("loggedOut")})),t.on("sessionLost",(()=>{this.setUserModel(void 0),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",getter(){return void 0!==this._internal.model?this._internal.model.getId():void 0}},fetched:{type:"signal",displayName:"Fetched",group:"Events"},changed:{type:"signal",displayName:"Changed",group:"Events"},failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",getter(){return this._internal.error}},username:{type:"string",displayName:"Username",group:"General",getter(){return void 0!==this._internal.model?this._internal.model.get("username"):void 0}},email:{type:"string",displayName:"Email",group:"General",getter(){return void 0!==this._internal.model?this._internal.model.get("email"):void 0}},authenticated:{type:"boolean",displayName:"Authenticated",group:"General",getter(){return void 0!==this._internal.model}}},inputs:{fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleFetch()}}},methods:{_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},scheduleOnce(e,t){const n=this,o="hasScheduled"+e;this._internal[o]||(this._internal[o]=!0,this.scheduleAfterInputsHaveUpdated((function(){n._internal[o]=!1,t()})))},setError(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"user-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"user-warning")},setUserModel(e){const t=this._internal;if(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"),e)for(const t in e.data)this.hasOutput("prop-"+t)&&this.flagOutputDirty("prop-"+t)},scheduleFetch(){this._internal,this.scheduleOnce("Fetch",(()=>{const e=NoodlRuntime.Services.UserService.forScope(this.nodeScope.modelScope);e.fetchCurrentUser({success:t=>{this.setUserModel(e.current),this.sendSignalOnOutput("fetched")},error:e=>{this.setError(e||"Failed to fetch.")}})}))},registerOutputIfNeeded(e){this.hasOutput(e)||("loggedOut"!==e&&"loggedIn"!==e&&"sessionLost"!==e?e.startsWith("prop-")&&this.registerOutput(e,{getter:this.getUserProperty.bind(this,e.substring(5))}):this.registerOutput(e,{getter:()=>{}}))},getUserProperty(e){return void 0!==this._internal.model?this._internal.model.get(e):void 0}}};function nn(e,t,n,o){const i=[];if(o){const e=o.find((e=>"_User"===e.name));if(e&&e.schema&&e.schema.properties){const t=e.schema.properties,n=["authData","password","username","email"];for(const e in t){if(-1!==n.indexOf(e))continue;const o=t[e];if(!i.find((t=>t.name===e)))if("Relation"===o.type);else{const t={String:"string",Boolean:"boolean",Number:"number",Date:"date"};i.push({type:{name:t[o.type]?t[o.type]:"*"},plug:"output",group:"Properties",name:"prop-"+e,displayName:e}),i.push({type:"signal",plug:"output",group:"Changed Events",displayName:e+" Changed",name:"changed-"+e})}}}}"undefined"==typeof _noodl_cloud_runtime_version&&(i.push({plug:"output",name:"loggedIn",type:"signal",displayName:"Logged In",group:"Events"}),i.push({plug:"output",name:"loggedOut",type:"signal",displayName:"Logged Out",group:"Events"}),i.push({plug:"output",name:"sessionLost",type:"signal",displayName:"Session Lost",group:"Events"})),n.sendDynamicPorts(e,i)}function on(e,t){function n(n){nn(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections")),n.on("parameterUpdated",(function(o){nn(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections"))})),t.on("metadataChanged.systemCollections",(function(t){nn(n.id,n.parameters,e.editorConnection,t)}))}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)}))}class sn{constructor(e){if(e.platform=e.platform||{},sn.instance=this,this.type=e.type||"browser",this.noodlModules=[],this.eventEmitter=new U.b,this.updateScheduled=!1,this.rootComponent=null,this._currentLoadedData=null,this.isWaitingForExport=!0,this.graphModel=new ne,this.errorHandlers=[],this.frameNumber=0,this.dontCreateRootComponent=!!e.dontCreateRootComponent,this.componentFilter=e.componentFilter,this.runningInEditor=!e.runDeployed,this.platform={requestUpdate:e.platform.requestUpdate,getCurrentTime:e.platform.getCurrentTime,webSocketOptions:e.platform.webSocketOptions,objectToString:e.platform.objectToString},!e.platform.requestUpdate)throw new Error("platform.requestUpdate must be set");if(!e.platform.getCurrentTime)throw new Error("platform.getCurrentTime must be set");var t;this.editorConnection=new Q({platform:e.platform,runtimeType:this.type}),this.context=new Y({runningInEditor:!e.runDeployed,editorConnection:this.editorConnection,platform:this.platform,graphModel:this.graphModel}),this.context.eventEmitter.on("scheduleUpdate",this.scheduleUpdate.bind(this)),e.runDeployed||this._setupEditorCommunication(e),this.registerGraphModelListeners(),t=this,[o,s,r,a,l,d,u,c,p,h,m,g,f,y,v,b,_,S,C,N,O,I,w,P,x,E,T,A,k,D,R,M,V,j,F].forEach((e=>t.registerNode(e)))}async prefetchBundles(e,t){await async function(e,t,n){const o=[],i=[];for(const s of t){const r=Promise.resolve().then((()=>n(s)));if(o.push(r),e<=t.length){const t=r.then((()=>{i.splice(i.indexOf(t),1)}));i.push(t),i.length>=e&&await Promise.race(i)}}return Promise.all(o)}(t,e,(async e=>{await this.context.fetchComponentBundle(e)}))}_setupEditorCommunication(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 o=Object.keys(e);return Object.keys(n).every((e=>-1!==o.indexOf(e)))&&o.every((o=>t(e[o],n[o])))}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("metadataUpdate",this.onMetaDataUpdateReceived.bind(this)),this.editorConnection.on("connected",(()=>{this.sendNodeLibrary()}))}setDebugInspectorsEnabled(e){this.context.setDebugInspectorsEnabled(e)}registerModule(e){if(e.nodes)for(let t of e.nodes)t.node||(t={node:t}),t.node.module=e.name||"Unknown Module",this.registerNode(t);this.noodlModules.push(e)}registerGraphModelListeners(){this.graphModel.on("componentAdded",(e=>{this.context.registerComponentModel(e)}),this),this.graphModel.on("componentRemoved",(e=>{this.context.deregisterComponentModel(e)}),this)}reload(){location.reload()}registerNode(e){if(e.node){const t=le(e.node);this.context.nodeRegister.register(t),t.setupNumberedInputDynamicPorts&&t.setupNumberedInputDynamicPorts(this.context,this.graphModel)}else this.context.nodeRegister.register(e.node);e.setup&&e.setup(this.context,this.graphModel)}async _setRootComponent(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",null),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"))}async setData(e){if(!this._disableLoad){this._currentLoadedData=e,await this.graphModel.importEditorData(e);for(const e of this.noodlModules)"function"==typeof e.setup&&e.setup();!0!==this.dontCreateRootComponent&&(await this._setRootComponent(this.graphModel.rootComponent||null),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()}}scheduleUpdate(){var e,t;this.updateScheduled||(this.updateScheduled=!0,null===(t=(e=this.platform).requestUpdate)||void 0===t||t.call(e,this._doUpdate.bind(this)))}_doUpdate(){this.updateScheduled=!1,this.context.currentFrameTime=this.platform.getCurrentTime(),this.context.eventEmitter.emit("frameStart"),this.context.update(),this.context.eventEmitter.emit("frameEnd"),this.frameNumber++}setProjectSettings(e){this.projectSettings=e}getNodeLibrary(){const e=function(e,t){const n={dynamicports:[],ports:[]};return function(e,t){for(let n=0;n<t.length;n++){const o=t[n];o.settings&&o.settings.forEach((t=>{e.ports.push(t)}))}}(n,t),n}(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=function(e){const t={typecasts:[{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:[]},{from:"enum",to:[]},{from:"object",to:[]},{from:"domelement",to:[]},{from:"reference",to:[]},{from:"font",to:[]},{from:"textStyle",to:["string"]},{from:"collection",to:["array"]},{from:"array",to:["collection"]}],dynamicports:[{type:"conditionalports",name:"basic"},{type:"expand",name:"basic"}],colors:{nodes:{component:{base:"#643D8B",baseHighlighted:"#79559b",header:"#4E2877",headerHighlighted:"#643d8b",outline:"#4E2877",outlineHighlighted:"#b58900",text:"#dbd0e4"},visual:{base:"#315272",baseHighlighted:"#4d6784",header:"#173E5D",headerHighlighted:"#315272",outline:"#173E5D",outlineHighlighted:"#b58900",text:"#cfd5de"},data:{base:"#465524",baseHighlighted:"#5b6a37",header:"#314110",headerHighlighted:"#465524",outline:"#314110",outlineHighlighted:"#b58900",text:"#d2d6c5"},javascript:{base:"#7E3660",baseHighlighted:"#944e74",header:"#67214B",headerHighlighted:"#7e3660",outline:"#67214B",outlineHighlighted:"#d57bab",text:"#e4cfd9"},default:{base:"#4C4F59",baseHighlighted:"#62656e",header:"#373B45",headerHighlighted:"#4c4f59",outline:"#373B45",outlineHighlighted:"#b58900",text:"#d3d4d6"}},connections:{signal:{normal:"#006f82",highlighted:"#7ec2cf",pulsing:"#ffffff"},default:{normal:"#875d00",highlighted:"#e5ae32",pulsing:"#ffffff"}}},nodetypes:[{name:"Component Children",shortDesc:"This node is a placeholder for where children of this component will be inserted.",docs:"https://docs.noodl.net/nodes/component-utilities/component-children",color:"component",allowAsChild:!0,category:"Visual",haveComponentChildren:["Visual"]}]},n=Object.keys(e._constructors);n.forEach((function(n){const o=e._constructors[n].metadata,i={name:n,searchTags:o.searchTags};t.nodetypes.push(i),o.version&&(i.version=o.version),o.displayNodeName&&(i.displayNodeName=o.displayNodeName),o.nodeDoubleClickAction&&(i.nodeDoubleClickAction=o.nodeDoubleClickAction),o.shortDesc&&(i.shortDesc=o.shortDesc),o.module&&(i.module=o.module),o.deprecated&&(i.deprecated=!0),o.haveComponentPorts&&(i.haveComponentPorts=!0),"Visual"===o.category&&(i.allowAsChild=!0,i.allowAsExportRoot=!0,i.color="visual"),void 0!==o.allowAsExportRoot&&(i.allowAsExportRoot=o.allowAsExportRoot),o.allowChildren&&(i.allowChildrenWithCategory=["Visual"],i.color="visual"),o.allowChildrenWithCategory&&(i.allowChildrenWithCategory=o.allowChildrenWithCategory),o.singleton&&(i.singleton=!0),o.allowAsChild&&(i.allowAsChild=!0),o.docs&&(i.docs=o.docs),o.shortDocs?i.shortDocs=o.shortDocs:o.docs&&0===o.docs.indexOf("https://docs.noodl.net")&&(i.shortDocs=o.docs.replace("/#","")+"-short.md"),i.category=o.category,o.panels&&(i.panels=o.panels),o.usePortAsLabel&&(i.usePortAsLabel=o.usePortAsLabel,i.portLabelTruncationMode=o.portLabelTruncationMode),o.color&&(i.color=o.color),o.dynamicports&&(i.dynamicports=function(e){var t,n;const o=[];for(const i of e.dynamicports||[])if(i.ports||i.template||i.port||i.channelPort)o.push(i);else if(i.inputs||i.outputs){const s=[];if(i.inputs)for(const n of i.inputs){const o=null===(t=e.inputs)||void 0===t?void 0:t[n];o&&s.push(Z(n,o,"input"))}if(i.outputs)for(const t of i.outputs){const o=null===(n=e.outputs)||void 0===n?void 0:n[t];o&&s.push(Z(t,o,"output"))}const r={name:i.name||"conditionalports/basic",condition:i.condition,ports:s};o.push(r)}return o}(o)),o.exportDynamicPorts&&(i.exportDynamicPorts=o.exportDynamicPorts),o.visualStates&&(i.visualStates=o.visualStates),o.useVariants&&(i.useVariants=o.useVariants),o.connectionPanel&&(i.connectionPanel=o.connectionPanel),i.ports=[];const s=i.dynamicports||[],r={},a={};s.filter((e=>void 0!==e.channelPort)).forEach((e=>{a[e.channelPort.plug+"/"+e.channelPort.name]=!0})),s.length&&(i.dynamicports=s),Object.keys(o.inputs||{}).forEach((function(e){var t;if(r.hasOwnProperty("input/"+e)||a.hasOwnProperty("input/"+e))return;const n=null===(t=o.inputs)||void 0===t?void 0:t[e];n&&!1!==n.exportToEditor&&(i.ports||(i.ports=[]),i.ports.push(Z(e,n,"input")))})),Object.keys(o.outputs||{}).forEach((function(e){var t;if(r.hasOwnProperty("output/"+e)||a.hasOwnProperty("output/"+e))return;const n=null===(t=o.outputs)||void 0===t?void 0:t[e];n&&function(e,t){const n={name:e,type:t.type,plug:"output"};t.group&&(n.group=t.group),t.displayName&&(n.displayName=t.displayName),t.editorName&&(n.editorName=t.editorName),t.hasOwnProperty("index")&&(n.index=t.index),i.ports||(i.ports=[]),i.ports.push(n)}(e,n)}))})),t.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","Color Blend","Number Remapper","Counter","Drag","net.noodl.animatetovalue"]},{name:"Logic",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:"System",items:["Screen Resolution","Open File Picker"]},{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"]},{name:"Cloud Data",items:["DbModel2","NewDbModelProperties","FilterDBModels","SetDbModelProperties","DbCollection2","DeleteDbModelProperties","AddDbModelRelation","RemoveDbModelRelation","Cloud File","Upload File","CloudFunction2","DbConfig"]},{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"]},{name:"External Data",items:["REST2"]}]},{name:"Custom Code",description:"Custom JavaScript and CSS",type:"javascript",subCategories:[{name:"",items:["Expression","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"]}]}]};const o=[];return n.forEach((t=>{e._constructors[t].metadata.module&&o.push(t)})),o.length&&(t.nodeIndex.moduleNodes=[{name:"",items:o}]),t}(this.context.nodeRegister);return t.projectsettings=e,JSON.stringify(t,null,3)}sendNodeLibrary(){const e=this.getNodeLibrary();this.lastSentNodeLibrary!==e&&(this.lastSentNodeLibrary=e,this.editorConnection.sendNodeLibrary(e))}connectToEditor(e){this.editorConnection.connect(e)}onMetaDataUpdateReceived(e){this.graphModel.isEmpty()||ie(this.context,this.graphModel,e)}async onModelUpdateReceived(e){this.isWaitingForExport||("projectInstanceChanged"===e.type?this.reload():!1===this.graphModel.isEmpty()&&await ie(this.context,this.graphModel,e))}addErrorHandler(e){this.errorHandlers.push(e)}reportError(e){this.errorHandlers.forEach((t=>{t(e)}))}getProjectSettings(){return this.graphModel.getSettings()}getMetaData(e){return this.graphModel.getMetaData(e)}}sn.Services=se,sn.Node=q.b,sn.NodeDefinition={defineNode:le},sn.EdgeTriggeredInput=re.i;const rn=sn},6351:(e,t,n)=>{"use strict";function o(e){if(null==e||""===e)return window.Noodl.baseUrl||"/";const t=String(e);return!t||"/"===t[0]||t.includes("://")||t.startsWith("data:")?t:(window.Noodl.baseUrl||"/")+t}function i(e){"string"==typeof e?console.log("Error in JS node run code.",e):e instanceof Error&&console.log("Error in JS node run code.",Object.getPrototypeOf(e).constructor.name+": "+e.message,e.stack)}function s(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function r(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}n.d(t,{DU:()=>r,Lo:()=>o,Os:()=>s,Ql:()=>i})},2004:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});const o={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},easeIn:()=>0,easeOut:()=>0,easeInOut:()=>0};o.easeIn=o.easeInCubic,o.easeOut=o.easeOutCubic,o.easeInOut=o.easeInOutCubic;const i=o},7095:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i,setup:()=>s});var o=n(1142);const i={name:"NavigationClosePopup",displayNodeName:"Close Popup",category:"Navigation",docs:"https://docs.noodl.net/nodes/popups/close-popup",_internal:{resultValues:{}},inputs:{results:{type:{name:"stringlist",allowEditOnly:!0},group:"Results",set(e){this._internal.results=e}},closeActions:{type:{name:"stringlist",allowEditOnly:!0},group:"Close Actions",set(e){this._internal.closeActions=e}},close:{type:"Signal",displayName:"Close",group:"Actions",valueChangedToTrue(){this.scheduleClose()}}},methods:{setResultValue(e,t){this._internal.resultValues[e]=t},_setCloseCallback(e){this._internal.closeCallback=e},scheduleClose(){const e=this,t=this._internal;t.hasScheduledClose||(t.hasScheduledClose=!0,this.scheduleAfterInputsHaveUpdated((function(){t.hasScheduledClose=!1,e.close()})))},close(){this._internal.closeCallback&&this._internal.closeCallback(this._internal.closeAction||"",this._internal.resultValues)},closeActionTriggered(e){this._internal.closeAction=e,this.scheduleClose()},registerInputIfNeeded(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:(0,o.i)({valueChangedToTrue:this.closeActionTriggered.bind(this,e)})}):void 0}}};function s(e,t){function n(t){function n(){var n;const o=[],i=t.parameters.results;if(i){const e=i?i.split(","):void 0;for(const t of e)o.push({type:{name:"*"},plug:"input",group:"Results",name:"result-"+t,displayName:t})}const s=t.parameters.closeActions;if(s){const e=s?s.split(","):void 0;for(const t of e)o.push({type:"signal",plug:"input",group:"Close Actions",name:"closeAction-"+t,displayName:t})}null===(n=e.editorConnection)||void 0===n||n.sendDynamicPorts(t.id,o)}n(),t.on("parameterUpdated",(function(e){"results"!==e.name&&"closeActions"!==e.name||n()}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.NavigationClosePopup",(function(e){n(e)}));for(const e of t.getNodesWithType("NavigationClosePopup"))n(e)}))}},8064:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o,setup:()=>i});const o={name:"PageStackNavigateBack",displayNodeName:"Pop Component Stack",category:"Navigation",docs:"https://docs.noodl.net/nodes/component-stack/pop-component",inputs:{navigate:{displayName:"Navigate",group:"Actions",valueChangedToTrue(){this.scheduleNavigate()}},results:{type:{name:"stringlist",allowEditOnly:!0},group:"Results",set(e){this._internal.results=e}},backActions:{type:{name:"stringlist",allowEditOnly:!0},group:"Back Actions",set(e){this._internal.backActions=e}}},initialize(){this._internal.resultValues={}},methods:{scheduleNavigate(){var e=this,t=this._internal;t.hasScheduledNavigate||(t.hasScheduledNavigate=!0,this.scheduleAfterInputsHaveUpdated((function(){t.hasScheduledNavigate=!1,e.navigate()})))},_setBackCallback(e){this._internal.backCallback=e},navigate(){void 0!==this._internal.backCallback&&this._internal.backCallback({backAction:this._internal.backAction,results:this._internal.resultValues})},setResultValue(e,t){this._internal.resultValues[e]=t},backActionTriggered(e){this._internal.backAction=e,this.scheduleNavigate()},registerInputIfNeeded(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:t=>{t&&this.backActionTriggered(e)}}):void 0}}};function i(e,t){function n(t){function n(){var n,o=[],i=t.parameters.results;if(i)for(var s in i=i?i.split(","):void 0){var r=i[s];o.push({type:{name:"*"},plug:"input",group:"Results",name:"result-"+r,displayName:r})}var a=t.parameters.backActions;if(a)for(var s in a=a?a.split(","):void 0)r=a[s],o.push({type:"signal",plug:"input",group:"Back Actions",name:"backAction-"+r,displayName:r});null===(n=e.editorConnection)||void 0===n||n.sendDynamicPorts(t.id,o)}n(),t.on("parameterUpdated",(function(e){"results"!==e.name&&"backActions"!==e.name||n()}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.PageStackNavigateBack",(function(e){n(e)}));for(const e of t.getNodesWithType("PageStackNavigateBack"))n(e)}))}},3700:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i,setup:()=>s});var o=n(260);const i={name:"PageStackNavigateToPath",displayNodeName:"Navigate To Path",category:"Navigation",docs:"https://docs.noodl.net/nodes/navigation/navigate-to-path",initialize(){const e=this._internal;e.params={},e.query={},e.openInNewTab=!1},inputs:{path:{type:{name:"string"},displayName:"Path",group:"General",set(e){this._internal.path=e}},queryNames:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Query",group:"Query",set(e){this._internal.queryNames=e}},openInNewTab:{index:10,displayName:"Open in new tab",group:"General",default:!1,type:"boolean",set(e){this._internal.openInNewTab=!!e}},navigate:{displayName:"Navigate",group:"Actions",valueChangedToTrue(){this.scheduleNavigate()}}},outputs:{},methods:{scheduleNavigate(){const e=this._internal;e.hasScheduledNavigate||(e.hasScheduledNavigate=!0,this.scheduleAfterInputsHaveUpdated((()=>{e.hasScheduledNavigate=!1,this.navigate()})))},navigate(){var e;const t=this._internal;let n=t.path;if(void 0===n)return;const i=null===(e=t.path)||void 0===e?void 0:e.match(/\{[A-Za-z0-9_]*\}/g);let s,r,a=[];i&&(a=i.map((e=>e.replace("{","").replace("}","")))),a.forEach((e=>{const o=t.params[e];n=n.replace("{"+e+"}",void 0!==o?o:"")}));const l=o.default.instance.getProjectSettings().navigationPathType;void 0===l||"hash"===l?r=n:s=n;const d=[];void 0!==t.queryNames&&t.queryNames.split(",").forEach((e=>{void 0!==t.query[e]&&d.push(e+"="+t.query[e])}));const u=(void 0!==s?s:"")+(d.length>=1?"?"+d.join("&"):"")+(void 0!==r?"#"+r:"");this._internal.openInNewTab?window.open(u,"_blank"):(window.history.pushState({},"",u),dispatchEvent(new PopStateEvent("popstate",{})))},setParam(e,t){this._internal.params[e]=t},setQuery(e,t){this._internal.query[e]=t},registerInputIfNeeded(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}}};function s(e,t){function n(t){function n(){var n;const o=[];if(void 0!==t.parameters.path){const e=(t.parameters.path.match(/\{[A-Za-z0-9_]*\}/g)||[]).map((e=>e.replace("{","").replace("}",""))).filter(((e,t,n)=>n.indexOf(e)===t)).map((e=>({name:"p-"+e,displayName:e,group:"Parameter",type:"*",plug:"input"})));o.push(...e)}void 0!==t.parameters.queryNames&&t.parameters.queryNames.split(",").forEach((e=>{o.push({name:"q-"+e,displayName:e,group:"Query",plug:"input",type:"*"})})),null===(n=e.editorConnection)||void 0===n||n.sendDynamicPorts(t.id,o)}n(),t.on("parameterUpdated",(function(e){n()}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.PageStackNavigateToPath",(function(e){n(e)}));for(const e of t.getNodesWithType("PageStackNavigateToPath"))n(e)}))}},5738:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>s,setup:()=>r});var o=n(5573),i=n(7410);const s={name:"PageStackNavigate",displayNodeName:"Push Component To Stack",category:"Navigation",docs:"https://docs.noodl.net/nodes/component-stack/push-component",initialize(){this._internal.transitionParams={},this._internal.pageParams={},this._internal.backResults={}},inputs:{stack:{type:{name:"string",identifierOf:"PackStack"},displayName:"Stack",group:"General",default:"Main",set(e){this._internal.stack=e}},mode:{type:{name:"enum",enums:[{label:"Push",value:"push"},{label:"Replace",value:"replace"}]},displayName:"Mode",default:"push",group:"General",set(e){this._internal.navigationMode=e}},navigate:{displayName:"Navigate",group:"Actions",valueChangedToTrue(){this.scheduleNavigate()}}},outputs:{navigated:{type:"signal",displayName:"Navigated",group:"Events"}},methods:{scheduleNavigate(){const e=this._internal;e.hasScheduledNavigate||(e.hasScheduledNavigate=!0,this.scheduleAfterInputsHaveUpdated((()=>{e.hasScheduledNavigate=!1,this.navigate()})))},navigate(){"push"===this._internal.navigationMode||void 0===this._internal.navigationMode?i.A.instance.navigate(this._internal.stack,{target:this._internal.target,transition:{type:this._internal.transition,...this._internal.transitionParams},params:this._internal.pageParams,backCallback:(e,t)=>{this._internal.backResults=t;for(const e in t)this.hasOutput("backResult-"+e)&&this.flagOutputDirty("backResult-"+e);void 0!==e&&this.sendSignalOnOutput(e)},hasNavigated:()=>{this.sendSignalOnOutput("navigated")}}):"replace"===this._internal.navigationMode&&i.A.instance.replace(this._internal.stack,{target:this._internal.target,params:this._internal.pageParams,hasNavigated:()=>{this.scheduleAfterInputsHaveUpdated((()=>{this.sendSignalOnOutput("navigated")}))}})},setTransitionParam(e,t){this._internal.transitionParams[e]=t},setPageParam(e,t){this._internal.pageParams[e]=t},getBackResult(e){return this._internal.backResults[e]},setTargetPageId(e){this._internal.target=e},setTransition(e){this._internal.transition=e},registerInputIfNeeded(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(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(){}}):void 0}}};function r(e,t){function n(n){function i(){var i;const s=[];if("push"===n.parameters.mode||void 0===n.parameters.mode){s.push({name:"transition",plug:"input",type:{name:"enum",enums:Object.keys(o.x)},default:"Push",displayName:"Transition",group:"Transition"});const e=n.parameters.transition||"Push";o.x[e]&&s.push(...o.x[e].ports(n.parameters))}const r=t.getNodesWithType("Page Stack").find((e=>(e.parameters.name||"Main")===(n.parameters.stack||"Main")));if(void 0!==r){const e=r.parameters.pages;if(void 0!==e&&e.length>0){s.push({plug:"input",type:{name:"enum",enums:e.map((e=>({label:e.label,value:e.id})))},group:"General",displayName:"Target Page",name:"target",default:e[0].id});const o=n.parameters.target||e[0].id,i=r.parameters["pageComp-"+o];if(void 0!==i){const e=t.components[i];if(void 0!==e){for(const t in e.inputPorts)s.push({name:"pm-"+t,displayName:t,type:"*",plug:"input",group:"Parameters"});for(const t of e.getNodesWithType("PageStackNavigateBack"))void 0!==t.parameters.backActions&&t.parameters.backActions.split(",").forEach((e=>{s.find((t=>t.name==="backAction-"+e))||s.push({name:"backAction-"+e,displayName:e,type:"signal",plug:"output",group:"Back Actions"})})),t.parameters.results&&t.parameters.results.split(",").forEach((e=>{s.find((t=>t.name==="backResult-"+e))||s.push({name:"backResult-"+e,displayName:e,type:"*",plug:"output",group:"Back Results"})}))}}}}null===(i=e.editorConnection)||void 0===i||i.sendDynamicPorts(n.id,s)}function s(){const e=t.getNodesWithType("Page Stack").find((e=>e.parameters.name===n.parameters.stack));if(void 0===e)return;const o=e.parameters.pages;if(void 0===o||0===o.length)return;const s=e.parameters["pageComp-"+(n.parameters.target||o[0].id)];if(void 0===s)return;const r=t.components[s];if(void 0!==r){r.on("inputPortAdded",i),r.on("inputPortRemoved",i);for(const e of r.getNodesWithType("PageStackNavigateBack"))e.on("parameterUpdated",i);r.on("nodeAdded",(e=>{"PageStackNavigateBack"===e.type&&(e.on("parameterUpdated",i),i())})),r.on("nodeWasRemoved",(e=>{"PageStackNavigateBack"===e.type&&i()}))}}function r(e){e.on("parameterUpdated",(function(e){"pages"!==e.name&&"name"!==e.name||i()}))}i(),s(),n.on("parameterUpdated",(function(e){"target"===e.name?(s(),i()):("stack"===e.name||"mode"===e.name||"transition"===e.name||e.name.startsWith("tr-"))&&i()})),t.on("nodeAdded.Page Stack",r),t.on("nodeWasRemoved.Page Stack",i);for(const e of t.getNodesWithType("Page Stack"))r(e)}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.PageStackNavigate",(function(e){n(e)}));for(const e of t.getNodesWithType("PageStackNavigate"))n(e)}))}},7410:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});class o{constructor(){this._pageStacks={},this._navigationQueue=[]}_performNavigation(e="Main",t,n){if(this._pageStacks[e])for(const o of this._pageStacks[e])"navigate"===n?o.navigate(t):o.replace(t);else this._navigationQueue.push({name:e,args:t,type:n})}navigate(e="Main",t){this._performNavigation(e,t,"navigate")}replace(e="Main",t){this._performNavigation(e,t,"replace")}registerPageStack(e="Main",t){this._pageStacks[e]||(this._pageStacks[e]=[]),this._pageStacks[e].push(t);let n=!1,o=!1,i=0;for(;i<this._navigationQueue.length;){const s=this._navigationQueue[i];s.name===e?("navigate"===s.type?(n||(t.reset(),n=!0),t.navigate(s.args)):t.replace(s.args),o=!0,this._navigationQueue.splice(i,1)):i++}o||t.reset()}deregisterPageStack(e="Main",t){if(!this._pageStacks[e])return;const n=this._pageStacks[e].indexOf(t);-1!==n&&(this._pageStacks[e].splice(n,1),0===this._pageStacks[e].length&&delete this._pageStacks[e])}}o.instance=new o;const i=o},6982:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o,setup:()=>i});const o={name:"PageInputs",displayNodeName:"Page Inputs",category:"Navigation",docs:"https://docs.noodl.net/nodes/navigation/page-inputs",color:"component",initialize(){this._internal.params={}},inputs:{pathParams:{type:{name:"stringlist",allowEditOnly:!0},group:"Path Parameters"},queryParams:{type:{name:"stringlist",allowEditOnly:!0},group:"Query Parameters"}},outputs:{},methods:{_setPageParams(e){for(const t in e)this._internal.params[t]=e[t],this.hasOutput("pm-"+t)&&this.flagOutputDirty("pm-"+t)},getPageParam(e){return this._internal.params[e]},registerOutputIfNeeded(e){if(!this.hasOutput(e))return e.startsWith("pm-")?this.registerOutput(e,{getter:this.getPageParam.bind(this,e.substring(3))}):void 0}}};function i(e,t){function n(t){function n(){var n;const o=[],i={};void 0!==t.parameters.pathParams&&t.parameters.pathParams.split(",").forEach((e=>{i[e]=!0})),void 0!==t.parameters.queryParams&&t.parameters.queryParams.split(",").forEach((e=>{i[e]=!0})),Object.keys(i).forEach((e=>{o.push({name:"pm-"+e,displayName:e,type:"*",plug:"output",group:"Parameters"})})),null===(n=e.editorConnection)||void 0===n||n.sendDynamicPorts(t.id,o)}n(),t.on("parameterUpdated",(function(){n()}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.PageInputs",(function(e){n(e)}));for(const e of t.getNodesWithType("PageInputs"))n(e)}))}},5741:(e,t,n)=>{"use strict";n.d(t,{u:()=>i});var o=n(260);class i{constructor(){this._routers={},this._navigationQueue=[]}navigate(e,t){setTimeout((()=>{const n=Object.keys(this._routers);if(1===n.length&&(e=n[0]),this._routers[e])for(const n of this._routers[e])n.navigate(t);else this._navigationQueue.push({name:e,args:t})}),1)}registerRouter(e,t){e=e||"Main",this._routers[e]||(this._routers[e]=[]),this._routers[e].push(t);let n=!1,o=0;for(;o<this._navigationQueue.length;){const i=this._navigationQueue[o];i.name===e?(t.navigate(i.args),n=!0,this._navigationQueue.splice(o,1)):o++}n||t.reset()}deregisterRouter(e,t){if(e=e||"Main",!this._routers[e])return;const n=this._routers[e].indexOf(t);-1!==n&&(this._routers[e].splice(n,1),0===this._routers[e].length&&delete this._routers[e])}getPagesForRouter(e){const t=o.default.instance.graphModel.routerIndex.routers;if(void 0===t||0===t.length)return[];const n=void 0===e?[t[0]]:t.filter((t=>t.name===e)),i=new Set;return n.forEach((e=>{const t=e.pages;void 0!==t&&void 0!==t.routes&&t.routes.forEach((e=>{i.add(e)}))})),Array.from(i).map((e=>this.getPageInfoForComponent(String(e)))).filter((e=>!!e))}getPageInfoForComponent(e){return o.default.instance.graphModel.routerIndex.pages.find((t=>t.component===e))}onNavigated(e,t){window.Noodl.Events.emit("NoodlApp_Navigated",{routerName:e,...t})}}i.instance=new i},5178:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(5741);const i={name:"RouterNavigate",displayNodeName:"Navigate",category:"Navigation",docs:"https://docs.noodl.net/nodes/navigation/navigate",initialize(){this._internal.pageParams={},this._internal.openInNewTab=!1},inputs:{navigate:{displayName:"Navigate",group:"Actions",valueChangedToTrue(){this.scheduleNavigate()}},openInNewTab:{index:10,displayName:"Open in new tab",group:"General",default:!1,type:"boolean",set(e){this._internal.openInNewTab=!!e}}},outputs:{navigated:{type:"signal",displayName:"Navigated",group:"Events"}},methods:{scheduleNavigate(){const e=this._internal;e.hasScheduledNavigate||(e.hasScheduledNavigate=!0,this.scheduleAfterInputsHaveUpdated((()=>{e.hasScheduledNavigate=!1,this.navigate()})))},navigate(){o.u.instance.navigate(this._internal.router,{target:this._internal.target,params:this._internal.pageParams,openInNewTab:this._internal.openInNewTab,hasNavigated:()=>{this.scheduleAfterInputsHaveUpdated((()=>{this.sendSignalOnOutput("navigated")}))}})},setPageParam(e,t){this._internal.pageParams[e]=t},setTargetPage(e){this._internal.target=e},setRouter(e){this._internal.router=e},registerInputIfNeeded(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}}}},320:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o,setup:()=>i});const o={name:"NavigationShowPopup",displayNodeName:"Show Popup",category:"Navigation",docs:"https://docs.noodl.net/nodes/popups/show-popup",initialize(){this._internal.popupParams={},this._internal.closeResults={}},inputs:{target:{type:"component",displayName:"Target",group:"General",set(e){this._internal.target=e}},show:{type:"signal",displayName:"Show",group:"Actions",valueChangedToTrue(){this.scheduleShow()}}},outputs:{Closed:{type:"signal"}},methods:{setPopupParam(e,t){this._internal.popupParams[e]=t},getCloseResult(e){return this._internal.closeResults[e]},scheduleShow(){const e=this._internal;e.hasScheduledShow||(e.hasScheduledShow=!0,this.scheduleAfterInputsHaveUpdated((()=>{e.hasScheduledShow=!1,this.show()})))},show(){void 0!==this._internal.target&&this.context.showPopup(this._internal.target,this._internal.popupParams,{senderNode:this.nodeScope.componentOwner,onClosePopup:(e,t)=>{this._internal.closeResults=t;for(const e in t)this.hasOutput("closeResult-"+e)&&this.flagOutputDirty("closeResult-"+e);e?this.sendSignalOnOutput(e):this.sendSignalOnOutput("Closed")}})},registerInputIfNeeded(e){if(!this.hasInput(e))return e.startsWith("popupParam-")?this.registerInput(e,{set:this.setPopupParam.bind(this,e.substring(11))}):void 0},registerOutputIfNeeded(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(){}}):void 0}}};function i(e,t){function n(n){function o(){var o;const i=[],s=n.parameters.target;if(void 0!==s){const e=t.components[s];if(e){for(const t in e.inputPorts){const n=e.inputPorts[t];i.push({name:"popupParam-"+t,displayName:t,type:n.type||"*",plug:"input",group:"Params"})}for(const t of e.getNodesWithType("NavigationClosePopup"))void 0!==t.parameters.closeActions&&t.parameters.closeActions.split(",").forEach((e=>{i.find((t=>t.name===e))||i.push({name:"closeAction-"+e,displayName:e,type:"signal",plug:"output",group:"Close Actions"})})),void 0!==t.parameters.results&&t.parameters.results.split(",").forEach((e=>{i.push({name:"closeResult-"+e,displayName:e,type:"*",plug:"output",group:"Close Results"})}))}}null===(o=e.editorConnection)||void 0===o||o.sendDynamicPorts(n.id,i)}function i(e){if(void 0===e)return;const n=t.components[e];if(void 0!==n){n.on("inputPortAdded",o),n.on("inputPortRemoved",o);for(const e of n.getNodesWithType("NavigationClosePopup"))e.on("parameterUpdated",o);n.on("nodeAdded",(e=>{"NavigationClosePopup"===e.type&&(e.on("parameterUpdated",o),o())})),n.on("nodeWasRemoved",(e=>{"NavigationClosePopup"===e.type&&o()}))}}o(),i(n.parameters.target),n.on("parameterUpdated",(function(e){"target"===e.name&&(o(),i(n.parameters.target))}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.NavigationShowPopup",(function(e){n(e)}));for(const e of t.getNodesWithType("NavigationShowPopup"))n(e)}))}},5573:(e,t,n)=>{"use strict";n.d(t,{x:()=>r});class o{constructor(){this.transitionForward=!1,this.startTime=0,this.timing={delay:0,dur:0},this._frame=this.frame.bind(this),this.timing={delay:0,dur:0}}start(e){this.cb=e.end,this.timing.delay+this.timing.dur===0?this.end():(this.transitionForward=!e.back,this.startTime=window.performance.now(),requestAnimationFrame(this._frame))}frame(){const 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()}end(){this.cb&&this.cb()}forward(e){}back(e){}}var i=n(8972),s=n.n(i);const r={None:class extends o{constructor(e,t,n){super(),this.from=e,this.to=t,this.timing={dur:0,delay:0}}update(e){}forward(e){}back(e){}static ports(){return[]}},Push:class extends o{constructor(e,t,n){super(),this.from=e,this.to=t,this.timing=n.timing||{curve:[0,0,.58,1],dur:300,delay:0},this.distance=n.shift||{value:25,unit:"%"},"number"==typeof this.distance&&(this.distance={value:this.distance,unit:"%"}),this.direction=n.direction||"Left",this.timing.curve[0]=Math.min(1,Math.max(0,this.timing.curve[0])),this.timing.curve[2]=Math.min(1,Math.max(0,this.timing.curve[2])),this.ease=s().apply(null,this.timing.curve).get,this.crossfade=void 0!==n.crossfade&&n.crossfade,this.darkOverlay=void 0===n.darkoverlay||n.darkoverlay,this.darkOverlayAmount=void 0===n.darkoverlayamount?.5:n.darkoverlayamount,this.zoom=n.zoom||{value:25,unit:"%"},"number"==typeof this.zoom&&(this.zoom={value:this.zoom,unit:"%"}),this.darkOverlay&&(this.darkOverlay=e.nodeScope.createPrimitiveNode("Group"),this.darkOverlay.setInputValue("position","absolute"),this.darkOverlay.setInputValue("sizeMode","explicit"),this.darkOverlay.setInputValue("width",{value:100,unit:"%"}),this.darkOverlay.setInputValue("height",{value:100,unit:"%"}),this.darkOverlay.setInputValue("backgroundColor","#000000"),this.darkOverlay.setInputValue("opacity",0))}update(e){if("In"===this.direction||"Out"===this.direction){let 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{const t=this.distance.value,n=this.distance.unit,o={Up:{x:0,y:-1},Down:{x:0,y:1},Left:{x:-1,y:0},Right:{x:1,y:0}},i={x:o[this.direction].x*t,y:o[this.direction].y*t},s={x:100*o[this.direction].x,y:100*o[this.direction].y};this.from.setStyle({transform:"translate("+i.x*e+n+","+i.y*e+n+")",opacity:this.crossfade?1-e:1}),this.to.setStyle({transform:"translate("+s.x*(e-1)+n+","+s.y*(e-1)+"%)",opacity:this.crossfade?e:1})}this.darkOverlay&&this.darkOverlay.setStyle({opacity:e*this.darkOverlayAmount})}forward(e){const t=this.ease(e);this.update(t)}back(e){const t=this.ease(e);this.update(1-t)}start(e){super.start(e),this.darkOverlay&&this.from.addChild(this.darkOverlay)}end(){this.darkOverlay&&this.from.removeChild(this.darkOverlay),super.end()}static ports(e){const 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}},Popup:class extends o{constructor(e,t,n){super(),this.from=e,this.to=t,this.timing=n.timing||{curve:[0,0,.58,1],dur:300,delay:0},this.distance=n.shift||{value:25,unit:"%"},"number"==typeof this.distance&&(this.distance={value:this.distance,unit:"%"}),this.direction=n.direction||"Right",this.timing.curve[0]=Math.min(1,Math.max(0,this.timing.curve[0])),this.timing.curve[2]=Math.min(1,Math.max(0,this.timing.curve[2])),this.ease=s().apply(null,this.timing.curve).get,this.fadein=void 0!==n.fadein&&n.fadein,this.zoom=n.zoom||{value:25,unit:"%"},"number"==typeof this.zoom&&(this.zoom={value:this.zoom,unit:"%"})}update(e){if("In"===this.direction||"Out"===this.direction){let t=this.zoom.value/100;t="Out"===this.direction?-t:t,this.to.setStyle({transform:"scale("+(1-t*(1-e))+")",opacity:this.crossfade?e:1})}else{const t=this.distance.value,n=this.distance.unit,o={Up:{x:0,y:-1},Down:{x:0,y:1},Left:{x:-1,y:0},Right:{x:1,y:0}},i={x:o[this.direction].x*t,y:o[this.direction].y*t};this.to.setStyle({transform:"translate("+i.x*(e-1)+n+","+i.y*(e-1)+n+")",opacity:this.fadein?e:1})}}forward(e){const t=this.ease(e);this.update(t)}back(e){const t=this.ease(e);this.update(1-t)}static ports(e){const 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}}}},7183:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(2004);const i={name:"net.noodl.animatetovalue",docs:"https://docs.noodl.net/nodes/logic/animate-to-value",displayName:"Animate To Value",shortDesc:"This node can interpolate smoothly from the current value to a target value.",category:"Animation",initialize(){const e=this._internal;e.currentNumber=0,e.numberInitialized=!1,e.animationStarted=!1,e.setCurrentNumberEnabled=!1,e.overrideValue=0,e._animation=this.context.timerScheduler.createTimer({duration:300,startValue:0,endValue:0,ease:o.A.easeOut,onStart:()=>{e.animationStarted=!0},onRunning:t=>{e.currentNumber=this.ease(this.startValue,this.endValue,t),this.flagOutputDirty("currentValue")},onFinish:()=>{this.sendSignalOnOutput("atTargetValue")}})},getInspectInfo(){return this._internal.currentNumber},inputs:{targetValue:{type:{name:"number"},displayName:"Target Value",group:"Target Value",default:void 0,set(e){if(!0===e?e=1:!1===e&&(e=0),e=Number(e),isNaN(e))return;const t=this._internal;if(!t.numberInitialized)return t.currentNumber=e,t.numberInitialized=!0,t._animation.endValue=e,void this.flagOutputDirty("currentValue");e!==t._animation.endValue&&(t._animation.startValue=t.currentNumber,t._animation.endValue=e,t._animation.start())}},duration:{type:"number",group:"Parameters",displayName:"Duration",default:300,set(e){this._internal._animation.duration=e}},delay:{type:"number",group:"Parameters",displayName:"Delay",default:0,set(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",set(e){this._internal._animation.ease=o.A[e]}}},outputs:{currentValue:{type:"number",displayName:"Current Value",group:"Current State",getter(){return this._internal.currentNumber}},atTargetValue:{type:"signal",displayName:"At Target Value",group:"Signals"}}}},374:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>d});var o=n(2004);function i(e,t){for(let n=0;n<3;++n){const o=1+2*n;e[n]=parseInt(t.substring(o,o+2),16)}}function s(e){const t=e.toString(16);return 1===t.length?"0"+t:t}let r=[0,0,0],a=[0,0,0],l=[0,0,0];const d={name:"Color Blend",docs:"https://docs.noodl.net/nodes/utilities/color-blend",shortDesc:"Given any number of input colors this node can interpolate between these and give the result color as output.",category:"Interpolation",getInspectInfo(){return[{type:"color",value:this._internal.resultColor}]},initialize(){const e=this._internal;e.resultColor="#000000",e.blendValue=0,e.colors=[]},numberedInputs:{color:{type:"color",displayPrefix:"Color",createSetter(e){return t=>{this._internal.colors[e]=t,this.updateColor()}}}},inputs:{blendValue:{type:"number",displayName:"Blend Value",default:0,set(e){this._internal.blendValue=e,this.updateColor()}}},outputs:{result:{type:"color",displayName:"Result",getter(){return this._internal.resultColor}}},methods:{updateColor(){const e=this._internal.colors;if(0===e.length)return;const t=t=>e[t]?e[t]:"#000000",n=(d=e.length-1,u=this._internal.blendValue,Math.max(0,Math.min(d,u)));var d,u;const c=Math.floor(n),p=n-c;var h;0===p?this._internal.resultColor=t(c):(i(r,t(c)),i(a,t(c+1)),l[0]=Math.floor(o.A.linear(r[0],a[0],p)),l[1]=Math.floor(o.A.linear(r[1],a[1],p)),l[2]=Math.floor(o.A.linear(r[2],a[2],p)),this._internal.resultColor="#"+s((h=l)[0])+s(h[1])+s(h[2])),this.flagOutputDirty("result")}}}},2390:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(260);const i={name:"CloudFunction2",displayName:"Cloud Function",category:"Cloud Services",color:"data",usePortAsLabel:"function",docs:"https://docs.noodl.net/nodes/data/cloud-data/cloud-function",_internal:{paramsValues:{},resultsValues:{}},initialize:function(){this._internal.paramsValues={},this._internal.resultsValues={}},getInspectInfo(){const e=this._internal.lastCallResult;return e?[{type:"value",value:e}]:"[Not executed yet]"},inputs:{call:{type:"signal",displayName:"Call",group:"Actions",valueChangedToTrue:function(){this.scheduleCall()}}},outputs:{success:{type:"signal",displayName:"Success",group:"Signals"},failure:{type:"signal",displayName:"Failure",group:"Signals"},error:{type:"string",displayName:"Error",group:"Error",getter:function(){return this._internal.error}}},methods:{setError:function(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure")},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(){const e=this._internal;e.hasScheduledCall||(e.hasScheduledCall=!0,this.scheduleAfterInputsHaveUpdated(this.doCall.bind(this)))},doCall:function(){this._internal.hasScheduledCall=!1;const e=o.default.instance.getMetaData("cloudservices");this.context.editorConnection&&(void 0===e||void 0===e.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"));const t=e.appId,n=this.context.editorConnection.isRunningLocally()?`http://${window.location.hostname}:8577`:e.endpoint;!function(e,t){const n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){let e;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");const i=o.default.instance.getMetaData("cloudservices");i&&i.deployVersion&&n.setRequestHeader("x-noodl-cloud-version",i.deployVersion);const s=localStorage["Parse/"+t.appId+"/currentUser"];if(void 0!==s)try{const e=JSON.parse(s);n.setRequestHeader("X-Parse-Session-Token",e.sessionToken)}catch(e){}n.send(JSON.stringify(t.content))}("/functions/"+encodeURIComponent(this._internal.functionName),{appId:t,endpoint:n,content:this._internal.paramsValues,method:"POST",success:e=>{if(void 0===e)this._internal.lastCallResult={status:"success",parameters:this._internal.paramsValues,results:"empty"};else{const t=e.result||{};for(let e in t)this._internal.resultsValues[e]=t[e],this.hasOutput("out-"+e)&&this.flagOutputDirty("out-"+e);this._internal.lastCallResult={status:"success",parameters:this._internal.paramsValues,results:this._internal.resultsValues}}this.sendSignalOnOutput("success")},error:e=>{const t="string"==typeof e?e:e.error||"Failed running cloud function.";this._internal.lastCallResult={status:"failure",error:t},this.setError(t)}})}}}},6439:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(260);const i={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",group:"General",set:function(e){e instanceof o.Collection&&(e=e.getId()),this.setCollectionID(e)}},clear:{displayName:"Do",group:"Actions",valueChangedToTrue:function(){this.scheduleAfterInputsHaveUpdated((()=>{this._internal.collection.set([]),this.sendSignalOnOutput("modified")}))}}},outputs:{modified:{group:"Events",type:"signal",displayName:"Done"}},methods:{setCollectionID:function(e){this.setCollection(o.Collection.get(e))},setCollection:function(e){this._internal.collection=e}}}},1749:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(260);const i={name:"CollectionInsert",docs:"https://docs.noodl.net/nodes/data/array/insert-into-array",displayNodeName:"Insert Object Into Array",shortDesc:"A collection of models, mainly used together with a For Each Node.",category:"Data",usePortAsLabel:"collectionId",color:"data",inputs:{collectionId:{type:{name:"string",identifierOf:"CollectionName",identifierDisplayName:"Array Ids"},displayName:"Array Id",group:"General",set(e){e instanceof o.Collection&&(e=e.getId()),this.setCollectionID(e)}},modifyId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Object Id",group:"Modify",set(e){this._internal.modifyId=e}},add:{displayName:"Do",group:"Actions",valueChangedToTrue:function(){const e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{if(this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"insert-warning"),void 0===e.modifyId)return void(this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"insert-warning",{showGlobally:!0,message:"No Object Id specified"}));if(void 0===e.collection)return void(this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"insert-warning",{showGlobally:!0,message:"No Array Id specified"}));const t=o.Model.get(e.modifyId);e.collection.add(t),this.sendSignalOnOutput("modified")}))}}},outputs:{modified:{group:"Events",type:"signal",displayName:"Done"}},methods:{setCollectionID(e){this.setCollection(o.Collection.get(e))},setCollection(e){this._internal.collection=e}}}},4380:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(260);const i={name:"CollectionNew",docs:"https://docs.noodl.net/nodes/data/array/create-new-array",displayNodeName:"Create New Array",shortDesc:"A collection of models, mainly used together with a For Each Node.",category:"Data",color:"data",initialize(){},inputs:{new:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleNew()}},items:{type:"array",group:"General",displayName:"Items",set(e){this._internal.sourceCollection=e}}},outputs:{id:{type:"string",displayName:"Id",group:"General",getter(){return this._internal.collection?this._internal.collection.getId():this._internal.collectionId}},created:{group:"Events",type:"signal",displayName:"Done"}},prototypeExtensions:{setCollectionID(e){this.setCollection(o.Collection.get(e))},setCollection(e){this._internal.collection=e,this.flagOutputDirty("id")},scheduleNew(){this.hasScheduledNew||(this.hasScheduledNew=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledNew=!1;const e=o.Collection.get();void 0!==this._internal.sourceCollection&&e.set(this._internal.sourceCollection),this.setCollection(e),this.sendSignalOnOutput("created")})))}}}},1088:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(260);const i={name:"CollectionRemove",docs:"https://docs.noodl.net/nodes/data/array/remove-from-array",displayNodeName:"Remove Object From Array",shortDesc:"A collection of models, mainly used together with a For Each Node.",category:"Data",usePortAsLabel:"collectionId",color:"data",initialize:function(){},inputs:{collectionId:{type:{name:"string",identifierOf:"CollectionName",identifierDisplayName:"Array Ids"},displayName:"Array Id",group:"General",set:function(e){e instanceof o.Collection&&(e=e.getId()),this.setCollectionID(e)}},modifyId:{type:{name:"string",allowConnectionsOnly:!0},displayName:"Object Id",group:"Modify",set:function(e){this._internal.modifyId=e}},remove:{displayName:"Do",group:"Actions",valueChangedToTrue:function(){const e=this,t=this._internal;this.scheduleAfterInputsHaveUpdated((function(){if(void 0===t.modifyId)return;if(void 0===t.collection)return;const n=o.Model.get(t.modifyId);t.collection.remove(n),e.sendSignalOnOutput("modified")}))}}},outputs:{modified:{group:"Events",type:"signal",displayName:"Done"}},prototypeExtensions:{setCollectionID:function(e){this.setCollection(o.Collection.get(e))},setCollection:function(e){this._internal.collection=e}}}},7397:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(260);const i={name:"Collection2",docs:"https://docs.noodl.net/nodes/data/array/array-node",displayNodeName:"Array",shortDesc:"A collection of models, mainly used together with a For Each Node.",category:"Data",usePortAsLabel:"collectionId",color:"data",initialize(){let e=!1;this._internal.collectionChangedCallback=()=>{this.isInputConnected("fetch")||e||(e=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.sendSignalOnOutput("changed"),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("count"),e=!1})))},this._internal.sourceCollectionChangedCallback=()=>{this.isInputConnected("store")||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",group:"General",set(e){e instanceof o.Collection&&(e=e.getId()),this._internal.collectionId=e,this.isInputConnected("fetch")?this.flagOutputDirty("id"):this.setCollectionID(e)}},items:{type:"array",group:"General",displayName:"Items",set(e){void 0!==e&&e!==this._internal.collection&&(this._internal.pendingSourceCollection=e,this.isInputConnected("store")||this.scheduleAfterInputsHaveUpdated((()=>{this.setSourceCollection(e)})))}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleSetCollection()}}},outputs:{id:{type:"string",displayName:"Id",group:"General",getter(){return this._internal.collection?this._internal.collection.getId():this._internal.collectionId}},items:{type:"array",displayName:"Items",group:"General",getter(){return this._internal.collection}},firstItemId:{type:"string",displayName:"First Item Id",group:"General",getter(){if(this._internal.collection){const e=this._internal.collection.get(0);if(void 0!==e)return e.getId()}}},count:{type:"number",displayName:"Count",group:"General",getter(){return this._internal.collection?this._internal.collection.size():0}},changed:{group:"Events",type:"signal",displayName:"Changed"},fetched:{group:"Events",type:"signal",displayName:"Fetched"}},prototypeExtensions:{setCollectionID(e){this.setCollection(o.Collection.get(e))},setCollection(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(e){const t=this._internal;t.sourceCollection&&t.sourceCollection instanceof o.Collection&&t.sourceCollection.off("change",t.sourceCollectionChangedCallback),t.sourceCollection=e,t.sourceCollection instanceof o.Collection&&t.sourceCollection.on("change",t.sourceCollectionChangedCallback),this._copySourceItems()},scheduleSetCollection(){this.hasScheduledSetCollection||(this.hasScheduledSetCollection=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledSetCollection=!1,this.setCollectionID(this._internal.collectionId),this.sendSignalOnOutput("fetched")})))},scheduleStore(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledStore=!1,this.setSourceCollection(e.pendingSourceCollection)}))},_copySourceItems(){const e=this._internal;void 0!==e.collection||this.isInputConnected("fetch")||this.setCollection(o.Collection.get()),e.collection&&e.collection.set(e.sourceCollection)},scheduleCopyItems(){this.hasScheduledCopyItems||(this.hasScheduledCopyItems=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledCopyItems=!1,this._copySourceItems()})))},_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this._internal.collection&&this._internal.collection.off("change",this._internal.collectionChangedCallback)}}}},2653:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>s,setup:()=>l});var o=n(260);const i=function(e,t){e instanceof o.Model&&(e=e.data),t instanceof o.Model&&(t=t.data);for(const n in this){const o=e[n],i=t[n];if(o!==i)return"string"==typeof o&&"string"==typeof i?1===this[n]?o>i?1:-1:o>i?-1:1:"number"==typeof o&&"number"==typeof i?1===this[n]?o-i:i-o:1===this[n]?o>i?1:-1:o>i?-1:1}return 0},s={name:"Filter Collection",docs:"https://docs.noodl.net/nodes/data/array/array-filter",displayNodeName:"Array Filter",shortDesc:"Filter, sort and limit array",category:"Data",color:"data",initialize:function(){this._internal.collectionChangedCallback=()=>{!0!==this.isInputConnected("filter")&&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",group:"General",set(e){this.bindCollection(e),this.isInputConnected("filter")||this.scheduleFilter()}},enabled:{type:"boolean",group:"General",displayName:"Enabled",default:!0,set:function(e){this._internal.enabled=e,this.isInputConnected("filter")||this.scheduleFilter()}},filter:{type:"signal",group:"Actions",displayName:"Filter",valueChangedToTrue:function(){this.scheduleFilter()}}},outputs:{items:{type:"array",displayName:"Items",group:"General",getter:function(){return this._internal.filteredCollection}},firstItemId:{type:"string",displayName:"First Item Id",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",group:"General",getter:function(){return this._internal.filteredCollection?this._internal.filteredCollection.size():0}},modified:{group:"Events",type:"signal",displayName:"Filtered"}},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.collection=e,e&&e.on("change",this._internal.collectionChangedCallback)},_onNodeDeleted:function(){o.Node.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection()},getFilter:function(){const e=this._internal.filterSettings,t=["case"];if(e.filterFilter){const n=e.filterFilter.split(","),o={};return n.forEach((n=>{const i="$"+(e["filterFilterOp-"+n]||"eq");o[n]={},o[n][i]=e["filterFilterValue-"+n],t.forEach((t=>{const i=e["filterFilterOption-"+t+"-"+n];i&&(o[n]["$"+t]=i)}))})),o}},getSort:function(){const e=this._internal.filterSettings;if(e.filterSort){const t=e.filterSort.split(","),n={};return t.forEach((t=>{n[t]="descending"===e["filterSort-"+t]?-1:1})),n}},getLimit:function(){const e=this._internal.filterSettings;if(e.filterEnableLimit)return e.filterLimit||10},getSkip:function(){const e=this._internal.filterSettings;if(e.filterEnableLimit)return e.filterSkip||0},scheduleFilter:function(){this.collectionChangedScheduled||(this.collectionChangedScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{if(this.collectionChangedScheduled=!1,!this._internal.collection)return;let e=[].concat(this._internal.collection.items);if(this._internal.enabled){const t=this.getFilter();t&&(e=e.filter((e=>((e,t)=>{for(const n in t){const o=t[n];if(void 0!==o.$neq){if(e[n]==o.$neq)return!1}else{if(void 0===e[n])return!1;if(void 0!==o.$eq&&e[n]!=o.$eq)return!1;if(!(void 0===o.$gt||e[n]>o.$gt))return!1;if(!(void 0===o.$lt||e[n]<o.$lt))return!1;if(!(void 0===o.$gte||e[n]>=o.$gte))return!1;if(!(void 0===o.$lte||e[n]<=o.$lte))return!1;if(void 0!==o.$regex){const t=e[n]+"";if(!new RegExp(o.$regex,!0!==o.$case?"i":void 0).test(t))return!1}}}return!0})(e.data,t))));const n=this.getSort();n&&e.sort(i.bind(n));const o=this.getSkip();o&&(e=e.slice(o,e.length));const s=this.getLimit();s&&(e=e.slice(0,s))}this._internal.filteredCollection=o.Collection.create(e),this.sendSignalOnOutput("modified"),this.flagOutputDirty("firstItemId"),this.flagOutputDirty("items"),this.flagOutputDirty("count")})))},registerInputIfNeeded:function(e){this.hasInput(e)||this.registerInput(e,{set:r.bind(this,e)})}}};function r(e,t){this._internal.filterSettings[e]=t,this.isInputConnected("filter")||this.scheduleFilter()}function a(e,t,n,o){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 s={string:[{value:"eq",label:"Equals"},{value:"neq",label:"Not Equals"},{value:"regex",label:"Matches RegEx"}],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"}]};t.filterFilter&&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:s[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}),i.push({type:n||"string",plug:"input",group:e+" filter",displayName:"Value",editorName:e+" Filter Value",name:"filterFilterValue-"+e})})),t.filterSort&&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)}function l(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Filter Collection",(function(n){a(n.id,n.parameters,e.editorConnection,t.getMetaData("dbCollections")),n.on("parameterUpdated",(function(o){o.name.startsWith("filter")&&a(n.id,n.parameters,e.editorConnection,t.getMetaData("dbCollections"))})),t.on("metadataChanged.dbCollections",(function(t){a(n.id,n.parameters,e.editorConnection)}))}))}},5071:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>l,setup:()=>d});var o=n(1594),i=n.n(o),s=n(260);const r=e=>{const{didMount:t,willUnmount:n}=e;return(0,o.useEffect)((()=>(t(),()=>{n()})),[t,n]),null};function a(e){return"object"==typeof e?e.name:e}const l={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(){this._internal.itemNodes=[],this._internal.itemOutputSignals={},this._internal.itemOutputs={},this._internal.collection=s.Collection.get(),this._internal.queuedOperations=[],this._internal.mountedOperations=[],this._internal.collection.on("add",(async e=>{this._internal.target&&this._queueOperation((async()=>{const t=this._internal.target.getChildren().indexOf(this)+1;await this.addItem(e.item,t+e.index)}))})),this._internal.collection.on("remove",(e=>{this._queueOperation((()=>{this.removeItem(e.item)}))})),this._internal.onItemsCollectionChanged=()=>{s.default.instance.getProjectSettings().repeaterDisabledWhenUnmounted&&!this.isMounted?this._internal.mountedOperations.push((()=>{this._internal.collection.set(this._internal.items)})):this._queueOperation((()=>{this._internal.collection.set(this._internal.items)}))},this.addDeleteListener((()=>{this._deleteAllItemNodes()}))},inputs:{items:{group:"Data",displayName:"Items",type:"array",set(e){e&&e!==this._internal.items&&this.bindCollection(e)}},templateType:{group:"Appearance",displayName:"Template Type",type:{name:"enum",enums:[{label:"Explicit",value:"explicit"},{label:"Dynamic",value:"dynamic"}]},default:"explicit",set(e){this._internal.templateType=e,this.scheduleRefresh()}},template:{type:"component",displayName:"Template",group:"Appearance",set(e){this._internal.template=e,this.scheduleRefresh()}},templateScript:{type:{name:"string",codeeditor:"javascript",allowEditOnly:!0},displayName:"Script",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(e){try{this._internal.templateFunction=new Function("item","var component;"+e+";return component;")}catch(e){console.log(e),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"foreach-syntax-warning",{message:"<strong>Syntax</strong>: "+e.message})}this.scheduleRefresh()}},refresh:{group:"Appearance",displayName:"Refresh",type:"signal",valueChangedToTrue(){this.scheduleRefresh()}}},outputs:{itemActionItemId:{type:"string",group:"Actions",displayName:"Item Id",getter(){return this._internal.itemActionItemId}}},prototypeExtensions:{updateTarget(e){this._internal.target=e?this.nodeScope.getNodeWithId(e):void 0,this.scheduleRefresh()},setNodeModel(e){s.Node.prototype.setNodeModel.call(this,e),e.parent&&this.updateTarget(e.parent.id);var t=this;e.on("parentUpdated",(function(e){t.updateTarget(e?e.id:void 0)}),this)},scheduleRefresh(){var e=this._internal;e.hasScheduledRefresh||(e.hasScheduledRefresh=!0,this.scheduleAfterInputsHaveUpdated((()=>{this._queueOperation((()=>{this.refresh()}))})))},unbindCurrentCollection(){var e=this._internal.items;e&&(s.Collection.instanceOf(e)&&e.off("change",this._internal.onItemsCollectionChanged),this._internal.items=void 0)},bindCollection(e){var t=this._internal;this.unbindCurrentCollection(),s.Collection.instanceOf(e)&&e.on("change",this._internal.onItemsCollectionChanged),t.items=e,this.scheduleCopyItems()},getTemplateForModel(e){var t=this._internal;if(void 0===t.templateType||"explicit"===t.templateType)return t.template;if(t.templateFunction){try{var n=t.templateFunction(e)}catch(e){console.log(e),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"foreach-dynamic-warning",{message:"<strong>Dynamic template</strong>: "+e.message})}if(n&&(n.startsWith("./")&&(n=this.model.component.name+n.substring(1)),n.startsWith("../"))){const e=this.model.component.name.split("/");n=e.slice(0,e.length-1).join("/")+n.substring(2)}return n}},_mapInputs(e,t){void 0!==this._internal.inputMapFunc&&this._internal.inputMapFunc((function(n){for(var o in n)e.hasInput(o)&&("function"==typeof n[o]?e.setInputValue(o,n[o](t)):"string"==typeof n[o]&&e.setInputValue(o,t.get(n[o])))}),t)},addItem:async function(e,t){var n=this._internal,o=this.getTemplateForModel(e);if(o){var i=await this.nodeScope.createNode(o,(0,s.guid)(),{_forEachModel:e,_forEachNode:this});if(void 0===this._internal.inputMapFunc){for(var r in i.hasInput("Id")&&i.setInputValue("Id",e.getId()),i.hasInput("id")&&i.setInputValue("id",e.getId()),i._inputs)void 0!==e.data[r]&&i.setInputValue(r,e.data[r]);i._forEachModelChangeListener=function(e){i._inputs[e.name]&&i.setInputValue(e.name,e.value)},e.on("change",i._forEachModelChangeListener),i.componentModel.on("inputPortAdded",(t=>{"id"===t.name&&i.setInputValue("id",e.getId()),"Id"===t.name&&i.setInputValue("Id",e.getId()),void 0!==e.data[t.name]&&i.setInputValue(t.name,e.data[t.name])}),this)}else this._mapInputs(i,e),i._forEachModelChangeListener=()=>this._mapInputs(i,e),e.on("change",i._forEachModelChangeListener);i._internal.creatorCallbacks={onOutputChanged:(t,o,s)=>{!1!==s&&void 0!==s||!0!==o||!n.itemOutputSignals[t]||this.itemOutputSignalTriggered(t,e,i)}};for(var a=i.nodeScope.getNodesWithType("For Each Actions"),l=0;l<a.length;l++)a[l].signalAdded();n.itemNodes.push(i),n.target.addChild(i,t)}},removeItem(e){var t=this._internal;if(t.target){var n=function(){var n=t.target.getChildren();for(var o in n){var i=n[o];if(i._forEachModel===e&&!i._forEachRemoveInProgress)return i}}();if(n){var o=n.nodeScope.getNodesWithType("For Each Actions");o&&o.length>0?(n._forEachRemoveInProgress=!0,o[0].tryRemove((()=>this._deleteItem(n)))):this._deleteItem(n);var i=t.itemNodes.indexOf(n);-1!==i&&t.itemNodes.splice(i,1)}}},_deleteItem(e){e._forEachModel.off("change",e._forEachModelChangeListener),e.model&&e.model.removeListenersWithRef(this),e.componentModel&&e.componentModel.removeListenersWithRef(this);const t=e.parent;!e._deleted&&t&&(t.removeChild(e),this.nodeScope.deleteNode(e))},_deleteAllItemNodes(){if(this._internal.itemNodes){for(const e of this._internal.itemNodes)this._deleteItem(e);this._internal.itemNodes=[]}},refresh:async function(){var e=this._internal;if(e.hasScheduledRefresh=!1,!e.template&&!e.templateFunction||!e.items)return;if(this._deleteAllItemNodes(),!e.target)return;const t=this._internal.target.getChildren().indexOf(this)+1;for(var n=0;n<e.collection.size();n++){var o=e.collection.get(n);await this.addItem(o,t+n)}},_queueOperation(e){this._internal.queuedOperations.push(e),this._runQueueOperations()},async _runQueueOperations(){if(!this.runningOperations)if(this.runningOperations=!0,s.default.instance.getProjectSettings().repeaterCreateComponentsAsync){const e=async()=>{const t=performance.now();for(;this._internal.queuedOperations.length&&performance.now()-t<25;){const e=this._internal.queuedOperations.shift();await e()}this._internal.queuedOperations.length?setTimeout(e,0):this.runningOperations=!1};e()}else{for(;this._internal.queuedOperations.length;){const e=this._internal.queuedOperations.shift();await e()}this.runningOperations=!1}},_onNodeDeleted(){s.Node.prototype._onNodeDeleted.call(this),this._internal.queuedOperations.length=0,this.unbindCurrentCollection()},render(){return i().createElement(r,{key:this.id,didMount:()=>this.didMount(),willUnmount:()=>this.willUnmount()})},didMount(){this.isMounted=!0;for(const e of this._internal.mountedOperations)this._queueOperation(e);this._internal.mountedOperations=[]},willUnmount(){this.isMounted=!1},getItemActionParameter(e){if(this._internal.itemActionParameters)return this._internal.itemActionParameters[e]},scheduleCopyItems(){this._internal.hasScheduledCopyItems||(this._internal.hasScheduledCopyItems=!0,this.scheduleAfterInputsHaveUpdated((()=>{this._internal.hasScheduledCopyItems=!1,void 0!==this._internal.items&&(s.default.instance.getProjectSettings().repeaterDisabledWhenUnmounted&&!this.isMounted?this._internal.mountedOperations.push((()=>{this._internal.collection.set(this._internal.items)})):this._internal.collection.set(this._internal.items))})))},itemOutputSignalTriggered(e,t,n){this._internal.itemActionItemId=t.getId(),this._internal.itemActionSignal=e,this.flagOutputDirty("itemActionItemId"),this._internal.hasScheduledTriggerItemOutputSignal||(this._internal.hasScheduledTriggerItemOutputSignal=!0,this.context.scheduleAfterUpdate((()=>{for(var e in this._internal.hasScheduledTriggerItemOutputSignal=!1,n._outputs){var t="itemOutput-"+e;this.hasOutput(t)&&(this._internal.itemOutputs[e]=n._outputs[e].value,this.flagOutputDirty(t))}this.sendSignalOnOutput("itemOutputSignal-"+this._internal.itemActionSignal)})))},getItemOutput(e){return this._internal.itemOutputs[e]},registerOutputIfNeeded(e){this.hasOutput(e)||(e.startsWith("itemOutputSignal-")?(this._internal.itemOutputSignals[e.substring(17)]=!0,this.registerOutput(e,{getter(){}})):e.startsWith("itemOutput-")&&this.registerOutput(e,{getter:this.getItemOutput.bind(this,e.substring(11))}))},setInputMappingScript(e){if(this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"foreach-inputmapping-warning"),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.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"foreach-inputmapping-warning",{message:"<strong>Input mapping</strong>: "+e.message})}else this._internal.inputMapFunc=void 0;this.scheduleRefresh()},registerInputIfNeeded(e){if(!this.hasInput(e))return"inputMappingScript"===e?this.registerInput(e,{set:this.setInputMappingScript.bind(this)}):void 0}}},d=function(e,t){function n(n){function o(){var o=n.parameters.template;if(void 0!==o){var i=[],s=t.components[o];if(void 0!==s){for(var r in s.outputPorts)"signal"===a((u=s.outputPorts[r]).type)?i.push({name:"itemOutputSignal-"+r,displayName:r,type:"signal",plug:"output",group:"Item Signals"}):i.push({name:"itemOutput-"+r,displayName:r,type:u.type,plug:"output",group:"Item Outputs"});var l="";for(var d in s.inputPorts){var u;"signal"!==a((u=s.inputPorts[d]).type)&&(l+="\t'"+d+"': '"+d+"',\n")}i.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'() { 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}}",l),plug:"input"}),e.editorConnection.sendDynamicPorts(n.id,i,{detectRenamed:{plug:"output",prefix:"itemOutput"}})}}}function i(e){if(void 0!==e){var n=t.components[e];void 0!==n&&(n.on("outputPortAdded",o),n.on("outputPortRemoved",o),n.on("outputPortTypesUpdated",o),n.on("inputPortTypesUpdated",o),n.on("inputPortAdded",o),n.on("inputPortRemoved",o))}}o(),i(n.parameters.template),n.on("parameterUpdated",(function(e){"template"===e.name&&(o(),i(n.parameters.template))}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.For Each",(function(e){n(e)}));for(const e of t.getNodesWithType("For Each"))n(e)}))}},1358:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(260);const i={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",group:"Events",valueChangedToTrue:function(){this._internal.removeCompletedCallback&&this._internal.removeCompletedCallback()}}},outputs:{added:{type:"signal",displayName:"Added",group:"Events"},tryRemove:{type:"signal",displayName:"Try Remove",group:"Events"},itemId:{type:"string",displayName:"Item Id",group:"General",get(){return this.getItemId()}}},prototypeExtensions:{getItemId(){const e=this.nodeScope.componentOwner._forEachModel;return e&&e.getId()},signalAdded:function(){this.sendSignalOnOutput("added")},tryRemove:function(e){this.getOutput("tryRemove").hasConnections()?(this._internal.removeCompletedCallback=e,this.sendSignalOnOutput("tryRemove")):this.scheduleAfterInputsHaveUpdated((function(){e()}))},itemActionTriggered(e){this.scheduleAfterInputsHaveUpdated((()=>{const t=this.getItemId();this.nodeScope.componentOwner._forEachNode.signalItemAction(e,t,this._internal.actionParameters||{})}))},setItemActionParameter(e){this._internal.actionParameters||(this._internal.actionParameters={}),this._internal.actionParameters[e]=e},registerInputIfNeeded:function(e){if(!this.hasInput(e))return e.startsWith("itemAction-")?this.registerInput(e,{set:(0,o.createSetter)({valueChangedToTrue:this.itemActionTriggered.bind(this,e)})}):e.startsWith("itemActionParameter-")?this.registerInput(e,{set:this.setItemActionParameter.bind(this,e)}):void 0}}}},7949:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(260);const i={name:"Map Collection",docs:"https://docs.noodl.net/nodes/data/array/array-map",displayNodeName:"Array Map",shortDesc:"Map array fields",category:"Data",color:"data",initialize:function(){this._internal.collectionChangedCallback=()=>{this.scheduleMap()}},inputs:{items:{type:"array",displayName:"Items",group:"General",set:function(e){this.setCollection(e),this.scheduleMap()}},mapScript:{type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},displayName:"Script",default:"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",set:function(e){this._internal.mapCode=e;try{this._internal.mapFunc=new Function("map","object",this._internal.mapCode)}catch(e){this._internal.mapFunc=void 0,console.log("Error while parsing map script: "+e)}this.scheduleMap()}}},outputs:{items:{type:"array",displayName:"Items",group:"General",getter:function(){return this._internal.mappedCollection}},count:{type:"number",displayName:"Count",group:"General",getter:function(){return this._internal.mappedCollection?this._internal.mappedCollection.size():0}},modified:{group:"Events",type:"signal",displayName:"Changed"}},prototypeExtensions:{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.collection=e,e&&e.on("change",this._internal.collectionChangedCallback)},_onNodeDeleted:function(){o.Node.prototype._onNodeDeleted.call(this),this.unbindCurrentCollection()},scheduleMap:function(){this.collectionChangedScheduled||(this.collectionChangedScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{if(this.collectionChangedScheduled=!1,void 0===this._internal.collection)return;const e=this._internal.collection.map((e=>{const t=o.Model.create();return this._internal.mapFunc((function(n){for(const o in n)"function"==typeof n[o]?t.set(o,n[o](e)):"string"==typeof n[o]&&t.set(o,e.get(n[o]))}),e),t}));this._internal.mappedCollection=o.Collection.create(e),this.sendSignalOnOutput("modified"),this.flagOutputDirty("items"),this.flagOutputDirty("count")})))}}}},1579:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i,setup:()=>s});var o=n(260);const i={name:"Set Variable",docs:"https://docs.noodl.net/nodes/data/variable/set-variable",category:"Data",usePortAsLabel:"name",color:"data",initialize(){this._internal.variablesModel=o.Model.get("--ndl--global-variables")},getInspectInfo(){return this._internal.name?this._internal.variablesModel.get(this._internal.name):"[No value set]"},outputs:{done:{type:"signal",displayName:"Done",group:"Events"}},inputs:{name:{type:{name:"string",identifierOf:"VariableName",identifierDisplayName:"Variable names"},displayName:"Name",group:"General",set(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",default:"*",group:"General",set(e){this._internal.setWith=e}},do:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleStore()}}},methods:{setValue(e){this._internal.value=e},scheduleStore(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledStore=!1;let t="emptyString"===e.setWith?"":e.value;"object"===e.setWith&&"string"==typeof t&&(t=o.Model.get(t)),"array"===e.setWith&&"string"==typeof t&&(t=o.Collection.get(t)),"boolean"===e.setWith&&(t=!!t),e.variablesModel.set(e.name,t,{forceChange:!0}),this.sendSignalOnOutput("done")}))},registerInputIfNeeded(e){this.hasInput(e)||"value"===e&&this.registerInput(e,{set:this.setValue.bind(this)})}}};function s(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Set Variable",(t=>{const n=()=>{var n;const o=[];"emptyString"!==t.parameters.setWith&&o.push({type:void 0!==t.parameters.setWith?t.parameters.setWith:"*",plug:"input",group:"General",name:"value",displayName:"Value"}),null===(n=e.editorConnection)||void 0===n||n.sendDynamicPorts(t.id,o)};n(),t.on("parameterUpdated",(()=>{n()}))}))}},3817:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i,setup:()=>s});var o=n(260);const i={name:"Static Data",docs:"https://docs.noodl.net/nodes/data/array/static-array",displayNodeName:"Static Array",shortDesc:"Store static data to populate a Collection with items.",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",group:"General",default:"csv",set(e){this._internal.type=e}},csv:{type:{name:"string",codeeditor:"text",allowEditOnly:!0},displayName:"CSV",group:"General",set(e){this._internal.csv=e,this.scheduleParseData()}},json:{type:{name:"string",codeeditor:"json",allowEditOnly:!0},displayName:"JSON",group:"General",set(e){this._internal.json=e,this.scheduleParseData()}}},outputs:{items:{type:"array",displayName:"Items",group:"General",getter(){return this._internal.collection}},count:{type:"number",displayName:"Count",group:"General",get(){return this._internal.collection?this._internal.collection.size():0}}},methods:{scheduleParseData(){const e=this._internal;e.hasScheduledParseData||(e.hasScheduledParseData=!0,this.scheduleAfterInputsHaveUpdated(this.parseData.bind(this)))},parseData(){const e=this._internal;if(e.hasScheduledParseData=!1,e.collection=o.Collection.get(),void 0===e.type||"csv"===e.type){const t=function(e,t=","){const n=new RegExp("(\\"+t+'|\\r?\\n|\\r|^)(?:"([^"]*(?:""[^"]*)*)"|([^"\\'+t+"\\r\\n]*))","gi"),o=[[]];let i,s;for(;(i=n.exec(e))&&s!==n.lastIndex;){s=n.lastIndex;const e=i[1];let r;e.length&&e!==t&&o.push([]),r=i[2]?i[2].replace(new RegExp('""',"g"),'"'):i[3],o[o.length-1].push(r)}return o}(e.csv),n=[],o=t[0];for(let e=1;e<t.length;e++){const i=t[e],s={};for(let e=0;e<o.length;e++)s[o[e]]=i[e];n.push(s)}e.collection.set(n),this.flagOutputDirty("items"),this.flagOutputDirty("count")}else if("json"===e.type){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"json-parse-warning");try{const t=JSON.parse(e.json);e.collection.set(t),this.flagOutputDirty("items"),this.flagOutputDirty("count")}catch(e){this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"json-parse-warning",{showGlobally:!0,message:e.message})}}}}};function s(){}},6065:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(260);const i={name:"Variable2",displayNodeName:"Variable",docs:"https://docs.noodl.net/nodes/data/variable/variable-node",category:"Data",usePortAsLabel:"name",color:"data",initialize(){const e=this._internal;this._internal.onModelChangedCallback=t=>{this.isInputConnected("fetch")||t.name!==e.name||(this.sendSignalOnOutput("changed"),this.flagOutputDirty("value"))},e.variablesModel=o.Model.get("--ndl--global-variables"),e.variablesModel.on("change",this._internal.onModelChangedCallback)},getInspectInfo(){return this._internal.name?this._internal.variablesModel.get(this._internal.name):"[No value set]"},outputs:{name:{type:"string",displayName:"Name",group:"General",getter(){return this._internal.name}},changed:{type:"signal",displayName:"Changed",group:"Events"},fetched:{type:"signal",displayName:"Fetched",group:"Events"},value:{type:"*",displayName:"Value",group:"General",getter(){const 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(e){this.isInputConnected("fetch")?(this._internal.name=e,this.flagOutputDirty("name")):this.setVariableName(e)}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.setVariableName(this._internal.name)}},value:{type:"*",displayName:"Value",group:"General",set(e){this._internal.value=e,this.scheduleStore()}}},prototypeExtensions:{scheduleStore(){if(this.hasScheduledStore)return;this.hasScheduledStore=!0;const e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledStore=!1,e.variablesModel.set(e.name,e.value)}))},setVariableName(e){this._internal.name=e,this.flagOutputDirty("name"),this.flagOutputDirty("value"),this.sendSignalOnOutput("fetched")},_onNodeDeleted(){o.Node.prototype._onNodeDeleted.call(this),this._internal.variablesModel.off("change",this._internal.onModelChangedCallback)}}}},1391:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o,setup:()=>i});const o={name:"Event Receiver",docs:"https://docs.noodl.net/nodes/events/receive-event",displayNodeName:"Receive Event",category:"Events",usePortAsLabel:"channelName",color:"component",initialize(){this._internal.outputValues={},this._internal.outputNames=[],this._internal.eventReceived=!1,this._internal._isEnabled=!0,this._internal.channelName=""},inputs:{enabled:{displayName:"Enabled",type:"boolean",default:!0,set(e){this._internal._isEnabled=e}},consume:{displayName:"Consume",type:{name:"enum",enums:[{label:"Never",value:"never"},{label:"Always",value:"always"}]},default:"never",set(e){this._internal.consume=e}},channelName:{type:{name:"string",identifierOf:"EventChannelName"},displayName:"Channel",set(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:{displayName:"Received",type:"signal"}},prototypeExtensions:{registerOutputIfNeeded(e){this.hasOutput(e)||(this._internal.outputNames.push(e),this.registerOutput(e,{getter:()=>this._internal.outputValues[e]}))},handleEvent(e){if(this._internal._isEnabled){this.sendSignalOnOutput("eventReceived");for(const t in e)this.hasOutput(t)&&(this._internal.outputValues[t]=e[t],this.flagOutputDirty(t));return"always"===this._internal.consume}},onEventReceived(e){this.handleEvent(e)},_onNodeDeleted(){Node.prototype._onNodeDeleted.call(this),this._internal.onEventReceivedCallback&&this.context.eventSenderEmitter.removeListener(this._internal.channelName,this._internal.onEventReceivedCallback)},registerListenersForChannel(e){const t=this.context.eventSenderEmitter;this._internal.onEventReceivedCallback=this.onEventReceived.bind(this),t.on(e,this._internal.onEventReceivedCallback),this.context.eventEmitter.once("applicationDataReloaded",(()=>{this._internal.onEventReceivedCallback&&t.removeListener(e,this._internal.onEventReceivedCallback)}))},getChannelName(){return this._internal.channelName}}};function i(e,t){function n(n){let o=n.parameters.channelName;function i(){var i;const s=t.getNodesWithType("Event Sender").filter((e=>e.parameters.channelName===o)),r={};s.forEach((e=>{const t=e.parameters.payload?e.parameters.payload.split(","):[];for(const e of t)r[e]=!0}));const a=Object.keys(r).map((e=>({name:e,type:"*",plug:"output",displayName:e})));null===(i=e.editorConnection)||void 0===i||i.sendDynamicPorts(n.id,a,{detectRenamed:{plug:"output"}})}function s(e){e.on("inputPortAdded",i),e.on("inputPortRemoved",i),e.on("parameterUpdated",(function(e){"channelName"===e.name&&i()}))}i(),n.on("parameterUpdated",(function(e){"channelName"===e.name&&(o=e.value,i())})),t.getNodesWithType("Event Sender").forEach(s),t.on("nodeAdded.Event Sender",s),t.on("nodeRemoved.Event Sender",i)}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.Event Receiver",n),t.getNodesWithType("Event Receiver").forEach(n)}))}},3631:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o,setup:()=>s});const o={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:{displayName:"Send",valueChangedToTrue:function(){const e=this;this.scheduleAfterInputsHaveUpdated((function(){"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)}))}},channelName:{type:{name:"string",allowEditOnly:!0,identifierOf:"EventChannelName",identifierDisplayName:"Event Channels"},default:"",group:"Settings",displayName:"Channel Name",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",set:function(e){this._internal.propagation=e}},payload:{type:{name:"stringlist",allowEditOnly:!0},group:"Payload"}},prototypeExtensions:{registerInputIfNeeded(e){if(this.hasInput(e))return;const t=this;this.registerInput(e,{set:function(n){t._internal.inputValues[e]=n}})}}};function i(e,t,n){const o=[];let i=t.payload;if(i){i=i.split(",");for(const e of i)o.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input",group:"Payload",name:e,displayName:e})}n.sendDynamicPorts(e,o,{detectRenamed:{plug:"input"}})}function s(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.Event Sender",(function(t){i(t.id,t.parameters,e.editorConnection),t.on("parameterUpdated",(function(n){i(t.id,t.parameters,e.editorConnection)}))}))}},8423:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i,setup:()=>p});var o=n(260);const i={name:"Javascript2",docs:"https://docs.noodl.net/nodes/javascript/script",displayNodeName:"Script",category:"CustomCode",color:"javascript",nodeDoubleClickAction:{focusPort:"Code"},searchTags:["javascript"],exportDynamicPorts:!0,initialize:function(){const 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.changedInputs={},e.signalScheduled={},e.killed=!1,e.inputQueue=[];const t=this;e.userFunctionScope={createComponent:e=>(e&&e.length>0&&"/"!==e[0]&&(e="/"+e),t.nodeScope.createNode(e,(0,o.guid)())),deleteComponent(e){t.nodeScope.deleteNode(e)},flagOutputDirty(e){if(!e)throw new Error("Output port name must be specified");t.flagOutputDirty(e)},runNextFrame(){e.runNextFrameScheduled||(e.runNextFrameScheduled=!0,t.context.scheduleNextFrame((function(){e.runNextFrameScheduled=!1,e.killed||r.call(t)})))},sendSignalOnOutput(e){t.sendSignalOnOutput(e)}},e.onFrameStart=l.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",set(e){}},scriptOutputs:{type:{name:"proplist",allowEditOnly:!0},group:"Script Outputs",set(e){}},useExternalFile:{type:{name:"enum",enums:[{value:"yes",label:"Yes"},{value:"no",label:"No"}],allowEditOnly:!0},default:"no",displayName:"Use External File",group:"Code",set(e){this._internal.isWaitingForExternalFileToLoad="yes"===e,this._internal.useExternalFile="yes"===e}},code:{displayName:"Code",group:"Code",type:{name:"string",allowEditOnly:!0,codeeditor:"javascript"},default:"",set(e){if(!e)return;const t=this;this.scheduleAfterInputsHaveUpdated((function(){if(!1===this._internal.useExternalFile){this._callDestroyFunction();const n=o.JavascriptNodeParser.createFromCode(e,{node:this});t._onCodeParsed(n)}}))}},externalFile:{displayName:"File Path",group:"Code",type:{name:"source",allowEditOnly:!0},set(e){if(!1===this._internal.useExternalFile)return;const t=this;o.JavascriptNodeParser.createFromURL(e,(function(e){t._internal.isWaitingForExternalFileToLoad=!1,t._onCodeParsed(e)}),{node:this})}}},prototypeExtensions:{_onNodeDeleted(){o.Node.prototype._onNodeDeleted.call(this),this._internal.killed=!0,this._callDestroyFunction()},update(){!0===this._internal.isWaitingForExternalFileToLoad?this._dirty=!1:o.Node.prototype.update.call(this)},_onCodeParsed(e){const t=this.context.editorConnection;if(t)for(const e of["js-destroy-waring","js-run-waring","js-setup-waring"])t.clearWarning(this.nodeScope.componentOwner.name,this.id,e);if(!e.error){if(Object.keys(this.model.inputPorts).forEach((e=>{const t=this.model.inputPorts[e].type;"color"!==t&&"color"!==t.name||(this._internal.inputValues[e]=void 0,this.hasInput(e)?this.getInput(e).type="color":this.registerInput(e,{type:"color",set:u.bind(this,e)}))})),Object.keys(this.model.outputPorts).forEach((e=>{this.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&&s.call(this),this._internal.runFunction&&r.call(this),this._internal.hasParsedCode=!0,this._internal.inputQueue){for(const{name:e,value:t}of this._internal.inputQueue)this.setInputValue(e,t);this._internal.inputQueue=void 0}e.apis.Node.Inputs=this._internal.inputValues,e.apis.Node.Outputs=this._internal.outputProperties}},registerInputIfNeeded(e){this.hasInput(e)||(this._internal.inputValues[e]=void 0,this.registerInput(e,{set:u.bind(this,e)}))},registerOutputIfNeeded(e){if(this.hasOutput(e))return;const t=this,n="signal"===d(this.model.outputPorts[e].type);Object.defineProperty(this._internal.outputProperties,e,{set(o){n||(t._internal.outputValues[e]=o,t.flagOutputDirty(e))},get:()=>n?()=>{t.hasOutput(e)&&t.sendSignalOnOutput(e)}:t._internal.outputValues[e]}),this.registerOutput(e,{getter:c.bind(this,e)})},_callRunFunction(){const e=this._internal;if(e.runFunction&&!e.killed)try{e.runFunction.call(e.userFunctionScope,e.inputValues,e.outputProperties,e.changedInputs)}catch(e){(0,o.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>: "+e.message})}},_callSignalFunction(e){const 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){console.log("Error in JS node signal function code.",Object.getPrototypeOf(e).constructor.name+": "+e.message),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>: "+e.message})}},_callDestroyFunction(){const e=this._internal;if(e.destroyFunction)try{e.destroyFunction.call(e.userFunctionScope,e.inputValues,e.outputProperties)}catch(e){console.log("Error in JS node destroy code.",Object.getPrototypeOf(e).constructor.name+": "+e.message),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>: "+e.message})}},_callSetupFunction(){const e=this._internal;if(e.setupFunction&&!e.killed)try{e.setupFunction.call(e.userFunctionScope,e.inputValues,e.outputProperties)}catch(e){console.log("Error in JS node setup code.",Object.getPrototypeOf(e).constructor.name+": "+e.message),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>: "+e.message})}}}};function s(){this._internal.setupScheduled||(this._internal.setupScheduled=!0,this.scheduleAfterInputsHaveUpdated((function(){this._internal.killed||(this._callSetupFunction(),this._internal.setupScheduled=!1)})))}function r(){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 a(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 l(){this._internal.runNextFrame=!1,r.call(this)}function d(e){return"string"==typeof e?e:e.name}function u(e,t){!0===this._internal.hasParsedCode?void 0!==this.model.inputPorts[e]&&"signal"===d(this.model.inputPorts[e].type)?this._internal.definedObject&&"function"==typeof this._internal.definedObject[e]&&t&&a.call(this,e):(this._internal.inputValues[e]=t,this._internal.changedInputs[e]=!0,r.call(this)):this._internal.inputQueue.push({name:e,value:t})}function c(e){return this._internal.outputValues[e]}function p(e,t){function n(t){function n(){const n=[],i=[{value:"string",label:"String"},{value:"boolean",label:"Boolean"},{value:"number",label:"Number"},{value:"object",label:"Object"},{value:"array",label:"Array"}],s=[{value:"string",label:"String"},{value:"boolean",label:"Boolean"},{value:"number",label:"Number"},{value:"object",label:"Object"},{value:"array",label:"Array"},{value:"signal",label:"Signal"}];void 0!==t.parameters.scriptOutputs&&t.parameters.scriptOutputs.length>0&&t.parameters.scriptOutputs.forEach((e=>{n.push({name:"outtype-"+e.label,displayName:"Type",plug:"input",type:{name:"enum",enums:s,allowEditOnly:!0},default:"string",parent:"scriptOutputs",parentItemId:e.id}),n.push({name:e.label,plug:"output",type:t.parameters["outtype-"+e.label]||"*",group:"Outputs"})})),void 0!==t.parameters.scriptInputs&&t.parameters.scriptInputs.length>0&&t.parameters.scriptInputs.forEach((e=>{n.push({name:"intype-"+e.label,displayName:"Type",plug:"input",type:{name:"enum",enums:i,allowEditOnly:!0},default:"string",parent:"scriptInputs",parentItemId:e.id}),n.push({name:e.label,plug:"input",type:t.parameters["intype-"+e.label]||"string",group:"Inputs"})})),function(e,t,n){const i=t.editorConnection;if(e.parameters)if(e.parameters.externalFile&&"yes"===e.parameters.useExternalFile){const t=e.parameters.externalFile;o.JavascriptNodeParser.createFromURL(t,r)}else e.parameters.code?r(o.JavascriptNodeParser.createFromCode(e.parameters.code)):(s(),n([]));function s(){for(const t of["js-parse-waring","js-destroy-waring","js-run-waring","js-setup-waring"])i.clearWarning(e.component.name,e.id,t)}function r(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(o){var i;o.forEach((e=>{n.find((t=>t.name===e.name&&t.plug===e.plug))||n.push(e)})),null===(i=e.editorConnection)||void 0===i||i.sendDynamicPorts(t.id,n)}))}n(),t.on("parameterUpdated",(function(){n()}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.Javascript2",(function(e){n(e)}));for(const e of t.getNodesWithType("Javascript2"))n(e)}))}},8129:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o});const o={name:"Number Remapper",docs:"https://docs.noodl.net/nodes/math/number-remapper",category:"Math",initialize(){const e=this._internal;e._currentInputValue=0,e._remappedValue=0,e._minInputValue=0,e._maxInputValue=0,e._minOutputValue=0,e._maxOutputValue=1,e._clampOutput=!0},getInspectInfo(){return this._internal._remappedValue},inputs:{inputValue:{group:"Value to Remap",type:{name:"number",allowConnectionOnly:!0},default:0,displayName:"Input Value",set(e){this._internal._currentInputValue=e,this._calculateNewOutputValue()}},minInputValue:{group:"Input Parameters",type:{name:"number"},default:0,displayName:"Input Minimum",set(e){this._internal._minInputValue=e,this._calculateNewOutputValue()}},maxInputValue:{group:"Input Parameters",type:{name:"number"},default:0,displayName:"Input Maximum",set(e){this._internal._maxInputValue=e,this._calculateNewOutputValue()}},minOutputValue:{group:"Output Parameters",type:{name:"number"},default:0,displayName:"Output Minimum",set(e){this._internal._minOutputValue=e,this._calculateNewOutputValue()}},maxOutputValue:{group:"Output Parameters",type:{name:"number"},default:1,displayName:"Output Maximum",set(e){this._internal._maxOutputValue=e,this._calculateNewOutputValue()}},clamp:{group:"Output Parameters",type:{name:"boolean",allowEditOnly:!0},default:!0,displayName:"Clamp Output",set(e){this._internal._clampOutput=e,this._calculateNewOutputValue()}}},outputs:{remappedValue:{type:"number",displayName:"Remapped Value",group:"Outputs",getter(){return this._internal._remappedValue}}},prototypeExtensions:{_calculateNewOutputValue(){let e;const 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")}}}},6552:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o});const o={name:"Open File Picker",docs:"https://docs.noodl.net/nodes/utilities/open-file-picker",category:"Utilities",getInspectInfo(){if(this._internal.file)return this._internal.file.path},initialize(){const e=document.createElement("input");e.type="file",this._internal.inputElement=e},inputs:{open:{type:"signal",displayName:"Open",group:"Actions",valueChangedToTrue(){const e=this._internal.inputElement;e.accept=this._internal.acceptedFileTypes||"",this._internal.capture&&(e.capture=this._internal.capture),e.onchange=t=>{const n=t.target;this._internal.file=n.files?n.files[0]:void 0,this.flagOutputDirty("file"),this.flagOutputDirty("path"),this.flagOutputDirty("name"),this.flagOutputDirty("sizeInBytes"),this.flagOutputDirty("type"),this.sendSignalOnOutput("success"),e.onchange=null,e.value=""},e.click()}},acceptedFileTypes:{group:"General",type:"string",displayName:"Accepted file types",set(e){this._internal.acceptedFileTypes=e}},capture:{group:"General",type:"string",displayName:"Capture",set(e){this._internal.capture=e}}},outputs:{file:{type:"*",displayName:"File",group:"General",get(){return this._internal.file}},path:{displayName:"Path",group:"Metadata",type:"string",get(){return this._internal.file&&this._internal.file.path}},name:{displayName:"Name",group:"Metadata",type:"string",get(){return this._internal.file&&this._internal.file.name}},sizeInBytes:{displayName:"Size in bytes",group:"Metadata",type:"number",get(){return this._internal.file&&this._internal.file.size}},type:{displayName:"Type",group:"Metadata",type:"string",get(){return this._internal.file&&this._internal.file.type}},success:{type:"signal",group:"Events",displayName:"Success"}}}},7518:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o});const o={name:"Screen Resolution",docs:"https://docs.noodl.net/nodes/utilities/screen-resolution",category:"Utilities",initialize(){"undefined"!=typeof window&&(window.addEventListener("resize",(()=>{this._viewportSizeChanged()})),this._viewportSizeChanged())},getInspectInfo(){return`${this._internal.width} x ${this._internal.height}`},outputs:{width:{type:"number",displayName:"Width",get(){return this._internal.width}},height:{type:"number",displayName:"Height",get(){return this._internal.height}},aspectRatio:{type:"number",displayName:"Aspect Ratio",get(){return this._internal.width/this._internal.height}}},methods:{_viewportSizeChanged(){this._internal.width=window.innerWidth,this._internal.height=window.innerHeight,this.flagAllOutputsDirty()}}}},5250:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>p,setup:()=>g});var o=n(260),i=n(2004),s=n(8972),r=n.n(s);const a={},l={};function d(e,t){if("transparent"===t||!t)return void(e[3]=0);const n=(t.length-1)/2;for(let o=0;o<n;++o){const n=1+2*o;e[o]=parseInt(t.substring(n,n+2),16)}}function u(e){const t=e.toString(16);return 1===t.length?"0"+t:t}function c(e){return"#"+u(e[0])+u(e[1])+u(e[2])+u(e[3])}const p={name:"States",docs:"https://docs.noodl.net/nodes/utilities/logic/states",shortDesc:"Define states with values and this node can interpolate between these values when the state is changed.",category:"Animation",initialize(){const 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:i.A.easeOut,onStart(){var n,o;const i=t.startValues,s=t.stateParameters,r=t.stateParameterTypes,a="value-"+t.state+"-";this.targetValues={},this.startValues={},this.valueTypes={};for(const t in this.transitionCurves)"number"===r["type-"+t]||void 0===r["type-"+t]?(this.valueTypes[t]="number",this.startValues[t]=i[t],this.targetValues[t]=s[a+t]||0):"color"===r["type-"+t]&&(this.valueTypes[t]="color",this.startValues[t]=[0,0,0,255],d(this.startValues[t],null===(n=e.context.styles)||void 0===n?void 0:n.resolveColor(i[t]||"#000000")),this.targetValues[t]=[0,0,0,255],d(this.targetValues[t],null===(o=e.context.styles)||void 0===o?void 0:o.resolveColor(s[a+t]||"#000000")))},onRunning(n){const o=n*this.duration,s=t.currentValues,r=[0,0,0,255];for(const n in this.transitionCurves){const a=this.transitionCurves[n];if(o<a.delay)s[n]=this.startValues[n];else if(o>=a.delay+a.dur)s[n]="color"===this.valueTypes[n]?c(this.targetValues[n]):this.targetValues[n];else{const e=t.transitionFuncs[n].get((o-a.delay)/a.dur);if("number"===this.valueTypes[n])s[n]=i.A.linear(Number(this.startValues[n]),Number(this.targetValues[n]),e);else if("color"===this.valueTypes[n]){const t=this.startValues[n],o=this.targetValues[n];r[0]=Math.floor(i.A.linear(t[0],o[0],e)),r[1]=Math.floor(i.A.linear(t[1],o[1],e)),r[2]=Math.floor(i.A.linear(t[2],o[2],e)),r[3]=Math.floor(i.A.linear(t[3],o[3],e)),s[n]=c(r)}}e.flagOutputDirty(n)}},onFinish(){const n="reached-"+t.state;e.hasOutput(n)&&e.sendSignalOnOutput(n)}})},getInspectInfo(){return`Current state: ${this._internal.state}`},inputs:{states:{type:{name:"stringlist",allowEditOnly:!0},displayName:"States",group:"States",set(e){if(this._internal.states=e?e.split(","):[],this._internal.states.length>0){const e=this;e._internal.state||this.scheduleGoToState(e._internal.startState||e._internal.states[0])}}},values:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Values",group:"Values",set(e){const t=this._internal;t.values=e.split(",");for(const e in t.values)this.registerOutputIfNeeded(t.values[e])}},toggle:{group:"Go to state",displayName:"Toggle",valueChangedToTrue(){const e=this._internal;if(!e.states)return;const t=(e.states.indexOf(e.state)+1)%e.states.length;this.scheduleGoToState(e.states[t])}},useTransitions:{type:"boolean",displayName:"Use Transitions",group:"General",default:!0,set(e){this._internal.useTransitions=e}}},outputs:{currentState:{type:"string",displayName:"State",group:"Current State",getter(){return this._internal.state}},stateChanged:{type:"signal",displayName:"State Changed",group:"Current State"}},prototypeExtensions:{registerOutputIfNeeded(e){const t=this._internal;this.hasOutput(e)||this.registerOutput(e,{getter:()=>t.currentValues[e]})},registerInputIfNeeded(e){const t=this,n=this._internal;if(!this.hasInput(e))if(0===e.indexOf("to-")){const t=e.substring(3);this.registerInput(e,{set:(0,o.createSetter)({valueChangedToTrue(){this.scheduleGoToState(t)}})})}else if("startState"===e)this.registerInput(e,{set(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(t){n.stateParameterTypes[e]=t}});else if(0===e.indexOf("value-")){const o=e.split("-"),i=o[1],s=o[2];this.registerInput(e,{set(o){n.stateParameters[e]=o,n.state===i&&(n.currentValues[s]=o,t.flagOutputDirty(s))}})}else 0===e.search(/duration-/g)?this.registerInput(e,{set(t){n.stateParameters[e]=t}}):0===e.search(/transition/g)&&(e.substring(11),this.registerInput(e,{set(t){n.stateParameters[e]=t}}))},setCurrentState(e){this.scheduleGoToState(e)},jumpToState(e){const t=this._internal;if(!t.states)return;if(e||(e=t.states[0]),t.state===e)return;t.animation.stop();const n="value-"+e+"-";for(const e in t.values){const o=t.values[e];t.currentValues[o]=t.stateParameters[n+o]||0,this.flagOutputDirty(o)}t.state=e,this.flagOutputDirty("currentState"),t.valuesAreInitialised&&this.sendSignalOnOutput("stateChanged"),t.valuesAreInitialised=!0,this.updateAtStatePorts()},scheduleGoToState(e){const t=this;this._internal.goToState=e,this.hasScheduledGoToState||(this.hasScheduledGoToState=!0,this.scheduleAfterInputsHaveUpdated((function(){t.hasScheduledGoToState=!1,t.goToState(t._internal.goToState)})))},goToState(e){const t=this._internal;if(t.states&&(e||(e=t.states[0]),t.state!==e))if(t.valuesAreInitialised){let n=0,o=0;const i={};for(const s in t.values){const a=t.values[s];t.startValues[a]=t.currentValues[a];const l=t.stateParameterTypes["type-"+a];if("boolean"===l){const n=t.stateParameters["value-"+e+"-"+a];t.currentValues[a]=void 0!==n&&!!n,this.flagOutputDirty(a)}else if("string"===l||"textStyle"===l)t.currentValues[a]=t.stateParameters["value-"+e+"-"+a],this.flagOutputDirty(a);else{let s=t.stateParameters["transition-"+e+"-"+a];s||(s=t.stateParameters["transitiondef-"+e]||{curve:[0,0,.58,1],dur:300,delay:0}),0===s.dur&&0===s.delay||!t.useTransitions?(t.currentValues[a]=t.stateParameters["value-"+e+"-"+a],this.flagOutputDirty(a)):(t.transitionFuncs[a]=r()(s.curve),i[a]=s,n=Math.min(n,s.delay),o=Math.max(o,s.dur+s.delay))}}if((o>0||n>0)&&(t.animation.transitionCurves=i,t.animation.duration=o,t.animation.delay=n,t.animation.start()),t.state=e,this.flagOutputDirty("currentState"),this.sendSignalOnOutput("stateChanged"),this.updateAtStatePorts(),0===o&&0===n){const e="reached-"+t.state;this.hasOutput(e)&&this.sendSignalOnOutput(e)}}else this.jumpToState(e)},updateAtStatePorts(){const e=this._internal,t=e.states;for(const n in t){const o=t[n],i="at-"+o;e.currentValues[i]=e.state===o,this.hasOutput(i)&&this.flagOutputDirty(i)}}}};function h(e,t){if(!e||!t)return;if(e.length!==t.length)return;const n={};for(let o=0;o<e.length;o++){if(-1===t.indexOf(e[o])){if(n.before)return;n.before=e[o]}if(-1===e.indexOf(t[o])){if(n.after)return;n.after=t[o]}}return n.before&&n.after?n:void 0}function m(e,t,n){const o=t.states,i=t.values,s=[],r=i?i.split(","):void 0;for(const e of r||[])s.push({type:{name:t["type-"+e]||"number",allowConnectionsOnly:!0},plug:"output",group:"Values",name:e}),s.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:e,name:"type-"+e});const d=o?o.split(","):void 0;d&&d.forEach((e=>{r&&r.forEach((n=>{s.push({plug:"input",type:t["type-"+n]||"number",group:e+" Values",name:"value-"+e+"-"+n,displayName:n,editorName:e+"|"+n})})),r&&!1!==t.useTransitions&&(s.push({plug:"input",type:"curve",displayName:"Default",default:{curve:[0,0,.58,1],dur:300,delay:0},group:e+" Transitions",name:"transitiondef-"+e}),r.forEach((n=>{void 0!==t["type-"+n]&&"number"!==t["type-"+n]&&"color"!==t["type-"+n]||s.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})}))),s.push({plug:"input",type:{name:"signal",allowConnectionsOnly:!0},displayName:"To "+e,name:"to-"+e,group:"Go to state"}),s.push({plug:"output",type:"boolean",displayName:"At "+e,name:"at-"+e,group:"Current state"}),s.push({plug:"output",type:"signal",displayName:"Has Reached "+e,name:"reached-"+e,group:"Current state"})})),o&&s.push({plug:"input",type:{name:"enum",enums:o},group:"States",displayName:"State",name:"currentState",default:t.startState||o[0]});const u=h(a[e],o);a[e]=o;const c=h(l[e],i);let p;l[e]=i,u?(p={plug:"input",before:u.before,after:u.after,patterns:["transition-{{*}}","to-{{*}}","at-{{*}}","reached-{{*}}"]},r&&r.forEach((e=>{p.patterns.push("value-{{*}}-"+e)}))):c&&(p=[{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:o?o.map((e=>"value-"+e+"-{{*}}")):void 0}]),n.sendDynamicPorts(e,s,{renamed:p})}function g(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.States",(function(t){t.parameters.states&&m(t.id,t.parameters,e.editorConnection),t.on("parameterUpdated",(function(n){("useTransitions"===n.name||"states"===n.name||"values"===n.name||n.name.startsWith("transition")||n.name.startsWith("type-"))&&m(t.id,t.parameters,e.editorConnection)}))}))}},8044:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o});const o={name:"Switch",docs:"https://docs.noodl.net/nodes/logic/switch",category:"Logic",initialize(){this._internal.state=!1,this._internal.initialized=!1},getInspectInfo(){return this._internal.state},inputs:{on:{displayName:"On",group:"Change State",valueChangedToTrue(){!0!==this._internal.state&&(this._internal.state=!0,this.flagOutputDirty("state"),this.emitSignals())}},off:{displayName:"Off",group:"Change State",valueChangedToTrue(){!1!==this._internal.state&&(this._internal.state=!1,this.flagOutputDirty("state"),this.emitSignals())}},flip:{displayName:"Flip",group:"Change State",valueChangedToTrue(){this._internal.state=!this._internal.state,this.flagOutputDirty("state"),this.emitSignals()}},onFromStart:{type:"boolean",displayName:"State",group:"General",default:!1,set(e){this._internal.state=!!e,this.flagOutputDirty("state"),this.emitSignals()}}},outputs:{state:{type:"boolean",displayName:"Current State",getter(){return this._internal.state}},switched:{displayName:"Switched",type:"signal",group:"Signals"},switchedToOn:{displayName:"Switched To On",type:"signal",group:"Signals"},switchedToOff:{displayName:"Switched To Off",type:"signal",group:"Signals"}},prototypeExtensions:{emitSignals(){!0===this._internal.state?this.sendSignalOnOutput("switchedToOn"):this.sendSignalOnOutput("switchedToOff"),this.sendSignalOnOutput("switched")}}}},1407:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o});const o={name:"Timer",docs:"https://docs.noodl.net/nodes/utilities/delay",displayName:"Delay",category:"Utilities",nodeDoubleClickAction:{focusPort:"duration"},initialize(){const e=this;this._internal._animation=this.context.timerScheduler.createTimer({duration:0,onStart(){e.sendSignalOnOutput("timerStarted")},onFinish(){e.sendSignalOnOutput("timerFinished")}}),this.addDeleteListener((()=>{this._internal._animation.stop()}))},getInspectInfo(){return this._internal._animation.isRunning()?Math.floor(this._internal._animation.durationLeft()/10)/100+" seconds":"Not running"},inputs:{start:{displayName:"Start",valueChangedToTrue(){!1===this._internal._animation._isRunning&&this._internal._animation.start()}},restart:{displayName:"Restart",valueChangedToTrue(){this._internal._animation.start()}},duration:{type:"number",displayName:"Duration",default:0,set(e){this._internal._animation.duration=e}},startDelay:{type:"number",displayName:"Start Delay",default:0,set(e){this._internal._animation.delay=e}},stop:{displayName:"Stop",valueChangedToTrue(){this._internal._animation.stop()}}},outputs:{timerStarted:{type:"signal",displayName:"Started"},timerFinished:{type:"signal",displayName:"Finished"}}}},655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>s});var o=n(9678),i=n(3795);const s={name:"Upload File",docs:"https://docs.noodl.net/nodes/data/cloud-data/upload-file",category:"Cloud Services",color:"data",getInspectInfo(){return this._internal.response},inputs:{file:{group:"General",displayName:"File",type:"*",set(e){this._internal.file=e}},upload:{type:"signal",displayName:"Upload",group:"Actions",valueChangedToTrue(){this.scheduleAfterInputsHaveUpdated((()=>{const e=this._internal.file;e?i.D.instance.uploadFile({file:e,onUploadProgress:e=>{this._internal.progressTotal=e.total,this._internal.progressLoaded=e.loaded,this.flagOutputDirty("progressTotalBytes"),this.flagOutputDirty("progressLoadedBytes"),this.flagOutputDirty("progressLoadedPercent"),this.sendSignalOnOutput("progressChanged")},success:e=>{this._internal.cloudFile=new o.A(e),this.flagOutputDirty("cloudFile"),this.sendSignalOnOutput("success")},error:e=>this.setError(e)}):this.setError("No file specified")}))}}},outputs:{cloudFile:{group:"General",displayName:"Cloud File",type:"cloudfile",get(){return this._internal.cloudFile}},success:{group:"Events",displayName:"Success",type:"signal"},failure:{group:"Events",displayName:"Failure",type:"signal"},error:{type:"string",displayName:"Error",group:"Error",get(){return this._internal.error}},errorStatus:{type:"number",displayName:"Error Status Code",group:"Error",get(){return this._internal.errorStatus}},progressChanged:{type:"signal",displayName:"Progress Changed",group:"Events"},progressTotalBytes:{type:"number",displayName:"Total Bytes",group:"Progress",get(){return this._internal.progressTotal}},progressLoadedBytes:{type:"number",displayName:"Uploaded Bytes",group:"Progress",get(){return this._internal.progressLoaded}},progressLoadedPercent:{type:"number",displayName:"Uploaded Percent",group:"Progress",get(){return this._internal.progressTotal?this._internal.progressLoaded/this._internal.progressTotal*100:0}}},methods:{setError(e){this._internal.error=e.hasOwnProperty("error")?e.error:e,this._internal.errorStatus=e.code||e.status||0,this.flagOutputDirty("error"),this.flagOutputDirty("errorStatus"),this.sendSignalOnOutput("failure")}}}},2457:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(5506);const i={name:"net.noodl.user.LogIn",docs:"https://docs.noodl.net/nodes/data/user/log-in",displayNodeName:"Log In",category:"Cloud Services",color:"data",outputs:{success:{type:"signal",displayName:"Success",group:"Events"},failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",getter(){return this._internal.error}}},inputs:{login:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleLogIn()}},username:{displayName:"Username",type:"string",group:"General",set(e){this._internal.username=e}},password:{displayName:"Password",type:"string",group:"General",set(e){this._internal.password=e}}},methods:{setError(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"user-login-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"user-login-warning")},scheduleLogIn(){!0!==this.logInScheduled&&(this.logInScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.logInScheduled=!1,o.default.instance.logIn({username:this._internal.username,password:this._internal.password,success:()=>{this.sendSignalOnOutput("success")},error:e=>{this.setError(e)}})})))}}}},2228:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i});var o=n(5506);const i={name:"net.noodl.user.LogOut",docs:"https://docs.noodl.net/nodes/data/user/log-out",displayNodeName:"Log Out",category:"Cloud Services",color:"data",outputs:{success:{type:"signal",displayName:"Success",group:"Events"},failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",getter(){return this._internal.error}}},inputs:{login:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleLogOut()}}},methods:{setError(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"user-login-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"user-login-warning")},scheduleLogOut(){!0!==this.logOutScheduled&&(this.logOutScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.logOutScheduled=!1,o.default.instance.logOut({success:()=>{this.sendSignalOnOutput("success")},error:e=>{this.setError(e)}})})))}}}},7154:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>i,setup:()=>r});var o=n(5506);const i={name:"net.noodl.user.SignUp",docs:"https://docs.noodl.net/nodes/data/user/sign-up",displayNodeName:"Sign Up",category:"Cloud Services",color:"data",initialize(){const e=this._internal;e.userProperties={},e.signUpScheduled=!1},outputs:{success:{type:"signal",displayName:"Success",group:"Events"},failure:{type:"signal",displayName:"Failure",group:"Events"},error:{type:"string",displayName:"Error",group:"Error",getter(){return this._internal.error}}},inputs:{signup:{displayName:"Do",group:"Actions",valueChangedToTrue(){this.scheduleSignUp()}},username:{displayName:"Username",type:"string",group:"General",set(e){this._internal.username=e}},password:{displayName:"Password",type:"string",group:"General",set(e){this._internal.password=e}},email:{displayName:"Email",type:"string",group:"General",set(e){this._internal.email=e}}},methods:{setError(e){this._internal.error=e,this.flagOutputDirty("error"),this.sendSignalOnOutput("failure"),this.context.editorConnection&&this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"user-login-warning",{message:e,showGlobally:!0})},clearWarnings(){this.context.editorConnection&&this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"user-login-warning")},scheduleSignUp(){const e=this._internal;!0!==this.signUpScheduled&&(this.signUpScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.signUpScheduled=!1,o.default.instance.signUp({username:this._internal.username,password:this._internal.password,email:this._internal.email,properties:e.userProperties,success:()=>{this.sendSignalOnOutput("success")},error:e=>{this.setError(e)}})})))},setUserProperty(e,t){this._internal.userProperties[e]=t},registerInputIfNeeded(e){if(!this.hasInput(e))return e.startsWith("prop-")?this.registerInput(e,{set:this.setUserProperty.bind(this,e.substring(5))}):void 0}}};function s(e,t,n,o){const i=[];if(o){const e=o.find((e=>"_User"===e.name));if(e&&e.schema&&e.schema.properties){const t=e.schema.properties,n=["authData","password","username","createdAt","updatedAt","emailVerified","email"];for(const e in t){if(-1!==n.indexOf(e))continue;const o=t[e];if(!i.find((t=>t.name===e)))if("Relation"===o.type);else{const t={String:"string",Boolean:"boolean",Number:"number",Date:"date"};i.push({type:{name:t[o.type]?t[o.type]:"*"},plug:"input",group:"Properties",name:"prop-"+e,displayName:e})}}}}n.sendDynamicPorts(e,i)}function r(e,t){function n(n){s(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections")),n.on("parameterUpdated",(function(o){s(n.id,n.parameters,e.editorConnection,t.getMetaData("systemCollections"))})),t.on("metadataChanged.systemCollections",(function(t){s(n.id,n.parameters,e.editorConnection,t)}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.net.noodl.user.SignUp",(function(e){n(e)}));for(const e of t.getNodesWithType("net.noodl.user.SignUp"))n(e)}))}},5506:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a});var o=n(260),i=n(7007),s=n(3795);class r{static forScope(e){return r.instance}static get instance(){return void 0===r._instance&&(r._instance=new r),r._instance}constructor(){this._initCloudServices(),this.events=new i.EventEmitter,this.events.setMaxListeners(1e5),this.getUserFromLocalStorage()&&(this.current=this.getUserModel(),this.fetchCurrentUser({success:()=>{},error:()=>{delete localStorage["Parse/"+this.appId+"/currentUser"],delete this.current,this.events.emit("sessionLost")}}))}getUserFromLocalStorage(){const e=localStorage["Parse/"+this.appId+"/currentUser"];if(e)try{return JSON.parse(e)}catch(e){}}_initCloudServices(){const e=o.default.instance.getMetaData("cloudservices");e&&(this.appId=e.appId,this.endpoint=e.endpoint)}on(...e){this.events.on(...e)}off(...e){this.events.off(...e)}_makeRequest(e,t){if(!this.endpoint)return void(t.error&&t.error({error:"No active cloud service",status:0}));const n=new XMLHttpRequest;n.onreadystatechange=()=>{if(4===n.readyState){let e;try{e=JSON.parse(n.response)}catch(e){}200===n.status||201===n.status?t.success(e||n.response):t.error(e||{error:n.responseText,status:n.status})}},n.open(t.method||"GET",this.endpoint+e,!0),n.setRequestHeader("X-Parse-Application-Id",this.appId);let i=localStorage["Parse/"+this.appId+"/installationId"];if(void 0===i&&(i=localStorage["Parse/"+this.appId+"/installationId"]=(0,o.guid)()),n.setRequestHeader("X-Parse-Installation-Id",i),t.sessionToken)n.setRequestHeader("X-Parse-Session-Token",t.sessionToken);else{const e=this.getUserFromLocalStorage();void 0!==e&&n.setRequestHeader("X-Parse-Session-Token",e.sessionToken)}n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify(t.content))}logIn(e){this._makeRequest("/login",{method:"POST",content:{username:e.username,password:e.password,_method:"GET"},success:t=>{var n;localStorage["Parse/"+this.appId+"/currentUser"]=JSON.stringify(t),this.current=this.getUserModel(),null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,t),this.events.emit("loggedIn")},error:t=>{var n;null===(n=null==e?void 0:e.error)||void 0===n||n.call(e,t.error)}})}logOut(e){this._makeRequest("/logout",{method:"POST",content:{},success:t=>{delete localStorage["Parse/"+this.appId+"/currentUser"],delete this.current,e.success(),this.events.emit("loggedOut")},error:t=>{e.error(t.error)}})}signUp(e){const t=e.properties?s.D._serializeObject({...e.properties},"_User"):{};this._makeRequest("/users",{method:"POST",content:{...t,username:e.username,password:e.password,email:e.email},success:t=>{var n;const o={...t,username:e.username,...e.properties};localStorage["Parse/"+this.appId+"/currentUser"]=JSON.stringify(o),this.current=this.getUserModel(),null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,t),this.events.emit("loggedIn")},error:t=>{var n;null===(n=null==e?void 0:e.error)||void 0===n||n.call(e,t.error)}})}setUserProperties(e){const t=this.getCurrentUser();if(void 0!==t){const n=s.D._serializeObject({...e.properties},"_User"),o={email:e.email,username:e.username,...n};delete o.emailVerified,delete o.createdAt,delete o.updatedAt,this._makeRequest("/users/"+t.objectId,{method:"PUT",content:o,success:n=>{Object.assign(t,o),localStorage["Parse/"+this.appId+"/currentUser"]=JSON.stringify(t),this.current=this.getUserModel(),e.success(n)},error:t=>{e.error(t.error)}})}}fetchCurrentUser(e){this._makeRequest("/users/me",{method:"GET",sessionToken:e.sessionToken,success:t=>{localStorage["Parse/"+this.appId+"/currentUser"]=JSON.stringify(t),this.current=this.getUserModel(),this.events.emit("sessionGained"),e.success(t)},error:t=>{209===t.code&&(delete localStorage["Parse/"+this.appId+"/currentUser"],this.events.emit("sessionLost")),e.error(t.error)}})}verifyEmail(e){this._makeRequest("/apps/"+this.appId+"/verify_email?username="+e.username+"&token="+e.token,{method:"GET",success:t=>{-1!==t.indexOf("Successfully verified your email")?e.success():t.indexOf("Invalid Verification Link")?e.error("Invalid verification token"):e.error("Failed to verify email")},error:t=>{e.error(t.error)}})}sendEmailVerification(e){this._makeRequest("/verificationEmailRequest",{method:"POST",content:{email:e.email},success:t=>{e.success()},error:t=>{e.error(t.error)}})}resetPassword(e){this._makeRequest("/apps/"+this.appId+"/request_password_reset",{method:"POST",content:{username:e.username,token:e.token,new_password:e.newPassword},success:t=>{-1!==t.indexOf("Password successfully reset")||-1!==t.indexOf("Successfully updated your password")?e.success():t.indexOf("Invalid Link")?e.error("Invalid verification token"):e.error("Failed to verify email")},error:t=>{e.error(t.error)}})}requestPasswordReset(e){this._makeRequest("/requestPasswordReset",{method:"POST",content:{email:e.email},success:t=>{e.success()},error:t=>{e.error(t.error)}})}getCurrentUser(){const e=localStorage["Parse/"+this.appId+"/currentUser"];if(void 0!==e)return JSON.parse(e)}getUserModel(){const e=this.getCurrentUser();if(void 0!==e)return delete e.sessionToken,delete e.ACL,delete e.className,delete e.__type,s.D._fromJSON(e,"_User")}}o.default.Services.UserService=r;const a=r},7387:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o});const o={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(){return this._internal.changeCount?"Triggered "+this._internal.changeCount+(1===this._internal.changeCount?" time":" times"):"Not triggered"},inputs:{value:{type:"*",displayName:"Input",set:function(e){this._internal.lastValue!==e&&(this._internal.changeCount++,this.sendSignalOnOutput("valueChanged"),this._internal.lastValue=e)}}},outputs:{valueChanged:{type:"signal",displayName:"Value Changed"}}}},8355:(e,t,n)=>{"use strict";n.r(t),n.d(t,{node:()=>o});const o={name:"Color",category:"Variables",docs:"https://docs.noodl.net/nodes/data/color",startValue:"#f1f2f4",nodeDoubleClickAction:{focusPort:"value"},type:{name:"color"},cast:e=>e}},5371:(e,t,n)=>{var o;!function(){function i(e,t,n){return e.call.apply(e.bind,arguments)}function s(e,t,n){if(!e)throw Error();if(2<arguments.length){var o=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,o),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function r(e,t,n){return(r=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?i:s).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 d=!!window.FontFace;function u(e,t,n,o){if(t=e.c.createElement(t),n)for(var i in n)n.hasOwnProperty(i)&&("style"==i?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return o&&t.appendChild(e.c.createTextNode(o)),t}function c(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 o=e.className.split(/\s+/),i=0;i<t.length;i+=1){for(var s=!1,r=0;r<o.length;r+=1)if(t[i]===o[r]){s=!0;break}s||o.push(t[i])}for(t=[],i=0;i<o.length;i+=1){for(s=!1,r=0;r<n.length;r+=1)if(o[i]===n[r]){s=!0;break}s||t.push(o[i])}e.className=t.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function m(e,t){for(var n=e.className.split(/\s+/),o=0,i=n.length;o<i;o++)if(n[o]==t)return!0;return!1}function g(e,t,n){function o(){a&&i&&s&&(a(r),a=null)}t=u(e,"link",{rel:"stylesheet",href:t,media:"all"});var i=!1,s=!0,r=null,a=n||null;d?(t.onload=function(){i=!0,o()},t.onerror=function(){i=!0,r=Error("Stylesheet failed to load"),o()}):setTimeout((function(){i=!0,o()}),0),c(e,"head",t)}function f(e,t,n,o){var i=e.c.getElementsByTagName("head")[0];if(i){var s=u(e,"script",{src:t}),r=!1;return s.onload=s.onreadystatechange=function(){r||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(r=!0,n&&n(null),s.onload=s.onreadystatechange=null,"HEAD"==s.parentNode.tagName&&i.removeChild(s))},i.appendChild(s),setTimeout((function(){r||(r=!0,n&&n(Error("Script load timeout")))}),o||5e3),s}return null}function y(){this.a=0,this.c=null}function v(e){return e.a++,function(){e.a--,_(e)}}function b(e,t){e.c=t,_(e)}function _(e){0==e.a&&e.c&&(e.c(),e.c=null)}function S(e){this.a=e||"-"}function C(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 N(e){var t=[];e=e.split(/,\s*/);for(var n=0;n<e.length;n++){var o=e[n].replace(/['"]/g,"");-1!=o.indexOf(" ")||/^\d/.test(o)?t.push("'"+o+"'"):t.push(o)}return t.join(",")}function O(e){return e.a+e.f}function I(e){var t="normal";return"o"===e.a?t="oblique":"i"===e.a&&(t="italic"),t}function w(e){var t=4,n="n",o=null;return e&&((o=e.match(/(normal|oblique|italic)/i))&&o[1]&&(n=o[1].substr(0,1).toLowerCase()),(o=e.match(/([1-9]00|normal|bold)/i))&&o[1]&&(/bold/i.test(o[1])?t=7:/[1-9]00/.test(o[1])&&(t=parseInt(o[1].substr(0,1),10)))),n+t}function P(e,t){this.c=e,this.f=e.o.document.documentElement,this.h=t,this.a=new S("-"),this.j=!1!==t.events,this.g=!1!==t.classes}function x(e){if(e.g){var t=m(e.f,e.a.c("wf","active")),n=[],o=[e.a.c("wf","loading")];t||n.push(e.a.c("wf","inactive")),h(e.f,n,o)}E(e,"inactive")}function E(e,t,n){e.j&&e.h[t]&&(n?e.h[t](n.c,O(n)):e.h[t]())}function T(){this.c={}}function A(e,t){this.c=e,this.f=t,this.a=u(this.c,"span",{"aria-hidden":"true"},this.f)}function k(e){c(e.c,"body",e.a)}function D(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:"+N(e.c)+";font-style:"+I(e)+";font-weight:"+e.f+"00;"}function R(e,t,n,o,i,s){this.g=e,this.j=t,this.a=o,this.c=n,this.f=i||3e3,this.h=s||void 0}function M(e,t,n,o,i,s,r){this.v=e,this.B=t,this.c=n,this.a=o,this.s=r||"BESbswy",this.f={},this.w=i||3e3,this.u=s||null,this.m=this.j=this.h=this.g=null,this.g=new A(this.c,this.s),this.h=new A(this.c,this.s),this.j=new A(this.c,this.s),this.m=new A(this.c,this.s),e=D(e=new C(this.a.c+",serif",O(this.a))),this.g.a.style.cssText=e,e=D(e=new C(this.a.c+",sans-serif",O(this.a))),this.h.a.style.cssText=e,e=D(e=new C("serif",O(this.a))),this.j.a.style.cssText=e,e=D(e=new C("sans-serif",O(this.a))),this.m.a.style.cssText=e,k(this.g),k(this.h),k(this.j),k(this.m)}S.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)},R.prototype.start=function(){var e=this.c.o.document,t=this,n=a(),o=new Promise((function(o,i){!function s(){a()-n>=t.f?i():e.fonts.load(function(e){return I(e)+" "+e.f+"00 300px "+N(e.c)}(t.a),t.h).then((function(e){1<=e.length?o():setTimeout(s,25)}),(function(){i()}))}()})),i=null,s=new Promise((function(e,n){i=setTimeout(n,t.f)}));Promise.race([s,o]).then((function(){i&&(clearTimeout(i),i=null),t.g(t.a)}),(function(){t.j(t.a)}))};var V={D:"serif",C:"sans-serif"},j=null;function F(){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 U(e,t,n){for(var o in V)if(V.hasOwnProperty(o)&&t===e.f[V[o]]&&n===e.f[V[o]])return!0;return!1}function W(e){var t,n=e.g.a.offsetWidth,o=e.h.a.offsetWidth;(t=n===e.f.serif&&o===e.f["sans-serif"])||(t=F()&&U(e,n,o)),t?a()-e.A>=e.w?F()&&U(e,n,o)&&(null===e.u||e.u.hasOwnProperty(e.a.c))?L(e,e.v):L(e,e.B):function(e){setTimeout(r((function(){W(this)}),e),50)}(e):L(e,e.v)}function L(e,t){setTimeout(r((function(){p(this.g.a),p(this.h.a),p(this.j.a),p(this.m.a),t(this.a)}),e),0)}function B(e,t,n){this.c=e,this.a=t,this.f=0,this.m=this.j=!1,this.s=n}M.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=a(),W(this)};var $=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")):x(e.a))}function z(e){this.j=e,this.a=new T,this.h=0,this.f=this.g=!0}function H(e,t,n,o,i){var s=0==--e.h;(e.f||e.g)&&setTimeout((function(){var e=i||null,a=o||{};if(0===n.length&&s)x(t.a);else{t.f+=n.length,s&&(t.j=s);var l,d=[];for(l=0;l<n.length;l++){var u=n[l],c=a[u.c],p=t.a,m=u;if(p.g&&h(p.f,[p.a.c("wf",m.c,O(m).toString(),"loading")]),E(p,"fontloading",m),p=null,null===$)if(window.FontFace){m=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent);var g=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);$=m?42<parseInt(m[1],10):!g}else $=!1;p=$?new R(r(t.g,t),r(t.h,t),t.c,u,t.s,c):new M(r(t.g,t),r(t.h,t),t.c,u,t.s,e,c),d.push(p)}for(l=0;l<d.length;l++)d[l].start()}}),0)}function G(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||J,this.a=[],this.f=[],this.g=t||""}B.prototype.g=function(e){var t=this.a;t.g&&h(t.f,[t.a.c("wf",e.c,O(e).toString(),"active")],[t.a.c("wf",e.c,O(e).toString(),"loading"),t.a.c("wf",e.c,O(e).toString(),"inactive")]),E(t,"fontactive",e),this.m=!0,q(this)},B.prototype.h=function(e){var t=this.a;if(t.g){var n=m(t.f,t.a.c("wf",e.c,O(e).toString(),"active")),o=[],i=[t.a.c("wf",e.c,O(e).toString(),"loading")];n||o.push(t.a.c("wf",e.c,O(e).toString(),"inactive")),h(t.f,o,i)}E(t,"fontinactive",e),q(this)},z.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 o=[],i=n.timeout;!function(e){e.g&&h(e.f,[e.a.c("wf","loading")]),E(e,"loading")}(t),o=function(e,t,n){var o,i=[];for(o in t)if(t.hasOwnProperty(o)){var s=e.c[o];s&&i.push(s(t[o],n))}return i}(e.a,n,e.c);var s=new B(e.c,t,i);for(e.h=o.length,t=0,n=o.length;t<n;t++)o[t].load((function(t,n,o){H(e,s,t,n,o)}))}(this,new P(this.c,e),e)},G.prototype.load=function(e){function t(){if(s["__mti_fntLst"+o]){var n,i=s["__mti_fntLst"+o](),r=[];if(i)for(var a=0;a<i.length;a++){var l=i[a].fontfamily;null!=i[a].fontStyle&&null!=i[a].fontWeight?(n=i[a].fontStyle+i[a].fontWeight,r.push(new C(l,n))):r.push(new C(l))}e(r)}else setTimeout((function(){t()}),50)}var n=this,o=n.a.projectId,i=n.a.version;if(o){var s=n.c.o;f(this.c,(n.a.api||"https://fast.fonts.net/jsapi")+"/"+o+".js"+(i?"?v="+i:""),(function(i){i?e([]):(s["__MonotypeConfiguration__"+o]=function(){return n.a},t())})).id="__MonotypeAPIScript__"+o}else e([])},X.prototype.load=function(e){var t,n,o=this.a.urls||[],i=this.a.families||[],s=this.a.testStrings||{},r=new y;for(t=0,n=o.length;t<n;t++)g(this.c,o[t],v(r));var a=[];for(t=0,n=i.length;t<n;t++)if((o=i[t].split(":"))[1])for(var l=o[1].split(","),d=0;d<l.length;d+=1)a.push(new C(o[0],l[d]));else a.push(new C(o[0]));b(r,(function(){e(a,s)}))};var J="https://fonts.googleapis.com/css";function K(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 oe={Arimo:!0,Cousine:!0,Tinos:!0};function ie(e,t){this.c=e,this.a=t}function se(e,t){this.c=e,this.f=t,this.a=[]}ne.prototype.load=function(e){var t=new y,n=this.c,o=new Y(this.a.api,this.a.text),i=this.a.families;!function(e,t){for(var n=t.length,o=0;o<n;o++){var i=t[o].split(":");3==i.length&&e.f.push(i.pop());var s="";2==i.length&&""!=i[1]&&(s=":"),e.a.push(i.join(s))}}(o,i);var s=new K(i);!function(e){for(var t=e.f.length,n=0;n<t;n++){var o=e.f[n].split(":"),i=o[0].replace(/\+/g," "),s=["n4"];if(2<=o.length){var r;if(r=[],a=o[1])for(var a,l=(a=a.split(",")).length,d=0;d<l;d++){var u;if((u=a[d]).match(/^[\w-]+$/))if(null==(c=te.exec(u.toLowerCase())))u="";else{if(u=null==(u=c[2])||""==u?"n":ee[u],null==(c=c[1])||""==c)c="4";else var c=Z[c]||(isNaN(c)?"4":c.substr(0,1));u=[u,c].join("")}else u="";u&&r.push(u)}0<r.length&&(s=r),3==o.length&&(r=[],0<(o=(o=o[2])?o.split(","):r).length&&(o=Q[o[0]])&&(e.c[i]=o))}for(e.c[i]||(o=Q[i])&&(e.c[i]=o),o=0;o<s.length;o+=1)e.a.push(new C(i,s[o]))}}(s),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=[],o=0;o<t;o++)n.push(e.a[o].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}(o),v(t)),b(t,(function(){e(s.a,s.c,oe)}))},ie.prototype.load=function(e){var t=this.a.id,n=this.c.o;t?f(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 o=[],i=0;i<t.length;i+=2)for(var s=t[i],r=t[i+1],a=0;a<r.length;a++)o.push(new C(s,r[a]));try{n.Typekit.load({events:!1,classes:!1,async:!0})}catch(e){}e(o)}}),2e3):e([])},se.prototype.load=function(e){var t=this.f.id,n=this.c.o,o=this;t?(n.__webfontfontdeckmodule__||(n.__webfontfontdeckmodule__={}),n.__webfontfontdeckmodule__[t]=function(t,n){for(var i=0,s=n.fonts.length;i<s;++i){var r=n.fonts[i];o.a.push(new C(r.name,w("font-weight:"+r.weight+";font-style:"+r.style)))}e(o.a)},f(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 re=new z(window);re.a.c.custom=function(e,t){return new X(t,e)},re.a.c.fontdeck=function(e,t){return new se(t,e)},re.a.c.monotype=function(e,t){return new G(t,e)},re.a.c.typekit=function(e,t){return new ie(t,e)},re.a.c.google=function(e,t){return new ne(t,e)};var ae={load:r(re.load,re)};void 0===(o=function(){return ae}.call(t,n,t,e))||(e.exports=o)}()},4665:(e,t,n)=>{const{default:o}=n(260),i={run:async(e,t)=>new Promise(((n,i)=>{const s=o.instance.getMetaData("cloudservices");if(void 0===s)return void i("No cloud services defined in this project.");const r=s.appId,a=o.instance.editorConnection.isRunningLocally()?`http://${window.location.hostname}:8577`:s.endpoint;!function(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){var e;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");const i=o.instance.getMetaData("cloudservices");i&&i.deployVersion&&n.setRequestHeader("x-noodl-cloud-version",i.deployVersion);var s=localStorage["Parse/"+t.appId+"/currentUser"];if(void 0!==s)try{const e=JSON.parse(s);n.setRequestHeader("X-Parse-Session-Token",e.sessionToken)}catch(e){}n.send(JSON.stringify(t.content))}("/functions/"+encodeURIComponent(e),{appId:r,endpoint:a,content:t,method:"POST",success:e=>{n(e?e.result:void 0)},error:e=>{i(e)}})}))};e.exports=i},4483:(e,t,n)=>{const o=n(5506),i={logIn:async e=>new Promise(((t,n)=>{o.instance.logIn({username:e.username,password:e.password,success:()=>{t()},error:e=>{n(e)}})})),signUp:async e=>new Promise(((t,n)=>{o.instance.signUp({username:e.username,password:e.password,email:e.email,properties:e.properties,success:()=>{t()},error:e=>{n(e)}})})),become:async e=>new Promise(((t,n)=>{o.instance.fetchCurrentUser({sessionToken:e,success:()=>{t()},error:e=>{n(e)}})})),on(e,t){o.instance.on(e,t)},off(e,t){o.instance.off(e,t)}},s={logOut:async()=>new Promise(((e,t)=>{o.instance.logOut({success:()=>{e()},error:e=>{t(e)}})})),save:async()=>new Promise(((e,t)=>{const n=Object.assign({},s.Properties.data);o.instance.setUserProperties({properties:n,success:()=>{e()},error:e=>{t(e)}})})),fetch:async()=>new Promise(((e,t)=>{o.instance.fetchCurrentUser({success:()=>{e()},error:e=>{t(e)}})}))};Object.defineProperty(i,"Current",{get:function(){const e=o.instance.current;return void 0===e?void 0:(s.email=e.email,s.username=e.username,s.id=e.id,s.emailVerified=e.emailVerified,s.Properties=e,s)}}),e.exports=i},7685:e=>{e.exports=function(e,t,n,o,i,s,r){void 0===r&&(r=this.options);var a=e-t,l=Math.abs(a)/n,d=r.deceleration,u=(r.swipeBounceTime,{destination:e+l/d*(a<0?-1:1),duration:r.swipeTime,rate:15});return this.hooks.trigger(this.hooks.eventTypes.momentum,u,a),u.destination<o?(u.destination=s?Math.max(o-s/4,o-s/u.rate*l):o,u.duration=Math.abs(u.destination-e)/l):u.destination>i&&(u.destination=s?Math.min(i+s/4,i+s/u.rate*l):i,u.duration=Math.abs(u.destination-e)/l),u.destination=Math.round(u.destination),u}},5542:(e,t,n)=>{"use strict";const o=n(260);e.exports={extendSetComponentObjectProperties:function(e){function t(e,t,n){var o=[];const 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:"*"}];var s=t.properties;if(s)for(var r in s=s?s.split(","):void 0){var a=s[r];o.push({type:{name:void 0===t["type-"+a]?"*":t["type-"+a]},plug:"input",group:"Property Values",displayName:a,name:"prop-"+a}),o.push({type:{name:"enum",enums:i,allowEditOnly:!0},plug:"input",group:"Property Types",displayName:a,default:"*",name:"type-"+a})}n.sendDynamicPorts(e,o,{detectRenamed:{plug:"input"}})}return{node:{name:e.name,displayNodeName:e.displayName,category:"Component Utilities",color:"component",docs:e.docs,initialize:function(){this._internal.inputValues={}},inputs:{properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",set(e){}},store:{type:"signal",group:"Actions",displayName:"Do",valueChangedToTrue(){this.scheduleStore()}}},outputs:{stored:{type:"signal",group:"Events",displayName:"Done"}},methods:{getComponentObjectId:e.getComponentObjectId,scheduleStore(){if(!this.hasScheduledStore){this.hasScheduledStore=!0;var e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{const t=o.get(this.getComponentObjectId());this.hasScheduledStore=!1;const n=(this.model.parameters.properties||"").split(","),i=Object.keys(e.inputValues).filter((e=>-1!==n.indexOf(e)));for(const n of i)t.set(n,e.inputValues[n],{resolve:!0});this.sendSignalOnOutput("stored")}))}},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(e){}})}}},setup:function(n,o){n.editorConnection&&n.editorConnection.isRunningLocally()&&o.on("nodeAdded."+e.name,(e=>{t(e.id,e.parameters,n.editorConnection),e.on("parameterUpdated",(o=>{("properties"===o.name||o.name.startsWith("type-"))&&t(e.id,e.parameters,n.editorConnection)}))}))}}}}},3235:(e,t,n)=>{"use strict";const{Node:o}=n(260),i=n(260),s={name:"net.noodl.ComponentObject",displayNodeName:"Component Object",category:"Component Utilities",color:"component",docs:"https://docs.noodl.net/nodes/component-utilities/component-object",initialize:function(){this._internal.inputValues={},this._internal.dirtyValues={},this._internal.onModelChangedCallback=e=>{!1===this.isInputConnected("fetch")&&(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=i.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",set(e){}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue(){this.scheduleFetch()}}},outputs:{changed:{type:"signal",displayName:"Changed",group:"Events"},fetched:{type:"signal",displayName:"Fetched",group:"Events"}},methods:{scheduleStore(){if(!this.hasScheduledStore){this.hasScheduledStore=!0;var e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{for(var t in this.hasScheduledStore=!1,e.dirtyValues)e.model.set(t,e.inputValues[t],{resolve:!0});e.dirtyValues={}}))}},scheduleFetch(){this.hasScheduledFetch||(this.hasScheduledFetch=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.hasScheduledFetch=!1,this.fetch()})))},fetch(){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(){o.prototype._onNodeDeleted.call(this),this._internal.model.off("change",this._internal.onModelChangedCallback)},registerOutputIfNeeded(e){if(this.hasOutput(e))return;const t=e.split("-"),n=t[t.length-1];this.registerOutput(e,{get(){return this._internal.model.get(n,{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()}})}}}};function r(e,t,n){const o=[];if(t.properties){var i=t.properties.split(",");for(var s in i){var r=i[s];o.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:"value-"+r,displayName:r}),o.push({type:"signal",plug:"output",group:"Changed Events",displayName:r+" Changed",name:"changed-"+r})}}n.sendDynamicPorts(e,o,{detectRenamed:{plug:"input/output"}})}e.exports={node:s,setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("nodeAdded.net.noodl.ComponentObject",(t=>{r(t.id,t.parameters,e.editorConnection),t.on("parameterUpdated",(n=>{"properties"===n.name&&r(t.id,t.parameters,e.editorConnection)}))}))}}},619:(e,t,n)=>{"use strict";const{Node:o}=n(260),i=n(260),s=new(0,n(7007).EventEmitter);s.setMaxListeners(1e6);const r={name:"net.noodl.ParentComponentObject",displayNodeName:"Parent Component Object",category:"Component Utilities",color:"component",docs:"https://docs.noodl.net/nodes/component-utilities/parent-component-object",initialize(){this._internal.inputValues={},this._internal.onModelChangedCallback=e=>{!1===this.isInputConnected("fetch")&&(this.hasOutput("value-"+e.name)&&this.flagOutputDirty("value-"+e.name),this.hasOutput("changed-"+e.name)&&this.sendSignalOnOutput("changed-"+e.name),this.sendSignalOnOutput("changed"))},this.onComponentStateNodesChanged=()=>{const e=this.findParentComponentStateModelId();this._internal.modelId!==e&&(this._internal.modelId=e,!1===this.isInputConnected("fetch")&&this.setModelId(this._internal.modelId))},s.on("componentStateNodesChanged",this.onComponentStateNodesChanged),this.updateComponentState()},nodeScopeDidInitialize(){this._internal.modelId||this.context.scheduleAfterUpdate((()=>{this.updateComponentState()}))},getInspectInfo(){if(!this._internal.model)return"No parent component state found";const e=[{type:"text",value:this._internal.parentComponentName}],t=this._internal.model.data;return e.concat(Object.keys(t).map((e=>({type:"text",value:e+": "+t[e]}))))},inputs:{properties:{type:{name:"stringlist",allowEditOnly:!0},displayName:"Properties",group:"Properties",set(e){}},fetch:{displayName:"Fetch",group:"Actions",valueChangedToTrue:function(){this.setModelId(this._internal.modelId)}}},outputs:{changed:{type:"signal",displayName:"Changed",group:"Events"},fetched:{type:"signal",displayName:"Fetched",group:"Events"}},methods:{updateComponentState(){this._internal.modelId=this.findParentComponentStateModelId(),!1===this.isInputConnected("fetch")&&this.setModelId(this._internal.modelId)},findParentComponentStateModelId(){const e=function e(t){let n;if(t.getRoots().length>0){const e=t.getRoots()[0];e.getVisualParentNode?e.getVisualParentNode()&&(n=e.getVisualParentNode().nodeScope.componentOwner):e.parentNodeScope&&(n=t.parentNodeScope.componentOwner)}else t.parentNodeScope&&(n=t.parentNodeScope.componentOwner);if(n&&n.nodeScope&&n.nodeScope.componentOwner!==t)return n.nodeScope.getNodesWithType("net.noodl.ComponentObject").length>0?n:e(n)}(this.nodeScope.componentOwner);if(e)return this._internal.parentComponentName=e.name,"componentState"+e.getInstanceId()},setModelId(e){if(this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback),this._internal.model=void 0,!e)return;const t=i.get(e);for(var n in this._internal.model=t,t.on("change",this._internal.onModelChangedCallback),t.data)this.hasOutput("value-"+n)&&this.flagOutputDirty("value-"+n),this.hasOutput("changed-"+n)&&this.sendSignalOnOutput("changed-"+n);this.sendSignalOnOutput("changed"),this.sendSignalOnOutput("fetched")},scheduleStore(){if(!this.hasScheduledStore){this.hasScheduledStore=!0;var e=this._internal;this.scheduleAfterInputsHaveUpdated((()=>{if(this.hasScheduledStore=!1,e.model)for(var t in e.inputValues)e.model.set(t,e.inputValues[t],{resolve:!0})}))}},_onNodeDeleted(){o.prototype._onNodeDeleted.call(this),s.off("componentStateNodesChanged",this.onComponentStateNodesChanged),this._internal.model&&this._internal.model.off("change",this._internal.onModelChangedCallback)},registerOutputIfNeeded(e){if(this.hasOutput(e))return;const t=e.substring(6);this.registerOutput(e,{get(){if(this._internal.model)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.scheduleStore()}})}}}};function a(e,t,n){const o=[];var i=t.properties&&t.properties.split(",");for(var s in i){var r=i[s];o.push({type:{name:"*",allowConnectionsOnly:!0},plug:"input/output",group:"Properties",name:"value-"+r,displayName:r}),o.push({type:"signal",plug:"output",group:"Changed Events",displayName:r+" Changed",name:"changed-"+r})}n.sendDynamicPorts(e,o,{detectRenamed:{plug:"input/output"}})}e.exports={node:r,setup:function(e,t){e.editorConnection&&e.editorConnection.isRunningLocally()&&(t.on("nodeAdded.net.noodl.ParentComponentObject",(t=>{a(t.id,t.parameters,e.editorConnection),t.on("parameterUpdated",(n=>{a(t.id,t.parameters,e.editorConnection)}))})),t.on("nodeAdded.net.noodl.ComponentObject",(e=>{setTimeout((()=>{s.emit("componentStateNodesChanged")}),0)})),t.on("nodeRemoved.net.noodl.ComponentObject",(e=>{setTimeout((()=>{s.emit("componentStateNodesChanged")}))})))}}},2610:(e,t,n)=>{"use strict";const o=n(5542);e.exports=o.extendSetComponentObjectProperties({name:"net.noodl.SetComponentObjectProperties",displayName:"Set Component Object Properties",docs:"https://docs.noodl.net/nodes/component-utilities/set-component-object-properties",getComponentObjectId:function(){return"componentState"+this.nodeScope.componentOwner.getInstanceId()}})},4986:(e,t,n)=>{"use strict";const{Node:o}=n(260),i=(n(260),n(5542));e.exports=i.extendSetComponentObjectProperties({name:"net.noodl.SetParentComponentObjectProperties",displayName:"Set Parent Component Object Properties",docs:"https://docs.noodl.net/nodes/component-utilities/set-parent-component-object-properties",getComponentObjectId:function(){const e=function e(t){let n;if(t.getRoots().length>0){const e=t.getRoots()[0];e.getVisualParentNode?e.getVisualParentNode()&&(n=e.getVisualParentNode().nodeScope.componentOwner):e.parentNodeScope&&(n=t.parentNodeScope.componentOwner)}else t.parentNodeScope&&(n=t.parentNodeScope.componentOwner);if(n&&n.nodeScope&&n.nodeScope.componentOwner!==t)return n.nodeScope.getNodesWithType("net.noodl.ComponentObject").length>0?n:e(n)}(this.nodeScope.componentOwner);if(e)return this._internal.parentComponentName=e.name,"componentState"+e.getInstanceId()}})},5900:e=>{const t=new Map,n={name:"CSS Definition",docs:"https://docs.noodl.net/nodes/utilities/css-definition",category:"CustomCode",color:"javascript",nodeDoubleClickAction:{focusPort:"Style"},initialize:function(){this._internal.style="";const e=this.getStyleRefId();this.addDeleteListener((()=>{t.set(e,t.get(e)-1),0===t.get(e)&&(this.removeStyleDeclaration(),t.delete(e))})),t.has(e)||t.set(e,0),t.set(e,t.get(e)+1)},inputs:{style:{index:4005,type:{name:"string",allowEditOnly:!0,codeeditor:"css"},displayName:"Style",group:"Content",default:"",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 o=document.getElementById(n);null===o&&((o=document.createElement("style")).id=n,o.type="text/css",document.head.appendChild(o)),o.innerHTML="\n"+e+"\n"}else this.removeStyleDeclaration()}}}};e.exports={node:n}},1594:e=>{"use strict";e.exports=React},5206:e=>{"use strict";e.exports=ReactDOM},6822:(e,t,n)=>{"use strict";n.d(t,{b:()=>o});var o=n(1150)}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={id:e,exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__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=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nc=void 0;var __webpack_exports__={};(()=>{"use strict";var e={};__webpack_require__.r(e),__webpack_require__.d(e,{node:()=>rt});var t=__webpack_require__(1594),n=__webpack_require__.n(t),o=__webpack_require__(5206),i=__webpack_require__.n(o),s=__webpack_require__(260);class r{constructor(e,t){this.graphModel=e,this.editorConnection=t,this.graphModel.getAllComponents().forEach((e=>this._bindComponentModel(e))),this.graphModel.on("componentAdded",(e=>this._bindComponentModel(e)),this),this.graphModel.on("componentRemoved",(e=>e.removeListenersWithRef(this)),this)}_bindComponentModel(e){e.on("rootAdded",(()=>this._evaluateWarnings(e)),this),e.on("rootRemoved",(t=>{this.editorConnection.clearWarning(e.name,t,"multiple-visual-roots-warning"),this._evaluateWarnings(e)}),this),this._evaluateWarnings(e)}_evaluateWarnings(e){const t=e.getRoots();if(0!==t.length){this.editorConnection.clearWarning(e.name,t[0],"multiple-visual-roots-warning");for(let 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"})}}dispose(){this.graphModel.getAllComponents().forEach((e=>{e.removeListenersWithRef(this)})),this.graphModel.removeListenersWithRef(this)}}class a{constructor(e){this.highlightedNodes=new Map,this.selectedNodes=new Map,this.noodlRuntime=e,this.isUpdatingHighlights=!1;const 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.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"}createHighlightDiv(){const e=document.createElement("div");return e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.outline="2px solid #2CA7BA",e.style.opacity="1.0",e}setWindowSelected(e){}updateHighlights(){const e=Array.from(this.highlightedNodes.entries()).concat(Array.from(this.selectedNodes.entries()));for(const t of e){const e=t[0].getRef()&&i().findDOMNode(t[0].getRef());if(!e){this.highlightedNodes.delete(t[0]),t[1].remove();continue}const n=e.getBoundingClientRect(),o=t[1];o.style.transform=`translateX(${n.x}px) translateY(${n.y}px)`,o.style.width=n.width+"px",o.style.height=n.height+"px"}this.isUpdatingHighlights=this.highlightedNodes.size>0||this.selectedNodes.size>0,this.isUpdatingHighlights&&requestAnimationFrame(this.updateHighlights.bind(this))}highlightNodesWithId(e){const t=l(this.noodlRuntime,e).filter((e=>e.getRef)).filter((e=>!this.highlightedNodes.has(e)));for(const e of t){const t=this.createHighlightDiv();this.highlightRootDiv.appendChild(t),this.highlightedNodes.set(e,t)}(this.selectedNodes.size>0||this.highlightedNodes.size>0)&&!this.isUpdatingHighlights&&this.updateHighlights()}disableHighlight(){for(const e of this.highlightedNodes){const t=e[1];t&&t.remove()}this.highlightedNodes.clear()}selectNodesWithId(e){this.noodlRuntime.rootComponent||this.noodlRuntime.eventEmitter.once("rootComponentUpdated",(()=>{setTimeout((()=>{this.selectNodesWithId(e)}),300)}));const t=l(this.noodlRuntime,e).filter((e=>e.getRef)).filter((e=>!this.selectedNodes.has(e)));for(const e of t){const t=this.createHighlightDiv();this.highlightRootDiv.appendChild(t),this.selectedNodes.set(e,t)}return this.selectedNodes.size>0&&this.setWindowSelected(!1),(this.selectedNodes.size>0||this.highlightedNodes.size>0)&&!this.isUpdatingHighlights&&this.updateHighlights(),t}deselectNodes(){for(const e of this.selectedNodes){const t=e[1];t&&t.remove()}this.selectedNodes.clear()}}function l(e,t){return e.rootComponent?e.rootComponent.nodeScope.getNodesWithIdRecursive(t):[]}class d{constructor({onInspect:e,onHighlight:t,onDisableHighlight:n}){this.onMouseMove=e=>{n();const o=this.findNoodlNode(e.target);o?(document.body.style.cursor="pointer",t(o.id)):document.body.style.cursor="initial",e.stopPropagation()},this.onClick=t=>{n();const o=this.findNoodlNode(t.target);o&&e([o.id]),t.stopPropagation(),t.preventDefault(),document.activeElement&&document.activeElement.blur()},this.onContextMenu=t=>{const n=document.elementsFromPoint(t.clientX,t.clientY).map((e=>this.findNoodlNode(e))).filter((e=>!!e)).map((e=>e.id));n.length&&e(n),t.stopPropagation(),t.preventDefault(),document.activeElement&&document.activeElement.blur()},this.onMouseOut=e=>{n()},this.blockEvent=e=>{e.stopPropagation()},this.onDisableHighlight=n}setComponent(e){this.component=e}enable(){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)}disable(){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()}findNoodlNode(e){let t;for(;!t&&e;){const n=Object.keys(e).find((e=>e.startsWith("__reactInternalInstance$")));t=n?e[n]:null,t||(e=e.parentElement)}if(!t)return;const n=e=>{let t=e.return;for(;t&&"string"==typeof t.type;)t=t.return;return t};let o=n(t);for(;o&&(!o.stateNode||!o.stateNode.props||!o.stateNode.props.noodlNode);)o=n(o);const i=o?o.stateNode.props.noodlNode:void 0;if(i){if(this.component){let e=i;for(;e;)if(e.parentNodeScope){if(e.parentNodeScope.componentOwner.name===this.component.name)return e;e=e.parentNodeScope.componentOwner}else{if(e.nodeScope.componentOwner.name===this.component.name)return e;e=e.nodeScope.componentOwner}return e}return i}}}const u="undefined"!=typeof document;class c{constructor(){this._title="",this._meta={}}get title(){return u?document.title:this._title}setTitle(e){this._title=e,u&&(document.title=e)}get meta(){return this._meta}clearMeta(){u&&Object.keys(this._meta).forEach((e=>{const t=document.querySelector(`meta[name="${e}"]`);t&&t.remove()})),this._meta={}}getMeta(e){return this._meta[e]}setMeta(e,t){if(this._meta[e]=t,u){const n=document.querySelector(`meta[name="${e}"]`);if(n)t?n.setAttribute("content",t):n.remove();else if(t){const n=document.createElement("meta");n.setAttribute("name",e),n.setAttribute("property",e),n.setAttribute("content",t),document.head.appendChild(n)}}}}var p=__webpack_require__(4483),h=__webpack_require__.n(p),m=__webpack_require__(4665),g=__webpack_require__.n(m),f=__webpack_require__(7031),y=__webpack_require__(5741);const v={_noodlRuntime:void 0,showPopup:async(e,t)=>new Promise((n=>{v._noodlRuntime.context.showPopup(e,t,{onClosePopup:(e,t)=>{n({action:null==e?void 0:e.replace("closeAction-",""),parameters:t})}})})),navigate(e,t,n){y.u.instance.navigate(e,{target:t,params:n})},navigateToPath(e,t){let n,o;const i=f.A.instance.getProjectSettings().navigationPathType;void 0===i||"hash"===i?n=e:o=e;const s=[];if(t&&void 0!==t.query)for(const e in t.query)s.push(`${e}=${t.query[e]}`);const r=(void 0!==o?o:"")+(s.length>=1?"?"+s.join("&"):"")+(void 0!==n?"#"+n:"");window.history.pushState({},"",r),dispatchEvent(new PopStateEvent("popstate",{}))}},b=v;var _=__webpack_require__(3795),S=__webpack_require__(9678);const C={upload:async(e,t)=>new Promise(((n,o)=>{_.D.instance.uploadFile({file:e,onUploadProgress:e=>{var n;null===(n=null==t?void 0:t.onProgress)||void 0===n||n.call(t,e)},success:e=>{n(new S.A(e))},error:e=>{o(e)}})}))},N={ports:[{name:"htmlTitle",displayName:"Title",group:"General",plug:"input",type:"string",default:"Fluxscape 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"}]};class O{constructor(e,t){this.isRunning=!1,this.numBoundingBoxObservers=0,this.callback=e,this.pollDelay=t}addObserver(){this.numBoundingBoxObservers++,this.isRunning||this._startObserver()}removeObserver(){this.numBoundingBoxObservers--,0===this.numBoundingBoxObservers&&this._stopObserver()}setTarget(e){this.target=e,this.numBoundingBoxObservers>0&&!this.isRunning&&this._startObserver()}_startObserver(){if(this.isRunning)return;if(!this.target)return;this.isRunning=!0;let e=this.target.getBoundingClientRect();const t=()=>{if(!this.target)return void(this.isRunning=!1);const n=this.target.getBoundingClientRect();e.x!==n.x&&this.callback("x",n),e.y!==n.y&&this.callback("y",n),e.width!==n.width&&this.callback("width",n),e.height!==n.height&&this.callback("height",n),e=n,this.isRunning&&(this.pollDelay?setTimeout(t,this.pollDelay):window.requestAnimationFrame(t))};window.requestAnimationFrame(t)}_stopObserver(){this.isRunning=!1}}function I(e){return e&&"%"===e[e.length-1]}function w(e){return Number(e.slice(0,-1))}function P(e,t,n){if(!t&&!n)return e;let o=`calc(${e}`;return t&&(o+=` - ${t}`),n&&(o+=` - ${n}`),o+=")",o}const x={size(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?(I(e.width)&&!t.fixedWidth&&(e.flexGrow=w(e.width),e.flexShrink=1),I(e.height)&&!t.fixedHeight&&(e.height=P(e.height,e.marginTop,e.marginBottom))):"column"===t.parentLayout&&"relative"===e.position?(I(e.width)&&!t.fixedWidth&&(e.width=P(e.width,e.marginLeft,e.marginRight)),I(e.height)&&!t.fixedHeight&&(e.flexGrow=w(e.height),e.flexShrink=1)):"relative"!==e.position&&(I(e.width)&&(e.width=P(e.width,e.marginLeft,e.marginRight)),I(e.height)&&(e.height=P(e.height,e.marginTop,e.marginBottom)))},align(e,t){const{position:n}=e;let{alignX:o,alignY:i}=t;"relative"!==n&&(o=o||"left",i=i||"top");let s="";const r=t.parentLayout||"column";if(o)if("relative"!==n)"left"===o?e.left=0:"center"===o?(e.left="50%",s+="translateX(-50%) "):e.right=0;else if("relative"===n&&"row"===r)switch(o){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"===r)switch(o){case"left":e.alignSelf="flex-start";break;case"center":e.alignSelf="center";break;case"right":e.alignSelf="flex-end"}if(i)if("relative"!==n)"top"===i?e.top=0:"center"===i?(e.top="50%",s+="translateY(-50%)"):e.bottom=0;else if("relative"===n&&"column"===r)switch(i){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"===r)switch(i){case"top":e.alignSelf="flex-start";break;case"center":e.alignSelf="center";break;case"bottom":e.alignSelf="flex-end"}s&&(e.transform=s+(e.transform||""))}};function E(e){return e&&"object"==typeof e&&!Array.isArray(e)}function T(e,...t){if(!t.length)return e;const n=t.shift();if(E(e)&&E(n))for(const t in n)E(n[t])?(e[t]||Object.assign(e,{[t]:{}}),T(e[t],n[t])):Object.assign(e,{[t]:n[t]});return T(e,...t)}class A{constructor(){this.loadedFontFamilies={},this.fontCssFamiliesAdded={},this.fontCallbacks={},["Arial","Arial Black","Courier New","Helvetica","Impact","Lucida Console","Tahoma","Times New Roman"].forEach((e=>{this.loadedFontFamilies[e]=!0}))}removeFileEnding(e){return e.replace(/\.[^/.]+$/,"")}loadFont(e){var t;if("undefined"==typeof document)return;e=(0,s.getAbsoluteUrl)(e);const n=this.removeFileEnding(e).split("/").pop();if(this.loadedFontFamilies[n])return void(null===(t=this.fontCallbacks[n])||void 0===t||t.forEach((e=>{e()})));if(this.fontCssFamiliesAdded[n])return;this.fontCssFamiliesAdded[n]=!0;const o=document.createElement("style");o.type="text/css";const i=Noodl.Env.BaseUrl||"/";e.startsWith("/")&&(e=e.substring(1)),o.appendChild(document.createTextNode(`@font-face { font-family: '${n}'; src: url('${i}${e}'); }\n`)),document.head.appendChild(o),"undefined"!=typeof window&&__webpack_require__(5371).load({timeout:6e5,custom:{families:[n]},fontactive:e=>{var t;this.loadedFontFamilies[e]=!0,null===(t=this.fontCallbacks[e])||void 0===t||t.forEach((e=>{e()}))}})}callWhenFontIsActive(e,t){this.loadedFontFamilies[e]?t():(this.fontCallbacks[e]||(this.fontCallbacks[e]=[]),this.fontCallbacks[e].push(t))}}function k({title:e,body:t,images:n}){let o=`<h3>${e}</h3>`;if(t&&(o+=(t=Array.isArray(t)?t:[t]).map((e=>`<p>${e}</p>`)).join("")),n){let e="";n.forEach((t=>{e+='<div class="popup-layer-image-item">',e+=`<img src="../assets/images/tooltips/${t.src}">`,t.label&&(e+=`<h3>${t.label}</h3>`),t.body&&(e+=`<p>${t.body}</p>`),e+="</div>"})),o+=`<div class="popup-layer-image-row">${e}</div>`}return o}function D(e,t){e.inputCss||(e.inputCss={}),e.defaultCss||(e.defaultCss={});for(const n in t)e.inputCss[n]=t[n]}function R(e,t,n){e[t]||(e[t]={});for(const o in n)e[t][o]=n[o]}function M(e,t){R(e,"inputs",t)}function V(e,t){R(e,"inputProps",t)}function j(e,t,n){e.dynamicports||(e.dynamicports=[]),e.dynamicports.push({condition:t,inputs:n})}A.instance=new A;const F={addInputProps:V,addInputs:M,addDynamicInputPorts:j,addInputCss:D,addSharedVisualInputs(e){D(e,{opacity:{index:200,group:"Style",displayName:"Opacity",type:"number",default:1,allowVisualStates:!0},mixBlendMode:{index:201,group:"Style",displayName:"Blend Mode",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}}),M(e,{visible:{index:210,displayName:"Visible",group:"Style",default:!0,type:"boolean",set(e){e?this.removeStyle(["visibility"]):this.setStyle({visibility:"hidden"})}},zIndex:{index:211,displayName:"zIndex",group:"Style",type:"number",allowVisualStates:!0,set(e){void 0===e?this.removeStyle(["zIndex"]):this.setStyle({zIndex:Number(e)})}}})},addMarginInputs(e){D(e,{marginLeft:{index:1,group:"Margin and padding",displayName:"Margin Left",type:{name:"number",units:["px","%"],defaultUnit:"px",marginPaddingComp:"margin-left"},allowVisualStates:!0},marginRight:{index:2,group:"Margin and padding",displayName:"Margin Right",type:{name:"number",units:["px","%"],defaultUnit:"px",marginPaddingComp:"margin-right"},allowVisualStates:!0},marginTop:{index:3,group:"Margin and padding",displayName:"Margin Top",type:{name:"number",units:["px","%"],defaultUnit:"px",marginPaddingComp:"margin-top"},allowVisualStates:!0},marginBottom:{index:4,group:"Margin and padding",displayName:"Margin Bottom",type:{name:"number",units:["px","%"],defaultUnit:"px",marginPaddingComp:"margin-bottom"},allowVisualStates:!0}})},addPaddingInputs(e,t){const n=(t=t||{}).defaults?t.defaults:{},o=t.styleTag;D(e,{paddingLeft:{index:64,group:"Margin and padding",default:n.paddingLeft||0,applyDefault:!1,displayName:"Pad Left",type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-left"},allowVisualStates:!0,styleTag:o},paddingRight:{index:65,group:"Margin and padding",default:n.paddingRight||0,applyDefault:!1,displayName:"Pad Right",type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-right"},allowVisualStates:!0,styleTag:o},paddingTop:{index:66,group:"Margin and padding",displayName:"Pad Top",default:n.paddingTop||0,applyDefault:!1,type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-top"},allowVisualStates:!0,styleTag:o},paddingBottom:{index:67,group:"Margin and padding",displayName:"Pad Bottom",default:n.paddingBottom||0,applyDefault:!1,type:{name:"number",units:["px"],defaultUnit:"px",marginPaddingComp:"padding-bottom"},allowVisualStates:!0,styleTag:o}})},addTransformInputs(e){M(e,{transformX:{group:"Placement",displayName:"Pos X",default:0,index:300,allowVisualStates:!0,type:{name:"number",units:["px","%"],defaultUnit:"px"},set(e){this.transforms||(this.transforms={}),this.transforms.x=e.value+e.unit,this.updateTransform()}},transformY:{group:"Placement",displayName:"Pos Y",default:0,index:301,allowVisualStates:!0,type:{name:"number",units:["px","%"],defaultUnit:"px"},set(e){this.transforms||(this.transforms={}),this.transforms.y=e.value+e.unit,this.updateTransform()}},transformRotation:{index:302,group:"Placement",displayName:"Rotation",default:0,allowVisualStates:!0,type:{name:"number",units:["deg"],defaultUnit:"deg"},set(e){this.transforms||(this.transforms={}),this.transforms.rotation=e.value+e.unit,this.updateTransform()}},transformScale:{index:303,group:"Placement",displayName:"Scale",default:1,allowVisualStates:!0,type:{name:"number"},set(e){this.transforms||(this.transforms={}),this.transforms.scale=e,this.updateTransform()}},transformOriginX:{index:304,group:"Placement",displayName:"Transform Origin X",allowVisualStates:!0,type:{name:"number",units:["px","%"],defaultUnit:"%"},default:"50",set(e){this.transformOriginX=e.value+e.unit,this.updateTransformOrigin()}},transformOriginY:{index:305,group:"Placement",displayName:"Transform Origin Y",allowVisualStates:!0,type:{name:"number",units:["px","%"],defaultUnit:"%"},default:"50",set(e){this.transformOriginY=e.value+e.unit,this.updateTransformOrigin()}}}),e.methods||(e.methods={}),e.methods.updateTransform=function(){let e="";const{x:t,y:n,rotation:o,scale:i}=this.transforms;t&&(e+=`translateX(${t}) `),n&&(e+=`translateY(${n}) `),o&&(e+=`rotate(${o}) `),void 0!==i&&(e+=`scale(${i},${i})`),this.setStyle({transform:e})},e.methods.updateTransformOrigin=function(){const e=void 0!==this.transformOriginX?this.transformOriginX:"50%",t=void 0!==this.transformOriginY?this.transformOriginY:"50%";this.setStyle({transformOrigin:`${e} ${t}`})}},addAlignInputs(e){D(e,{position:{index:11,displayName:"Position",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"}}),V(e,{alignX:{index:5,group:"Alignment",displayName:"Align X",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",type:{name:"enum",enums:[{label:"Top",value:"top"},{label:"Center",value:"center"},{label:"Bottom",value:"bottom"}],alignComp:"vertical"}}}),function(e){e.inputCss.position.tooltip=k({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(e){M(e,{pointerEventsMode:{index:403,displayName:"Pointer Events Mode",type:{name:"enum",enums:[{label:"Inherit",value:"inherit"},{label:"Explicit",value:"explicit"}]},default:"inherit",group:"Pointer Events",set(e){if("inherit"===e)this.removeStyle(["pointerEvents"]);else{let e="auto";void 0!==this._internal.pointerEventsEnabled&&(e=this._internal.pointerEventsEnabled?"auto":"none"),this.setStyle({pointerEvents:e})}}},pointerEventsEnabled:{index:404,displayName:"Pointer Events Enabled",type:"boolean",group:"Pointer Events",default:!0,set(e){this._internal.pointerEventsEnabled=!!e,this.setStyle({pointerEvents:this._internal.pointerEventsEnabled?"auto":"none"})}}}),V(e,{blockTouch:{index:450,displayName:"Block Pointer Events",group:"Pointer Events",type:"boolean"}}),j(e,"pointerEventsMode = explicit",["pointerEventsEnabled"]),function(e){R(e,"outputProps",{onClick:{displayName:"Click",group:"Events",type:"signal",propPath:"pointer"},pointerDown:{displayName:"Pointer Down",group:"Pointer Events",type:"signal",propPath:"pointer",props:{onMouseDown(){this.sendSignalOnOutput("pointerDown")},onTouchStart(){this.sendSignalOnOutput("pointerDown")}}},pointerUp:{displayName:"Pointer Up",group:"Pointer Events",type:"signal",propPath:"pointer",props:{onMouseUp(){this.sendSignalOnOutput("pointerUp")},onTouchEnd(){this.sendSignalOnOutput("pointerUp")},onTouchCancel(){this.sendSignalOnOutput("pointerUp")}}},pointerEnter:{displayName:"Pointer Enter",group:"Pointer Events",type:"signal",propPath:"pointer",props:{onMouseEnter(){this.sendSignalOnOutput("pointerEnter")}}},hoverStart:{displayName:"Hover Start",group:"Hover Events",type:"signal",propPath:"pointer",props:{onMouseOver(){this.sendSignalOnOutput("hoverStart"),this.setVisualStates(["hover"])}}},hoverEnd:{displayName:"Hover End",group:"Hover Events",type:"signal",propPath:"pointer",props:{onMouseLeave(){this.sendSignalOnOutput("hoverEnd"),this.setVisualStates([""])}}}})}(e),function(e){e.inputs.pointerEventsMode.tooltip=k({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=k({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)},addDimensions(e,{defaultSizeMode:t="explicit",contentLabel:n="Content",useDimensionConstraints:o=!0}={}){let i="sizeMode = explicit OR sizeMode = contentHeight",s="sizeMode = explicit OR sizeMode = contentWidth";"explicit"!==t&&"contentHeight"!==t||(i+=" OR sizeMode NOT SET"),"explicit"!==t&&"contentWidth"!==t||(s+=" OR sizeMode NOT SET"),j(e,i,["width"]),j(e,s,["height"]),V(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",default:t,allowVisualStates:!0},width:{index:11,group:"Dimensions",displayName:"Width",type:{name:"dimension",units:["%","px","vw","vh"],defaultUnit:"%"},default:100,allowVisualStates:!0,onChange(e){this.props.fixedWidth=e.isFixed}},height:{index:13,group:"Dimensions",displayName:"Height",type:{name:"dimension",units:["%","px","vw","vh"],defaultUnit:"%"},default:100,allowVisualStates:!0,onChange(e){this.props.fixedHeight=e.isFixed}}}),Noodl.deployed||function(e,t){e.inputProps.sizeMode.tooltip={explicit:{standard:"Explicit width & height",extended:k({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:`${t} width & explicit height`,extended:k({title:`${t} width & explicit height`,body:`The width will match the width of the ${t.toLowerCase()}. Height is set explicitly.`,images:[{src:"size-mode-content-width.svg"}]})},contentHeight:{standard:`Explicit width & ${t.toLowerCase()} height`,extended:k({title:`Explicit width & ${t.toLowerCase()} height`,body:`The width is set explicitly. The height will match the height of the ${t.toLowerCase()}`,images:[{src:"size-mode-content-height.svg"}]})},contentSize:{standard:`${t} width & height`,extended:k({title:`${t} width & height`,body:`The width and height will match the size of the ${t.toLowerCase()}`,images:[{src:"size-mode-content-size.svg"}]})}};const 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"],o=k({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:k({title:"Width",body:n}),fixed:o},e.inputProps.height.tooltip={dimension:k({title:"Height",body:n}),fixed:o}}(e,n),o&&(D(e,{minWidth:{index:400,group:"Dimension Constraints",displayName:"Min Width",allowVisualStates:!0,type:{name:"number",units:["%","px","vw","vh"],defaultUnit:"%"}},maxWidth:{index:401,group:"Dimension Constraints",displayName:"Max Width",allowVisualStates:!0,type:{name:"number",units:["%","px","vw","vh"],defaultUnit:"%"}},minHeight:{index:402,group:"Dimension Constraints",displayName:"Min Height",allowVisualStates:!0,type:{name:"number",units:["%","px","vw","vh"],defaultUnit:"%"}},maxHeight:{index:403,group:"Dimension Constraints",displayName:"Max Height",allowVisualStates:!0,type:{name:"number",units:["%","px","vw","vh"],defaultUnit:"%"}}}),Noodl.deployed||function(e){e.inputCss.minWidth.tooltip=k({title:"Minimum width",body:"This is prioritized over other properties, so the element won't shrink below this size"}),e.inputCss.minHeight.tooltip=k({title:"Minimum height",body:"This is prioritized over other properties, so the element won't shrink below this size"}),e.inputCss.maxWidth.tooltip=k({title:"Maximum width",body:"This is prioritized over other properties, so the element won't grow beyond this size"}),e.inputCss.maxHeight.tooltip=k({title:"Maximum height",body:"This is prioritized over other properties, so the element won't grow beyond this size"})}(e))},_addCornerRadius(e,t){const n=(t=t||{}).defaults||{},o=t.styleTag;function i(e,t,o,i){const s={group:"corners",tab:o,label:t},r=`border${t}Radius`;M(e,{[r]:{index:240+i,displayName:"Corner Radius",editorName:"Corner Radius "+(t?"("+t+")":""),group:"Corner Radius",type:{name:"number",units:["px","%"],defaultUnit:"px"},allowVisualStates:!0,default:n[r],tab:s,set(e){this._internal.borderRadius[r]=void 0===e.value?Number(e)+"px":e.value+e.unit,this._updateCornerRadii()}}})}n.borderRadius||(n.borderRadius=0),i(e,"","corners-all",0),i(e,"TopLeft","corners-top-left",1),i(e,"TopRight","corners-top-right",2),i(e,"BottomRight","corners-bottom-right",3),i(e,"BottomLeft","corners-bottom-left",4),e.methods._updateCornerRadii=function(){const e=this._internal.borderRadius;function t(t,n){const o=`border${n}Radius`;t[o]=e[o]||e.borderRadius}const n={};t(n,"TopLeft"),t(n,"TopRight"),t(n,"BottomRight"),t(n,"BottomLeft"),this.setStyle(n,o)};const s=e.initialize;e.initialize=function(){s&&s.call(this),this._internal.borderRadius={...n},n.borderRadius&&this._updateCornerRadii()}},addBorderInputs(e,t){const n=(t=t||{}).defaults||{},o=t.styleTag;function i(e,t,o,i){const s=`border${t}Style`,r=`border${t}Width`,a=`border${t}Color`;let l="none"!==n.borderStyle?"OR borderStyle NOT SET":"";t?(n[s]&&"none"!==n[s]&&(l+=`OR ${s} NOT SET`),j(e,`${s} = solid OR ${s} = dashed OR ${s} = dotted OR borderStyle = solid OR borderStyle = dashed OR borderStyle = dotted ${l}`,[`${r}`,`${a}`])):j(e,`${s} = solid OR ${s} = dashed OR ${s} = dotted ${l}`,[`${r}`,`${a}`]);const d={group:"border-styles",tab:o,label:t},u=e=>`${e} ${t?"("+t+")":""}`,c=202+4*i;M(e,{[s]:{index:c+1,displayName:"Border Style",editorName:u("Border Style"),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:d,set(e){this._internal.borders[s]=e,this._updateBorders()}},[r]:{index:c+2,displayName:"Border Width",editorName:u("Border Width"),group:"Border Style",allowVisualStates:!0,type:{name:"number",units:["px"],defaultUnit:"px"},default:n[r],tab:d,set(e){this._internal.borders[r]=void 0===e.value?Number(e)+"px":e.value+e.unit,this._updateBorders()}},[a]:{index:c+3,displayName:"Border Color",editorName:u("Border Color"),group:"Border Style",type:"color",default:n[a],allowVisualStates:!0,tab:d,set(e){this._internal.borders[a]=e,this._updateBorders()}}})}void 0===n.borderStyle&&(n.borderStyle="none"),void 0===n.borderWidth&&(n.borderWidth=2),void 0===n.borderColor&&(n.borderColor="#000000"),i(e,"","borders-all",0),i(e,"Left","borders-left",1),i(e,"Top","borders-top",2),i(e,"Right","borders-right",3),i(e,"Bottom","borders-bottom",4),e.methods._updateBorders=function(){const e=this._internal.borders;function t(t,n){const o=`border${n}Width`,i=`border${n}Color`,s=`border${n}Style`;t[o]=e[o]||e.borderWidth,t[i]=e[i]||e.borderColor,t[s]=e[s]||e.borderStyle}const n={};t(n,"Top"),t(n,"Right"),t(n,"Bottom"),t(n,"Left"),this.setStyle(n,o)};const s=e.initialize;e.initialize=function(){s&&s.call(this),this._internal.borders={...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:o})},addShadowInputs(e,t){const n=(t=t||{}).styleTag;j(e,"boxShadowEnabled = true",["boxShadowOffsetX","boxShadowOffsetY","boxShadowInset","boxShadowBlurRadius","boxShadowSpreadRadius","boxShadowColor"]),M(e,{boxShadowEnabled:{index:250,group:"Box Shadow",displayName:"Shadow Enabled",type:"boolean",default:!1,allowVisualStates:!0,set(e){this._internal.boxShadowEnabled=e,this._updateBoxShadow()}},boxShadowOffsetX:{index:251,group:"Box Shadow",displayName:"Offset X",default:0,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,set(e){this._internal.boxShadowOffsetX=e.value+e.unit,this._updateBoxShadow()}},boxShadowOffsetY:{index:252,group:"Box Shadow",displayName:"Offset Y",default:0,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,set(e){this._internal.boxShadowOffsetY=e.value+e.unit,this._updateBoxShadow()}},boxShadowBlurRadius:{index:253,group:"Box Shadow",displayName:"Blur Radius",default:5,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,set(e){this._internal.boxShadowBlurRadius=e.value+e.unit,this._updateBoxShadow()}},boxShadowSpreadRadius:{index:254,group:"Box Shadow",displayName:"Spread Radius",default:2,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,set(e){this._internal.boxShadowSpreadRadius=e.value+e.unit,this._updateBoxShadow()}},boxShadowInset:{index:255,group:"Box Shadow",displayName:"Inset",type:"boolean",default:!1,allowVisualStates:!0,set(e){this._internal.boxShadowInset=e,this._updateBoxShadow()}},boxShadowColor:{index:256,group:"Box Shadow",displayName:"Shadow Color",type:"color",default:"#00000033",allowVisualStates:!0,set(e){this._internal.boxShadowColor=e,this._updateBoxShadow()}}}),e.methods._updateBoxShadow=function(){const e=this._internal;e.boxShadowEnabled?this.setStyle({boxShadow:`${e.boxShadowInset?"inset ":""}${e.boxShadowOffsetX} ${e.boxShadowOffsetY} ${e.boxShadowBlurRadius} ${e.boxShadowSpreadRadius} ${e.boxShadowColor}`},n):this.removeStyle(["boxShadow"],n)};const o=e.initialize;e.initialize=function(){o&&o.call(this),this._internal.boxShadowOffsetX=0,this._internal.boxShadowOffsetY=0,this._internal.boxShadowBlurRadius="5px",this._internal.boxShadowSpreadRadius="2px",this._internal.boxShadowColor="#00000033"}},addIconInputs(e,t){const n={useIcon:!0,iconColor:"#FFFFFF"};(t=t||{}).defaults&&Object.assign(n,t.defaults);let o="useIcon = true";n.useIcon&&(o+=" OR useIcon NOT SET");const i=["iconSourceType","iconSize"];t.enableIconPlacement&&(i.push("iconPlacement"),i.push("iconSpacing")),j(e,o,i),n.useIcon?(j(e,"#js (params.useIcon===true || params.useIcon===undefined) && params.iconSourceType === 'image'",["iconImageSource"]),j(e,"#js (params.useIcon===true || params.useIcon===undefined) && params.iconSourceType === 'icon'",["iconIconSource","iconColor"])):(j(e,"useIcon = true AND iconSourceType = image",["iconImageSource"]),j(e,"useIcon = true AND iconSourceType = icon",["iconIconSource","iconColor"])),t.hideEnableIconInput||V(e,{useIcon:{type:"boolean",group:"Icon",displayName:"Enable Icon",default:n.useIcon,allowVisualStates:!0,index:20}}),V(e,{iconSourceType:{type:{name:"enum",enums:[{label:"Image",value:"image"},{label:"Icon",value:"icon"}]},group:"Icon",displayName:"Type",default:"icon",allowVisualStates:!0,index:21},iconIconSource:{type:"icon",displayName:"Icon Source",group:"Icon",allowVisualStates:!0,index:23}}),M(e,{iconImageSource:{type:"image",displayName:"Image Source",group:"Icon",allowVisualStates:!0,index:22,set(e){this.props.iconImageSource=(0,s.getAbsoluteUrl)(e)}}}),t.enableIconPlacement&&V(e,{iconSpacing:{group:"Icon",displayName:"Spacing",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",default:"left",allowVisualStates:!0,index:25}}),V(e,{iconSize:{group:"Icon",displayName:"Size",default:16,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,index:26},iconColor:{group:"Icon",displayName:"Color",editorName:"Icon Color",default:n.iconColor,type:"color",allowVisualStates:!0,index:27}})},addLabelInputs(e,t){const n={useLabel:!1};(t=t||{}).defaults&&Object.assign(n,t.defaults);const o=n.useLabel?"useLabel = true OR useLabel NOT SET":"useLabel = true",i=t.styleTag||"",s=["label"].concat(["textStyle","fontFamily","fontSize","color","letterSpacing","lineHeight","textTransform"].map((e=>i+e)));t.enableSpacing&&s.push("labelSpacing"),j(e,o,s),V(e,{useLabel:{index:18,type:"boolean",displayName:"Enable Label",group:"Label",default:n.useLabel},label:{type:"string",displayName:"Label",group:"Label",default:"Label"}}),t.enableSpacing&&V(e,{labelSpacing:{displayName:"Spacing",group:"Label",type:{name:"number",units:["px"],defaultUnit:"px"},default:10}}),this.addTextStyleInputs(e,{...t,group:"Label Text Style",popout:{group:"label-text-style",label:"Text Style",parentGroup:"Label"}})},addTextStyleInputs(e,t){const n=(t=t||{}).group||"Text Style",o=t.styleTag,i=t.hasOwnProperty("portPrefix")?t.portPrefix:t.styleTag||"",s=i+"textStyle",r=void 0!==t.portIndex?t.portIndex:19;function a(e){return t.displayName?t.displayName+" "+e:e}M(e,{[s]:{index:r,type:{name:"textStyle",childPorts:["fontFamily","fontSize","color","letterSpacing","lineHeight","textTransform"],childPortPrefix:i},group:n,displayName:"Text Style",editorName:a("Text Style"),default:"None",set(e){this.props[s]=this.context.styles.getTextStyle(e),this.forceUpdate()},allowVisualStates:!0,popout:t.popout},[i+"fontFamily"]:{index:r+1,type:{name:"font",parentPort:s},group:n,displayName:"Font Family",editorName:a("Font Family"),set(e){if(e){let t=e;t.split(".").length>1&&(A.instance.loadFont(t),t=t.replace(/\.[^/.]+$/,""),t=t.split("/").pop()),this.setStyle({fontFamily:t},o)}else this.removeStyle(["fontFamily"],o);this.props[s]&&this.forceUpdate()},allowVisualStates:!0,popout:t.popout}}),D(e,{[i+"fontSize"]:{index:r+2,group:n,displayName:"Font Size",editorName:a("Font Size"),targetStyleProperty:"fontSize",type:{name:"number",units:["px"],defaultUnit:"px",parentPort:s},onChange(){this.props[s]&&this.forceUpdate()},allowVisualStates:!0,popout:t.popout,styleTag:o},[i+"color"]:{index:r+3,type:{name:"color",parentPort:s},displayName:"Color",editorName:a("Color"),group:n,targetStyleProperty:"color",allowVisualStates:!0,popout:t.popout,styleTag:o,onChange(){this.props[s]&&this.forceUpdate()}},[i+"letterSpacing"]:{index:r+4,group:n,displayName:"Letter Spacing",editorName:a("Letter Spacing"),targetStyleProperty:"letterSpacing",type:{name:"number",units:["px","em"],defaultUnit:"px"},allowVisualStates:!0,popout:t.popout,styleTag:o,default:"Auto",applyDefault:!1,onChange(){this.props[s]&&this.forceUpdate()}},[i+"lineHeight"]:{index:r+5,group:n,displayName:"Line Height",editorName:a("Line Height"),targetStyleProperty:"lineHeight",type:{name:"number",units:["","px","%"],defaultUnit:"",parentPort:s},allowVisualStates:!0,onChange(){this.props[s]&&this.forceUpdate()},popout:t.popout,styleTag:o,default:"Auto",applyDefault:!1},[i+"textTransform"]:{index:r+6,group:n,displayName:"Case",editorName:a("Case"),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:s},default:"none",popout:t.popout,styleTag:o,allowVisualStates:!0,onChange(){this.props[s]&&this.forceUpdate()}}});const l=i+"fontFamily";e.setup=function(t,n){n.on("nodeAdded."+e.name,(function(e){e.parameters[l]&&e.parameters[l].split(".").length>1&&A.instance.loadFont(e.parameters[l]),e.on("parameterUpdated",(function(e){e.name===l&&e.value&&e.value.split(".").length>1&&A.instance.loadFont(e.value)}))}))}}};var U=__webpack_require__(8972),W=__webpack_require__.n(U),L=__webpack_require__(2004);function B(e,t,n,o){e._transitions&&e._transitions[t]&&(e._transitions[t].stop(),delete e._transitions[t]);const i=e.getInputValue(t),s=e.getInput(t);let r;if(s&&"color"===s.type?r=function(e,t){const n=[0,0,0,255];q(n,e);const o=[0,0,0,255];q(o,t),e&&"transparent"!==e||(n[0]=o[0],n[1]=o[1],n[2]=o[2]),t&&"transparent"!==t||(o[0]=n[0],o[1]=n[1],o[2]=n[2]);const i=[0,0,0,0];return e=>(i[0]=Math.floor(L.A.linear(n[0],o[0],e)),i[1]=Math.floor(L.A.linear(n[1],o[1],e)),i[2]=Math.floor(L.A.linear(n[2],o[2],e)),i[3]=Math.floor(L.A.linear(n[3],o[3],e)),function(e){return"#"+z(e[0])+z(e[1])+z(e[2])+z(e[3])}(i))}(e.context.styles.resolveColor(i),e.context.styles.resolveColor(n)):"number"==typeof i&&"number"==typeof n?r=$(i,n):"object"==typeof i&&i.hasOwnProperty("value")&&"object"==typeof n&&n.hasOwnProperty("value")&&(r=$(i.value,n.value)),r){e._transitions||(e._transitions={});const n=W()(o.curve);e._transitions[t]=e.context.timerScheduler.createTimer({duration:o.dur,onRunning:o=>{const i=r(n.get(o));e.queueInput(t,i)},onFinish:()=>{delete e._transitions[t]}}),e._transitions[t].start()}else e.queueInput(t,n)}function $(e,t){return n=>L.A.linear(e,t,n)}function q(e,t){if("transparent"===t||!t)return void(e[3]=0);const n=(t.length-1)/2;for(let o=0;o<n;++o){const n=1+2*o;e[o]=parseInt(t.substring(n,n+2),16)}}function z(e){const t=e.toString(16);return 1===t.length?"0"+t:t}function H(e,t,n){const o=n?e.props[n]:e.props;for(const n in t)if(o[n]){const i=o[n];o[n]=()=>{i(),t[n].call(e)}}else o[n]=t[n].bind(e);e.forceUpdate()}function G(e,t,n){let o;o="signal"===n.type?()=>{e.sendSignalOnOutput(t)}:(...o)=>{e.outputPropValues[t]=n.getValue?n.getValue.call(e,...o):o[0],e.flagOutputDirty(t),n.onChange&&n.onChange.call(e,e.outputPropValues[t])},H(e,{[t]:o},n.propPath)}function X(e,t){if(!e.type)throw new Error(`input ${t} is missing a type`);e.type.units?e.set=function(n){const o=e.propPath?this.props[e.propPath]:this.props;n&&void 0!==n.value?o[t]=n.value+n.unit:delete o[t],e.onChange&&e.onChange.call(this,n),this.forceUpdate()}:e.set=function(n){const o=e.propPath?this.props[e.propPath]:this.props;void 0!==n?o[t]=n:delete o[t],e.onChange&&e.onChange.call(this,n),this.forceUpdate()}}function Y(e,t){for(const n of t)Array.isArray(n)?Y(e,n):void 0!==n&&e.push(n)}class J extends n().Component{componentDidMount(){this.props.noodlNode.sendSignalOnOutput("didMount")}componentWillUnmount(){this.props.noodlNode.sendSignalOnOutput("willUnmount");const e=this.props.noodlNode;if(e.currentVisualStates){const t=["hover","pressed","focused"],n=e.currentVisualStates.filter((e=>!t.includes(e)));e.setVisualStates(n)}}render(){const{noodlNode:e,style:t,...o}=this.props;let i=e.style;t&&(i={...e.style,...t});const s={ref:t=>{e.innerReactComponentRef=t},style:i,...e.props,...o};if(e.noodlNodeAsProp){s.noodlNode=e;const t=e.getVisualParentNode();t&&t.props.layout&&(s.parentLayout=t.props.layout)}return e.renderedAtFrame=e.context.frameNumber,e.useFrame&&(void 0!==s.textStyle&&(s.style=i=Object.assign({},s.textStyle,i)),x.size(i,s),x.align(i,s)),n().createElement(e.reactComponent,s,e.renderChildren())}}function K(e,t,n){let o=e;if(n&&o.getAttribute("noodl-style-tag")!==n&&(o=e.querySelector(`[noodl-style-tag=${n}]`)),o)for(const e in t)o.style[e]=t[e]}let Q=0;function Z(e){const{frame:t}=e;void 0!==t&&(t.dimensions&&F.addDimensions(e,"object"==typeof t.dimensions?t.dimensions:void 0),t.position&&F.addTransformInputs(e),t.margins&&F.addMarginInputs(e),t.padding&&F.addPaddingInputs(e),t.align&&F.addAlignInputs(e));const{initialize:o,inputs:s,inputProps:r,inputCss:a,outputs:l,outputProps:d,dynamicports:u,defaultCss:c={},methods:p}=e,h=Object.assign({},c),m={};for(const e in a){const t=a[e],n=t.hasOwnProperty("default")&&!1!==t.applyDefault;if(t.styleTag&&!m.hasOwnProperty(t.styleTag)&&(m[t.styleTag]={}),n){const n=t.type.units?t.default+t.type.defaultUnit:t.default;t.styleTag?m[t.styleTag][e]=n:h[e]=n}}function g(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")}const f=void 0===e.useVariants||e.useVariants,y={name:e.name,docs:e.docs,displayNodeName:e.displayNodeName||e.displayName,shortDesc:"",category:"Visual",allowChildren:void 0===e.allowChildren||e.allowChildren,visualStates:e.visualStates,allowAsExportRoot:e.allowAsExportRoot,singleton:e.singleton,useVariants:f,usePortAsLabel:e.usePortAsLabel,portLabelTruncationMode:e.portLabelTruncationMode,connectionPanel:e.connectionPanel,nodeDoubleClickAction:e.nodeDoubleClickAction,initialize(){this.reactKey="key"+Q,Q++,this.children=[],v&&(this.childrenCount=0),this.props={styles:{}},this.outputPropValues={},this.style=Object.assign({},h);for(const e in m)this.props.styles[e]=Object.assign({},m[e]);this.childIndex=0,this.clientBoundingRect={},this.noodlNodeAsProp=!!e.noodlNodeAsProp;const n=this.context&&this.context.runningInCanvas?300:0;this.boundingBoxObserver=new O(g.bind(this),n),this.wantsToBeMounted=!0,this.useFrame=!!t;for(const e in r){const t=r[e];t.propPath&&!this.props.hasOwnProperty(t.propPath)&&(this.props[t.propPath]={});const n=t.propPath?this.props[t.propPath]:this.props;t.hasOwnProperty("default")&&(t.type.defaultUnit&&void 0!==t.default?n[e]=t.default+t.type.defaultUnit:n[e]=t.default)}for(const e in d){const t=d[e];t.propPath&&!this.props.hasOwnProperty(t.propPath)&&(this.props[t.propPath]={}),t.props?H(this,t.props,t.propPath):G(this,e,t)}this.reactComponentRef=null,this.reactComponent=e.getReactComponent.call(this),o&&o.call(this)},getInspectInfo:e.getInspectInfo,nodeScopeDidInitialize:e.nodeScopeDidInitialize,dynamicports:u,inputs:{cssClassName:{index:100010,displayName:"CSS Class",group:"Advanced HTML",type:"string",default:"",set(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; */",set(e){this.updateAdvancedStyle({content:e})}}},outputs:{childIndex:{displayName:"Child Index",type:"number",get(){return this.childIndex}},this:{displayName:"This",type:"reference",get(){return this}},screenPositionX:{group:"Bounding Box",displayName:"Screen Position X",type:"number",get(){return this.clientBoundingRect.x},onFirstConnectionAdded(){this.boundingBoxObserver.addObserver()},onLastConnectionRemoved(){this.boundingBoxObserver.removeObserver()}},screenPositionY:{group:"Bounding Box",displayName:"Screen Position Y",type:"number",get(){return this.clientBoundingRect.y},onFirstConnectionAdded(){this.boundingBoxObserver.addObserver()},onLastConnectionRemoved(){this.boundingBoxObserver.removeObserver()}},boundingWidth:{group:"Bounding Box",displayName:"Width",type:"number",get(){return this.clientBoundingRect.width},onFirstConnectionAdded(){this.boundingBoxObserver.addObserver()},onLastConnectionRemoved(){this.boundingBoxObserver.removeObserver()}},boundingHeight:{group:"Bounding Box",displayName:"Height",type:"number",get(){return this.clientBoundingRect.height},onFirstConnectionAdded(){this.boundingBoxObserver.addObserver()},onLastConnectionRemoved(){this.boundingBoxObserver.removeObserver()}},didMount:{group:"Mounted",displayName:"Did Mount",type:"signal"},willUnmount:{group:"Mounted",displayName:"Will Unmount",type:"signal"}},methods:{updateAdvancedStyle(e){let t;this.customCssStyles&&(this.removeStyle(Object.keys(this.customCssStyles)),this.customCssStyles=void 0);let n="",o=(e.content||"").replace("\n",""),i="";for(;o.length;){let e=o.indexOf("/*");if(-1===e&&(e=o.length),i+=o.substring(0,e),o=o.substring(e),o.length){let e=o.indexOf("*/");-1===e&&(e=o.length),o=o.substring(e+2)}}function s(e){return e.replace(/^\s+|\s+$/gm,"")}const r=i.split(";").map(s).filter((e=>e.length));t={};for(const e of r){const o=e.split(":").map(s);if(-1!==e.indexOf("\n"))n+="Missing semicolon: "+e.split("\n")[0];else if(2!==o.length)n+="Syntax error: "+e;else{const e=o[0].split("-");for(let t=1;t<e.length;t++)e[t]=e[t][0].toUpperCase()+e[t].substring(1);t[e.join("")]=o[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(e){this.childIndex=e,this.flagOutputDirty("childIndex")},updateChildIndices(){let e=0;for(let t=0;t<this.children.length;t++){const n=this.children[t];"For Each"!==n.name&&"Component Children"!==n.name||e--,n.setChildIndex&&n.setChildIndex(t+e)}},updateChildrenCount(){let e=0;this.children.forEach((t=>{"For Each"===t?.model?.type?e+=t.model.children.length:e++})),this.childrenCount=e,this.flagOutputDirty("childrenCount")},addChild(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(e){const 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(e){return-1!==this.children.indexOf(e)||this.children.some((t=>t.contains&&t.contains(e)))},scheduleUpdateChildCountAndIndicies(){this.updateChildIndiciesScheduled||(this.updateChildIndiciesScheduled=!0,this.scheduleAfterInputsHaveUpdated((()=>{this.updateChildIndices(),v&&this.updateChildrenCount(),this.updateChildIndiciesScheduled=!1})))},getChildren(){return this.children},isChild(e){return-1!==this.children.indexOf(e)},getChildRoot(){return this},forceUpdate(){!0!==this.forceUpdateScheduled&&(this.forceUpdateScheduled=!0,this.context.eventEmitter.once("frameEnd",(()=>{this.forceUpdateScheduled=!1,this.renderedAtFrame!==this.context.frameNumber&&this.reactComponentRef&&this.reactComponentRef.setState({})})),this.context.scheduleUpdate())},_resetReactVirtualDOM(){this.reactKey="key"+Q,Q++;const e=this.getVisualParentNode();e&&(e.cachedChildren=void 0,e.forceUpdate())},triggerDidMount(){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((e=>{e.triggerDidMount&&e.triggerDidMount()}))},render(){if(this.wantsToBeMounted)return n().createElement(J,{key:this.reactKey,noodlNode:this,ref:e=>{this.reactComponentRef=e,this.boundingBoxObserver.setTarget(i().findDOMNode(e))}})},renderChildren(){if(!this.cachedChildren){let e=[];Y(e,this.children.map((e=>e.render()))),0===e.length?e=null:1===e.length&&(e=e[0]),this.cachedChildren=e}return this.cachedChildren},setStyle(e,t){const n=t?this.props.styles[t]:this.style;for(const t in e)n[t]=e[t];const o=this.getDOMElement();if(!o)return;let i=!1;if(!t){if(e.hasOwnProperty("opacity")&&(i=e.hasOwnProperty("opacity")&&("0"===o.style.opacity&&e.opacity>0||"0"!==o.style.opacity&&0===e.opacity)),e.transform){let t=e.transform;const n=this.getVisualParentNode();"absolute"!==this.style.position&&n&&n.style.flexDirection||("center"!==this.props.alignX||o.style.marginLeft&&o.style.marginRight||(t="translateX(-50%) "+t),"center"!==this.props.alignY||o.style.marginTop&&o.style.marginBottom||(t="translateY(-50%) "+t)),e.transform=t}const t=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])&&t&&(i=!0),(e.position||e.flexDirection||e.clip)&&(i=!0)}i?this.forceUpdate():K(o,e,t)},removeStyle(e,t){const n=t?this.props.styles[t]:this.style;for(const t of e)delete n[t];const o=this.getDOMElement();let i=!1;if(!t&&o){const t={marginTop:!0,marginBottom:!0,marginLeft:!0,marginRight:!0};for(const n of e)t[n]&&(i=!0)}if(o){const n={};for(const t of e)n[t]="";K(o,n,t)}i&&this.forceUpdate()},getStyle(e){return this.style[e]},getRef(){return this.reactComponentRef},getDOMElement(){const e=this.getRef();if(e)return i().findDOMNode(e)},getVisualParentNode(){if(this.parent)return this.parent;let e=this.nodeScope.componentOwner;for(;!e.parent&&e.parentNodeScope;)e=e.parentNodeScope.componentOwner;return e?e.parent:void 0},setVariant(e){this._stopStateTransitions(),this.variant=e;const t={};e&&T(t,e.parameters),T(t,this.model.parameters),this.currentVisualStates&&T(t,this.getParametersForStates(this.currentVisualStates));const n=Object.keys(t).filter((e=>!this._hasInputBeenSetFromAConnection(e)));for(const e of n)this.registerInputIfNeeded(e),this.hasInput(e)&&this.queueInput(e,t[e])},getParameter(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(e){const t={};if(this.variant)for(const n of e)this.variant.stateParameters&&this.variant.stateParameters.hasOwnProperty(n)&&T(t,this.variant.stateParameters[n]);for(const e in t)this.model.parameters.hasOwnProperty(e)&&((n=t[e])&&"object"==typeof n&&!Array.isArray(n)?T(t[e],this.model.parameters[e]):t[e]=this.model.parameters[e]);var n;if(this.model.stateParameters)for(const n of e)this.model.stateParameters.hasOwnProperty(n)&&T(t,this.model.stateParameters[n]);return t},_getNewState(e,t){const n=t.filter((t=>!(e||[]).includes(t))),o=n.length?n[0]:"neutral";return""===o?"neutral":o},_getDefaultTransition(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(e){let 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(e){if(!this.model)return;if(this.currentVisualStates&&e.length===this.currentVisualStates.length&&e.every(((e,t)=>e===this.currentVisualStates[t])))return;const t=this.currentVisualStates?this.getParametersForStates(this.currentVisualStates):{},n=this.getParametersForStates(e),o=this._getNewState(this.currentVisualStates,e);this.currentVisualStates=e;const i={};for(const e in t)n.hasOwnProperty(e)||this._hasInputBeenSetFromAConnection(e)||void 0!==this.getParameter(e)&&(i[e]=this.getParameter(e));for(const e in n)this._hasInputBeenSetFromAConnection(e)||void 0===n[e]||(i[e]=n[e]);const s=this._getDefaultTransition(o),r=this._getStateTransition(o);for(const e in i)r[e]&&r[e].curve?B(this,e,i[e],r[e]):!r[e]&&s?B(this,e,i[e],s):(this._transitions&&this._transitions[e]&&(this._transitions[e].stop(),delete this._transitions[e]),this.queueInput(e,i[e]))},_getVisualStates(){return this.currentVisualStates||[]},_stopStateTransitions(){if(this._transitions)for(const e in this._transitions)this._transitions[e].stop(),delete this._transitions[e]}}};f&&(y.inputs.variant={displayName:"Variant",group:"General",type:{name:"string",allowConnectionsOnly:!0},set(e){if(this.variant&&this.variant.name===e)return;const t=this.context.variants.getVariant(this.model.type,e);t&&this.setVariant(t)}}),!1!==e.mountedInput&&(y.inputs.mounted={displayName:"Mounted",index:9999,type:"boolean",group:"General",default:!0,set(e){if(e=!!e,this.wantsToBeMounted!==e){this.wantsToBeMounted=e;const t=this.getVisualParentNode();t&&(t.cachedChildren=void 0,t.forceUpdate())}}});const v=y.allowChildren||y.displayName;v&&(y.outputs.childrenCount={displayName:"Children Count",type:"number",get(){return this.childrenCount}});for(const e in s)y.inputs[e]=s[e];for(const t in r){const n=r[t];"node"===n.type?(n.type="reference",n.set=function(e){const o=n.propPath?this.props[n.propPath]:this.props;void 0!==e?o[t]=e.render():delete o[t],this.forceUpdate()}):"signal"===n.type?console.error(`Error: Signals not supported as a react prop. node: '${e.name}' input: '${t}'`):X(n,t),y.inputs[t]=n}for(const e in a){const t=a[e],n=t.targetStyleProperty||e;t.type.units?t.set=function(e){"object"!=typeof e&&t.type.defaultUnit&&(e={value:e,unit:t.type.defaultUnit}),"object"==typeof e&&void 0!==e.value?this.setStyle({[n]:e.value+e.unit},t.styleTag):void 0!==e?this.setStyle({[n]:e},t.styleTag):this.removeStyle([n],t.styleTag),t.onChange&&t.onChange.call(this,e)}:t.set=function(e){void 0!==e?this.setStyle({[n]:e},t.styleTag):this.removeStyle([n],t.styleTag),t.onChange&&t.onChange.call(this,e)},y.inputs[e]=t}for(const e in l)y.outputs[e]=l[e];for(const e in d){const t=d[e];"signal"!==t.type&&(t.get=function(){return this.outputPropValues[e]}),y.outputs[e]=t}for(const e in p)y.methods[e]=p[e];return{node:y,setup:e.setup}}const ee=["onClick","onMouseDown","onMouseMove","onMouseUp","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel","onPointerDown","onPointerMove","onPointerUp","onPointerCancel"],te=new Set(["onMouseLeave","onMouseOut"]);function ne(e){const t={};for(const n of ee)e.blockTouch&&!te.has(n)?e.pointer&&e.pointer[n]?t[n]=t=>{e.pointer[n](t),t.stopPropagation()}:e[n]?t[n]=t=>{e[n](t),t.stopPropagation()}:t[n]=e=>{e.stopPropagation()}:e[n]?t[n]=e[n]:e.pointer&&(t[n]=e.pointer[n]);if(e.noodlNode)for(const n in t){const o=t[n];o&&(t[n]=t=>{o.call(this,t),e.noodlNode.context.updateDirtyNodes()})}return t}const oe={};function ie(e,t,n){e[t]||(e[t]={});for(const o in n)e[t][o]=n[o]}const se=function(e,t,n){if(oe[e])(function(e,t){let 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,oe[e].props)||(oe[e].style.innerHTML=n(e,t),oe[e].props=Object.assign({},t));else{const o=document.createElement("style");o.innerHTML=n(e,t),document.head.appendChild(o),oe[e]={style:o,props:Object.assign({},t)}}},re=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"}),function(e){ie(e,"inputs",{enabled:{type:"boolean",displayName:"Enabled",group:"General",default:!0,set:function(e){const t=(e=!!e)!==this._internal.enabled;this.props.enabled=this._internal.enabled=e,t&&(this._updateVisualState(),this.forceUpdate(),this.flagOutputDirty("enabled"))}}})}(e),function(e){ie(e,"inputProps",{blockTouch:{index:450,displayName:"Block Pointer Events",type:"boolean",group:"Pointer Events"}})}(e),e.methods._updateVisualState=function(){const 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)},function(e){ie(e,"outputProps",{focusState:{displayName:"Focused",group:"States",type:"boolean",props:{onFocus(){this.outputPropValues.focusState=!0,this.flagOutputDirty("focusState"),this._updateVisualState()},onBlur(){this.outputPropValues.focusState=!1,this.flagOutputDirty("focusState"),this._updateVisualState()}}},onFocus:{displayName:"Focused",group:"Focus Events",type:"signal",props:{onFocus(){this.sendSignalOnOutput("onFocus")}}},onBlur:{displayName:"Blurred",group:"Focus Events",type:"signal",props:{onBlur(){this.sendSignalOnOutput("onBlur")}}},hoverState:{displayName:"Hover",group:"States",type:"boolean",props:{onMouseOver(){this.outputPropValues.hoverState=!0,this.flagOutputDirty("hoverState"),this._updateVisualState()},onMouseLeave(){this.outputPropValues.hoverState=!1,this.flagOutputDirty("hoverState"),this._updateVisualState()}}},hoverStart:{displayName:"Hover Start",group:"Pointer Events",type:"signal",props:{onMouseOver(){this.sendSignalOnOutput("hoverStart")}}},hoverEnd:{displayName:"Hover End",group:"Pointer Events",type:"signal",props:{onMouseLeave(){this.sendSignalOnOutput("hoverEnd")}}},pressedState:{displayName:"Pressed",group:"States",type:"boolean",props:{onMouseDown(){this.outputPropValues.pressedState=!0,this.flagOutputDirty("pressedState"),this._updateVisualState()},onTouchStart(){this.outputPropValues.pressedState=!0,this.flagOutputDirty("pressedState"),this._updateVisualState()},onMouseUp(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this._updateVisualState()},onTouchEnd(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this._updateVisualState()},onTouchCancel(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this._updateVisualState()},onMouseLeave(){this.outputPropValues.pressedState=!1,this.flagOutputDirty("pressedState"),this._updateVisualState()}}},pointerDown:{displayName:"Pointer Down",group:"Pointer Events",type:"signal",props:{onMouseDown(){this.sendSignalOnOutput("pointerDown")},onTouchStart(){this.sendSignalOnOutput("pointerDown")}}},pointerUp:{displayName:"Pointer Up",group:"Pointer Events",type:"signal",props:{onMouseUp(){this.sendSignalOnOutput("pointerUp")},onTouchEnd(){this.sendSignalOnOutput("pointerUp")},onTouchCancel(){this.sendSignalOnOutput("pointerUp")}}}})}(e),function(e){ie(e,"outputs",{enabled:{type:"boolean",displayName:"Enabled",group:"States",getter:function(){return this._internal.enabled}}})}(e);const 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}},ae=function(e){return Object.assign({},{onFocus:e.onFocus,onBlur:e.onBlur},ne(e))};function le(e){let t={...e.style};function o(){const t={};return e.useLabel&&("left"===e.iconPlacement||void 0===e.iconPlacement?t.marginRight=e.iconSpacing:t.marginLeft=e.iconSpacing),"image"===e.iconSourceType&&void 0!==e.iconImageSource?(t.width=e.iconSize,t.height=e.iconSize,n().createElement("img",{alt:"",src:e.iconImageSource,style:t})):"icon"===e.iconSourceType&&void 0!==e.iconIconSource?(t.fontSize=e.iconSize,t.color=e.iconColor,!0===e.iconIconSource.codeAsClass?n().createElement("span",{className:[e.iconIconSource.class,e.iconIconSource.code].join(" "),style:t}):n().createElement("span",{className:e.iconIconSource.class,style:t},e.iconIconSource.code)):null}x.size(t,e),x.align(t,e),void 0!==e.textStyle&&(t=Object.assign({},e.textStyle,t),t.color=e.noodlNode.context.styles.resolveColor(t.color));let i="ndl-controls-button";e.className&&(i=i+" "+e.className);let s=null;return e.useLabel&&e.useIcon?s=n().createElement(n().Fragment,null,"left"===e.iconPlacement?o():null,String(e.label),"right"===e.iconPlacement?o():null):e.useLabel?s=String(e.label):e.useIcon&&(s=o()),n().createElement("button",{...e.attrs,className:i,disabled:!e.enabled,...ae(e),type:e.buttonType,style:t,onClick:e.onClick},s,e.children)}const de={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(){this.props.attrs={},this.props.layout="row"},getReactComponent:()=>le,inputs:{testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}},inputCss:{backgroundColor:{index:100,displayName:"Background Color",group:"Style",type:"color",default:"#000000",allowVisualStates:!0}},outputProps:{onClick:{displayName:"Click",group:"Events",type:"signal"}}};F.addDimensions(de,{defaultSizeMode:"contentSize",contentLabel:"Content"}),F.addTextStyleInputs(de),F.addAlignInputs(de),F.addTransformInputs(de),F.addPaddingInputs(de,{defaults:{paddingTop:5,paddingRight:20,paddingBottom:5,paddingLeft:20}}),F.addMarginInputs(de),F.addLabelInputs(de,{defaults:{useLabel:!0}}),F.addIconInputs(de,{enableIconPlacement:!0,defaults:{useIcon:!1}}),F.addSharedVisualInputs(de),F.addBorderInputs(de),F.addShadowInputs(de),re(de);const ue=Z(de);function ce(e){const[o,i]=(0,t.useState)(e.checked);(0,t.useEffect)((()=>{i(!!e.checked)}),[]),(0,t.useEffect)((()=>{i(!!e.checked)}),[e.checked]);const s={...e.style};"none"===e.parentLayout&&(s.position="absolute"),x.align(s,e);const r={...e.attrs,id:e.id,className:[e.className,"ndl-controls-checkbox-2"].join(" "),disabled:!e.enabled,style:{width:e.styles.checkbox.width,height:e.styles.checkbox.height}},a={display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,position:"relative",...e.styles.checkbox};e.useLabel||(Object.assign(r,ae(e)),Object.assign(a,s));const l=n().createElement("div",{className:"ndl-controls-pointer",style:a,"noodl-style-tag":"checkbox"},e.useIcon?function(){if("image"===e.iconSourceType&&void 0!==e.iconImageSource)return n().createElement("img",{alt:"",src:e.iconImageSource,style:{width:e.iconSize,height:e.iconSize,position:"absolute"}});if("icon"===e.iconSourceType&&void 0!==e.iconIconSource){const t={fontSize:e.iconSize,color:e.iconColor,position:"absolute"};return!0===e.iconIconSource.codeAsClass?n().createElement("span",{className:[e.iconIconSource.class,e.iconIconSource.code].join(" "),style:t}):n().createElement("span",{className:e.iconIconSource.class,style:t},e.iconIconSource.code)}return null}():null,n().createElement("input",{type:"checkbox",...r,checked:o,onChange:t=>{i(t.target.checked),e.checkedChanged&&e.checkedChanged(t.target.checked)}}));if(e.useLabel){const t={marginLeft:e.labelSpacing,...e.labeltextStyle,...e.styles.label};return e.enabled||(t.cursor="default"),t.color=e.noodlNode.context.styles.resolveColor(t.color),n().createElement("div",{style:{display:"flex",alignItems:"center",...s},...ae(e)},l,n().createElement("label",{className:"ndl-controls-pointer",style:t,htmlFor:e.id,"noodl-style-tag":"label"},e.label))}return l}const pe={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(){this.props.attrs={},this.props.sizeMode="explicit",this.props.id="input-"+(0,s.guid)(),this.props.checked=this._internal.checked=!1,this.props.checkedChanged=e=>{const t=this._internal.checked!==e;this._internal.checked=e,t&&(this.flagOutputDirty("checked"),this.sendSignalOnOutput("onChange"),this._updateVisualState())}},getReactComponent:()=>ce,inputs:{checked:{type:"boolean",displayName:"Checked",group:"General",default:!1,index:100,set:function(e){const t=(e=!!e)!==this._internal.checked;this.props.checked=this._internal.checked=e,t&&(this.forceUpdate(),this.flagOutputDirty("checked"),this._updateVisualState())}},check:{type:"signal",displayName:"Check",group:"Actions",valueChangedToTrue(){!0!==this._internal.checked&&(this.props.checked=this._internal.checked=!0,this.forceUpdate(),this.flagOutputDirty("checked"),this._updateVisualState())}},uncheck:{type:"signal",displayName:"Uncheck",group:"Actions",valueChangedToTrue(){!1!==this._internal.checked&&(this.props.checked=this._internal.checked=!1,this.forceUpdate(),this.flagOutputDirty("checked"),this._updateVisualState())}},testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}},inputCss:{backgroundColor:{index:201,displayName:"Background Color",group:"Style",type:"color",default:"transparent",applyDefault:!1,allowVisualStates:!0,styleTag:"checkbox"},width:{index:11,group:"Dimensions",displayName:"Width",type:{name:"number",units:["px","vw","vh"],defaultUnit:"px"},default:32,allowVisualStates:!0,styleTag:"checkbox"},height:{index:12,group:"Dimensions",displayName:"Height",type:{name:"number",units:["px","vw","vh"],defaultUnit:"px"},default:32,allowVisualStates:!0,styleTag:"checkbox"}},outputs:{checked:{type:"boolean",displayName:"Checked",group:"States",getter:function(){return this._internal.checked}},onChange:{displayName:"Changed",group:"Events",type:"signal"}}};F.addAlignInputs(pe),F.addTransformInputs(pe),F.addMarginInputs(pe),F.addPaddingInputs(pe),F.addIconInputs(pe),F.addLabelInputs(pe,{enableSpacing:!0,styleTag:"label"}),F.addSharedVisualInputs(pe),F.addBorderInputs(pe,{defaults:{borderStyle:"solid",borderWidth:2,borderColor:"#000000",borderRadius:3},styleTag:"checkbox"}),F.addShadowInputs(pe,{styleTag:"checkbox"}),re(pe,{checked:!0});const he=Z(pe);function me(e){const[o,i]=(0,t.useState)(e.value);(0,t.useEffect)((()=>{i(e.value),e.valueChanged(e.value)}),[e.value,e.items]);let s={...e.style};x.size(s,e),x.align(s,e),void 0!==e.textStyle&&(s=Object.assign({},e.textStyle,s),s.color=e.noodlNode.context.styles.resolveColor(s.color));const r=e.items&&void 0!==o?e.items.findIndex((e=>e.Value===o)):-1,{height:a,...l}=s;function d(){if("image"===e.iconSourceType&&void 0!==e.iconImageSource)return n().createElement("img",{alt:"",src:e.iconImageSource,style:{width:e.iconSize,height:e.iconSize}});if("icon"===e.iconSourceType&&void 0!==e.iconIconSource){const t={fontSize:e.iconSize,color:e.iconColor};return"left"===e.iconPlacement||void 0===e.iconPlacement?t.marginRight=e.iconSpacing:t.marginLeft=e.iconSpacing,!0===e.iconIconSource.codeAsClass?n().createElement("span",{className:[e.iconIconSource.class,e.iconIconSource.code].join(" "),style:t}):n().createElement("span",{className:e.iconIconSource.class,style:t},e.iconIconSource.code)}return null}const u={...e.attrs,id:e.id,className:e.className,style:{inset:0,opacity:0,position:"absolute",textTransform:"inherit",cursor:e.enabled?"":"default","-webkit-appearance":"none"},onClick:e.onClick},c={display:"flex",alignItems:"center",...e.styles.inputWrapper,cursor:e.enabled?"":"default"},p=a&&"%"===a[String(a).length-1];e.useLabel?p?c.flexGrow=1:c.height=a:(Object.assign(c,l),c.height=a);let h=[];e.items&&(h=e.items.map((e=>n().createElement("option",{key:e.Value,value:e.Value,disabled:"true"===e.Disabled||!0===e.Disabled||void 0},e.Label))));let m=null;r>=0&&r<e.items.length?m=n().createElement("span",null,e.items[r].Label):e.placeholder&&(m=n().createElement("span",{style:{opacity:e.placeholderOpacity}},e.placeholder));const g=n().createElement("div",{className:"ndl-controls-pointer",style:c,"noodl-style-tag":"inputWrapper"},e.useIcon&&"left"===e.iconPlacement?d():null,n().createElement("div",{style:{width:"100%",height:"100%",alignItems:"center",display:"flex"}},m),e.useIcon&&"right"===e.iconPlacement?d():null,n().createElement("select",{...u,disabled:!e.enabled,value:h.find((e=>e.props.value===o))?o:void 0,...ae(e),onChange:t=>{i(t.target.value),e.valueChanged&&e.valueChanged(t.target.value)}},n().createElement("option",{value:"",disabled:!0,selected:!0,hidden:!0}),h));if(e.useLabel){const t={...l,display:"flex",flexDirection:"column"};return p&&(t.height=a),n().createElement("div",{style:t},n().createElement("label",{htmlFor:e.id,style:{...e.labeltextStyle,...e.styles.label,marginBottom:e.labelSpacing},"noodl-style-tag":"label"},e.label),g)}return g}const ge={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(){this.props.attrs={},this._itemsChanged=()=>{this.forceUpdate()},this.props.id="input-"+(0,s.guid)(),this.props.valueChanged=e=>{const t=this._internal.value!==e;this._internal.value=e,t&&(this.flagOutputDirty("value"),this.sendSignalOnOutput("onChange"))}},getReactComponent:()=>me,inputs:{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,this.forceUpdate()}},value:{type:"string",displayName:"Value",group:"General",set:function(e){if(void 0!==e&&"string"!=typeof e){if(void 0===(null==e?void 0:e.toString))return;e=e.toString()}const t=e!==this._internal.value;this.props.value=this._internal.value=e,t&&(this.forceUpdate(),this.flagOutputDirty("value"))}},testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}},inputProps:{placeholder:{displayName:"Placeholder",type:"string",group:"Placeholder"},placeholderOpacity:{group:"Placeholder",displayName:"Placeholder opacity",type:"number",default:.5}},outputs:{value:{type:"string",displayName:"Value",group:"States",getter:function(){return this._internal.value}},onChange:{type:"signal",displayName:"Changed",group:"Events"}},inputCss:{backgroundColor:{index:100,displayName:"Background Color",group:"Style",type:"color",default:"transparent",styleTag:"inputWrapper",allowVisualStates:!0}}};F.addDimensions(ge,{defaultSizeMode:"contentSize",contentLabel:"Content"}),F.addAlignInputs(ge),F.addTextStyleInputs(ge),F.addTransformInputs(ge),F.addPaddingInputs(ge,{styleTag:"inputWrapper"}),F.addMarginInputs(ge),F.addIconInputs(ge,{enableIconPlacement:!0,defaults:{useIcon:!1,iconColor:"#000000"}}),F.addLabelInputs(ge,{enableSpacing:!0,styleTag:"label"}),F.addSharedVisualInputs(ge),F.addBorderInputs(ge,{defaults:{borderStyle:"solid",borderWidth:2,borderColor:"#000000",borderRadius:5},styleTag:"inputWrapper"}),F.addShadowInputs(ge,{styleTag:"inputWrapper"}),re(ge);const fe=Z(ge),ye=n().createContext({name:void 0,selected:void 0,checkedChanged:void 0});function ve(e){return e&&"%"===e[e.length-1]}function be(e){const o=(0,t.useContext)(ye),i={...e.style};"none"===e.parentLayout&&(i.position="absolute"),x.align(i,e),e.checkedChanged&&e.checkedChanged(!!o&&o.selected===e.value);const s={...e.attrs,id:e.id,disabled:!e.enabled,className:[e.className,"ndl-controls-radio-2"].join(" "),style:{width:e.styles.radio.width,height:e.styles.radio.height}},r={display:"flex",alignItems:"center",justifyContent:"center",position:"relative",flexShrink:0,...e.styles.radio};e.useLabel?ve(e.styles.radio.width)&&(delete r.width,r.flexGrow=1):(Object.assign(s,ae(e)),Object.assign(r,i));const a={left:e.fillSpacing,right:e.fillSpacing,top:e.fillSpacing,bottom:e.fillSpacing,backgroundColor:e.styles.fill.backgroundColor,borderRadius:"inherit",position:"absolute"},l=n().createElement("div",{className:"ndl-controls-pointer",style:r,"noodl-style-tag":"radio"},n().createElement("div",{style:a,"noodl-style-tag":"fill"}),e.useIcon?function(){if("image"===e.iconSourceType&&void 0!==e.iconImageSource)return n().createElement("img",{alt:"",src:e.iconImageSource,style:{width:e.iconSize,height:e.iconSize}});if("icon"===e.iconSourceType&&void 0!==e.iconIconSource){const t={fontSize:e.iconSize,color:e.iconColor};return!0===e.iconIconSource.codeAsClass?n().createElement("span",{className:["ndl-controls-abs-center",e.iconIconSource.class,e.iconIconSource.code].join(" "),style:t}):n().createElement("span",{className:["ndl-controls-abs-center",e.iconIconSource.class].join(" "),style:t},e.iconIconSource.code)}return null}():null,n().createElement("input",{type:"radio",name:o?o.name:void 0,...s,checked:!!o&&o.selected===e.value,onChange:t=>{o&&o.checkedChanged&&o.checkedChanged(e.value)}}));if(e.useLabel){const t={marginLeft:e.labelSpacing,...e.labeltextStyle,...e.styles.label,cursor:e.enabled?void 0:"default"};t.color=e.noodlNode.context.styles.resolveColor(t.color);const o={display:"flex",alignItems:"center",...i};return ve(e.styles.radio.width)&&(o.width=e.styles.radio.width),ve(e.styles.radio.height)&&(o.height=e.styles.radio.height),n().createElement("div",{style:o,...ae(e)},l,n().createElement("label",{className:"ndl-controls-pointer",style:t,htmlFor:e.id,"noodl-style-tag":"label"},e.label))}return l}const _e={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(){this.props.attrs={},this.props.sizeMode="explicit",this.props.id="input-"+(0,s.guid)(),this._internal.checked=!1,this.props.checkedChanged=e=>{const t=this._internal.checked!==e;this._internal.checked=e,t&&(this.flagOutputDirty("checked"),this._updateVisualState())},this.props.styles.fill={}},getReactComponent:()=>be,inputs:{fillColor:{index:19,displayName:"Fill Color",group:"Fill Style",type:"color",allowVisualStates:!0,styleTag:"fill",set(e){this.setStyle({backgroundColor:e},"fill")}},testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}},inputProps:{value:{type:"string",displayName:"Value",group:"General",index:100},fillSpacing:{displayName:"Fill Spacing",group:"Fill Style",type:{name:"number",units:["px","vw","vh"],defaultUnit:"px"},allowVisualStates:!0,default:2}},inputCss:{width:{index:11,group:"Dimensions",displayName:"Width",type:{name:"number",units:["px","%","vw","vh"],defaultUnit:"px"},default:32,allowVisualStates:!0,styleTag:"radio",onChange(){this.forceUpdate()}},height:{index:12,group:"Dimensions",displayName:"Height",type:{name:"number",units:["px","%"],defaultUnit:"px"},default:32,allowVisualStates:!0,styleTag:"radio",onChange(){this.forceUpdate()}},backgroundColor:{index:201,displayName:"Background Color",group:"Style",type:"color",allowVisualStates:!0,styleTag:"radio",default:"transparent",applyDefault:!1}},outputs:{checked:{type:"boolean",displayName:"Checked",group:"States",get(){return this._internal.checked}}}};F.addAlignInputs(_e),F.addTransformInputs(_e),F.addMarginInputs(_e),F.addPaddingInputs(_e),F.addIconInputs(_e),F.addLabelInputs(_e,{enableSpacing:!0,styleTag:"label"}),F.addSharedVisualInputs(_e),F.addBorderInputs(_e,{defaults:{borderStyle:"solid",borderWidth:2,borderRadius:16},styleTag:"radio"}),F.addShadowInputs(_e,{styleTag:"radio"}),re(_e,{checked:!0});const Se=Z(_e);function Ce(e){const[o,i]=(0,t.useState)(e.value),s={selected:o,name:e.name,checkedChanged:t=>{i(t),e.valueChanged&&e.valueChanged(t)}};(0,t.useEffect)((()=>{i(e.value)}),[e.value]);const r={...e.style};x.size(r,e),x.align(r,e);let a="ndl-controls-radiobuttongroup";return e.className&&(a=a+" "+e.className),n().createElement(ye.Provider,{value:s},n().createElement("div",{className:a,style:r},e.children))}const Ne=["row","row-reverse","column","column-reverse","inherit","initial","revert","unset"],Oe={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(){this.props.name="radio-"+(0,s.guid)(),this.props.valueChanged=e=>{const t=this._internal.value!==e;this._internal.value=e,this.props.value=e,t&&(this.forceUpdate(),this.flagOutputDirty("value"),this.sendSignalOnOutput("onChange"))}},getReactComponent:()=>Ce,defaultCss:{display:"flex",position:"relative",flexDirection:"column"},inputs:{flexDirection:{index:11,displayName:"Layout",group:"Layout",type:{name:"enum",enums:[{label:"Vertical",value:"column"},{label:"Horizontal",value:"row"}]},default:"column",set(e){this.props.layout=e,"none"!==e?this.setStyle({flexDirection:e}):this.removeStyle(["flexDirection"]),this.context.editorConnection&&("none"===e||Ne.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",set:function(e){if("string"!=typeof e&&void 0!==e.toString&&(e=e.toString()),"string"!=typeof e)return;const t=e!==this._internal.value;this.props.value=this._internal.value=e,t&&(this.forceUpdate(),this.flagOutputDirty("value"))}}},outputs:{value:{type:"string",displayName:"Value",group:"States",getter:function(){return this._internal.value}},onChange:{type:"signal",displayName:"Changed",group:"Events"}},inputProps:{},outputProps:{}};F.addDimensions(Oe,{defaultSizeMode:"contentSize",contentLabel:"Content"}),F.addAlignInputs(Oe),F.addTransformInputs(Oe),F.addMarginInputs(Oe),F.addPaddingInputs(Oe),F.addSharedVisualInputs(Oe);const Ie=Z(Oe);function we(e,t){return`.${e}::-webkit-slider-thumb {\n width: ${t.thumbWidth};\n}`}function Pe(e,t,n){function o(e,o){const i=`${t}Border${o}Color`,s=`${t}Border${o}Style`,r=n[`${t}Border${o}Width`]||n[`${t}BorderWidth`];void 0!==r&&(e[`border${o}Width`]=r);const a=e[i]=n[i]||n[`${t}BorderColor`];void 0!==a&&(e[`border${o}Color`]=a);const l=n[s]||n[`${t}BorderStyle`];void 0!==l&&(e[`border${o}Style`]=l)}o(e,"Top"),o(e,"Right"),o(e,"Bottom"),o(e,"Left")}function xe(e,t,n){const o=n[`${t}BorderRadius`],i=n[`${t}BorderTopLeftRadius`]||o,s=n[`${t}BorderTopRightRadius`]||o,r=n[`${t}BorderBottomRightRadius`]||o,a=n[`${t}BorderBottomLeftRadius`]||o;e.borderRadius=`${i} ${s} ${r} ${a}`}function Ee(e,t,n){if(!n[`${t}BoxShadowEnabled`])return;const o=n[`${t}BoxShadowInset`],i=n[`${t}BoxShadowOffsetX`],s=n[`${t}BoxShadowOffsetY`],r=n[`${t}BoxShadowBlurRadius`],a=n[`${t}BoxShadowSpreadRadius`],l=n[`${t}BoxShadowColor`];e.boxShadow=`${o?"inset ":""}${i} ${s} ${r} ${a} ${l}`}function Te(e){return e&&"x"===e[e.length-1]}function Ae(e){const[o,i]=(0,t.useState)(e.value);function s(t){i(t),e.updateOutputValue(t)}(0,t.useEffect)((()=>{s(e.value)}),[e.value]);const r={...e.style};x.size(r,e),x.align(r,e);const a="ndl-controls-range-"+e._nodeId;se(a,e,we);const l=`ndl-controls-range2 ${a} ${e.className?e.className:""} `,d={...e.attrs,id:e.id,style:{width:"100%",opacity:0},onClick:e.onClick,min:e.min,max:e.max};if(d.style=d.style||{},e.step&&(d.step=e.step),Te(e.thumbHeight))if(Te(e.trackHeight)){const t=Number(e.thumbHeight.slice(0,-2)),n=Number(e.trackHeight.slice(0,-2));d.style.height=Math.max(t,n)+"px"}else d.style.height=e.thumbHeight;else d.style.height=e.trackHeight;const u={display:"flex",alignItems:"center",...r},c=(o-e.min)/(e.max-e.min),p={position:"absolute",width:"100%",height:e.trackHeight,background:`linear-gradient(to right, ${e.trackActiveColor} 0%, ${e.trackActiveColor} ${100*c}%, ${e.trackColor} ${100*c}%, ${e.trackColor} 100%)`};Pe(p,"track",e),xe(p,"track",e),Ee(p,"track",e);const h={position:"absolute",left:"calc((100% - "+e.thumbWidth+") * "+c+")",width:e.thumbWidth,height:e.thumbHeight,backgroundColor:e.thumbColor};return Pe(h,"thumb",e),xe(h,"thumb",e),Ee(h,"thumb",e),n().createElement("div",{style:u},n().createElement("div",{style:p}),n().createElement("div",{style:h}),n().createElement("input",{className:l,...ae(e),type:"range",...d,value:o,disabled:!e.enabled,onChange:e=>s(Number(e.target.value))}))}const ke={group:"thumb-styles",label:"Thumb Styles"},De={group:"track-styles",label:"Track Styles"},Re={name:"net.noodl.controls.range",displayNodeName:"Slider",category:"Controls",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(){this.props.attrs={},this.props.sizeMode="contentHeight",this.props.id="input-"+(0,s.guid)(),this.props.value=this.props.min,this._internal.outputValue=0,this.props._nodeId=this.id,this.props.updateOutputValue=e=>{e="string"==typeof e?parseFloat(e):e,this._internal.outputValue!==e&&(this._internal.outputValue=e,this.flagOutputDirty("value"),this._updateOutputValuePercent(e),this.sendSignalOnOutput("onChange")),this._internal.valuePercent||this._updateOutputValuePercent(e)},this.props.updateOutputValue(this.props.value)},getReactComponent:()=>Ae,inputs:{value:{type:"string",displayName:"Value",group:"General",index:100,set(e){this._setInputValue(e)}},testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}},outputs:{value:{type:"number",displayName:"Value",group:"States",get(){return this._internal.outputValue}},valuePercent:{type:"number",displayName:"Value Percent",group:"States",get(){return this._internal.valuePercent}},onChange:{type:"signal",displayName:"Changed",group:"Events"}},inputProps:{min:{type:"number",displayName:"Min",group:"General",default:0,index:100,onChange(){this._setInputValue(this.props.value)}},max:{type:"number",displayName:"Max",group:"General",default:100,index:100,onChange(){this._setInputValue(this.props.value)}},step:{type:"number",displayName:"Step",group:"General",default:1,index:100},width:{index:11,group:"Dimensions",displayName:"Width",type:{name:"number",units:["%","px","vw"],defaultUnit:"%"},default:100,allowVisualStates:!0},thumbWidth:{group:"Thumb Style",displayName:"Width",type:{name:"number",units:["px","vw","%"],defaultUnit:"px",allowEditOnly:!0},default:16,popout:ke,allowVisualStates:!0},thumbHeight:{group:"Thumb Style",displayName:"Height",type:{name:"number",units:["px","vh","%"],defaultUnit:"px",allowEditOnly:!0},default:16,popout:ke,allowVisualStates:!0},thumbColor:{group:"Thumb Style",displayName:"Color",type:{name:"color",allowEditOnly:!0},default:"#000000",popout:ke,allowVisualStates:!0},trackHeight:{group:"Track Style",displayName:"Height",type:{name:"number",units:["px","vh","%"],defaultUnit:"px",allowEditOnly:!0},default:6,popout:De,allowVisualStates:!0},trackColor:{group:"Track Style",displayName:"Inactive Color",type:{name:"color",allowEditOnly:!0},default:"#f0f0f0",popout:De,allowVisualStates:!0},trackActiveColor:{group:"Track Style",displayName:"Active Color",type:{name:"color",allowEditOnly:!0},default:"#f0f0f0",popout:De,allowVisualStates:!0}},methods:{_updateOutputValuePercent(e){const t=this.props.min,n=this.props.max,o=Math.floor((e-t)/(n-t)*100),i=this._internal.valuePercentChanged!==o;this._internal.valuePercent=o,i&&this.flagOutputDirty("valuePercent")},_setInputValue(e){const t=Math.max(this.props.min,Math.min(this.props.max,e||0));t!==this.props.value&&(this.props.value=t,this.forceUpdate())}}};function Me(e,t){const n=(t=t||{}).defaults||{},o=t.popout;n.borderStyle="none",n.borderWidth=0,n.borderColor="#000000";const i=t.propPrefix[0].toUpperCase()+t.propPrefix.slice(1);function s(e,s,r,a){const l=t.propPrefix+`Border${s}Style`,d=t.propPrefix+`Border${s}Width`,u=t.propPrefix+`Border${s}Color`;let c="none"!==n.borderStyle?"OR borderStyle NOT SET":"";s?(n[l]&&"none"!==n[l]&&(c+=`OR ${l} NOT SET`),F.addDynamicInputPorts(e,`${l} = solid OR ${l} = dashed OR ${l} = dotted OR borderStyle = solid OR borderStyle = dashed OR borderStyle = dotted ${c}`,[`${d}`,`${u}`])):F.addDynamicInputPorts(e,`${l} = solid OR ${l} = dashed OR ${l} = dotted ${c}`,[`${d}`,`${u}`]);const p={group:t.propPrefix+"-border-styles",tab:r,label:s},h=e=>`${i} ${e} ${s?"("+s+")":""}`,m=202+4*a,g=i+" Border Style";F.addInputProps(e,{[l]:{index:m+1,displayName:"Border Style",editorName:h("Border Style"),group:g,type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Solid",value:"solid"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"}]},default:n[`border${s}Style`],tab:p,popout:o,allowVisualStates:!0},[d]:{index:m+2,displayName:"Border Width",editorName:h("Border Width"),group:g,type:{name:"number",units:["px"],defaultUnit:"px"},default:n[`border${s}Width`],tab:p,popout:o,allowVisualStates:!0},[u]:{index:m+3,displayName:"Border Color",editorName:h("Border Color"),group:g,type:"color",default:n[`border${s}Color`],tab:p,popout:o,allowVisualStates:!0}})}s(e,"","borders-all",0),s(e,"Left","borders-left",1),s(e,"Top","borders-top",2),s(e,"Right","borders-right",3),s(e,"Bottom","borders-bottom",4)}function Ve(e,t){const n=(t=t||{}).defaults||{},o=t.popout;n.borderRadius||(n.borderRadius=0);const i=t.propPrefix[0].toUpperCase()+t.propPrefix.slice(1);function s(e,s,r,a){const l={group:t.propPrefix+"-corners",tab:r,label:s},d=`Border${s}Radius`;F.addInputProps(e,{[t.propPrefix+d]:{index:240+a,displayName:"Corner Radius",editorName:`${i} Corner Radius ${s?"("+s+")":""}`,group:i+" Corner Radius",type:{name:"number",units:["px","%"],defaultUnit:"px"},default:n[`border${s}Radius`],tab:l,popout:o}})}s(e,"","corners-all",0),s(e,"TopLeft","corners-top-left",1),s(e,"TopRight","corners-top-right",2),s(e,"BottomRight","corners-bottom-right",3),s(e,"BottomLeft","corners-bottom-left",4)}function je(e,t){const n=(t=t||{}).popout,o=t.propPrefix;F.addDynamicInputPorts(e,`${o}BoxShadowEnabled = true`,[`${o}BoxShadowOffsetX`,`${o}BoxShadowOffsetY`,`${o}BoxShadowInset`,`${o}BoxShadowBlurRadius`,`${o}BoxShadowSpreadRadius`,`${o}BoxShadowColor`]);const i=t.propPrefix[0].toUpperCase()+t.propPrefix.slice(1),s=e=>`${i} ${e}`;F.addInputProps(e,{[`${o}BoxShadowEnabled`]:{index:250,group:t.group||"Box Shadow",displayName:"Shadow Enabled",editorName:s("Shadow Enabled"),type:"boolean",allowVisualStates:!0,popout:n},[`${o}BoxShadowOffsetX`]:{index:251,group:t.group||"Box Shadow",displayName:"Offset X",editorName:s("Offset X"),default:0,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,popout:n},[`${o}BoxShadowOffsetY`]:{index:252,group:t.group||"Box Shadow",displayName:"Offset Y",editorName:s("Offset Y"),default:0,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,popout:n},[`${o}BoxShadowBlurRadius`]:{index:253,group:t.group||"Box Shadow",displayName:"Blur Radius",editorName:s("Blur Radius"),default:5,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,popout:n},[`${o}BoxShadowSpreadRadius`]:{index:254,group:t.group||"Box Shadow",displayName:"Spread Radius",editorName:s("Spread Radius"),default:2,type:{name:"number",units:["px"],defaultUnit:"px"},allowVisualStates:!0,popout:n},[`${o}BoxShadowInset`]:{index:255,group:t.group||"Box Shadow",displayName:"Inset",editorName:s("Inset"),type:"boolean",default:!1,allowVisualStates:!0,popout:n},[`${o}BoxShadowColor`]:{index:256,group:t.group||"Box Shadow",displayName:"Shadow Color",editorName:s("Shadow Color"),type:"color",default:"#00000033",allowVisualStates:!0,popout:n}})}F.addAlignInputs(Re),F.addTransformInputs(Re),F.addMarginInputs(Re),F.addPaddingInputs(Re),F.addSharedVisualInputs(Re),Me(Re,{propPrefix:"track",popout:De}),Ve(Re,{propPrefix:"track",popout:De}),je(Re,{propPrefix:"track",popout:De,group:"Track Box Shadow"}),Me(Re,{propPrefix:"thumb",popout:ke}),Ve(Re,{propPrefix:"thumb",popout:ke}),je(Re,{propPrefix:"thumb",popout:ke,group:"Thumb Box Shadow"}),re(Re);const Fe=Z(Re);function Ue(e){e.stopPropagation(),window.removeEventListener("click",Ue,!0)}class We extends n().Component{constructor(e){super(e),this.state={value:e.startValue},this.ref=n().createRef()}setText(e){this.setState({value:e}),this.props.onTextChanged&&this.props.onTextChanged(e)}componentDidMount(){this.ref.current&&(this.ref.current.noodlNode=this.props.noodlNode),this.setText(this.props.startValue)}render(){const e={...this.props.style};x.size(e,this.props),x.align(e,this.props),0===e.opacity&&(e.pointerEvents="none");const{height:t,...o}=e,i=o,s=this.props,r=()=>{if("image"===s.iconSourceType&&void 0!==s.iconImageSource)return n().createElement("img",{alt:"",src:s.iconImageSource,style:{width:s.iconSize,height:s.iconSize},onClick:()=>this.focus()});if("icon"===s.iconSourceType&&void 0!==s.iconIconSource){const e={userSelect:"none",fontSize:s.iconSize,color:s.iconColor};return"left"===s.iconPlacement||void 0===s.iconPlacement?e.marginRight=s.iconSpacing:e.marginLeft=s.iconSpacing,!0===s.iconIconSource.codeAsClass?n().createElement("span",{className:[s.iconIconSource.class,s.iconIconSource.code].join(" "),style:e}):n().createElement("span",{className:s.iconIconSource.class,style:e},s.iconIconSource.code)}return null};let a,l="ndl-controls-textinput "+s.id;s.className&&(l=l+" "+s.className);const d={...s.textStyle,...s.styles.input,width:"100%",height:"100%"};d.color=s.noodlNode.context.styles.resolveColor(d.color);const u={...s.attrs,id:s.id,value:this.state.value,...ae(s),disabled:!s.enabled,style:d,className:l,placeholder:s.placeholder,maxLength:s.maxLength,onChange:e=>this.onChange(e)};"textArea"!==s.type?a=n().createElement("input",{ref:e=>this.ref.current=e,type:this.props.type,...u,onKeyDown:e=>this.onKeyDown(e),onMouseDown:()=>window.addEventListener("click",Ue,!0),"noodl-style-tag":"input"}):(u.style.resize="none",a=n().createElement("textarea",{ref:e=>this.ref.current=e,...u,onKeyDown:e=>this.onKeyDown(e),"noodl-style-tag":"input"}));const c={display:"flex",alignItems:"center",...s.styles.inputWrapper},p=t&&"%"===t[String(t).length-1];s.useLabel?p?c.flexGrow=1:c.height=t:(Object.assign(c,i),c.height=t),"textArea"!==s.type&&(c.alignItems="center");const h=n().createElement("div",{style:c,"noodl-style-tag":"inputWrapper"},s.useIcon&&"left"===s.iconPlacement?r():null,a,s.useIcon&&"right"===s.iconPlacement?r():null);if(s.useLabel){i.display="flex",i.flexDirection="column",p&&(i.height=t);const e={...s.labeltextStyle,...s.styles.label,marginBottom:s.labelSpacing};return e.color=s.noodlNode.context.styles.resolveColor(e.color),n().createElement("div",{style:i},n().createElement("label",{htmlFor:s.id,style:e,"noodl-style-tag":"label"},s.label),h)}return h}onKeyDown(e){"Enter"!==e.key&&13!==e.which||this.props.onEnter&&this.props.onEnter()}onChange(e){const t=e.target.value;this.setText(t)}focus(){this.ref.current&&this.ref.current.focus()}blur(){this.ref.current&&this.ref.current.blur()}hasFocus(){return document.activeElement===this.ref.current}}function Le(e,t){return`\n .${e}::placeholder {\n opacity: ${t.placeholderOpacity};\n }\n `}const Be={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"]},getReactComponent:()=>We,initialize(){this.props.attrs={},this.props.startValue="",this.props.id=this._internal.controlId="input-"+(0,s.guid)()},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 here...",type:{name:"string"}},maxLength:{group:"Text",displayName:"Max length",type:"number",index:24}},inputs:{placeHolderOpacity:{index:23,group:"Text",displayName:"Placeholder opacity",type:"number",default:.5,set(e){const t=this._internal.controlId;se(t,{placeholderOpacity:e},Le)}},set:{group:"Actions",displayName:"Set",type:"signal",valueChangedToTrue(){this.scheduleAfterInputsHaveUpdated((()=>{this.setText(this._internal.text)}))}},startValue:{index:18,displayName:"Text",type:"string",group:"Text",set(e){this._internal.text!==e&&(this._internal.text=e,!1===this.isInputConnected("set")&&this.setText(e))}},clear:{type:"signal",group:"Actions",displayName:"Clear",valueChangedToTrue(){this.clear()}},focus:{type:"signal",group:"Actions",displayName:"Focus",valueChangedToTrue(){this.context.setNodeFocused(this,!0)}},blur:{type:"signal",group:"Actions",displayName:"Blur",valueChangedToTrue(){this.context.setNodeFocused(this,!1)}},textAlignX:{group:"Text Alignment",index:13,displayName:"Text Horizontal Align",type:{name:"enum",enums:[{label:"left",value:"left"},{label:"center",value:"center"},{label:"right",value:"right"}],alignComp:"justify"},default:"left",set(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")}}},testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}},inputCss:{backgroundColor:{index:100,displayName:"Background Color",group:"Style",type:"color",default:"transparent",allowVisualStates:!0,styleTag:"inputWrapper"}},outputProps:{onTextChanged:{group:"General",displayName:"Text",type:"string",index:1,onChange(){this.sendSignalOnOutput("textChanged")}},onEnter:{group:"Events",displayName:"On Enter",type:"signal"}},outputs:{textChanged:{displayName:"Text Changed",type:"signal",group:"General",index:2}},methods:{_focus(){this.innerReactComponentRef&&this.innerReactComponentRef.focus()},_blur(){this.innerReactComponentRef&&this.innerReactComponentRef.blur()},clear(){this.props.startValue="",this.innerReactComponentRef&&this.innerReactComponentRef.setText("")},setText(e){this.props.startValue=e,this.innerReactComponentRef?!1===this.innerReactComponentRef.hasFocus()&&this.innerReactComponentRef.setText(e):this.outputPropValues.onTextChanged!==e&&(this.outputPropValues.onTextChanged=e,this.flagOutputDirty("onTextChanged"))}}};F.addDimensions(Be,{defaultSizeMode:"contentSize",contentLabel:"Text"}),F.addIconInputs(Be,{enableIconPlacement:!0,defaults:{useIcon:!1,iconColor:"#000000"}}),F.addLabelInputs(Be,{enableSpacing:!0,styleTag:"label",displayName:"Label"}),F.addTextStyleInputs(Be,{styleTag:"input",portPrefix:"",portIndex:18,popout:{group:"input-text-style",label:"Text Style",parentGroup:"Text"}}),F.addAlignInputs(Be),F.addTransformInputs(Be),F.addPaddingInputs(Be,{styleTag:"inputWrapper"}),F.addMarginInputs(Be),F.addSharedVisualInputs(Be),F.addBorderInputs(Be,{styleTag:"inputWrapper"}),F.addShadowInputs(Be,{styleTag:"inputWrapper"}),re(Be);const $e=Z(Be);class qe{constructor(){this.queue=[],this.workingOnPromise=!1}enqueue(e){return new Promise(((t,n)=>{this.queue.push({promise:e,resolve:t,reject:n}),this.dequeue()}))}dequeue(){if(this.workingOnPromise)return!1;const e=this.queue.shift();if(!e)return!1;try{this.workingOnPromise=!0,e.promise().then((t=>{this.workingOnPromise=!1,e.resolve(t),this.dequeue()})).catch((t=>{this.workingOnPromise=!1,e.reject(t),this.dequeue()}))}catch(t){this.workingOnPromise=!1,e.reject(t),this.dequeue()}return!0}}var ze=__webpack_require__(7410),He=__webpack_require__(5573);const Ge=e=>{const{didMount:o,willUnmount:i,style:s,children:r}=e;return(0,t.useEffect)((()=>(o(),()=>{i()})),[o,i]),n().createElement("div",{style:s},r)},Xe={name:"Page Stack",displayNodeName:"Component Stack",category:"Visuals",docs:"https://docs.noodl.net/nodes/component-stack/component-stack-node",useVariants:!1,initialize(){this._internal.stack=[],this._internal.topPageName="",this._internal.stackDepth=0,this._internal.pageInfo={},this._internal.asyncQueue=new qe,this.onScheduleReset=()=>{this.scheduleReset()},this.props.didMount=()=>{this._internal.isMounted=!0,window.history&&window.history.pushState?window.addEventListener("popstate",this.onScheduleReset):window.addEventListener("hashchange",this.onScheduleReset),this._registerPageStack()},this.props.willUnmount=()=>{this._internal.isMounted=!1,window.removeEventListener("popstate",this.onScheduleReset),window.removeEventListener("hashchange",this.onScheduleReset),this._deregisterPageStack()}},getInspectInfo(){return 0===this._internal.stack.length?"No active page":[{type:"text",value:"Active Components:"}].concat(this._internal.stack.map((e=>({type:"text",value:"- "+this._findPage(e.pageId).label}))))},defaultCss:{width:"100%",flex:"1 1 100%",position:"relative",display:"flex",flexDirection:"column"},getReactComponent:()=>Ge,inputs:{name:{type:{name:"string",identifierOf:"PackStack"},displayName:"Name",group:"General",default:"Main",set(e){this._deregisterPageStack(),this._internal.name=e,this._internal.isMounted&&this._registerPageStack()}},useRoutes:{type:"boolean",displayName:"Use Routes",group:"General",default:!1,set(e){this._internal.useRoutes=!!e}},clip:{displayName:"Clip Content",type:"boolean",group:"Layout",default:!0,set(e){e?this.setStyle({overflow:"hidden"}):this.removeStyle(["overflow"])}},pages:{type:"proplist",displayName:"Components",group:"Components",set(e){this._internal.pages=e,this._internal.isMounted&&this.scheduleReset()}},reset:{type:"signal",displayName:"Reset",group:"Actions",valueChangedToTrue(){this.scheduleReset()}}},inputCss:{backgroundColor:{type:"color",displayName:"Background Color",group:"Style",default:"transparent",applyDefault:!1}},outputs:{topPageName:{type:"string",displayName:"Top Component Name",group:"General",get(){return this._internal.topPageName}},stackDepth:{type:"number",displayName:"Stack Depth",group:"General",get(){return this._internal.stackDepth}}},methods:{_registerPageStack(){ze.A.instance.registerPageStack(this._internal.name,this)},_deregisterPageStack(){ze.A.instance.deregisterPageStack(this._internal.name,this)},_findPage(e){if(this._internal.pageInfo[e]){const t=this._internal.pageInfo[e],n=this._internal.pages.find((t=>t.id===e));return{component:String(t.component),label:String(n.label),id:String(e)}}const t=this._internal.pages.find((t=>t.label===e));if(t){const e=this._internal.pageInfo[t.id];return{component:String(e.component),label:String(t.label),id:String(t.id)}}},setPageOutputs(e){for(const t in e)this._internal[t]=e[t],this.flagOutputDirty(t)},scheduleReset(){const e=this._internal;e.hasScheduledReset||(e.hasScheduledReset=!0,this.scheduleAfterInputsHaveUpdated((()=>{e.hasScheduledReset=!1,this.reset()})))},createPageContainer(){const e=this.nodeScope.createPrimitiveNode("Group");return e.setStyle({flex:"1 0 100%"}),e},reset(){this._internal.asyncQueue.enqueue(this.resetAsync.bind(this))},async resetAsync(){const e=this.getChildren();for(const t of e)this.removeChild(t),this.nodeScope.deleteNode(t);if(void 0===this._internal.pages||0===this._internal.pages.length)return;let t,n={};const o=this.matchPageFromUrl();void 0!==o?(t=o.pageId,n={...o.query,...o.params}):(t=this._internal.startPageId,void 0===t&&(t=this._internal.pages[0].id));const i=this._findPage(t);if(void 0===i||void 0===i.component)return;const r=await this.nodeScope.createNode(i.component,(0,s.guid)());for(const e in n)r.setInputValue(e,n[e]);const a=this.createPageContainer();a.addChild(r),this.addChild(a),this._internal.stack=[{from:null,page:a,pageId:t,pageInfo:i,params:n,componentName:this._internal.startPage}],this.setPageOutputs({topPageName:i.label,stackDepth:this._internal.stack.length})},getRelativeURL(){const e=this._internal.stack[this._internal.stack.length-1];if(void 0===e)return;let t=e.pageInfo.path;if(void 0===t){const n=this._internal.pages.find((t=>t.id==e.pageId));if(void 0===n)return;t=n.label.replace(/\s+/g,"-").toLowerCase()}const n=t.match(/{([^}]+)}/g),o={...e.params};if(n)for(const i of n){const n=i.replace(/[{}]/g,"");void 0!==e.params[n]&&(t=t.replace(i,encodeURIComponent(o[n])),delete o[n])}const i=Object.keys(o).map((e=>({name:e,value:o[e]})));return t.startsWith("/")&&(t=t.substring(1)),{path:t,query:i}},getNavigationAbsoluteURL(){let e=this.parent;for(;void 0!==e&&"function"!=typeof e.getNavigationAbsoluteURL;)e=e.getVisualParentNode();const t=void 0===e?{path:"",query:[]}:e.getNavigationAbsoluteURL(),n=this.getRelativeURL();return void 0===n?t:{path:t.path+(t.path.endsWith("/")?"":"/")+n.path,query:t.query.concat(n.query)}},_getLocationPath(){const e=s.default.instance.getProjectSettings().navigationPathType;if(void 0===e||"hash"===e){let e=location.hash;return e&&("#"===e[0]&&(e=e.substring(1)),"/"===e[0]&&(e=e.substring(1))),e}{let e=location.pathname;return e&&"/"===e[0]&&(e=e.substring(1)),e}},_getSearchParams(){const e=/\+/g,t=/([^&=]+)=?([^&]*)/g,n=t=>decodeURIComponent(t.replace(e," ")),o=window.location.search.substring(1);let i;const s={};for(;i=t.exec(o);)s[n(i[1])]=n(i[2]);return s},getNavigationRemainingPath(){return this._internal.remainingNavigationPath},matchPageFromUrl(e){if(!this._internal.useRoutes)return;if(void 0===this._internal.pages||0===this._internal.pages.length)return;let t=this.parent;for(;void 0!==t&&"function"!=typeof t.getNavigationRemainingPath;)t=t.getVisualParentNode();const n=void 0===t?this._getLocationPath().split("/").filter(Boolean):t.getNavigationRemainingPath();if(void 0===n)return;const o=this._getSearchParams(),i=(e,t)=>{const n={};for(let o=0;o<t.length;o++){if(void 0===e[o])return;const i=t[o];if("{"===i[0]&&"}"===i[i.length-1])n[i.substring(1,i.length-1)]=decodeURIComponent(e[o]);else if(i!==e[o])return}return{params:n,remainingPathParts:e.splice(t.length)}};for(const e of this._internal.pages){const t=this._internal.pageInfo[e.id];if(void 0===t)continue;let s=t.path;void 0===s&&(s=e.label.replace(/\s+/g,"-").toLowerCase()),"/"===s[0]&&(s=s.substring(1));const r=i(n,s.split("/"));if(r)return this._internal.remainingNavigationPath=r.remainingPathParts,{pageId:e.id,params:r.params,query:o}}},_updateUrlWithTopPage(){if(this._internal.useRoutes&&void 0!==window.history){const e=this.getNavigationAbsoluteURL();let t,n;const o=s.default.instance.getProjectSettings().navigationPathType;void 0===o||"hash"===o?n=e.path:t=e.path;const i=e.query.map((e=>`${e.name}=${e.value}`)),r=(void 0!==t?t:"")+(i.length>=1?"?"+i.join("&"):"")+(void 0!==n?"#"+n:"");this._internal.remainingNavigationPath=void 0,window.history.pushState({},"",r)}},replace(e){this._internal.asyncQueue.enqueue(this.replaceAsync.bind(this,e))},async replaceAsync(e){if(void 0===this._internal.pages||0===this._internal.pages.length)return;if(this._internal.isTransitioning)return;const t=e.target||this._internal.pages[0].id,n=this._findPage(t);if(void 0===n||void 0===n.component)return;const o=this.getChildren();for(const e of o)this.removeChild(e),this.nodeScope.deleteNode(e);const i=this.createPageContainer(),r=await this.nodeScope.createNode(n.component,(0,s.guid)());for(const t in e.params)r.setInputValue(t,e.params[t]);i.addChild(r),this.addChild(i),this._internal.stack=[{from:null,page:i,pageId:t,pageInfo:n,params:e.params,componentName:e.target}],this.setPageOutputs({topPageName:n.label,stackDepth:this._internal.stack.length}),this._updateUrlWithTopPage(),e.hasNavigated&&e.hasNavigated()},navigate(e){this._internal.asyncQueue.enqueue(this.navigateAsync.bind(this,e))},async navigateAsync(e){if(void 0===this._internal.pages||0===this._internal.pages.length)return;if(this._internal.isTransitioning)return;const t=e.target||this._internal.pages[0].id,n=this._findPage(t);if(void 0===n||void 0===n.component)return;const o=this.createPageContainer();o.setInputValue("position","absolute");const i=await this.nodeScope.createNode(n.component,(0,s.guid)());for(const t in e.params)i.setInputValue(t,e.params[t]);o.addChild(i);const r=i.nodeScope.getNodesWithType("PageStackNavigateBack");if(r&&r.length>0)for(const e of r)e._setBackCallback(this.back.bind(this));const a=this._internal.stack[this._internal.stack.length-1],l={from:a.page,page:o,pageInfo:n,pageId:t,params:e.params,transition:new He.x[e.transition.type||"Push"](a.page,o,e.transition),backCallback:e.backCallback,componentName:e.target};this._internal.stack.push(l),this.setPageOutputs({topPageName:n.label,stackDepth:this._internal.stack.length}),this._updateUrlWithTopPage(),l.transition.forward(0),this._internal.isTransitioning=!0,l.transition.start({end:()=>{this._internal.isTransitioning=!1,this.removeChild(a.page),o.setInputValue("position","relative")}}),this.addChild(o),e.hasNavigated&&e.hasNavigated()},back(e){if(this._internal.stack.length<=1)return;if(this._internal.isTransitioning)return;const t=this._internal.stack[this._internal.stack.length-1];t.page.setInputValue("position","absolute"),this.addChild(t.from,0),t.backCallback&&t.backCallback(e.backAction,e.results);const n=this._findPage(this._internal.stack[this._internal.stack.length-2].pageId);this.setPageOutputs({topPageName:n.label,stackDepth:this._internal.stack.length-1}),this._internal.isTransitioning=!0,t.transition.start({end:()=>{this._internal.isTransitioning=!1,t.page.setInputValue("position","relative"),this.removeChild(t.page),this.nodeScope.deleteNode(t.page),this._internal.stack.pop(),this._updateUrlWithTopPage()},back:!0})},setPageComponent(e,t){const n=this._internal;n.pageInfo[e]||(n.pageInfo[e]={}),n.pageInfo[e].component=t},setPagePath(e,t){const n=this._internal;n.pageInfo[e]||(n.pageInfo[e]={}),n.pageInfo[e].path=t},setStartPage(e){this._internal.startPageId=e},registerInputIfNeeded(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(e,t){function n(t){function n(){const n=[];void 0!==t.parameters.pages&&t.parameters.pages.length>0&&(t.parameters.pages.forEach((e=>{n.push({name:"pageComp-"+e.id,displayName:"Component",editorName:e.label+" | Component",plug:"input",type:"component",parent:"pages",parentItemId:e.id}),!0===t.parameters.useRoutes&&n.push({name:"pagePath-"+e.id,displayName:"Path",editorName:e.label+" | Path",plug:"input",type:"string",default:e.label.replace(/\s+/g,"-").toLowerCase(),parent:"pages",parentItemId:e.id})})),n.push({plug:"input",type:{name:"enum",enums:t.parameters.pages.map((e=>({label:e.label,value:e.id}))),allowEditOnly:!0},group:"General",displayName:"Start Page",name:"startPage",default:t.parameters.pages[0].id})),e.editorConnection.sendDynamicPorts(t.id,n)}n(),t.on("parameterUpdated",(function(e){"pages"!==e.name&&"useRoutes"!==e.name||n()}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.Page Stack",(function(e){n(e)}));for(const e of t.getNodesWithType("Page Stack"))n(e)}))}},Ye=Z(Xe),Je={group:"seo-og",label:"Open Graph",parentGroup:"Experimental SEO"},Ke={group:"seo-twitter",label:"Twitter",parentGroup:"Experimental SEO"},Qe=[{isProperty:!0,key:"description",displayName:"Description",group:"Experimental SEO"},{isProperty:!0,key:"robots",displayName:"Robots",group:"Experimental SEO"},{isProperty:!0,key:"og:title",displayName:"Title",editorName:"OG Title",group:"General",popout:Je},{isProperty:!0,key:"og:description",displayName:"Description",editorName:"OG Description",group:"General",popout:Je},{isProperty:!0,key:"og:url",displayName:"Url",editorName:"OG Url",group:"General",popout:Je},{isProperty:!0,key:"og:type",displayName:"Type",editorName:"OG Type",group:"General",popout:Je},{isProperty:!0,key:"og:image",displayName:"Image",editorName:"OG Image",group:"Image",popout:Je},{isProperty:!0,key:"og:image:width",displayName:"Image Width",editorName:"OG Image Width",group:"Image",popout:Je},{isProperty:!0,key:"og:image:height",displayName:"Image Height",editorName:"OG Image Height",group:"Image",popout:Je},{isProperty:!1,key:"twitter:card",displayName:"Card",editorName:"Twitter Card",group:"General",popout:Ke},{isProperty:!1,key:"twitter:title",displayName:"Title",editorName:"Twitter Title",group:"General",popout:Ke},{isProperty:!1,key:"twitter:description",displayName:"Description",editorName:"Twitter Description",group:"General",popout:Ke},{isProperty:!1,key:"twitter:image",displayName:"Image",editorName:"Twitter Image",group:"General",popout:Ke}];function Ze(e){const{style:t,children:o}=e;return x.size(t,e),x.align(t,e),Qe.forEach((t=>{const n=e.metatags&&e.metatags[t.key];Noodl.SEO.setMeta(t.key,n)})),n().createElement("div",{style:t,className:e.className},o)}const et={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(){this.props.layout="column",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:()=>Ze,inputs:{sitemapIncluded:{index:80001,displayName:"Included",group:"Experimental Sitemap",default:!0,type:{name:"boolean",allowEditOnly:!0}},sitemapChangefreq:{index:80002,displayName:"Change Freq",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",group:"Experimental Sitemap",default:.5,type:{name:"number",allowEditOnly:!0}}},inputProps:Qe.reduce(((e,t,n)=>(e[t.key]={index:8e4+n,displayName:t.displayName,editorName:t.editorName||t.displayName,propPath:"metatags",group:t.group,popout:t.popout,type:t.type||"string"},e)),{}),methods:{getUrlPath(){return this._internal.urlPath},getTitle(){return this._internal.title},setTitle(e){this._internal.title=e},setUrlPath(e){this._internal.urlPath=e},registerInputIfNeeded(e){if(!this.hasInput(e))return"title"===e?this.registerInput(e,{set:this.setTitle.bind(this)}):"urlPath"===e?this.registerInput(e,{set:this.setUrlPath.bind(this)}):void 0}},setup(e,t){function n(t){function n(){const n=[],o=t.component.name.split("/");n.push({name:"title",displayName:"Title",type:"string",group:"General",plug:"input",default:o[o.length-1]});const i=(t.parameters.title||o[o.length-1]).replace(/\s+/g,"-").toLowerCase();n.push({name:"urlPath",displayName:"Url Path",type:"string",group:"General",plug:"input",default:i}),e.editorConnection.sendDynamicPorts(t.id,n)}n(),t.on("parameterUpdated",(function(e){"title"===e.name&&n()}))}e.editorConnection&&e.editorConnection.isRunningLocally()&&t.on("editorImportComplete",(()=>{t.on("nodeAdded.Page",(function(e){n(e)})),t.on("componentRenamed",(function(e){const o=t.getNodesWithType("Page").filter((t=>e.roots.includes(t.id)));o.length>0&&n(o[0])}));for(const e of t.getNodesWithType("Page"))n(e)}))}};F.addPaddingInputs(et);const tt=Z(et);function nt(e){const{didMount:o,willUnmount:i,children:s,style:r}=e;return(0,t.useEffect)((()=>(o(),()=>{i()})),[]),n().createElement("div",{className:e.className,style:r},s)}function ot(e){return"/"===e[0]&&(e=e.substring(1)),"/"===e[e.length-1]&&(e=e.substring(0,e.length-1)),e}const it={name:"Router",displayNodeName:"Page Router",category:"Visuals",docs:"https://docs.noodl.net/nodes/navigation/page-router",useVariants:!1,connectionPanel:{groupPriority:["General","Actions","Events","Mounted"]},initialize(){this._internal.asyncQueue=new qe,this.onScheduleReset=()=>{this.scheduleReset()},this.props.didMount=()=>{this._internal.isMounted=!0,"undefined"!=typeof window&&(window.history&&window.history.pushState?window.addEventListener("popstate",this.onScheduleReset):window.addEventListener("hashchange",this.onScheduleReset)),this._registerRouter()},this.props.willUnmount=()=>{this._internal.isMounted=!1,window.removeEventListener("popstate",this.onScheduleReset),window.removeEventListener("hashchange",this.onScheduleReset),this._deregisterRouter()},this.props.layout="column"},getInspectInfo(){return this._internal.currentUrl},defaultCss:{flex:"1 1",alignSelf:"stretch",position:"relative",display:"flex",flexDirection:"column"},getReactComponent:()=>nt,inputs:{name:{type:"string",displayName:"Name",group:"General",set(e){this._deregisterRouter(),this._internal.name=e,this._internal.isMounted&&this._registerRouter()}},pages:{type:{name:"pages",allowEditOnly:!0},displayName:"Pages",group:"Pages",set(e){this._internal.pages=e,this._internal.isMounted&&this.scheduleReset()}},urlPath:{type:"string",displayName:"Url path",group:"General",set(e){this._internal.urlPath=e}},clip:{displayName:"Clip Behavior",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(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",group:"Actions",valueChangedToTrue(){this.scheduleReset()}}},inputCss:{backgroundColor:{type:"color",displayName:"Background Color",group:"Style",default:"transparent",applyDefault:!1}},outputs:{currentPageTitle:{type:"string",group:"General",displayName:"Current Page Title",getter(){return void 0!==this._internal.currentPage?this._internal.currentPage.title:void 0}},currentPageComponent:{type:"string",group:"General",displayName:"Current Page Component",getter(){return void 0!==this._internal.currentPage?this._internal.currentPage.component:void 0}}},methods:{_registerRouter(){y.u.instance.registerRouter(this._internal.name,this)},_deregisterRouter(){y.u.instance.deregisterRouter(this._internal.name,this)},setPageOutputs(e){for(const t in e)this._internal[t]=e[t],this.flagOutputDirty(t)},scheduleReset(){const e=this._internal;e.hasScheduledReset||(e.hasScheduledReset=!0,this.scheduleAfterInputsHaveUpdated((()=>{e.hasScheduledReset=!1,this.reset()})))},createPageContainer(){const e=this.nodeScope.createPrimitiveNode("Group");return e.setStyle({flex:"1 0 100%"}),e},reset(){this._internal.asyncQueue.enqueue(this.resetAsync.bind(this))},scrollToTop(){const e=this.getDOMElement();e&&(e.scrollTop=0,s.default.instance.getProjectSettings().bodyScroll&&e.scrollIntoView())},async resetAsync(){let e,t={};const n=this.matchPageFromUrl();if(n?n.page?(e=n.page.component,t=Object.assign({},n.params,n.query)):(e=void 0!==this._internal.pages?this._internal.pages.startPage:void 0,t=Object.assign({},n.params,n.query)):(e=this._internal.pages.startPage,t={}),void 0===e)return;const o=y.u.instance.getPageInfoForComponent(e);if(this._internal.currentPage===o)return void(function(e,t){const n=Object.keys(e||{}),o=Object.keys(t||{});return n.length===o.length&&n.every((n=>e[n]===t[n]))}(this._internal.currentParams,t)||(this._internal.currentParams=t,this._updatePageInputs(this._internal.currentPageComponent.nodeScope,t)));this.scrollToTop();const i=this.getChildren();for(const e in i){const t=i[e];this.removeChild(t),this.nodeScope.deleteNode(t)}const r=await this.nodeScope.createNode(e,(0,s.guid)());this._internal.currentPageComponent=r;const a=r.nodeScope.getNodesWithType("Page");if(void 0===a||1!==a.length)return;this._internal.currentPage=y.u.instance.getPageInfoForComponent(e),this._internal.currentParams=t,this.flagOutputDirty("currentPageTitle"),this.flagOutputDirty("currentPageComponent"),Noodl.SEO.setTitle(this._internal.currentPage.title),this._updatePageInputs(this._internal.currentPageComponent.nodeScope,t);const l=this.createPageContainer();l.addChild(r),this.addChild(l)},_updatePageInputs(e,t){for(const n of e.getNodesWithType("PageInputs"))n._setPageParams(t)},getRelativeURL(e,t){if(!e)return;let n=e.path;if(void 0===n)return;const o=n.match(/{([^}]+)}/g),i=Object.assign({},t);if(o)for(const e of o){const o=e.replace(/[{}]/g,"");void 0!==t[o]&&(n=n.replace(e,encodeURIComponent(i[o])),delete i[o])}const s=[];for(const e in i)s.push({name:e,value:encodeURIComponent(i[e])});return n=ot(n),void 0!==this._internal.urlPath&&(n=ot(this._internal.urlPath)+"/"+n),{path:n,query:s}},getNavigationAbsoluteURL(e,t){let n=this.parent,o={path:"",query:[]};for(;void 0!==n&&"function"!=typeof n.getNavigationAbsoluteURL;)n=n.getVisualParentNode();n&&(o=n.getNavigationAbsoluteURL(n._internal.currentPage,n._internal.currentParams));const i=this.getRelativeURL(e,t);if(i){const e=o.path.endsWith("/")||i.path.startsWith("/");return{path:o.path+(e?"":"/")+i.path,query:o.query.concat(i.query)}}return o},_getLocationPath:function(){const e=s.default.instance.getProjectSettings().navigationPathType;if(void 0===e||"hash"===e){let e=location.hash;return e&&("#"===e[0]&&(e=e.substring(1)),"/"===e[0]&&(e=e.substring(1))),decodeURI(e)}{let e=location.pathname;if(e&&"/"===e[0]){const t=Noodl.Env.BaseUrl;if(t){const n=function(e){if(!e.startsWith("/"))try{return new URL(e).pathname.length}catch(e){}return e.length}(t);e=e.substring(n)}else e=e.substring(1)}return decodeURI(e)}},_getSearchParams:function(){const e=/\+/g,t=/([^&=]+)=?([^&]*)/g,n=function(t){return decodeURIComponent(t.replace(e," "))},o=location.search.substring(1);let i;const s={};for(;i=t.exec(o);)s[n(i[1])]=n(i[2]);return s},getNavigationRemainingPath(){return this._internal.remainingNavigationPath},matchPageFromUrl(){let e,t=this.parent;for(;void 0!==t&&"function"!=typeof t.getNavigationRemainingPath;)t=t.getVisualParentNode();if(void 0===t){let t=this._getLocationPath();"/"===t[0]&&(t=t.substring(1)),e=t.split("/")}else e=t.getNavigationRemainingPath();if(void 0===e)return;const n=this._getSearchParams();function o(e,t){const n={};for(let o=0;o<t.length;o++){const i=t[o];if("{"===i[0]&&"}"===i[i.length-1])void 0!==e[o]&&(n[i.substring(1,i.length-1)]=decodeURIComponent(e[o]));else if(void 0===e[o]||i!==e[o])return}return{params:n,remainingPathParts:e.slice().splice(t.length)}}const i=y.u.instance.getPagesForRouter(this._internal.name);if(void 0===i||0===i.length)return;let s,r=9999;for(const t of i){let n=t.path;if(void 0===n)continue;n=ot(n),void 0!==this._internal.urlPath&&(n=ot(this._internal.urlPath)+"/"+n);const i=n.split("/"),a=o(e,i),l=Math.abs(i.length-e.length);a&&r>l&&(s={match:a,pageInfo:t},r=l)}return s?(this._internal.remainingNavigationPath=s.match.remainingPathParts,{page:s.pageInfo,params:s.match.params,query:n}):{page:void 0,params:{},query:n}},_getCompleteUrlToPage(e,t){const n=this.getNavigationAbsoluteURL(e,t);let o,i;const r=s.default.instance.getProjectSettings().navigationPathType;void 0===r||"hash"===r?i=n.path:o=n.path;const a=n.query.map((e=>e.name+"="+e.value));return(void 0!==o?o:"")+(a.length>=1?"?"+a.join("&"):"")+(void 0!==i?"#"+i:"")},_updateUrlWithTopPage(){if(void 0!==window.history){this._internal.remainingNavigationPath=void 0;const e=this._getCompleteUrlToPage(this._internal.currentPage,this._internal.currentParams);window.history.pushState({},"",e)}},navigate(e){this._internal.asyncQueue.enqueue(this.navigateAsync.bind(this,e))},async navigateAsync(e){if(void 0===e.target)return;const t=y.u.instance.getPageInfoForComponent(e.target);if(t)if(e.openInNewTab){const n=this._getCompleteUrlToPage(t,e.params);window.open(n,"_blank"),e.hasNavigated&&e.hasNavigated()}else await this._navigateInCurrentWindow(t,e)},async _navigateInCurrentWindow(e,t){this.scrollToTop();const n=this.getChildren();for(const e in n){const t=n[e];this.removeChild(t),this.nodeScope.deleteNode(t)}const o=this.createPageContainer(),i=await this.nodeScope.createNode(t.target,(0,s.guid)());this._internal.currentPage=e,this._internal.currentParams=t.params,this.flagOutputDirty("currentPageTitle"),this.flagOutputDirty("currentPageComponent"),Noodl.SEO.setTitle(this._internal.currentPage.title);const r=i.nodeScope.getNodesWithType("PageInputs");void 0!==r&&r.length>0&&r.forEach((e=>{e._setPageParams(t.params)})),o.addChild(i),this.addChild(o),this._updateUrlWithTopPage(),t.hasNavigated&&t.hasNavigated(),y.u.instance.onNavigated(this._internal.name,e)},registerInputIfNeeded(e){this.hasInput(e)}}},st=Z(it),rt={name:"net.noodl.externallink",displayNodeName:"External Link",docs:"https://docs.noodl.net/nodes/navigation/external-link",category:"Navigation",nodeDoubleClickAction:{focusPort:"link"},inputs:{link:{type:"string",displayName:"Link"},openInNewTab:{type:"boolean",displayName:"Open In New Tab",default:!0},do:{type:"signal",displayName:"Do",valueChangedToTrue(){const e=this.getInputValue("openInNewTab"),t=e?"noopener,noreferrer":"",n=!0===e||void 0===e?"_blank":"_self";window.open(this.getInputValue("link"),n,t)}}}};function at(e,t,n,o){const i=(o-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function lt(e,t,n,o,i){i%360==o%360&&(i-=1e-4);const s=at(e,t,n,i),r=at(e,t,n,o),a=i-o<=180?"0":"1";return["M",s.x,s.y,"A",n,n,0,a,0,r.x,r.y,"L",e,t,"L",s.x,s.y].join(" ")}class dt extends n().Component{constructor(e){super(e)}render(){let e,t;const o=this.props.size/2,{startAngle:i,endAngle:s}=this.props;if(this.props.fillEnabled){const t=this.props.size/2;e=n().createElement("path",{d:lt(t,t,t,i,s),fill:this.props.fillColor})}if(this.props.strokeEnabled){const{strokeColor:e,strokeWidth:r,strokeLineCap:a}=this.props,l=function(e,t,n,o,i){i%360==o%360&&(i-=1e-4);const s=at(e,t,n,i),r=at(e,t,n,o),a=i-o<=180?"0":"1";return["M",s.x,s.y,"A",n,n,0,a,0,r.x,r.y].join(" ")}(o,o,o-this.props.strokeWidth/2,i,s);t=n().createElement("path",{d:l,stroke:e,strokeWidth:r,fill:"transparent",strokeLinecap:a})}const r={...this.props.style};return x.size(r,this.props),x.align(r,this.props),0===r.opacity&&(r.pointerEvents="none"),n().createElement("div",{className:this.props.className,...this.props.dom,...ne(this.props),style:r},n().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:this.props.size,height:this.props.size},e,t))}}const ut={name:"Circle",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:()=>dt,noodlNodeAsProp:!0,allowChildren:!1,defaultCss:{flexShrink:0,position:"relative",display:"flex"},inputProps:{size:{displayName:"Size",default:"100",group:"Dimension",type:{name:"number"},index:10,allowVisualStates:!0},fillEnabled:{group:"Fill",displayName:"Fill",default:!0,type:"boolean",index:20,allowVisualStates:!0},fillColor:{group:"Fill",displayName:"Fill Color",default:"red",type:"color",index:21,allowVisualStates:!0},strokeEnabled:{index:23,group:"Stroke",default:!1,displayName:"Stroke",type:"boolean",allowVisualStates:!0},strokeWidth:{index:24,group:"Stroke",displayName:"Stroke Width",default:10,type:{name:"number"},allowVisualStates:!0},strokeColor:{index:25,group:"Stroke",displayName:"Stroke Color",type:"color",default:"black",allowVisualStates:!0},strokeLineCap:{index:26,group:"Stroke",displayName:"Line Cap",type:{name:"enum",enums:[{label:"Butt",value:"butt"},{label:"Round",value:"round"}]},default:"butt",allowVisualStates:!0},startAngle:{displayName:"Start Angle",type:"number",default:0,group:"Style",index:198,allowVisualStates:!0},endAngle:{displayName:"End Angle",type:"number",default:360,group:"Style",index:199,allowVisualStates:!0}},setup(e,t){F.addTransformInputs(ut),F.addMarginInputs(ut),F.addSharedVisualInputs(ut),F.addAlignInputs(ut),F.addPointerEventOutputs(ut)}},ct=Z(ut);var pt=__webpack_require__(5071);function ht(e,t,n,o){const i=mt(e,t,n,o),s=mt(i.layout,t,n,o);return i.totalFractions===s.totalFractions?i:ht(s.layout,t,n,o)}function mt(e,t,n,o){const i=100/e.reduce(((e,t)=>e+t),0),s=e.reduce(((e,s,r)=>({expected:e.expected+i/100*n*s,min:e.min+parseFloat(t)+o})),{expected:0,min:0,max:null}),r=e;s.expected<s.min&&r.pop();const a=r.reduce(((e,t)=>e+t),0);return{layout:r,totalFractions:a,fractionSize:100/a,columnAmount:r.length}}function gt(e){if(!e.children)return null;let o=null;const i=(0,t.useRef)(null),[s,r]=(0,t.useState)(null);switch((0,t.useEffect)((()=>{const e=i.current;if(!e)return;const t=new ResizeObserver((()=>{const e=i.current;e&&r(e.offsetWidth)}));return t.observe(e),()=>{t.disconnect()}}),[]),typeof e.layoutString){case"string":o=e.layoutString.trim();break;case"number":o=String(e.layoutString).trim();break;default:o=null}if(!o)return n().createElement(n().Fragment,null,e.children);const a=o.split(" ").map((e=>parseInt(e))),{layout:l,columnAmount:d,fractionSize:u}=ht(a,e.minWidth,s||0,e.marginX);let c=[],p=null;return Array.isArray(e.children)?(c=e.children.filter((e=>n().isValidElement(e)&&e.type!==pt.node)),p=e.children.find((e=>n().isValidElement(e)&&e.type===pt.node))):e.children.type!==pt.node&&(c=[e.children]),n().createElement("div",{...e.attrs,className:["columns-container",e.className].join(" "),ref:i,style:{visibility:null===s?"hidden":"visible",marginTop:-1*parseFloat(e.marginY),marginLeft:-1*parseFloat(e.marginX),display:"flex",flexWrap:"wrap",alignItems:"stretch",justifyContent:e.justifyContent,flexDirection:e.direction,width:`calc(100% + (${parseFloat(e.marginX)}px)`,boxSizing:"border-box",...e.style}},p&&p,c.map(((t,o)=>n().isValidElement(t)?n().createElement("div",{className:"column-item",key:o,style:{boxSizing:"border-box",paddingTop:e.marginY,paddingLeft:e.marginX,width:l[o%d]*u+"%",flexShrink:0,flexGrow:0,minWidth:e.minWidth}},n().cloneElement(t)):null)))}const ft=Z({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(){this.props.attrs={},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:()=>gt,inputs:{layoutString:{group:"Layout Settings",displayName:"Layout String",type:"string",default:"1 2 1",set(e){this.props.layoutString=e,"string"!=typeof e?this.context.editorConnection.sendWarning(this.nodeScope.componentOwner.name,this.id,"layout-type-warning",{message:"Layout String needs to be a string."}):this.context.editorConnection.clearWarning(this.nodeScope.componentOwner.name,this.id,"layout-type-warning"),this.forceUpdate()}},testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}},inputProps:{marginX:{group:"Layout Settings",displayName:"Horizontal Gap",type:{name:"number",units:["px"],defaultUnit:"px"},default:16},marginY:{group:"Layout Settings",displayName:"Vertical Gap",type:{name:"number",units:["px"],defaultUnit:"px"},default:16},minWidth:{group:"Constraints",displayName:"Min Column Width",type:{name:"number",units:["px"],defaultUnit:"px"},default:0},direction:{group:"Layout Settings",displayName:"Layout Direction",type:{name:"enum",enums:[{label:"Horizontal",value:"row"},{label:"Vertical",value:"column"}]},default:"row"},justifyContent:{group:"Justify Content",displayName:"Justify Content",type:{name:"enum",enums:[{label:"Start",value:"flex-start"},{label:"End",value:"flex-end"},{label:"Center",value:"center"}],alignComp:"align-items"},default:"flex-start"}}});var yt=__webpack_require__(5900),vt=__webpack_require__.n(yt),bt=__webpack_require__(5794),_t=__webpack_require__.n(bt);function St(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)}class Ct extends n().Component{constructor(e){super(e),this.state={x:0,y:0}}snapToPosition({timerScheduler:e,propCallback:t,duration:n,axis:o,endValue:i}){const s=this;return e.createTimer({duration:void 0===n?300:n,startValue:this.state[o],endValue:i,ease:L.A.easeOut,onRunning:function(e){const n=this.ease(this.startValue,this.endValue,e);s.setState({[o]:n}),t&&t(n)}}).start()}componentDidMount(){const e=this.props.inputPositionX?this.props.inputPositionX:0,t=this.props.inputPositionY?this.props.inputPositionY:0;this.setState({x:e,y:t}),St({x:e,y:t,deltaX:0,deltaY:0},this.props)}UNSAFE_componentWillReceiveProps(e){const t=this.props;t.inputPositionX!==e.inputPositionX&&(this.setState({x:e.inputPositionX}),t.positionX&&t.positionX(e.inputPositionX),t.deltaX&&t.deltaX(e.inputPositionX-t.inputPositionX)),t.inputPositionY!==e.inputPositionY&&(this.setState({y:e.inputPositionY}),t.positionY&&t.positionY(e.inputPositionY),t.deltaY&&t.deltaY(e.inputPositionY-t.inputPositionY))}snapToPositionX(e,t){this.state.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}))}snapToPositionY(e,t){this.state.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}))}render(){const e=this.props,t=e.useParentBounds?"parent":void 0;let o;return n().Children.count(e.children)>0?(o=n().Children.toArray(e.children)[0],n().createElement(_t(),{axis:e.axis,bounds:t,disabled:!1===e.enabled,scale:e.scale||0,position:{x:this.state.x,y:this.state.y},onStart:(t,n)=>{St(n,e),e.onStart&&e.onStart(),this.snapToPositionXTimer&&this.snapToPositionXTimer.stop(),this.snapToPositionYTimer&&this.snapToPositionYTimer.stop()},onStop:(t,n)=>{"x"!==e.axis&&"both"!==e.axis||this.setState({x:n.x}),"y"!==e.axis&&"both"!==e.axis||this.setState({y:n.y}),e.positionX&&e.positionX(n.x),e.positionY&&e.positionY(n.y),e.onStop&&e.onStop()},onDrag:(t,n)=>{St(n,e),e.onDrag&&e.onDrag()}},n().cloneElement(o,{parentLayout:e.parentLayout}))):null}}const Nt=Z({name:"Drag",docs:"https://docs.noodl.net/nodes/utilities/drag",allowChildren:!0,noodlNodeAsProp:!0,getReactComponent:()=>Ct,initialize(){this._internal.snapPositionX=0,this._internal.snapPositionY=0,this._internal.snapDurationX=300,this._internal.snapDurationY=300},inputs:{"snapToPositionX.do":{group:"Snap To Position X",displayName:"Do",editorName:"Do|Snap To Position X",type:"signal",valueChangedToTrue(){this.scheduleAfterInputsHaveUpdated((()=>{const{snapPositionX:e,snapDurationX:t}=this._internal;this.innerReactComponentRef&&this.innerReactComponentRef.snapToPositionX(e,t)}))}},"snapToPositionX.value":{default:0,group:"Snap To Position X",displayName:"Value",editorName:"Value|Snap To Position X",type:"number",set(e){this._internal.snapPositionX=e}},"snapToPositionX.duration":{default:300,group:"Snap To Position X",displayName:"Duration",editorName:"Duration|Snap To Position X",type:"number",set(e){this._internal.snapDurationX=e}},"snapToPositionY.do":{group:"Snap To Position Y",displayName:"Do",editorName:"Do|Snap To Position Y",type:"signal",valueChangedToTrue(){this.scheduleAfterInputsHaveUpdated((()=>{const{snapPositionY:e,snapDurationY:t}=this._internal;this.innerReactComponentRef&&this.innerReactComponentRef.snapToPositionY(e,t)}))}},"snapToPositionY.value":{default:0,group:"Snap To Position Y",displayName:"Value",editorName:"Value|Snap To Position Y",type:"number",set(e){this._internal.snapPositionY=e}},"snapToPositionY.duration":{default:300,group:"Snap To Position Y",displayName:"Duration",editorName:"Duration|Snap To Position Y",type:"number",set(e){this._internal.snapDurationY=e}}},inputProps:{enabled:{group:"Drag",displayName:"Enabled",type:"boolean",default:!0},axis:{group:"Drag",displayName:"Axis",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",type:"boolean",default:!0},inputPositionX:{displayName:"Start Drag X",type:{name:"number"}},inputPositionY:{displayName:"Start Drag Y",type:{name:"number"}},scale:{displayName:"Scale",default:1,type:{name:"number"}}},outputProps:{onStart:{group:"Signals",type:"signal",displayName:"Drag Started"},onStop:{group:"Signals",type:"signal",displayName:"Drag Ended"},onDrag:{group:"Signals",type:"signal",displayName:"Drag Moved"},positionX:{group:"Values",displayName:"Drag X",type:"number"},positionY:{group:"Values",displayName:"Drag Y",type:"number"},deltaX:{group:"Values",displayName:"Delta X",type:"number"},deltaY:{group:"Values",displayName:"Delta Y",type:"number"}}});var Ot=function(e,t){return Ot=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])},Ot(e,t)};function It(e,t){function n(){this.constructor=e}Ot(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var wt=function(){return wt=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},wt.apply(this,arguments)};function Pt(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),i=0;for(t=0;t<n;t++)for(var s=arguments[t],r=0,a=s.length;r<a;r++,i++)o[i]=s[r];return o}var xt=[{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 Et(e){console.error("[BScroll warn]: "+e)}var Tt="undefined"!=typeof window,At=Tt&&navigator.userAgent.toLowerCase(),kt=!(!At||!/wechatdevtools/.test(At)),Dt=At&&At.indexOf("android")>0,Rt=function(){if("string"==typeof At){var e=/os (\d\d?_\d(_\d)?)/.exec(At);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}(),Mt=!1;if(Tt)try{var Vt={};Object.defineProperty(Vt,"passive",{get:function(){Mt=!0}}),window.addEventListener("test-passive",(function(){}),Vt)}catch(e){}function jt(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}var Ft=function(e,t){for(var n in t)e[n]=t[n];return e};function Ut(e){return null==e}function Wt(e,t,n){return e<t?t:e>n?n:e}var Lt=Tt&&document.createElement("div").style,Bt=function(){if(!Tt)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!==Lt[n.value])return n.key}return!1}();function $t(e){return!1===Bt?e:"standard"===Bt?"transitionEnd"===e?"transitionend":e:Bt+e.charAt(0).toUpperCase()+e.substr(1)}function qt(e){return"string"==typeof e?document.querySelector(e):e}function zt(e,t,n,o){var i=Mt?{passive:!1,capture:!!o}:!!o;e.addEventListener(t,n,i)}function Ht(e,t,n,o){e.removeEventListener(t,n,{capture:!!o})}function Gt(e){e.cancelable&&e.preventDefault()}function Xt(e){for(var t=0,n=0;e;)t-=e.offsetLeft,n-=e.offsetTop,e=e.offsetParent;return{left:t,top:n}}Bt&&"standard"!==Bt&&Bt.toLowerCase();var Yt=$t("transform"),Jt=$t("transition"),Kt=Tt&&$t("perspective")in Lt,Qt=Tt&&("ontouchstart"in window||kt),Zt=Tt&&Jt in Lt,en={transform:Yt,transition:Jt,transitionTimingFunction:$t("transitionTimingFunction"),transitionDuration:$t("transitionDuration"),transitionDelay:$t("transitionDelay"),transformOrigin:$t("transformOrigin"),transitionEnd:$t("transitionEnd"),transitionProperty:$t("transitionProperty")},tn={touchstart:1,touchmove:1,touchend:1,touchcancel:1,mousedown:2,mousemove:2,mouseup:2};function nn(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 on(e,t){for(var n in t)if(t[n].test(e[n]))return!0;return!1}var sn=on;function rn(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 o,i={};n&&(i.screenX=n.screenX||0,i.screenY=n.screenY||0,i.clientX=n.clientX||0,i.clientY=n.clientY||0);var s=!0,r=!0,a={ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey};if("undefined"!=typeof MouseEvent)try{o=new MouseEvent(t,Ft(wt({bubbles:s,cancelable:r},a),i))}catch(e){l()}else l();function l(){(o=document.createEvent("Event")).initEvent(t,s,r),Ft(o,i)}o.forwardedTouchEvent=!0,o._constructed=!0,e.target.dispatchEvent(o)}var an={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}}},ln=1e3/60,dn=Tt&&window;function un(){}var cn,pn,hn,mn,gn=Tt?dn.requestAnimationFrame||dn.webkitRequestAnimationFrame||dn.mozRequestAnimationFrame||dn.oRequestAnimationFrame||function(e){return window.setTimeout(e,e.interval||ln)}:un,fn=Tt?dn.cancelAnimationFrame||dn.webkitCancelAnimationFrame||dn.mozCancelAnimationFrame||dn.oCancelAnimationFrame||function(e){window.clearTimeout(e)}:un,yn=function(e){},vn={enumerable:!0,configurable:!0,get:yn,set:yn},bn=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 o=this;void 0===n&&(n=this),this.hasType(e);var i=function(){for(var s=[],r=0;r<arguments.length;r++)s[r]=arguments[r];o.off(e,i);var a=t.apply(n,s);if(!0===a)return a};return i.fn=t,this.on(e,i),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 o=n.length;o--;)(n[o][0]===t||n[o][0]&&n[o][0].fn===t)&&n.splice(o,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 o=this.events[e];if(o)for(var i,s=o.length,r=Pt(o),a=0;a<s;a++){var l=r[a],d=l[0],u=l[1];if(d&&!0===(i=d.apply(u,t)))return i}},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||Et('EventEmitter has used unknown event type: "'+e+'", should be oneof ['+Object.keys(t).map((function(e){return JSON.stringify(e)}))+"]")},e}(),_n=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(zt)},e.prototype.removeDOMEvents=function(){this.handleDOMEvents(Ht)},e.prototype.handleDOMEvents=function(e){var t=this,n=this.wrapper;this.events.forEach((function(o){e(n,o.name,t,!!o.capture)}))},e.prototype.handleEvent=function(e){var t=e.type;this.events.some((function(n){return n.name===t&&(n.handler(e),!0)}))},e}(),Sn=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=Qt,t.disableTouch=!Qt,t.autoBlur=!0,t.autoEndDistance=5,t.outOfBoundaryDampingFactor=1/3,t.specifiedIndexAsContent=0,t.quadrant=1,t}return It(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&&Kt?" translateZ(1px)":"",this.useTransition=this.useTransition&&Zt,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?Ft(t,e):e?t:{top:!1,right:!1,bottom:!1,left:!1}},t}((function(){})),Cn=function(){function e(e,t){this.wrapper=e,this.options=t,this.hooks=new bn(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}return e.prototype.handleDOMEvents=function(){var e=this.options,t=e.bindToWrapper,n=e.disableMouse,o=e.disableTouch,i=e.click,s=this.wrapper,r=t?s:window,a=[],l=[],d=!o,u=!n;i&&a.push({name:"click",handler:this.click.bind(this),capture:!0}),d&&(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)})),u&&(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 _n(s,a),this.targetEventRegister=new _n(r,l)},e.prototype.beforeHandler=function(e,t){var n=this.options,o=n.preventDefault,i=n.stopPropagation,s=n.preventDefaultException;({start:function(){return o&&!on(e.target,s)},end:function(){return o&&!on(e.target,s)},move:function(){return o}})[t]()&&e.preventDefault(),i&&e.stopPropagation()},e.prototype.setInitiated=function(e){void 0===e&&(e=0),this.initiated=e},e.prototype.start=function(e){var t=tn[e.type];if(!this.initiated||this.initiated===t)if(this.setInitiated(t),sn(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(tn[e.type]===this.initiated){this.beforeHandler(e,"move");var t=e.touches?e.touches[0]:e,n=t.pageX-this.pointX,o=t.pageY-this.pointY;if(this.pointX=t.pageX,this.pointY=t.pageY,!this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:n,deltaY:o,e})){var i=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,s=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,r=this.pointX-i,a=this.pointY-s,l=this.options.autoEndDistance;(r>document.documentElement.clientWidth-l||a>document.documentElement.clientHeight-l||r<l||a<l)&&this.end(e)}}},e.prototype.end=function(e){tn[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}(),Nn={x:["translateX","px"],y:["translateY","px"]},On=function(){function e(e){this.setContent(e),this.hooks=new bn(["beforeTranslate","translate"])}return e.prototype.getComputedPosition=function(){var e=window.getComputedStyle(this.content,null)[en.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(Nn[n]){var o=Nn[n][0];if(o){var i=Nn[n][1],s=e[n];t.push(o+"("+s+i+")")}}})),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,t,e),this.style[en.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}(),In=function(){function e(e,t,n){this.translater=t,this.options=n,this.timer=0,this.hooks=new bn(["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&&(fn(this.timer),this.timer=0)},e.prototype.destroy=function(){this.hooks.destroy(),fn(this.timer)},e}(),wn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return It(t,e),t.prototype.startProbe=function(e,t){var n=this,o=e,i=function(){var s=n.translater.getComputedPosition();(function(e,t,n,o){var i=function(e,t){var n=e-t;return n>0?-1:n<0?1:0},s=i(t.x,e.x),r=i(t.y,e.y),a=n.x-o.x,l=n.y-o.y;return s*a<=0&&r*l<=0})(e,t,s,o)&&n.hooks.trigger(n.hooks.eventTypes.move,s),n.pending||(n.callStopWhenPending?n.callStopWhenPending=!1:n.hooks.trigger(n.hooks.eventTypes.end,s)),o=s,n.pending&&(n.timer=gn(i))};this.callStopWhenPending&&this.setCallStop(!1),fn(this.timer),i()},t.prototype.transitionTime=function(e){void 0===e&&(e=0),this.style[en.transitionDuration]=e+"ms",this.hooks.trigger(this.hooks.eventTypes.time,e)},t.prototype.transitionTimingFunction=function(e){this.style[en.transitionTimingFunction]=e,this.hooks.trigger(this.hooks.eventTypes.timeFunction,e)},t.prototype.transitionProperty=function(){this.style[en.transitionProperty]=en.transform},t.prototype.move=function(e,t,n,o){this.setPending(n>0),this.transitionTimingFunction(o),this.transitionProperty(),this.transitionTime(n),this.translate(t);var i=3===this.options.probeType;n&&i&&this.startProbe(e,t),n||(this._reflow=this.content.offsetHeight,i&&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),fn(this.timer);var t=this.translater.getComputedPosition(),n=t.x,o=t.y;this.transitionTime(),this.translate({x:n,y:o}),this.setForceStopped(!0),this.setCallStop(!0),this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:n,y:o})}return e},t.prototype.stop=function(){this.doStop()&&this.hooks.trigger(this.hooks.eventTypes.callStop)},t}(In),Pn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return It(t,e),t.prototype.move=function(e,t,n,o){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,o)},t.prototype.animate=function(e,t,n,o){var i=this,s=jt(),r=s+n,a=3===this.options.probeType,l=function(){var d=jt();if(d>=r)return i.translate(t),a&&i.hooks.trigger(i.hooks.eventTypes.move,t),void i.hooks.trigger(i.hooks.eventTypes.end,t);var u=o(d=(d-s)/n),c={};Object.keys(t).forEach((function(n){var o=e[n],i=t[n];c[n]=(i-o)*u+o})),i.translate(c),a&&i.hooks.trigger(i.hooks.eventTypes.move,c),i.pending&&(i.timer=gn(l)),i.pending||(i.callStopWhenPending?i.callStopWhenPending=!1:i.hooks.trigger(i.hooks.eventTypes.end,t))};this.setPending(!0),this.callStopWhenPending&&this.setCallStop(!1),fn(this.timer),l()},t.prototype.doStop=function(){var e=this.pending;if(this.setForceStopped(!1),this.setCallStop(!1),e){this.setPending(!1),fn(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}(In),xn=function(){function e(e,t,n){this.wrapper=e,this.options=n,this.hooks=new bn(["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 o=-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,o,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,o,i,s,r){void 0===r&&(r=this.options);var a=e-t,l=Math.abs(a)/n,d=r.deceleration,u=r.swipeBounceTime,c=r.swipeTime,p={destination:e+l*l/d*(a<0?-1:1),duration:Math.min(c,2*l/d),rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,p,a),p.destination<o?(p.destination=s?Math.max(o-s/4,o-s/p.rate*l):o,p.duration=u):p.destination>i&&(p.destination=s?Math.min(i+s/4,i+s/p.rate*l):i,p.duration=u),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,o=t.position,i="static"===window.getComputedStyle(this.wrapper,null).position,s=nn(this.wrapper);this.wrapperSize=this.wrapper["width"===n?"clientWidth":"clientHeight"],this.setContent(e);var r=nn(this.content);this.contentSize=r[n],this.relativeOffset=r[o],i&&(this.relativeOffset-=s[o]),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}(),En=((cn={}).yes=function(e){return!0},cn.no=function(e){return Gt(e),!1},cn),Tn=((pn={}).horizontal=((hn={}).yes="horizontal",hn.no="vertical",hn),pn.vertical=((mn={}).yes="vertical",mn.no="horizontal",mn),pn),An=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=Tn[this.directionLocked];if(t){if(this.eventPassthrough===t.yes)return En.yes(e);if(this.eventPassthrough===t.no)return En.no(e)}return!1},e}(),kn=function(){function e(e,t,n,o,i){this.hooks=new bn(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd","contentNotMoved","detectMovingDirection","coordinateTransformation"]),this.scrollBehaviorX=e,this.scrollBehaviorY=t,this.actionsHandler=n,this.animater=o,this.options=i,this.directionLockAction=new An(i.directionLockThreshold,i.freeScroll,i.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,o=t.deltaY,i=t.e;if(!e.enabled)return!0;var s=function(e,t,n){return 2===n?[t,-e]:3===n?[-e,-t]:4===n?[-t,e]:[e,t]}(n,o,e.options.quadrant),r={deltaX:s[0],deltaY:s[1]};return e.hooks.trigger(e.hooks.eventTypes.coordinateTransformation,r),e.handleMove(r.deltaX,r.deltaY,i)})),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=jt();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 o=this.scrollBehaviorX.getAbsDist(e),i=this.scrollBehaviorY.getAbsDist(t),s=jt();if(this.checkMomentum(o,i,s))return!0;if(this.directionLockAction.checkMovingDirection(o,i,n))return this.actionsHandler.setInitiated(),!0;var r=this.directionLockAction.adjustDelta(e,t),a=this.scrollBehaviorX.getCurrentPos(),l=this.scrollBehaviorX.move(r.deltaX),d=this.scrollBehaviorY.getCurrentPos(),u=this.scrollBehaviorY.move(r.deltaY);if(!this.hooks.trigger(this.hooks.eventTypes.detectMovingDirection)){this.fingerMoved||(this.fingerMoved=!0);var c=l!==a||u!==d;this.contentMoved||c||this.hooks.trigger(this.hooks.eventTypes.contentNotMoved),!this.contentMoved&&c&&(this.contentMoved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.contentMoved&&c&&(this.animater.translate({x:l,y:u}),this.dispatchScroll(s))}}},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=jt();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,o=this.scrollBehaviorX,i=o.minScrollPos,s=o.maxScrollPos,r=this.scrollBehaviorY,a=r.minScrollPos,l=r.maxScrollPos;return t=t>0?Math.ceil(t):Math.floor(t),n=n>0?Math.ceil(n):Math.floor(n),{x:t=Wt(t,s,i),y:n=Wt(n,l,a)}},e.prototype.handleClick=function(e){on(e.target,this.options.preventDefaultException)||(Gt(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 Dn(e,t,n,o){var i=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime","outOfBoundaryDampingFactor","specifiedIndexAsContent"].reduce((function(t,n){return t[n]=e[n],t}),{});return i.scrollable=!!e[t],i.bounces=n,i.rect=o,i}function Rn(e,t,n){n.forEach((function(n){var o,i;"string"==typeof n?o=i=n:(o=n.source,i=n.target),e.on(o,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.trigger.apply(t,Pt([i],e))}))}))}var Mn=function(){function e(e,t,n){this.wrapper=e,this.content=t,this.resizeTimeout=0,this.hooks=new bn(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","resize","touchEnd","end","flick","scrollCancel","momentum","scrollTo","minDistanceScroll","scrollToElement","beforeRefresh"]),this.options=n;var o,i=this.options.bounce,s=i.left,r=i.right,a=i.top,l=i.bottom;this.scrollBehaviorX=new xn(e,t,Dn(n,"scrollX",[s,r],{size:"width",position:"left"})),this.scrollBehaviorY=new xn(e,t,Dn(n,"scrollY",[a,l],{size:"height",position:"top"})),this.translater=new On(this.content),this.animater=function(e,t,n){var o=n.useTransition,i={};return Object.defineProperty(i,"probeType",{enumerable:!0,configurable:!1,get:function(){return n.probeType}}),o?new wn(e,t,i):new Pn(e,t,i)}(this.content,this.translater,this.options),this.actionsHandler=new Cn(this.options.bindToTarget?this.content:e,(o=this.options,["click","bindToWrapper","disableMouse","disableTouch","preventDefault","stopPropagation","tagException","preventDefaultException","autoEndDistance"].reduce((function(e,t){return e[t]=o[t],e}),{}))),this.actions=new kn(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var d=this.resize.bind(this);this.resizeRegister=new _n(window,[{name:"orientationchange",handler:d},{name:"resize",handler:d}]),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 _n(this.content,[{name:en.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))})),Rn(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;Rn(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,o){return e.hooks.trigger(e.hooks.eventTypes.touchEnd,o),!!e.hooks.trigger(e.hooks.eventTypes.end,o)||!(t.fingerMoved||(e.hooks.trigger(e.hooks.eventTypes.scrollCancel),!e.checkClick(n)))||(e.resetPosition(e.options.bounceTime,an.bounce)?(e.animater.setForceStopped(!1),!0):void 0)})),t.hooks.on(t.hooks.eventTypes.scrollEnd,(function(n,o){var i=Math.abs(n.x-e.scrollBehaviorX.startPos),s=Math.abs(n.y-e.scrollBehaviorY.startPos);if(e.checkFlick(o,i,s))return e.animater.setForceStopped(!1),void e.hooks.trigger(e.hooks.eventTypes.flick);e.momentum(n,o)?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:an.swiper,newX:e.x,newY:e.y},o=this.scrollBehaviorX.end(t),i=this.scrollBehaviorY.end(t);if(n.newX=Ut(o.destination)?n.newX:o.destination,n.newY=Ut(i.destination)?n.newY:i.destination,n.time=Math.max(o.duration,i.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=an.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,o=!1;if(n&&this.lastClickTime){var i=n.delay,s=void 0===i?300:i;jt()-this.lastClickTime<s&&(o=!0,function(e){rn(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&&!on(e.target,this.options.preventDefaultException)&&rn(e),this.lastClickTime=o?null:jt(),!0}return!1},e.prototype.resize=function(){var e=this;this.actions.enabled&&(Dt&&(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,an.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",o=0;o<t.length;o++){var i=t[o];i.isBScrollContainer||(i.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=Xt(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,o){void 0===n&&(n=0);var i=this.getCurrentPos(),s=i.x,r=i.y;o=o||an.bounce,e+=s,t+=r,this.scrollTo(e,t,n,o)},e.prototype.scrollTo=function(e,t,n,o,i){void 0===n&&(n=0),void 0===o&&(o=an.bounce),void 0===i&&(i={start:{},end:{}});var s=this.options.useTransition?o.style:o.fn,r=this.getCurrentPos(),a=wt({x:r.x,y:r.y},i.start),l=wt({x:e,y:t},i.end);if(this.hooks.trigger(this.hooks.eventTypes.scrollTo,l),!function(e,t){for(var n=0,o=Object.keys(e);n<o.length;n++){var i=o[n];if(e[i]!==t[i])return!1}return!0}(a,l)){var d=Math.abs(l.x-a.x),u=Math.abs(l.y-a.y);d<1&&u<1&&(n=0,this.hooks.trigger(this.hooks.eventTypes.minDistanceScroll)),this.animater.move(a,l,n,s)}},e.prototype.scrollToElement=function(e,t,n,o,i){var s=qt(e),r=Xt(s),a=function(e,t,n){return"number"==typeof e?e:e?Math.round(t/2-n/2):0};n=a(n,s.offsetWidth,this.wrapper.offsetWidth),o=a(o,s.offsetHeight,this.wrapper.offsetHeight);var l=function(e,t,n,o){return e-=t,o.adjustPosition(e-n)};r.left=l(r.left,this.wrapperOffset.left,n,this.scrollBehaviorX),r.top=l(r.top,this.wrapperOffset.top,o,this.scrollBehaviorY),this.hooks.trigger(this.hooks.eventTypes.scrollToElement,s,r)||this.scrollTo(r.left,r.top,t,i)},e.prototype.resetPosition=function(e,t){void 0===e&&(e=0),void 0===t&&(t=an.bounce);var n=this.scrollBehaviorX.checkInBoundary(),o=n.position,i=n.inBoundary,s=this.scrollBehaviorY.checkInBoundary(),r=s.position,a=s.inBoundary;return!(i&&a||(Rt&&this.reflow(),this.scrollTo(o,r,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(){fn(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}(),Vn=function(e){function t(t,n){var o=e.call(this,["refresh","contentChanged","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,i=qt(t);return i?(o.plugins={},o.options=(new Sn).merge(n).process(),o.setContent(i).valid?(o.hooks=new bn(["refresh","enable","disable","destroy","beforeInitialScrollTo","contentChanged"]),o.init(i),o):o):(Et("Can not resolve the wrapper DOM."),o)}return It(t,e),t.use=function(e){var n=e.pluginName;return t.plugins.some((function(t){return e===t.ctor}))?t:Ut(n)?(Et("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,o=e.children[this.options.specifiedIndexAsContent];return o?(t=this.content!==o)&&(this.content=o):(Et("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 Mn(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(xt),this.applyPlugins(),this.refreshWithoutReset(this.content);var n=this.options,o={x:n.startX,y:n.startY};this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo,o)||this.scroller.scrollTo(o.x,o.y)},t.prototype.applyPlugins=function(){var e=this,n=this.options;t.plugins.sort((function(e,t){var n,o=((n={}).pre=-1,n.post=1,n);return(e.applyOrder?o[e.applyOrder]:0)-(t.applyOrder?o[t.applyOrder]:0)})).forEach((function(t){var o=t.ctor;n[t.name]&&"function"==typeof o&&(e.plugins[t.name]=new o(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(){Rn(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,o=e.sourceKey;!function(e,t,n){vn.get=function(){return function(e,t){for(var n=t.split("."),o=0;o<n.length-1;o++)if("object"!=typeof(e=e[n[o]])||!e)return;var i=n.pop();return"function"==typeof e[i]?function(){return e[i].apply(e,arguments)}:e[i]}(this,t)},vn.set=function(e){!function(e,t,n){for(var o,i=t.split("."),s=0;s<i.length-1;s++)e[o=i[s]]||(e[o]={}),e=e[o];e[i.pop()]=n}(this,t,e)},Object.defineProperty(e,n,vn)}(t,o,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}(bn);function jn(e,t){return new Vn(e,t)}jn.use=Vn.use,jn.plugins=Vn.plugins,jn.pluginsMap=Vn.pluginsMap;var Fn=jn,Un="undefined"!=typeof window,Wn=Un&&navigator.userAgent.toLowerCase();Wn&&/wechatdevtools/.test(Wn),Wn&&Wn.indexOf("android"),function(){if("string"==typeof Wn){var e=/os (\d\d?_\d(_\d)?)/.exec(Wn);if(!e)return!1;var t=e[1].split("_").map((function(e){return parseInt(e,10)}));13===t[0]&&t[1]}}();var Ln=!1;if(Un)try{var Bn={};Object.defineProperty(Bn,"passive",{get:function(){Ln=!0}}),window.addEventListener("test-passive",(function(){}),Bn)}catch(e){}var $n=Un&&document.createElement("div").style,qn=function(){if(!Un)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!==$n[n.value])return n.key}return!1}();function zn(e){return!1===qn?e:"standard"===qn?"transitionEnd"===e?"transitionend":e:qn+e.charAt(0).toUpperCase()+e.substr(1)}function Hn(e,t,n,o){var i=Ln?{passive:!1,capture:!!o}:!!o;e.addEventListener(t,n,i)}function Gn(e,t,n,o){e.removeEventListener(t,n,{capture:!!o})}qn&&"standard"!==qn&&qn.toLowerCase(),zn("transform"),zn("transition"),Un&&zn("perspective"),zn("transitionTimingFunction"),zn("transitionDuration"),zn("transitionDelay"),zn("transformOrigin"),zn("transitionEnd"),zn("transitionProperty");var Xn=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(Hn)},e.prototype.removeDOMEvents=function(){this.handleDOMEvents(Gn)},e.prototype.handleDOMEvents=function(e){var t=this,n=this.wrapper;this.events.forEach((function(o){e(n,o.name,t,!!o.capture)}))},e.prototype.handleEvent=function(e){var t=e.type;this.events.some((function(n){return n.name===t&&(n.handler(e),!0)}))},e}(),Yn=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 Xn(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,o=t.scrollBehaviorY;n.setMovingDirection(0),o.setMovingDirection(0),n.setDirection(0),o.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,o=n.throttleTime,i=n.dampingFactor;if(o&&this.wheelMoveTimer)this.deltaCache.push(e);else{var s=this.deltaCache.reduce((function(e,t){return{x:e.x+t.x,y:e.y+t.y}}),{x:0,y:0});this.cleanCache();var r=this.scroll.scroller,a=r.scrollBehaviorX,l=r.scrollBehaviorY;a.setMovingDirection(-e.directionX),l.setMovingDirection(-e.directionY),a.setDirection(e.x),l.setDirection(e.y);var d=a.performDampingAlgorithm(Math.round(e.x)+s.x,i),u=l.performDampingAlgorithm(Math.round(e.y)+s.x,i);if(!this.scroll.trigger(this.scroll.eventTypes.mousewheelMove,{x:d,y:u})){var c=this.getEaseTime();d===this.scroll.x&&u===this.scroll.y||this.scroll.scrollTo(d,u,c)}o&&(this.wheelMoveTimer=window.setTimeout((function(){t.wheelMoveTimer=0}),o))}},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,o=0,i=0,s=t.invert?-1:1;switch(!0){case"deltaX"in e:1===e.deltaMode?(o=-e.deltaX*n,i=-e.deltaY*n):(o=-e.deltaX,i=-e.deltaY);break;case"wheelDeltaX"in e:o=e.wheelDeltaX/120*n,i=e.wheelDeltaY/120*n;break;case"wheelDelta"in e:o=i=e.wheelDelta/120*n;break;case"detail"in e:o=i=-e.detail/3*n}return o*=s,i*=s,this.scroll.hasVerticalScroll||(Math.abs(i)>Math.abs(o)&&(o=i),i=0),this.scroll.hasHorizontalScroll||(o=0),{x:o,y:i,directionX:o>0?-1:o<0?1:0,directionY:i>0?-1:i<0?1:0}},e.prototype.beforeHandler=function(e){var t=this.scroll.options,n=t.preventDefault,o=t.stopPropagation,i=t.preventDefaultException;n&&!function(e,t){for(var n in t)if(t[n].test(e[n]))return!0;return!1}(e.target,i)&&function(e){e.cancelable&&e.preventDefault()}(e),o&&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],o=e[2];t.off(n,o)}))},e.pluginName="mouseWheel",e.applyOrder="pre",e}(),Jn=function(){return Jn=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Jn.apply(this,arguments)},Kn="undefined"!=typeof window,Qn=Kn&&navigator.userAgent.toLowerCase();Qn&&/wechatdevtools/.test(Qn),Qn&&Qn.indexOf("android"),function(){if("string"==typeof Qn){var e=/os (\d\d?_\d(_\d)?)/.exec(Qn);if(!e)return!1;var t=e[1].split("_").map((function(e){return parseInt(e,10)}));13===t[0]&&t[1]}}();var Zn=!1;if(Kn)try{var eo={};Object.defineProperty(eo,"passive",{get:function(){Zn=!0}}),window.addEventListener("test-passive",(function(){}),eo)}catch(e){}function to(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}function no(e,t,n){return e<t?t:e>n?n:e}var oo=Kn&&document.createElement("div").style,io=function(){if(!Kn)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!==oo[n.value])return n.key}return!1}();function so(e){return!1===io?e:"standard"===io?"transitionEnd"===e?"transitionend":e:io+e.charAt(0).toUpperCase()+e.substr(1)}function ro(e,t,n,o){var i=Zn?{passive:!1,capture:!!o}:!!o;e.addEventListener(t,n,i)}function ao(e,t,n,o){e.removeEventListener(t,n,{capture:!!o})}function lo(e){e.cancelable&&e.preventDefault()}io&&"standard"!==io&&io.toLowerCase();var uo=so("transform");so("transition"),Kn&&so("perspective");var co=uo,po=so("transitionTimingFunction"),ho=so("transitionDuration"),mo=(so("transitionDelay"),so("transformOrigin"),so("transitionEnd"),so("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 o=this;void 0===n&&(n=this),this.hasType(e);var i=function(){for(var s=[],r=0;r<arguments.length;r++)s[r]=arguments[r];o.off(e,i);var a=t.apply(n,s);if(!0===a)return a};return i.fn=t,this.on(e,i),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 o=n.length;o--;)(n[o][0]===t||n[o][0]&&n[o][0].fn===t)&&n.splice(o,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 o=this.events[e];if(o)for(var i,s=o.length,r=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),i=0;for(t=0;t<n;t++)for(var s=arguments[t],r=0,a=s.length;r<a;r++,i++)o[i]=s[r];return o}(o),a=0;a<s;a++){var l=r[a],d=l[0],u=l[1];if(d&&!0===(i=d.apply(u,t)))return i}},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}()),go=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(ro)},e.prototype.removeDOMEvents=function(){this.handleDOMEvents(ao)},e.prototype.handleDOMEvents=function(e){var t=this,n=this.wrapper;this.events.forEach((function(o){e(n,o.name,t,!!o.capture)}))},e.prototype.handleEvent=function(e){var t=e.type;this.events.some((function(n){return n.name===t&&(n.handler(e),!0)}))},e}(),fo=function(){function e(e,t){this.indicator=e,this.options=t,this.hooks=new mo(["touchStart","touchMove","touchEnd"]),this.registerEvents()}return e.prototype.registerEvents=function(){var e=this.options,t=e.disableMouse,n=e.disableTouch,o=[],i=[],s=[];t||(o.push({name:"mousedown",handler:this.start.bind(this)}),i.push({name:"mousemove",handler:this.move.bind(this)}),s.push({name:"mouseup",handler:this.end.bind(this)})),n||(o.push({name:"touchstart",handler:this.start.bind(this)}),i.push({name:"touchmove",handler:this.move.bind(this)}),s.push({name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),this.startEventRegister=new go(this.indicator.indicatorEl,o),this.moveEventRegister=new go(window,i),this.endEventRegister=new go(window,s)},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;lo(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];lo(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,lo(e),e.stopPropagation(),this.hooks.trigger(this.hooks.eventTypes.touchEnd))},e.prototype.destroy=function(){this.startEventRegister.destroy(),this.moveEventRegister.destroy(),this.endEventRegister.destroy()},e}(),yo=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,o=t.interactive,i=t.scrollbarTrackClickable,s=this.scroll,r=s.hooks,a=s.scroller.translater.hooks,l=s.scroller.animater.hooks;if(this.registerHooks(r,r.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(s,s.eventTypes.scrollEnd,(function(){e.fade()})),this.registerHooks(s,s.eventTypes.scrollStart,(function(){e.fade(!0)})),s.eventTypes.mousewheelStart&&s.eventTypes.mousewheelEnd&&(this.registerHooks(s,s.eventTypes.mousewheelStart,(function(){e.fade(!0)})),this.registerHooks(s,s.eventTypes.mousewheelMove,(function(){e.fade(!0)})),this.registerHooks(s,s.eventTypes.mousewheelEnd,(function(){e.fade()})))),o){var d=this.scroll.options,u=d.disableMouse,c=d.disableTouch;this.eventHandler=new fo(this,{disableMouse:u,disableTouch:c});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)}i&&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 go(e,[{name:"click",handler:this.handleClick.bind(this)}])},e.prototype.handleClick=function(e){var t=this.calculateclickOffsetPos(e),n=this.scroll,o=n.x,i=n.y;o="horizontal"===this.direction?t:o,i="vertical"===this.direction?t:i,this.scroll.scrollTo(o,i,this.options.scrollbarTrackOffsetTime)},e.prototype.calculateclickOffsetPos=function(e){var t=this.keysMap,n=t.point,o=t.domRect,i=this.options.scrollbarTrackOffsetType,s=e[n]-this.wrapperRect[o],r=s<this.currentPos?-1:1,a=0,l=this.currentPos;return"step"===i?a=this.scrollInfo.baseSize*r:(a=0,l=s),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,o=t.fadeOutTime,i=e?n:o,s=this.wrapper;s.style[ho]=i+"ms",s.style.opacity=e?"1":"0"},e.prototype.refresh=function(){var e=this.keysMap.hasScroll,t=this.scroll,n=t.x,o=t.y;if(this.wrapperRect=this.wrapper.getBoundingClientRect(),this.canScroll(t[e])){var i=this.keysMap,s=i.wrapperSize,r=i.scrollerSize,a=i.maxScrollPos;this.scrollInfo=this.refreshScrollInfo(this.wrapper[s],t[r],t[a],this.indicatorEl[s]),this.updatePosition({x:n,y:o})}},e.prototype.transitionTime=function(e){void 0===e&&(e=0),this.indicatorEl.style[ho]=e+"ms"},e.prototype.transitionTimingFunction=function(e){this.indicatorEl.style[po]=e},e.prototype.canScroll=function(e){return this.wrapper.style.display=e?"block":"none",e},e.prototype.refreshScrollInfo=function(e,t,n,o){var i=Math.max(Math.round(e*e/(t||e||1)),this.options.minSize);this.options.isCustom&&(i=o);var s=e-i;return{baseSize:i,maxScrollPos:s,minScrollPos:0,sizeRatio:s/n}},e.prototype.updatePosition=function(e){var t=this.caculatePosAndSize(e,this.scrollInfo),n=t.pos,o=t.size;this.refreshStyle(o,n),this.currentPos=n},e.prototype.caculatePosAndSize=function(e,t){var n,o=this.keysMap.pos,i=t.sizeRatio,s=t.baseSize,r=t.maxScrollPos,a=t.minScrollPos,l=this.options.minSize,d=Math.round(i*e[o]);return d<a?(n=Math.max(s+3*d,l),d=a):d>r?d=r+s-(n=Math.max(s-3*(d-r),l)):n=s,{pos:d,size:n}},e.prototype.refreshStyle=function(e,t){var n=this.keysMap,o=n.translateProperty,i=n.size,s=this.scroll.options.translateZ;this.indicatorEl.style[i]=e+"px",this.indicatorEl.style[co]=o+"("+t+"px)"+s},e.prototype.startHandler=function(){this.moved=!1,this.startTime=to(),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,o=n.maxScrollPos;return t===n.minScrollPos&&e<=0||t===o&&e>=0},e.prototype.syncBScroll=function(e){var t=to(),n=this.scroll,o=n.x,i=n.y,s=n.options,r=n.scroller,a=n.maxScrollY,l=n.minScrollY,d=n.maxScrollX,u=n.minScrollX,c=s.probeType,p=s.momentumLimitTime,h={x:o,y:i};"vertical"===this.direction?h.y=no(e,a,l):h.x=no(e,d,u),r.translater.translate(h),t-this.startTime>p&&(this.startTime=t,1===c&&r.hooks.trigger(r.hooks.eventTypes.scroll,h)),c>1&&r.hooks.trigger(r.hooks.eventTypes.scroll,h)},e.prototype.newPos=function(e,t,n){var o=n.maxScrollPos,i=n.sizeRatio,s=e+t;return s=no(s,n.minScrollPos,o),Math.round(s/i)},e.prototype.destroy=function(){var e=this.options,t=e.interactive,n=e.scrollbarTrackClickable,o=e.isCustom;t&&this.eventHandler.destroy(),n&&this.clickEventRegister.destroy(),o||this.wrapper.parentNode.removeChild(this.wrapper),this.hooksFn.forEach((function(e){var t=e[0],n=e[1],o=e[2];t.off(n,o)})),this.hooksFn.length=0},e}(),vo=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=[],o=["scrollX","scrollY"],i=["horizontal","vertical"],s=this.options.customElements,r=0;r<o.length;r++){var a=o[r];if(t.options[a]){var l=s.shift(),d=i[r],u=!1,c=l||this.createScrollbarElement(d);c!==l?t.wrapper.appendChild(c):u=!0,e=Jn(Jn({wrapper:c,direction:d},this.options),{isCustom:u}),n.push(new yo(t,e))}}this.indicators=n},e.prototype.createScrollbarElement=function(e,t){void 0===t&&(t=this.options.scrollbarTrackClickable);var n=document.createElement("div"),o=document.createElement("div");return n.style.cssText="position:absolute;z-index:9999;overflow:hidden;",o.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;",o.className="bscroll-indicator","horizontal"===e?(n.style.cssText+="height:7px;left:2px;right:2px;bottom:0;",o.style.height="100%",n.className="bscroll-horizontal-scrollbar"):(n.style.cssText+="width:7px;bottom:2px;top:2px;right:1px;",o.style.width="100%",n.className="bscroll-vertical-scrollbar"),t||(n.style.cssText+="pointer-events:none;"),n.appendChild(o),n},e.pluginName="scrollbar",e}(),bo={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],o=t.options.scrollX,i=t.options.scrollY,s=n.options.scrollX,r=n.options.scrollY;o!==s&&i!==r||(e.forEach((function(t,n){var o=e[(n+1)%2];t.on("scrollStart",(function(){o.pending&&(o.stop(),o.resetPosition()),function(e){var t=So(e),n=t.hasHorizontalScroll,o=t.hasVerticalScroll,i=e.scroller,s=i.actions,r=i.scrollBehaviorX,a=i.scrollBehaviorY;s.startTime=+new Date,o?a.startPos=a.currentPos:n&&(r.startPos=r.currentPos)}(o),o.disable()})),t.on("touchEnd",(function(){o.enable()}))})),n.on("scrollStart",(function(){var e,o,i,s,r,a,l,d,u,c,p;o=So(e=n),i=o.hasHorizontalScroll,s=o.hasVerticalScroll,r=e.scroller,a=r.scrollBehaviorX,l=r.scrollBehaviorY,d=e.x>=e.minScrollX&&-1===a.movingDirection,u=e.x<=e.maxScrollX&&1===a.movingDirection,c=e.y>=e.minScrollY&&-1===l.movingDirection,p=e.y<=e.maxScrollY&&1===l.movingDirection,(s?c||p:i&&(d||u))&&(n.disable(),t.enable())})))}};function _o(e,t){for(var n=0,o=e.parentNode;o&&o!==t;)n++,o=o.parentNode;return n}function So(e){return{hasHorizontalScroll:e.scroller.scrollBehaviorX.hasScroll,hasVerticalScroll:e.scroller.scrollBehaviorY.hasScroll}}const Co=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,o,i,s=0;s<e.length;s++){n=(t=e[s]).wrapper;for(var r=0;r<e.length;r++)if(i=(o=e[r]).wrapper,t!==o&&i.contains(n))if(t.__parentInfo){var a=_o(n,i);t.__parentInfo.depth>a&&(t.__parentInfo={parent:o,depth:a})}else t.__parentInfo={parent:o,depth:_o(n,i)}}},e.prototype.handleCompatible=function(){var e=this.availableBScrolls(),t=["duplicateClick","nestedScroll"];e.forEach((function(e){t.forEach((function(t){bo[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 No=__webpack_require__(7685),Oo=__webpack_require__.n(No),Io="undefined"!=typeof window,wo=Io&&navigator.userAgent.toLowerCase();function Po(e,t,n){return e<t?t:e>n?n:e}wo&&/wechatdevtools/.test(wo),wo&&wo.indexOf("android");var xo=Io&&document.createElement("div").style,Eo=function(){if(!Io)return!1;var e={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var t in e)if(void 0!==xo[e[t]])return t;return!1}();function To(e){return!1===Eo?e:"standard"===Eo?"transitionEnd"===e?"transitionend":e:Eo+e.charAt(0).toUpperCase()+e.substr(1)}function Ao(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 ko(e,t){e.removeChild(t)}Eo&&"standard"!==Eo&&Eo.toLowerCase(),To("transform"),To("transition"),Io&&To("perspective"),To("transitionTimingFunction"),To("transitionDuration"),To("transitionDelay"),To("transformOrigin"),To("transitionEnd");var Do={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}}},Ro=Io&&window;Io&&(Ro.requestAnimationFrame||Ro.webkitRequestAnimationFrame||Ro.mozRequestAnimationFrame||Ro.oRequestAnimationFrame),Io&&(Ro.cancelAnimationFrame||Ro.webkitCancelAnimationFrame||Ro.mozCancelAnimationFrame||Ro.oCancelAnimationFrame);var Mo=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,o=Ao(e.wrapper),i=Ao(e.content);this.wrapperWidth=o.width,this.wrapperHeight=o.height,this.scrollerHeight=n.hasScroll?i.height:o.height,this.scrollerWidth=t.hasScroll?i.width:o.width;var s=this.slideOpt.stepX||this.wrapperWidth,r=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(s,r),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,o=0,i=this.pages.length;n<i-1&&!(e>=this.pages[n][0].cx);n++);for(i=this.pages[n].length;o<i-1&&!(t>=this.pages[0][o].cy);o++);return{pageX:n,pageY:o}}},e.prototype.computePagePosInfo=function(e,t){var n,o,i,s,r=[],a=0,l=0,d=this.scroll.scroller.scrollBehaviorX.maxScrollPos,u=this.scroll.scroller.scrollBehaviorY.maxScrollPos;for(o=Math.round(e/2),i=Math.round(t/2);a>-this.scrollerWidth;){for(r[l]=[],s=0,n=0;n>-this.scrollerHeight;)r[l][s]={x:Math.max(a,d),y:Math.max(n,u),width:e,height:t,cx:a-o,cy:n-i},n-=t,s++;a-=e,l++}return r},e.prototype.computePagePosInfoByEl=function(e){for(var t,n,o,i=[],s=0,r=0,a=0,l=e.length,d=0,u=-1,c=this.scroll.scroller.scrollBehaviorX.maxScrollPos,p=this.scroll.scroller.scrollBehaviorY.maxScrollPos;a<l;a++)o=Ao(e[a]),(0===a||o.left<=Ao(e[a-1]).left)&&(d=0,u++),i[d]||(i[d]=[]),s=Math.max(-o.left,c),r=Math.max(-o.top,p),t=s-Math.round(o.width/2),n=r-Math.round(o.height/2),i[d][u]={x:s,y:r,width:o.width,height:o.height,cx:t,cy:n},s>c&&d++;return i},e}(),Vo=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 Mo(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=[],o=0;o<t;o++)n.push(o);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 o=0;o<t.length;o++){var i=t[o];for(var s in i)e[s]=i[s]}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,o=this.pagesPos.yLen-1,i=0,s=0;return this.loopX&&(e+=1,i+=1,n-=1),this.loopY&&(t+=1,s+=1,o-=1),{realX:e=Po(e,i,n),realY:t=Po(t,s,o)}}},e.prototype.nextPage=function(){return this.changedPageNum("positive")},e.prototype.prevPage=function(){return this.changedPageNum("negative")},e.prototype.nearestPage=function(e,t,n,o){var i=this.pagesPos.getNearestPage(e,t);if(!i)return{x:0,y:0,pageX:0,pageY:0};var s=i.pageX,r=i.pageY;return s===this.currentPage.pageX&&(s=Po(s+=n,0,this.pagesPos.xLen-1)),r===this.currentPage.pageY&&(r+=o,r=Po(i.pageY,0,this.pagesPos.yLen-1)),{x:this.pagesPos.getPos(s,0).x,y:this.pagesPos.getPos(0,r).y,pageX:s,pageY:r}},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}(),jo=[{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}}));const Fo=function(){function e(e){this.scroll=e,this.resetLooping=!1,this.isTouching=!1,this.scroll.proxy(jo),this.scroll.registerType(["slideWillChange"]),this.slideOpt=this.scroll.options.slide,this.page=new Vo(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,o=!1;t.loop&&(n.children.length>1?(this.cloneSlideEleForLoop(n),o=!0):t.loop=!1);var i=this.setSlideWidth(n),s=this.setSlideHeight(this.scroll.scroller.wrapper,n),r=i||s,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),o||r?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(),o=n.pageX,i=n.pageY;this.goTo(o,i,e,t)},e.prototype.prev=function(e,t){var n=this.page.prevPage(),o=n.pageX,i=n.pageY;this.goTo(o,i,e,t)},e.prototype.goToPage=function(e,t,n,o){var i=this.page.realPage2Page(e,t);i&&this.goTo(i.realX,i.realY,n,o)},e.prototype.getCurrentPage=function(){return this.page.getRealPage()},e.prototype.nearestPage=function(e,t){var n=this.scroll.scroller.scrollBehaviorX,o=this.scroll.scroller.scrollBehaviorY,i=!0;return Math.abs(e-n.absStartPos)<=this.thresholdX&&Math.abs(t-o.absStartPos)<=this.thresholdY&&(i=!1),i?this.page.nearestPage(Po(e,n.maxScrollPos,n.minScrollPos),Po(t,o.maxScrollPos,o.minScrollPos),n.direction,o.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&&(ko(e,t[t.length-1]),ko(e,t[0]))}this.hooksFn.forEach((function(e){var t=e[0],n=e[1],o=e[2];t.eventTypes[n]&&t.off(n,o)})),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,o,i=e.children;t=i[i.length-1].cloneNode(!0),(o=(n=e).firstChild)?function(e,t){t.parentNode.insertBefore(e,t)}(t,o):n.appendChild(t),e.appendChild(i[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,o=this.page.nearestPage(Po(this.scroll.x,t.maxScrollPos,t.minScrollPos),Po(this.scroll.y,n.maxScrollPos,n.minScrollPos),0,0),i={x:o.x,y:o.y,pageX:o.pageX,pageY:o.pageY};this.page.isSameWithCurrent(i)||this.page.changeCurrentPage(i)}var s=this.page.resetLoopPage();if(s)return this.resetLooping=!0,this.goTo(s.pageX,s.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,o=0;o<t.length;o++)t[o].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,o=t.children,i=0;i<o.length;i++)o[i].style.height=n+"px";return t.style.height=n*o.length+"px",!0},e.prototype.goTo=function(e,t,n,o){void 0===t&&(t=0);var i=this.page.change2safePage(e,t);if(i){var s=o||this.slideOpt.easing||Do.bounce,r=i.x,a=i.y,l=r-this.scroll.scroller.scrollBehaviorX.currentPos,d=a-this.scroll.scroller.scrollBehaviorY.currentPos;(l||d)&&(n=void 0===n?this.getAnimateTime(l,d):n,this.page.changeCurrentPage({x:r,y:a,pageX:i.pageX,pageY:i.pageY}),this.pageWillChangeTo(this.page.currentPage),this.scroll.scroller.scrollTo(r,a,n,s))}},e.prototype.flickHandler=function(){var e=this.scroll.scroller.scrollBehaviorX,t=this.scroll.scroller.scrollBehaviorY,n=e.currentPos-e.startPos,o=t.currentPos-t.startPos,i=this.getAnimateTime(n,o);this.goTo(this.page.currentPage.pageX+e.direction,this.page.currentPage.pageY+t.direction,i)},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||Do.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}();Fn.use(vo),Fn.use(Co),Fn.use(Yn),Fn.use(Fo);class Uo extends n().Component{constructor(e){super(e),this.scrollNeedsToInit=!1,this.scrollRef=n().createRef()}componentDidMount(){this.props.scrollEnabled&&!0!==this.props.nativeScroll&&this.setupIScroll(),this.scrollRef.current&&(this.scrollRef.current.noodlNode=this.props.noodlNode)}componentWillUnmount(){this.iScroll&&(this.iScroll.destroy(),this.iScroll=void 0),this.props.noodlNode.context.setNodeFocused(this.props.noodlNode,!1)}componentDidUpdate(){this.scrollNeedsToInit&&(this.setupIScroll(),this.scrollNeedsToInit=!1),this.iScroll&&setTimeout((()=>{this.iScroll&&this.iScroll.refresh()}),0)}scrollToIndex(e,t){var n,o;if(this.iScroll){const o=null===(n=this.scrollRef.current)||void 0===n?void 0:n.children[0].children[e];o&&this.iScroll.scrollToElement(o,t,0,0)}else{const t=null===(o=this.scrollRef.current)||void 0===o?void 0:o.children[e];t&&t.scrollIntoView({behavior:"smooth"})}}scrollToElement(e,t){if(!e)return;const n=i().findDOMNode(e.getRef());n&&n.scrollIntoView&&(this.iScroll?this.iScroll.scrollToElement(n,t,0,0):n.scrollIntoView({behavior:"smooth"}))}setupIScroll(){const{scrollSnapEnabled:e}=this.props,t=this.getScrollDirection(),n={disableSetWidth:!0,disableSetHeight:!0,loop:!1},o=this.scrollRef.current;this.iScroll=new Fn(o,{bounceTime:500,swipeBounceTime:300,scrollbar:this.props.showScrollbar?{}:void 0,momentum:!e||!this.props.scrollSnapToEveryItem,bounce:this.props.scrollBounceEnabled&&!(e&&n.loop),scrollX:"x"===t||"both"===t,scrollY:"y"===t||"both"===t,slide:e?n:void 0,probeType:this.props.onScrollPositionChanged?3:1,click:!0,nestedScroll:!0,useTransition:!1});const i=this.iScroll.scroller;i.scrollBehaviorX&&(i.scrollBehaviorX.momentum=Oo().bind(i.scrollBehaviorX)),i.scrollBehaviorY&&(i.scrollBehaviorY.momentum=Oo().bind(i.scrollBehaviorY)),this.iScroll.on("beforeScrollStart",(()=>{this.iScroll.refresh()})),this.iScroll.on("scrollStart",(()=>{this.props.onScrollStart&&this.props.onScrollStart()})),this.iScroll.on("scrollEnd",(()=>{this.props.onScrollEnd&&this.props.onScrollEnd()})),this.props.onScrollPositionChanged&&this.iScroll.on("scroll",(()=>{this.props.onScrollPositionChanged("x"===t?-this.iScroll.x:-this.iScroll.y)}))}UNSAFE_componentWillReceiveProps(e){(this.props.scrollSnapEnabled!==e.scrollSnapEnabled||this.props.onScrollPositionChanged!==e.onScrollPositionChanged||this.props.onScrollStart!==e.onScrollStart||this.props.onScrollEnd!==e.onScrollEnd||this.props.showScrollbar!==e.showScrollbar||this.props.scrollEnabled!==e.scrollEnabled||this.props.nativeScroll!==e.nativeScroll||this.props.scrollSnapToEveryItem!==e.scrollSnapToEveryItem||this.props.layout!==e.layout||this.props.flexWrap!==e.flexWrap||this.props.scrollBounceEnabled!==e.scrollBounceEnabled)&&(this.iScroll&&(this.iScroll.destroy(),this.iScroll=void 0),this.scrollNeedsToInit=e.scrollEnabled&&!e.nativeScroll)}renderIScroll(){const{flexDirection:e,flexWrap:t}=this.props.style,o={display:"inline-flex",flexShrink:0,flexDirection:e,flexWrap:t,touchAction:"none"};return"row"===e?"wrap"===t?o.width="100%":o.height="100%":"wrap"===t?o.height="100%":o.width="100%",n().createElement("div",{className:"scroll-wrapper-internal",style:o},this.props.children)}getScrollDirection(){return"wrap"===this.props.flexWrap||"wrap-reverse"===this.props.flexWrap?"row"===this.props.layout?"y":"x":"row"===this.props.layout?"x":"y"}render(){const{as:e="div",...t}=this.props,o=t.scrollEnabled&&!t.nativeScroll?this.renderIScroll():t.children,i={...t.style};if(x.size(i,t),x.align(i,t),t.clip&&(i.overflowX="hidden",i.overflowY="hidden"),t.scrollEnabled&&t.nativeScroll){const e=this.getScrollDirection();"y"===e?i.overflowY="auto":"x"===e?i.overflowX="auto":"both"===e&&(i.overflowX="auto",i.overflowY="auto")}return 0===i.opacity&&(i.pointerEvents="none"),n().createElement(e,{className:t.className,...t.attrs,...t.dom,...ne(t),style:i,ref:this.scrollRef},o)}}const Wo={name:"Group",docs:"https://docs.noodl.net/nodes/basic-elements/group",connectionPanel:{groupPriority:["General","Style","Events","Mounted","Hover Events","Pointer Events","Focus","Scroll"]},initialize(){this.props.attrs={},this._internal={scrollElementDuration:500,scrollIndexDuration:500,scrollIndex:0},this.props.layout="column"},getReactComponent:()=>Uo,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",type:{name:"enum",enums:[{label:"None",value:"none"},{label:"Vertical",value:"column"},{label:"Horizontal",value:"row"}]},default:"column",set(e){this.props.layout=e,"none"!==e?this.setStyle({flexDirection:e}):this.removeStyle(["flexDirection"]),this.context.editorConnection&&("none"===e||Ne.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()}},"scrollToIndex.do":{displayName:"Scroll To Index - Do",group:"Scroll To Index",type:"signal",index:505,valueChangedToTrue(){this.scheduleAfterInputsHaveUpdated((()=>{if(!this.innerReactComponentRef)return;const e=this._internal.scrollIndex,t=this._internal.scrollIndexDuration;this.innerReactComponentRef.scrollToIndex(e,t)}))}},"scrollToElement.do":{displayName:"Scroll To Element - Do",group:"Scroll To Element",type:"signal",index:500,valueChangedToTrue(){this.innerReactComponentRef&&this.scheduleAfterInputsHaveUpdated((()=>{const e=this._internal.scrollElement,t=this._internal.scrollElementDuration;this.innerReactComponentRef.scrollToElement(e,t)}))}},"scrollToElement.element":{displayName:"Scroll To Element - Element",group:"Scroll To Element",type:"reference",index:501,set(e){this._internal.scrollElement=e}},"scrollToElement.duration":{displayName:"Scroll To Element - Duration",group:"Scroll To Element",type:"number",default:500,index:502,set(e){this._internal.scrollElementDuration=e}},"scrollToIndex.index":{displayName:"Scroll To Index - Index",group:"Scroll To Index",type:"number",default:0,index:506,set(e){this._internal.scrollIndex=e}},"scrollToIndex.duration":{displayName:"Scroll To Index - Duration",group:"Scroll To Index",type:"number",default:500,index:507,set(e){this._internal.scrollIndexDuration=e}},focus:{displayName:"Focus",type:"signal",group:"Focus",valueChangedToTrue(){this.context.setNodeFocused(this,!0)}},testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}},inputProps:{clip:{index:19,displayName:"Clip Content",type:"boolean",group:"Layout",default:!1},scrollEnabled:{index:54,group:"Scroll",displayName:"Enable Scroll",type:"boolean",default:!1},scrollSnapEnabled:{index:55,displayName:"Snap",group:"Scroll",type:"boolean",default:!1},scrollSnapToEveryItem:{index:56,displayName:"Snap To Every Item",group:"Scroll",type:"boolean",default:!1},showScrollbar:{index:57,displayName:"Show Scrollbar",group:"Scroll",type:"boolean",default:!1},scrollBounceEnabled:{index:58,displayName:"Bounce at boundaries",group:"Scroll",type:"boolean",default:!0},nativeScroll:{index:60,group:"Scroll",displayName:"Native platform scroll",type:"boolean",default:!0},as:{index:1e5,group:"Advanced HTML",displayName:"Tag",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",type:{name:"enum",enums:[{label:"Start",value:"flex-start"},{label:"End",value:"flex-end"},{label:"Center",value:"center"}],alignComp:"align-items"},default:"flex-start"},justifyContent:{index:14,group:"Align and justify content",displayName:"Justify Content",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",group:"Layout",type:{name:"enum",enums:[{label:"Off",value:"nowrap"},{label:"On",value:"wrap"},{label:"On Reverse",value:"wrap-reverse"}]},default:"nowrap",onChange(e){this.props.flexWrap=e,this.forceUpdate()},applyDefault:!1},alignContent:{index:16,group:"Layout",displayName:"Align Content",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",group:"Layout",type:{name:"number",units:["px","%","em"],defaultUnit:"px"},default:0,applyDefault:!1},columnGap:{index:18,displayName:"Horizontal Gap",group:"Layout",type:{name:"number",units:["px","%","em"],defaultUnit:"px"},default:0,applyDefault:!1},backgroundColor:{index:201,displayName:"Background Color",group:"Style",type:"color",default:"transparent",applyDefault:!1,allowVisualStates:!0}},outputProps:{onScrollPositionChanged:{displayName:"Scroll Position",type:"number",group:"Scroll"},onScrollStart:{displayName:"Scroll Start",type:"signal",group:"Scroll"},onScrollEnd:{displayName:"Scroll End",type:"signal",group:"Scroll"}},outputs:{focused:{displayName:"Focused",type:"signal",group:"Focus"},focusLost:{displayName:"Focus Lost",type:"signal",group:"Focus"}},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(){this.sendSignalOnOutput("focused")},_blur(){this.sendSignalOnOutput("focusLost")}}};var Lo;F.addDimensions(Wo),F.addTransformInputs(Wo),F.addSharedVisualInputs(Wo),F.addPaddingInputs(Wo),F.addMarginInputs(Wo),F.addAlignInputs(Wo),F.addPointerEventOutputs(Wo),F.addBorderInputs(Wo),F.addShadowInputs(Wo),Noodl.runDeployed||((Lo=Wo).inputProps.clip.tooltip=k({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"}]}),Lo.inputCss.flexWrap.tooltip=k({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 Bo=Z(Wo);function $o(e){const t={userSelect:"none",...e.style};x.size(t,e),x.align(t,e);let o="ndl-visual-icon";return e.className&&(o=o+" "+e.className),n().createElement("div",{className:o,style:t},function(){const t={};return"image"===e.iconSourceType&&void 0!==e.iconImageSource?(t.width=e.iconSize,t.height=e.iconSize,n().createElement("img",{alt:"",src:e.iconImageSource,style:t})):"icon"===e.iconSourceType&&void 0!==e.iconIconSource?(t.fontSize=e.iconSize,t.color=e.iconColor,t.lineHeight=1,n().createElement("div",{style:{lineHeight:0}},!0===e.iconIconSource.codeAsClass?n().createElement("span",{className:[e.iconIconSource.class,e.iconIconSource.code].join(" "),style:t}):n().createElement("span",{className:e.iconIconSource.class,style:t},e.iconIconSource.code))):null}())}const qo={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:()=>$o};F.addAlignInputs(qo),F.addTransformInputs(qo),F.addPaddingInputs(qo,{defaults:{paddingTop:5,paddingRight:5,paddingBottom:5,paddingLeft:5}}),F.addMarginInputs(qo),F.addIconInputs(qo,{hideEnableIconInput:!0,defaults:{useIcon:!0}}),F.addSharedVisualInputs(qo);const zo=Z(qo);function Ho(e){var t,o;const i={...e.style};if(x.size(i,e),x.align(i,e),0===i.opacity&&(i.pointerEvents="none"),null===(o=null===(t=e.dom)||void 0===t?void 0:t.src)||void 0===o?void 0:o.startsWith("/")){const t=Noodl.Env.BaseUrl;t&&(e.dom.src=t+e.dom.src.substring(1))}return n().createElement("img",{...e.attrs,className:e.className,...e.dom,...ne(e),style:i})}const Go={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(){this.props.attrs={},this.props.default=""},getReactComponent:()=>Ho,getInspectInfo(){if(this.props.dom.srcSet)return this.props.dom.srcSet;if(this.props.dom.src){const e=this.props.dom.src.toString();return[{type:"text",value:e},{type:"image",value:e}]}},allowChildren:!1,defaultCss:{display:"block",flexShrink:0},inputCss:{objectFit:{displayName:"Image Fit",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",propPath:"dom",type:{name:"image"},index:30,allowVisualStates:!0,set(e){this.props.dom.src=(0,s.getAbsoluteUrl)(e),this.forceUpdate()}},testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}},inputProps:{srcSet:{displayName:"Source Set",group:"Image",propPath:"dom",type:{name:"string"},index:31,allowVisualStates:!0},alt:{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"},onError:{displayName:"On Error",propPath:"dom",type:"signal",group:"Events"}}};F.addDimensions(Go,{defaultSizeMode:"contentSize",contentLabel:"Image"}),F.addTransformInputs(Go),F.addMarginInputs(Go),F.addSharedVisualInputs(Go),F.addAlignInputs(Go),F.addPointerEventOutputs(Go),F.addBorderInputs(Go),F.addShadowInputs(Go);const Xo=Z(Go);function Yo(e){const{as:t="div"}=e,o={...e.textStyle,...e.style};return x.size(o,e),x.align(o,e),o.color=e.noodlNode.context.styles.resolveColor(o.color),"contentSize"===e.sizeMode||"contentWidth"===e.sizeMode?o.whiteSpace="pre":(o.whiteSpace="pre-wrap",o.overflowWrap="anywhere"),0===o.opacity&&(o.pointerEvents="none"),n().createElement(t,{className:["ndl-visual-text",e.className].join(" "),...e.attrs,...e.dom,...ne(e),style:o},String(e.text))}const Jo={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"},initialize(){this.props.attrs={}},getReactComponent:()=>Yo,getInspectInfo(){return this.props.text},defaultCss:{position:"relative",display:"flex"},inputProps:{text:{index:19,group:"Text",displayName:"Text",default:"Text",type:{name:"string",multiline:!0}},as:{index:1e5,group:"Advanced HTML",displayName:"Tag",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"}},inputs:{textAlignX:{group:"Text Alignment",index:13,displayName:"Text Horizontal Align",type:{name:"enum",enums:[{label:"left",value:"left"},{label:"center",value:"center"},{label:"right",value:"right"}],alignComp:"justify"},default:"left",set(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",type:{name:"enum",enums:[{label:"Top",value:"top"},{label:"Center",value:"center"},{label:"Bottom",value:"bottom"}],alignComp:"vertical"},default:"top",set(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"})}}},testId:{index:100009,displayName:"Test ID Attribute",group:"Advanced HTML",type:"string",set(e){this.props.attrs["data-testid"]=e,this.forceUpdate()}}}};F.addDimensions(Jo,{defaultSizeMode:"contentHeight",contentLabel:"Text"}),F.addTextStyleInputs(Jo),F.addAlignInputs(Jo),F.addTransformInputs(Jo),F.addMarginInputs(Jo),F.addSharedVisualInputs(Jo),F.addPointerEventOutputs(Jo),Noodl.runDeployed||function(e){e.inputCss.wordBreak.tooltip=k({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"]})}(Jo);const Ko=Z(Jo);class Qo extends n().PureComponent{constructor(){super(...arguments),this.video=null}componentDidUpdate(){var e,t,n,o,i;this.video&&(this.video.muted=null!==(e=this.props.muted)&&void 0!==e&&e,this.video.loop=null!==(t=this.props.loop)&&void 0!==t&&t,this.video.volume=null!==(n=this.props.volume)&&void 0!==n?n:1,this.video.autoplay=null!==(o=this.props.autoplay)&&void 0!==o&&o,this.video.controls=null!==(i=this.props.controls)&&void 0!==i&&i)}render(){let e=this.props.src?this.props.src.toString():void 0;if(e&&(-1===e.indexOf("#t=")&&(e+="#t=0.01"),e.startsWith("/"))){const t=Noodl.Env.BaseUrl;t&&(e=t+e.substring(1))}return n().createElement("video",{...this.props,playsInline:!0,src:e,...ne(this.props),ref:e=>{this.video=e,this.props.innerRef(e)}})}}class Zo extends n().Component{constructor(e){super(e),this.video=null,this.wantToPlay=!1,this.canPlay=!1}componentWillUnmount(){this.canPlay=!1}setSourceObject(e){this.video&&this.video.srcObject!==e&&(this.video.srcObject=e,this.canPlay=!1)}play(){this.wantToPlay=!0,this.video&&this.canPlay&&this.video.play()}restart(){this.wantToPlay=!0,this.video&&this.canPlay&&(this.video.currentTime=0,this.video.play())}pause(){this.wantToPlay=!1,this.video&&this.video.pause()}reset(){this.wantToPlay=!1,this.video&&(this.video.currentTime=0,this.video.pause())}render(){const e=this.props,t={...e.style};return x.size(t,e),x.align(t,e),0===t.opacity&&(t.pointerEvents="none"),t.objectPosition=`${e.objectPositionX} ${e.objectPositionY}`,n().createElement(Qo,{...e.dom,className:e.className,style:t,innerRef:e=>{this.video=e,this.props.onVideoElementCreated&&this.props.onVideoElementCreated(e)},onCanPlay:()=>{this.canPlay=!0,this.wantToPlay&&this.video.play(),this.props.onCanPlay&&this.props.onCanPlay(),this.props.videoWidth&&this.props.videoWidth(this.video.videoWidth),this.props.videoHeight&&this.props.videoHeight(this.video.videoHeight)}})}}const ei={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:()=>Zo,allowChildren:!1,noodlNodeAsProp:!0,defaultCss:{display:"block"},inputs:{srcObject:{displayName:"Source Object",group:"Video",type:"mediastream",default:null,set(e){this.innerReactComponentRef&&this.innerReactComponentRef.setSourceObject(e)}},play:{type:"signal",group:"Video Actions",displayName:"Play",tooltip:{standard:"Play the video"},valueChangedToTrue(){this.innerReactComponentRef&&this.innerReactComponentRef.play()}},restart:{type:"signal",group:"Video Actions",displayName:"Restart",tooltip:{standard:"Restart the video from the beginning"},valueChangedToTrue(){this.innerReactComponentRef&&this.innerReactComponentRef.restart()}},pause:{type:"boolean",group:"Video Actions",displayName:"Pause",valueChangedToTrue(){this.innerReactComponentRef&&this.innerReactComponentRef.pause()}},reset:{type:"boolean",group:"Video Actions",displayName:"Reset",valueChangedToTrue(){this.innerReactComponentRef&&this.innerReactComponentRef.reset()}},src:{displayName:"Source",group:"Video",type:"string",set(e){this.props.dom.src=(0,s.getAbsoluteUrl)(e),this.forceUpdate()}},poster:{displayName:"Poster",group:"Video",type:"image",set(e){this.props.dom.poster=(0,s.getAbsoluteUrl)(e),this.forceUpdate()}}},inputProps:{autoplay:{displayName:"Autoplay",propPath:"dom",group:"Video",type:"boolean"},controls:{displayName:"Controls",propPath:"dom",group:"Video",type:"boolean"},volume:{displayName:"Volume",propPath:"dom",group:"Video",type:"number",default:1},muted:{displayName:"Muted",propPath:"dom",group:"Video",type:"boolean"},loop:{displayName:"Loop",propPath:"dom",group:"Video",type:"boolean"},objectPositionX:{displayName:"Video Position X",group:"Video Layout",type:{name:"number",units:["%","px"],defaultUnit:"%"},default:50},objectPositionY:{displayName:"Video Position Y",group:"Video Layout",type:{name:"number",units:["%","px"],defaultUnit:"%"},default:50}},inputCss:{objectFit:{displayName:"Object Fit",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:{onCanPlay:{type:"signal",group:"Events",displayName:"On Can Play"},onTimeUpdate:{group:"Playback",displayName:"Playback Position",type:"number",propPath:"dom",getValue:e=>e.target.currentTime},onPlay:{group:"Events",displayName:"On Play",type:"signal",propPath:"dom"},onPause:{group:"Events",displayName:"On Pause",type:"signal",propPath:"dom"},onVideoElementCreated:{type:"domelement",displayName:"DOM Element"},videoWidth:{group:"Playback",type:"number",displayName:"Video Width"},videoHeight:{group:"Playback",type:"number",displayName:"Video Height"}}};F.addDimensions(ei,{defaultSizeMode:"contentSize",contentLabel:"Video"}),F.addTransformInputs(ei),F.addMarginInputs(ei),F.addSharedVisualInputs(ei),F.addAlignInputs(ei),F.addPointerEventOutputs(ei),F.addBorderInputs(ei);const ti=Z(ei);var ni=__webpack_require__(5072),oi=__webpack_require__.n(ni),ii=__webpack_require__(4960);oi()(ii.A,{insert:"head",singleton:!1}),ii.A.locals;class si{constructor({graphModel:e,nodeRegister:t,getNodeScope:n}){this.getNodeScope=n,this.graphModel=e,this.nodeRegister=t,this.setStyles(e.getMetaData("styles")||{}),e.on("metadataChanged.styles",(e=>this.setStyles(e)))}setStyles(e){this.styles=e;const t=e.text||{};Object.values(t).filter((e=>e.fontFamily)).forEach((e=>{let t=e.fontFamily;t.split(".").length>1&&(A.instance.loadFont(t),t=t.replace(/\.[^/.]+$/,""),t=t.split("/").pop(),e.fontFamily=t)}));for(const e in t){const n=t[e];for(const e in n){const t=n[e];"object"==typeof t&&(n[e]=t.value+t.unit)}}for(const e in t){const n=t[e];n.hasOwnProperty("color")&&!n.color&&delete n.color}const n=this.getNodeScope&&this.getNodeScope();if(!n)return;const o=this.graphModel.getVariants();for(const e of o)this._variantHasInputsWithTypes(e,["color","textStyle"])&&n.getAllNodesWithVariantRecursive(e).forEach((t=>t.setVariant(e)));["color","textStyle"].forEach((e=>{(function(e,t){const n=[];return e.getAllNodesRecursive().forEach((e=>{const o=[];for(const n in e._inputs)e._inputs[n].type===t&&o.push(n);o.length&&n.push({node:e,inputs:o})})),n})(n,e).forEach((({node:e,inputs:t})=>{t.forEach((t=>{e.getInputValue(t)&&e.setInputValue(t,e.getInputValue(t))}))}))}))}resolveColor(e){if(!this.styles.colors)return e;return this.styles.colors[e]||e}getTextStyle(e){return this.styles.text&&this.styles.text[e]||{}}_variantHasInputsWithTypes(e,t){if(!this.nodeRegister.hasNode(e.typename))return;const n=this.nodeRegister.getNodeMetadata(e.typename),o=new Set(Object.keys(e.parameters));for(const t in e.stateParameters)Object.keys(e.stateParameters[t]).forEach((e=>o.add(e)));for(const e of Array.from(o)){const o=n.inputs[e]&&n.inputs[e].type;if(t.includes(o))return!0}return!1}}"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:null,setHighlighter(e){this.highlighter=e,this.highlighter.setWindowSelected(window.NoodlEditorInspectorAPI.enabled)},selectNode(e){this.highlighter.deselectNodes(),e&&"null"!==e?this.highlighter.selectNodesWithId(e):window.NoodlEditorInspectorAPI.enabled&&this.highlighter.setWindowSelected(!0)}});class ri extends n().Component{constructor(t){super(t),this.state={popups:[]};const{noodlRuntime:n}=t;this.runningDeployed=void 0!==this.props.projectData,this.focusedNoodlNodes=[],n.context.setNodeFocused=this.setNodeFocused.bind(this);const o="undefined"!=typeof document&&-1!==document.location.href.indexOf("forceDebugger=true")||Noodl.enableDebugInspectors;if(n.setDebugInspectorsEnabled(o),n.context.setPopupCallbacks({onShow:e=>{const t=this.state.popups.concat([e]);n.getProjectSettings().bodyScroll&&1===t.length&&(document.body.style.width=document.body.clientWidth+"px",document.body.style.top=`-${window.scrollY}px`,document.body.style.position="fixed"),this.setState({popups:t})},onClose: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"))}}}),function(t){[__webpack_require__(8044),__webpack_require__(1407),__webpack_require__(8355),__webpack_require__(3631),__webpack_require__(1391),__webpack_require__(7518),__webpack_require__(8423),__webpack_require__(8129),__webpack_require__(7387),__webpack_require__(5250),__webpack_require__(5071),__webpack_require__(1358),__webpack_require__(374),__webpack_require__(7183),__webpack_require__(8355),__webpack_require__(3235),__webpack_require__(619),__webpack_require__(2610),__webpack_require__(4986),__webpack_require__(6065),__webpack_require__(1579),__webpack_require__(7397),__webpack_require__(1749),__webpack_require__(1088),__webpack_require__(6439),__webpack_require__(4380),__webpack_require__(2653),__webpack_require__(3817),__webpack_require__(7949),__webpack_require__(2390),__webpack_require__(6552),__webpack_require__(655),__webpack_require__(8064),__webpack_require__(3700),__webpack_require__(5738),__webpack_require__(320),__webpack_require__(7095),__webpack_require__(6982),__webpack_require__(5178),__webpack_require__(2457),__webpack_require__(2228),__webpack_require__(7154)].forEach((function(e){t.registerNode(e)})),t.registerNode(vt()),t.registerNode(Bo),t.registerNode(Ko),t.registerNode(Xo),t.registerNode(zo),t.registerNode(ct),t.registerNode(ti),t.registerNode(Nt),t.registerNode(e),t.registerNode(ft),t.registerNode(ue),t.registerNode(he),t.registerNode(Ie),t.registerNode(Se),t.registerNode(fe),t.registerNode(Fe),t.registerNode($e),t.registerNode(Ye),t.registerNode(tt),t.registerNode(st)}(n),function(e){const t="undefined"!=typeof window?window:globalThis;t.Noodl.getProjectSettings=e.getProjectSettings.bind(e),t.Noodl.getMetaData=e.getMetaData.bind(e),t.Noodl.Collection=t.Noodl.Array=s.Collection,t.Noodl.Model=t.Noodl.Object=s.Model,t.Noodl.Variables=t.Noodl.Object.get("--ndl--global-variables"),t.Noodl.Events=t.Noodl.eventEmitter=e.context.eventSenderEmitter,t.Noodl.Records=(0,s.createRecordsAPI)(),t.Noodl.Users=h(),t.Noodl.CloudFunctions=g(),t.Noodl.Navigation=b,t.Noodl.Navigation._noodlRuntime=e,t.Noodl.Files=C,t.Noodl.SEO=new c,t.Noodl.Env||(t.Noodl.Env={}),t.Noodl.Arrays=new Proxy(t.Noodl.Array,{get:(e,t,n)=>Noodl.Array.get(t),set(e,t,n){if(!Array.isArray(n))throw new Error("Cannot assign non array value to array with id "+t);return Noodl.Array.get(t).set(n),!0}}),t.Noodl.Objects=new Proxy(t.Noodl.Object,{get:(e,t,n)=>Noodl.Object.get(t),set:(e,t,n)=>(Noodl.Object.get(t).setAll(n),!0)})}(n),n.setProjectSettings(N),this.props.noodlModules)for(const e of this.props.noodlModules){if(e.reactNodes){const t=[];for(const n of e.reactNodes)t.push(Z(n));const n=e.nodes||[];e.nodes=n.concat(t)}n.registerModule(e)}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 si({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.focusedNoodlNodes=[]}connectToEditor(){const{noodlRuntime:e}=this.props,t=((Noodl.host||location.protocol+"//"+location.host)+location.pathname+(location.search?location.search:"")).replace("http","ws");e.connectToEditor(t),this.highlightedNodes=new Map,this.isUpdatingHighlights=!1,"undefined"!=typeof window&&window.NoodlEditor&&(this.highlighter=new a(e),NoodlEditorHighlightAPI.setHighlighter(this.highlighter),e.editorConnection.on("hoverStart",(e=>{this.highlighter.highlightNodesWithId(e)})),e.editorConnection.on("hoverEnd",(e=>{this.highlighter.disableHighlight()})),this.inspector=new d({onDisableHighlight:()=>this.highlighter.disableHighlight(),onHighlight:e=>this.highlighter.highlightNodesWithId(e),onInspect:e=>{NoodlEditor.inspectNodes(e)}}),NoodlEditorInspectorAPI.setInspector(this.inspector)),e.editorConnection.on("debuggingEnabledChanged",(t=>{e.setDebugInspectorsEnabled(t)})),this.graphWarnings=new r(e.graphModel,e.editorConnection)}setNodeFocused(e,t){if(t&&-1===this.focusedNoodlNodes.indexOf(e))this.focusedNoodlNodes.filter((t=>!t.contains(e))).forEach((e=>{e._blur()})),e._focus(),this.focusedNoodlNodes.push(e);else if(!t){const t=this.focusedNoodlNodes.indexOf(e);if(-1!==t)return;e._blur(),this.focusedNoodlNodes.filter((t=>t.contains(e))).forEach((e=>{e._blur()})),this.focusedNoodlNodes.splice(t,1)}}onClickCapture(e){const t=[];let n=e.target;for(;n;)n.noodlNode&&n.noodlNode._focus&&t.push(n.noodlNode),n=n.parentNode;this.focusedNoodlNodes.filter((e=>-1===t.indexOf(e))).forEach((e=>e._blur())),t.filter((e=>-1===this.focusedNoodlNodes.indexOf(e))).forEach((e=>e._focus())),this.focusedNoodlNodes=t}render(){const e=this.props.noodlRuntime.rootComponent;if(this.state.waitingForExport)return null;if(!e)return this.runningDeployed?null:n().createElement("div",{style:{overflowY:"auto",padding:"24px",fontFamily:"Open Sans",fontSize:"16px",width:"100vw",height:"100vh",backgroundColor:"#F57569"}},n().createElement("div",{style:{marginBottom:"50px",fontWeight:"bold",display:"flex",alignItems:"center"}},n().createElement("span",null,"ERROR"),n().createElement("img",{src:"ndl_assets/noodl-logo-black.svg",style:{marginLeft:"auto"}})),n().createElement("div",{style:{margin:"0 auto",alignItems:"center",display:"flex",flexDirection:"column"}},n().createElement("div",{style:{fontSize:"24px",textAlign:"center",marginBottom:"50px"}},"No"," ",n().createElement("img",{src:"ndl_assets/home-icon.svg",style:{marginRight:"-6px"}})," ",n().createElement("span",{style:{fontWeight:"bold"}},"HOME")," component selected"),n().createElement("div",{style:{textAlign:"center"}},"Click ",n().createElement("span",{style:{fontWeight:"bold"}},"Make home")," as shown below."),n().createElement("img",{style:{marginTop:"24px"},srcSet:"ndl_assets/make-home-instructions@2x.png 2x"})));if(this.props.noodlRuntime.getProjectSettings().bodyScroll){const t={margin:0,padding:0,minHeight:"100vh",alignSelf:"stretch",display:"flex",flexDirection:"column"};return n().createElement("div",{style:t,onClickCapture:e=>this.onClickCapture(e)},n().createElement("div",{style:{...t,isolation:"isolate"}},e.render()),this.state.popups.length?n().createElement("div",{style:{...t,isolation:"isolate"}},this.state.popups.map((e=>e.render()))):null)}return n().createElement("div",{style:{margin:0,padding:0,overflow:"hidden",width:"100%",height:"100%"},onClickCapture:e=>this.onClickCapture(e)},e.render(),this.state.popups.map((e=>e.render())))}}function ai(){return"undefined"==typeof window?{type:"browser",platform:{requestUpdate:e=>setImmediate(e),getCurrentTime:()=>0,objectToString:e=>JSON.stringify(e,null,2)},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__/")}}String.prototype.matchAll||(String.prototype.matchAll=function(e){const t=new RegExp(e,"g"),n=[],o=this.match(t);if(o)for(let t in o){const i=o[t];n[t]=i.match(new RegExp(e))}return n});const li={render(e,t,{isLocal:o=!1}){const r=ai();o&&(r.platform.isRunningLocally=()=>!0);const a=new s.default(r);i().render(n().createElement(ri,{noodlRuntime:a,noodlModules:t},null),e)},renderDeployed(e,t,n){e.children.length>0&&e.children[0].hasAttribute("data-reactroot")?i().hydrate(this.createElement(t,n),e):i().render(this.createElement(t,n),e)},createElement(e,t){const o=new s.default({...ai(),runDeployed:!0});return n().createElement(ri,{noodlRuntime:o,noodlModules:e,projectData:t},null)}};window.ELECTRON_DISABLE_SECURITY_WARNINGS=!0,window.Noodl._viewerReact=li})()})();
//# sourceMappingURL=noodl.viewer.js.map