UNPKG

@tripetto/runner-autoscroll

Version:

Autoscroll UI for running Tripetto forms and surveys.

2 lines β€’ 816 kB
/*! Tripetto Autoscroll Runner 8.2.3 - Copyright (C) 2023 Tripetto B.V. - All Rights Reserved */ !function(){var e={129:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return{contract:{name:"@tripetto/runner-autoscroll",version:"8.2.3"},customLocale:!0,availableTranslations:["en","de","es","fr","id","nl","pl","pt"],strings:["runner#1|πŸ†— ButtonsBack","runner#1|πŸ†— ButtonsDiscard","runner#1|πŸ†— ButtonsNext","runner#1|πŸ†— ButtonsReload","runner#1|πŸ†— ButtonsRetry","runner#1|πŸ†— ButtonsStart","runner#1|πŸ†— ButtonsStart again","runner#1|πŸ†— ButtonsSubmit","runner#2|πŸ’¬ Messages|Conversation closedNothing to talk about. The conversation is closed 🀐","runner#2|πŸ’¬ Messages|Conversation closedπŸ‘‹ Hi there!","runner#2|πŸ’¬ Messages|Conversation endedπŸŽ‰ It's a wrap!","runner#2|πŸ’¬ Messages|Conversation pausedThe conversation is now paused.","runner#2|πŸ’¬ Messages|Conversation paused⏸ Paused","runner#3|🩺 Status information%1 of %2 answered","runner#3|🩺 Status informationNothing to answer","runner#3|🩺 Status informationPausing...","runner#3|🩺 Status informationSubmitting...","runner#3|🩺 Status information⏳ One moment please...","runner#6|πŸ“‚ File uploadAllowed extensions: %1","runner#6|πŸ“‚ File uploadChoose or drag a file here","runner#6|πŸ“‚ File uploadDelete","runner#6|πŸ“‚ File uploadDrop your file now","runner#6|πŸ“‚ File uploadExtension is not allowed.","runner#6|πŸ“‚ File uploadFile size is too large.","runner#6|πŸ“‚ File uploadSize limit: %1","runner#6|πŸ“‚ File uploadSomething went wrong while uploading%1.","runner#6|πŸ“‚ File uploadThis file can't be used.","runner#6|πŸ“‚ File uploadToo many files selected.","runner#6|πŸ“‚ File uploadTry again","runner#6|πŸ“‚ File uploadUploading (%1)","runner#6|πŸ”· Yes/NoNo","runner#6|πŸ”· Yes/NoYes","runner#8|⏸ Pause conversationCancel pausing","runner#8|⏸ Pause conversationPause this conversation","runner#8|⏸ Pause conversationReceive a link by email to resume later on any device, right where you left off.","runner#8|⏸ Pause conversationReceive resume link","runner#8|⏸ Pause conversationYour email address...","runner#9|⚠ Errors|Connection errorPlease check your connection and try again (for the techies: The error console of your browser might contain more technical information about what went wrong).",["runner#9|⚠ Errors|Input error%1 item requires your attention! Click to fix.","%1 items require your attention! Click to fix."],"runner#9|⚠ Errors|Outdated errorIt seems the form is changed by the owner while you were filling in the form. Your data cannot be processed, but you can try to reload the new version of the form while maintaining the data you've filled in. Click the reload button to try this. Please check your data after reloading and then submit again.","runner#9|⚠ Errors|Outdated errorIt seems the form is changed by the owner while you were filling in the form. Your data cannot be processed. Try reloading the form.","runner#9|⚠ Errors|Pausing errorSomething went wrong while pausing your conversation.","runner#9|⚠ Errors|Rejected errorUnfortunately, your data is marked as invalid and therefore rejected. If you believe this is a mistake, please contact the form owner. We're sorry for the inconvenience.","runner#9|⚠ Errors|Submit errorSomething went wrong while submitting your conversation.","runner#9|⚠ Errors|Submit errorThe form is outdated.","runner#9|⚠ Errors|Submit errorYour data is rejected."]}}},174:function(e,t,o){!function(){"use strict";var t={4533:function(e,t,o){var i,n=this&&this.__extends||(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),l=this&&this.__decorate||function(e,t,o,i){var n,l=arguments.length,a=l<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,i);else for(var r=e.length-1;r>=0;r--)(n=e[r])&&(a=(l<3?n(a):l>3?n(t,o,a):n(t,o))||a);return l>3&&a&&Object.defineProperty(t,o,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.Calculator=void 0;var a=o(9954),r=o(3208),c=o(5331),s=o(4583),u=o(4617),d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allowMarkdown=!1,t.startBlank=!0,t.operations=a.Collection.of(r.Operation,t),t}var o;return n(t,e),o=t,Object.defineProperty(t.prototype,"block",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"label",{get:function(){return(0,a.npgettext)("block:calculator","%2 (%1 operation)","%2 (%1 operations)",this.operations.count,this.type.label)},enumerable:!1,configurable:!0}),t.prototype.defineName=function(){var e,t=this;if(!this.node.name&&!this.operations.count){var i=0,n=1;null===(e=this.map)||void 0===e||e.forEach((function(e){if("@tripetto/block-calculator"===e.blockTypeIdentifier&&(i++,e.name&&0===e.name.indexOf(o.label+" "))){var t=(0,a.castToNumber)(e.name.substr(o.label.length+1));t>n&&(n=t+1)}}),"nodes"),this.node.name=o.label+" ".concat(a.Num.max(n,i))}this.outcome.hook("OnSlotProperty","synchronous",(function(e){switch(e.property){case"precision":case"digits":case"decimal":case"separator":case"minimum":case"maximum":case"prefix":case"prefixPlural":case"suffix":case"suffixPlural":t.slots.each((function(o){o instanceof a.Slots.Numeric&&"dynamic"===o.kind&&(0,a.set)(o,e.property,t.outcome[e.property])}))}}),this)},t.prototype.defineSlot=function(){this.outcome=this.slots.static({type:a.Slots.Numeric,reference:"calculator",label:this.node.name||(0,a.pgettext)("block:calculator","Calculation"),exchange:["alias","exportable","precision","digits","decimal","separator","minimum","maximum","prefix","prefixPlural","suffix","suffixPlural"]})},t.prototype.defineEditor=function(){var e=this,t=new a.Forms.Numeric(a.Forms.Numeric.bind(this.outcome,"minimum",void 0)).precision(this.outcome.precision||0).digits(this.outcome.digits||0).decimalSign(this.outcome.decimal||"").thousands(!!this.outcome.separator,this.outcome.separator||"").prefix(this.outcome.prefix||"").prefixPlural(this.outcome.prefixPlural||void 0).suffix(this.outcome.suffix||"").suffixPlural(this.outcome.suffixPlural||void 0).label((0,a.pgettext)("block:calculator","Minimum")),o=new a.Forms.Numeric(a.Forms.Numeric.bind(this.outcome,"maximum",void 0)).precision(this.outcome.precision||0).digits(this.outcome.digits||0).decimalSign(this.outcome.decimal||"").thousands(!!this.outcome.separator,this.outcome.separator||"").prefix(this.outcome.prefix||"").prefixPlural(this.outcome.prefixPlural||void 0).suffix(this.outcome.suffix||"").suffixPlural(this.outcome.suffixPlural||void 0).label((0,a.pgettext)("block:calculator","Maximum")),i=this.editor.form({controls:[new a.Forms.Notification((0,a.pgettext)("block:calculator","Some formatting options were automatically set for you, based on the block you've just selected as initial value."),"success")]}).visible(!1),n=(0,a.getHelpTopic)("block:calculator");this.editor.form({title:(0,a.pgettext)("block:calculator","Explanation"),controls:[new a.Forms.Static((0,a.pgettext)("block:calculator","Perform a calculation and use the result in your form%1.",n?" ([".concat((0,a.pgettext)("block:calculator","learn more"),"](").concat(n,"))"):"")).markdown()]}),this.editor.option({name:(0,a.pgettext)("block:calculator","Operations"),collection:(0,c.calculator)(this),activated:!0,locked:!0}),this.editor.name(!1,!1,(0,a.pgettext)("block:calculator","Description"),!1),this.editor.groups.settings();var l=new a.Forms.Dropdown([{optGroup:(0,a.pgettext)("block:calculator","Decimals")},{label:"#",value:0},{label:"#.#",value:1},{label:"#.##",value:2},{label:"#.###",value:3},{label:"#.####",value:4},{label:"#.#####",value:5},{label:"#.######",value:6},{label:"#.#######",value:7},{label:"#.########",value:8},{optGroup:(0,a.pgettext)("block:calculator","Digits")},{label:"##",value:-2},{label:"###",value:-3},{label:"####",value:-4},{label:"#####",value:-5},{label:"######",value:-6},{label:"#######",value:-7},{label:"########",value:-8},{label:"#########",value:-9},{label:"##########",value:-10},{label:"###########",value:-11},{label:"############",value:-12},{label:"#############",value:-13},{label:"##############",value:-14},{label:"###############",value:-15},{label:"################",value:-16}],(this.outcome.digits?-this.outcome.digits:this.outcome.precision)||0).on((function(){e.outcome.precision=l.isFeatureEnabled&&(0,a.isNumber)(l.value)&&l.value>=0?l.value:void 0,e.outcome.digits=l.isFeatureEnabled&&(0,a.isNumber)(l.value)&&l.value<0?-l.value:void 0,t.precision(e.outcome.precision||0),o.precision(e.outcome.precision||0),t.digits(e.outcome.digits||0),o.digits(e.outcome.digits||0),s.disabled(!e.outcome.precision),v.disabled((e.outcome.digits||0)>0)})),r=this.editor.option({name:(0,a.pgettext)("block:calculator","Format"),form:{title:(0,a.pgettext)("block:calculator","Format"),controls:[l]},activated:(0,a.isNumber)(this.outcome.precision)||(0,a.isNumber)(this.outcome.digits)}),s=new a.Forms.Dropdown([{label:"#.#",value:"."},{label:"#,#",value:","}],a.Forms.Dropdown.bind(this.outcome,"decimal",void 0)).label((0,a.pgettext)("block:calculator","Decimal sign")).disabled(!this.outcome.precision).on((function(e){t.decimalSign(e.isFeatureEnabled&&e.value||""),o.decimalSign(e.isFeatureEnabled&&e.value||"")})),u=new a.Forms.Dropdown([{label:(0,a.pgettext)("block:calculator","None"),value:void 0},{label:"#,###",value:","},{label:"#.###",value:"."}],a.Forms.Dropdown.bind(this.outcome,"separator",void 0)).label((0,a.pgettext)("block:calculator","Thousands separator")).on((function(e){t.thousands(!(!e.isFeatureEnabled||!e.value),e.isFeatureEnabled&&e.value||""),o.thousands(!(!e.isFeatureEnabled||!e.value),e.isFeatureEnabled&&e.value||"")}));this.editor.option({name:(0,a.pgettext)("block:calculator","Limits"),form:{title:(0,a.pgettext)("block:calculator","Limits"),controls:[t,o]},activated:(0,a.isNumber)(this.outcome.minimum)||(0,a.isNumber)(this.outcome.maximum)});var d=new a.Forms.Text("singleline",a.Forms.Text.bind(this.outcome,"prefix",void 0)).sanitize(!1).on((function(e){t.prefix(e.isFeatureEnabled&&e.value||""),o.prefix(e.isFeatureEnabled&&e.value||"")})),p=new a.Forms.Text("singleline",a.Forms.Text.bind(this.outcome,"prefixPlural",void 0)).indent(32).sanitize(!1).on((function(e){t.prefixPlural(e.isFeatureEnabled&&e.isObservable&&e.value||void 0),o.prefixPlural(e.isFeatureEnabled&&e.isObservable&&e.value||void 0)})).placeholder((0,a.pgettext)("block:calculator","Prefix when value is plural")).visible((0,a.isString)(this.outcome.prefixPlural)),b=new a.Forms.Checkbox((0,a.pgettext)("block:calculator","Specify different prefix for plural values"),(0,a.isString)(this.outcome.prefixPlural)).on((function(e){d.placeholder(e.isChecked&&(0,a.pgettext)("block:calculator","Prefix when value is singular")||""),p.visible(e.isChecked)})),g=this.editor.option({name:(0,a.pgettext)("block:calculator","Prefix"),form:{title:(0,a.pgettext)("block:calculator","Prefix"),controls:[d,b,p]},activated:(0,a.isString)(this.outcome.prefix)}),f=new a.Forms.Text("singleline",a.Forms.Text.bind(this.outcome,"suffix",void 0)).sanitize(!1).on((function(e){t.suffix(e.isFeatureEnabled&&e.value||""),o.suffix(e.isFeatureEnabled&&e.value||"")})),M=new a.Forms.Text("singleline",a.Forms.Text.bind(this.outcome,"suffixPlural",void 0)).indent(32).sanitize(!1).on((function(e){t.suffixPlural(e.isFeatureEnabled&&e.isObservable&&e.value||void 0),o.suffixPlural(e.isFeatureEnabled&&e.isObservable&&e.value||void 0)})).placeholder((0,a.pgettext)("block:calculator","Suffix when value is plural")).visible((0,a.isString)(this.outcome.suffixPlural)),m=new a.Forms.Checkbox((0,a.pgettext)("block:calculator","Specify different suffix for plural values"),(0,a.isString)(this.outcome.suffixPlural)).on((function(e){f.placeholder(e.isChecked&&(0,a.pgettext)("block:calculator","Suffix when value is singular")||""),M.visible(e.isChecked)})),h=this.editor.option({name:(0,a.pgettext)("block:calculator","Suffix"),form:{title:(0,a.pgettext)("block:calculator","Suffix"),controls:[f,m,M]},activated:(0,a.isString)(this.outcome.suffix)}),v=this.editor.option({name:(0,a.pgettext)("block:calculator","Signs"),form:{title:(0,a.pgettext)("block:calculator","Signs"),controls:[s,u,new a.Forms.Static((0,a.pgettext)("block:calculator","**Note:** These signs are used to format the number in de dataset. When the number is displayed in a runner, the appropriate user locale might be applied making it seem like changing these settings has no effect.")).markdown()]},activated:(0,a.isString)(this.outcome.separator)||(0,a.isString)(this.outcome.decimal),disabled:(this.outcome.digits||0)>0});this.editor.groups.options(),this.editor.visibility(),this.editor.alias(this.outcome),this.editor.exportable(this.outcome),this.preselect=function(t){var o=!1;!t.precision&&!t.digits||r.isActivated||(l.value=t.digits?-t.digits:t.precision,o=!0,r.activate()),!t.decimal&&!t.separator||v.isActivated||(s.value=t.decimal,u.value=t.decimal,o=!0,v.activate()),!t.prefix&&!t.prefixPlural||g.isActivated||(d.value=t.prefix||"",o=!0,t.prefixPlural&&(p.value=t.prefixPlural,b.check()),g.activate()),!t.suffix&&!t.suffixPlural||h.isActivated||(f.value=t.suffix||"",o=!0,t.suffixPlural&&(M.value=t.suffixPlural,m.check()),h.activate()),o&&(i.visible(!0),(0,a.scheduleTimeout)((function(){i.visible(!1)}),1e4)),e.preselect=void 0}},t.prototype.defineCondition=function(){var e=this,t=function(e,t){return(0,a.each)([{mode:"equal",label:(0,a.pgettext)("block:calculator","Calculation is equal to")},{mode:"not-equal",label:(0,a.pgettext)("block:calculator","Calculation is not equal to")},{mode:"below",label:(0,a.pgettext)("block:calculator","Calculation is lower than")},{mode:"above",label:(0,a.pgettext)("block:calculator","Calculation is higher than")},{mode:"between",label:(0,a.pgettext)("block:calculator","Calculation is between")},{mode:"not-between",label:(0,a.pgettext)("block:calculator","Calculation is not between")},{mode:"defined",label:(0,a.pgettext)("block:calculator","Calculation is valid")},{mode:"undefined",label:(0,a.pgettext)("block:calculator","Calculation is not valid")}],(function(o){e.template({condition:s.CalculatorCondition,label:o.label,autoOpen:"defined"!==o.mode&&"undefined"!==o.mode,props:{slot:t,mode:o.mode,value:0,to:"between"===o.mode||"not-between"===o.mode?0:void 0}})}))};this.slots.count>1?this.slots.each((function(o){o.label&&t(e.conditions.group(o.label),o)})):t(this.conditions,this.outcome)},l([a.definition,(0,a.affects)("#name")],t.prototype,"operations",void 0),l([a.assigned],t.prototype,"defineName",null),l([a.slots,a.renamed],t.prototype,"defineSlot",null),l([a.editor],t.prototype,"defineEditor",null),l([a.conditions],t.prototype,"defineCondition",null),o=l([(0,a.tripetto)({type:"node",legacyBlock:!0,identifier:"@tripetto/block-calculator",version:"4.0.3",icon:u.default,get label(){return(0,a.pgettext)("block:calculator","Calculator")},kind:"headless"})],t)}(a.NodeBlock);t.Calculator=d},5331:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.calculator=void 0;var i=o(9954),n=o(3208),l=o(4238);t.calculator=function(e,t,o){return void 0===t&&(t=(0,i.pgettext)("block:calculator","Initial value is the last outcome (ANS).")),{collection:e.operations,banner:o,title:(0,i.pgettext)("block:calculator","Operations"),icon:!0,allowAutoSorting:!1,allowCleanup:(0,i.pgettext)("block:calculator","Remove invalid operations"),placeholder:(0,i.pgettext)("block:calculator","Invalid operation"),allowVariables:!0,allowFormatting:!0,markdown:i.Markdown.MarkdownFeatures.Formatting|i.Markdown.MarkdownFeatures.InlineCode,showAliases:function(t){var o;return null===(o=e.block.slots.select(t.id,"dynamic"))||void 0===o?void 0:o.alias},onReposition:function(e){return e.refresh("name")},onResize:e instanceof n.Operation&&function(){return e.refresh("name")}||void 0,menu:function(){return(0,l.operatorMenu)(e,e instanceof n.Operation)},emptyMessage:{message:e instanceof n.Operation||!e.startBlank?"**"+t+"**\n\n"+(0,i.pgettext)("block:calculator","Click the + button to add an operation.")+"\n\n"+(0,i.pgettext)("block:calculator","Use **=** operation to set another initial value."):"**"+(0,i.pgettext)("block:calculator","Every calculation begins with an initial value.")+"**\n\n"+(0,i.pgettext)("block:calculator","Click the + button to specify that value.")+"\n\n"+(0,i.pgettext)("block:calculator","After that you can add more operations."),height:96}}}},4583:function(e,t,o){var i,n=this&&this.__extends||(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),l=this&&this.__decorate||function(e,t,o,i){var n,l=arguments.length,a=l<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,i);else for(var r=e.length-1;r>=0;r--)(n=e[r])&&(a=(l<3?n(a):l>3?n(t,o,a):n(t,o))||a);return l>3&&a&&Object.defineProperty(t,o,a),a};Object.defineProperty(t,"__esModule",{value:!0}),t.CalculatorCondition=void 0;var a=o(9954),r=o(4617),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allowMarkdown=!0,t.mode="equal",t}return n(t,e),Object.defineProperty(t.prototype,"label",{get:function(){return""},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){var e=this.slot;if(e instanceof a.Slots.Numeric){var t=this.parse(e,this.value);switch(this.mode){case"between":return"".concat(t," ≀ @").concat(e.id," ≀ ").concat(this.parse(e,this.to));case"not-between":return"@".concat(e.id," < ").concat(t," ").concat((0,a.pgettext)("block:calculator","or")," @").concat(e.id," > ").concat(this.parse(e,this.to));case"defined":return"@".concat(e.id," ").concat((0,a.pgettext)("block:calculator","calculated"));case"undefined":return"@".concat(e.id," ").concat((0,a.pgettext)("block:calculator","not calculated"));case"not-equal":return"@".concat(e.id," β‰  ").concat(t);case"above":case"below":case"equal":return"@".concat(e.id," ").concat("above"===this.mode?">":"below"===this.mode?"<":"="," ").concat(t)}}return this.type.label},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){var e,t;return(null===(e=this.slot)||void 0===e?void 0:e.label)||(null===(t=this.node)||void 0===t?void 0:t.label)},enumerable:!1,configurable:!0}),t.prototype.parse=function(e,t){var o;return(0,a.isNumberFinite)(t)?e.toString(t,(function(e,t){return a.L10n.locale.number(e,t,!1)})):(0,a.isString)(t)&&t&&(null===(o=(0,a.lookupVariable)(this,t))||void 0===o?void 0:o.label)?"@".concat(t):"\\_\\_"},t.prototype.defineEditor=function(){var e=this;this.editor.form({title:(0,a.pgettext)("block:calculator","Compare mode"),controls:[new a.Forms.Radiobutton([{label:(0,a.pgettext)("block:calculator","Calculation is equal to"),value:"equal"},{label:(0,a.pgettext)("block:calculator","Calculation is not equal to"),value:"not-equal"},{label:(0,a.pgettext)("block:calculator","Calculation is lower than"),value:"below"},{label:(0,a.pgettext)("block:calculator","Calculation is higher than"),value:"above"},{label:(0,a.pgettext)("block:calculator","Calculation is between"),value:"between"},{label:(0,a.pgettext)("block:calculator","Calculation is not between"),value:"not-between"},{label:(0,a.pgettext)("block:calculator","Calculation is valid"),value:"defined"},{label:(0,a.pgettext)("block:calculator","Calculation is not valid"),value:"undefined"}],a.Forms.Radiobutton.bind(this,"mode","equal")).on((function(e){switch(o.visible("defined"!==e.value&&"undefined"!==e.value),i.visible("between"===e.value||"not-between"===e.value),e.value){case"equal":o.title=(0,a.pgettext)("block:calculator","If calculation equals");break;case"not-equal":o.title=(0,a.pgettext)("block:calculator","If calculation not equals");break;case"below":o.title=(0,a.pgettext)("block:calculator","If calculation is lower than");break;case"above":o.title=(0,a.pgettext)("block:calculator","If calculation is higher than");break;case"between":o.title=(0,a.pgettext)("block:calculator","If calculation is between");break;case"not-between":o.title=(0,a.pgettext)("block:calculator","If calculation is not between")}}))]});var t=function(t,o,i){var n,l=e[t],r=e.slot,c=new a.Forms.Numeric((0,a.isNumberFinite)(l)?l:0).label((0,a.pgettext)("block:calculator","Use fixed number")).precision((null==r?void 0:r.precision)||0).digits((null==r?void 0:r.digits)||0).decimalSign((null==r?void 0:r.decimal)||"").thousands(!!(null==r?void 0:r.separator),(null==r?void 0:r.separator)||"").prefix((null==r?void 0:r.prefix)||"").prefixPlural((null==r?void 0:r.prefixPlural)||void 0).suffix((null==r?void 0:r.suffix)||"").suffixPlural((null==r?void 0:r.suffixPlural)||void 0).min(null==r?void 0:r.minimum).max(null==r?void 0:r.maximum).autoFocus("value"===t).escape(e.editor.close).enter((function(){return("between"!==e.mode&&"not-between"!==e.mode||"to"===t)&&e.editor.close()})).on((function(o){o.isFormVisible&&o.isObservable&&(e[t]=o.value)})),s=(0,a.populateVariables)(e,(function(e){return e instanceof a.Slots.Number||e instanceof a.Slots.Numeric}),(0,a.isString)(l)?l:void 0,!0,null===(n=e.slot)||void 0===n?void 0:n.id),u=new a.Forms.Dropdown(s,(0,a.isString)(l)?l:"").label((0,a.pgettext)("block:calculator","Use value of")).width("full").on((function(o){o.isFormVisible&&o.isObservable&&(e[t]=o.value||"")}));return e.editor.form({title:o,controls:[new a.Forms.Radiobutton([{label:(0,a.pgettext)("block:calculator","Number"),value:"number"},{label:(0,a.pgettext)("block:calculator","Value"),value:"variable",disabled:0===s.length}],(0,a.isString)(l)?"variable":"number").on((function(e){c.visible("number"===e.value),u.visible("variable"===e.value),c.isObservable&&c.focus()})),c,u]}).visible(i)},o=t("value",(0,a.pgettext)("block:calculator","If calculation equals"),"defined"!==this.mode&&"undefined"!==this.mode),i=t("to",(0,a.pgettext)("block:calculator","And"),"between"===this.mode||"not-between"===this.mode)},l([a.definition,(0,a.affects)("#name")],t.prototype,"mode",void 0),l([a.definition,(0,a.affects)("#name")],t.prototype,"value",void 0),l([a.definition,(0,a.affects)("#name")],t.prototype,"to",void 0),l([a.editor],t.prototype,"defineEditor",null),l([(0,a.tripetto)({type:"condition",legacyBlock:!0,context:"@tripetto/block-calculator",identifier:"@tripetto/block-calculator",version:"4.0.3",icon:r.default,get label(){return(0,a.pgettext)("block:calculator","Verify calculation")}})],t)}(a.ConditionBlock);t.CalculatorCondition=c},427:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.angleUnitsControl=void 0;var i=o(9954);t.angleUnitsControl=function(e,t,o,n){void 0===n&&(n="angleUnits");var l=e[n];return t.form({title:(0,i.pgettext)("block:calculator","Units"),controls:[new i.Forms.Radiobutton([{label:(0,i.pgettext)("block:calculator","Degrees")+" (Β°)",value:"degrees"},{label:(0,i.pgettext)("block:calculator","Radians")+" (rad)",value:"radians"},{label:(0,i.pgettext)("block:calculator","Gradians")+" (ᡍ)",value:"gradians"}],"radians"===l||"gradians"===l?l:"degrees").on((function(t){(0,i.setAny)(e,n,t.value||"degrees"),o&&o(t.value||"degrees")}))]})}},4588:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.constantControl=t.getConstantIcon=t.getConstantLabel=void 0;var i=o(9954),n=o(7680);function l(e){switch(e){case"Ο€":return"Ο€ β‰ˆ ".concat(i.L10n.locale.number(3.14159,"auto"));case"e":return"e β‰ˆ ".concat(i.L10n.locale.number(2.71828,"auto"));case"Ξ³":return"Ξ³ β‰ˆ ".concat(i.L10n.locale.number(.57722,"auto"));case"c":return"c = ".concat(i.L10n.locale.number(299792458)," m/s");case"random":return(0,i.pgettext)("block:calculator","Random value (0 to less than 1)");case"timestamp":return(0,i.pgettext)("block:calculator","UNIX time (seconds since Unix Epoch)");case"year":return(0,i.pgettext)("block:calculator","Year");case"month":return(0,i.pgettext)("block:calculator","Month (January = 1)");case"day":return(0,i.pgettext)("block:calculator","Day of month (1-31)");case"day-of-week":return(0,i.pgettext)("block:calculator","Day of week (Sunday = 0)");case"hour":return(0,i.pgettext)("block:calculator","Hour (0-23)");case"minute":return(0,i.pgettext)("block:calculator","Minute (0-59)");case"second":return(0,i.pgettext)("block:calculator","Second (0-59)");case"millisecond":return(0,i.pgettext)("block:calculator","Millisecond (0-999)");case"timezone":return(0,i.pgettext)("block:calculator","Timezone (in milliseconds)");case"branch":return(0,i.pgettext)("block:calculator","Branch number")}}t.getConstantLabel=l,t.getConstantIcon=function(e){switch(e){case"Ο€":case"e":case"Ξ³":case"c":return 59098;case"random":return 59015;case"timestamp":return 59274;case"year":case"month":case"day-of-week":return 59273;case"day":return 59272;case"hour":case"minute":case"second":case"millisecond":return 59624;case"timezone":return 59526;case"branch":return 59719}},t.constantControl=function(e,t,o,a,r){void 0===o&&(o="value"),void 0===a&&(a="form"),void 0===r&&(r=!0);var c=new i.Forms.Dropdown(n.CONSTANTS.map((function(e){return{label:l(e),value:e}})),(0,i.castToString)(e[o])).autoFocus(r).on((function(t){t.isFormVisible&&t.isObservable&&(0,i.setAny)(e,o,(0,n.castToConstant)(t.value))}));return"inline"===a?c.label((0,i.pgettext)("block:calculator","Use constant")):t.form({title:(0,i.pgettext)("block:calculator","Use constant"),controls:[c]})}},3146:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.explanationControl=void 0;var i=o(9954);t.explanationControl=function(e,t){return e.form({title:(0,i.pgettext)("block:calculator","Explanation"),controls:[new i.Forms.Static(t).markdown()]})}},4596:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.controls=void 0;var i=o(427),n=o(3146),l=o(5461),a=o(7066),r=o(3788),c=o(4588);t.controls={angles:i.angleUnitsControl,constant:c.constantControl,explanation:n.explanationControl,number:l.numberControl,type:a.typeControl,variable:r.variableControl}},5461:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.numberControl=void 0;var i=o(9954);t.numberControl=function(e,t,o,n,l,a){void 0===o&&(o="value"),void 0===n&&(n=!0),void 0===l&&(l=!0),void 0===a&&(a="form");var r=e[o],c=new i.Forms.Numeric((0,i.isNumberFinite)(r)?r:0).precision("auto").thousands(!1).autoFocus(l).on((function(t){t.isFormVisible&&t.isObservable&&(0,i.setAny)(e,o,t.value)}));return n&&(c.enter(t.close),c.escape(t.close)),"percentage"===o&&(c.suffix("%"),c.min(0)),["form"===a?t.form({title:(0,i.pgettext)("block:calculator","Use fixed number"),controls:[c]}):c.label((0,i.pgettext)("block:calculator","Use fixed number")),c]}},7066:function(e,t,o){var i=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,n=0,l=t.length;n<l;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.typeControl=void 0;var n=o(9954),l=o(4588),a=o(5461),r=o(3788),c=o(7680);t.typeControl=function(e,t,o,s,u,d,p,b,g,f){void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===u&&(u=!0),void 0===d&&(d="value"),void 0===p&&(p=!0),void 0===b&&(b=!0);var M,m=e[d],h=g?"inline":"form",v=new n.Forms.Radiobutton(i(i(i(i([],o?[{label:e.isSubCalculation&&e.isFirst?(0,n.pgettext)("block:calculator","Last outcome *(%1 parent calculation)*","ANS"):e.isFirst&&!e.calculator.startBlank?(0,n.pgettext)("block:calculator","Initial value"):(0,n.pgettext)("block:calculator","Last outcome *(%1)*","ANS"),value:"ans",disabled:!e.allowANS,markdown:!0}]:[],!0),u?[{label:(0,n.pgettext)("block:calculator","Number"),value:"number"}]:[],!0),[{label:(0,n.pgettext)("block:calculator","Value"),value:"variable"}],!1),s?[{label:(0,n.pgettext)("block:calculator","Constant"),value:"constant"}]:[],!0),(0,n.isString)(m)?(0,c.isConstant)(m)?"constant":"variable":(0,n.isNumberFinite)(m)||!o?"number":"ans").on((function(t){x[0].visible("number"===t.value),y[0].visible("variable"===t.value),w.visible("constant"===t.value),"ans"===t.value&&(0,n.setAny)(e,d,void 0),f&&f(t.value||"number","variable"===t.value&&y[2].value&&(0,n.lookupVariable)(e.calculator.block,y[2].value)||void 0)}));"form"===h&&(M=t.form({title:(0,n.pgettext)("block:calculator","Input"),controls:[v]}));var x=(0,a.numberControl)(e,t,d,p,b,h),y=(0,r.variableControl)(e,t,d,h,b,void 0,f&&function(t){f(v.value||"number","variable"===v.value&&t&&(0,n.lookupVariable)(e.calculator.block,t)||void 0)}),w=(0,l.constantControl)(e,t,d,h,b).visible((0,c.isConstant)((0,n.castToString)(m)));return x[0].visible((0,n.isNumberFinite)(m)||!o&&!(0,n.isString)(m)),y[0].visible((0,n.isString)(m)),v.buttonDisabled("variable",0===y[1]),x[0]instanceof n.Forms.Control&&y[0]instanceof n.Forms.Control&&w instanceof n.Forms.Control&&(M=t.form({title:g,markdown:!0,controls:[v,x[0],y[0],w]})),[M,x[1]]}},3788:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.variableControl=void 0;var i=o(9954);t.variableControl=function(e,t,o,n,l,a,r){void 0===o&&(o="value"),void 0===n&&(n="form"),void 0===l&&(l=!0),void 0===a&&(a=function(e){return e instanceof i.Slots.Number||e instanceof i.Slots.Numeric});var c=e[o],s=(0,i.populateVariables)(e.calculator.block,a,(0,i.isString)(c)?c:void 0),u=new i.Forms.Dropdown(s,(0,i.isString)(c)?c:"").placeholder(0===s.length?(0,i.pgettext)("block:calculator","No usable values found..."):"").autoFocus(l).on((function(t){t.isFormVisible&&t.isObservable&&(0,i.setAny)(e,o,t.value||""),r&&r(t.value||"")}));return["form"===n?t.form({title:(0,i.pgettext)("block:calculator","Use value of"),controls:[u]}):u.label((0,i.pgettext)("block:calculator","Use value of")),s.length,u]}},4238:function(e,t,o){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)},n=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,n=0,l=t.length;n<l;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.operatorChangeMenu=t.operatorMenu=void 0;var l=o(9954),a=o(4533),r=o(7680),c=o(4588),s=o(4387),u=o(7200),d=o(4750),p=o(6322),b=o(6456),g=o(4908),f=o(2547),M=o(4948);t.operatorMenu=function(e,t){return void 0===t&&(t=!1),e.startBlank&&0===e.operations.count&&!t?m(e,!1)("+"):[new l.Components.MenuSubmenuWithImage(u.default,(0,l.pgettext)("block:calculator","Add"),(function(){return m(e,t)("+")})),new l.Components.MenuSubmenuWithImage(d.default,(0,l.pgettext)("block:calculator","Subtract"),(function(){return m(e,t)("-")})),new l.Components.MenuSubmenuWithImage(p.default,(0,l.pgettext)("block:calculator","Multiply"),(function(){return m(e,t)("*")})),new l.Components.MenuSubmenuWithImage(b.default,(0,l.pgettext)("block:calculator","Divide"),(function(){return m(e,t)("/")})),new l.Components.MenuSeparator,new l.Components.MenuSubmenuWithImage(s.default,(0,l.pgettext)("block:calculator","Equal"),(function(){return m(e,t)("=")}))]},t.operatorChangeMenu=function(e){return[new l.Components.MenuItemWithImage(u.default,(0,l.pgettext)("block:calculator","Add"),(function(){return e.operator="+"}),"+"===e.operator),new l.Components.MenuItemWithImage(d.default,(0,l.pgettext)("block:calculator","Subtract"),(function(){return e.operator="-"}),"-"===e.operator),new l.Components.MenuItemWithImage(p.default,(0,l.pgettext)("block:calculator","Multiply"),(function(){return e.operator="*"}),"*"===e.operator),new l.Components.MenuItemWithImage(b.default,(0,l.pgettext)("block:calculator","Divide"),(function(){return e.operator="/"}),"/"===e.operator),new l.Components.MenuSeparator,new l.Components.MenuItemWithImage(s.default,(0,l.pgettext)("block:calculator","Equal"),(function(){return e.operator="="}),"="===e.operator)]};var m=function(e,t){return function(o){var i=t||e.startBlank&&0===e.operations.count||"="!==o,a=[];a.push(new l.Components.MenuItemWithIcon(59254,(0,l.pgettext)("block:calculator","Number"),(function(){return e.operations.append().set({operator:o,opcode:"number",value:"/"===o?1:0,open:!0})})));var r=y(e,o);return a.push(new l.Components.MenuSubmenuWithIcon(59105,(0,l.pgettext)("block:calculator","Score"),h(e,o),!1,!1),new l.Components.MenuSubmenuWithIcon(59449,(0,l.pgettext)("block:calculator","Comparison"),(function(){var t=v(e,o);return n([new l.Components.MenuItemWithIcon(e.startBlank||e.operations.count>0?59239:59644,e.startBlank||e.operations.count>0?(0,l.pgettext)("block:calculator","Last outcome (%1)","ANS"):(0,l.pgettext)("block:calculator","Initial value"),(function(){return e.operations.append().set({operator:o,opcode:"equation",value:void 0,cona:0,conb:0,outa:1,outb:0,open:!0})}),0===e.operations.count&&e.startBlank),new l.Components.MenuSubmenuWithIcon(59273,(0,l.pgettext)("block:calculator","Date/time"),[new l.Components.MenuItem((0,l.pgettext)("block:calculator","Current date"),(function(){return e.operations.append().set({operator:o,opcode:"date",value:void 0,cona:l.DateTime.UTCToday,conb:void 0,outa:1,outb:0,open:!0})})),new l.Components.MenuItem((0,l.pgettext)("block:calculator","Current date + time"),(function(){return e.operations.append().set({operator:o,opcode:"datetime",value:void 0,cona:l.DateTime.UTC,conb:void 0,outa:1,outb:0,open:!0})}))])],t,!0)})),new l.Components.MenuSubmenuWithIcon(58927,(0,l.pgettext)("block:calculator","Function"),(function(){return x(o,e.operations,i)})),new l.Components.MenuItemWithIcon(59238,(0,l.pgettext)("block:calculator","Subcalculation"),(function(){return e.operations.append().set({operator:o,opcode:"calc",open:!0})}))),r.length>0&&(r[0]instanceof l.Components.MenuSeparator||a.push(new l.Components.MenuSeparator,new l.Components.MenuLabel((0,l.pgettext)("block:calculator","Blocks"))),a.push.apply(a,r)),a}},h=function(e,t){var o,i=[],n=function(e){if((null==e?void 0:e.id)!==o){var t=null==e?void 0:e.name;i.length>0&&i.push(new l.Components.MenuSeparator),t&&i.push(new l.Components.MenuLabel(t)),o=null==e?void 0:e.id}},a=function(o,a){var r,c,s,u,d=l.Collection.find(a),p=(0,l.getMetadata)(a.block,"calculator");if(d||p&&(null===(c=p[(null===(r=a.slot)||void 0===r?void 0:r.reference)||"*"]||p["*"])||void 0===c?void 0:c.scores)){n(o.block.node.section);var b=null===(u=null===(s=a.slot)||void 0===s?void 0:s.slots)||void 0===u?void 0:u.select("score","feature");if(b){var g=[];w(g,t,e.operations,{type:"slot",block:o.block,label:b.alias||(0,l.pgettext)("block:calculator","Existing score"),icon:o.icon||o.block.type.icon,id:b.id,reference:b.reference,slot:b},!1,!0),g.push(new l.Components.MenuItemWithIcon(59147,(0,l.pgettext)("block:calculator","New score"),(function(){return e.operations.append().set({operator:t,opcode:"score",value:a.id,open:!0})}))),i.push(new l.Components.MenuSubmenuWithImage(o.icon||o.block.type.icon,o.label,g))}else i.push(new l.Components.MenuItemWithImage(o.icon||o.block.type.icon,o.label,(function(){return e.operations.append().set({operator:t,opcode:"score",value:a.id,open:!0})})))}};return(0,l.each)((0,l.populateSlots)(e.block,{mode:"validated",pipes:"include-consumed-slots"}),(function(o){o.slots?(0,l.findFirst)(o.slots,(function(r){var c,s;if("pipe"===r.type){if(l.Collection.find(r)){var u=null===(s=null===(c=r.slot)||void 0===c?void 0:c.slots)||void 0===s?void 0:s.select("score","feature");if(n(o.block.node.section),u){var d=[];w(d,t,e.operations,{type:"slot",block:o.block,label:u.alias||(0,l.pgettext)("block:calculator","Existing score"),icon:o.icon||o.block.type.icon,id:u.id,reference:u.reference,slot:u},!1,!0),d.push(new l.Components.MenuItemWithIcon(59147,(0,l.pgettext)("block:calculator","New score"),(function(){return e.operations.append().set({operator:t,opcode:"score",value:r.id,open:!0})}))),i.push(new l.Components.MenuSubmenuWithImage(o.icon||o.block.type.icon,o.label,d))}else i.push(new l.Components.MenuItemWithImage(o.icon||o.block.type.icon,o.label,(function(){return e.operations.append().set({operator:t,opcode:"score",value:r.id,open:!0})})));return!0}}else if(r.id&&(r.slot instanceof l.Slots.String||r.slot instanceof l.Slots.Text))return a(o,r),!0;return!1})):o.id&&(o.slot instanceof l.Slots.String||o.slot instanceof l.Slots.Text)&&a(o,o)})),i},v=function(e,t){var o,i=[],n=function(e){if((null==e?void 0:e.id)!==o){var t=null==e?void 0:e.name;i.push(new l.Components.MenuSeparator),(t||1===i.length)&&i.push(new l.Components.MenuLabel(t||(0,l.pgettext)("block:calculator","Blocks"))),o=null==e?void 0:e.id}};return(0,l.each)((0,l.populateSlots)(e.block,{mode:"validated",pipes:"exclude"}),(function(o){if(o.slots){var a,r=[];(0,l.each)(o.slots,(function(o){if(o.id&&(o.slot instanceof l.Slots.String||o.slot instanceof l.Slots.Text||o.slot instanceof l.Slots.Boolean||o.slot instanceof l.Slots.Number||o.slot instanceof l.Slots.Numeric||o.slot instanceof l.Slots.Date)){var i=(o.slot instanceof l.Slots.String||o.slot instanceof l.Slots.Text)&&l.Collection.find(o);i&&i.sole||r.push(new l.Components.MenuItemWithIcon((0,l.getSlotIcon)(o.slot),o.label,a=function(){return e.operations.append().set(o.slot instanceof l.Slots.String||o.slot instanceof l.Slots.Text?{operator:t,opcode:"evaluate",value:o.id,cona:0,conb:0,outa:1,outb:0,open:!0}:o.slot instanceof l.Slots.Boolean?{operator:t,opcode:"boolean",value:o.id,outa:1,outb:0,open:!0}:o.slot instanceof l.Slots.Date?{operator:t,opcode:"date",value:o.id,cona:void 0,conb:void 0,outa:1,outb:0,open:!0}:{operator:t,opcode:"equation",value:o.id,cona:0,conb:0,outa:1,outb:0,open:!0})}))}})),r.length>0&&(n(o.block.node.section),i.push(1===r.length&&a?new l.Components.MenuItemWithImage(o.icon||o.block.type.icon,o.label,a):new l.Components.MenuSubmenuWithImage(o.icon||o.block.type.icon,o.label,r)))}else if(o.id&&(o.slot instanceof l.Slots.String||o.slot instanceof l.Slots.Text||o.slot instanceof l.Slots.Boolean||o.slot instanceof l.Slots.Number||o.slot instanceof l.Slots.Numeric||o.slot instanceof l.Slots.Date)){var c=(o.slot instanceof l.Slots.String||o.slot instanceof l.Slots.Text)&&l.Collection.find(o);c&&c.sole||(n(o.block.node.section),i.push(new l.Components.MenuItemWithImage(o.icon||o.block.type.icon,o.label,(function(){return e.operations.append().set(o.slot instanceof l.Slots.String||o.slot instanceof l.Slots.Text?{operator:t,opcode:"evaluate",value:o.id,cona:0,conb:0,outa:1,outb:0,open:!0}:o.slot instanceof l.Slots.Boolean?{operator:t,opcode:"boolean",value:o.id,outa:1,outb:0,open:!0}:o.slot instanceof l.Slots.Date?{operator:t,opcode:"date",value:o.id,cona:void 0,conb:void 0,outa:1,outb:0,open:!0}:{operator:t,opcode:"equation",value:o.id,cona:0,conb:0,outa:1,outb:0,open:!0})}))))}})),i},x=function(e,t,o,i,a){return void 0===a&&(a=!0),n([new l.Components.MenuSubmenuWithIcon(59122,(0,l.pgettext)("block:calculator","Limiting"),[new l.Components.MenuItem("min",(function(){return t.append().set({operator:e,opcode:"min",value:o?0:i,min:0,open:!0})})),new l.Components.MenuItem("max",(function(){return t.append().set({operator:e,opcode:"max",value:o?0:i,max:0,open:!0})})),new l.Components.MenuItem("clamp",(function(){return t.append().set({operator:e,opcode:"clamp",value:o?0:i,min:0,max:0,open:!0})}))]),new l.Components.MenuSubmenuWithImage(f.default,(0,l.pgettext)("block:calculator","Floating point"),[new l.Components.MenuItem("round",(function(){return t.append().set({operator:e,opcode:"round",value:o?0:i,open:o})})),new l.Components.MenuItem("floor",(function(){return t.append().set({operator:e,opcode:"floor",value:o?0:i,open:o})})),new l.Components.MenuItem("ceil",(function(){return t.append().set({operator:e,opcode:"ceil",value:o?0:i,open:o})})),new l.Components.MenuItem("trunc",(function(){return t.append().set({operator:e,opcode:"trunc",value:o?0:i,open:o})}))]),new l.Components.MenuSubmenuWithImage(g.default,(0,l.pgettext)("block:calculator","Exponentiation"),[new l.Components.MenuItem("xΒ²",(function(){return t.append().set({operator:e,opcode:"square",value:o?0:i,open:o})})),new l.Components.MenuItem("√",(function(){return t.append().set({operator:e,opcode:"sqrt",value:o?0:i,open:o})})),new l.Components.MenuItem("pow",(function(){return t.append().set({operator:e,opcode:"pow",exponent:1,open:!0})})),new l.Components.MenuItem("exp",(function(){return t.append().set({operator:e,opcode:"exp",exponent:o?0:void 0,open:o})})),new l.Components.MenuItem("ln",(function(){return t.append().set({operator:e,opcode:"ln",value:o?0:i,open:o})})),new l.Components.MenuItem("log",(function(){return t.append().set({operator:e,opcode:"log",value:o?0:i,open:o})}))]),new l.Components.MenuSubmenuWithIcon(59778,(0,l.pgettext)("block:calculator","Trigonometry"),[new l.Components.MenuItem("sin",(function(){return t.append().set({operator:e,opcode:"sin",value:o?0:i,open:o})})),new l.Components.MenuItem("cos",(function(){return t.append().set({operator:e,opcode:"cos",value:o?0:i,open:o})})),new l.Components.MenuItem("tan",(function(){return t.append().set({operator:e,opcode:"tan",value:o?0:i,open:o})})),new l.Components.MenuSeparator,new l.Components.MenuLabel((0,l.pgettext)("block:calculator","Inverse")),new l.Components.MenuItem("sin⁻¹",(function(){return t.append().set({operator:e,opcode:"asin",value:o?0:i,open:o})})),new l.Components.MenuItem("cos⁻¹",(function(){return t.append().set({operator:e,opcode:"acos",value:o?0:i,open:o})})),new l.Components.MenuItem("tan⁻¹",(function(){return t.append().set({operator:e,opcode:"atan",value:o?0:i,open:o})})),new l.Components.MenuSeparator,new l.Components.MenuLabel((0,l.pgettext)("block:calculator","Hyperbolic")),new l.Components.MenuItem("sinh",(function(){return t.append().set({operator:e,opcode:"sinh",value:o?0:i,open:o})})),new l.Components.MenuItem("cosh",(function(){return t.append().set({operator:e,opcode:"cosh",value:o?0:i,open:o})})),new l.Components.MenuItem("tanh",(function(){return t.append().set({operator:e,opcode:"tanh",value:o?0:i,open:o})})),new l.Components.MenuSeparator,new l.Components.MenuLabel((0,l.pgettext)("block:calculator","Inverse hyperbolic")),new l.Components.MenuItem("sinh⁻¹",(function(){return t.append().set({operator:e,opcode:"asinh",value:o?0:i,open:o})})),new l.Components.MenuItem("cosh⁻¹",(function(){return t.append().set({operator:e,opcode:"acosh",value:o?0:i,open:o})})),new l.Components.MenuItem("tanh⁻¹",(function(){return t.append().set({operator:e,opcode:"atanh",value:o?0:i,open:o})}))]),new l.Components.MenuSubmenuWithIcon(59732,(0,l.pgettext)("block:calculator","Factorial"),[new l.Components.MenuItem("n!",(function(){return t.append().set({operator:e,opcode:"fact",value:o?0:i,open:o})})),new l.Components.MenuItem("gamma",(function(){return t.append().set({operator:e,opcode:"gamma",value:o?0:i,open:o})}))]),new l.Components.MenuSubmenuWithIcon(59704,(0,l.pgettext)("block:calculator","Miscellaneous"),[new l.Components.MenuItem("abs",(function(){return t.append().set({operator:e,opcode:"abs",value:o?0:i,open:o})})),new l.Components.MenuItem("sgn",(function(){return t.append().set({operator:e,opcode:"sgn",value:o?0:i,open:o})})),new l.Components.MenuItem("mod",(function(){return t.append().set({operator:e,opcode:"mod",value:o?0:i,divisor:1,open:!0})})),new l.Components.MenuItem("%",(function(){return t.append().set({operator:e,opcode:"percentage",value:o?0:i,percentage:0,open:!0})}))])],a?[new l.Components.MenuSubmenuWithIcon(59222,(0,l.pgettext)("block:calculator","Constants"),(function(){return r.CONSTANTS.map((function(o){return new l.Components.MenuItemWithIcon((0,c.getConstantIcon)(o),(0,c.getConstantLabel)(o),(function(){return t.append().set({operator:e,opcode:"number",value:o})}))}))}))]:[],!0)},y=function(e,t){var o,i=[],n=function(e){if((null==e?void 0:e.id)!==o){var t=null==e?void 0:e.name;(i.length>0||t)&&i.push(new l.Components.MenuSeparator),t&&i.push(new l.Components.MenuLabel(t)),o=null==e?void 0:e.id}};return(0,l.each)((0,l.populateSlots)(e.block,{mode:"validated",pipes:"include-consumed-slots"}),(function(o){if(o.slots){var a=[],r=!0,c=!1,s=!1;(0,l.findFirst)(o.slots,(function(i){var n,r,u;if("pipe"===i.type){var d=l.Collection.find(i);if(d){var p=null===(r=null===(n=i.slot)||void 0===n?void 0:n.slots)||void 0===r?void 0:r.select("score","feature");if(c=!0,p){var b=[];w(b,t,e.operations,{type:"slot",block:o.block,label:p.alias||(0,l.pgettext)("block:calculator","Existing score"),icon:o.icon||o.block.type.icon,id:p.id,reference:p.reference,slot:p},!1,!0),b.push(new l.Components.MenuItemWithIcon(59147,(0,l.pgettext)("block:calculator","New score"),(function(){return e.operations.append().set({operator:t,opcode:"score",value:i.id,open:!0})}))),a.push(new l.Components.MenuSubmenuWithIcon(59105,(0,l.pgettext)("block:calculator","Score"),b))}else a.push(new l.Components.MenuItemWithIcon(59105,(0,l.pgettext)("block:calculator","Score"),(function(){return e.operations.append().set({operator:t,opcode:"score",value:i.id,open:!0})})));if(d.origin&&d.sole)if(i.slot instanceof l.Slots.Number||i.slot instanceof l.Slots.Numeric)a.push(new l.Components.MenuItemWithIcon(59837,(0,l.pgettext)("block:calculator","Sum"),(function(){return e.operations.append().set({operator:t,opcode:"sum",value:i.id})})));else if(i.slot instanceof l.Slots.Boolean){var g=null===(u=i.slot.slots)||void 0===u?void 0:u.select("counter");g?(s=!0,w(a,t,e.operations,{type:"slot",block:o.block,label:g.label||(0,l.pgettext)("block:calculator","Counter"),icon:M.default,id:g.id,reference:g.reference,slot:g},!1,!0)):a.push(new l.Components.MenuItemWithIcon(59694,(0,l.pgettext)("block:calculator","Count"),(function(){return e.operations.append().set({operator:t,opcode:"count",value:i.id})})))}return!0}}return!1})),(0,l.each)(o.slots,(function(o){"slot"===o.type&&o.id&&o.slot&&("score"!==o.reference&&"counter"!==o.reference||"score"===o.reference&&!c||"counter"===o.reference&&!s)&&(r&&(r=!1,a.length>0&&a.push(new l.Components.MenuSeparator)),w(a,t,e.operations,o,!0))})),a.length>0&&(n(o.block.node.section),i.push(new l.Components.MenuSubmenuWithImage(o.icon||o.block.type.icon,o.label,a)))}else if(o.id&&o.slot){var u=[];w(u,t,e.operations,o,!1),u.length>0&&(n(o.block.node.section),i.push.apply(i,u))}})),i},w=function(e,t,o,i,r,c){var s,u,d,p,b,g,f;if(void 0===c&&(c=!1),i.slot instanceof l.Slots.String||i.slot instanceof l.Slots.Text){var M=l.Collection.find(i),m=(0,l.getMetadata)(i.block,"calculator"),h=function(){return o.append().set({operator:t,opcode:"score",value:i.id,open:!0})},v=(null==M?void 0:M.sole)&&m&&!0===(null===(s=m[i.slot.reference]||m["*"])||void 0===s?void 0:s.allowDefault)||!(null==M?void 0:M.sole)&&(!m||!1!==(null===(u=m[i.slot.reference]||m["*"])||void 0===u?void 0:u.allowDefault)),y=(null==M?void 0:M.sole)&&m&&!0===(null===(d=m[i.slot.reference]||m["*"])||void 0===d?void 0:d.allowCastToNumber)||!(null==M?void 0:M.sole)&&(!m||!1!==(null===(p=m[i.slot.reference]||m["*"])||void 0===p?void 0:p.allowCastToNumber)),S=null===(b=i.slot.slots)||void 0===b?void 0:b.select("score","feature"),j=!!(M||m&&(null===(g=m[i.slot.reference]||m["*"])||void 0===g?void 0:g.scores));if((null==M?void 0:M.sole)&&!y||m&&(null===(f=m[i.slot.reference]||m["*"])||void 0===f?void 0:f.scores)&&!v&&!y)S?(w(A=[],t,o,{type:"slot",block:i.block,label:S.alias||(0,l.pgettext)("block:calculator","Existing score"),icon:i.icon||i.block.type.icon,id:S.id,reference:S.reference,slot:S},!1,!0),A.push(new l.Components.MenuItemWithIcon(59147,(0,l.pgettext)("block:calculator","New score"),(function(){return o.append().set({operator:t,opcode:"score",value:i.id,open:!0})}))),e.push(r?new l.Components.MenuSubmenuWithIcon(59105,(0,l.pgettext)("block:calculator","Score"),A):new l.Components.MenuSubmenuWithImage(i.icon||i.block.type.icon,i.label,A))):e.push(r?new l.Components.MenuItemWithIcon(59105,i.label,h):new l.Components.MenuItemWithImage(i.icon||i.block.type.icon,i.label,h));else{var A,I=[];(j||S)&&(S?(w(A=[],t,o,{type:"slot",block:i.block,label:S.alias||(0,l.pgettext)("block:calculator","Existing score"),icon:i.icon||i.block.type.icon,id:S.id,reference:S.reference,slot:S},!1,!0),A.push(new l.Components.MenuItemWithIcon(59147,(0,l.pgettext)("block:calculator","New score"),h)),I.push(new l.Components.MenuSubmenuWithIcon(59105,(0,l.pgettext)("block:calculator","Score"),A))):I.push(new l.Components.MenuItemWithIcon(59105,(0,l.pgettext)("block:calculator","Score"),h))),v&&I.push(new l.Components.MenuItemWithIcon(59449,(0,l.pgettext)("block:calculator","Compare"),(function(){return o.append().set({operator:t,opcode:"evaluate",value:i.id,cona:0,conb:0,outa:1,outb:0,open:!0})})),new l.Components.MenuItemWithIcon(59771,(0,l.pgettext)("block:calculator","Character count"),(function(){return o.append().set({operator:t,opcode:"chars",value:i.id})})),new l.Components.MenuItemWithIcon(59771,(0,l.pgettext)("block:calculator","Word count"),(function(){return o.append().set({operator:t,opcode:"words",value:i.id})})),new l.Components.MenuItemWithIcon(59771,(0,l.pgettext)("block:calculator","Line count"),(function(){return o.append().set({operator:t,opcode:"lines",value:i.id})})),new l.Components.MenuItemWithIcon(59683,(0,l.pgettext)("block:calculator","Count occurrences"),(function(){return o.append().