Crowdsignal Forms - Version 1.5.15

Version Description

Download this release

Release Info

Developer donncha
Plugin Icon wp plugin Crowdsignal Forms
Version 1.5.15
Comparing to
See all releases

Code changes from version 1.5.14 to 1.5.15

README.TXT CHANGED
@@ -3,8 +3,8 @@ Contributors: automattic
3
  Tags: polls, forms, surveys, gutenberg, block
4
  Requires at least: 5.0
5
  Requires PHP: 5.6.20
6
- Tested up to: 5.8.2
7
- Stable tag: 1.5.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -67,11 +67,22 @@ Compare our [simple and affordable plans](https://crowdsignal.com/pricing/) or t
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
70
  = 1.5.14 =
71
- * Revert the styling of the settings page.
72
 
73
  = 1.5.13 =
74
- * Updated the style of the settings page.
 
 
 
 
 
 
75
 
76
  = 1.5.12 =
77
  * Improve broken connection handling (#193)
@@ -155,8 +166,8 @@ Compare our [simple and affordable plans](https://crowdsignal.com/pricing/) or t
155
 
156
  == Upgrade Notice ==
157
 
158
- = 1.5.7 =
159
- Bugfixes and typos. v1.5.7 addresses an issue with newer version of Gutenberg preventing Feedback Button to render properly on the editor.
160
 
161
  = 0.9 =
162
  Initial release
3
  Tags: polls, forms, surveys, gutenberg, block
4
  Requires at least: 5.0
5
  Requires PHP: 5.6.20
6
+ Tested up to: 5.8.3
7
+ Stable tag: 1.5.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
67
 
68
  == Changelog ==
69
 
70
+ = 1.5.15 =
71
+ * Fix CSS so it doesn't interfere with Jetpack (#208)
72
+ * add trigger for crowdsignal_forms_get_account_info (#203)
73
+ * fix typo on respones -> responses (#207)
74
+
75
  = 1.5.14 =
76
+ * Rollback to 1.5.12
77
 
78
  = 1.5.13 =
79
+ * Update the text and styling of the settings page. (#199)
80
+ * Fix transient and empty user (#200)
81
+ * Update links to settings page. (#198)
82
+ * Let the dashboard plugin take care of menus. (#196)
83
+ * WIP: Move the "Getting Started" process into the Settings page. (#179)
84
+ * Some fixes along the way (#197)
85
+ * Update and delete the dashboard login details too (#195)
86
 
87
  = 1.5.12 =
88
  * Improve broken connection handling (#193)
166
 
167
  == Upgrade Notice ==
168
 
169
+ = 1.5.12 =
170
+ Improve broken connection handling, fix multiple choice poll check styling. Bugs and fixes on backend code.
171
 
172
  = 0.9 =
173
  Initial release
build/editor.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill'), 'version' => 'eca1f8791482563f84488f462a8c5543');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill'), 'version' => 'f19ba150ba2f7925f6173a87c841f756');
build/editor.js CHANGED
@@ -10,4 +10,4 @@
10
  *
11
  * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
12
  * Released under the MIT license
13
- */!function(a){if(void 0===(o="function"==typeof(r=a)?r.call(t,n,t,e):r)||(e.exports=o),!0,e.exports=a(),!!0){var l=window.Cookies,c=window.Cookies=a();c.noConflict=function(){return window.Cookies=l,c}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function a(t,n,a){if("undefined"!=typeof document){"number"==typeof(a=e({path:"/"},o.defaults,a)).expires&&(a.expires=new Date(1*new Date+864e5*a.expires)),a.expires=a.expires?a.expires.toUTCString():"";try{var l=JSON.stringify(n);/^[\{\[]/.test(l)&&(n=l)}catch(s){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var c="";for(var i in a)a[i]&&(c+="; "+i,!0!==a[i]&&(c+="="+a[i].split(";")[0]));return document.cookie=t+"="+n+c}}function l(e,n){if("undefined"!=typeof document){for(var o={},a=document.cookie?document.cookie.split("; "):[],l=0;l<a.length;l++){var c=a[l].split("="),i=c.slice(1).join("=");n||'"'!==i.charAt(0)||(i=i.slice(1,-1));try{var s=t(c[0]);if(i=(r.read||r)(i,s)||t(i),n)try{i=JSON.parse(i)}catch(u){}if(o[s]=i,e===s)break}catch(u){}}return e?o[e]:o}}return o.set=a,o.get=function(e){return l(e,!1)},o.getJSON=function(e){return l(e,!0)},o.remove=function(t,n){a(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}((function(){}))}))},function(e,t){!function(){e.exports=this.ReactDOM}()},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){var r=n(23);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},,function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t,n){var r=n(28);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t,n){var r=n(45),o=n(46);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t,n){var r=n(20),o=n(23),a=n(47),l=n(48);function c(t){var n="function"==typeof Map?new Map:void 0;return e.exports=c=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return l(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),o(t,e)},c(t)}e.exports=c},function(e,t){!function(){e.exports=this.wp.editor}()},function(e,t){!function(){e.exports=this.wp.keycodes}()},,,,function(e,t,n){var r=n(28);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var l,c=e[Symbol.iterator]();!(r=(l=c.next()).done)&&(n.push(l.value),!t||n.length!==t);r=!0);}catch(i){o=!0,a=i}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}},function(e,t){e.exports=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.")}},function(e,t,n){"use strict";var r=n(44);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,l){if(l!==r){var c=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 c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array: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:a,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}},function(e,t,n){var r=n(23),o=n(49);function a(t,n,l){return o()?e.exports=a=Reflect.construct:e.exports=a=function(e,t,n){var o=[null];o.push.apply(o,t);var a=new(Function.bind.apply(e,o));return n&&r(a,n.prototype),a},a.apply(null,arguments)}e.exports=a},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},function(e,t,n){"use strict";n.r(t);var r=n(17),o=n(24),a=n(0),l=n(1),c=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 6L5.5 18C5.5 18.2761 5.72386 18.5 6 18.5L18 18.5C18.2761 18.5 18.5 18.2761 18.5 18L18.5 6C18.5 5.72386 18.2761 5.5 18 5.5L6 5.5C5.72386 5.5 5.5 5.72386 5.5 6ZM4 18L4 6C4 4.89543 4.89543 4 6 4L18 4C19.1046 4 20 4.89543 20 6L20 18C20 19.1046 19.1046 20 18 20L6 20C4.89543 20 4 19.1046 4 18Z"}),Object(a.createElement)("rect",{x:"15",y:"17",width:"6",height:"1.5",transform:"rotate(-90 15 17)"}),Object(a.createElement)("rect",{x:"11.5",y:"17",width:"9",height:"1.5",transform:"rotate(-90 11.5 17)"}),Object(a.createElement)("rect",{x:"8",y:"17",width:"5",height:"1.5",transform:"rotate(-90 8 17)"}))},i=n(18),s=n.n(i),u=n(5),d=n.n(u),f=n(12),b=n(3);function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var g={tryFetch:!1,isFetching:!1,pollsByClientId:{},pollClientIds:[]},O={setTryFetchPollData:function(e){return{type:"SET_TRY_FETCH",tryFetch:e}},setIsFetchingPollData:function(e){return{type:"IS_FETCHING",isFetching:e}},setPollApiDataForClientId:function(e,t){return{type:"SET_POLL",clientId:e,pollData:t}},addPollClientId:function(e){return{type:"ADD_POLL_CLIENT_ID",clientId:e}},removePollClientId:function(e){return{type:"REMOVE_POLL_CLIENT_ID",clientId:e}}},v=(Object(f.registerStore)("crowdsignal-forms/polls",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_TRY_FETCH":return p({},e,{tryFetch:!!t.tryFetch});case"IS_FETCHING":return p({},e,{isFetching:!!t.isFetching});case"SET_POLL":return p({},e,{pollsByClientId:p({},e.pollsByClientId,d()({},t.clientId,t.pollData))});case"ADD_POLL_CLIENT_ID":return p({},e,{pollClientIds:e.pollClientIds.indexOf(t.clientId)<0?[].concat(s()(e.pollClientIds),[t.clientId]):e.pollClientIds});case"REMOVE_POLL_CLIENT_ID":return p({},e,{pollClientIds:Object(b.filter)(e.pollClientIds,(function(e){return e!==t.clientId}))});default:return e}},actions:O,selectors:{shouldTryFetchingPollData:function(e){return!!e.tryFetch},getPollDataByClientId:function(e,t){return e.pollsByClientId[t]||null},getPollClientIds:function(e){return e.pollClientIds},isFetchingPollData:function(e){return!!e.isFetching}},controls:{},resolvers:{}}),n(10)),w=n.n(v),h=n(7),j=n.n(h),_=n(2),y=n.n(_),C=n(6),E=n(4),k=n(15),x=n(13),S=n(9),T=n.n(S),I=function(e){var t=e.hasVoted,n=e.isPollClosed,r=e.isPollHidden,o=e.showSubmitMessage,c=T()({"is-transparent":o},"crowdsignal-forms-poll__closed-banner");return Object(a.createElement)("div",{className:c},r&&Object(l.__)("This Poll is Hidden","crowdsignal-forms"),n&&!r&&Object(l.__)("This Poll is Closed","crowdsignal-forms"),t&&Object(l.__)("Thanks For Voting!","crowdsignal-forms"))},P=n(8),L=n.n(P),N=n(11),A=n.n(N),R=n(14),D=n.n(R),B=n(21),F=n.n(B),M=n(25),H=n.n(M),V=n(26),W=n.n(V),U=n(30),z=n.n(U),q=n(20),K=n.n(q),G=n(31),Z=n.n(G),Y=n(16),Q=n.n(Y);function J(e){return function(){var t,n=K()(e);if(X()){var r=K()(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return z()(this,t)}}function X(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var $=function(){var e=D()(A.a.mark((function e(t){var n,r,o=arguments;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(o.length>1&&void 0!==o[1])||o[1],r="https://api.crowdsignal.com/v3/polls",n){e.next=4;break}return e.abrupt("return",null);case 4:return e.abrupt("return",window.fetch("".concat(r,"/").concat(t,"/results"),{method:"GET",headers:{"content-type":"application/json"}}).then((function(e){if(e.status>=200&&e.status<300)return e.json();throw e})).then((function(e){if(404===e.status)return{};if(e.error)throw new Error(e.message);return e.results.votes_by_answer})));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ee=function(){var e=D()(A.a.mark((function e(t){var n,r,o;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"5430eeac3911395001d731d9702fc38b",n=(new Date).getTime(),e.next=4,window.fetch("https://poll.fm/n/".concat("5430eeac3911395001d731d9702fc38b","/").concat(t,"?").concat(n,"&format=json"));case 4:if((r=e.sent).ok){e.next=7;break}throw new re;case 7:return e.next=9,r.json();case 9:if((o=e.sent).nonce){e.next=12;break}throw new re;case 12:return e.abrupt("return",o.nonce);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),te=function(){var e=D()(A.a.mark((function e(t,n,r,o){var a,l,c;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r.join(","),e.next=3,window.fetch("https://polls.polldaddy.com/vote-js.php?format=json&p=".concat(n,"&b=1&a=").concat(a,"&o=&va=16&cookie=0&n=").concat(t,"&url=").concat(encodeURIComponent(window.location),"&vi=").concat(o));case 3:if((l=e.sent).ok){e.next=6;break}throw new re;case 6:return e.next=8,l.json();case 8:if("error"!==(c=e.sent).status){e.next=11;break}throw new ne(c.error);case 11:case"end":return e.stop()}}),e)})));return function(t,n,r,o){return e.apply(this,arguments)}}(),ne=function(e){W()(n,e);var t=J(n);function n(){return H()(this,n),t.apply(this,arguments)}return n}(Z()(Error)),re=function(e){W()(n,e);var t=J(n);function n(){return H()(this,n),t.call(this,Object(l.__)("Server error. Please try again.","crowdsignal-forms"))}return n}(ne),oe=function(){var e=D()(A.a.mark((function e(){return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Q()({path:"/crowdsignal-forms/v1/account/info",method:"GET"});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ae=function(e,t){var n=Object(_.useState)(null),r=j()(n,2),o=r[0],a=r[1],l=Object(_.useState)(null),c=j()(l,2),i=c[0],s=c[1],u=Object(_.useState)(!0),d=j()(u,2),f=d[0],b=d[1];return Object(_.useEffect)((function(){b(!0),s(null),a(null),e().then(a).catch(s).finally((function(){return b(!1)}))}),t),{data:o,error:i,loading:f}},le=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=ae((function(){return $(e,t)}),[e]),r=n.data,o=n.error,a=n.loading;return{error:o,loading:a,results:r}},ce={is_verified:!0,capabilities:["hide-branding"],signal_count:{count:0,userLimit:2500,shouldDisplay:!1}},ie=function(){var e=Object(_.useState)(ce),t=j()(e,2),n=t[0],r=t[1],o=function(){var e=D()(A.a.mark((function e(){var t;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,oe();case 2:return t=e.sent,r(t),e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(_.useEffect)((function(){o()}),[]),{accountInfo:n,reloadAccountInfo:o}},se=function(e){var t=e.error,n=e.loading,r=e.text,o=e.totalVotes,c=e.votes,i=T()("crowdsignal-forms-poll__answer-results",{"is-error":t,"is-loading":n}),s=!n&&!t,u=0===o?0:100*c/o,d={width:"".concat(parseInt(u,10),"%")};return Object(a.createElement)("div",{className:i},Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-results-labels"},Object(a.createElement)("span",{className:"crowdsignal-forms-poll__answer-results-answer"},Object(k.decodeEntities)(r)),Object(a.createElement)("span",{className:"crowdsignal-forms-poll__answer-results-votes"},s&&Object(l.sprintf)(Object(l._n)("%s vote","%s votes",c,"crowdsignal-forms"),c.toLocaleString())),Object(a.createElement)("span",{className:"crowdsignal-forms-poll__answer-results-percent"},s&&"".concat(u.toFixed(2),"%"))),Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-results-progress-track"},Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-results-progress-bar",style:d})))};se.propTypes={loading:L.a.bool,text:L.a.string.isRequired,totalVotes:L.a.number,votes:L.a.number};var ue,de=se,fe=Object(a.createElement)("span",null,"Hide Crowdsignal ads",Object(a.createElement)("br",null),"and get unlimited",Object(a.createElement)("br",null),"signals -"," ",Object(a.createElement)("a",{href:"https://crowdsignal.com/pricing",target:"_blank",rel:"noopener noreferrer"},"Upgrade")),be=function(e){var t=e.showLogo,n=e.editing,r=e.message,o=e.trackRef,c=void 0===o?"cs-forms-poll":o;return Object(a.createElement)("div",{className:"crowdsignal-forms__footer-branding"},Object(a.createElement)("a",{className:"crowdsignal-forms__footer-cs-link",href:"https://crowdsignal.com?ref="+c,target:"_blank",rel:"noopener noreferrer"},r||Object(l.__)("Create your own poll with Crowdsignal","crowdsignal-forms")),n&&Object(a.createElement)(E.Tooltip,{text:fe,position:"top center"},Object(a.createElement)("a",{href:"https://crowdsignal.com/pricing",target:"_blank",rel:"noopener noreferrer",className:"crowdsignal-forms__branding-promote"},Object(l.__)("Hide","crowdsignal-forms"))),t&&Object(a.createElement)("a",{href:"https://crowdsignal.com?ref="+c,target:"_blank",rel:"noopener noreferrer"},Object(a.createElement)("img",{className:"crowdsignal-forms__footer-branding-logo",src:"https://app.crowdsignal.com/images/svg/cs-logo-dots.svg",alt:"Crowdsignal sticker"})))},me=Object.freeze({THANK_YOU:"thank-you",CUSTOM_TEXT:"custom-text",REDIRECT:"redirect",RESULTS:"results"}),pe=Object.freeze({THEME_DEFAULT:"theme-default",GEORGIA:"georgia",PALATINO:"palatino",TIMES_NEW_ROMAN:"times-new-roman",ARIAL:"arial",IMPACT:"impact",LUCIDA:"lucida",TAHOMA:"tahoma",TREBUCHET:"trebuchet",VERDANA:"verdana",COURIER:"courier",CABIN:"Cabin",CHIVO:"Chivo",OPEN_SANS:"Open+Sans",FIRA_SANS:"Fira+Sans",ROBOTO:"Roboto",NUNITO:"Nunito",OVERPASS:"Overpass",LATO:"Lato",LIBRE_FRANKLIN:"Libre+Franklin",MONTSERRAT:"Montserrat",POPPINS:"Poppins",RUBIK:"Rubik",RALEWAY:"Raleway",JOSEFIN_SANS:"Josefin+Sans",ALEGREYA_SANS:"Alegreya+Sans",OSWALD:"Oswald"}),ge=Object.freeze([pe.CABIN,pe.CHIVO,pe.OPEN_SANS,pe.FIRA_SANS,pe.ROBOTO,pe.NUNITO,pe.OVERPASS,pe.LATO,pe.LIBRE_FRANKLIN,pe.MONTSERRAT,pe.POPPINS,pe.RUBIK,pe.RALEWAY,pe.JOSEFIN_SANS,pe.ALEGREYA_SANS,pe.OSWALD]),Oe=Object.freeze((ue={},d()(ue,pe.THEME_DEFAULT,null),d()(ue,pe.GEORGIA,"Georgia, serif"),d()(ue,pe.PALATINO,'"Palatino Linotype", "Book Antiqua", Palatino, serif'),d()(ue,pe.TIMES_NEW_ROMAN,'"Times New Roman", Times, serif'),d()(ue,pe.ARIAL,"Arial, Helvetica, sans-serif"),d()(ue,pe.IMPACT,"Impact, Charcoal, sans-serif"),d()(ue,pe.LUCIDA,'"Lucida Sans Unicode", "Lucida Grande", sans-serif'),d()(ue,pe.TAHOMA,"Tahoma, Geneva, sans-serif"),d()(ue,pe.TREBUCHET,'"Trebuchet MS", Helvetica, sans-serif'),d()(ue,pe.VERDANA,"Verdana, Geneva, sans-serif"),d()(ue,pe.COURIER,'"Courier New", Courier, monospace'),d()(ue,pe.CABIN,'"Cabin", sans-serif'),d()(ue,pe.CHIVO,'"Chivo", sans-serif'),d()(ue,pe.OPEN_SANS,'"Open Sans", sans-serif'),d()(ue,pe.FIRA_SANS,'"Fira Sans", sans-serif'),d()(ue,pe.ROBOTO,'"Roboto", sans-serif'),d()(ue,pe.NUNITO,'"Nunito", sans-serif'),d()(ue,pe.OVERPASS,'"Overpass", sans-serif'),d()(ue,pe.LATO,'"Lato", sans-serif'),d()(ue,pe.LIBRE_FRANKLIN,'"Libre Franklin", sans-serif'),d()(ue,pe.MONTSERRAT,'"Montserrat", sans-serif'),d()(ue,pe.POPPINS,'"Poppins", sans-serif'),d()(ue,pe.RUBIK,'"Rubik", sans-serif'),d()(ue,pe.RALEWAY,'"Raleway", sans-serif'),d()(ue,pe.JOSEFIN_SANS,'"Josefin Sans", sans-serif'),d()(ue,pe.ALEGREYA_SANS,'"Alegreya Sans", sans-serif'),d()(ue,pe.OSWALD,'"Oswald", sans-serif'),ue)),ve=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),we=Object.freeze({SHOW_RESULTS:"show-results",SHOW_CLOSED_BANNER:"show-closed-banner",HIDDEN:"hidden"}),he=Object.freeze({RADIO:"radio",BUTTON:"button"}),je=Object.freeze({LIST:"list",INLINE:"inline"});function _e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var ye=function(e,t){return Object(b.map)(e,(function(e){return void 0!==e.answerIdFromApi?e:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{answerIdFromApi:t[e.answerId]})}))},Ce=function(e){return Object(b.isEmpty)(e)||void 0===e.text||null===e.text||""===e.text},Ee=function(e){var t=e.answers,n=e.pollIdFromApi,r=e.setErrorMessage,o=e.hideBranding,c=le(n),i=c.error,s=c.loading,u=c.results;Object(_.useEffect)((function(){r(i?Object(l.__)("Unfortunately, we're having some trouble retrieving the results for this poll at this time.","crowdsignal-forms"):"")}),[i]);var d=T()("crowdsignal-forms-poll__results",{"is-error":!!i,"is-loading":s}),f=Object(b.sum)(Object(b.values)(u));return Object(a.createElement)("div",{className:d},Object(a.createElement)("div",{className:"crowdsignal-forms-poll__results-list"},Object(b.map)(t,(function(e){var t;return!Ce(e)&&Object(a.createElement)(de,{key:e.answerId,error:!!i,loading:s,text:e.text,totalVotes:f,votes:u&&null!==(t=u[e.answerIdFromApi])&&void 0!==t?t:0})}))),Object(a.createElement)("div",{className:"crowdsignal-forms-poll__results-footer"},Object(a.createElement)("span",{className:"crowdsignal-forms-poll__results-total"},Object(l.sprintf)(Object(l._n)("%s total vote","%s total votes",f,"crowdsignal-forms"),f?f.toLocaleString():0)),!o&&Object(a.createElement)(be,null)))};Ee.propTypes={pollIdFromApi:L.a.number,answers:L.a.arrayOf(L.a.shape({answerId:L.a.string.isRequired,answerIdFromApi:L.a.number,text:L.a.string})).isRequired,setErrorMessage:L.a.func.isRequired,hideBranding:L.a.bool};var ke=Ee,xe=n(19),Se=n.n(xe),Te=function(e){for(var t=window.getComputedStyle(e).backgroundColor;"rgba(0, 0, 0, 0)"===t&&e.parentNode&&e.parentNode.nodeType===window.Node.ELEMENT_NODE;)e=e.parentNode,t=window.getComputedStyle(e).backgroundColor;return t},Ie=function(){return Object(a.createElement)("div",{className:"crowdsignal-forms__style-probe"},Object(a.createElement)("p",null),Object(a.createElement)("h3",null,"Text"),Object(a.createElement)("div",{className:"wp-block-button"},Object(a.createElement)("div",{className:"wp-block-button__link"})),Object(a.createElement)("div",{className:"entry-content"},Object(a.createElement)("div",{className:"alignwide"})))},Pe=function(e){if(null===e)return{};var t,n=e.querySelector(".wp-block-button__link"),r=e.querySelector("p"),o=e.querySelector("h3"),a=e.querySelector(".alignwide"),l=Te(n),c=Te(r),i=window.getComputedStyle(r).color;if(l===c){var s=(t=n,"0px"!==window.getComputedStyle(t).borderBlockStartWidth?window.getComputedStyle(t).borderBlockStartColor:null);l=s||i}return{accentColor:l,backgroundColor:c,textColor:i,textColorInverted:window.getComputedStyle(n).color,textFont:window.getComputedStyle(r).fontFamily,textSize:window.getComputedStyle(r).fontSize,headingFont:window.getComputedStyle(o).fontFamily,contentWideWidth:window.getComputedStyle(a).maxWidth}},Le=function(e){return Object(E.withFallbackStyles)((function(e){return{fallbackStyles:Pe(e.querySelector(".crowdsignal-forms__style-probe"))}}))((function(t){var n=t.fallbackStyles,r=Se()(t,["fallbackStyles"]);return Object(a.createElement)(e,w()({fallbackStyles:n||{},renderStyleProbe:function(){return n?null:Object(a.createElement)(Ie,null)}},r))}))};function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Ae=function(e){var t=e.answer,n=e.answerStyle,r=e.index,o=e.isMultipleChoice,c=e.onChange,i=e.onDelete,s=e.onNewAnswer,u=e.disabled,f=function(e){return c(r,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t,{text:e}))},m=function(){return i(r)},p=function(){return s(r+1)},g=T()("crowdsignal-forms-poll__answer",{"is-multiple-choice":o,"is-button":he.BUTTON===n});return Object(a.createElement)("div",{className:g},he.RADIO===n&&Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{className:"crowdsignal-forms-poll__check"}),Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-label-wrapper"},u?Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-label"},t.text?Object(k.decodeEntities)(t.text):Object(l.__)("Enter an answer","crowdsignal-forms")):Object(a.createElement)(C.RichText,{className:"crowdsignal-forms-poll__answer-label",placeholder:Object(l.__)("Enter an answer","crowdsignal-forms"),multiline:!1,preserveWhiteSpace:!1,onChange:f,onSplit:p,onReplace:b.noop,onRemove:m,value:t.text,allowedFormats:[],withoutInteractiveFormatting:!0}))),he.BUTTON===n&&Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-poll__block-button"},u?Object(a.createElement)("div",{className:"wp-block-button__link crowdsignal-forms-poll__submit-button"},t.text?Object(k.decodeEntities)(t.text):Object(l.__)("Enter an answer","crowdsignal-forms")):Object(a.createElement)(C.RichText,{className:"wp-block-button__link crowdsignal-forms-poll__submit-button",placeholder:Object(l.__)("Enter an answer","crowdsignal-forms"),multiline:!1,preserveWhiteSpace:!1,onChange:f,onSplit:p,onReplace:b.noop,onRemove:m,value:t.text,allowedFormats:[],withoutInteractiveFormatting:!0})))},Re=function(e,t){return Object(b.tap)(e.querySelectorAll("[role=textbox]")[t],(function(e){return e&&e.focus()}))},De=function(e){var t=e.attributes,n=e.isSelected,r=e.setAttributes,o=e.disabled,l=e.answerStyle,c=e.buttonAlignment,i=Object(_.useRef)(),u=function(e,n){return r({answers:Object(b.tap)(s()(t.answers),(function(t){t[e]=n}))})},d=function(e){Re(i.current,Math.max(e-1,0)),r({answers:Object(b.filter)(t.answers,(function(n){return t.answers.length<=2||n!==t.answers[e]}))})},f=function(e){e<t.answers.length&&r({answers:[].concat(s()(Object(b.slice)(t.answers,0,e)),[{}],s()(Object(b.slice)(t.answers,e,t.answers.length)))}),Re(i.current,Math.min(e,t.answers.length))},m=n&&Object(b.last)(t.answers).text?[].concat(s()(t.answers),[{}]):t.answers,p=T()({"is-button":he.BUTTON===l,"is-inline-button-alignment":je.INLINE===c},"crowdsignal-forms-poll__options"),g=he.RADIO===l;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{ref:i,className:p},Object(b.map)(m,(function(e,r){return function(e){return n&&!o||!Ce(e)}(e)&&Object(a.createElement)(Ae,{key:"poll-answer-".concat(r),answer:e,answerStyle:l,index:r,isMultipleChoice:t.isMultipleChoice,onChange:u,onDelete:d,onNewAnswer:f,disabled:o})}))),g&&Object(a.createElement)("div",{className:"crowdsignal-forms-poll__actions"},Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-poll__block-button"},o?Object(a.createElement)("div",{className:"wp-block-button__link crowdsignal-forms-poll__submit-button"},t.submitButtonLabel):Object(a.createElement)(C.RichText,{className:"wp-block-button__link crowdsignal-forms-poll__submit-button",onChange:function(e){return r({submitButtonLabel:e})},value:t.submitButtonLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0}))))},Be=function(e){return Object(b.includes)(pe,e)?Oe[e]:null},Fe=function(e,t){var n,r,o,a,l=Object(b.isEmpty)(e.textColor)?t.textColor:e.textColor;return Object(b.mapKeys)({borderColor:null!==(n=e.borderColor)&&void 0!==n?n:t.accentColor,borderRadius:"".concat(e.borderRadius,"px"),borderWidth:"".concat(e.borderWidth,"px"),bgColor:e.backgroundColor,bodyFontFamily:null!==(r=Be(e.fontFamily))&&void 0!==r?r:t.textFont,questionFontFamily:null!==(o=Be(e.fontFamily))&&void 0!==o?o:t.headingFont,submitButtonBgColor:e.submitButtonBackgroundColor||t.accentColor,submitButtonTextColor:e.submitButtonTextColor||t.textColorInverted,textColor:l,textColorProperties:null!==(a=Me(l))&&void 0!==a?a:"0, 0, 0",contentWideWidth:t.contentWideWidth},(function(e,t){return"--crowdsignal-forms-".concat(Object(b.kebabCase)(t))}))},Me=function(e){return!e||"string"!=typeof e||-1===e.indexOf("rgb")&&0!==e.indexOf("#")||-1<e.indexOf("rgba")?null:(0===e.indexOf("#")&&(e=He(e)),e.match(/\((.*?)\)/)[1])},He=function(e){var t=0,n=0,r=0,o=4===e.length?"#".concat(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]):e;return 7===o.length&&(t=parseInt(o.substr(1,2),16)||0,n=parseInt(o.substr(3,2),16)||0,r=parseInt(o.substr(5,2),16)||0),"rgb(".concat(t,", ").concat(n,", ").concat(r,")")},Ve=function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return T()({"has-bg-color":e.backgroundColor,"has-text-color":e.textColor,"has-submit-button-bg-color":e.submitButtonBackgroundColor,"has-submit-button-text-color":e.submitButtonTextColor,"has-border-radius":null!==(t=e.borderRadius)&&void 0!==t&&t,"has-box-shadow":e.hasBoxShadow},r)},We=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;if(ve.CLOSED===e)return!0;if(ve.CLOSED_AFTER===e){var r=new Date(t);return r<n}return!1},Ue=function(e,t){return e.isMultipleChoice?he.RADIO:!Object(b.isEmpty)(t)&&t.indexOf("is-style-buttons")>-1?he.BUTTON:he.RADIO},ze=function(e){e?Object(r.registerBlockStyle)("crowdsignal-forms/poll",{name:"buttons",label:Object(l.__)("Buttons","crowdsignal-forms")}):Object(r.unregisterBlockStyle)("crowdsignal-forms/poll","buttons")},qe=function(e){var t=e.signalWarning;return Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.Button,{href:"https://crowdsignal.com/pricing",isSecondary:!0,target:"_blank"},Object(l.__)("Upgrade","crowdsignal-forms")),t?Object(a.createElement)("div",{className:"crowdsignal-forms__sidebar-promote"},Object(a.createElement)("em",null,Object(l.__)("Your free Crowdsignal account has ","crowdsignal-forms"),Object(a.createElement)("strong",null,Object(a.createElement)(E.ExternalLink,{href:"https://crowdsignal.com/support/what-is-a-signal/"},Object(l.__)("reached the signals limit.","crowdsignal-forms"))))):Object(a.createElement)("div",{className:"crowdsignal-forms__sidebar-promote"},Object(a.createElement)("em",null,Object(l.__)("Hide Crowdsignal branding and get ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://crowdsignal.com/support/what-is-a-signal/"},Object(l.__)("unlimited signals","crowdsignal-forms")))))},Ke=function(e){var t,n=e.attributes,r=e.className,o=e.setAttributes,c=e.fallbackBackgroundColor,i=e.fallbackTextColor,s=e.fallbackSubmitButtonBackgroundColor,u=e.fallbackSubmitButtonTextColor,d=e.viewResultsUrl,f=e.shouldPromote,m=e.signalWarning,p=""!==d,g=Ue(n,r);return me.REDIRECT===n.confirmMessageType&&(n.confirmMessageType=me.THANK_YOU),Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,p?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Publish this post to enable results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{href:d,isSecondary:!0,target:"_blank",disabled:!p},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{value:Object(k.decodeEntities)(null!==(t=n.title)&&void 0!==t?t:n.question),label:Object(l.__)("Title of the poll block","crowdsignal-forms"),onChange:function(e){return o({title:e})}}),f&&Object(a.createElement)(qe,{signalWarning:m})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Confirmation message","crowdsignal-forms"),initialOpen:!1},Object(a.createElement)(E.SelectControl,{value:n.confirmMessageType,label:Object(l.__)("On submission","crowdsignal-forms"),options:[{label:Object(l.__)("Show results","crowdsignal-forms"),value:me.RESULTS},{label:Object(l.__)('Show "Thank You" message',"crowdsignal-forms"),value:me.THANK_YOU},{label:Object(l.__)("Show a custom text message","crowdsignal-forms"),value:me.CUSTOM_TEXT}],onChange:function(e){return Object(b.includes)(me,e)&&o({confirmMessageType:e})}}),me.CUSTOM_TEXT===n.confirmMessageType&&Object(a.createElement)(E.TextareaControl,{value:n.customConfirmMessage,label:Object(l.__)("Message text","crowdsignal-forms"),placeholder:Object(l.__)("Thanks for voting!","crowdsignal-forms"),onChange:function(e){return o({customConfirmMessage:e})}}),me.REDIRECT===n.confirmMessageType&&Object(a.createElement)(C.URLInput,{className:"crowdsignal-forms__redirect-url",value:n.redirectAddress,label:Object(l.__)("Redirect address","crowdsignal-forms"),onChange:function(e){return o({redirectAddress:e})}})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms"),initialOpen:!1},Object(a.createElement)(E.SelectControl,{value:n.pollStatus,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:ve.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:ve.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:ve.CLOSED}],onChange:function(e){Object(b.includes)(ve,e)&&o({closedAfterDateTime:e===ve.CLOSED_AFTER?new Date((new Date).getTime()+864e5).toISOString():null,pollStatus:e})}}),ve.CLOSED_AFTER===n.pollStatus&&Object(a.createElement)(E.TimePicker,{currentTime:n.closedAfterDateTime,label:Object(l.__)("Close poll on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);o({closedAfterDateTime:t.toISOString()})},is12Hour:!0}),ve.OPEN!==n.pollStatus&&Object(a.createElement)(E.SelectControl,{value:n.closedPollState,label:Object(l.__)("When poll is closed","crowdsignal-forms"),options:[{label:Object(l.__)("Show results","crowdsignal-forms"),value:we.SHOW_RESULTS},{label:Object(l.__)('Show poll with "Closed" banner',"crowdsignal-forms"),value:we.SHOW_CLOSED_BANNER},{label:Object(l.__)("Hide poll","crowdsignal-forms"),value:we.HIDDEN}],onChange:function(e){return Object(b.includes)(we,e)&&o({closedPollState:e})}})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Block styling","crowdsignal-forms"),initialOpen:!1,colorSettings:[{value:n.textColor,onChange:function(e){return o({textColor:e})},label:Object(l.__)("Text color","crowdsignal-forms")},{value:n.backgroundColor,onChange:function(e){return o({backgroundColor:e})},label:Object(l.__)("Background color","crowdsignal-forms")},{value:n.borderColor,onChange:function(e){return o({borderColor:e})},label:Object(l.__)("Border color","crowdsignal-forms")}]},Object(a.createElement)(C.ContrastChecker,{textColor:n.textColor,backgroundColor:n.backgroundColor,fallbackBackgroundColor:c,fallbackTextColor:i}),Object(a.createElement)(E.SelectControl,{value:n.fontFamily,label:Object(l.__)("Choose font","crowdsignal-forms"),options:[{label:Object(l.__)("Default theme font","crowdsignal-forms"),value:pe.THEME_DEFAULT},{label:"Alegreya Sans",value:pe.ALEGREYA_SANS},{label:"Arial",value:pe.ARIAL},{label:"Cabin",value:pe.CABIN},{label:"Chivo",value:pe.CHIVO},{label:"Courier",value:pe.COURIER},{label:"Fira Sans",value:pe.FIRA_SANS},{label:"Georgia",value:pe.GEORGIA},{label:"Impact",value:pe.IMPACT},{label:"Josefin Sans",value:pe.JOSEFIN_SANS},{label:"Lato",value:pe.LATO},{label:"Libre Franklin",value:pe.LIBRE_FRANKLIN},{label:"Lucida",value:pe.LUCIDA},{label:"Montserrat",value:pe.MONTSERRAT},{label:"Nunito",value:pe.NUNITO},{label:"Open Sans",value:pe.OPEN_SANS},{label:"Oswald",value:pe.OSWALD},{label:"Overpass",value:pe.OVERPASS},{label:"Palatino",value:pe.PALATINO},{label:"Poppins",value:pe.POPPINS},{label:"Raleway",value:pe.RALEWAY},{label:"Roboto",value:pe.ROBOTO},{label:"Rubik",value:pe.RUBIK},{label:"Tahoma",value:pe.TAHOMA},{label:"Times New Roman",value:pe.TIMES_NEW_ROMAN},{label:"Trebuchet",value:pe.TREBUCHET},{label:"Verdana",value:pe.VERDANA}],onChange:function(e){return Object(b.includes)(pe,e)&&o({fontFamily:e})}}),"full"!==n.align&&Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.TextControl,{type:"number",label:Object(l.__)("Width (%)","crowdsignal-forms"),value:n.width,onChange:function(e){return o({width:parseInt(e,10)})}}),Object(a.createElement)(E.Button,{isSmall:!0,className:"crowdsignal-forms__reset-width-button",onClick:function(){return o({width:100})}},Object(l.__)("Reset","crowdsignal-forms"))),Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.TextControl,{label:Object(l.__)("Border thickness","crowdsignal-forms"),value:n.borderWidth,onChange:function(e){o({borderWidth:parseInt(e,10)||0})},type:"number",className:"crowdsignal-forms__small-text-input"}),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Corner radius","crowdsignal-forms"),value:n.borderRadius,onChange:function(e){o({borderRadius:parseInt(e,10)||0})},type:"number",className:"crowdsignal-forms__small-text-input"})),Object(a.createElement)(E.ToggleControl,{label:Object(l.__)("Drop shadow","crowdsignal-forms"),checked:n.hasBoxShadow,onChange:function(e){o({hasBoxShadow:e})}})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Button styling","crowdsignal-forms"),initialOpen:!1,colorSettings:[{value:n.submitButtonTextColor,onChange:function(e){return o({submitButtonTextColor:e})},label:Object(l.__)("Text color","crowdsignal-forms")},{value:n.submitButtonBackgroundColor,onChange:function(e){return o({submitButtonBackgroundColor:e})},label:Object(l.__)("Background color","crowdsignal-forms")}]},Object(a.createElement)(C.ContrastChecker,{textColor:n.submitButtonTextColor,backgroundColor:n.submitButtonBackgroundColor,fallbackBackgroundColor:s,fallbackTextColor:u}),he.BUTTON===g&&Object(a.createElement)(E.SelectControl,{value:n.buttonAlignment,label:Object(l.__)("Alignment","crowdsignal-forms"),options:[{value:je.LIST,label:Object(l.__)("List","crowdsignal-forms")},{value:je.INLINE,label:Object(l.__)("Inline","crowdsignal-forms")}],onChange:function(e){return o({buttonAlignment:e})}})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Answer settings","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)(E.CheckboxControl,{checked:n.hasOneResponsePerComputer,label:Object(l.__)("One response per computer","crowdsignal-forms"),onChange:function(e){return o({hasOneResponsePerComputer:e})}}),Object(a.createElement)(E.CheckboxControl,{checked:n.randomizeAnswers,label:Object(l.__)("Randomize answer order","crowdsignal-forms"),onChange:function(e){return o({randomizeAnswers:e})}})))};function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Ze=[{icon:function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{d:"M20 6.75H12V5.25H20V6.75Z"}),Object(a.createElement)("path",{d:"M20 12.5H12V11H20V12.5Z"}),Object(a.createElement)("path",{d:"M20 18.75H12V17.25H20V18.75Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM6 8C7.10457 8 8 7.10457 8 6C8 4.89543 7.10457 4 6 4C4.89543 4 4 4.89543 4 6C4 7.10457 4.89543 8 6 8Z"}),Object(a.createElement)("path",{d:"M6 12.75C6.55228 12.75 7 12.3023 7 11.75C7 11.1977 6.55228 10.75 6 10.75C5.44772 10.75 5 11.1977 5 11.75C5 12.3023 5.44772 12.75 6 12.75ZM6 13.75C7.10457 13.75 8 12.8546 8 11.75C8 10.6454 7.10457 9.75 6 9.75C4.89543 9.75 4 10.6454 4 11.75C4 12.8546 4.89543 13.75 6 13.75Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 19C6.55228 19 7 18.5523 7 18C7 17.4477 6.55228 17 6 17C5.44772 17 5 17.4477 5 18C5 18.5523 5.44772 19 6 19ZM6 20C7.10457 20 8 19.1046 8 18C8 16.8954 7.10457 16 6 16C4.89543 16 4 16.8954 4 18C4 19.1046 4.89543 20 6 20Z"}))},title:Object(l.__)("Choose one answer","crowdsignal-forms"),value:!1},{icon:function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 10.75H5V12.75H7V10.75ZM4 9.75V13.75H8V9.75H4Z"}),Object(a.createElement)("path",{d:"M4 4H8V8H4V4Z"}),Object(a.createElement)("path",{d:"M4 16H8V20H4V16Z"}),Object(a.createElement)("path",{d:"M20 6.75H12V5.25H20V6.75Z"}),Object(a.createElement)("path",{d:"M20 12.5H12V11H20V12.5Z"}),Object(a.createElement)("path",{d:"M20 18.75H12V17.25H20V18.75Z"}))},title:Object(l.__)("Choose multiple answers","crowdsignal-forms"),value:!0}],Ye=function(e){var t=e.attributes,n=e.setAttributes,r=Object(b.map)(Ze,(function(e){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{isActive:e.value===t.isMultipleChoice,onClick:function(){n({isMultipleChoice:e.value}),ze(e.value)}})}));return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.Toolbar,{controls:r}))},Qe=function(e){var t=e.children;return Object(a.createElement)("div",{className:"crowdsignal-forms-poll__error-banner"},t)},Je="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),Xe=new Uint8Array(16);function $e(){if(!Je)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Je(Xe)}for(var et=[],tt=0;tt<256;++tt)et.push((tt+256).toString(16).substr(1));var nt=function(e,t){var n=t||0;return(et[e[n+0]]+et[e[n+1]]+et[e[n+2]]+et[e[n+3]]+"-"+et[e[n+4]]+et[e[n+5]]+"-"+et[e[n+6]]+et[e[n+7]]+"-"+et[e[n+8]]+et[e[n+9]]+"-"+et[e[n+10]]+et[e[n+11]]+et[e[n+12]]+et[e[n+13]]+et[e[n+14]]+et[e[n+15]]).toLowerCase()};var rt=function(e,t,n){var r=(e=e||{}).random||(e.rng||$e)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return nt(r)},ot=function(e){var t=e.onEditClick;return Object(a.createElement)("div",{className:"crowdsignal-forms-poll__edit-bar"},Object(a.createElement)("div",{className:"crowdsignal-forms-poll__edit-bar-message"},Object(l.__)("Warning! This poll is published. Deleting or reordering answers may cause the loss of existing responses.","crowdsignal-forms")),Object(a.createElement)("button",{className:"crowdsignal-forms-poll__edit-bar-button",onClick:function(){t()}},Object(l.__)("Edit","crowdsignal-forms")))},at=Object(b.debounce)((function(e,t){window._tkq=window._tkq||[],window._tkq.push(["recordEvent","crowdsignal_connection_failed",{author_id:e,block_name:t}])}),5e3),lt=function(e){var t=e.blockIcon,n=e.blockName,r=e.children,o=ie(),c=o.accountInfo,i=o.reloadAccountInfo,s=c&&0!==c.id,u=!!c.is_verified,d=Object(f.useSelect)((function(e){return e("core/editor").getEditedPostAttribute("author")})),b=function(){var e=D()(A.a.mark((function e(){var t,n,r,o;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s,e.next=3,i();case 3:n=e.sent,r=0!==n.id,o=!!n.is_verified,r||window.open("/wp-admin/admin.php?page=crowdsignal-forms-setup"),t&&!o&&window.open("https://wordpress.com/me/account");case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();if(s&&u)return r;var m=!s,p=s&&!u;return at(d,n),Object(a.createElement)("div",{className:"crowdsignal-forms__connect-to-crowdsignal"},Object(a.createElement)("div",{className:"crowdsignal-forms__connect-to-crowdsignal-header"},t,Object(a.createElement)("div",{className:"crowdsignal-forms__connect-to-crowdsignal-title"},n)),Object(a.createElement)("div",{className:"crowdsignal-forms__connect-to-crowdsignal-body"},m&&Object(l.__)("You need to connect to a Crowdsignal account to collect and manage your results.","crowdsignal-forms"),p&&Object(l.__)("Please verify your WordPress.com email address in order to publish your poll.","crowdsignal-forms")),Object(a.createElement)(E.Button,{isPrimary:!0,onClick:b},m&&Object(l.__)("Connect to Crowdsignal","crowdsignal-forms"),p&&Object(l.__)("Verify or Change your Email Address","crowdsignal-forms")))};function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function it(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var st=function(e){return!!e&&("crowdsignal-forms/poll"===e.name||"crowdsignal-forms/applause"===e.name||"crowdsignal-forms/vote"===e.name)},ut=!1,dt=!1;!function(){if(!ut){ut=!0;var e=Object(f.select)("core/editor"),t=e.isEditedPostDirty,n=e.isEditedPostNew,r=e.isSavingPost,o=e.isCleanNewPost,a=e.getCurrentPostId,l=Object(f.dispatch)("crowdsignal-forms/polls"),c=l.setTryFetchPollData,i=l.setPollApiDataForClientId,s=l.setIsFetchingPollData,u=Object(f.select)("crowdsignal-forms/polls"),d=u.shouldTryFetchingPollData,m=u.getPollDataByClientId,p=u.isFetchingPollData;Object(f.subscribe)((function(){var e=Object(b.filter)(Object(f.select)("core/block-editor").getBlocks(),st);if(!(e.length<1)&&(!p()&&!(o()||n()||r()||t())&&a())){var l=Object(b.filter)(e,(function(e){var t=e.attributes;return t.pollId&&null===m(t.pollId)}));l.length<1||(d()?p()||(s(!0),Promise.all(Object(b.map)(l,(function(e){var t=e.attributes.pollId;return Q()({path:"/crowdsignal-forms/v1/polls/".concat(t,"?cached=1"),method:"GET"}).then((function(e){return i(t,it({},e,{viewResultsUrl:"https://app.crowdsignal.com/polls/".concat(e.id,"/results")}))}),(function(){return i(t,null)}))}))).finally((function(){return s(!1)}))):c(!0))}}))}}();var ft=function(e){return function(t){var n=t.attributes,r=t.setAttributes,o=t.addPollClientId,l=t.removePollClientId;return Object(_.useEffect)((function(){return("p2tenberg"in window||"p2editor"in window)&&function(){if(!dt){dt=!0;var e=null,t=function(){null!==e&&clearTimeout(e),e=setTimeout((function(){return n()}),1e3+1e3*Math.random())},n=function(){var e=Object(f.select)("crowdsignal-forms/polls"),n=e.getPollClientIds,r=e.getPollDataByClientId,o=e.shouldTryFetchingPollData,a=e.isFetchingPollData,l=Object(b.filter)(n(),(function(e){return null===r(e)}));if(l.length<1)return t();var c=Object(f.dispatch)("crowdsignal-forms/polls"),i=c.setTryFetchPollData,s=c.setPollApiDataForClientId,u=c.setIsFetchingPollData;return o()?a()||(u(!0),Promise.all(Object(b.map)(l,(function(e){return Q()({path:"/crowdsignal-forms/v1/polls/".concat(e,"?cached=1"),method:"GET"}).then((function(t){return s(e,it({},t,{viewResultsUrl:"https://app.crowdsignal.com/polls/".concat(t.id,"/results")}))}),(function(){return s(e,null)}))}))).finally((function(){return u(!1)}))):i(!0),t()};n()}}(),n.pollId&&o(n.pollId),function(){n.pollId&&l(n.pollId)}}),[]),function(e,t,n,r){Object(_.useEffect)((function(){if(!Object(b.isEmpty)(t))if(window.csPolls||(window.csPolls={}),window.csPolls[t])if(window.csPolls[t].indexOf(e)>-1);else{var o=Object(b.map)(n,(function(e){return Object(b.omit)(e,["answerId"])}));r({pollId:null,answers:o})}else window.csPolls[t]=[e]}),[t])}(t.clientId,n.pollId,n.answers,r),Object(a.createElement)(e,t)}},bt=function(e){return Object(x.compose)([Object(f.withSelect)((function(e,t){var n=e("crowdsignal-forms/polls"),r=n.getPollDataByClientId,o=n.shouldTryFetchingPollData,a=n.isFetchingPollData,l=t.attributes;return{pollDataFromApi:l.pollId?r(l.pollId):null,getPollDataByClientId:r,shouldTryFetchingPollData:o,isFetchingPollData:a}})),Object(f.withDispatch)((function(e){var t=e("crowdsignal-forms/polls");return{setTryFetchPollData:t.setTryFetchPollData,setPollApiDataForClientId:t.setPollApiDataForClientId,setIsFetchingPollData:t.setIsFetchingPollData,addPollClientId:t.addPollClientId,removePollClientId:t.removePollClientId}})),ft])(e)},mt=function(e){var t=e.icon,n=e.children,r=e.componentActions,o=void 0===r?[]:r,l=Se()(e,["icon","children","componentActions"]);return Object(a.createElement)(E.Notice,w()({className:"crowdsignal-forms__editor-notice"},l),t&&Object(a.createElement)("div",{className:"crowdsignal-forms__editor-notice-icon"},Object(a.createElement)(E.Icon,{icon:t})),Object(a.createElement)("div",{className:"crowdsignal-forms__editor-notice-text"},n),o.map((function(e){return e})))},pt=function(){return Object(a.createElement)(mt,{icon:"warning",status:"warn",isDismissible:!1,actions:[{label:Object(l.__)("Please upgrade","crowdsignal-forms"),url:"https://crowdsignal.com/pricing",className:"is-secondary",noDefaultClasses:!0}]},Object(l.__)("Your free Crowdsignal account has ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://crowdsignal.com/support/what-is-a-signal/"},Object(l.__)("exceeded 2500 signals.","crowdsignal-forms")))};function gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Ot=Object(x.compose)([Le,bt,function(e){return function(t){var n=t.attributes,r=t.setAttributes;return Object(_.useEffect)((function(){if(!n.pollId){var e=rt();r({pollId:e})}if(Object(b.some)(n.answers,(function(e){return!e.answerId&&e.text}))){var t=Object(b.map)(n.answers,(function(e){return e.answerId||!e.text?e:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gt(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{answerId:rt()})}));r({answers:t})}})),Object(a.createElement)(e,t)}}])((function(e){var t=e.attributes,n=e.className,r=e.fallbackStyles,o=e.isSelected,i=e.setAttributes,s=e.renderStyleProbe,u=e.pollDataFromApi,d=Object(_.useState)(!0),f=j()(d,2),m=f[0],p=f[1],g=Object(_.useState)(""),O=j()(g,2),v=O[0],h=O[1],y=!Object(b.isEmpty)(u),x=u?u.viewResultsUrl:"",S=u?u.id:null,T={};u&&Object(b.map)(u.answers,(function(e){T[e.client_id]=e.id}));var P=o&&"full"!==t.align,L="full"!==t.align?"".concat(t.width,"%"):"auto",N=We(t.pollStatus,t.closedAfterDateTime),A=t.note||o&&m,R=N&&we.SHOW_RESULTS===t.closedPollState,D=N&&we.HIDDEN===t.closedPollState,B=ie().accountInfo,F=Object(b.get)(B,"capabilities",[]).includes("hide-branding");Object(_.useEffect)((function(){return p(!y)}),[o]),Object(_.useEffect)((function(){o&&ze(!t.isMultipleChoice)}),[t.isMultipleChoice,o]);var M=o&&y&&!m,H=Ue(t,n);t.fontFamily&&function(e){if(!Object(b.isEmpty)(e)&&pe.THEME_DEFAULT!==e&&-1!==ge.indexOf(e)){var t="https://fonts.googleapis.com/css2?family=".concat(e,":wght@400;600;700&display=swap");0===Object(b.filter)(Array.from(document.head.childNodes),(function(e){return"link"===e.nodeName.toLowerCase()&&e.href===t})).length&&document.head.appendChild(Object(b.tap)(document.createElement("link"),(function(e){e.type="text/css",e.rel="stylesheet",e.href=t})))}}(t.fontFamily);var V=Object(b.get)(B,["signalCount","shouldDisplay"]),W=V&&Object(b.get)(B,["signalCount","count"])>=Object(b.get)(B,["signalCount","userLimit"]);return Object(a.createElement)(lt,{blockIcon:Object(a.createElement)(c,null),blockName:Object(l.__)("Crowdsignal Poll","crowdsignal-forms")},Object(a.createElement)(Ye,e),Object(a.createElement)(Ke,w()({},e,{viewResultsUrl:x,shouldPromote:V,signalWarning:W})),W&&Object(a.createElement)(pt,null),Object(a.createElement)(E.ResizableBox,{className:"crowdsignal-forms-poll__resize-wrapper",size:{height:"auto",width:L},minWidth:"25%",maxWidth:"100%",enable:{left:!0,right:!0},onResizeStop:function(e,t,n){"right"!==t&&"left"!==t||i({width:Object(b.round)(n.offsetWidth/n.parentNode.offsetWidth*100)})},showHandle:P,resizeRatio:2},Object(a.createElement)("div",{className:Ve(t,n,{"is-selected-in-editor":o,"is-closed":N,"is-hidden":D},"crowdsignal-forms-poll"),style:Fe(t,r)},M&&Object(a.createElement)(ot,{onEditClick:function(){p(!0)}}),v&&Object(a.createElement)(Qe,null,v),Object(a.createElement)("div",{className:"crowdsignal-forms-poll__content"},m?Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-poll__question",placeholder:Object(l.__)("Enter your question","crowdsignal-forms"),onChange:function(e){return i({question:e})},value:t.question,allowedFormats:[]}):Object(a.createElement)(C.RichText.Content,{tagName:"h3",className:"crowdsignal-forms-poll__question",placeholder:Object(l.__)("Enter your question","crowdsignal-forms"),value:Object(k.decodeEntities)(t.question)}),A&&(m?Object(a.createElement)(C.RichText,{tagName:"p",className:"crowdsignal-forms-poll__note",placeholder:Object(l.__)("Add a note (optional)","crowdsignal-forms"),onChange:function(e){return i({note:e})},value:t.note,allowedFormats:[]}):Object(a.createElement)(C.RichText.Content,{tagName:"div",className:"crowdsignal-forms-poll__note",placeholder:Object(l.__)("Add a note (optional)","crowdsignal-forms"),value:Object(k.decodeEntities)(t.note)})),!R&&Object(a.createElement)(De,w()({},e,{setAttributes:i,disabled:!m,answerStyle:H,buttonAlignment:t.buttonAlignment})),R&&Object(a.createElement)(ke,{answers:ye(Object(b.filter)(t.answers,(function(e){return!Ce(e)})),T),pollIdFromApi:S,hideBranding:F,setErrorMessage:h}),!F&&Object(a.createElement)(be,{editing:!0})),N&&Object(a.createElement)(I,{isPollHidden:D,isPollClosed:N}),s())))})),vt={pollId:{type:"string",default:null},isMultipleChoice:{type:"boolean",default:!1},title:{type:"string",default:null},question:{type:"string",default:""},note:{type:"string",default:""},answers:{type:"array",default:[{},{},{}],items:{type:"object",properties:{answerId:{type:"string",default:null},text:{type:"string",default:""}}}},submitButtonLabel:{type:"string",default:Object(l.__)("Submit","crowdsignal-forms")},submitButtonTextColor:{type:"string"},submitButtonBackgroundColor:{type:"string"},confirmMessageType:{type:"string",default:me.RESULTS},customConfirmMessage:{type:"string"},redirectAddress:{type:"string"},textColor:{type:"string"},backgroundColor:{type:"string"},borderColor:{type:"string"},borderWidth:{type:"number",default:2},borderRadius:{type:"number",default:0},hasBoxShadow:{type:"boolean",default:!1},fontFamily:{type:"string",default:pe.THEME_DEFAULT},hasOneResponsePerComputer:{type:"boolean",default:!1},randomizeAnswers:{type:"boolean",default:!1},align:{type:"string"},width:{type:"number",default:100},pollStatus:{type:"string",default:ve.OPEN},closedPollState:{type:"string",default:we.SHOW_RESULTS},closedAfterDateTime:{type:"string",default:null},hideBranding:{type:"boolean",default:!1},buttonAlignment:{type:"string",default:je.LIST}},wt={title:Object(l.__)("Poll","crowdsignal-forms"),description:Object(l.__)("Create polls and get your audience’s opinion — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",keywords:[Object(l.__)("ask","crowdsignal-forms"),"crowdsignal",Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("form","crowdsignal-forms"),Object(l.__)("opinion","crowdsignal-forms"),Object(l.__)("poll","crowdsignal-forms"),Object(l.__)("pop","crowdsignal-forms"),Object(l.__)("question","crowdsignal-forms"),Object(l.__)("quiz","crowdsignal-forms"),Object(l.__)("research","crowdsignal-forms"),Object(l.__)("survey","crowdsignal-forms"),Object(l.__)("vote","crowdsignal-forms")],icon:Object(a.createElement)(c,null),edit:Ot,attributes:vt,supports:{align:["center","wide","full"]},getEditWrapperProps:function(e){return{"data-align":e.align}},example:{attributes:{question:Object(l.__)("How did you hear about us?","crowdsignal-forms"),answers:[{text:Object(l.__)("Search","crowdsignal-forms")},{text:Object(l.__)("Friend","crowdsignal-forms")},{text:Object(l.__)("Email","crowdsignal-forms")}]}},styles:[{name:"default",label:Object(l.__)("List","crowdsignal-forms"),isDefault:!0},{name:"buttons",label:Object(l.__)("Buttons","crowdsignal-forms")}],variations:[{isDefault:!0,attributes:{className:"is-style-buttons"}}]},ht=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("mask",{id:"maskVote","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:"3",y:"3",width:"18",height:"18"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.5999 9.525H13.3942L14.1779 5.75475L14.2027 5.49075C14.2027 5.1525 14.0624 4.839 13.8397 4.61625L12.9652 3.75L7.53666 9.18675C7.23142 9.48374 7.04992 9.89621 7.04991 10.3499H3.75V18.6824H7.05V18.6178C7.05963 19.5172 7.79834 20.25 8.69991 20.25H16.1249C16.8097 20.25 17.3954 19.8375 17.6429 19.2435L20.1344 13.4273C20.2087 13.2375 20.2499 13.0395 20.2499 12.825V11.175C20.2499 10.2675 19.5074 9.525 18.5999 9.525ZM7.05 18.6178V10.3499H7.04991C7.04991 10.35 7.04991 10.35 7.04991 10.35V18.6C7.04991 18.6059 7.04994 18.6119 7.05 18.6178ZM18.5999 12.825L16.1249 18.6H8.69986V10.35L12.2804 6.76952L11.3646 11.175H18.5999V12.825Z",fill:"white"})),Object(a.createElement)("g",{mask:"url(#maskVote)"},Object(a.createElement)("rect",{x:"1.00024",y:"1.25",width:"22",height:"22"})))},jt=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),_t=(Object.freeze({CONNECTED:"connected",NOT_CONNECTED:"not-connected",NOT_VERIFIED:"not-verified"}),[{title:Object(l.__)("Small","crowdsignal-forms"),size:"small"},{title:Object(l.__)("Medium","crowdsignal-forms"),size:"medium"},{title:Object(l.__)("Large","crowdsignal-forms"),size:"large"}]),yt={position:"bottom right",isAlternate:!0,className:"crowdsignal-forms-vote__size-dropdown"},Ct=function(e){var t=e.attributes,n=e.setAttributes,r=e.viewResultsUrl,o=e.signalWarning,c=e.shouldPromote,i=""!==r;return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,i?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Publish this post to enable results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{href:r,isSecondary:!0,target:"_blank",disabled:!i},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{value:t.title,label:Object(l.__)("Title of the vote block","crowdsignal-forms"),onChange:function(e){return n({title:e})}}),c&&Object(a.createElement)(qe,{signalWarning:o})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms")},Object(a.createElement)(E.SelectControl,{value:t.pollStatus,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:jt.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:jt.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:jt.CLOSED}],onChange:function(e){Object(b.includes)(jt,e)&&n({closedAfterDateTime:e===jt.CLOSED_AFTER?new Date((new Date).getTime()+864e5).toISOString():null,pollStatus:e})}}),jt.CLOSED_AFTER===t.pollStatus&&Object(a.createElement)(E.TimePicker,{currentTime:t.closedAfterDateTime,label:Object(l.__)("Close vote block on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);n({closedAfterDateTime:t.toISOString()})},is12Hour:!0})))},Et=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.1894 5.75L13.6668 5.75L13.6668 4.25H19.0002H19.7502L19.7502 5V10.3333H18.2502V6.81054L6.81072 18.25L10.3333 18.25V19.75L5 19.75H4.25V19V13.6666L5.75 13.6666L5.75 17.1894L17.1894 5.75Z"}))},kt=function(){return Object(a.createElement)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("line",{x1:"8",y1:"8.5",x2:"24",y2:"8.5",stroke:"currentColor"}),Object(a.createElement)("line",{x1:"8",y1:"15",x2:"24",y2:"15",stroke:"currentColor",strokeWidth:"2"}),Object(a.createElement)("line",{x1:"8",y1:"22.5",x2:"24",y2:"22.5",stroke:"currentColor",strokeWidth:"3"}))},xt=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{d:"M12.0078 18.2266C14.7656 18.2266 16.4062 15.9531 16.4062 12.3438C16.4062 8.73438 14.75 6.5 12.0078 6.5C9.25781 6.5 7.59375 8.75 7.59375 12.3516C7.59375 15.9688 9.24219 18.2266 12.0078 18.2266ZM12.0078 16.5781C10.5078 16.5781 9.625 15 9.625 12.3438C9.625 9.73438 10.5234 8.14844 12.0078 8.14844C13.4844 8.14844 14.3672 9.71875 14.3672 12.3516C14.3672 15.0078 13.5 16.5781 12.0078 16.5781Z"}))};function St(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Tt=function(e){var t=e.attributes,n=e.setAttributes,r=Object(b.get)(t,"size","medium"),o=_t,c=Object(_.useState)(!1),i=j()(c,2),s=i[0],u=i[1],f=function(){return u(!s)},m=t.hideResults?Object(l.__)("Show vote counters","crowdsignal-forms"):Object(l.__)("Hide vote counters","crowdsignal-forms");return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.ToolbarGroup,{isCollapsed:!0,icon:Et,label:Object(l.__)("Change block size","crowdsignal-forms"),popoverProps:yt,controls:o.map((function(e){var t=e.size;return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?St(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):St(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{isActive:r===t,role:"menuitemradio",onClick:function(){return n({size:t})}})}))}),Object(a.createElement)(E.Toolbar,{controls:[{icon:kt,onClick:f},{icon:xt,label:m,onClick:function(){return n({hideResults:!t.hideResults})},isActive:!t.hideResults,isPressed:!t.hideResults}]}),s&&Object(a.createElement)(E.Popover,{className:"crowdsignal-forms__border-popover",onFocusOutside:f},Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.TextControl,{label:Object(l.__)("Border thickness","crowdsignal-forms"),type:"number",className:"crowdsignal-forms__small-text-input",onChange:function(e){n({borderWidth:parseInt(e,10)||0})},value:t.borderWidth||0}),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Corner radius","crowdsignal-forms"),type:"number",className:"crowdsignal-forms__small-text-input",onChange:function(e){n({borderRadius:parseInt(e,10)||0})},value:t.borderRadius||0}))))},It=function(e){return function(t){return function(n){var r=n.attributes,o=n.setAttributes;return Object(_.useEffect)((function(){Object(b.forEach)(e,(function(e){r[e]||o(d()({},e,rt()))}))}),[]),Object(a.createElement)(t,n)}}},Pt=function(e,t,n,r){return Object(_.useEffect)((function(){Object(b.isEmpty)(window.csBlockTypeCount)&&(window.csBlockTypeCount={}),Object(b.isNil)(window.csBlockTypeCount[e])&&(window.csBlockTypeCount[e]=0),window.csBlockTypeCount[e]++,null===n.title&&(1===window.csBlockTypeCount[e]?r({title:t}):r({title:"".concat(t," ").concat(window.csBlockTypeCount[e])}))}),[])},Lt=Object(x.compose)([bt,It(["pollId"])])((function(e){var t=e.attributes,n=e.setAttributes,r=e.className,o=e.pollDataFromApi;Pt(e.name,Object(l.__)("Untitled Vote","crowdsignal-forms"),t,n);var c=o?o.viewResultsUrl:"",i=We(t.pollStatus,t.closedAfterDateTime),s=T()(r,"crowdsignal-forms-vote","size-".concat(t.size),{"no-results":t.hideResults,"is-closed":i}),u=function(e){return Object(b.mapKeys)({borderRadius:"".concat(e.borderRadius,"px"),borderWidth:"".concat(e.borderWidth,"px")},(function(e,t){return"--crowdsignal-forms-vote-".concat(Object(b.kebabCase)(t))}))}(t),d=ie().accountInfo,f=Object(b.get)(d,["signalCount","shouldDisplay"]),m=f&&Object(b.get)(d,["signalCount","count"])>=Object(b.get)(d,["signalCount","userLimit"]);return Object(a.createElement)(lt,{blockIcon:null,blockName:Object(l.__)("Crowdsignal Vote","crowdsignal-forms")},Object(a.createElement)(Ct,w()({},e,{shouldPromote:f,signalWarning:m,viewResultsUrl:c})),Object(a.createElement)(Tt,e),Object(a.createElement)("div",{className:s,style:u},Object(a.createElement)("div",{className:"crowdsignal-forms-vote__items"},Object(a.createElement)(C.InnerBlocks,{template:[["crowdsignal-forms/vote-item",{type:"up"}],["crowdsignal-forms/vote-item",{type:"down"}]],templateInsertUpdatesSelection:!1,templateLock:"insert",allowedBlocks:["crowdsignal-forms/vote-item"],orientation:"horizontal",__experimentalMoverDirection:"horizontal"}))))})),Nt={pollId:{type:"string",default:null},hideBranding:{type:"boolean",default:!1},title:{type:"string",default:null},pollStatus:{type:"string",default:jt.OPEN},closedAfterDateTime:{type:"string",default:null},size:{type:"string",default:"medium"},borderWidth:{type:"number",default:1},borderRadius:{type:"number",default:5},hideResults:{type:"boolean",default:!1}},At={title:Object(l.__)("Vote","crowdsignal-forms"),description:Object(l.__)("Allow your audience to rate your work or express their opinion — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",keywords:[Object(l.__)("ballot","crowdsignal-forms"),Object(l.__)("button","crowdsignal-forms"),Object(l.__)("count","crowdsignal-forms"),"crowdsignal",Object(l.__)("deciding","crowdsignal-forms"),Object(l.__)("decision","crowdsignal-forms"),Object(l.__)("elect","crowdsignal-forms"),Object(l.__)("election","crowdsignal-forms"),Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("form","crowdsignal-forms"),Object(l.__)("like","crowdsignal-forms"),Object(l.__)("nero","crowdsignal-forms"),Object(l.__)("opinion","crowdsignal-forms"),Object(l.__)("poll","crowdsignal-forms"),Object(l.__)("polling","crowdsignal-forms"),Object(l.__)("rate","crowdsignal-forms"),Object(l.__)("rating","crowdsignal-forms"),Object(l.__)("research","crowdsignal-forms"),Object(l.__)("survey","crowdsignal-forms"),Object(l.__)("thumb down","crowdsignal-forms"),Object(l.__)("thumb up","crowdsignal-forms"),Object(l.__)("thumbs","crowdsignal-forms"),Object(l.__)("vote","crowdsignal-forms"),Object(l.__)("voting","crowdsignal-forms")],icon:Object(a.createElement)(ht,null),edit:Lt,save:function(){return Object(a.createElement)(C.InnerBlocks.Content,null)},attributes:Nt,example:{attributes:{className:"crowdsignal-forms-vote__example",size:"large"}}},Rt=function(e){var t=e.attributes,n=e.setAttributes;return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Styling","crowdsignal-forms"),initialOpen:!0,colorSettings:[{value:t.textColor,onChange:function(e){return n({textColor:e})},label:Object(l.__)("Text color","crowdsignal-forms")},{value:t.backgroundColor,onChange:function(e){return n({backgroundColor:e})},label:Object(l.__)("Background color","crowdsignal-forms")},{value:t.borderColor,onChange:function(e){return n({borderColor:e})},label:Object(l.__)("Border color","crowdsignal-forms")}]}))};function Dt(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Bt(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var Ft=n(22),Mt=n.n(Ft),Ht=!1,Vt=y.a.createContext(null),Wt="entering",Ut="entered",zt=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var o,a=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?a?(o="exited",r.appearStatus=Wt):o=Ut:o=t.unmountOnExit||t.mountOnEnter?"unmounted":"exited",r.state={status:o},r.nextCallback=null,r}Dt(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&"unmounted"===t.status?{status:"exited"}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==Wt&&n!==Ut&&(t=Wt):n!==Wt&&n!==Ut||(t="exiting")}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===Wt?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,o=this.props.nodeRef?[r]:[Mt.a.findDOMNode(this),r],a=o[0],l=o[1],c=this.getTimeouts(),i=r?c.appear:c.enter;!e&&!n||Ht?this.safeSetState({status:Ut},(function(){t.props.onEntered(a)})):(this.props.onEnter(a,l),this.safeSetState({status:Wt},(function(){t.props.onEntering(a,l),t.onTransitionEnd(i,(function(){t.safeSetState({status:Ut},(function(){t.props.onEntered(a,l)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:Mt.a.findDOMNode(this);t&&!Ht?(this.props.onExit(r),this.safeSetState({status:"exiting"},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:Mt.a.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=o[0],l=o[1];this.props.addEndListener(a,l)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if("unmounted"===e)return null;var t=this.props,n=t.children,r=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,Bt(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return y.a.createElement(Vt.Provider,{value:null},"function"==typeof n?n(e,r):y.a.cloneElement(y.a.Children.only(n),r))},t}(y.a.Component);function qt(){}zt.contextType=Vt,zt.propTypes={},zt.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:qt,onEntering:qt,onEntered:qt,onExit:qt,onExiting:qt,onExited:qt},zt.UNMOUNTED="unmounted",zt.EXITED="exited",zt.ENTERING=Wt,zt.ENTERED=Ut,zt.EXITING="exiting";var Kt,Gt,Zt=zt;var Yt="out-in",Qt="in-out",Jt=function(e,t,n){return function(){var r;e.props[t]&&(r=e.props)[t].apply(r,arguments),n()}},Xt=((Kt={})[Yt]=function(e){var t=e.current,n=e.changeState;return y.a.cloneElement(t,{in:!1,onExited:Jt(t,"onExited",(function(){n(Wt,null)}))})},Kt[Qt]=function(e){var t=e.current,n=e.changeState,r=e.children;return[t,y.a.cloneElement(r,{in:!0,onEntered:Jt(r,"onEntered",(function(){n(Wt)}))})]},Kt),$t=((Gt={})[Yt]=function(e){var t=e.children,n=e.changeState;return y.a.cloneElement(t,{in:!0,onEntered:Jt(t,"onEntered",(function(){n(Ut,y.a.cloneElement(t,{in:!0}))}))})},Gt[Qt]=function(e){var t=e.current,n=e.children,r=e.changeState;return[y.a.cloneElement(t,{in:!1,onExited:Jt(t,"onExited",(function(){r(Ut,y.a.cloneElement(n,{in:!0}))}))}),y.a.cloneElement(n,{in:!0})]},Gt),en=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={status:Ut,current:null},t.appeared=!1,t.changeState=function(e,n){void 0===n&&(n=t.state.current),t.setState({status:e,current:n})},t}Dt(t,e);var n=t.prototype;return n.componentDidMount=function(){this.appeared=!0},t.getDerivedStateFromProps=function(e,t){return null==e.children?{current:null}:t.status===Wt&&e.mode===Qt?{status:Wt}:!t.current||(n=t.current,r=e.children,n===r||y.a.isValidElement(n)&&y.a.isValidElement(r)&&null!=n.key&&n.key===r.key)?{current:y.a.cloneElement(e.children,{in:!0})}:{status:"exiting"};var n,r},n.render=function(){var e,t=this.props,n=t.children,r=t.mode,o=this.state,a=o.status,l=o.current,c={children:n,current:l,changeState:this.changeState,status:a};switch(a){case Wt:e=$t[r](c);break;case"exiting":e=Xt[r](c);break;case Ut:e=l}return y.a.createElement(Vt.Provider,{value:{isMounting:!this.appeared}},e)},t}(y.a.Component);en.propTypes={},en.defaultProps={mode:Yt};var tn=en;function nn(){return(nn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function rn(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var on=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=rn(n.className,r):n.setAttribute("class",rn(n.className&&n.className.baseVal||"",r)));var n,r}))},an=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),o=r[0],a=r[1];t.removeClasses(o,"exit"),t.addClass(o,a?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),o=r[0],a=r[1]?"appear":"enter";t.addClass(o,a,"active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),o=r[0],a=r[1]?"appear":"enter";t.removeClasses(o,a),t.addClass(o,a,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r="string"==typeof n,o=r?""+(r&&n?n+"-":"")+e:n[e];return{baseClassName:o,activeClassName:r?o+"-active":n[e+"Active"],doneClassName:r?o+"-done":n[e+"Done"]}},t}Dt(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var r=this.getClassNames(t)[n+"ClassName"],o=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&o&&(r+=" "+o),"active"===n&&e&&e.scrollTop,r&&(this.appliedClasses[t][n]=r,function(e,t){e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.add(r):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,r)||("string"==typeof n.className?n.className=n.className+" "+r:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+r)));var n,r}))}(e,r))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,o=n.active,a=n.done;this.appliedClasses[t]={},r&&on(e,r),o&&on(e,o),a&&on(e,a)},n.render=function(){var e=this.props,t=(e.classNames,Bt(e,["classNames"]));return y.a.createElement(Zt,nn({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(y.a.Component);an.defaultProps={classNames:""},an.propTypes={};var ln=an,cn=function(e){var t=e.className,n=e.fillColor,r=void 0===n?"black":n;return Object(a.createElement)("svg",{className:t,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("g",{clipPath:"url(#clipThumbsUp)"},Object(a.createElement)("mask",{id:"maskThumbsUp","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:"2",y:"-1",width:"20",height:"20"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.35 6.24998H13.5658L14.4366 2.06081L14.4641 1.76748C14.4641 1.39165 14.3083 1.04331 14.0608 0.795813L13.0891 -0.166687L7.05748 5.87415C6.71831 6.20415 6.51664 6.66248 6.51664 7.16665L2.84998 7.16665V16.425H6.51664V16.3333C6.51664 17.3416 7.34164 18.1666 8.34998 18.1666H16.6C17.3608 18.1666 18.0116 17.7083 18.2866 17.0483L21.055 10.5858C21.1375 10.375 21.1833 10.155 21.1833 9.91665V8.08331C21.1833 7.07498 20.3583 6.24998 19.35 6.24998ZM19.35 9.91665L16.6 16.3333H8.34998V7.16665L12.3283 3.18831L11.3108 8.08331H19.35V9.91665Z",fill:"white"})),Object(a.createElement)("g",{mask:"url(#maskThumbsUp)"},Object(a.createElement)("rect",{x:"0.999878",y:"-3.05176e-05",width:"22",height:"22",fill:r}))),Object(a.createElement)("defs",null,Object(a.createElement)("clipPath",{id:"clipThumbsUp"},Object(a.createElement)("rect",{width:"24",height:"24",fill:"white"}))))},sn=function(e){var t=e.className,n=e.fillColor,r=void 0===n?"black":n;return Object(a.createElement)("svg",{className:t,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("g",{clipPath:"url(#clipThumbsDown)"},Object(a.createElement)("mask",{id:"maskThumbsDown","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:"2",y:"5",width:"20",height:"20"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.65002 17.75H10.4342L9.56336 21.9392L9.53586 22.2325C9.53586 22.6083 9.69169 22.9567 9.93919 23.2042L10.9109 24.1667L16.9425 18.1258C17.2817 17.7958 17.4834 17.3375 17.4834 16.8333L21.15 16.8333L21.15 7.57499H17.4834V7.66666C17.4834 6.65832 16.6584 5.83332 15.65 5.83332H7.40003C6.63919 5.83332 5.98836 6.29165 5.71336 6.95166L2.94503 13.4142C2.86253 13.625 2.81669 13.845 2.81669 14.0833V15.9167C2.81669 16.925 3.64169 17.75 4.65002 17.75ZM4.65002 14.0833L7.40002 7.66666H15.65L15.65 16.8333L11.6717 20.8117L12.6892 15.9167H4.65002V14.0833Z",fill:"white"})),Object(a.createElement)("g",{mask:"url(#maskThumbsDown)"},Object(a.createElement)("rect",{x:"23.0001",y:"24",width:"22",height:"22",transform:"rotate(-180 23.0001 24)",fill:r}))),Object(a.createElement)("defs",null,Object(a.createElement)("clipPath",{id:"clipThumbsDown"},Object(a.createElement)("rect",{width:"24",height:"24",fill:"white"}))))},un=function(e){return e?e>=1e7?"".concat(Object(b.round)(e/1e6),"M"):e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e4?"".concat(Object(b.round)(e/1e3),"K"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString():"0"},dn=function(e){var t=e.attributes,n=e.voteCount,r=e.apiAnswerId,o=e.onVote,l=e.disabled,c=e.isVotedOn,i=e.hideCount,s=e.fallbackStyles,u=e.isInEditor,d=t.className,f=t.type,m=Object(_.useState)(0),p=j()(m,2),g=p[0],O=p[1],v=function(){!l&&o&&(O(1),o(r))},w="up"===f?cn:sn,h="is-type-".concat(f),y=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return T()({"has-bg-color":e.backgroundColor,"has-text-color":e.textColor,"has-border-color":e.borderColor},n)}(t,"crowdsignal-forms-vote-item",d,{"is-voted-on":c,"is-disabled":l,"is-in-editor":u},h),C=function(e,t){var n=Object(b.isEmpty)(e.textColor)?t.textColor:e.textColor,r=Object(b.isEmpty)(e.backgroundColor)?t.backgroundColor:e.backgroundColor;return Object(b.mapKeys)({borderColor:e.borderColor,bgColor:r,textColor:n,votedColor:t.accentColor},(function(e,t){return"--crowdsignal-forms-vote-".concat(Object(b.kebabCase)(t))}))}(t,s),E=n+g;return Object(a.createElement)("div",{className:y,onClick:v,onKeyPress:v,role:"button",style:C,tabIndex:0},Object(a.createElement)(w,{className:"crowdsignal-forms-vote-item__icon",fillColor:"currentColor"}),!i&&Object(a.createElement)(tn,{mode:"in-out"},Object(a.createElement)(ln,{key:g,classNames:"crowdsignal-forms-vote-item__count",timeout:300},Object(a.createElement)("div",{className:"crowdsignal-forms-vote-item__count"},un(E)))))};dn.propTypes={apiAnswerId:L.a.number,className:L.a.string,disabled:L.a.bool,isVotedOn:L.a.bool,onVote:L.a.func,type:L.a.string.isRequired,voteCount:L.a.number.isRequired};var fn=dn,bn=Object(x.compose)([Le,It(["answerId"])])((function(e){var t=e.attributes,n=e.className,r=e.fallbackStyles,o=e.renderStyleProbe;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)(Rt,e),Object(a.createElement)(fn,{attributes:t,fallbackStyles:r,className:n,voteCount:0,isInEditor:!0,type:t.type}),o())})),mn={title:Object(l.__)("Vote Item","crowdsignal-forms"),description:Object(l.__)("Allow your audience to rate your work or express their opinion — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",parent:["crowdsignal-forms/vote"],icon:Object(a.createElement)(ht,null),edit:bn,attributes:{answerId:{type:"string",default:null},type:{type:"string"},textColor:{type:"string"},backgroundColor:{type:"string"},borderColor:{type:"string"}}},pn=function(e){var t=e.showBranding,n=e.referralCode;return Object(a.createElement)("div",{className:"crowdsignal-forms__branding"},t&&Object(a.createElement)("a",{className:"crowdsignal-forms__branding-link with-external-icon",href:"https://crowdsignal.com?ref=".concat(n),target:"blank",rel:"noopener noreferrer"},Object(l.__)("Powered by Crowdsignal","crowdsignal-forms")),!t&&Object(a.createElement)("span",{className:"crowdsignal-forms__branding-link"}," "))};pn.propTypes={showBranding:L.a.bool,referralCode:L.a.string.isRequired};var gn=pn,On=function(e){var t=e.active,n=e.className,r=T()("crowdsignal-forms-applause__animation",n,{"is-active":t});return Object(a.createElement)("svg",{className:r,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("g",{className:"crowdsignal-forms-applause__animation-right"},Object(a.createElement)("path",{className:"crowdsignal-forms-applause__animation-inner-fill",fillRule:"evenodd",clipRule:"evenodd",d:"M24.5287 18.5813L21.719 22.432C20.771 23.7312 18.9509 24.0157 17.6517 23.0676L9.50948 17.1265C8.6982 16.5345 8.52021 15.3957 9.11218 14.5844C9.18511 14.4845 9.26979 14.3931 9.35606 14.3119L9.19145 14.1918C8.38017 13.5998 8.20218 12.461 8.79415 11.6497C8.93571 11.4557 9.10825 11.2933 9.30319 11.1743C9.10822 10.6266 9.17716 10.0013 9.54606 9.49567C10.1123 8.71967 11.1811 8.52659 11.9839 9.03133C12.0392 8.91852 12.1004 8.81 12.1733 8.71006C12.7653 7.89878 13.9042 7.72079 14.7154 8.31276L20.3297 12.4094L20.611 10.4435C20.6949 9.84704 21.1499 9.35925 21.7392 9.23069L23.703 8.79878L25.0454 16.3547C25.1822 17.1302 24.992 17.9464 24.5287 18.5813Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M24.5287 18.5813L21.719 22.432C20.771 23.7312 18.9509 24.0157 17.6517 23.0676L9.50948 17.1265C8.6982 16.5345 8.52021 15.3957 9.11218 14.5844C9.18511 14.4845 9.26979 14.3931 9.35606 14.3119L9.19145 14.1918C8.38017 13.5998 8.20218 12.461 8.79415 11.6497C8.93571 11.4557 9.10825 11.2933 9.30319 11.1743C9.10822 10.6266 9.17716 10.0013 9.54606 9.49567C10.1123 8.71967 11.1811 8.52659 11.9839 9.03133C12.0392 8.91852 12.1004 8.81 12.1733 8.71006C12.7653 7.89878 13.9042 7.72079 14.7154 8.31276L20.3297 12.4094L20.611 10.4435C20.6949 9.84704 21.1499 9.35925 21.7392 9.23069L23.703 8.79878L25.0454 16.3547C25.1822 17.1302 24.992 17.9464 24.5287 18.5813ZM23.6104 16.605L22.538 10.5434L22.0547 10.6502L21.4234 15.0093L13.8574 9.48855C13.8574 9.48855 13.4691 9.4034 13.349 9.56801C13.2288 9.73262 13.2638 9.95632 13.4284 10.0764L17.667 13.1693L16.8091 14.345L11.2301 10.2742C11.0655 10.1541 10.8418 10.189 10.7217 10.3536C10.6016 10.5182 10.6365 10.7419 10.8012 10.862L16.3802 14.9329L15.5222 16.1087L10.4782 12.4282C10.3136 12.3081 10.0899 12.343 9.96978 12.5076C9.84967 12.6722 9.88463 12.8959 10.0492 13.0161L15.0933 16.6966L14.2353 17.8723L10.7962 15.3629C10.6316 15.2428 10.4079 15.2777 10.2878 15.4423C10.1677 15.607 10.2027 15.8307 10.3673 15.9508L18.5094 21.8919C19.1561 22.3638 20.0713 22.2207 20.5431 21.5741L23.3571 17.7175C23.5888 17.4001 23.6766 16.9957 23.6104 16.605Z"})),Object(a.createElement)("g",{className:"crowdsignal-forms-applause__animation-left"},Object(a.createElement)("path",{className:"crowdsignal-forms-applause__animation-inner-fill",fillRule:"evenodd",clipRule:"evenodd",d:"M21.2292 18.7813L18.4195 22.632C17.4715 23.9312 15.6513 24.2157 14.3521 23.2676L6.20992 17.3265C5.39864 16.7345 5.22065 15.5957 5.81262 14.7844C5.88554 14.6845 5.97023 14.5931 6.0565 14.5119L5.89189 14.3918C5.08061 13.7998 4.90262 12.661 5.49459 11.8497C5.63615 11.6557 5.80869 11.4933 6.00363 11.3743C5.80866 10.8266 5.8776 10.2013 6.2465 9.69567C6.81274 8.91967 7.88153 8.72658 8.68439 9.23133C8.73968 9.11852 8.80084 9.01 8.87377 8.91006C9.46573 8.09878 10.6046 7.92079 11.4159 8.51276L17.0302 12.6094L17.3115 10.6435C17.3953 10.047 17.8504 9.55925 18.4397 9.43069L20.4034 8.99877L21.7458 16.5547C21.8826 17.3302 21.6925 18.1464 21.2292 18.7813Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.2292 18.7813L18.4195 22.632C17.4715 23.9312 15.6513 24.2157 14.3521 23.2676L6.20992 17.3265C5.39864 16.7345 5.22065 15.5957 5.81262 14.7844C5.88554 14.6845 5.97023 14.5931 6.0565 14.5119L5.89189 14.3918C5.08061 13.7998 4.90262 12.661 5.49459 11.8497C5.63615 11.6557 5.80869 11.4933 6.00363 11.3743C5.80866 10.8266 5.8776 10.2013 6.2465 9.69567C6.81274 8.91967 7.88153 8.72658 8.68439 9.23133C8.73968 9.11852 8.80084 9.01 8.87377 8.91006C9.46573 8.09878 10.6046 7.92079 11.4159 8.51276L17.0302 12.6094L17.3115 10.6435C17.3953 10.047 17.8504 9.55925 18.4397 9.43069L20.4034 8.99877L21.7458 16.5547C21.8826 17.3302 21.6925 18.1464 21.2292 18.7813ZM20.3108 16.805L19.2384 10.7434L18.7551 10.8502L18.1239 15.2093L10.5578 9.68854C10.5578 9.68854 10.1695 9.6034 10.0494 9.76801C9.92928 9.93261 9.96425 10.1563 10.1289 10.2764L14.3675 13.3692L13.5096 14.545L7.93056 10.4742C7.76595 10.354 7.54224 10.389 7.42213 10.5536C7.30202 10.7182 7.33699 10.9419 7.50159 11.062L13.0806 15.1329L12.2227 16.3087L7.17864 12.6282C7.01403 12.5081 6.79033 12.543 6.67022 12.7076C6.55011 12.8722 6.58507 13.0959 6.74968 13.216L11.7937 16.8965L10.9358 18.0723L7.49667 15.5629C7.33206 15.4428 7.10836 15.4777 6.98825 15.6423C6.86814 15.8069 6.9031 16.0307 7.06771 16.1508L15.2099 22.0919C15.8566 22.5638 16.7717 22.4207 17.2436 21.7741L20.0576 17.9175C20.2892 17.6001 20.3771 17.1957 20.3108 16.805Z"})),Object(a.createElement)("g",{className:"crowdsignal-forms-applause__animation-wave-small"},Object(a.createElement)("rect",{x:"15.4854",y:"4.42176",width:"1.5",height:"3",transform:"rotate(8 15.4854 4.42176)"}),Object(a.createElement)("rect",{x:"19.9369",y:"5.15548",width:"1.5",height:"3",transform:"rotate(43 19.9369 5.15548)"}),Object(a.createElement)("rect",{x:"11.1523",y:"4.78963",width:"1.5",height:"3",transform:"rotate(-27 11.1523 4.78963)"})),Object(a.createElement)("g",{className:"crowdsignal-forms-applause__animation-wave-large"},Object(a.createElement)("rect",{x:"23.453",y:"2.41095",width:"1.5",height:"3",transform:"rotate(38 23.453 2.41095)"}),Object(a.createElement)("rect",{x:"26.9413",y:"5.27211",width:"1.5",height:"3",transform:"rotate(73 26.9413 5.27211)"}),Object(a.createElement)("rect",{x:"19.5165",y:"0.562988",width:"1.5",height:"3",transform:"rotate(3 19.5165 0.562988)"}),Object(a.createElement)("rect",{width:"1.5",height:"3",transform:"matrix(-0.788011 0.615662 0.615662 0.788011 8.52597 2.41095)"}),Object(a.createElement)("rect",{width:"1.5",height:"3",transform:"matrix(-0.292372 0.956305 0.956305 0.292372 5.03775 5.27211)"}),Object(a.createElement)("rect",{width:"1.5",height:"3",transform:"matrix(-0.99863 0.052336 0.052336 0.99863 12.4625 0.562988)"})))},vn=function(e){var t=e.attributes,n=e.fallbackStyles,r=e.renderStyleProbe,o=t.apiPollData?t.apiPollData.id:null,l=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r="cs-poll-".concat(e),o=Object(_.useState)(!1),a=j()(o,2),l=a[0],c=a[1],i=Object(_.useState)(!1),s=j()(i,2),u=s[0],d=s[1],f=Object(_.useState)(""),b=j()(f,2),m=b[0],p=b[1];Object(_.useEffect)((function(){t&&void 0!==F.a.get(r)&&(d(!0),p(F.a.get(r)))}),[]);var g=function(){var o=D()(A.a.mark((function o(a){var l,i,s,u=arguments;return A.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return l=u.length>1&&void 0!==u[1]?u[1]:1,o.prev=1,c(!0),o.next=5,ee(e);case 5:return i=o.sent,o.next=8,te(i,e,a,l);case 8:d(!0),t&&(s=n?a.join(","):(new Date).getTime(),F.a.set(r,s,{sameSite:"Strict",expires:365}),p(s));case 10:return o.prev=10,c(!1),o.finish(10);case 13:case"end":return o.stop()}}),o,null,[[1,,10,13]])})));return function(e){return o.apply(this,arguments)}}();return{hasVoted:u,isVoting:l,vote:g,storedCookieValue:m}}(o,!0),c=l.hasVoted,i=l.vote,s=Object(_.useState)(0),u=j()(s,2),d=u[0],f=u[1],m=Object(_.useState)(0),p=j()(m,2),g=p[0],O=p[1],v=Object(_.useState)(null),w=j()(v,2),h=w[0],y=w[1],C=Object(_.useState)(!1),E=j()(C,2),k=E[0],x=E[1],S=Object(_.useState)(null),I=j()(S,2),P=I[0],L=I[1],N=le(o).results,R=We(t.pollStatus,t.closedAfterDateTime),B=function(){if(null!==o&&!R){P&&clearTimeout(P),x(!0),L(setTimeout((function(){x(!1)}),200));var e=g+1;O(e),f(d+1);var n=t.apiPollData.answers[0].id;null!==h&&clearTimeout(h);var r=setTimeout((function(){i([n],e),y(null),O(0)}),1e3);y(r)}},M=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return T()({"has-bg-color":e.backgroundColor,"has-text-color":e.textColor,"has-border-color":e.borderColor},n)}(t,"crowdsignal-forms-applause",t.className,"size-".concat(t.size),{"is-closed":R}),H=function(e,t){var n=Object(b.isEmpty)(e.textColor)?t.textColor:e.textColor;return Object(b.mapKeys)({bgColor:e.backgroundColor||t.backgroundColor,textColor:n,hoverColor:t.accentColor,borderRadius:"".concat(e.borderRadius||0,"px"),borderWidth:"".concat(e.borderWidth||0,"px"),borderColor:e.borderColor},(function(e,t){return"--crowdsignal-forms-applause-".concat(Object(b.kebabCase)(t))}))}(t,n),V=(null!==N?Object(b.values)(N)[0]:0)+d;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{className:M,style:H,onClick:B,onKeyPress:B,role:"button",tabIndex:0},Object(a.createElement)(On,{active:k}),Object(a.createElement)("p",{className:"crowdsignal-forms-applause__count"},un(V)," Claps"),r()),Object(a.createElement)(gn,{showBranding:c&&!t.hideBranding,referralCode:"cs-forms-applause"}))};vn.propTypes={className:L.a.string};var wn=Le(vn),hn=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),jn=[{title:Object(l.__)("Small","crowdsignal-forms"),size:"small"},{title:Object(l.__)("Medium","crowdsignal-forms"),size:"medium"},{title:Object(l.__)("Large","crowdsignal-forms"),size:"large"}],_n={position:"bottom right",isAlternate:!0,className:"crowdsignal-forms-vote__size-dropdown"};function yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Cn=function(e){var t=e.attributes,n=e.setAttributes,r=Object(b.get)(t,"size","medium"),o=jn,c=Object(_.useState)(!1),i=j()(c,2),s=i[0],u=i[1],f=function(){return u(!s)};return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.ToolbarGroup,{isCollapsed:!0,icon:Et,label:Object(l.__)("Change block size","crowdsignal-forms"),popoverProps:_n,controls:o.map((function(e){var t=e.size;return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yn(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{isActive:r===t,role:"menuitemradio",onClick:function(){return n({size:t})}})}))}),Object(a.createElement)(E.Toolbar,{controls:[{icon:kt,onClick:f}]}),s&&Object(a.createElement)(E.Popover,{className:"crowdsignal-forms__border-popover",onFocusOutside:f},Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.TextControl,{label:Object(l.__)("Border thickness","crowdsignal-forms"),type:"number",className:"crowdsignal-forms__small-text-input",onChange:function(e){n({borderWidth:parseInt(e,10)||0})},value:t.borderWidth}),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Corner radius","crowdsignal-forms"),type:"number",className:"crowdsignal-forms__small-text-input",onChange:function(e){n({borderRadius:parseInt(e,10)||0})},value:t.borderRadius}))))},En=function(e){var t=e.attributes,n=e.setAttributes,r=e.viewResultsUrl,o=e.shouldPromote,c=e.signalWarning,i=""!==r;return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,i?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Publish this post to enable results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{href:r,isSecondary:!0,target:"_blank",disabled:!i},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{value:t.title,label:Object(l.__)("Title of the applause block","crowdsignal-forms"),onChange:function(e){return n({title:e})}}),o&&Object(a.createElement)(qe,{signalWarning:c})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms")},Object(a.createElement)(E.SelectControl,{value:t.pollStatus,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:hn.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:hn.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:hn.CLOSED}],onChange:function(e){Object(b.includes)(hn,e)&&n({closedAfterDateTime:e===hn.CLOSED_AFTER?new Date((new Date).getTime()+864e5).toISOString():null,pollStatus:e})}}),hn.CLOSED_AFTER===t.pollStatus&&Object(a.createElement)(E.TimePicker,{currentTime:t.closedAfterDateTime,label:Object(l.__)("Close applause block on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);n({closedAfterDateTime:t.toISOString()})},is12Hour:!0})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Styling","crowdsignal-forms"),initialOpen:!0,colorSettings:[{value:t.textColor,onChange:function(e){return n({textColor:e})},label:Object(l.__)("Text color","crowdsignal-forms")},{value:t.backgroundColor,onChange:function(e){return n({backgroundColor:e})},label:Object(l.__)("Background color","crowdsignal-forms")},{value:t.borderColor,onChange:function(e){return n({borderColor:e})},label:Object(l.__)("Border color","crowdsignal-forms")}]}))},kn=Object(x.compose)([bt,It(["pollId","answerId"])])((function(e){var t=e.attributes,n=e.setAttributes,r=e.pollDataFromApi,o=r?r.viewResultsUrl:"";Pt(e.name,Object(l.__)("Untitled Applause","crowdsignal-forms"),t,n);var c=ie().accountInfo,i=Object(b.get)(c,["signalCount","shouldDisplay"]),s=i&&Object(b.get)(c,["signalCount","count"])>=Object(b.get)(c,["signalCount","userLimit"]);return Object(a.createElement)(lt,{blockIcon:null,blockName:Object(l.__)("Crowdsignal Applause","crowdsignal-forms")},Object(a.createElement)(En,w()({},e,{shouldPromote:i,signalWarning:s,viewResultsUrl:o})),Object(a.createElement)(Cn,e),Object(a.createElement)(wn,e))})),xn={pollId:{type:"string",default:null},hideBranding:{type:"boolean",default:!1},title:{type:"string",default:null},answerId:{type:"string",default:null},size:{type:"string",default:"medium"},pollStatus:{type:"string",default:hn.OPEN},closedAfterDateTime:{type:"string",default:null},textColor:{type:"string"},backgroundColor:{type:"string"},borderColor:{type:"string"},borderWidth:{type:"number",default:0},borderRadius:{type:"number",default:0}},Sn={title:Object(l.__)("Applause","crowdsignal-forms"),description:Object(l.__)("Let your audience cheer with a big round of applause — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",keywords:["crowdsignal",Object(l.__)("applause","crowdsignal-forms"),Object(l.__)("cheer","crowdsignal-forms"),Object(l.__)("cheering","crowdsignal-forms"),Object(l.__)("clap","crowdsignal-forms"),Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("kudos","crowdsignal-forms"),Object(l.__)("like","crowdsignal-forms"),Object(l.__)("opinion","crowdsignal-forms"),Object(l.__)("praise","crowdsignal-forms"),Object(l.__)("rating","crowdsignal-forms"),Object(l.__)("upvote","crowdsignal-forms"),Object(l.__)("upvoting","crowdsignal-forms"),Object(l.__)("votes","crowdsignal-forms"),Object(l.__)("voting","crowdsignal-forms")],icon:Object(a.createElement)((function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("g",{clipPath:"url(#clip0)"},Object(a.createElement)("rect",{width:"24",height:"24",fill:"white"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.5284 16.5813L18.7187 20.432C17.7707 21.7312 15.9506 22.0157 14.6513 21.0676L6.50915 15.1265C5.69788 14.5345 5.51988 13.3957 6.11185 12.5844C6.18478 12.4845 6.26946 12.3931 6.35573 12.3119L6.19112 12.1918C5.37984 11.5998 5.20185 10.461 5.79382 9.64968C5.93538 9.45568 6.10792 9.29329 6.30287 9.17428C6.1079 8.62662 6.17683 8.00125 6.54574 7.49567C7.11197 6.71967 8.18077 6.52659 8.98362 7.03133C9.03891 6.91852 9.10007 6.81 9.173 6.71006C9.76497 5.89878 10.9038 5.72079 11.7151 6.31276L17.3294 10.4094L17.6107 8.44349C17.6946 7.84704 18.1496 7.35925 18.7389 7.23069L20.7027 6.79878L22.045 14.3547C22.1819 15.1302 21.9917 15.9464 21.5284 16.5813ZM20.61 14.605L19.5377 8.54337L19.0543 8.65016L18.4231 13.0093L10.857 7.48855C10.857 7.48855 10.4687 7.4034 10.3486 7.56801C10.2285 7.73262 10.2635 7.95632 10.4281 8.07643L14.6667 11.1693L13.8088 12.345L8.22979 8.27416C8.06518 8.15405 7.84147 8.18902 7.72136 8.35362C7.60126 8.51823 7.63622 8.74194 7.80082 8.86204L13.3798 12.9329L12.5219 14.1087L7.47787 10.4282C7.31327 10.3081 7.08956 10.343 6.96945 10.5076C6.84934 10.6722 6.8843 10.8959 7.04891 11.0161L12.0929 14.6966L11.235 15.8723L7.7959 13.3629C7.6313 13.2428 7.40759 13.2777 7.28748 13.4423C7.16737 13.607 7.20233 13.8307 7.36694 13.9508L15.5091 19.8919C16.1558 20.3638 17.0709 20.2207 17.5428 19.5741L20.3568 15.7175C20.5884 15.4001 20.6763 14.9957 20.61 14.605Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.2289 16.7813L15.4192 20.632C14.4711 21.9312 12.651 22.2157 11.3518 21.2676L3.20959 15.3265C2.39831 14.7345 2.22032 13.5957 2.81229 12.7844C2.88522 12.6845 2.9699 12.5931 3.05617 12.5119L2.89156 12.3918C2.08028 11.7998 1.90229 10.661 2.49426 9.84968C2.63582 9.65567 2.80836 9.49329 3.0033 9.37428C2.80834 8.82662 2.87727 8.20125 3.24618 7.69567C3.81241 6.91967 4.88121 6.72658 5.68406 7.23133C5.73935 7.11852 5.80051 7.01 5.87344 6.91006C6.46541 6.09878 7.60427 5.92079 8.41555 6.51276L14.0298 10.6094L14.3111 8.64348C14.395 8.04703 14.85 7.55925 15.4393 7.43069L17.4031 6.99877L18.7455 14.5547C18.8823 15.3302 18.6921 16.1464 18.2289 16.7813Z",fill:"white"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.2289 16.7813L15.4192 20.632C14.4711 21.9312 12.651 22.2157 11.3518 21.2676L3.20959 15.3265C2.39831 14.7345 2.22032 13.5957 2.81229 12.7844C2.88522 12.6845 2.9699 12.5931 3.05617 12.5119L2.89156 12.3918C2.08028 11.7998 1.90229 10.661 2.49426 9.84968C2.63582 9.65567 2.80836 9.49329 3.0033 9.37428C2.80834 8.82662 2.87727 8.20125 3.24618 7.69567C3.81241 6.91967 4.88121 6.72658 5.68406 7.23133C5.73935 7.11852 5.80051 7.01 5.87344 6.91006C6.46541 6.09878 7.60427 5.92079 8.41555 6.51276L14.0298 10.6094L14.3111 8.64348C14.395 8.04703 14.85 7.55925 15.4393 7.43069L17.4031 6.99877L18.7455 14.5547C18.8823 15.3302 18.6921 16.1464 18.2289 16.7813ZM17.3105 14.805L16.2381 8.74337L15.7548 8.85016L15.1235 13.2093L7.55749 7.68854C7.55749 7.68854 7.16918 7.6034 7.04907 7.76801C6.92896 7.93261 6.96392 8.15632 7.12853 8.27643L11.3672 11.3692L10.5092 12.545L4.93023 8.47416C4.76562 8.35405 4.54191 8.38901 4.4218 8.55362C4.3017 8.71823 4.33666 8.94193 4.50126 9.06204L10.0803 13.1329L9.22235 14.3087L4.17831 10.6282C4.0137 10.5081 3.79 10.543 3.66989 10.7076C3.54978 10.8722 3.58474 11.0959 3.74935 11.216L8.79338 14.8965L7.93546 16.0723L4.49634 13.5629C4.33173 13.4428 4.10803 13.4777 3.98792 13.6423C3.86781 13.8069 3.90277 14.0307 4.06738 14.1508L12.2096 20.0919C12.8562 20.5638 13.7714 20.4207 14.2432 19.7741L17.0572 15.9175C17.2889 15.6001 17.3767 15.1957 17.3105 14.805Z"}),Object(a.createElement)("rect",{x:"12.4851",y:"1.42175",width:"1.5",height:"3",transform:"rotate(8 12.4851 1.42175)"}),Object(a.createElement)("rect",{x:"16.9365",y:"2.15547",width:"1.5",height:"3",transform:"rotate(43 16.9365 2.15547)"}),Object(a.createElement)("rect",{x:"8.15195",y:"1.78963",width:"1.5",height:"3",transform:"rotate(-27 8.15195 1.78963)"})),Object(a.createElement)("defs",null,Object(a.createElement)("clipPath",{id:"clip0"},Object(a.createElement)("rect",{width:"24",height:"24",fill:"white"}))))}),null),edit:kn,attributes:xn,example:{attributes:{size:"large"}}},Tn="rating",In="feedback",Pn=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),Ln={backgroundColor:{type:"string"},buttonColor:{type:"string"},buttonTextColor:{type:"string"},feedbackPlaceholder:{type:"string",default:Object(l.__)("Please help us understand your rating","crowdsignal-forms")},feedbackQuestion:{type:"string",default:Object(l.__)("Thanks so much for your response! How could we do better?","crowdsignal-forms")},hideBranding:{type:"boolean",default:!1},highRatingLabel:{type:"string",default:Object(l.__)("Extremely likely","crowdsignal-forms")},lowRatingLabel:{type:"string",default:Object(l.__)("Not likely at all","crowdsignal-forms")},ratingQuestion:{type:"string",default:Object(l.__)("How likely is it that you would recommend this project to a friend or colleague?","crowdsignal-forms")},submitButtonLabel:{type:"string",default:Object(l.__)("Submit","crowdsignal-forms")},surveyId:{type:"number",default:null},textColor:{type:"string"},title:{type:"string",default:""},viewThreshold:{type:"string",default:2},status:{type:"string",default:Pn.OPEN},closedAfterDateTime:{type:"string",default:null},isExample:{type:"boolean",default:!1}},Nn=n(32),An=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object(_.useState)(!1),r=j()(n,2),o=r[0],a=r[1],l=Object(_.useRef)(0),c=Object(_.useCallback)(Object(b.debounce)((function(t,n){return e(t).catch(n)}),1500),[]),i=Object(_.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;a(!1),c(t,(function(){e===l.current&&(n<3?i(e,n+1):a(!0))}))}),Object(b.values)(t));return Object(_.useEffect)((function(){0!=l.current++&&i(l.current)}),Object(b.values)(t)),{error:o,save:function(){return i(l.current)}}},Rn=function(e){return new Promise((function(t,n){var r=setTimeout((function(){return n(new Error("Request timed out"))}),1e4);e.then(t,n).finally((function(){return clearTimeout(r)}))}))},Dn=function(e){return Rn(Q()({path:Object(b.trimEnd)("/crowdsignal-forms/v1/nps/".concat(e.surveyId||""),"/"),method:"POST",data:e}))},Bn=function(e){var t=e.attributes,n=e.setAttributes,r=e.shouldPromote,o=e.signalWarning,c="https://app.crowdsignal.com/surveys/".concat(t.surveyId,"/report/overview"),i=function(e){return function(t){return n(d()({},e,t))}};return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,t.surveyId?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Save the block to track results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{isSecondary:!0,disabled:!t.surveyId,href:c,target:"blank"},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Title (optional)","crowdsignal-forms"),onChange:function(e){return n({title:e})},value:Object(k.decodeEntities)(t.title)}),r&&Object(a.createElement)(qe,{signalWarning:o})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Block styling","crowdsignal-forms"),initialOpen:!1,colorSettings:[{label:Object(l.__)("Background color","crowdsignal-forms"),onChange:i("backgroundColor"),value:t.backgroundColor},{label:Object(l.__)("Text color","crowdsignal-forms"),onChange:i("textColor"),value:t.textColor},{label:Object(l.__)("Button color","crowdsignal-forms"),onChange:i("buttonColor"),value:t.buttonColor},{label:Object(l.__)("Button text color","crowdsignal-forms"),onChange:i("buttonTextColor"),value:t.buttonTextColor}]}),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms"),initialOpen:!1},Object(a.createElement)(E.SelectControl,{value:t.status,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:Pn.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:Pn.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:Pn.CLOSED}],onChange:function(e){return n({status:e})},help:Pn.CLOSED_AFTER===t.status&&null!==t.closedAfterDateTime&&(new Date).toISOString()>t.closedAfterDateTime?"Currently closed as date has passed":""}),Pn.CLOSED_AFTER===t.status&&Object(a.createElement)(E.DateTimePicker,{currentDate:t.closedAfterDateTime&&new Date(t.closedAfterDateTime)||new Date,label:Object(l.__)("Close on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);n({closedAfterDateTime:t.toISOString()})},is12Hour:!0})))},Fn=function(e){var t=e.attributes,n=e.currentView,r=e.onViewChange,o=e.setAttributes,c=Object(_.useState)(!1),i=j()(c,2),s=i[0],u=i[1],d=function(e){return function(){return r(e)}};return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.ToolbarGroup,{label:Object(l.__)("Current view","crowdsignal-forms")},Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-nps__toolbar-toggle",isActive:n===Tn,label:Object(l.__)("Rating","crowdsignal-forms"),onClick:d(Tn)},Object(l.__)("Rating","crowdsignal-forms")),Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-nps__toolbar-toggle",isActive:n===In,label:Object(l.__)("Feedback","crowdsignal-forms"),onClick:d(In)},Object(l.__)("Feedback","crowdsignal-forms"))),Object(a.createElement)(E.ToolbarGroup,null,Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-nps__toolbar-popover-button",icon:"visibility",label:Object(l.__)("Set view threshold","crowdsignal-forms"),onClick:function(){return u(!0)}},s&&Object(a.createElement)(E.Popover,{onClose:function(){return u(!1)}},Object(a.createElement)("div",{className:"crowdsignal-forms-nps__toolbar-popover"},Object(a.createElement)(E.TextControl,{label:Object(l.__)("Show this block after __ visits:","crowdsignal-forms"),value:t.viewThreshold,onChange:function(e){return o({viewThreshold:e})},type:"number",min:"1"}))))))},Mn=function(e,t){return Object(b.mapKeys)({backgroundColor:e.backgroundColor||"#ffffff",buttonColor:e.buttonColor||t.accentColor,buttonTextColor:e.buttonTextColor||t.textColorInverted,textColor:e.textColor||t.textColor,textSize:t.textSize},(function(e,t){return"--crowdsignal-forms-".concat(Object(b.kebabCase)(t))}))},Hn=function(e){var t=e.retryHandler;return Object(a.createElement)(mt,{status:"error",icon:"warning",isDismissible:!1,actions:[{className:"is-destructive",label:Object(l.__)("Retry","crowdsignal-forms"),onClick:t}]},Object(l.__)("Unfortunately, the block couldn't be saved to Crowdsignal.com.","crowdsignal-forms"))},Vn=Object(x.compose)([Object(f.withSelect)((function(e){var t=e("core/editor").getPermalink();return t||(t=e("core").getSite()&&e("core").getSite().url),{sourceLink:t}})),Le])((function(e){var t=Object(_.useState)(Tn),n=j()(t,2),r=n[0],o=n[1],c=e.attributes,i=e.clientId,s=e.fallbackStyles,u=e.isSelected,m=e.setAttributes,p=e.renderStyleProbe,g=e.sourceLink,O=c.feedbackQuestion,v=c.ratingQuestion,h=c.surveyId,y=c.title,k=c.isExample,x=c.viewThreshold,S=An(function(){var e=D()(A.a.mark((function e(t){var n;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Object(f.dispatch)("core/editor").lockPostSaving(i),e.prev=1,e.next=4,Dn({feedbackQuestion:t.feedbackQuestion,ratingQuestion:t.ratingQuestion,sourceLink:t.sourceLink,surveyId:t.surveyId,title:t.title||t.ratingQuestion});case 4:n=e.sent,t.surveyId||m({surveyId:n.surveyId});case 6:return e.prev=6,Object(f.dispatch)("core/editor").unlockPostSaving(i),e.finish(6);case 9:case"end":return e.stop()}}),e,null,[[1,,6,9]])})));return function(t){return e.apply(this,arguments)}}(),{feedbackQuestion:O,ratingQuestion:v,sourceLink:g,surveyId:h,title:y}),I=S.error,P=S.save;Object(_.useEffect)((function(){k||c.surveyId||P()}),[]),Object(_.useEffect)((function(){u||o(Tn)}),[u]);var L=function(e){return function(t){return m(d()({},e,t))}},N=T()("crowdsignal-forms-nps",{"is-inactive":!k&&!u}),R=ie().accountInfo,B=Object(b.get)(R,"capabilities",[]).includes("hide-branding"),F=Object(b.get)(R,["signalCount","shouldDisplay"]),M=F&&Object(b.get)(R,["signalCount","count"])>=Object(b.get)(R,["signalCount","userLimit"]);return Object(a.createElement)(lt,{blockIcon:null,blockName:Object(l.__)("Crowdsignal NPS","crowdsignal-forms")},Object(a.createElement)(Fn,w()({currentView:r,onViewChange:o},e)),Object(a.createElement)(Bn,w()({shouldPromote:F,signalWarning:M},e)),!k&&M&&Object(a.createElement)(pt,null),!k&&I&&Object(a.createElement)(Hn,{retryHandler:P}),!k&&Object(a.createElement)(mt,{isDismissible:!1,icon:"visibility",componentActions:[Object(a.createElement)(Nn.PostPreviewButton,{key:1,className:["is-secondary","components-notice__action","crowdsignal-forms-nps__preview-button",c.surveyId?"":"is-disabled"],textContent:Object(l.__)("Preview","crowdsignal-forms")})]},Object(l.sprintf)(Object(l._n)("This block will appear as a popup window to people who have visited this page at least %d time.","This block will appear as a popup window to people who have visited this page at least %d times.",x,"crowdsignal-forms"),x)),(r===Tn||!u)&&Object(a.createElement)("div",{className:N,style:Mn(c,s)},Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-nps__question",placeholder:Object(l.__)("Enter your rating question","crowdsignal-forms"),onChange:L("ratingQuestion"),value:v,allowedFormats:[]}),Object(a.createElement)("div",{className:"crowdsignal-forms-nps__rating"},Object(a.createElement)("div",{className:"crowdsignal-forms-nps__rating-labels"},Object(a.createElement)(C.RichText,{tagName:"span",placeholder:Object(l.__)("Not likely","crowdsignal-forms"),onChange:L("lowRatingLabel"),value:c.lowRatingLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0}),Object(a.createElement)(C.RichText,{tagName:"span",placeholder:Object(l.__)("Very likely","crowdsignal-forms"),onChange:L("highRatingLabel"),value:c.highRatingLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0})),Object(a.createElement)("div",{className:"crowdsignal-forms-nps__rating-scale"},Object(b.times)(11,(function(e){return Object(a.createElement)("div",{key:"rating-".concat(e),className:"crowdsignal-forms-nps__rating-button"},e)}))),!B&&Object(a.createElement)(be,{trackRef:"cs-forms-nps",editing:!0,message:Object(l.__)("Collect your own feedback with Crowdsignal","crowdsignal-forms")}))),r===In&&u&&Object(a.createElement)("div",{className:N,style:Mn(c,s)},Object(a.createElement)("div",{className:"crowdsignal-forms-nps__feedback"},Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-nps__question",placeholder:Object(l.__)("Enter your feedback question","crowdsignal-forms"),onChange:L("feedbackQuestion"),value:O,allowedFormats:[]}),Object(a.createElement)(E.TextareaControl,{className:"crowdsignal-forms-nps__feedback-text",rows:6,onChange:L("feedbackPlaceholder"),value:c.feedbackPlaceholder}),Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-nps__feedback-button-wrapper"},Object(a.createElement)(C.RichText,{className:"wp-block-button__link crowdsignal-forms-nps__feedback-button",onChange:L("submitButtonLabel"),value:c.submitButtonLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0})),!B&&Object(a.createElement)(be,{trackRef:"cs-forms-nps",editing:!0,message:Object(l.__)("Collect your own feedback with Crowdsignal","crowdsignal-forms")}))),p())})),Wn={title:Object(l.__)("Measure NPS","crowdsignal-forms"),description:Object(l.__)("Calculate your Net Promoter Score! Collect feedback and track customer satisfaction over time. — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",attributes:Ln,supports:{multiple:!1,html:!1,reusable:!1},icon:Object(a.createElement)((function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{d:"M4.49707 15V10.3857H4.54102L7.83691 15H9.05762V7.9541H7.64648V12.5439H7.60742L4.31641 7.9541H3.08594V15H4.49707ZM9.73438 7.9541V15H11.209V12.7783H12.5273C14.0117 12.7783 15.042 11.8115 15.042 10.3662C15.042 8.91602 14.0459 7.9541 12.6006 7.9541H9.73438ZM11.209 9.12109H12.21C13.0547 9.12109 13.543 9.57031 13.543 10.3711C13.543 11.1768 13.0498 11.626 12.2051 11.626H11.209V9.12109ZM15.1523 12.9932C15.1963 14.3164 16.2754 15.1221 17.9697 15.1221C19.7178 15.1221 20.8262 14.2578 20.8262 12.8906C20.8262 11.8164 20.2109 11.2109 18.7998 10.9082L17.9453 10.7275C17.1348 10.542 16.793 10.2979 16.793 9.86328C16.793 9.34082 17.2812 8.99414 18.0088 8.99414C18.7461 8.99414 19.2686 9.35547 19.3174 9.95117H20.6992C20.6748 8.67676 19.6445 7.83203 18.0039 7.83203C16.4316 7.83203 15.3086 8.69141 15.3086 9.99023C15.3086 11.0205 15.9482 11.6797 17.2471 11.958L18.165 12.1582C19.0146 12.3486 19.3516 12.6025 19.3516 13.0615C19.3516 13.5791 18.8145 13.9551 18.0283 13.9551C17.2471 13.9551 16.6416 13.5742 16.5732 12.9932H15.1523Z"}))}),null),edit:Vn,keywords:[Object(l.__)("ask","crowdsignal-forms"),"crowdsignal",Object(l.__)("CSAT","crowdsignal-forms"),Object(l.__)("customer experience","crowdsignal-forms"),Object(l.__)("customer satisfaction","crowdsignal-forms"),Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("form","crowdsignal-forms"),Object(l.__)("loyalty","crowdsignal-forms"),Object(l.__)("net promoter score","crowdsignal-forms"),Object(l.__)("nps","crowdsignal-forms"),Object(l.__)("opinion","crowdsignal-forms"),Object(l.__)("poll","crowdsignal-forms"),Object(l.__)("promoter","crowdsignal-forms"),Object(l.__)("research","crowdsignal-forms"),Object(l.__)("rating","crowdsignal-forms"),Object(l.__)("review","crowdsignal-forms"),Object(l.__)("score","crowdsignal-forms"),Object(l.__)("survey","crowdsignal-forms")],example:{attributes:{isExample:!0,ratingQuestion:Object(l.__)("How satisfied are you with the content of the site?","crowdsignal-forms"),feedbackQuestion:Object(l.__)("Any advise on how we could improve your experience?","crowdsignal-forms"),lowRatingLabel:Object(l.__)("Not satisfied","crowdsignal-forms"),highRatingLabel:Object(l.__)("Very satisfied","crowdsignal-forms")}}},Un=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5.25V17.6893L6.42678 16.2626C6.75497 15.9344 7.20008 15.75 7.66421 15.75H18.75C18.8881 15.75 19 15.6381 19 15.5V5.5C19 5.36193 18.8881 5.25 18.75 5.25H5ZM3.5 5C3.5 4.30965 4.05964 3.75 4.75 3.75H18.75C19.7165 3.75 20.5 4.5335 20.5 5.5V15.5C20.5 16.4665 19.7165 17.25 18.75 17.25H7.66421C7.59791 17.25 7.53432 17.2763 7.48744 17.3232L3.5 21.3107V5Z"}),Object(a.createElement)("rect",{x:"7",y:"9.75",width:"1.5",height:"1.5"}),Object(a.createElement)("rect",{x:"11.25",y:"9.75",width:"1.5",height:"1.5"}),Object(a.createElement)("rect",{x:"15.5",y:"9.75",width:"1.5",height:"1.5"}))},zn="question",qn="submit",Kn=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),Gn=Object.freeze({CLICK:"click",HOVER:"hover",PAGE_LOAD:"load"}),Zn={backgroundColor:{type:"string"},buttonColor:{type:"string"},buttonTextColor:{type:"string"},emailPlaceholder:{type:"string",default:Object(l.__)("Your Email","crowdsignal-forms")},emailRequired:{type:"boolean",default:!1},feedbackPlaceholder:{type:"string",default:Object(l.__)("Please let us know how we can do better…","crowdsignal-forms")},header:{type:"string",default:Object(l.__)("👋 Hey there!","crowdsignal-forms")},hideBranding:{type:"boolean",default:!1},hideTriggerShadow:{type:"boolean",default:!1},submitButtonLabel:{type:"string",default:Object(l.__)("Submit","crowdsignal-forms")},submitText:{type:"string",default:Object(l.__)("Thanks for letting us know!","crowdsignal-forms")},surveyId:{type:"number",default:null},textColor:{type:"string"},toggleOn:{type:"string",default:Gn.CLICK},triggerLabel:{type:"string",default:Object(l.__)("Feedback","crowdsignal-forms")},triggerBackgroundColor:{type:"string"},triggerTextColor:{type:"string"},title:{type:"string",default:""},x:{type:"string",default:"left"},y:{type:"string",default:"bottom"},status:{type:"string",default:Kn.OPEN},closedAfterDateTime:{type:"string",default:null},emailResponses:{type:"boolean",default:!0},isExample:{type:"boolean",default:!1},isWidget:{type:"boolean",default:!1}};function Yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yn(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Jn,Xn=function(e,t){return{left:e.left+t.x+window.scrollX,right:e.right+(window.innerWidth>t.left+t.width?window.innerWidth-t.left-t.width:0),top:e.top+t.y+window.scrollY,bottom:e.bottom+(window.innerHeight>t.top+t.height?window.innerHeight-t.top-t.height:0)}},$n=function(e,t,n){return{left:"left"===e?n.left:null,right:"right"===e?n.right:null}},er=function(e,t,n){return"center"===e?{top:(window.innerHeight-t)/2,bottom:null}:{top:"top"===e?n.top:null,bottom:"bottom"===e?n.bottom:null}},tr=function(e){var t=e.attributes,n=e.setAttributes,r=e.shouldPromote,o=e.signalWarning,c=e.email,i="https://app.crowdsignal.com/surveys/".concat(t.surveyId,"/report/overview"),s=function(e){return function(t){return n(d()({},e,t))}};return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,t.surveyId?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Save the block to track results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{isSecondary:!0,disabled:!t.surveyId,href:i,target:"blank"},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Title (optional)","crowdsignal-forms"),onChange:function(e){return n({title:e})},value:Object(k.decodeEntities)(t.title)}),Object(a.createElement)(E.ToggleControl,{label:Object(l.__)("Send me responses via email","crowdsignal-forms"),checked:t.emailResponses,onChange:s("emailResponses"),help:t.emailResponses&&c&&Object(l.sprintf)(Object(l.__)("Responses will be sent to %s","crowdsignal-forms"),c)}),r&&Object(a.createElement)(qe,{signalWarning:o})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Feedback Button","crowdsignal-forms"),initialOpen:!1,colorSettings:[{label:Object(l.__)("Background color","crowdsignal-forms"),onChange:s("triggerBackgroundColor"),value:t.triggerBackgroundColor},{label:Object(l.__)("Text color","crowdsignal-forms"),onChange:s("triggerTextColor"),value:t.triggerTextColor}]},Object(a.createElement)(E.ToggleControl,{label:Object(l.__)("Hide Shadow","crowdsignal-forms"),checked:t.hideTriggerShadow,onChange:s("hideTriggerShadow")})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Block styling","crowdsignal-forms"),initialOpen:!1,colorSettings:[{label:Object(l.__)("Background color","crowdsignal-forms"),onChange:s("backgroundColor"),value:t.backgroundColor},{label:Object(l.__)("Text color","crowdsignal-forms"),onChange:s("textColor"),value:t.textColor},{label:Object(l.__)("Button color","crowdsignal-forms"),onChange:s("buttonColor"),value:t.buttonColor},{label:Object(l.__)("Button text color","crowdsignal-forms"),onChange:s("buttonTextColor"),value:t.buttonTextColor}]}),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms"),initialOpen:!1},Object(a.createElement)(E.SelectControl,{value:t.status,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:Kn.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:Kn.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:Kn.CLOSED}],onChange:function(e){return n({status:e})},help:Kn.CLOSED_AFTER===t.status&&null!==t.closedAfterDateTime&&(new Date).toISOString()>t.closedAfterDateTime?"Currently closed as date has passed":""}),Kn.CLOSED_AFTER===t.status&&Object(a.createElement)(E.DateTimePicker,{currentDate:t.closedAfterDateTime&&new Date(t.closedAfterDateTime)||new Date,label:Object(l.__)("Close on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);n({closedAfterDateTime:t.toISOString()})},is12Hour:!0}),Object(a.createElement)(E.SelectControl,{value:t.toggleOn,label:Object(l.__)("Show feedback form on:","crowdsignal-forms"),options:[{label:Object(l.__)("Click","crowdsignal-forms"),value:Gn.CLICK},{label:Object(l.__)("Hover","crowdsignal-forms"),value:Gn.HOVER},{label:Object(l.__)("Page load","crowdsignal-forms"),value:Gn.PAGE_LOAD}],onChange:s("toggleOn")}),Object(a.createElement)(E.ToggleControl,{label:Object(l.__)("Require email address","crowdsignal-forms"),checked:t.emailRequired,onChange:s("emailRequired")})))},nr=n(33);function rr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function or(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ar(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?or(Object(n),!0).forEach((function(t){rr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):or(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function lr(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ir(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return cr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cr(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function sr(e){return e?e.ownerDocument||e:document}try{Jn=window}catch(ba){}function ur(e){return e&&sr(e).defaultView||Jn}var dr,fr=(dr=ur(),Boolean(void 0!==dr&&dr.document&&dr.document.createElement)),br=fr?_.useLayoutEffect:_.useEffect;function mr(e){return Object(_.useState)(e)[0]}function pr(e){for(var t,n=[[]],r=function(){var e=t.value,r=n.find((function(t){return!t[0]||t[0].groupId===e.groupId}));r?r.push(e):n.push([e])},o=ir(e);!(t=o()).done;)r();return n}function gr(e){for(var t,n=[],r=ir(e);!(t=r()).done;){var o=t.value;n.push.apply(n,o)}return n}function Or(e){return e.slice().reverse()}function vr(e,t){return t?e.find((function(e){return!e.disabled&&e.id!==t})):e.find((function(e){return!e.disabled}))}function wr(e,t){var n;return t||null===t?t:e.currentId||null===e.currentId?e.currentId:null===(n=vr(e.items||[]))||void 0===n?void 0:n.id}function hr(e,t){if(t)return null==e?void 0:e.find((function(e){return e.id===t&&!e.disabled}))}function jr(e,t){return function(e){return"function"==typeof e}(e)?e(t):e}function _r(e){return void 0===e&&(e="id"),(e?e+"-":"")+Math.random().toString(32).substr(2,6)}var yr=Object(_.createContext)(_r);function Cr(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Er(e,t){return e.findIndex((function(e){return!(!e.ref.current||!t.ref.current)&&Cr(t.ref.current,e.ref.current)}))}function kr(e){for(var t,n=0,r=ir(e);!(t=r()).done;){var o=t.value.length;o>n&&(n=o)}return n}function xr(e){for(var t=pr(e),n=kr(t),r=[],o=0;o<n;o+=1)for(var a,l=ir(t);!(a=l()).done;){var c=a.value;c[o]&&r.push(ar(ar({},c[o]),{},{groupId:c[o].groupId?""+o:void 0}))}return r}function Sr(e,t,n){for(var r,o=kr(e),a=ir(e);!(r=a()).done;)for(var l=r.value,c=0;c<o;c+=1){var i=l[c];if(!i||n&&i.disabled){var s=0===c&&n?vr(l):l[c-1];l[c]=s&&t!==(null==s?void 0:s.id)&&n?s:{id:"__EMPTY_ITEM__",disabled:!0,ref:{current:null},groupId:null==s?void 0:s.groupId}}}return e}var Tr={id:null,ref:{current:null}};function Ir(e,t){return e.filter((function(e){return e.groupId===t}))}var Pr={horizontal:"vertical",vertical:"horizontal"};function Lr(e,t,n){return n in e?[].concat(e.slice(0,n),[t],e.slice(n)):[].concat(e,[t])}function Nr(e){var t=e.map((function(e,t){return[t,e]})),n=!1;return t.sort((function(e,t){var r=e[0],o=e[1],a=t[0],l=t[1],c=o.ref.current,i=l.ref.current;return c&&i?Cr(c,i)?(r>a&&(n=!0),-1):(r<a&&(n=!0),1):0})),n?t.map((function(e){e[0];return e[1]})):e}function Ar(e,t){var n=Nr(e);e!==n&&t(n)}function Rr(e,t){var n=Object(_.useRef)([]);Object(_.useEffect)((function(){for(var r,o=function(e){for(var t,n=e[0],r=e.slice(1),o=null==n||null===(t=n.ref.current)||void 0===t?void 0:t.parentElement,a=function(){var e=o;if(r.every((function(t){return e.contains(t.ref.current)})))return{v:o};o=o.parentElement};o;){var l=a();if("object"==typeof l)return l.v}return sr(o).body}(e),a=new IntersectionObserver((function(){!!n.current.length&&Ar(e,t),n.current=e}),{root:o}),l=ir(e);!(r=l()).done;){var c=r.value;c.ref.current&&a.observe(c.ref.current)}return function(){a.disconnect()}}),[e])}function Dr(e,t){"function"==typeof IntersectionObserver?Rr(e,t):function(e,t){Object(_.useEffect)((function(){var n=setTimeout((function(){return Ar(e,t)}),250);return function(){return clearTimeout(n)}}))}(e,t)}function Br(e,t){var n=e.unstable_virtual,r=e.rtl,o=e.orientation,a=e.items,l=e.groups,c=e.currentId,i=e.loop,s=e.wrap,u=e.pastIds,d=e.shift,f=e.unstable_moves,b=e.unstable_includesBaseElement,m=e.initialVirtual,p=e.initialRTL,g=e.initialOrientation,O=e.initialCurrentId,v=e.initialLoop,w=e.initialWrap,h=e.initialShift,j=e.hasSetCurrentId;switch(t.type){case"registerGroup":var _=t.group;if(0===l.length)return ar(ar({},e),{},{groups:[_]});var y=Er(l,_);return ar(ar({},e),{},{groups:Lr(l,_,y)});case"unregisterGroup":var C=t.id,E=l.filter((function(e){return e.id!==C}));return E.length===l.length?e:ar(ar({},e),{},{groups:E});case"registerItem":var k,x=t.item,S=l.find((function(e){var t;return null===(t=e.ref.current)||void 0===t?void 0:t.contains(x.ref.current)})),T=ar({groupId:null==S?void 0:S.id},x),I=Er(a,T),P=ar(ar({},e),{},{items:Lr(a,T,I)});return j||f||void 0!==O?P:ar(ar({},P),{},{currentId:null===(k=vr(P.items))||void 0===k?void 0:k.id});case"unregisterItem":var L=t.id,N=a.filter((function(e){return e.id!==L}));if(N.length===a.length)return e;var A=u.filter((function(e){return e!==L})),R=ar(ar({},e),{},{pastIds:A,items:N});if(c&&c===L){var D=b?null:wr(ar(ar({},R),{},{currentId:A[0]}));return ar(ar({},R),{},{currentId:D})}return R;case"move":var B=t.id;if(void 0===B)return e;var F=u.filter((function(e){return e!==c&&e!==B})),M=c?[c].concat(F):F,H=ar(ar({},e),{},{pastIds:M});if(null===B)return ar(ar({},H),{},{unstable_moves:f+1,currentId:wr(H,B)});var V=hr(a,B);return ar(ar({},H),{},{unstable_moves:V?f+1:f,currentId:wr(H,null==V?void 0:V.id)});case"next":if(null==c)return Br(e,ar(ar({},t),{},{type:"first"}));var W=r&&"vertical"!==o,U=W?Or(a):a,z=U.find((function(e){return e.id===c}));if(!z)return Br(e,ar(ar({},t),{},{type:"first"}));var q=!!z.groupId,K=U.indexOf(z),G=U.slice(K+1),Z=Ir(G,z.groupId);if(t.allTheWay){var Y=vr(W?Ir(U,z.groupId):Or(Z));return Br(e,ar(ar({},t),{},{type:"move",id:null==Y?void 0:Y.id}))}var Q=function(e){return e&&Pr[e]}(q?o||"horizontal":o),J=i&&i!==Q,X=q&&s&&s!==Q,$=t.hasNullItem||!q&&J&&b;if(J){var ee=vr(function(e,t,n){var r=e.findIndex((function(e){return e.id===t}));return[].concat(e.slice(r+1),n?[Tr]:[],e.slice(0,r))}(X&&!$?U:Ir(U,z.groupId),c,$),c);return Br(e,ar(ar({},t),{},{type:"move",id:null==ee?void 0:ee.id}))}if(X){var te=vr($?Z:G,c),ne=$?(null==te?void 0:te.id)||null:null==te?void 0:te.id;return Br(e,ar(ar({},t),{},{type:"move",id:ne}))}var re=vr(Z,c);return Br(e,!re&&$?ar(ar({},t),{},{type:"move",id:null}):ar(ar({},t),{},{type:"move",id:null==re?void 0:re.id}));case"previous":var oe=!!!l.length&&b,ae=Br(ar(ar({},e),{},{items:Or(a)}),ar(ar({},t),{},{type:"next",hasNullItem:oe}));return ar(ar({},ae),{},{items:a});case"down":var le=d&&!t.allTheWay,ce=xr(gr(Sr(pr(a),c,le))),ie=i&&"horizontal"!==i&&b,se=Br(ar(ar({},e),{},{orientation:"vertical",items:ce}),ar(ar({},t),{},{type:"next",hasNullItem:ie}));return ar(ar({},se),{},{orientation:o,items:a});case"up":var ue=d&&!t.allTheWay,de=xr(Or(gr(Sr(pr(a),c,ue)))),fe=b,be=Br(ar(ar({},e),{},{orientation:"vertical",items:de}),ar(ar({},t),{},{type:"next",hasNullItem:fe}));return ar(ar({},be),{},{orientation:o,items:a});case"first":var me=vr(a);return Br(e,ar(ar({},t),{},{type:"move",id:null==me?void 0:me.id}));case"last":var pe=Br(ar(ar({},e),{},{items:Or(a)}),ar(ar({},t),{},{type:"first"}));return ar(ar({},pe),{},{items:a});case"sort":return ar(ar({},e),{},{items:Nr(a),groups:Nr(l)});case"setVirtual":return ar(ar({},e),{},{unstable_virtual:jr(t.virtual,n)});case"setRTL":return ar(ar({},e),{},{rtl:jr(t.rtl,r)});case"setOrientation":return ar(ar({},e),{},{orientation:jr(t.orientation,o)});case"setCurrentId":var ge=wr(ar(ar({},e),{},{currentId:jr(t.currentId,c)}));return ar(ar({},e),{},{currentId:ge,hasSetCurrentId:!0});case"setLoop":return ar(ar({},e),{},{loop:jr(t.loop,i)});case"setWrap":return ar(ar({},e),{},{wrap:jr(t.wrap,s)});case"setShift":return ar(ar({},e),{},{shift:jr(t.shift,d)});case"setIncludesBaseElement":return ar(ar({},e),{},{unstable_includesBaseElement:jr(t.includesBaseElement,b)});case"reset":return ar(ar({},e),{},{unstable_virtual:m,rtl:p,orientation:g,currentId:wr(ar(ar({},e),{},{currentId:O})),loop:v,wrap:w,shift:h,unstable_moves:0,pastIds:[]});case"setItems":return ar(ar({},e),{},{items:t.items});default:throw new Error}}function Fr(e){return Object(_.useCallback)(e,[])}function Mr(e){void 0===e&&(e={});var t=mr(e),n=t.unstable_virtual,r=void 0!==n&&n,o=t.rtl,a=void 0!==o&&o,l=t.orientation,c=t.currentId,i=t.loop,s=void 0!==i&&i,u=t.wrap,d=void 0!==u&&u,f=t.shift,b=void 0!==f&&f,m=t.unstable_includesBaseElement,p=function(e){void 0===e&&(e={});var t=mr(e).baseId,n=Object(_.useContext)(yr),r=Object(_.useRef)(0),o=Object(_.useState)((function(){return t||n()}));return{baseId:o[0],setBaseId:o[1],unstable_idCountRef:r}}(lr(t,["unstable_virtual","rtl","orientation","currentId","loop","wrap","shift","unstable_includesBaseElement"])),g=Object(_.useReducer)(Br,{unstable_virtual:r,rtl:a,orientation:l,items:[],groups:[],currentId:c,loop:s,wrap:d,shift:b,unstable_moves:0,pastIds:[],unstable_includesBaseElement:null!=m?m:null===c,initialVirtual:r,initialRTL:a,initialOrientation:l,initialCurrentId:c,initialLoop:s,initialWrap:d,initialShift:b}),O=g[0],v=(O.pastIds,O.initialVirtual,O.initialRTL,O.initialOrientation,O.initialCurrentId,O.initialLoop,O.initialWrap,O.initialShift,O.hasSetCurrentId,lr(O,["pastIds","initialVirtual","initialRTL","initialOrientation","initialCurrentId","initialLoop","initialWrap","initialShift","hasSetCurrentId"])),w=g[1],h=Object(_.useState)(!1),j=h[0],y=h[1],C=function(){var e=Object(_.useRef)(!1);return br((function(){return function(){e.current=!0}}),[]),e}(),E=Object(_.useCallback)((function(e){return w({type:"setItems",items:e})}),[]);return Dr(v.items,E),ar(ar(ar({},p),v),{},{unstable_hasActiveWidget:j,unstable_setHasActiveWidget:y,registerItem:Fr((function(e){C.current||w({type:"registerItem",item:e})})),unregisterItem:Fr((function(e){C.current||w({type:"unregisterItem",id:e})})),registerGroup:Fr((function(e){C.current||w({type:"registerGroup",group:e})})),unregisterGroup:Fr((function(e){C.current||w({type:"unregisterGroup",id:e})})),move:Fr((function(e){return w({type:"move",id:e})})),next:Fr((function(e){return w({type:"next",allTheWay:e})})),previous:Fr((function(e){return w({type:"previous",allTheWay:e})})),up:Fr((function(e){return w({type:"up",allTheWay:e})})),down:Fr((function(e){return w({type:"down",allTheWay:e})})),first:Fr((function(){return w({type:"first"})})),last:Fr((function(){return w({type:"last"})})),sort:Fr((function(){return w({type:"sort"})})),unstable_setVirtual:Fr((function(e){return w({type:"setVirtual",virtual:e})})),setRTL:Fr((function(e){return w({type:"setRTL",rtl:e})})),setOrientation:Fr((function(e){return w({type:"setOrientation",orientation:e})})),setCurrentId:Fr((function(e){return w({type:"setCurrentId",currentId:e})})),setLoop:Fr((function(e){return w({type:"setLoop",loop:e})})),setWrap:Fr((function(e){return w({type:"setWrap",wrap:e})})),setShift:Fr((function(e){return w({type:"setShift",shift:e})})),unstable_setIncludesBaseElement:Fr((function(e){return w({type:"setIncludesBaseElement",includesBaseElement:e})})),reset:Fr((function(){return w({type:"reset"})}))})}function Hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Wr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vr(Object(n),!0).forEach((function(t){Hr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ur(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function zr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qr(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return zr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zr(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var Kr=Object(_.createContext)({});var Gr=function(e,t,n){void 0===n&&(n=t.children);var r=Object(_.useContext)(Kr);if(r.useCreateElement)return r.useCreateElement(e,t,n);if("string"==typeof e&&function(e){return"function"==typeof e}(n)){t.children;return n(Ur(t,["children"]))}return Object(_.createElement)(e,t,n)};function Zr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yr(Object(n),!0).forEach((function(t){Zr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Jr(e){return"object"==typeof e&&null!=e}function Xr(e){var t;if(!Jr(e))return!1;var n=Object.getPrototypeOf(e);return null==n||(null===(t=n.constructor)||void 0===t?void 0:t.toString())===Object.toString()}function $r(e,t){for(var n={},r={},o=0,a=Object.keys(e);o<a.length;o++){var l=a[o];t.indexOf(l)>=0?n[l]=e[l]:r[l]=e[l]}return[n,r]}function eo(e,t){if(void 0===t&&(t=[]),!Xr(e.state))return $r(e,t);var n=$r(e,[].concat(t,["state"])),r=n[0],o=n[1],a=r.state,l=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(r,["state"]);return[Qr(Qr({},a),l),o]}function to(e,t){if(e===t)return!0;if(!e)return!1;if(!t)return!1;if("object"!=typeof e)return!1;if("object"!=typeof t)return!1;var n=Object.keys(e),r=Object.keys(t),o=n.length;if(r.length!==o)return!1;for(var a=0,l=n;a<l.length;a++){var c=l[a];if(e[c]!==t[c])return!1}return!0}function no(e){return"normalizePropsAreEqualInner"===e.name?e:function(t,n){return Xr(t.state)&&Xr(n.state)?e(Qr(Qr({},t.state),t),Qr(Qr({},n.state),n)):e(t,n)}}function ro(e){var t,n=e.as,r=e.useHook,o=e.memo,a=e.propsAreEqual,l=void 0===a?null==r?void 0:r.unstable_propsAreEqual:a,c=e.keys,i=void 0===c?(null==r?void 0:r.__keys)||[]:c,s=e.useCreateElement,u=void 0===s?Gr:s,d=function(e,t){var o=e.as,a=void 0===o?n:o,l=Ur(e,["as"]);if(r){var c,s=eo(l,i),d=s[0],f=s[1],b=r(d,Wr({ref:t},f)),m=b.wrapElement,p=Ur(b,["wrapElement"]),g=(null===(c=a.render)||void 0===c?void 0:c.__keys)||a.__keys,O=g&&eo(l,g)[0],v=O?Wr(Wr({},p),O):p,w=u(a,v);return m?m(w):w}return u(a,Wr({ref:t},l))};return t=d,d=Object(_.forwardRef)(t),o&&(d=function(e,t){return Object(_.memo)(e,t)}(d,l&&no(l))),d.__keys=i,d.unstable_propsAreEqual=no(l||to),d}function oo(e,t){Object(_.useDebugValue)(e);var n=Object(_.useContext)(Kr);return null!=n[e]?n[e]:t}function ao(e){var t,n,r,o=(r=e.compose,Array.isArray(r)?r:void 0!==r?[r]:[]),a=function(t,n){if(e.useOptions&&(t=e.useOptions(t,n)),e.name&&(t=function(e,t,n){void 0===t&&(t={}),void 0===n&&(n={});var r="use"+e+"Options";Object(_.useDebugValue)(r);var o=oo(r);return o?Wr(Wr({},t),o(t,n)):t}(e.name,t,n)),e.compose)for(var r,a=qr(o);!(r=a()).done;){t=r.value.__useOptions(t,n)}return t},l=function(t,n,r){if(void 0===t&&(t={}),void 0===n&&(n={}),void 0===r&&(r=!1),r||(t=a(t,n)),e.useProps&&(n=e.useProps(t,n)),e.name&&(n=function(e,t,n){void 0===t&&(t={}),void 0===n&&(n={});var r="use"+e+"Props";Object(_.useDebugValue)(r);var o=oo(r);return o?o(t,n):n}(e.name,t,n)),e.compose)if(e.useComposeOptions&&(t=e.useComposeOptions(t,n)),e.useComposeProps)n=e.useComposeProps(t,n);else for(var l,c=qr(o);!(l=c()).done;){n=(0,l.value)(t,n,!0)}var i={},s=n||{};for(var u in s)void 0!==s[u]&&(i[u]=s[u]);return i};l.__useOptions=a;var c=o.reduce((function(e,t){return e.push.apply(e,t.__keys||[]),e}),[]);return l.__keys=[].concat(c,(null===(t=e.useState)||void 0===t?void 0:t.__keys)||[],e.keys||[]),l.unstable_propsAreEqual=e.propsAreEqual||(null===(n=o[0])||void 0===n?void 0:n.unstable_propsAreEqual)||to,l}function lo(e,t){void 0===t&&(t=null),e&&("function"==typeof e?e(t):e.current=t)}function co(e,t){return Object(_.useMemo)((function(){return null==e&&null==t?null:function(n){lo(e,n),lo(t,n)}}),[e,t])}function io(e){var t=Object(_.useRef)(e);return br((function(){t.current=e})),t}function so(e){return e.target===e.currentTarget}var uo=ao({name:"Role",keys:["unstable_system"],propsAreEqual:function(e,t){var n=e.unstable_system,r=lr(e,["unstable_system"]),o=t.unstable_system,a=lr(t,["unstable_system"]);return!(n!==o&&!to(n,o))&&to(r,a)}}),fo=(ro({as:"div",useHook:uo}),["button","color","file","image","reset","submit"]);function bo(e){if("BUTTON"===e.tagName)return!0;if("INPUT"===e.tagName){var t=e;return-1!==fo.indexOf(t.type)}return!1}function mo(e){var t=sr(e).activeElement;return null!=t&&t.nodeName?t:null}function po(e,t){return e===t||e.contains(t)}function go(e){var t=mo(e);if(!t)return!1;if(po(e,t))return!0;var n=t.getAttribute("aria-activedescendant");return!!n&&(n===e.id||!!e.querySelector("#"+n))}function Oo(e){return!po(e.currentTarget,e.target)}function vo(e){return!!fr&&-1!==window.navigator.userAgent.indexOf(e)}function wo(e,t){return"matches"in e?e.matches(t):"msMatchesSelector"in e?e.msMatchesSelector(t):e.webkitMatchesSelector(t)}var ho="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function jo(e){return wo(e,ho)&&function(e){var t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)}var _o=vo("Mac")&&!vo("Chrome")&&(vo("Safari")||vo("Firefox"));function yo(e){!go(e)&&jo(e)&&e.focus()}function Co(e,t,n,r){return e?t&&!n?-1:void 0:t?r:r||0}function Eo(e,t){return Object(_.useCallback)((function(n){var r;null===(r=e.current)||void 0===r||r.call(e,n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())}),[e,t])}var ko=ao({name:"Tabbable",compose:uo,keys:["disabled","focusable"],useOptions:function(e,t){return ar({disabled:t.disabled},e)},useProps:function(e,t){var n=t.ref,r=t.tabIndex,o=t.onClickCapture,a=t.onMouseDownCapture,l=t.onMouseDown,c=t.onKeyPressCapture,i=t.style,s=lr(t,["ref","tabIndex","onClickCapture","onMouseDownCapture","onMouseDown","onKeyPressCapture","style"]),u=Object(_.useRef)(null),d=io(o),f=io(a),b=io(l),m=io(c),p=!!e.disabled&&!e.focusable,g=Object(_.useState)(!0),O=g[0],v=g[1],w=Object(_.useState)(!0),h=w[0],j=w[1],y=e.disabled?ar({pointerEvents:"none"},i):i;br((function(){var e,t=u.current;t&&("BUTTON"!==(e=t).tagName&&"INPUT"!==e.tagName&&"SELECT"!==e.tagName&&"TEXTAREA"!==e.tagName&&"A"!==e.tagName&&v(!1),function(e){return"BUTTON"===e.tagName||"INPUT"===e.tagName||"SELECT"===e.tagName||"TEXTAREA"===e.tagName}(t)||j(!1))}),[]);var C=Eo(d,e.disabled),E=Eo(f,e.disabled),k=Eo(m,e.disabled),x=Object(_.useCallback)((function(e){var t;null===(t=b.current)||void 0===t||t.call(b,e);var n=e.currentTarget;if(!e.defaultPrevented&&_o&&!Oo(e)&&bo(n)){var r=requestAnimationFrame((function(){n.removeEventListener("mouseup",o,!0),yo(n)})),o=function(){cancelAnimationFrame(r),yo(n)};n.addEventListener("mouseup",o,{once:!0,capture:!0})}}),[]);return ar({ref:co(u,n),style:y,tabIndex:Co(p,O,h,r),disabled:!(!p||!h)||void 0,"aria-disabled":!!e.disabled||void 0,onClickCapture:C,onMouseDownCapture:E,onMouseDown:x,onKeyPressCapture:k},s)}});ro({as:"div",useHook:ko});function xo(e,t,n){if("function"==typeof Event)return new Event(t,n);var r=sr(e).createEvent("Event");return r.initEvent(t,null==n?void 0:n.bubbles,null==n?void 0:n.cancelable),r}function So(e,t,n){return void 0===n&&(n={}),"function"==typeof FocusEvent?new FocusEvent(t,n):xo(e,t,n)}function To(e,t){var n=So(e,"blur",t),r=e.dispatchEvent(n),o=Qr(Qr({},t),{},{bubbles:!0});return e.dispatchEvent(So(e,"focusout",o)),r}function Io(e,t,n){return e.dispatchEvent(function(e,t,n){if(void 0===n&&(n={}),"function"==typeof KeyboardEvent)return new KeyboardEvent(t,n);var r=sr(e).createEvent("KeyboardEvent");return r.initKeyboardEvent(t,n.bubbles,n.cancelable,ur(e),n.key,n.location,n.ctrlKey,n.altKey,n.shiftKey,n.metaKey),r}(e,t,n))}var Po=fr&&"msCrypto"in window;var Lo=["baseId","unstable_idCountRef","setBaseId","unstable_virtual","rtl","orientation","items","groups","currentId","loop","wrap","shift","unstable_moves","unstable_hasActiveWidget","unstable_includesBaseElement","registerItem","unregisterItem","registerGroup","unregisterGroup","move","next","previous","up","down","first","last","sort","unstable_setVirtual","setRTL","setOrientation","setCurrentId","setLoop","setWrap","setShift","reset","unstable_setIncludesBaseElement","unstable_setHasActiveWidget"],No=Lo,Ao=No;function Ro(e){e.userFocus=!0,e.focus(),e.userFocus=!1}function Do(e,t){e.userFocus=t}var Bo=fr&&"msCrypto"in window;function Fo(e,t,n){var r=io(n);return Object(_.useCallback)((function(n){var o;if(null===(o=r.current)||void 0===o||o.call(r,n),!n.defaultPrevented&&e&&function(e){return!!so(e)&&(!e.metaKey&&"Tab"!==e.key)}(n)){var a=null==t?void 0:t.ref.current;a&&(Io(a,n.type,n)||n.preventDefault(),n.currentTarget.contains(a)&&n.stopPropagation())}}),[e,t])}function Mo(e,t){return null==e?void 0:e.some((function(e){return!!t&&e.ref.current===t}))}var Ho=ro({as:"div",useHook:ao({name:"Composite",compose:[ko],keys:Lo,useOptions:function(e){return ar(ar({},e),{},{currentId:wr(e)})},useProps:function(e,t){var n=t.ref,r=t.onFocusCapture,o=t.onFocus,a=t.onBlurCapture,l=t.onKeyDown,c=t.onKeyDownCapture,i=t.onKeyUpCapture,s=lr(t,["ref","onFocusCapture","onFocus","onBlurCapture","onKeyDown","onKeyDownCapture","onKeyUpCapture"]),u=Object(_.useRef)(null),d=hr(e.items,e.currentId),f=Object(_.useRef)(null),b=io(r),m=io(o),p=io(a),g=io(l),O=function(e){var t=io(e),n=Object(_.useReducer)((function(e){return e+1}),0),r=n[0],o=n[1];return Object(_.useEffect)((function(){var e,n=null===(e=t.current)||void 0===e?void 0:e.ref.current;r&&n&&Ro(n)}),[r]),o}(d),v=Bo?function(e){var t=Object(_.useRef)(null);return Object(_.useEffect)((function(){var n=sr(e.current),r=function(e){var n=e.target;t.current=n};return n.addEventListener("focus",r,!0),function(){n.removeEventListener("focus",r,!0)}}),[]),t}(u):void 0;Object(_.useEffect)((function(){var t=u.current;e.unstable_moves&&!d&&(null==t||t.focus())}),[e.unstable_moves,d]);var w=Fo(e.unstable_virtual,d,c),h=Fo(e.unstable_virtual,d,i),j=Object(_.useCallback)((function(t){var n;if(null===(n=b.current)||void 0===n||n.call(b,t),!t.defaultPrevented&&e.unstable_virtual){var r=(null==v?void 0:v.current)||t.relatedTarget,o=Mo(e.items,r);so(t)&&o&&(t.stopPropagation(),f.current=r)}}),[e.unstable_virtual,e.items]),y=Object(_.useCallback)((function(t){var n;if(null===(n=m.current)||void 0===n||n.call(m,t),!t.defaultPrevented)if(e.unstable_virtual)so(t)&&O();else if(so(t)){var r;null===(r=e.setCurrentId)||void 0===r||r.call(e,null)}}),[e.unstable_virtual,e.setCurrentId]),C=Object(_.useCallback)((function(t){var n;if(null===(n=p.current)||void 0===n||n.call(p,t),!t.defaultPrevented&&e.unstable_virtual){var r=(null==d?void 0:d.ref.current)||null,o=function(e){return Po?mo(e.currentTarget):e.relatedTarget}(t),a=Mo(e.items,o);if(so(t)&&a)o===r?f.current&&f.current!==o&&To(f.current,t):r&&To(r,t),t.stopPropagation();else!Mo(e.items,t.target)&&r&&To(r,t)}}),[e.unstable_virtual,e.items,d]),E=Object(_.useCallback)((function(t){var n,r;if(null===(n=g.current)||void 0===n||n.call(g,t),!t.defaultPrevented&&null===e.currentId&&so(t)){var o="horizontal"!==e.orientation,a="vertical"!==e.orientation,l=!(null===(r=e.groups)||void 0===r||!r.length),c={ArrowUp:(l||o)&&function(){if(l){var t,n=vr(gr(Or(pr(e.items))));if(null!=n&&n.id)null===(t=e.move)||void 0===t||t.call(e,n.id)}else{var r;null===(r=e.last)||void 0===r||r.call(e)}},ArrowRight:(l||a)&&e.first,ArrowDown:(l||o)&&e.first,ArrowLeft:(l||a)&&e.last,Home:e.first,End:e.last,PageUp:e.first,PageDown:e.last}[t.key];c&&(t.preventDefault(),c())}}),[e.currentId,e.orientation,e.groups,e.items,e.move,e.last,e.first]);return ar({ref:co(u,n),id:e.baseId,onFocus:y,onFocusCapture:j,onBlurCapture:C,onKeyDownCapture:w,onKeyDown:E,onKeyUpCapture:h,"aria-activedescendant":e.unstable_virtual&&(null==d?void 0:d.id)||void 0},s)},useComposeProps:function(e,t){t=uo(e,t,!0);var n=ko(e,t,!0);return e.unstable_virtual||null===e.currentId?ar({tabIndex:0},n):ar(ar({},t),{},{ref:n.ref})}}),useCreateElement:function(e,t,n){return Gr(e,t,n)}}),Vo=ao({keys:[].concat(["baseId","unstable_idCountRef","setBaseId"],["id"]),useOptions:function(e,t){var n=Object(_.useContext)(yr),r=Object(_.useState)((function(){return e.unstable_idCountRef?(e.unstable_idCountRef.current+=1,"-"+e.unstable_idCountRef.current):e.baseId?"-"+n(""):""}))[0],o=Object(_.useMemo)((function(){return e.baseId||n()}),[e.baseId,n]),a=t.id||e.id||""+o+r;return ar(ar({},e),{},{id:a})},useProps:function(e,t){return ar({id:e.id},t)}}),Wo=(ro({as:"div",useHook:Vo}),ao({name:"Group",compose:uo,keys:[],useProps:function(e,t){return ar({role:"group"},t)}})),Uo=(ro({as:"div",useHook:Wo}),ro({as:"div",useHook:ao({name:"CompositeGroup",compose:[Wo,Vo],keys:No,propsAreEqual:function(e,t){if(!t.id||e.id!==t.id)return Wo.unstable_propsAreEqual(e,t);var n=e.currentId,r=(e.unstable_moves,lr(e,["currentId","unstable_moves"])),o=t.currentId,a=(t.unstable_moves,lr(t,["currentId","unstable_moves"]));if(e.items&&t.items){var l=hr(e.items,n),c=hr(t.items,o),i=null==l?void 0:l.groupId,s=null==c?void 0:c.groupId;if(t.id===s||t.id===i)return!1}return Wo.unstable_propsAreEqual(r,a)},useProps:function(e,t){var n=t.ref,r=lr(t,["ref"]),o=Object(_.useRef)(null),a=e.id;return br((function(){var t;if(a)return null===(t=e.registerGroup)||void 0===t||t.call(e,{id:a,ref:o}),function(){var t;null===(t=e.unregisterGroup)||void 0===t||t.call(e,a)}}),[a,e.registerGroup,e.unregisterGroup]),ar({ref:co(o,n)},r)}})}));var zo=ao({name:"Clickable",compose:ko,keys:["unstable_clickOnEnter","unstable_clickOnSpace"],useOptions:function(e){var t=e.unstable_clickOnEnter,n=void 0===t||t,r=e.unstable_clickOnSpace;return ar({unstable_clickOnEnter:n,unstable_clickOnSpace:void 0===r||r},lr(e,["unstable_clickOnEnter","unstable_clickOnSpace"]))},useProps:function(e,t){var n=t.onKeyDown,r=t.onKeyUp,o=lr(t,["onKeyDown","onKeyUp"]),a=Object(_.useState)(!1),l=a[0],c=a[1],i=io(n),s=io(r),u=Object(_.useCallback)((function(t){var n;if(null===(n=i.current)||void 0===n||n.call(i,t),!t.defaultPrevented&&!e.disabled&&!t.metaKey&&so(t)){var r=e.unstable_clickOnEnter&&"Enter"===t.key,o=e.unstable_clickOnSpace&&" "===t.key;if(r||o){if(function(e){var t=e.currentTarget;return!!e.isTrusted&&(bo(t)||"INPUT"===t.tagName||"TEXTAREA"===t.tagName||"A"===t.tagName||"SELECT"===t.tagName)}(t))return;t.preventDefault(),r?t.currentTarget.click():o&&c(!0)}}}),[e.disabled,e.unstable_clickOnEnter,e.unstable_clickOnSpace]),d=Object(_.useCallback)((function(t){var n;if(null===(n=s.current)||void 0===n||n.call(s,t),!t.defaultPrevented&&!e.disabled&&!t.metaKey){var r=e.unstable_clickOnSpace&&" "===t.key;l&&r&&(c(!1),t.currentTarget.click())}}),[e.disabled,e.unstable_clickOnSpace,l]);return ar({"data-active":l||void 0,onKeyDown:u,onKeyUp:d},o)}});ro({as:"button",memo:!0,useHook:zo});function qo(e){try{var t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName,r="true"===e.contentEditable;return t||n||r||!1}catch(o){return!1}}function Ko(e){var t=mo(e);if(!t)return!1;if(t===e)return!0;var n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function Go(e,t){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){var n,r=Object.getPrototypeOf(e),o=null===(n=Object.getOwnPropertyDescriptor(r,"value"))||void 0===n?void 0:n.set;o&&(o.call(e,t),function(e,t,n){e.dispatchEvent(xo(e,t,n))}(e,"input",{bubbles:!0}))}}function Zo(e){return e.querySelector("[data-composite-item-widget]")}var Yo=ro({as:"button",memo:!0,useHook:ao({name:"CompositeItem",compose:[zo,Vo],keys:Ao,propsAreEqual:function(e,t){if(!t.id||e.id!==t.id)return zo.unstable_propsAreEqual(e,t);var n=e.currentId,r=e.unstable_moves,o=lr(e,["currentId","unstable_moves"]),a=t.currentId,l=t.unstable_moves,c=lr(t,["currentId","unstable_moves"]);if(a!==n){if(t.id===a||t.id===n)return!1}else if(r!==l)return!1;return zo.unstable_propsAreEqual(o,c)},useOptions:function(e){return ar(ar({},e),{},{id:e.id,currentId:wr(e),unstable_clickOnSpace:!e.unstable_hasActiveWidget&&e.unstable_clickOnSpace})},useProps:function(e,t){var n,r=t.ref,o=t.tabIndex,a=void 0===o?0:o,l=t.onMouseDown,c=t.onFocus,i=t.onBlurCapture,s=t.onKeyDown,u=t.onClick,d=lr(t,["ref","tabIndex","onMouseDown","onFocus","onBlurCapture","onKeyDown","onClick"]),f=Object(_.useRef)(null),b=e.id,m=e.disabled&&!e.focusable,p=e.currentId===b,g=io(p),O=Object(_.useRef)(!1),v=function(e){return Object(_.useMemo)((function(){var t;return null===(t=e.items)||void 0===t?void 0:t.find((function(t){return e.id&&t.id===e.id}))}),[e.items,e.id])}(e),w=io(l),h=io(c),j=io(i),y=io(s),C=io(u),E=!e.unstable_virtual&&!e.unstable_hasActiveWidget&&p||!(null!==(n=e.items)&&void 0!==n&&n.length);Object(_.useEffect)((function(){var t;if(b)return null===(t=e.registerItem)||void 0===t||t.call(e,{id:b,ref:f,disabled:!!m}),function(){var t;null===(t=e.unregisterItem)||void 0===t||t.call(e,b)}}),[b,m,e.registerItem,e.unregisterItem]),Object(_.useEffect)((function(){var t=f.current;t&&e.unstable_moves&&g.current&&Ro(t)}),[e.unstable_moves]);var k=Object(_.useCallback)((function(e){var t;null===(t=w.current)||void 0===t||t.call(w,e),Do(e.currentTarget,!0)}),[]),x=Object(_.useCallback)((function(t){var n,r,o=!!t.currentTarget.userFocus;if(Do(t.currentTarget,!1),null===(n=h.current)||void 0===n||n.call(h,t),!t.defaultPrevented&&!Oo(t)&&b&&!function(e,t){if(so(e))return!1;for(var n,r=ir(t);!(n=r()).done;){if(n.value.ref.current===e.target)return!0}return!1}(t,e.items)&&(null===(r=e.setCurrentId)||void 0===r||r.call(e,b),o&&e.unstable_virtual&&e.baseId&&so(t))){var a=sr(t.target).getElementById(e.baseId);a&&(O.current=!0,function(e,t){var n=void 0===t?{}:t,r=n.preventScroll,o=n.isActive,a=void 0===o?Ko:o;a(e)||(e.focus({preventScroll:r}),a(e)||requestAnimationFrame((function(){e.focus({preventScroll:r})})))}(a))}}),[b,e.items,e.setCurrentId,e.unstable_virtual,e.baseId]),S=Object(_.useCallback)((function(t){var n;null===(n=j.current)||void 0===n||n.call(j,t),t.defaultPrevented||e.unstable_virtual&&O.current&&(O.current=!1,t.preventDefault(),t.stopPropagation())}),[e.unstable_virtual]),T=Object(_.useCallback)((function(t){var n;if(so(t)){var r="horizontal"!==e.orientation,o="vertical"!==e.orientation,a=!(null==v||!v.groupId),l={ArrowUp:(a||r)&&e.up,ArrowRight:(a||o)&&e.next,ArrowDown:(a||r)&&e.down,ArrowLeft:(a||o)&&e.previous,Home:function(){var n,r;!a||t.ctrlKey?null===(n=e.first)||void 0===n||n.call(e):null===(r=e.previous)||void 0===r||r.call(e,!0)},End:function(){var n,r;!a||t.ctrlKey?null===(n=e.last)||void 0===n||n.call(e):null===(r=e.next)||void 0===r||r.call(e,!0)},PageUp:function(){var t,n;a?null===(t=e.up)||void 0===t||t.call(e,!0):null===(n=e.first)||void 0===n||n.call(e)},PageDown:function(){var t,n;a?null===(t=e.down)||void 0===t||t.call(e,!0):null===(n=e.last)||void 0===n||n.call(e)}}[t.key];if(l)return t.preventDefault(),void l();if(null===(n=y.current)||void 0===n||n.call(y,t),!t.defaultPrevented)if(1===t.key.length&&" "!==t.key){var c=Zo(t.currentTarget);c&&qo(c)&&(c.focus(),Go(c,""))}else if("Delete"===t.key||"Backspace"===t.key){var i=Zo(t.currentTarget);i&&qo(i)&&(t.preventDefault(),Go(i,""))}}}),[e.orientation,v,e.up,e.next,e.down,e.previous,e.first,e.last]),I=Object(_.useCallback)((function(e){var t;if(null===(t=C.current)||void 0===t||t.call(C,e),!e.defaultPrevented){var n=Zo(e.currentTarget);n&&!go(n)&&n.focus()}}),[]);return ar({ref:co(f,r),id:b,tabIndex:E?a:-1,"aria-selected":!(!e.unstable_virtual||!p)||void 0,onMouseDown:k,onFocus:x,onBlurCapture:S,onKeyDown:T,onClick:I},d)}})}),Qo=function(e){var t=e.isActive,n=e.column,r=e.onSelect,o=e.row,l=Se()(e,["isActive","column","onSelect","row"]),c="".concat(o.label," ").concat(n.label),i=Object(_.useCallback)((function(){r(o.value,n.value)}),[r,o.value,n.value]),s=T()("crowdsignal-forms__block-alignment-control-button",{"is-active":t});return Object(a.createElement)(E.Tooltip,{text:c},Object(a.createElement)(Yo,w()({className:s,role:"gridcell",onFocus:i},l),Object(a.createElement)(E.VisuallyHidden,null,c)))},Jo=function(e,t,n){return"".concat(e,"-").concat(t,"-").concat(n)};var Xo=function e(t){var n=t.columns,r=t.onChange,o=t.rows,c=t.value,i=Object(x.useInstanceId)(e,"block-alignment-control-grid"),s=Mr({baseId:i,currentId:Jo(i,c.row,c.column),rtl:Object(l.isRTL)()});return Object(_.useEffect)((function(){s.setCurrentId(Jo(i,c.row,c.column))}),[c,s.setCurrentId]),Object(a.createElement)(Ho,w()({},s,{className:"crowdsignal-forms__block-alignment-control-grid"}),Object(b.map)(o,(function(e){return Object(a.createElement)(Uo,w()({},s,{key:"".concat(i,"-").concat(e.value),role:"row",className:"crowdsignal-forms__block-alignment-control-row"}),Object(b.map)(n,(function(t){var n=Jo(i,e.value,t.value),o=s.currentId===Jo(i,e.value,t.value);return Object(a.createElement)(Qo,w()({},s,{id:n,key:n,isActive:o,row:e,column:t,onSelect:r,tabIndex:o?0:-1}))})))})))},$o=function(e){var t=e.rows,n=e.columns,r=e.value,o=0,l=0;return Object(a.createElement)("div",{className:"crowdsignal-forms__block-alignment-control-icon"},Object(b.map)(t,(function(e){return Object(a.createElement)("div",{key:l++,className:"crowdsignal-forms__block-alignment-control-icon-row"},Object(b.map)(n,(function(t){var n=e.value===r.row&&t.value===r.column,l=T()("crowdsignal-forms__block-alignment-control-icon-dot",{"is-active":n});return Object(a.createElement)("span",{key:o++,className:l})})))})))},ea={"2x2":{rows:[{label:Object(l.__)("Top","crowdsignal-forms"),value:"top"},{label:Object(l.__)("Bottom","crowdsignal-forms"),value:"bottom"}],columns:[{label:Object(l.__)("Left","crowdsignal-forms"),value:"left"},{label:Object(l.__)("Right","crowdsignal-forms"),value:"right"}]},"2x3":{rows:[{label:Object(l.__)("Top","crowdsignal-forms"),value:"top"},{label:Object(l.__)("Center","crowdsignal-forms"),value:"center"},{label:Object(l.__)("Bottom","crowdsignal-forms"),value:"bottom"}],columns:[{label:Object(l.__)("Left","crowdsignal-forms"),value:"left"},{label:Object(l.__)("Right","crowdsignal-forms"),value:"right"}]}},ta=function(e){var t=e.closeOnSelectionChanged,n=e.disabled,r=e.label,o=e.onChange,l=e.rows,c=e.columns,i=e.value,s=Object(a.createElement)($o,{rows:l,columns:c,value:i});return Object(a.createElement)(E.Dropdown,{className:"crowdsignal-forms__block-alignment-control",popoverProps:{className:"crowdsignal-forms__block-alignment-control-popover"},renderToggle:function(e){var t=e.onToggle,o=e.isOpen;return Object(a.createElement)(E.Tooltip,{text:r},Object(a.createElement)(E.ToolbarButton,{showTooltip:!0,"aria-haspopup":"true","aria-expanded":o,disabled:n,icon:s,onClick:t,onKeyDown:function(e){o||e.keyCode!==nr.DOWN||(e.preventDefault(),e.stopPropagation(),t())}}))},renderContent:function(e){var n=e.onClose;return Object(a.createElement)(Xo,{onChange:function(e,r){o(e,r),!t||i.row===e&&i.column===r||n()},rows:l,columns:c,value:i})}})};ta.defaultProps={closeOnSelectionChanged:!1,label:Object(l.__)("Change block position","crowdsignal-forms"),onChange:b.noop};var na=ta,ra=function(e){var t=e.attributes,n=e.currentView,r=e.onViewChange,o=e.setAttributes,c=function(e){return function(){return r(e)}};return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.ToolbarGroup,{label:Object(l.__)("Current view","crowdsignal-forms")},Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-feedback__toolbar-toggle",isActive:n===zn,label:Object(l.__)("Question","crowdsignal-forms"),onClick:c(zn)},Object(l.__)("Question","crowdsignal-forms")),Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-feedback__toolbar-toggle",isActive:n===qn,label:Object(l.__)("Submit","crowdsignal-forms"),onClick:c(qn)},Object(l.__)("Submit","crowdsignal-forms"))),Object(a.createElement)(E.ToolbarGroup,null,Object(a.createElement)(na,w()({closeOnSelectionChanged:!0,onChange:function(e,t){return o({x:t,y:e})},label:Object(l.__)("Change button position","crowdsignal-forms"),value:{row:t.y,column:t.x}},ea["2x3"]))))},oa=function(){return!!window.wp.widgets},aa=function(e){return Rn(Q()({path:Object(b.trimEnd)("/crowdsignal-forms/v1/feedback/".concat(e.surveyId||""),"/"),method:"POST",data:e}))};function la(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var ca=Object(x.compose)([Object(f.withSelect)((function(e){var t=e("core/editor").getPermalink();t||(t=e("core").getSite()&&e("core").getSite().url);var n=e("core/edit-post");return{isFullscreen:"isFeatureActive"in n?n.isFeatureActive("fullscreenMode"):n.getPreference("fullscreenMode"),isInserterActive:n.isInserterOpened(),isListViewActive:n.isListViewOpened(),isSidebarActive:n.isEditorSidebarOpened(),sourceLink:t}})),Le])((function(e){var t=Object(_.useState)(zn),n=j()(t,2),r=n[0],o=n[1],c=Object(_.useState)(null),i=j()(c,2),s=i[0],u=i[1],m=Object(_.useState)({}),p=j()(m,2),g=p[0],O=p[1],v=e.attributes,h=e.isFullscreen,y=e.isInserterActive,k=e.isListViewActive,x=e.isSidebarActive,S=e.fallbackStyles,I=e.isSelected,P=e.setAttributes,L=e.clientId,N=e.sourceLink,R=e.setPosition,B=v.isExample,F=v.feedbackPlaceholder,M=v.emailPlaceholder,H=v.surveyId,V=v.title,W=v.header,U=v.emailResponses,z=v.triggerLabel,q=Object(_.useState)({}),K=j()(q,2),G=K[0],Z=K[1],Y=Object(_.useState)(!1),Q=j()(Y,2),J=Q[0],X=Q[1],$=Object(_.useMemo)(oa,[]),ee=Object(_.useRef)(null),te=Object(_.useRef)(null),ne=Object(_.useRef)(null),re=An(function(){var e=D()(A.a.mark((function e(t){var n;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Object(f.dispatch)("core/editor").lockPostSaving(L),e.prev=1,e.next=4,aa({feedbackPlaceholder:t.feedbackPlaceholder,emailPlaceholder:t.emailPlaceholder,sourceLink:t.sourceLink,surveyId:t.surveyId,title:t.title||t.header,emailResponses:t.emailResponses});case 4:n=e.sent,t.surveyId||P({surveyId:n.surveyId});case 6:return e.prev=6,Object(f.dispatch)("core/editor").unlockPostSaving(L),e.finish(6);case 9:case"end":return e.stop()}}),e,null,[[1,,6,9]])})));return function(t){return e.apply(this,arguments)}}(),{feedbackPlaceholder:F,emailPlaceholder:M,sourceLink:N,surveyId:H,title:V,header:W,emailResponses:U}),oe=re.error,ae=re.save;Object(_.useEffect)((function(){B||v.surveyId||(ae(),P({isWidget:$}))}),[]),Object(_.useEffect)((function(){I||o(zn)}),[I]),Object(_.useEffect)((function(){window.requestAnimationFrame((function(){return X(!J)}))}),[y,k,x]),Object(_.useLayoutEffect)((function(){if(!B&&te.current&&!$){R(function(e,t,n,r,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,l={left:Object(b.isObject)(o)?o.left:o,right:Object(b.isObject)(o)?o.right:o,top:Object(b.isObject)(o)?o.top:o,bottom:Object(b.isObject)(o)?o.bottom:o};return a&&(l=Xn(l,a.getBoundingClientRect())),Qn({},$n(e,0,l),{},er(t,r,l))}(v.x,v.y,ee.current.offsetWidth,ee.current.offsetHeight,{left:"center"===v.y?10:20,right:"center"===v.y?10:20,top:I?80:20,bottom:20},document.getElementsByClassName("interface-interface-skeleton__content")[0]),te.current.offsetWidth,te.current.offsetHeight);var e=(Object(b.max)([te.current.offsetWidth,ee.current.offsetHeight])-te.current.offsetWidth)/2;Z({"--crowdsignal-forms-feedback__toggle-padding":"".concat(e,"px"),minHeight:"center"===v.y?te.current.offsetWidth:0,marginLeft:"center"===v.y&&"left"===v.x?te.current.offsetHeight-te.current.offsetWidth-10:0,marginRight:"center"===v.y&&"right"===v.x?te.current.offsetHeight-te.current.offsetWidth-10:0})}}),[J,h,I,R,v.x,v.y,te.current,ee.current,z,$]),Object(_.useLayoutEffect)((function(){ne.current&&u(ne.current.offsetHeight)}),[v.header,ne.current,I]),Object(_.useLayoutEffect)((function(){if(!oa)if(te.current&&te.current.ownerDocument!==document)O({bottom:0,left:0,right:0,top:0});else{var e=document.getElementsByClassName("interface-interface-skeleton__content")[0].getBoundingClientRect();O({bottom:window.innerHeight-(e.top+e.height),left:e.left,right:window.innerWidth-(e.left+e.width),top:e.top})}}),[J,h,I,te.current]);var le=function(e){return function(t){return P(d()({},e,t))}},ce=ie().accountInfo,se=Object(b.get)(ce,["signalCount","shouldDisplay"]),ue=se&&Object(b.get)(ce,["signalCount","count"])>=Object(b.get)(ce,["signalCount","userLimit"]),de=Object(b.get)(ce,["account","email"]),fe=T()("crowdsignal-forms-feedback","align-".concat(v.x),"vertical-align-".concat(v.y),{"no-shadow":v.hideTriggerShadow,"is-active":I,"is-vertical":"center"===v.y,"is-widget":$}),me=$&&te.current&&te.current.offsetHeight?"".concat(te.current&&te.current.offsetHeight,"px"):null,pe=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?la(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):la(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},function(e,t){return Object(b.mapKeys)({backgroundColor:e.backgroundColor||"#ffffff",buttonColor:e.buttonColor||t.accentColor,buttonTextColor:e.buttonTextColor||t.textColorInverted,textColor:e.textColor||t.textColor,textSize:t.textSize,triggerBackgroundColor:e.triggerBackgroundColor||t.accentColor,triggerTextColor:e.triggerTextColor||t.textColorInverted},(function(e,t){return"--crowdsignal-forms-".concat(Object(b.kebabCase)(t))}))}(v,S),{},G,{"--crowdsignal-forms-trigger-height":me}),ge={height:s},Oe=Kn.CLOSED===v.status||Kn.CLOSED_AFTER===v.status&&null!==v.closedAfterDateTime&&(new Date).toISOString()>v.closedAfterDateTime,ve=Object(b.get)(ce,"capabilities",[]).includes("hide-branding");return Object(a.createElement)(lt,{blockName:Object(l.__)("Feedback Button","crowdsignal-forms"),blockIcon:Object(a.createElement)(Un,null)},Object(a.createElement)(ra,w()({currentView:r,onViewChange:o},e)),Object(a.createElement)(tr,w()({shouldPromote:se,signalWarning:ue,email:de},e)),$&&Object(a.createElement)(a.Fragment,null,!B&&!$&&ue&&Object(a.createElement)(pt,null),!B&&!$&&oe&&Object(a.createElement)(Hn,{retryHandler:ae}),Object(a.createElement)(mt,{icon:"warning",status:"warn",isDismissible:!1},Object(l.__)("This widget will appear in a fixed position as selected, in a corner or at an edge.","crowdsignal-forms"))),Object(a.createElement)("div",{ref:ee,className:fe,style:pe},Object(a.createElement)("div",{className:"crowdsignal-forms-feedback__trigger-preview"},Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-feedback__trigger-wrapper"},Object(a.createElement)(C.RichText,{ref:te,className:"wp-block-button__link crowdsignal-forms-feedback__trigger",onChange:le("triggerLabel"),value:z,allowedFormats:[],multiline:!1,disableLineBreaks:!0}))),Object(a.createElement)("div",{className:"crowdsignal-forms-feedback__popover-preview"},(B||I||$)&&Object(a.createElement)(a.Fragment,null,!$&&Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{"aria-modal":"true",role:"dialog",className:"crowdsignal-forms-feedback__popover-overlay",onClick:function(){Object(f.dispatch)("core/block-editor").clearSelectedBlock(),te.current.parentElement.parentElement.parentElement.blur()},style:g})),!B&&!$&&ue&&Object(a.createElement)(pt,null),!B&&!$&&oe&&Object(a.createElement)(Hn,{retryHandler:ae}),r===zn&&Object(a.createElement)("div",{ref:ne,className:"crowdsignal-forms-feedback__popover"},Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-feedback__header",onChange:le("header"),value:v.header,allowedFormats:[]}),Object(a.createElement)(E.TextareaControl,{className:"crowdsignal-forms-feedback__input",rows:6,onChange:le("feedbackPlaceholder"),value:v.feedbackPlaceholder}),Object(a.createElement)(E.TextControl,{className:"crowdsignal-forms-feedback__input",onChange:le("emailPlaceholder"),value:v.emailPlaceholder}),Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-feedback__button-wrapper"},Object(a.createElement)(C.RichText,{className:"wp-block-button__link crowdsignal-forms-feedback__feedback-button",onChange:le("submitButtonLabel"),value:v.submitButtonLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0})),!ve&&Object(a.createElement)(be,{editing:!0,trackRef:"cs-forms-feedback",message:Object(l.__)("Collect your own feedback with Crowdsignal","crowdsignal-forms")})),r===qn&&Object(a.createElement)("div",{className:"crowdsignal-forms-feedback__popover",style:ge},Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-feedback__header",onChange:le("submitText"),value:v.submitText,allowedFormats:[]}),!ve&&Object(a.createElement)(be,{editing:!0,trackRef:"cs-forms-feedback",message:Object(l.__)("Collect your own feedback with Crowdsignal","crowdsignal-forms")})),Oe&&Object(a.createElement)("div",{className:"crowdsignal-forms-feedback__closed-notice"},Object(l.__)("This Feedback Form is Closed","crowdsignal-forms"))))),e.renderStyleProbe())})),ia={title:Object(l.__)("Feedback Button","crowdsignal-forms"),description:Object(l.__)("Add an always visible button that allows your audience to share feedback anytime.","crowdsignal-forms"),category:"crowdsignal-forms",keywords:["crowdsignal",Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("floating","crowdsignal-forms"),Object(l.__)("contact","crowdsignal-forms"),Object(l.__)("call to action","crowdsignal-forms"),Object(l.__)("cta","crowdsignal-forms"),Object(l.__)("button","crowdsignal-forms"),Object(l.__)("subscribe","crowdsignal-forms"),Object(l.__)("form","crowdsignal-forms"),Object(l.__)("email","crowdsignal-forms"),Object(l.__)("message","crowdsignal-forms")],icon:Object(a.createElement)(Un,null),edit:ca,supports:{multiple:!1,html:!1,reusable:!1},attributes:Zn,example:{attributes:{isExample:!0}}};function sa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ua(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sa(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var da={},fa=["crowdsignal-forms/feedback"];Object(r.registerBlockType)("crowdsignal-forms/poll",wt),Object(r.registerBlockType)("crowdsignal-forms/vote",At),Object(r.registerBlockType)("crowdsignal-forms/vote-item",mn),Object(r.registerBlockType)("crowdsignal-forms/applause",Sn),Object(r.registerBlockType)("crowdsignal-forms/nps",Wn),Object(r.registerBlockType)("crowdsignal-forms/feedback",ia),Object(o.addFilter)("editor.BlockListBlock","crowdsignal-forms/with-fixed-position",(function(e){return function(t){if(!Object(b.includes)(fa,t.name))return Object(a.createElement)(e,t);var n=Object(_.useState)({}),r=j()(n,2),o=r[0],l=r[1];da[t.clientId]=l,Object(_.useEffect)((function(){return function(){da[t.clientId]=null}}),[da,t.clientId]);var c=ua({},Object(b.get)(t,["wrapperProps","style"],{}),{},o,{position:Object(b.isEmpty)(o)?null:"fixed",margin:0}),i=ua({},t.wrapperProps,{style:c});return Object(a.createElement)(e,w()({},t,{wrapperProps:i}))}}),1),Object(o.addFilter)("editor.BlockEdit","crowdsignal-forms/with-fixed-position-control",(function(e){return function(t){if(!Object(b.includes)(fa,t.name))return Object(a.createElement)(e,t);var n=Object(_.useCallback)((function(e){da[t.clientId](Object(b.pick)(e,["top","left","right","bottom"]))}),[t.clientId]);return Object(a.createElement)(e,w()({},t,{setPosition:n}))}}))}]));
10
  *
11
  * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
12
  * Released under the MIT license
13
+ */!function(a){if(void 0===(o="function"==typeof(r=a)?r.call(t,n,t,e):r)||(e.exports=o),!0,e.exports=a(),!!0){var l=window.Cookies,c=window.Cookies=a();c.noConflict=function(){return window.Cookies=l,c}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function a(t,n,a){if("undefined"!=typeof document){"number"==typeof(a=e({path:"/"},o.defaults,a)).expires&&(a.expires=new Date(1*new Date+864e5*a.expires)),a.expires=a.expires?a.expires.toUTCString():"";try{var l=JSON.stringify(n);/^[\{\[]/.test(l)&&(n=l)}catch(s){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var c="";for(var i in a)a[i]&&(c+="; "+i,!0!==a[i]&&(c+="="+a[i].split(";")[0]));return document.cookie=t+"="+n+c}}function l(e,n){if("undefined"!=typeof document){for(var o={},a=document.cookie?document.cookie.split("; "):[],l=0;l<a.length;l++){var c=a[l].split("="),i=c.slice(1).join("=");n||'"'!==i.charAt(0)||(i=i.slice(1,-1));try{var s=t(c[0]);if(i=(r.read||r)(i,s)||t(i),n)try{i=JSON.parse(i)}catch(u){}if(o[s]=i,e===s)break}catch(u){}}return e?o[e]:o}}return o.set=a,o.get=function(e){return l(e,!1)},o.getJSON=function(e){return l(e,!0)},o.remove=function(t,n){a(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}((function(){}))}))},function(e,t){!function(){e.exports=this.ReactDOM}()},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){var r=n(23);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},,function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t,n){var r=n(28);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t,n){var r=n(45),o=n(46);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t,n){var r=n(20),o=n(23),a=n(47),l=n(48);function c(t){var n="function"==typeof Map?new Map:void 0;return e.exports=c=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return l(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),o(t,e)},c(t)}e.exports=c},function(e,t){!function(){e.exports=this.wp.editor}()},function(e,t){!function(){e.exports=this.wp.keycodes}()},,,,function(e,t,n){var r=n(28);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var l,c=e[Symbol.iterator]();!(r=(l=c.next()).done)&&(n.push(l.value),!t||n.length!==t);r=!0);}catch(i){o=!0,a=i}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}},function(e,t){e.exports=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.")}},function(e,t,n){"use strict";var r=n(44);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,l){if(l!==r){var c=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 c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array: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:a,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}},function(e,t,n){var r=n(23),o=n(49);function a(t,n,l){return o()?e.exports=a=Reflect.construct:e.exports=a=function(e,t,n){var o=[null];o.push.apply(o,t);var a=new(Function.bind.apply(e,o));return n&&r(a,n.prototype),a},a.apply(null,arguments)}e.exports=a},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},function(e,t,n){"use strict";n.r(t);var r=n(17),o=n(24),a=n(0),l=n(1),c=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 6L5.5 18C5.5 18.2761 5.72386 18.5 6 18.5L18 18.5C18.2761 18.5 18.5 18.2761 18.5 18L18.5 6C18.5 5.72386 18.2761 5.5 18 5.5L6 5.5C5.72386 5.5 5.5 5.72386 5.5 6ZM4 18L4 6C4 4.89543 4.89543 4 6 4L18 4C19.1046 4 20 4.89543 20 6L20 18C20 19.1046 19.1046 20 18 20L6 20C4.89543 20 4 19.1046 4 18Z"}),Object(a.createElement)("rect",{x:"15",y:"17",width:"6",height:"1.5",transform:"rotate(-90 15 17)"}),Object(a.createElement)("rect",{x:"11.5",y:"17",width:"9",height:"1.5",transform:"rotate(-90 11.5 17)"}),Object(a.createElement)("rect",{x:"8",y:"17",width:"5",height:"1.5",transform:"rotate(-90 8 17)"}))},i=n(18),s=n.n(i),u=n(5),d=n.n(u),f=n(12),b=n(3);function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var g={tryFetch:!1,isFetching:!1,pollsByClientId:{},pollClientIds:[]},O={setTryFetchPollData:function(e){return{type:"SET_TRY_FETCH",tryFetch:e}},setIsFetchingPollData:function(e){return{type:"IS_FETCHING",isFetching:e}},setPollApiDataForClientId:function(e,t){return{type:"SET_POLL",clientId:e,pollData:t}},addPollClientId:function(e){return{type:"ADD_POLL_CLIENT_ID",clientId:e}},removePollClientId:function(e){return{type:"REMOVE_POLL_CLIENT_ID",clientId:e}}},v=(Object(f.registerStore)("crowdsignal-forms/polls",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_TRY_FETCH":return p({},e,{tryFetch:!!t.tryFetch});case"IS_FETCHING":return p({},e,{isFetching:!!t.isFetching});case"SET_POLL":return p({},e,{pollsByClientId:p({},e.pollsByClientId,d()({},t.clientId,t.pollData))});case"ADD_POLL_CLIENT_ID":return p({},e,{pollClientIds:e.pollClientIds.indexOf(t.clientId)<0?[].concat(s()(e.pollClientIds),[t.clientId]):e.pollClientIds});case"REMOVE_POLL_CLIENT_ID":return p({},e,{pollClientIds:Object(b.filter)(e.pollClientIds,(function(e){return e!==t.clientId}))});default:return e}},actions:O,selectors:{shouldTryFetchingPollData:function(e){return!!e.tryFetch},getPollDataByClientId:function(e,t){return e.pollsByClientId[t]||null},getPollClientIds:function(e){return e.pollClientIds},isFetchingPollData:function(e){return!!e.isFetching}},controls:{},resolvers:{}}),n(10)),w=n.n(v),h=n(7),j=n.n(h),_=n(2),y=n.n(_),C=n(6),E=n(4),k=n(15),x=n(13),S=n(9),T=n.n(S),I=function(e){var t=e.hasVoted,n=e.isPollClosed,r=e.isPollHidden,o=e.showSubmitMessage,c=T()({"is-transparent":o},"crowdsignal-forms-poll__closed-banner");return Object(a.createElement)("div",{className:c},r&&Object(l.__)("This Poll is Hidden","crowdsignal-forms"),n&&!r&&Object(l.__)("This Poll is Closed","crowdsignal-forms"),t&&Object(l.__)("Thanks For Voting!","crowdsignal-forms"))},P=n(8),L=n.n(P),N=n(11),A=n.n(N),R=n(14),D=n.n(R),B=n(21),F=n.n(B),M=n(25),H=n.n(M),V=n(26),W=n.n(V),U=n(30),z=n.n(U),q=n(20),K=n.n(q),G=n(31),Z=n.n(G),Y=n(16),Q=n.n(Y);function J(e){return function(){var t,n=K()(e);if(X()){var r=K()(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return z()(this,t)}}function X(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var $=function(){var e=D()(A.a.mark((function e(t){var n,r,o=arguments;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(o.length>1&&void 0!==o[1])||o[1],r="https://api.crowdsignal.com/v3/polls",n){e.next=4;break}return e.abrupt("return",null);case 4:return e.abrupt("return",window.fetch("".concat(r,"/").concat(t,"/results"),{method:"GET",headers:{"content-type":"application/json"}}).then((function(e){if(e.status>=200&&e.status<300)return e.json();throw e})).then((function(e){if(404===e.status)return{};if(e.error)throw new Error(e.message);return e.results.votes_by_answer})));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ee=function(){var e=D()(A.a.mark((function e(t){var n,r,o;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"5430eeac3911395001d731d9702fc38b",n=(new Date).getTime(),e.next=4,window.fetch("https://poll.fm/n/".concat("5430eeac3911395001d731d9702fc38b","/").concat(t,"?").concat(n,"&format=json"));case 4:if((r=e.sent).ok){e.next=7;break}throw new re;case 7:return e.next=9,r.json();case 9:if((o=e.sent).nonce){e.next=12;break}throw new re;case 12:return e.abrupt("return",o.nonce);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),te=function(){var e=D()(A.a.mark((function e(t,n,r,o){var a,l,c;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r.join(","),e.next=3,window.fetch("https://polls.polldaddy.com/vote-js.php?format=json&p=".concat(n,"&b=1&a=").concat(a,"&o=&va=16&cookie=0&n=").concat(t,"&url=").concat(encodeURIComponent(window.location),"&vi=").concat(o));case 3:if((l=e.sent).ok){e.next=6;break}throw new re;case 6:return e.next=8,l.json();case 8:if("error"!==(c=e.sent).status){e.next=11;break}throw new ne(c.error);case 11:case"end":return e.stop()}}),e)})));return function(t,n,r,o){return e.apply(this,arguments)}}(),ne=function(e){W()(n,e);var t=J(n);function n(){return H()(this,n),t.apply(this,arguments)}return n}(Z()(Error)),re=function(e){W()(n,e);var t=J(n);function n(){return H()(this,n),t.call(this,Object(l.__)("Server error. Please try again.","crowdsignal-forms"))}return n}(ne),oe=function(){var e=D()(A.a.mark((function e(){return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Q()({path:"/crowdsignal-forms/v1/account/info",method:"GET"});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ae=function(e,t){var n=Object(_.useState)(null),r=j()(n,2),o=r[0],a=r[1],l=Object(_.useState)(null),c=j()(l,2),i=c[0],s=c[1],u=Object(_.useState)(!0),d=j()(u,2),f=d[0],b=d[1];return Object(_.useEffect)((function(){b(!0),s(null),a(null),e().then(a).catch(s).finally((function(){return b(!1)}))}),t),{data:o,error:i,loading:f}},le=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=ae((function(){return $(e,t)}),[e]),r=n.data,o=n.error,a=n.loading;return{error:o,loading:a,results:r}},ce={is_verified:!0,capabilities:["hide-branding"],signal_count:{count:0,userLimit:2500,shouldDisplay:!1}},ie=function(){var e=Object(_.useState)(ce),t=j()(e,2),n=t[0],r=t[1],o=function(){var e=D()(A.a.mark((function e(){var t;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,oe();case 2:return t=e.sent,r(t),e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(_.useEffect)((function(){o()}),[]),{accountInfo:n,reloadAccountInfo:o}},se=function(e){var t=e.error,n=e.loading,r=e.text,o=e.totalVotes,c=e.votes,i=T()("crowdsignal-forms-poll__answer-results",{"is-error":t,"is-loading":n}),s=!n&&!t,u=0===o?0:100*c/o,d={width:"".concat(parseInt(u,10),"%")};return Object(a.createElement)("div",{className:i},Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-results-labels"},Object(a.createElement)("span",{className:"crowdsignal-forms-poll__answer-results-answer"},Object(k.decodeEntities)(r)),Object(a.createElement)("span",{className:"crowdsignal-forms-poll__answer-results-votes"},s&&Object(l.sprintf)(Object(l._n)("%s vote","%s votes",c,"crowdsignal-forms"),c.toLocaleString())),Object(a.createElement)("span",{className:"crowdsignal-forms-poll__answer-results-percent"},s&&"".concat(u.toFixed(2),"%"))),Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-results-progress-track"},Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-results-progress-bar",style:d})))};se.propTypes={loading:L.a.bool,text:L.a.string.isRequired,totalVotes:L.a.number,votes:L.a.number};var ue,de=se,fe=Object(a.createElement)("span",null,"Hide Crowdsignal ads",Object(a.createElement)("br",null),"and get unlimited",Object(a.createElement)("br",null),"signals -"," ",Object(a.createElement)("a",{href:"https://crowdsignal.com/pricing",target:"_blank",rel:"noopener noreferrer"},"Upgrade")),be=function(e){var t=e.showLogo,n=e.editing,r=e.message,o=e.trackRef,c=void 0===o?"cs-forms-poll":o;return Object(a.createElement)("div",{className:"crowdsignal-forms__footer-branding"},Object(a.createElement)("a",{className:"crowdsignal-forms__footer-cs-link",href:"https://crowdsignal.com?ref="+c,target:"_blank",rel:"noopener noreferrer"},r||Object(l.__)("Create your own poll with Crowdsignal","crowdsignal-forms")),n&&Object(a.createElement)(E.Tooltip,{text:fe,position:"top center"},Object(a.createElement)("a",{href:"https://crowdsignal.com/pricing",target:"_blank",rel:"noopener noreferrer",className:"crowdsignal-forms__branding-promote"},Object(l.__)("Hide","crowdsignal-forms"))),t&&Object(a.createElement)("a",{href:"https://crowdsignal.com?ref="+c,target:"_blank",rel:"noopener noreferrer"},Object(a.createElement)("img",{className:"crowdsignal-forms__footer-branding-logo",src:"https://app.crowdsignal.com/images/svg/cs-logo-dots.svg",alt:"Crowdsignal sticker"})))},me=Object.freeze({THANK_YOU:"thank-you",CUSTOM_TEXT:"custom-text",REDIRECT:"redirect",RESULTS:"results"}),pe=Object.freeze({THEME_DEFAULT:"theme-default",GEORGIA:"georgia",PALATINO:"palatino",TIMES_NEW_ROMAN:"times-new-roman",ARIAL:"arial",IMPACT:"impact",LUCIDA:"lucida",TAHOMA:"tahoma",TREBUCHET:"trebuchet",VERDANA:"verdana",COURIER:"courier",CABIN:"Cabin",CHIVO:"Chivo",OPEN_SANS:"Open+Sans",FIRA_SANS:"Fira+Sans",ROBOTO:"Roboto",NUNITO:"Nunito",OVERPASS:"Overpass",LATO:"Lato",LIBRE_FRANKLIN:"Libre+Franklin",MONTSERRAT:"Montserrat",POPPINS:"Poppins",RUBIK:"Rubik",RALEWAY:"Raleway",JOSEFIN_SANS:"Josefin+Sans",ALEGREYA_SANS:"Alegreya+Sans",OSWALD:"Oswald"}),ge=Object.freeze([pe.CABIN,pe.CHIVO,pe.OPEN_SANS,pe.FIRA_SANS,pe.ROBOTO,pe.NUNITO,pe.OVERPASS,pe.LATO,pe.LIBRE_FRANKLIN,pe.MONTSERRAT,pe.POPPINS,pe.RUBIK,pe.RALEWAY,pe.JOSEFIN_SANS,pe.ALEGREYA_SANS,pe.OSWALD]),Oe=Object.freeze((ue={},d()(ue,pe.THEME_DEFAULT,null),d()(ue,pe.GEORGIA,"Georgia, serif"),d()(ue,pe.PALATINO,'"Palatino Linotype", "Book Antiqua", Palatino, serif'),d()(ue,pe.TIMES_NEW_ROMAN,'"Times New Roman", Times, serif'),d()(ue,pe.ARIAL,"Arial, Helvetica, sans-serif"),d()(ue,pe.IMPACT,"Impact, Charcoal, sans-serif"),d()(ue,pe.LUCIDA,'"Lucida Sans Unicode", "Lucida Grande", sans-serif'),d()(ue,pe.TAHOMA,"Tahoma, Geneva, sans-serif"),d()(ue,pe.TREBUCHET,'"Trebuchet MS", Helvetica, sans-serif'),d()(ue,pe.VERDANA,"Verdana, Geneva, sans-serif"),d()(ue,pe.COURIER,'"Courier New", Courier, monospace'),d()(ue,pe.CABIN,'"Cabin", sans-serif'),d()(ue,pe.CHIVO,'"Chivo", sans-serif'),d()(ue,pe.OPEN_SANS,'"Open Sans", sans-serif'),d()(ue,pe.FIRA_SANS,'"Fira Sans", sans-serif'),d()(ue,pe.ROBOTO,'"Roboto", sans-serif'),d()(ue,pe.NUNITO,'"Nunito", sans-serif'),d()(ue,pe.OVERPASS,'"Overpass", sans-serif'),d()(ue,pe.LATO,'"Lato", sans-serif'),d()(ue,pe.LIBRE_FRANKLIN,'"Libre Franklin", sans-serif'),d()(ue,pe.MONTSERRAT,'"Montserrat", sans-serif'),d()(ue,pe.POPPINS,'"Poppins", sans-serif'),d()(ue,pe.RUBIK,'"Rubik", sans-serif'),d()(ue,pe.RALEWAY,'"Raleway", sans-serif'),d()(ue,pe.JOSEFIN_SANS,'"Josefin Sans", sans-serif'),d()(ue,pe.ALEGREYA_SANS,'"Alegreya Sans", sans-serif'),d()(ue,pe.OSWALD,'"Oswald", sans-serif'),ue)),ve=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),we=Object.freeze({SHOW_RESULTS:"show-results",SHOW_CLOSED_BANNER:"show-closed-banner",HIDDEN:"hidden"}),he=Object.freeze({RADIO:"radio",BUTTON:"button"}),je=Object.freeze({LIST:"list",INLINE:"inline"});function _e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var ye=function(e,t){return Object(b.map)(e,(function(e){return void 0!==e.answerIdFromApi?e:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{answerIdFromApi:t[e.answerId]})}))},Ce=function(e){return Object(b.isEmpty)(e)||void 0===e.text||null===e.text||""===e.text},Ee=function(e){var t=e.answers,n=e.pollIdFromApi,r=e.setErrorMessage,o=e.hideBranding,c=le(n),i=c.error,s=c.loading,u=c.results;Object(_.useEffect)((function(){r(i?Object(l.__)("Unfortunately, we're having some trouble retrieving the results for this poll at this time.","crowdsignal-forms"):"")}),[i]);var d=T()("crowdsignal-forms-poll__results",{"is-error":!!i,"is-loading":s}),f=Object(b.sum)(Object(b.values)(u));return Object(a.createElement)("div",{className:d},Object(a.createElement)("div",{className:"crowdsignal-forms-poll__results-list"},Object(b.map)(t,(function(e){var t;return!Ce(e)&&Object(a.createElement)(de,{key:e.answerId,error:!!i,loading:s,text:e.text,totalVotes:f,votes:u&&null!==(t=u[e.answerIdFromApi])&&void 0!==t?t:0})}))),Object(a.createElement)("div",{className:"crowdsignal-forms-poll__results-footer"},Object(a.createElement)("span",{className:"crowdsignal-forms-poll__results-total"},Object(l.sprintf)(Object(l._n)("%s total vote","%s total votes",f,"crowdsignal-forms"),f?f.toLocaleString():0)),!o&&Object(a.createElement)(be,null)))};Ee.propTypes={pollIdFromApi:L.a.number,answers:L.a.arrayOf(L.a.shape({answerId:L.a.string.isRequired,answerIdFromApi:L.a.number,text:L.a.string})).isRequired,setErrorMessage:L.a.func.isRequired,hideBranding:L.a.bool};var ke=Ee,xe=n(19),Se=n.n(xe),Te=function(e){for(var t=window.getComputedStyle(e).backgroundColor;"rgba(0, 0, 0, 0)"===t&&e.parentNode&&e.parentNode.nodeType===window.Node.ELEMENT_NODE;)e=e.parentNode,t=window.getComputedStyle(e).backgroundColor;return t},Ie=function(){return Object(a.createElement)("div",{className:"crowdsignal-forms__style-probe"},Object(a.createElement)("p",null),Object(a.createElement)("h3",null,"Text"),Object(a.createElement)("div",{className:"wp-block-button"},Object(a.createElement)("div",{className:"wp-block-button__link"})),Object(a.createElement)("div",{className:"entry-content"},Object(a.createElement)("div",{className:"alignwide"})))},Pe=function(e){if(null===e)return{};var t,n=e.querySelector(".wp-block-button__link"),r=e.querySelector("p"),o=e.querySelector("h3"),a=e.querySelector(".alignwide"),l=Te(n),c=Te(r),i=window.getComputedStyle(r).color;if(l===c){var s=(t=n,"0px"!==window.getComputedStyle(t).borderBlockStartWidth?window.getComputedStyle(t).borderBlockStartColor:null);l=s||i}return{accentColor:l,backgroundColor:c,textColor:i,textColorInverted:window.getComputedStyle(n).color,textFont:window.getComputedStyle(r).fontFamily,textSize:window.getComputedStyle(r).fontSize,headingFont:window.getComputedStyle(o).fontFamily,contentWideWidth:window.getComputedStyle(a).maxWidth}},Le=function(e){return Object(E.withFallbackStyles)((function(e){return{fallbackStyles:Pe(e.querySelector(".crowdsignal-forms__style-probe"))}}))((function(t){var n=t.fallbackStyles,r=Se()(t,["fallbackStyles"]);return Object(a.createElement)(e,w()({fallbackStyles:n||{},renderStyleProbe:function(){return n?null:Object(a.createElement)(Ie,null)}},r))}))};function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Ae=function(e){var t=e.answer,n=e.answerStyle,r=e.index,o=e.isMultipleChoice,c=e.onChange,i=e.onDelete,s=e.onNewAnswer,u=e.disabled,f=function(e){return c(r,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t,{text:e}))},m=function(){return i(r)},p=function(){return s(r+1)},g=T()("crowdsignal-forms-poll__answer",{"is-multiple-choice":o,"is-button":he.BUTTON===n});return Object(a.createElement)("div",{className:g},he.RADIO===n&&Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{className:"crowdsignal-forms-poll__check"}),Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-label-wrapper"},u?Object(a.createElement)("div",{className:"crowdsignal-forms-poll__answer-label"},t.text?Object(k.decodeEntities)(t.text):Object(l.__)("Enter an answer","crowdsignal-forms")):Object(a.createElement)(C.RichText,{className:"crowdsignal-forms-poll__answer-label",placeholder:Object(l.__)("Enter an answer","crowdsignal-forms"),multiline:!1,preserveWhiteSpace:!1,onChange:f,onSplit:p,onReplace:b.noop,onRemove:m,value:t.text,allowedFormats:[],withoutInteractiveFormatting:!0}))),he.BUTTON===n&&Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-poll__block-button"},u?Object(a.createElement)("div",{className:"wp-block-button__link crowdsignal-forms-poll__submit-button"},t.text?Object(k.decodeEntities)(t.text):Object(l.__)("Enter an answer","crowdsignal-forms")):Object(a.createElement)(C.RichText,{className:"wp-block-button__link crowdsignal-forms-poll__submit-button",placeholder:Object(l.__)("Enter an answer","crowdsignal-forms"),multiline:!1,preserveWhiteSpace:!1,onChange:f,onSplit:p,onReplace:b.noop,onRemove:m,value:t.text,allowedFormats:[],withoutInteractiveFormatting:!0})))},Re=function(e,t){return Object(b.tap)(e.querySelectorAll("[role=textbox]")[t],(function(e){return e&&e.focus()}))},De=function(e){var t=e.attributes,n=e.isSelected,r=e.setAttributes,o=e.disabled,l=e.answerStyle,c=e.buttonAlignment,i=Object(_.useRef)(),u=function(e,n){return r({answers:Object(b.tap)(s()(t.answers),(function(t){t[e]=n}))})},d=function(e){Re(i.current,Math.max(e-1,0)),r({answers:Object(b.filter)(t.answers,(function(n){return t.answers.length<=2||n!==t.answers[e]}))})},f=function(e){e<t.answers.length&&r({answers:[].concat(s()(Object(b.slice)(t.answers,0,e)),[{}],s()(Object(b.slice)(t.answers,e,t.answers.length)))}),Re(i.current,Math.min(e,t.answers.length))},m=n&&Object(b.last)(t.answers).text?[].concat(s()(t.answers),[{}]):t.answers,p=T()({"is-button":he.BUTTON===l,"is-inline-button-alignment":je.INLINE===c},"crowdsignal-forms-poll__options"),g=he.RADIO===l;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{ref:i,className:p},Object(b.map)(m,(function(e,r){return function(e){return n&&!o||!Ce(e)}(e)&&Object(a.createElement)(Ae,{key:"poll-answer-".concat(r),answer:e,answerStyle:l,index:r,isMultipleChoice:t.isMultipleChoice,onChange:u,onDelete:d,onNewAnswer:f,disabled:o})}))),g&&Object(a.createElement)("div",{className:"crowdsignal-forms-poll__actions"},Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-poll__block-button"},o?Object(a.createElement)("div",{className:"wp-block-button__link crowdsignal-forms-poll__submit-button"},t.submitButtonLabel):Object(a.createElement)(C.RichText,{className:"wp-block-button__link crowdsignal-forms-poll__submit-button",onChange:function(e){return r({submitButtonLabel:e})},value:t.submitButtonLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0}))))},Be=function(e){return Object(b.includes)(pe,e)?Oe[e]:null},Fe=function(e,t){var n,r,o,a,l=Object(b.isEmpty)(e.textColor)?t.textColor:e.textColor;return Object(b.mapKeys)({borderColor:null!==(n=e.borderColor)&&void 0!==n?n:t.accentColor,borderRadius:"".concat(e.borderRadius,"px"),borderWidth:"".concat(e.borderWidth,"px"),bgColor:e.backgroundColor,bodyFontFamily:null!==(r=Be(e.fontFamily))&&void 0!==r?r:t.textFont,questionFontFamily:null!==(o=Be(e.fontFamily))&&void 0!==o?o:t.headingFont,submitButtonBgColor:e.submitButtonBackgroundColor||t.accentColor,submitButtonTextColor:e.submitButtonTextColor||t.textColorInverted,textColor:l,textColorProperties:null!==(a=Me(l))&&void 0!==a?a:"0, 0, 0",contentWideWidth:t.contentWideWidth},(function(e,t){return"--crowdsignal-forms-".concat(Object(b.kebabCase)(t))}))},Me=function(e){return!e||"string"!=typeof e||-1===e.indexOf("rgb")&&0!==e.indexOf("#")||-1<e.indexOf("rgba")?null:(0===e.indexOf("#")&&(e=He(e)),e.match(/\((.*?)\)/)[1])},He=function(e){var t=0,n=0,r=0,o=4===e.length?"#".concat(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]):e;return 7===o.length&&(t=parseInt(o.substr(1,2),16)||0,n=parseInt(o.substr(3,2),16)||0,r=parseInt(o.substr(5,2),16)||0),"rgb(".concat(t,", ").concat(n,", ").concat(r,")")},Ve=function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return T()({"has-bg-color":e.backgroundColor,"has-text-color":e.textColor,"has-submit-button-bg-color":e.submitButtonBackgroundColor,"has-submit-button-text-color":e.submitButtonTextColor,"has-border-radius":null!==(t=e.borderRadius)&&void 0!==t&&t,"has-box-shadow":e.hasBoxShadow},r)},We=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;if(ve.CLOSED===e)return!0;if(ve.CLOSED_AFTER===e){var r=new Date(t);return r<n}return!1},Ue=function(e,t){return e.isMultipleChoice?he.RADIO:!Object(b.isEmpty)(t)&&t.indexOf("is-style-buttons")>-1?he.BUTTON:he.RADIO},ze=function(e){e?Object(r.registerBlockStyle)("crowdsignal-forms/poll",{name:"buttons",label:Object(l.__)("Buttons","crowdsignal-forms")}):Object(r.unregisterBlockStyle)("crowdsignal-forms/poll","buttons")},qe=function(e){var t=e.signalWarning;return Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.Button,{href:"https://crowdsignal.com/pricing",isSecondary:!0,target:"_blank"},Object(l.__)("Upgrade","crowdsignal-forms")),t?Object(a.createElement)("div",{className:"crowdsignal-forms__sidebar-promote"},Object(a.createElement)("em",null,Object(l.__)("Your free Crowdsignal account has ","crowdsignal-forms"),Object(a.createElement)("strong",null,Object(a.createElement)(E.ExternalLink,{href:"https://crowdsignal.com/support/what-is-a-signal/"},Object(l.__)("reached the signals limit.","crowdsignal-forms"))))):Object(a.createElement)("div",{className:"crowdsignal-forms__sidebar-promote"},Object(a.createElement)("em",null,Object(l.__)("Hide Crowdsignal branding and get ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://crowdsignal.com/support/what-is-a-signal/"},Object(l.__)("unlimited signals","crowdsignal-forms")))))},Ke=function(e){var t,n=e.attributes,r=e.className,o=e.setAttributes,c=e.fallbackBackgroundColor,i=e.fallbackTextColor,s=e.fallbackSubmitButtonBackgroundColor,u=e.fallbackSubmitButtonTextColor,d=e.viewResultsUrl,f=e.shouldPromote,m=e.signalWarning,p=""!==d,g=Ue(n,r);return me.REDIRECT===n.confirmMessageType&&(n.confirmMessageType=me.THANK_YOU),Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,p?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Publish this post to enable results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{href:d,isSecondary:!0,target:"_blank",disabled:!p},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{value:Object(k.decodeEntities)(null!==(t=n.title)&&void 0!==t?t:n.question),label:Object(l.__)("Title of the poll block","crowdsignal-forms"),onChange:function(e){return o({title:e})}}),f&&Object(a.createElement)(qe,{signalWarning:m})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Confirmation message","crowdsignal-forms"),initialOpen:!1},Object(a.createElement)(E.SelectControl,{value:n.confirmMessageType,label:Object(l.__)("On submission","crowdsignal-forms"),options:[{label:Object(l.__)("Show results","crowdsignal-forms"),value:me.RESULTS},{label:Object(l.__)('Show "Thank You" message',"crowdsignal-forms"),value:me.THANK_YOU},{label:Object(l.__)("Show a custom text message","crowdsignal-forms"),value:me.CUSTOM_TEXT}],onChange:function(e){return Object(b.includes)(me,e)&&o({confirmMessageType:e})}}),me.CUSTOM_TEXT===n.confirmMessageType&&Object(a.createElement)(E.TextareaControl,{value:n.customConfirmMessage,label:Object(l.__)("Message text","crowdsignal-forms"),placeholder:Object(l.__)("Thanks for voting!","crowdsignal-forms"),onChange:function(e){return o({customConfirmMessage:e})}}),me.REDIRECT===n.confirmMessageType&&Object(a.createElement)(C.URLInput,{className:"crowdsignal-forms__redirect-url",value:n.redirectAddress,label:Object(l.__)("Redirect address","crowdsignal-forms"),onChange:function(e){return o({redirectAddress:e})}})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms"),initialOpen:!1},Object(a.createElement)(E.SelectControl,{value:n.pollStatus,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:ve.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:ve.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:ve.CLOSED}],onChange:function(e){Object(b.includes)(ve,e)&&o({closedAfterDateTime:e===ve.CLOSED_AFTER?new Date((new Date).getTime()+864e5).toISOString():null,pollStatus:e})}}),ve.CLOSED_AFTER===n.pollStatus&&Object(a.createElement)(E.TimePicker,{currentTime:n.closedAfterDateTime,label:Object(l.__)("Close poll on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);o({closedAfterDateTime:t.toISOString()})},is12Hour:!0}),ve.OPEN!==n.pollStatus&&Object(a.createElement)(E.SelectControl,{value:n.closedPollState,label:Object(l.__)("When poll is closed","crowdsignal-forms"),options:[{label:Object(l.__)("Show results","crowdsignal-forms"),value:we.SHOW_RESULTS},{label:Object(l.__)('Show poll with "Closed" banner',"crowdsignal-forms"),value:we.SHOW_CLOSED_BANNER},{label:Object(l.__)("Hide poll","crowdsignal-forms"),value:we.HIDDEN}],onChange:function(e){return Object(b.includes)(we,e)&&o({closedPollState:e})}})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Block styling","crowdsignal-forms"),initialOpen:!1,colorSettings:[{value:n.textColor,onChange:function(e){return o({textColor:e})},label:Object(l.__)("Text color","crowdsignal-forms")},{value:n.backgroundColor,onChange:function(e){return o({backgroundColor:e})},label:Object(l.__)("Background color","crowdsignal-forms")},{value:n.borderColor,onChange:function(e){return o({borderColor:e})},label:Object(l.__)("Border color","crowdsignal-forms")}]},Object(a.createElement)(C.ContrastChecker,{textColor:n.textColor,backgroundColor:n.backgroundColor,fallbackBackgroundColor:c,fallbackTextColor:i}),Object(a.createElement)(E.SelectControl,{value:n.fontFamily,label:Object(l.__)("Choose font","crowdsignal-forms"),options:[{label:Object(l.__)("Default theme font","crowdsignal-forms"),value:pe.THEME_DEFAULT},{label:"Alegreya Sans",value:pe.ALEGREYA_SANS},{label:"Arial",value:pe.ARIAL},{label:"Cabin",value:pe.CABIN},{label:"Chivo",value:pe.CHIVO},{label:"Courier",value:pe.COURIER},{label:"Fira Sans",value:pe.FIRA_SANS},{label:"Georgia",value:pe.GEORGIA},{label:"Impact",value:pe.IMPACT},{label:"Josefin Sans",value:pe.JOSEFIN_SANS},{label:"Lato",value:pe.LATO},{label:"Libre Franklin",value:pe.LIBRE_FRANKLIN},{label:"Lucida",value:pe.LUCIDA},{label:"Montserrat",value:pe.MONTSERRAT},{label:"Nunito",value:pe.NUNITO},{label:"Open Sans",value:pe.OPEN_SANS},{label:"Oswald",value:pe.OSWALD},{label:"Overpass",value:pe.OVERPASS},{label:"Palatino",value:pe.PALATINO},{label:"Poppins",value:pe.POPPINS},{label:"Raleway",value:pe.RALEWAY},{label:"Roboto",value:pe.ROBOTO},{label:"Rubik",value:pe.RUBIK},{label:"Tahoma",value:pe.TAHOMA},{label:"Times New Roman",value:pe.TIMES_NEW_ROMAN},{label:"Trebuchet",value:pe.TREBUCHET},{label:"Verdana",value:pe.VERDANA}],onChange:function(e){return Object(b.includes)(pe,e)&&o({fontFamily:e})}}),"full"!==n.align&&Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.TextControl,{type:"number",label:Object(l.__)("Width (%)","crowdsignal-forms"),value:n.width,onChange:function(e){return o({width:parseInt(e,10)})}}),Object(a.createElement)(E.Button,{isSmall:!0,className:"crowdsignal-forms__reset-width-button",onClick:function(){return o({width:100})}},Object(l.__)("Reset","crowdsignal-forms"))),Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.TextControl,{label:Object(l.__)("Border thickness","crowdsignal-forms"),value:n.borderWidth,onChange:function(e){o({borderWidth:parseInt(e,10)||0})},type:"number",className:"crowdsignal-forms__small-text-input"}),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Corner radius","crowdsignal-forms"),value:n.borderRadius,onChange:function(e){o({borderRadius:parseInt(e,10)||0})},type:"number",className:"crowdsignal-forms__small-text-input"})),Object(a.createElement)(E.ToggleControl,{label:Object(l.__)("Drop shadow","crowdsignal-forms"),checked:n.hasBoxShadow,onChange:function(e){o({hasBoxShadow:e})}})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Button styling","crowdsignal-forms"),initialOpen:!1,colorSettings:[{value:n.submitButtonTextColor,onChange:function(e){return o({submitButtonTextColor:e})},label:Object(l.__)("Text color","crowdsignal-forms")},{value:n.submitButtonBackgroundColor,onChange:function(e){return o({submitButtonBackgroundColor:e})},label:Object(l.__)("Background color","crowdsignal-forms")}]},Object(a.createElement)(C.ContrastChecker,{textColor:n.submitButtonTextColor,backgroundColor:n.submitButtonBackgroundColor,fallbackBackgroundColor:s,fallbackTextColor:u}),he.BUTTON===g&&Object(a.createElement)(E.SelectControl,{value:n.buttonAlignment,label:Object(l.__)("Alignment","crowdsignal-forms"),options:[{value:je.LIST,label:Object(l.__)("List","crowdsignal-forms")},{value:je.INLINE,label:Object(l.__)("Inline","crowdsignal-forms")}],onChange:function(e){return o({buttonAlignment:e})}})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Answer settings","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)(E.CheckboxControl,{checked:n.hasOneResponsePerComputer,label:Object(l.__)("One response per computer","crowdsignal-forms"),onChange:function(e){return o({hasOneResponsePerComputer:e})}}),Object(a.createElement)(E.CheckboxControl,{checked:n.randomizeAnswers,label:Object(l.__)("Randomize answer order","crowdsignal-forms"),onChange:function(e){return o({randomizeAnswers:e})}})))};function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Ze=[{icon:function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{d:"M20 6.75H12V5.25H20V6.75Z"}),Object(a.createElement)("path",{d:"M20 12.5H12V11H20V12.5Z"}),Object(a.createElement)("path",{d:"M20 18.75H12V17.25H20V18.75Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM6 8C7.10457 8 8 7.10457 8 6C8 4.89543 7.10457 4 6 4C4.89543 4 4 4.89543 4 6C4 7.10457 4.89543 8 6 8Z"}),Object(a.createElement)("path",{d:"M6 12.75C6.55228 12.75 7 12.3023 7 11.75C7 11.1977 6.55228 10.75 6 10.75C5.44772 10.75 5 11.1977 5 11.75C5 12.3023 5.44772 12.75 6 12.75ZM6 13.75C7.10457 13.75 8 12.8546 8 11.75C8 10.6454 7.10457 9.75 6 9.75C4.89543 9.75 4 10.6454 4 11.75C4 12.8546 4.89543 13.75 6 13.75Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 19C6.55228 19 7 18.5523 7 18C7 17.4477 6.55228 17 6 17C5.44772 17 5 17.4477 5 18C5 18.5523 5.44772 19 6 19ZM6 20C7.10457 20 8 19.1046 8 18C8 16.8954 7.10457 16 6 16C4.89543 16 4 16.8954 4 18C4 19.1046 4.89543 20 6 20Z"}))},title:Object(l.__)("Choose one answer","crowdsignal-forms"),value:!1},{icon:function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 10.75H5V12.75H7V10.75ZM4 9.75V13.75H8V9.75H4Z"}),Object(a.createElement)("path",{d:"M4 4H8V8H4V4Z"}),Object(a.createElement)("path",{d:"M4 16H8V20H4V16Z"}),Object(a.createElement)("path",{d:"M20 6.75H12V5.25H20V6.75Z"}),Object(a.createElement)("path",{d:"M20 12.5H12V11H20V12.5Z"}),Object(a.createElement)("path",{d:"M20 18.75H12V17.25H20V18.75Z"}))},title:Object(l.__)("Choose multiple answers","crowdsignal-forms"),value:!0}],Ye=function(e){var t=e.attributes,n=e.setAttributes,r=Object(b.map)(Ze,(function(e){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{isActive:e.value===t.isMultipleChoice,onClick:function(){n({isMultipleChoice:e.value}),ze(e.value)}})}));return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.Toolbar,{controls:r}))},Qe=function(e){var t=e.children;return Object(a.createElement)("div",{className:"crowdsignal-forms-poll__error-banner"},t)},Je="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),Xe=new Uint8Array(16);function $e(){if(!Je)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Je(Xe)}for(var et=[],tt=0;tt<256;++tt)et.push((tt+256).toString(16).substr(1));var nt=function(e,t){var n=t||0;return(et[e[n+0]]+et[e[n+1]]+et[e[n+2]]+et[e[n+3]]+"-"+et[e[n+4]]+et[e[n+5]]+"-"+et[e[n+6]]+et[e[n+7]]+"-"+et[e[n+8]]+et[e[n+9]]+"-"+et[e[n+10]]+et[e[n+11]]+et[e[n+12]]+et[e[n+13]]+et[e[n+14]]+et[e[n+15]]).toLowerCase()};var rt=function(e,t,n){var r=(e=e||{}).random||(e.rng||$e)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return nt(r)},ot=function(e){var t=e.onEditClick;return Object(a.createElement)("div",{className:"crowdsignal-forms-poll__edit-bar"},Object(a.createElement)("div",{className:"crowdsignal-forms-poll__edit-bar-message"},Object(l.__)("Warning! This poll is published. Deleting or reordering answers may cause the loss of existing responses.","crowdsignal-forms")),Object(a.createElement)("button",{className:"crowdsignal-forms-poll__edit-bar-button",onClick:function(){t()}},Object(l.__)("Edit","crowdsignal-forms")))},at=Object(b.debounce)((function(e,t){window._tkq=window._tkq||[],window._tkq.push(["recordEvent","crowdsignal_connection_failed",{author_id:e,block_name:t}])}),5e3),lt=function(e){var t=e.blockIcon,n=e.blockName,r=e.children,o=ie(),c=o.accountInfo,i=o.reloadAccountInfo,s=c&&0!==c.id,u=!!c.is_verified,d=Object(f.useSelect)((function(e){return e("core").getCurrentUser()})),b=function(){var e=D()(A.a.mark((function e(){var t,n,r,o;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s,e.next=3,i();case 3:n=e.sent,r=0!==n.id,o=!!n.is_verified,r||window.open("/wp-admin/options-general.php?page=crowdsignal-forms-settings"),t&&!o&&window.open("https://wordpress.com/me/account");case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();if(s&&u)return r;var m=!s,p=s&&!u;return at(d&&d.id?d.id:0,n),Object(a.createElement)("div",{className:"crowdsignal-forms__connect-to-crowdsignal"},Object(a.createElement)("div",{className:"crowdsignal-forms__connect-to-crowdsignal-header"},t,Object(a.createElement)("div",{className:"crowdsignal-forms__connect-to-crowdsignal-title"},n)),Object(a.createElement)("div",{className:"crowdsignal-forms__connect-to-crowdsignal-body"},m&&Object(l.__)("You need to connect to a Crowdsignal account to collect and manage your results.","crowdsignal-forms"),p&&Object(l.__)("Please verify your WordPress.com email address in order to publish your poll.","crowdsignal-forms")),Object(a.createElement)(E.Button,{isPrimary:!0,onClick:b},m&&Object(l.__)("Connect to Crowdsignal","crowdsignal-forms"),p&&Object(l.__)("Verify or Change your Email Address","crowdsignal-forms")))};function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function it(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var st=function(e){return!!e&&("crowdsignal-forms/poll"===e.name||"crowdsignal-forms/applause"===e.name||"crowdsignal-forms/vote"===e.name)},ut=!1,dt=!1;!function(){if(!ut){ut=!0;var e=Object(f.select)("core/editor"),t=e.isEditedPostDirty,n=e.isEditedPostNew,r=e.isSavingPost,o=e.isCleanNewPost,a=e.getCurrentPostId,l=Object(f.dispatch)("crowdsignal-forms/polls"),c=l.setTryFetchPollData,i=l.setPollApiDataForClientId,s=l.setIsFetchingPollData,u=Object(f.select)("crowdsignal-forms/polls"),d=u.shouldTryFetchingPollData,m=u.getPollDataByClientId,p=u.isFetchingPollData;Object(f.subscribe)((function(){var e=Object(b.filter)(Object(f.select)("core/block-editor").getBlocks(),st);if(!(e.length<1)&&(!p()&&!(o()||n()||r()||t())&&a())){var l=Object(b.filter)(e,(function(e){var t=e.attributes;return t.pollId&&null===m(t.pollId)}));l.length<1||(d()?p()||(s(!0),Promise.all(Object(b.map)(l,(function(e){var t=e.attributes.pollId;return Q()({path:"/crowdsignal-forms/v1/polls/".concat(t,"?cached=1"),method:"GET"}).then((function(e){return i(t,it({},e,{viewResultsUrl:"https://app.crowdsignal.com/polls/".concat(e.id,"/results")}))}),(function(){return i(t,null)}))}))).finally((function(){return s(!1)}))):c(!0))}}))}}();var ft=function(e){return function(t){var n=t.attributes,r=t.setAttributes,o=t.addPollClientId,l=t.removePollClientId;return Object(_.useEffect)((function(){return("p2tenberg"in window||"p2editor"in window)&&function(){if(!dt){dt=!0;var e=null,t=function(){null!==e&&clearTimeout(e),e=setTimeout((function(){return n()}),1e3+1e3*Math.random())},n=function(){var e=Object(f.select)("crowdsignal-forms/polls"),n=e.getPollClientIds,r=e.getPollDataByClientId,o=e.shouldTryFetchingPollData,a=e.isFetchingPollData,l=Object(b.filter)(n(),(function(e){return null===r(e)}));if(l.length<1)return t();var c=Object(f.dispatch)("crowdsignal-forms/polls"),i=c.setTryFetchPollData,s=c.setPollApiDataForClientId,u=c.setIsFetchingPollData;return o()?a()||(u(!0),Promise.all(Object(b.map)(l,(function(e){return Q()({path:"/crowdsignal-forms/v1/polls/".concat(e,"?cached=1"),method:"GET"}).then((function(t){return s(e,it({},t,{viewResultsUrl:"https://app.crowdsignal.com/polls/".concat(t.id,"/results")}))}),(function(){return s(e,null)}))}))).finally((function(){return u(!1)}))):i(!0),t()};n()}}(),n.pollId&&o(n.pollId),function(){n.pollId&&l(n.pollId)}}),[]),function(e,t,n,r){Object(_.useEffect)((function(){if(!Object(b.isEmpty)(t))if(window.csPolls||(window.csPolls={}),window.csPolls[t])if(window.csPolls[t].indexOf(e)>-1);else{var o=Object(b.map)(n,(function(e){return Object(b.omit)(e,["answerId"])}));r({pollId:null,answers:o})}else window.csPolls[t]=[e]}),[t])}(t.clientId,n.pollId,n.answers,r),Object(a.createElement)(e,t)}},bt=function(e){return Object(x.compose)([Object(f.withSelect)((function(e,t){var n=e("crowdsignal-forms/polls"),r=n.getPollDataByClientId,o=n.shouldTryFetchingPollData,a=n.isFetchingPollData,l=t.attributes;return{pollDataFromApi:l.pollId?r(l.pollId):null,getPollDataByClientId:r,shouldTryFetchingPollData:o,isFetchingPollData:a}})),Object(f.withDispatch)((function(e){var t=e("crowdsignal-forms/polls");return{setTryFetchPollData:t.setTryFetchPollData,setPollApiDataForClientId:t.setPollApiDataForClientId,setIsFetchingPollData:t.setIsFetchingPollData,addPollClientId:t.addPollClientId,removePollClientId:t.removePollClientId}})),ft])(e)},mt=function(e){var t=e.icon,n=e.children,r=e.componentActions,o=void 0===r?[]:r,l=Se()(e,["icon","children","componentActions"]);return Object(a.createElement)(E.Notice,w()({className:"crowdsignal-forms__editor-notice"},l),t&&Object(a.createElement)("div",{className:"crowdsignal-forms__editor-notice-icon"},Object(a.createElement)(E.Icon,{icon:t})),Object(a.createElement)("div",{className:"crowdsignal-forms__editor-notice-text"},n),o.map((function(e){return e})))},pt=function(){return Object(a.createElement)(mt,{icon:"warning",status:"warn",isDismissible:!1,actions:[{label:Object(l.__)("Please upgrade","crowdsignal-forms"),url:"https://crowdsignal.com/pricing",className:"is-secondary",noDefaultClasses:!0}]},Object(l.__)("Your free Crowdsignal account has ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://crowdsignal.com/support/what-is-a-signal/"},Object(l.__)("exceeded 2500 signals.","crowdsignal-forms")))};function gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Ot=Object(x.compose)([Le,bt,function(e){return function(t){var n=t.attributes,r=t.setAttributes;return Object(_.useEffect)((function(){if(!n.pollId){var e=rt();r({pollId:e})}if(Object(b.some)(n.answers,(function(e){return!e.answerId&&e.text}))){var t=Object(b.map)(n.answers,(function(e){return e.answerId||!e.text?e:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gt(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{answerId:rt()})}));r({answers:t})}})),Object(a.createElement)(e,t)}}])((function(e){var t=e.attributes,n=e.className,r=e.fallbackStyles,o=e.isSelected,i=e.setAttributes,s=e.renderStyleProbe,u=e.pollDataFromApi,d=Object(_.useState)(!0),f=j()(d,2),m=f[0],p=f[1],g=Object(_.useState)(""),O=j()(g,2),v=O[0],h=O[1],y=!Object(b.isEmpty)(u),x=u?u.viewResultsUrl:"",S=u?u.id:null,T={};u&&Object(b.map)(u.answers,(function(e){T[e.client_id]=e.id}));var P=o&&"full"!==t.align,L="full"!==t.align?"".concat(t.width,"%"):"auto",N=We(t.pollStatus,t.closedAfterDateTime),A=t.note||o&&m,R=N&&we.SHOW_RESULTS===t.closedPollState,D=N&&we.HIDDEN===t.closedPollState,B=ie().accountInfo,F=Object(b.get)(B,"capabilities",[]).includes("hide-branding");Object(_.useEffect)((function(){return p(!y)}),[o]),Object(_.useEffect)((function(){o&&ze(!t.isMultipleChoice)}),[t.isMultipleChoice,o]);var M=o&&y&&!m,H=Ue(t,n);t.fontFamily&&function(e){if(!Object(b.isEmpty)(e)&&pe.THEME_DEFAULT!==e&&-1!==ge.indexOf(e)){var t="https://fonts.googleapis.com/css2?family=".concat(e,":wght@400;600;700&display=swap");0===Object(b.filter)(Array.from(document.head.childNodes),(function(e){return"link"===e.nodeName.toLowerCase()&&e.href===t})).length&&document.head.appendChild(Object(b.tap)(document.createElement("link"),(function(e){e.type="text/css",e.rel="stylesheet",e.href=t})))}}(t.fontFamily);var V=Object(b.get)(B,["signalCount","shouldDisplay"]),W=V&&Object(b.get)(B,["signalCount","count"])>=Object(b.get)(B,["signalCount","userLimit"]);return Object(a.createElement)(lt,{blockIcon:Object(a.createElement)(c,null),blockName:Object(l.__)("Crowdsignal Poll","crowdsignal-forms")},Object(a.createElement)(Ye,e),Object(a.createElement)(Ke,w()({},e,{viewResultsUrl:x,shouldPromote:V,signalWarning:W})),W&&Object(a.createElement)(pt,null),Object(a.createElement)(E.ResizableBox,{className:"crowdsignal-forms-poll__resize-wrapper",size:{height:"auto",width:L},minWidth:"25%",maxWidth:"100%",enable:{left:!0,right:!0},onResizeStop:function(e,t,n){"right"!==t&&"left"!==t||i({width:Object(b.round)(n.offsetWidth/n.parentNode.offsetWidth*100)})},showHandle:P,resizeRatio:2},Object(a.createElement)("div",{className:Ve(t,n,{"is-selected-in-editor":o,"is-closed":N,"is-hidden":D},"crowdsignal-forms-poll"),style:Fe(t,r)},M&&Object(a.createElement)(ot,{onEditClick:function(){p(!0)}}),v&&Object(a.createElement)(Qe,null,v),Object(a.createElement)("div",{className:"crowdsignal-forms-poll__content"},m?Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-poll__question",placeholder:Object(l.__)("Enter your question","crowdsignal-forms"),onChange:function(e){return i({question:e})},value:t.question,allowedFormats:[]}):Object(a.createElement)(C.RichText.Content,{tagName:"h3",className:"crowdsignal-forms-poll__question",placeholder:Object(l.__)("Enter your question","crowdsignal-forms"),value:Object(k.decodeEntities)(t.question)}),A&&(m?Object(a.createElement)(C.RichText,{tagName:"p",className:"crowdsignal-forms-poll__note",placeholder:Object(l.__)("Add a note (optional)","crowdsignal-forms"),onChange:function(e){return i({note:e})},value:t.note,allowedFormats:[]}):Object(a.createElement)(C.RichText.Content,{tagName:"div",className:"crowdsignal-forms-poll__note",placeholder:Object(l.__)("Add a note (optional)","crowdsignal-forms"),value:Object(k.decodeEntities)(t.note)})),!R&&Object(a.createElement)(De,w()({},e,{setAttributes:i,disabled:!m,answerStyle:H,buttonAlignment:t.buttonAlignment})),R&&Object(a.createElement)(ke,{answers:ye(Object(b.filter)(t.answers,(function(e){return!Ce(e)})),T),pollIdFromApi:S,hideBranding:F,setErrorMessage:h}),!F&&Object(a.createElement)(be,{editing:!0})),N&&Object(a.createElement)(I,{isPollHidden:D,isPollClosed:N}),s())))})),vt={pollId:{type:"string",default:null},isMultipleChoice:{type:"boolean",default:!1},title:{type:"string",default:null},question:{type:"string",default:""},note:{type:"string",default:""},answers:{type:"array",default:[{},{},{}],items:{type:"object",properties:{answerId:{type:"string",default:null},text:{type:"string",default:""}}}},submitButtonLabel:{type:"string",default:Object(l.__)("Submit","crowdsignal-forms")},submitButtonTextColor:{type:"string"},submitButtonBackgroundColor:{type:"string"},confirmMessageType:{type:"string",default:me.RESULTS},customConfirmMessage:{type:"string"},redirectAddress:{type:"string"},textColor:{type:"string"},backgroundColor:{type:"string"},borderColor:{type:"string"},borderWidth:{type:"number",default:2},borderRadius:{type:"number",default:0},hasBoxShadow:{type:"boolean",default:!1},fontFamily:{type:"string",default:pe.THEME_DEFAULT},hasOneResponsePerComputer:{type:"boolean",default:!1},randomizeAnswers:{type:"boolean",default:!1},align:{type:"string"},width:{type:"number",default:100},pollStatus:{type:"string",default:ve.OPEN},closedPollState:{type:"string",default:we.SHOW_RESULTS},closedAfterDateTime:{type:"string",default:null},hideBranding:{type:"boolean",default:!1},buttonAlignment:{type:"string",default:je.LIST}},wt={title:Object(l.__)("Poll","crowdsignal-forms"),description:Object(l.__)("Create polls and get your audience’s opinion — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",keywords:[Object(l.__)("ask","crowdsignal-forms"),"crowdsignal",Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("form","crowdsignal-forms"),Object(l.__)("opinion","crowdsignal-forms"),Object(l.__)("poll","crowdsignal-forms"),Object(l.__)("pop","crowdsignal-forms"),Object(l.__)("question","crowdsignal-forms"),Object(l.__)("quiz","crowdsignal-forms"),Object(l.__)("research","crowdsignal-forms"),Object(l.__)("survey","crowdsignal-forms"),Object(l.__)("vote","crowdsignal-forms")],icon:Object(a.createElement)(c,null),edit:Ot,attributes:vt,supports:{align:["center","wide","full"]},getEditWrapperProps:function(e){return{"data-align":e.align}},example:{attributes:{question:Object(l.__)("How did you hear about us?","crowdsignal-forms"),answers:[{text:Object(l.__)("Search","crowdsignal-forms")},{text:Object(l.__)("Friend","crowdsignal-forms")},{text:Object(l.__)("Email","crowdsignal-forms")}]}},styles:[{name:"default",label:Object(l.__)("List","crowdsignal-forms"),isDefault:!0},{name:"buttons",label:Object(l.__)("Buttons","crowdsignal-forms")}],variations:[{isDefault:!0,attributes:{className:"is-style-buttons"}}]},ht=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("mask",{id:"maskVote","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:"3",y:"3",width:"18",height:"18"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.5999 9.525H13.3942L14.1779 5.75475L14.2027 5.49075C14.2027 5.1525 14.0624 4.839 13.8397 4.61625L12.9652 3.75L7.53666 9.18675C7.23142 9.48374 7.04992 9.89621 7.04991 10.3499H3.75V18.6824H7.05V18.6178C7.05963 19.5172 7.79834 20.25 8.69991 20.25H16.1249C16.8097 20.25 17.3954 19.8375 17.6429 19.2435L20.1344 13.4273C20.2087 13.2375 20.2499 13.0395 20.2499 12.825V11.175C20.2499 10.2675 19.5074 9.525 18.5999 9.525ZM7.05 18.6178V10.3499H7.04991C7.04991 10.35 7.04991 10.35 7.04991 10.35V18.6C7.04991 18.6059 7.04994 18.6119 7.05 18.6178ZM18.5999 12.825L16.1249 18.6H8.69986V10.35L12.2804 6.76952L11.3646 11.175H18.5999V12.825Z",fill:"white"})),Object(a.createElement)("g",{mask:"url(#maskVote)"},Object(a.createElement)("rect",{x:"1.00024",y:"1.25",width:"22",height:"22"})))},jt=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),_t=(Object.freeze({CONNECTED:"connected",NOT_CONNECTED:"not-connected",NOT_VERIFIED:"not-verified"}),[{title:Object(l.__)("Small","crowdsignal-forms"),size:"small"},{title:Object(l.__)("Medium","crowdsignal-forms"),size:"medium"},{title:Object(l.__)("Large","crowdsignal-forms"),size:"large"}]),yt={position:"bottom right",isAlternate:!0,className:"crowdsignal-forms-vote__size-dropdown"},Ct=function(e){var t=e.attributes,n=e.setAttributes,r=e.viewResultsUrl,o=e.signalWarning,c=e.shouldPromote,i=""!==r;return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,i?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Publish this post to enable results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{href:r,isSecondary:!0,target:"_blank",disabled:!i},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{value:t.title,label:Object(l.__)("Title of the vote block","crowdsignal-forms"),onChange:function(e){return n({title:e})}}),c&&Object(a.createElement)(qe,{signalWarning:o})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms")},Object(a.createElement)(E.SelectControl,{value:t.pollStatus,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:jt.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:jt.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:jt.CLOSED}],onChange:function(e){Object(b.includes)(jt,e)&&n({closedAfterDateTime:e===jt.CLOSED_AFTER?new Date((new Date).getTime()+864e5).toISOString():null,pollStatus:e})}}),jt.CLOSED_AFTER===t.pollStatus&&Object(a.createElement)(E.TimePicker,{currentTime:t.closedAfterDateTime,label:Object(l.__)("Close vote block on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);n({closedAfterDateTime:t.toISOString()})},is12Hour:!0})))},Et=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.1894 5.75L13.6668 5.75L13.6668 4.25H19.0002H19.7502L19.7502 5V10.3333H18.2502V6.81054L6.81072 18.25L10.3333 18.25V19.75L5 19.75H4.25V19V13.6666L5.75 13.6666L5.75 17.1894L17.1894 5.75Z"}))},kt=function(){return Object(a.createElement)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("line",{x1:"8",y1:"8.5",x2:"24",y2:"8.5",stroke:"currentColor"}),Object(a.createElement)("line",{x1:"8",y1:"15",x2:"24",y2:"15",stroke:"currentColor",strokeWidth:"2"}),Object(a.createElement)("line",{x1:"8",y1:"22.5",x2:"24",y2:"22.5",stroke:"currentColor",strokeWidth:"3"}))},xt=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{d:"M12.0078 18.2266C14.7656 18.2266 16.4062 15.9531 16.4062 12.3438C16.4062 8.73438 14.75 6.5 12.0078 6.5C9.25781 6.5 7.59375 8.75 7.59375 12.3516C7.59375 15.9688 9.24219 18.2266 12.0078 18.2266ZM12.0078 16.5781C10.5078 16.5781 9.625 15 9.625 12.3438C9.625 9.73438 10.5234 8.14844 12.0078 8.14844C13.4844 8.14844 14.3672 9.71875 14.3672 12.3516C14.3672 15.0078 13.5 16.5781 12.0078 16.5781Z"}))};function St(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Tt=function(e){var t=e.attributes,n=e.setAttributes,r=Object(b.get)(t,"size","medium"),o=_t,c=Object(_.useState)(!1),i=j()(c,2),s=i[0],u=i[1],f=function(){return u(!s)},m=t.hideResults?Object(l.__)("Show vote counters","crowdsignal-forms"):Object(l.__)("Hide vote counters","crowdsignal-forms");return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.ToolbarGroup,{isCollapsed:!0,icon:Et,label:Object(l.__)("Change block size","crowdsignal-forms"),popoverProps:yt,controls:o.map((function(e){var t=e.size;return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?St(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):St(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{isActive:r===t,role:"menuitemradio",onClick:function(){return n({size:t})}})}))}),Object(a.createElement)(E.Toolbar,{controls:[{icon:kt,onClick:f},{icon:xt,label:m,onClick:function(){return n({hideResults:!t.hideResults})},isActive:!t.hideResults,isPressed:!t.hideResults}]}),s&&Object(a.createElement)(E.Popover,{className:"crowdsignal-forms__border-popover",onFocusOutside:f},Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.TextControl,{label:Object(l.__)("Border thickness","crowdsignal-forms"),type:"number",className:"crowdsignal-forms__small-text-input",onChange:function(e){n({borderWidth:parseInt(e,10)||0})},value:t.borderWidth||0}),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Corner radius","crowdsignal-forms"),type:"number",className:"crowdsignal-forms__small-text-input",onChange:function(e){n({borderRadius:parseInt(e,10)||0})},value:t.borderRadius||0}))))},It=function(e){return function(t){return function(n){var r=n.attributes,o=n.setAttributes;return Object(_.useEffect)((function(){Object(b.forEach)(e,(function(e){r[e]||o(d()({},e,rt()))}))}),[]),Object(a.createElement)(t,n)}}},Pt=function(e,t,n,r){return Object(_.useEffect)((function(){Object(b.isEmpty)(window.csBlockTypeCount)&&(window.csBlockTypeCount={}),Object(b.isNil)(window.csBlockTypeCount[e])&&(window.csBlockTypeCount[e]=0),window.csBlockTypeCount[e]++,null===n.title&&(1===window.csBlockTypeCount[e]?r({title:t}):r({title:"".concat(t," ").concat(window.csBlockTypeCount[e])}))}),[])},Lt=Object(x.compose)([bt,It(["pollId"])])((function(e){var t=e.attributes,n=e.setAttributes,r=e.className,o=e.pollDataFromApi;Pt(e.name,Object(l.__)("Untitled Vote","crowdsignal-forms"),t,n);var c=o?o.viewResultsUrl:"",i=We(t.pollStatus,t.closedAfterDateTime),s=T()(r,"crowdsignal-forms-vote","size-".concat(t.size),{"no-results":t.hideResults,"is-closed":i}),u=function(e){return Object(b.mapKeys)({borderRadius:"".concat(e.borderRadius,"px"),borderWidth:"".concat(e.borderWidth,"px")},(function(e,t){return"--crowdsignal-forms-vote-".concat(Object(b.kebabCase)(t))}))}(t),d=ie().accountInfo,f=Object(b.get)(d,["signalCount","shouldDisplay"]),m=f&&Object(b.get)(d,["signalCount","count"])>=Object(b.get)(d,["signalCount","userLimit"]);return Object(a.createElement)(lt,{blockIcon:null,blockName:Object(l.__)("Crowdsignal Vote","crowdsignal-forms")},Object(a.createElement)(Ct,w()({},e,{shouldPromote:f,signalWarning:m,viewResultsUrl:c})),Object(a.createElement)(Tt,e),Object(a.createElement)("div",{className:s,style:u},Object(a.createElement)("div",{className:"crowdsignal-forms-vote__items"},Object(a.createElement)(C.InnerBlocks,{template:[["crowdsignal-forms/vote-item",{type:"up"}],["crowdsignal-forms/vote-item",{type:"down"}]],templateInsertUpdatesSelection:!1,templateLock:"insert",allowedBlocks:["crowdsignal-forms/vote-item"],orientation:"horizontal",__experimentalMoverDirection:"horizontal"}))))})),Nt={pollId:{type:"string",default:null},hideBranding:{type:"boolean",default:!1},title:{type:"string",default:null},pollStatus:{type:"string",default:jt.OPEN},closedAfterDateTime:{type:"string",default:null},size:{type:"string",default:"medium"},borderWidth:{type:"number",default:1},borderRadius:{type:"number",default:5},hideResults:{type:"boolean",default:!1}},At={title:Object(l.__)("Vote","crowdsignal-forms"),description:Object(l.__)("Allow your audience to rate your work or express their opinion — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",keywords:[Object(l.__)("ballot","crowdsignal-forms"),Object(l.__)("button","crowdsignal-forms"),Object(l.__)("count","crowdsignal-forms"),"crowdsignal",Object(l.__)("deciding","crowdsignal-forms"),Object(l.__)("decision","crowdsignal-forms"),Object(l.__)("elect","crowdsignal-forms"),Object(l.__)("election","crowdsignal-forms"),Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("form","crowdsignal-forms"),Object(l.__)("like","crowdsignal-forms"),Object(l.__)("nero","crowdsignal-forms"),Object(l.__)("opinion","crowdsignal-forms"),Object(l.__)("poll","crowdsignal-forms"),Object(l.__)("polling","crowdsignal-forms"),Object(l.__)("rate","crowdsignal-forms"),Object(l.__)("rating","crowdsignal-forms"),Object(l.__)("research","crowdsignal-forms"),Object(l.__)("survey","crowdsignal-forms"),Object(l.__)("thumb down","crowdsignal-forms"),Object(l.__)("thumb up","crowdsignal-forms"),Object(l.__)("thumbs","crowdsignal-forms"),Object(l.__)("vote","crowdsignal-forms"),Object(l.__)("voting","crowdsignal-forms")],icon:Object(a.createElement)(ht,null),edit:Lt,save:function(){return Object(a.createElement)(C.InnerBlocks.Content,null)},attributes:Nt,example:{attributes:{className:"crowdsignal-forms-vote__example",size:"large"}}},Rt=function(e){var t=e.attributes,n=e.setAttributes;return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Styling","crowdsignal-forms"),initialOpen:!0,colorSettings:[{value:t.textColor,onChange:function(e){return n({textColor:e})},label:Object(l.__)("Text color","crowdsignal-forms")},{value:t.backgroundColor,onChange:function(e){return n({backgroundColor:e})},label:Object(l.__)("Background color","crowdsignal-forms")},{value:t.borderColor,onChange:function(e){return n({borderColor:e})},label:Object(l.__)("Border color","crowdsignal-forms")}]}))};function Dt(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Bt(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var Ft=n(22),Mt=n.n(Ft),Ht=!1,Vt=y.a.createContext(null),Wt="entering",Ut="entered",zt=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var o,a=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?a?(o="exited",r.appearStatus=Wt):o=Ut:o=t.unmountOnExit||t.mountOnEnter?"unmounted":"exited",r.state={status:o},r.nextCallback=null,r}Dt(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&"unmounted"===t.status?{status:"exited"}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==Wt&&n!==Ut&&(t=Wt):n!==Wt&&n!==Ut||(t="exiting")}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===Wt?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,o=this.props.nodeRef?[r]:[Mt.a.findDOMNode(this),r],a=o[0],l=o[1],c=this.getTimeouts(),i=r?c.appear:c.enter;!e&&!n||Ht?this.safeSetState({status:Ut},(function(){t.props.onEntered(a)})):(this.props.onEnter(a,l),this.safeSetState({status:Wt},(function(){t.props.onEntering(a,l),t.onTransitionEnd(i,(function(){t.safeSetState({status:Ut},(function(){t.props.onEntered(a,l)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:Mt.a.findDOMNode(this);t&&!Ht?(this.props.onExit(r),this.safeSetState({status:"exiting"},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:Mt.a.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=o[0],l=o[1];this.props.addEndListener(a,l)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if("unmounted"===e)return null;var t=this.props,n=t.children,r=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,Bt(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return y.a.createElement(Vt.Provider,{value:null},"function"==typeof n?n(e,r):y.a.cloneElement(y.a.Children.only(n),r))},t}(y.a.Component);function qt(){}zt.contextType=Vt,zt.propTypes={},zt.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:qt,onEntering:qt,onEntered:qt,onExit:qt,onExiting:qt,onExited:qt},zt.UNMOUNTED="unmounted",zt.EXITED="exited",zt.ENTERING=Wt,zt.ENTERED=Ut,zt.EXITING="exiting";var Kt,Gt,Zt=zt;var Yt="out-in",Qt="in-out",Jt=function(e,t,n){return function(){var r;e.props[t]&&(r=e.props)[t].apply(r,arguments),n()}},Xt=((Kt={})[Yt]=function(e){var t=e.current,n=e.changeState;return y.a.cloneElement(t,{in:!1,onExited:Jt(t,"onExited",(function(){n(Wt,null)}))})},Kt[Qt]=function(e){var t=e.current,n=e.changeState,r=e.children;return[t,y.a.cloneElement(r,{in:!0,onEntered:Jt(r,"onEntered",(function(){n(Wt)}))})]},Kt),$t=((Gt={})[Yt]=function(e){var t=e.children,n=e.changeState;return y.a.cloneElement(t,{in:!0,onEntered:Jt(t,"onEntered",(function(){n(Ut,y.a.cloneElement(t,{in:!0}))}))})},Gt[Qt]=function(e){var t=e.current,n=e.children,r=e.changeState;return[y.a.cloneElement(t,{in:!1,onExited:Jt(t,"onExited",(function(){r(Ut,y.a.cloneElement(n,{in:!0}))}))}),y.a.cloneElement(n,{in:!0})]},Gt),en=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={status:Ut,current:null},t.appeared=!1,t.changeState=function(e,n){void 0===n&&(n=t.state.current),t.setState({status:e,current:n})},t}Dt(t,e);var n=t.prototype;return n.componentDidMount=function(){this.appeared=!0},t.getDerivedStateFromProps=function(e,t){return null==e.children?{current:null}:t.status===Wt&&e.mode===Qt?{status:Wt}:!t.current||(n=t.current,r=e.children,n===r||y.a.isValidElement(n)&&y.a.isValidElement(r)&&null!=n.key&&n.key===r.key)?{current:y.a.cloneElement(e.children,{in:!0})}:{status:"exiting"};var n,r},n.render=function(){var e,t=this.props,n=t.children,r=t.mode,o=this.state,a=o.status,l=o.current,c={children:n,current:l,changeState:this.changeState,status:a};switch(a){case Wt:e=$t[r](c);break;case"exiting":e=Xt[r](c);break;case Ut:e=l}return y.a.createElement(Vt.Provider,{value:{isMounting:!this.appeared}},e)},t}(y.a.Component);en.propTypes={},en.defaultProps={mode:Yt};var tn=en;function nn(){return(nn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function rn(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var on=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=rn(n.className,r):n.setAttribute("class",rn(n.className&&n.className.baseVal||"",r)));var n,r}))},an=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),o=r[0],a=r[1];t.removeClasses(o,"exit"),t.addClass(o,a?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),o=r[0],a=r[1]?"appear":"enter";t.addClass(o,a,"active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),o=r[0],a=r[1]?"appear":"enter";t.removeClasses(o,a),t.addClass(o,a,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r="string"==typeof n,o=r?""+(r&&n?n+"-":"")+e:n[e];return{baseClassName:o,activeClassName:r?o+"-active":n[e+"Active"],doneClassName:r?o+"-done":n[e+"Done"]}},t}Dt(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var r=this.getClassNames(t)[n+"ClassName"],o=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&o&&(r+=" "+o),"active"===n&&e&&e.scrollTop,r&&(this.appliedClasses[t][n]=r,function(e,t){e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.add(r):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,r)||("string"==typeof n.className?n.className=n.className+" "+r:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+r)));var n,r}))}(e,r))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,o=n.active,a=n.done;this.appliedClasses[t]={},r&&on(e,r),o&&on(e,o),a&&on(e,a)},n.render=function(){var e=this.props,t=(e.classNames,Bt(e,["classNames"]));return y.a.createElement(Zt,nn({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(y.a.Component);an.defaultProps={classNames:""},an.propTypes={};var ln=an,cn=function(e){var t=e.className,n=e.fillColor,r=void 0===n?"black":n;return Object(a.createElement)("svg",{className:t,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("g",{clipPath:"url(#clipThumbsUp)"},Object(a.createElement)("mask",{id:"maskThumbsUp","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:"2",y:"-1",width:"20",height:"20"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.35 6.24998H13.5658L14.4366 2.06081L14.4641 1.76748C14.4641 1.39165 14.3083 1.04331 14.0608 0.795813L13.0891 -0.166687L7.05748 5.87415C6.71831 6.20415 6.51664 6.66248 6.51664 7.16665L2.84998 7.16665V16.425H6.51664V16.3333C6.51664 17.3416 7.34164 18.1666 8.34998 18.1666H16.6C17.3608 18.1666 18.0116 17.7083 18.2866 17.0483L21.055 10.5858C21.1375 10.375 21.1833 10.155 21.1833 9.91665V8.08331C21.1833 7.07498 20.3583 6.24998 19.35 6.24998ZM19.35 9.91665L16.6 16.3333H8.34998V7.16665L12.3283 3.18831L11.3108 8.08331H19.35V9.91665Z",fill:"white"})),Object(a.createElement)("g",{mask:"url(#maskThumbsUp)"},Object(a.createElement)("rect",{x:"0.999878",y:"-3.05176e-05",width:"22",height:"22",fill:r}))),Object(a.createElement)("defs",null,Object(a.createElement)("clipPath",{id:"clipThumbsUp"},Object(a.createElement)("rect",{width:"24",height:"24",fill:"white"}))))},sn=function(e){var t=e.className,n=e.fillColor,r=void 0===n?"black":n;return Object(a.createElement)("svg",{className:t,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("g",{clipPath:"url(#clipThumbsDown)"},Object(a.createElement)("mask",{id:"maskThumbsDown","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:"2",y:"5",width:"20",height:"20"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.65002 17.75H10.4342L9.56336 21.9392L9.53586 22.2325C9.53586 22.6083 9.69169 22.9567 9.93919 23.2042L10.9109 24.1667L16.9425 18.1258C17.2817 17.7958 17.4834 17.3375 17.4834 16.8333L21.15 16.8333L21.15 7.57499H17.4834V7.66666C17.4834 6.65832 16.6584 5.83332 15.65 5.83332H7.40003C6.63919 5.83332 5.98836 6.29165 5.71336 6.95166L2.94503 13.4142C2.86253 13.625 2.81669 13.845 2.81669 14.0833V15.9167C2.81669 16.925 3.64169 17.75 4.65002 17.75ZM4.65002 14.0833L7.40002 7.66666H15.65L15.65 16.8333L11.6717 20.8117L12.6892 15.9167H4.65002V14.0833Z",fill:"white"})),Object(a.createElement)("g",{mask:"url(#maskThumbsDown)"},Object(a.createElement)("rect",{x:"23.0001",y:"24",width:"22",height:"22",transform:"rotate(-180 23.0001 24)",fill:r}))),Object(a.createElement)("defs",null,Object(a.createElement)("clipPath",{id:"clipThumbsDown"},Object(a.createElement)("rect",{width:"24",height:"24",fill:"white"}))))},un=function(e){return e?e>=1e7?"".concat(Object(b.round)(e/1e6),"M"):e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e4?"".concat(Object(b.round)(e/1e3),"K"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString():"0"},dn=function(e){var t=e.attributes,n=e.voteCount,r=e.apiAnswerId,o=e.onVote,l=e.disabled,c=e.isVotedOn,i=e.hideCount,s=e.fallbackStyles,u=e.isInEditor,d=t.className,f=t.type,m=Object(_.useState)(0),p=j()(m,2),g=p[0],O=p[1],v=function(){!l&&o&&(O(1),o(r))},w="up"===f?cn:sn,h="is-type-".concat(f),y=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return T()({"has-bg-color":e.backgroundColor,"has-text-color":e.textColor,"has-border-color":e.borderColor},n)}(t,"crowdsignal-forms-vote-item",d,{"is-voted-on":c,"is-disabled":l,"is-in-editor":u},h),C=function(e,t){var n=Object(b.isEmpty)(e.textColor)?t.textColor:e.textColor,r=Object(b.isEmpty)(e.backgroundColor)?t.backgroundColor:e.backgroundColor;return Object(b.mapKeys)({borderColor:e.borderColor,bgColor:r,textColor:n,votedColor:t.accentColor},(function(e,t){return"--crowdsignal-forms-vote-".concat(Object(b.kebabCase)(t))}))}(t,s),E=n+g;return Object(a.createElement)("div",{className:y,onClick:v,onKeyPress:v,role:"button",style:C,tabIndex:0},Object(a.createElement)(w,{className:"crowdsignal-forms-vote-item__icon",fillColor:"currentColor"}),!i&&Object(a.createElement)(tn,{mode:"in-out"},Object(a.createElement)(ln,{key:g,classNames:"crowdsignal-forms-vote-item__count",timeout:300},Object(a.createElement)("div",{className:"crowdsignal-forms-vote-item__count"},un(E)))))};dn.propTypes={apiAnswerId:L.a.number,className:L.a.string,disabled:L.a.bool,isVotedOn:L.a.bool,onVote:L.a.func,type:L.a.string.isRequired,voteCount:L.a.number.isRequired};var fn=dn,bn=Object(x.compose)([Le,It(["answerId"])])((function(e){var t=e.attributes,n=e.className,r=e.fallbackStyles,o=e.renderStyleProbe;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)(Rt,e),Object(a.createElement)(fn,{attributes:t,fallbackStyles:r,className:n,voteCount:0,isInEditor:!0,type:t.type}),o())})),mn={title:Object(l.__)("Vote Item","crowdsignal-forms"),description:Object(l.__)("Allow your audience to rate your work or express their opinion — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",parent:["crowdsignal-forms/vote"],icon:Object(a.createElement)(ht,null),edit:bn,attributes:{answerId:{type:"string",default:null},type:{type:"string"},textColor:{type:"string"},backgroundColor:{type:"string"},borderColor:{type:"string"}}},pn=function(e){var t=e.showBranding,n=e.referralCode;return Object(a.createElement)("div",{className:"crowdsignal-forms__branding"},t&&Object(a.createElement)("a",{className:"crowdsignal-forms__branding-link with-external-icon",href:"https://crowdsignal.com?ref=".concat(n),target:"blank",rel:"noopener noreferrer"},Object(l.__)("Powered by Crowdsignal","crowdsignal-forms")),!t&&Object(a.createElement)("span",{className:"crowdsignal-forms__branding-link"}," "))};pn.propTypes={showBranding:L.a.bool,referralCode:L.a.string.isRequired};var gn=pn,On=function(e){var t=e.active,n=e.className,r=T()("crowdsignal-forms-applause__animation",n,{"is-active":t});return Object(a.createElement)("svg",{className:r,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("g",{className:"crowdsignal-forms-applause__animation-right"},Object(a.createElement)("path",{className:"crowdsignal-forms-applause__animation-inner-fill",fillRule:"evenodd",clipRule:"evenodd",d:"M24.5287 18.5813L21.719 22.432C20.771 23.7312 18.9509 24.0157 17.6517 23.0676L9.50948 17.1265C8.6982 16.5345 8.52021 15.3957 9.11218 14.5844C9.18511 14.4845 9.26979 14.3931 9.35606 14.3119L9.19145 14.1918C8.38017 13.5998 8.20218 12.461 8.79415 11.6497C8.93571 11.4557 9.10825 11.2933 9.30319 11.1743C9.10822 10.6266 9.17716 10.0013 9.54606 9.49567C10.1123 8.71967 11.1811 8.52659 11.9839 9.03133C12.0392 8.91852 12.1004 8.81 12.1733 8.71006C12.7653 7.89878 13.9042 7.72079 14.7154 8.31276L20.3297 12.4094L20.611 10.4435C20.6949 9.84704 21.1499 9.35925 21.7392 9.23069L23.703 8.79878L25.0454 16.3547C25.1822 17.1302 24.992 17.9464 24.5287 18.5813Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M24.5287 18.5813L21.719 22.432C20.771 23.7312 18.9509 24.0157 17.6517 23.0676L9.50948 17.1265C8.6982 16.5345 8.52021 15.3957 9.11218 14.5844C9.18511 14.4845 9.26979 14.3931 9.35606 14.3119L9.19145 14.1918C8.38017 13.5998 8.20218 12.461 8.79415 11.6497C8.93571 11.4557 9.10825 11.2933 9.30319 11.1743C9.10822 10.6266 9.17716 10.0013 9.54606 9.49567C10.1123 8.71967 11.1811 8.52659 11.9839 9.03133C12.0392 8.91852 12.1004 8.81 12.1733 8.71006C12.7653 7.89878 13.9042 7.72079 14.7154 8.31276L20.3297 12.4094L20.611 10.4435C20.6949 9.84704 21.1499 9.35925 21.7392 9.23069L23.703 8.79878L25.0454 16.3547C25.1822 17.1302 24.992 17.9464 24.5287 18.5813ZM23.6104 16.605L22.538 10.5434L22.0547 10.6502L21.4234 15.0093L13.8574 9.48855C13.8574 9.48855 13.4691 9.4034 13.349 9.56801C13.2288 9.73262 13.2638 9.95632 13.4284 10.0764L17.667 13.1693L16.8091 14.345L11.2301 10.2742C11.0655 10.1541 10.8418 10.189 10.7217 10.3536C10.6016 10.5182 10.6365 10.7419 10.8012 10.862L16.3802 14.9329L15.5222 16.1087L10.4782 12.4282C10.3136 12.3081 10.0899 12.343 9.96978 12.5076C9.84967 12.6722 9.88463 12.8959 10.0492 13.0161L15.0933 16.6966L14.2353 17.8723L10.7962 15.3629C10.6316 15.2428 10.4079 15.2777 10.2878 15.4423C10.1677 15.607 10.2027 15.8307 10.3673 15.9508L18.5094 21.8919C19.1561 22.3638 20.0713 22.2207 20.5431 21.5741L23.3571 17.7175C23.5888 17.4001 23.6766 16.9957 23.6104 16.605Z"})),Object(a.createElement)("g",{className:"crowdsignal-forms-applause__animation-left"},Object(a.createElement)("path",{className:"crowdsignal-forms-applause__animation-inner-fill",fillRule:"evenodd",clipRule:"evenodd",d:"M21.2292 18.7813L18.4195 22.632C17.4715 23.9312 15.6513 24.2157 14.3521 23.2676L6.20992 17.3265C5.39864 16.7345 5.22065 15.5957 5.81262 14.7844C5.88554 14.6845 5.97023 14.5931 6.0565 14.5119L5.89189 14.3918C5.08061 13.7998 4.90262 12.661 5.49459 11.8497C5.63615 11.6557 5.80869 11.4933 6.00363 11.3743C5.80866 10.8266 5.8776 10.2013 6.2465 9.69567C6.81274 8.91967 7.88153 8.72658 8.68439 9.23133C8.73968 9.11852 8.80084 9.01 8.87377 8.91006C9.46573 8.09878 10.6046 7.92079 11.4159 8.51276L17.0302 12.6094L17.3115 10.6435C17.3953 10.047 17.8504 9.55925 18.4397 9.43069L20.4034 8.99877L21.7458 16.5547C21.8826 17.3302 21.6925 18.1464 21.2292 18.7813Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.2292 18.7813L18.4195 22.632C17.4715 23.9312 15.6513 24.2157 14.3521 23.2676L6.20992 17.3265C5.39864 16.7345 5.22065 15.5957 5.81262 14.7844C5.88554 14.6845 5.97023 14.5931 6.0565 14.5119L5.89189 14.3918C5.08061 13.7998 4.90262 12.661 5.49459 11.8497C5.63615 11.6557 5.80869 11.4933 6.00363 11.3743C5.80866 10.8266 5.8776 10.2013 6.2465 9.69567C6.81274 8.91967 7.88153 8.72658 8.68439 9.23133C8.73968 9.11852 8.80084 9.01 8.87377 8.91006C9.46573 8.09878 10.6046 7.92079 11.4159 8.51276L17.0302 12.6094L17.3115 10.6435C17.3953 10.047 17.8504 9.55925 18.4397 9.43069L20.4034 8.99877L21.7458 16.5547C21.8826 17.3302 21.6925 18.1464 21.2292 18.7813ZM20.3108 16.805L19.2384 10.7434L18.7551 10.8502L18.1239 15.2093L10.5578 9.68854C10.5578 9.68854 10.1695 9.6034 10.0494 9.76801C9.92928 9.93261 9.96425 10.1563 10.1289 10.2764L14.3675 13.3692L13.5096 14.545L7.93056 10.4742C7.76595 10.354 7.54224 10.389 7.42213 10.5536C7.30202 10.7182 7.33699 10.9419 7.50159 11.062L13.0806 15.1329L12.2227 16.3087L7.17864 12.6282C7.01403 12.5081 6.79033 12.543 6.67022 12.7076C6.55011 12.8722 6.58507 13.0959 6.74968 13.216L11.7937 16.8965L10.9358 18.0723L7.49667 15.5629C7.33206 15.4428 7.10836 15.4777 6.98825 15.6423C6.86814 15.8069 6.9031 16.0307 7.06771 16.1508L15.2099 22.0919C15.8566 22.5638 16.7717 22.4207 17.2436 21.7741L20.0576 17.9175C20.2892 17.6001 20.3771 17.1957 20.3108 16.805Z"})),Object(a.createElement)("g",{className:"crowdsignal-forms-applause__animation-wave-small"},Object(a.createElement)("rect",{x:"15.4854",y:"4.42176",width:"1.5",height:"3",transform:"rotate(8 15.4854 4.42176)"}),Object(a.createElement)("rect",{x:"19.9369",y:"5.15548",width:"1.5",height:"3",transform:"rotate(43 19.9369 5.15548)"}),Object(a.createElement)("rect",{x:"11.1523",y:"4.78963",width:"1.5",height:"3",transform:"rotate(-27 11.1523 4.78963)"})),Object(a.createElement)("g",{className:"crowdsignal-forms-applause__animation-wave-large"},Object(a.createElement)("rect",{x:"23.453",y:"2.41095",width:"1.5",height:"3",transform:"rotate(38 23.453 2.41095)"}),Object(a.createElement)("rect",{x:"26.9413",y:"5.27211",width:"1.5",height:"3",transform:"rotate(73 26.9413 5.27211)"}),Object(a.createElement)("rect",{x:"19.5165",y:"0.562988",width:"1.5",height:"3",transform:"rotate(3 19.5165 0.562988)"}),Object(a.createElement)("rect",{width:"1.5",height:"3",transform:"matrix(-0.788011 0.615662 0.615662 0.788011 8.52597 2.41095)"}),Object(a.createElement)("rect",{width:"1.5",height:"3",transform:"matrix(-0.292372 0.956305 0.956305 0.292372 5.03775 5.27211)"}),Object(a.createElement)("rect",{width:"1.5",height:"3",transform:"matrix(-0.99863 0.052336 0.052336 0.99863 12.4625 0.562988)"})))},vn=function(e){var t=e.attributes,n=e.fallbackStyles,r=e.renderStyleProbe,o=t.apiPollData?t.apiPollData.id:null,l=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r="cs-poll-".concat(e),o=Object(_.useState)(!1),a=j()(o,2),l=a[0],c=a[1],i=Object(_.useState)(!1),s=j()(i,2),u=s[0],d=s[1],f=Object(_.useState)(""),b=j()(f,2),m=b[0],p=b[1];Object(_.useEffect)((function(){t&&void 0!==F.a.get(r)&&(d(!0),p(F.a.get(r)))}),[]);var g=function(){var o=D()(A.a.mark((function o(a){var l,i,s,u=arguments;return A.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return l=u.length>1&&void 0!==u[1]?u[1]:1,o.prev=1,c(!0),o.next=5,ee(e);case 5:return i=o.sent,o.next=8,te(i,e,a,l);case 8:d(!0),t&&(s=n?a.join(","):(new Date).getTime(),F.a.set(r,s,{sameSite:"Strict",expires:365}),p(s));case 10:return o.prev=10,c(!1),o.finish(10);case 13:case"end":return o.stop()}}),o,null,[[1,,10,13]])})));return function(e){return o.apply(this,arguments)}}();return{hasVoted:u,isVoting:l,vote:g,storedCookieValue:m}}(o,!0),c=l.hasVoted,i=l.vote,s=Object(_.useState)(0),u=j()(s,2),d=u[0],f=u[1],m=Object(_.useState)(0),p=j()(m,2),g=p[0],O=p[1],v=Object(_.useState)(null),w=j()(v,2),h=w[0],y=w[1],C=Object(_.useState)(!1),E=j()(C,2),k=E[0],x=E[1],S=Object(_.useState)(null),I=j()(S,2),P=I[0],L=I[1],N=le(o).results,R=We(t.pollStatus,t.closedAfterDateTime),B=function(){if(null!==o&&!R){P&&clearTimeout(P),x(!0),L(setTimeout((function(){x(!1)}),200));var e=g+1;O(e),f(d+1);var n=t.apiPollData.answers[0].id;null!==h&&clearTimeout(h);var r=setTimeout((function(){i([n],e),y(null),O(0)}),1e3);y(r)}},M=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return T()({"has-bg-color":e.backgroundColor,"has-text-color":e.textColor,"has-border-color":e.borderColor},n)}(t,"crowdsignal-forms-applause",t.className,"size-".concat(t.size),{"is-closed":R}),H=function(e,t){var n=Object(b.isEmpty)(e.textColor)?t.textColor:e.textColor;return Object(b.mapKeys)({bgColor:e.backgroundColor||t.backgroundColor,textColor:n,hoverColor:t.accentColor,borderRadius:"".concat(e.borderRadius||0,"px"),borderWidth:"".concat(e.borderWidth||0,"px"),borderColor:e.borderColor},(function(e,t){return"--crowdsignal-forms-applause-".concat(Object(b.kebabCase)(t))}))}(t,n),V=(null!==N?Object(b.values)(N)[0]:0)+d;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{className:M,style:H,onClick:B,onKeyPress:B,role:"button",tabIndex:0},Object(a.createElement)(On,{active:k}),Object(a.createElement)("p",{className:"crowdsignal-forms-applause__count"},un(V)," Claps"),r()),Object(a.createElement)(gn,{showBranding:c&&!t.hideBranding,referralCode:"cs-forms-applause"}))};vn.propTypes={className:L.a.string};var wn=Le(vn),hn=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),jn=[{title:Object(l.__)("Small","crowdsignal-forms"),size:"small"},{title:Object(l.__)("Medium","crowdsignal-forms"),size:"medium"},{title:Object(l.__)("Large","crowdsignal-forms"),size:"large"}],_n={position:"bottom right",isAlternate:!0,className:"crowdsignal-forms-vote__size-dropdown"};function yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Cn=function(e){var t=e.attributes,n=e.setAttributes,r=Object(b.get)(t,"size","medium"),o=jn,c=Object(_.useState)(!1),i=j()(c,2),s=i[0],u=i[1],f=function(){return u(!s)};return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.ToolbarGroup,{isCollapsed:!0,icon:Et,label:Object(l.__)("Change block size","crowdsignal-forms"),popoverProps:_n,controls:o.map((function(e){var t=e.size;return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yn(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{isActive:r===t,role:"menuitemradio",onClick:function(){return n({size:t})}})}))}),Object(a.createElement)(E.Toolbar,{controls:[{icon:kt,onClick:f}]}),s&&Object(a.createElement)(E.Popover,{className:"crowdsignal-forms__border-popover",onFocusOutside:f},Object(a.createElement)("div",{className:"crowdsignal-forms__row"},Object(a.createElement)(E.TextControl,{label:Object(l.__)("Border thickness","crowdsignal-forms"),type:"number",className:"crowdsignal-forms__small-text-input",onChange:function(e){n({borderWidth:parseInt(e,10)||0})},value:t.borderWidth}),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Corner radius","crowdsignal-forms"),type:"number",className:"crowdsignal-forms__small-text-input",onChange:function(e){n({borderRadius:parseInt(e,10)||0})},value:t.borderRadius}))))},En=function(e){var t=e.attributes,n=e.setAttributes,r=e.viewResultsUrl,o=e.shouldPromote,c=e.signalWarning,i=""!==r;return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,i?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Publish this post to enable results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{href:r,isSecondary:!0,target:"_blank",disabled:!i},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{value:t.title,label:Object(l.__)("Title of the applause block","crowdsignal-forms"),onChange:function(e){return n({title:e})}}),o&&Object(a.createElement)(qe,{signalWarning:c})),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms")},Object(a.createElement)(E.SelectControl,{value:t.pollStatus,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:hn.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:hn.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:hn.CLOSED}],onChange:function(e){Object(b.includes)(hn,e)&&n({closedAfterDateTime:e===hn.CLOSED_AFTER?new Date((new Date).getTime()+864e5).toISOString():null,pollStatus:e})}}),hn.CLOSED_AFTER===t.pollStatus&&Object(a.createElement)(E.TimePicker,{currentTime:t.closedAfterDateTime,label:Object(l.__)("Close applause block on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);n({closedAfterDateTime:t.toISOString()})},is12Hour:!0})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Styling","crowdsignal-forms"),initialOpen:!0,colorSettings:[{value:t.textColor,onChange:function(e){return n({textColor:e})},label:Object(l.__)("Text color","crowdsignal-forms")},{value:t.backgroundColor,onChange:function(e){return n({backgroundColor:e})},label:Object(l.__)("Background color","crowdsignal-forms")},{value:t.borderColor,onChange:function(e){return n({borderColor:e})},label:Object(l.__)("Border color","crowdsignal-forms")}]}))},kn=Object(x.compose)([bt,It(["pollId","answerId"])])((function(e){var t=e.attributes,n=e.setAttributes,r=e.pollDataFromApi,o=r?r.viewResultsUrl:"";Pt(e.name,Object(l.__)("Untitled Applause","crowdsignal-forms"),t,n);var c=ie().accountInfo,i=Object(b.get)(c,["signalCount","shouldDisplay"]),s=i&&Object(b.get)(c,["signalCount","count"])>=Object(b.get)(c,["signalCount","userLimit"]);return Object(a.createElement)(lt,{blockIcon:null,blockName:Object(l.__)("Crowdsignal Applause","crowdsignal-forms")},Object(a.createElement)(En,w()({},e,{shouldPromote:i,signalWarning:s,viewResultsUrl:o})),Object(a.createElement)(Cn,e),Object(a.createElement)(wn,e))})),xn={pollId:{type:"string",default:null},hideBranding:{type:"boolean",default:!1},title:{type:"string",default:null},answerId:{type:"string",default:null},size:{type:"string",default:"medium"},pollStatus:{type:"string",default:hn.OPEN},closedAfterDateTime:{type:"string",default:null},textColor:{type:"string"},backgroundColor:{type:"string"},borderColor:{type:"string"},borderWidth:{type:"number",default:0},borderRadius:{type:"number",default:0}},Sn={title:Object(l.__)("Applause","crowdsignal-forms"),description:Object(l.__)("Let your audience cheer with a big round of applause — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",keywords:["crowdsignal",Object(l.__)("applause","crowdsignal-forms"),Object(l.__)("cheer","crowdsignal-forms"),Object(l.__)("cheering","crowdsignal-forms"),Object(l.__)("clap","crowdsignal-forms"),Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("kudos","crowdsignal-forms"),Object(l.__)("like","crowdsignal-forms"),Object(l.__)("opinion","crowdsignal-forms"),Object(l.__)("praise","crowdsignal-forms"),Object(l.__)("rating","crowdsignal-forms"),Object(l.__)("upvote","crowdsignal-forms"),Object(l.__)("upvoting","crowdsignal-forms"),Object(l.__)("votes","crowdsignal-forms"),Object(l.__)("voting","crowdsignal-forms")],icon:Object(a.createElement)((function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("g",{clipPath:"url(#clip0)"},Object(a.createElement)("rect",{width:"24",height:"24",fill:"white"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.5284 16.5813L18.7187 20.432C17.7707 21.7312 15.9506 22.0157 14.6513 21.0676L6.50915 15.1265C5.69788 14.5345 5.51988 13.3957 6.11185 12.5844C6.18478 12.4845 6.26946 12.3931 6.35573 12.3119L6.19112 12.1918C5.37984 11.5998 5.20185 10.461 5.79382 9.64968C5.93538 9.45568 6.10792 9.29329 6.30287 9.17428C6.1079 8.62662 6.17683 8.00125 6.54574 7.49567C7.11197 6.71967 8.18077 6.52659 8.98362 7.03133C9.03891 6.91852 9.10007 6.81 9.173 6.71006C9.76497 5.89878 10.9038 5.72079 11.7151 6.31276L17.3294 10.4094L17.6107 8.44349C17.6946 7.84704 18.1496 7.35925 18.7389 7.23069L20.7027 6.79878L22.045 14.3547C22.1819 15.1302 21.9917 15.9464 21.5284 16.5813ZM20.61 14.605L19.5377 8.54337L19.0543 8.65016L18.4231 13.0093L10.857 7.48855C10.857 7.48855 10.4687 7.4034 10.3486 7.56801C10.2285 7.73262 10.2635 7.95632 10.4281 8.07643L14.6667 11.1693L13.8088 12.345L8.22979 8.27416C8.06518 8.15405 7.84147 8.18902 7.72136 8.35362C7.60126 8.51823 7.63622 8.74194 7.80082 8.86204L13.3798 12.9329L12.5219 14.1087L7.47787 10.4282C7.31327 10.3081 7.08956 10.343 6.96945 10.5076C6.84934 10.6722 6.8843 10.8959 7.04891 11.0161L12.0929 14.6966L11.235 15.8723L7.7959 13.3629C7.6313 13.2428 7.40759 13.2777 7.28748 13.4423C7.16737 13.607 7.20233 13.8307 7.36694 13.9508L15.5091 19.8919C16.1558 20.3638 17.0709 20.2207 17.5428 19.5741L20.3568 15.7175C20.5884 15.4001 20.6763 14.9957 20.61 14.605Z"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.2289 16.7813L15.4192 20.632C14.4711 21.9312 12.651 22.2157 11.3518 21.2676L3.20959 15.3265C2.39831 14.7345 2.22032 13.5957 2.81229 12.7844C2.88522 12.6845 2.9699 12.5931 3.05617 12.5119L2.89156 12.3918C2.08028 11.7998 1.90229 10.661 2.49426 9.84968C2.63582 9.65567 2.80836 9.49329 3.0033 9.37428C2.80834 8.82662 2.87727 8.20125 3.24618 7.69567C3.81241 6.91967 4.88121 6.72658 5.68406 7.23133C5.73935 7.11852 5.80051 7.01 5.87344 6.91006C6.46541 6.09878 7.60427 5.92079 8.41555 6.51276L14.0298 10.6094L14.3111 8.64348C14.395 8.04703 14.85 7.55925 15.4393 7.43069L17.4031 6.99877L18.7455 14.5547C18.8823 15.3302 18.6921 16.1464 18.2289 16.7813Z",fill:"white"}),Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.2289 16.7813L15.4192 20.632C14.4711 21.9312 12.651 22.2157 11.3518 21.2676L3.20959 15.3265C2.39831 14.7345 2.22032 13.5957 2.81229 12.7844C2.88522 12.6845 2.9699 12.5931 3.05617 12.5119L2.89156 12.3918C2.08028 11.7998 1.90229 10.661 2.49426 9.84968C2.63582 9.65567 2.80836 9.49329 3.0033 9.37428C2.80834 8.82662 2.87727 8.20125 3.24618 7.69567C3.81241 6.91967 4.88121 6.72658 5.68406 7.23133C5.73935 7.11852 5.80051 7.01 5.87344 6.91006C6.46541 6.09878 7.60427 5.92079 8.41555 6.51276L14.0298 10.6094L14.3111 8.64348C14.395 8.04703 14.85 7.55925 15.4393 7.43069L17.4031 6.99877L18.7455 14.5547C18.8823 15.3302 18.6921 16.1464 18.2289 16.7813ZM17.3105 14.805L16.2381 8.74337L15.7548 8.85016L15.1235 13.2093L7.55749 7.68854C7.55749 7.68854 7.16918 7.6034 7.04907 7.76801C6.92896 7.93261 6.96392 8.15632 7.12853 8.27643L11.3672 11.3692L10.5092 12.545L4.93023 8.47416C4.76562 8.35405 4.54191 8.38901 4.4218 8.55362C4.3017 8.71823 4.33666 8.94193 4.50126 9.06204L10.0803 13.1329L9.22235 14.3087L4.17831 10.6282C4.0137 10.5081 3.79 10.543 3.66989 10.7076C3.54978 10.8722 3.58474 11.0959 3.74935 11.216L8.79338 14.8965L7.93546 16.0723L4.49634 13.5629C4.33173 13.4428 4.10803 13.4777 3.98792 13.6423C3.86781 13.8069 3.90277 14.0307 4.06738 14.1508L12.2096 20.0919C12.8562 20.5638 13.7714 20.4207 14.2432 19.7741L17.0572 15.9175C17.2889 15.6001 17.3767 15.1957 17.3105 14.805Z"}),Object(a.createElement)("rect",{x:"12.4851",y:"1.42175",width:"1.5",height:"3",transform:"rotate(8 12.4851 1.42175)"}),Object(a.createElement)("rect",{x:"16.9365",y:"2.15547",width:"1.5",height:"3",transform:"rotate(43 16.9365 2.15547)"}),Object(a.createElement)("rect",{x:"8.15195",y:"1.78963",width:"1.5",height:"3",transform:"rotate(-27 8.15195 1.78963)"})),Object(a.createElement)("defs",null,Object(a.createElement)("clipPath",{id:"clip0"},Object(a.createElement)("rect",{width:"24",height:"24",fill:"white"}))))}),null),edit:kn,attributes:xn,example:{attributes:{size:"large"}}},Tn="rating",In="feedback",Pn=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),Ln={backgroundColor:{type:"string"},buttonColor:{type:"string"},buttonTextColor:{type:"string"},feedbackPlaceholder:{type:"string",default:Object(l.__)("Please help us understand your rating","crowdsignal-forms")},feedbackQuestion:{type:"string",default:Object(l.__)("Thanks so much for your response! How could we do better?","crowdsignal-forms")},hideBranding:{type:"boolean",default:!1},highRatingLabel:{type:"string",default:Object(l.__)("Extremely likely","crowdsignal-forms")},lowRatingLabel:{type:"string",default:Object(l.__)("Not likely at all","crowdsignal-forms")},ratingQuestion:{type:"string",default:Object(l.__)("How likely is it that you would recommend this project to a friend or colleague?","crowdsignal-forms")},submitButtonLabel:{type:"string",default:Object(l.__)("Submit","crowdsignal-forms")},surveyId:{type:"number",default:null},textColor:{type:"string"},title:{type:"string",default:""},viewThreshold:{type:"string",default:2},status:{type:"string",default:Pn.OPEN},closedAfterDateTime:{type:"string",default:null},isExample:{type:"boolean",default:!1}},Nn=n(32),An=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object(_.useState)(!1),r=j()(n,2),o=r[0],a=r[1],l=Object(_.useRef)(0),c=Object(_.useCallback)(Object(b.debounce)((function(t,n){return e(t).catch(n)}),1500),[]),i=Object(_.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;a(!1),c(t,(function(){e===l.current&&(n<3?i(e,n+1):a(!0))}))}),Object(b.values)(t));return Object(_.useEffect)((function(){0!=l.current++&&i(l.current)}),Object(b.values)(t)),{error:o,save:function(){return i(l.current)}}},Rn=function(e){return new Promise((function(t,n){var r=setTimeout((function(){return n(new Error("Request timed out"))}),1e4);e.then(t,n).finally((function(){return clearTimeout(r)}))}))},Dn=function(e){return Rn(Q()({path:Object(b.trimEnd)("/crowdsignal-forms/v1/nps/".concat(e.surveyId||""),"/"),method:"POST",data:e}))},Bn=function(e){var t=e.attributes,n=e.setAttributes,r=e.shouldPromote,o=e.signalWarning,c="https://app.crowdsignal.com/surveys/".concat(t.surveyId,"/report/overview"),i=function(e){return function(t){return n(d()({},e,t))}};return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,t.surveyId?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Save the block to track results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{isSecondary:!0,disabled:!t.surveyId,href:c,target:"blank"},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Title (optional)","crowdsignal-forms"),onChange:function(e){return n({title:e})},value:Object(k.decodeEntities)(t.title)}),r&&Object(a.createElement)(qe,{signalWarning:o})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Block styling","crowdsignal-forms"),initialOpen:!1,colorSettings:[{label:Object(l.__)("Background color","crowdsignal-forms"),onChange:i("backgroundColor"),value:t.backgroundColor},{label:Object(l.__)("Text color","crowdsignal-forms"),onChange:i("textColor"),value:t.textColor},{label:Object(l.__)("Button color","crowdsignal-forms"),onChange:i("buttonColor"),value:t.buttonColor},{label:Object(l.__)("Button text color","crowdsignal-forms"),onChange:i("buttonTextColor"),value:t.buttonTextColor}]}),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms"),initialOpen:!1},Object(a.createElement)(E.SelectControl,{value:t.status,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:Pn.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:Pn.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:Pn.CLOSED}],onChange:function(e){return n({status:e})},help:Pn.CLOSED_AFTER===t.status&&null!==t.closedAfterDateTime&&(new Date).toISOString()>t.closedAfterDateTime?"Currently closed as date has passed":""}),Pn.CLOSED_AFTER===t.status&&Object(a.createElement)(E.DateTimePicker,{currentDate:t.closedAfterDateTime&&new Date(t.closedAfterDateTime)||new Date,label:Object(l.__)("Close on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);n({closedAfterDateTime:t.toISOString()})},is12Hour:!0})))},Fn=function(e){var t=e.attributes,n=e.currentView,r=e.onViewChange,o=e.setAttributes,c=Object(_.useState)(!1),i=j()(c,2),s=i[0],u=i[1],d=function(e){return function(){return r(e)}};return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.ToolbarGroup,{label:Object(l.__)("Current view","crowdsignal-forms")},Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-nps__toolbar-toggle",isActive:n===Tn,label:Object(l.__)("Rating","crowdsignal-forms"),onClick:d(Tn)},Object(l.__)("Rating","crowdsignal-forms")),Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-nps__toolbar-toggle",isActive:n===In,label:Object(l.__)("Feedback","crowdsignal-forms"),onClick:d(In)},Object(l.__)("Feedback","crowdsignal-forms"))),Object(a.createElement)(E.ToolbarGroup,null,Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-nps__toolbar-popover-button",icon:"visibility",label:Object(l.__)("Set view threshold","crowdsignal-forms"),onClick:function(){return u(!0)}},s&&Object(a.createElement)(E.Popover,{onClose:function(){return u(!1)}},Object(a.createElement)("div",{className:"crowdsignal-forms-nps__toolbar-popover"},Object(a.createElement)(E.TextControl,{label:Object(l.__)("Show this block after __ visits:","crowdsignal-forms"),value:t.viewThreshold,onChange:function(e){return o({viewThreshold:e})},type:"number",min:"1"}))))))},Mn=function(e,t){return Object(b.mapKeys)({backgroundColor:e.backgroundColor||"#ffffff",buttonColor:e.buttonColor||t.accentColor,buttonTextColor:e.buttonTextColor||t.textColorInverted,textColor:e.textColor||t.textColor,textSize:t.textSize},(function(e,t){return"--crowdsignal-forms-".concat(Object(b.kebabCase)(t))}))},Hn=function(e){var t=e.retryHandler;return Object(a.createElement)(mt,{status:"error",icon:"warning",isDismissible:!1,actions:[{className:"is-destructive",label:Object(l.__)("Retry","crowdsignal-forms"),onClick:t}]},Object(l.__)("Unfortunately, the block couldn't be saved to Crowdsignal.com.","crowdsignal-forms"))},Vn=Object(x.compose)([Object(f.withSelect)((function(e){var t=e("core/editor").getPermalink();return t||(t=e("core").getSite()&&e("core").getSite().url),{sourceLink:t}})),Le])((function(e){var t=Object(_.useState)(Tn),n=j()(t,2),r=n[0],o=n[1],c=e.attributes,i=e.clientId,s=e.fallbackStyles,u=e.isSelected,m=e.setAttributes,p=e.renderStyleProbe,g=e.sourceLink,O=c.feedbackQuestion,v=c.ratingQuestion,h=c.surveyId,y=c.title,k=c.isExample,x=c.viewThreshold,S=An(function(){var e=D()(A.a.mark((function e(t){var n;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Object(f.dispatch)("core/editor").lockPostSaving(i),e.prev=1,e.next=4,Dn({feedbackQuestion:t.feedbackQuestion,ratingQuestion:t.ratingQuestion,sourceLink:t.sourceLink,surveyId:t.surveyId,title:t.title||t.ratingQuestion});case 4:n=e.sent,t.surveyId||m({surveyId:n.surveyId});case 6:return e.prev=6,Object(f.dispatch)("core/editor").unlockPostSaving(i),e.finish(6);case 9:case"end":return e.stop()}}),e,null,[[1,,6,9]])})));return function(t){return e.apply(this,arguments)}}(),{feedbackQuestion:O,ratingQuestion:v,sourceLink:g,surveyId:h,title:y}),I=S.error,P=S.save;Object(_.useEffect)((function(){k||c.surveyId||P()}),[]),Object(_.useEffect)((function(){u||o(Tn)}),[u]);var L=function(e){return function(t){return m(d()({},e,t))}},N=T()("crowdsignal-forms-nps",{"is-inactive":!k&&!u}),R=ie().accountInfo,B=Object(b.get)(R,"capabilities",[]).includes("hide-branding"),F=Object(b.get)(R,["signalCount","shouldDisplay"]),M=F&&Object(b.get)(R,["signalCount","count"])>=Object(b.get)(R,["signalCount","userLimit"]);return Object(a.createElement)(lt,{blockIcon:null,blockName:Object(l.__)("Crowdsignal NPS","crowdsignal-forms")},Object(a.createElement)(Fn,w()({currentView:r,onViewChange:o},e)),Object(a.createElement)(Bn,w()({shouldPromote:F,signalWarning:M},e)),!k&&M&&Object(a.createElement)(pt,null),!k&&I&&Object(a.createElement)(Hn,{retryHandler:P}),!k&&Object(a.createElement)(mt,{isDismissible:!1,icon:"visibility",componentActions:[Object(a.createElement)(Nn.PostPreviewButton,{key:1,className:["is-secondary","components-notice__action","crowdsignal-forms-nps__preview-button",c.surveyId?"":"is-disabled"],textContent:Object(l.__)("Preview","crowdsignal-forms")})]},Object(l.sprintf)(Object(l._n)("This block will appear as a popup window to people who have visited this page at least %d time.","This block will appear as a popup window to people who have visited this page at least %d times.",x,"crowdsignal-forms"),x)),(r===Tn||!u)&&Object(a.createElement)("div",{className:N,style:Mn(c,s)},Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-nps__question",placeholder:Object(l.__)("Enter your rating question","crowdsignal-forms"),onChange:L("ratingQuestion"),value:v,allowedFormats:[]}),Object(a.createElement)("div",{className:"crowdsignal-forms-nps__rating"},Object(a.createElement)("div",{className:"crowdsignal-forms-nps__rating-labels"},Object(a.createElement)(C.RichText,{tagName:"span",placeholder:Object(l.__)("Not likely","crowdsignal-forms"),onChange:L("lowRatingLabel"),value:c.lowRatingLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0}),Object(a.createElement)(C.RichText,{tagName:"span",placeholder:Object(l.__)("Very likely","crowdsignal-forms"),onChange:L("highRatingLabel"),value:c.highRatingLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0})),Object(a.createElement)("div",{className:"crowdsignal-forms-nps__rating-scale"},Object(b.times)(11,(function(e){return Object(a.createElement)("div",{key:"rating-".concat(e),className:"crowdsignal-forms-nps__rating-button"},e)}))),!B&&Object(a.createElement)(be,{trackRef:"cs-forms-nps",editing:!0,message:Object(l.__)("Collect your own feedback with Crowdsignal","crowdsignal-forms")}))),r===In&&u&&Object(a.createElement)("div",{className:N,style:Mn(c,s)},Object(a.createElement)("div",{className:"crowdsignal-forms-nps__feedback"},Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-nps__question",placeholder:Object(l.__)("Enter your feedback question","crowdsignal-forms"),onChange:L("feedbackQuestion"),value:O,allowedFormats:[]}),Object(a.createElement)(E.TextareaControl,{className:"crowdsignal-forms-nps__feedback-text",rows:6,onChange:L("feedbackPlaceholder"),value:c.feedbackPlaceholder}),Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-nps__feedback-button-wrapper"},Object(a.createElement)(C.RichText,{className:"wp-block-button__link crowdsignal-forms-nps__feedback-button",onChange:L("submitButtonLabel"),value:c.submitButtonLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0})),!B&&Object(a.createElement)(be,{trackRef:"cs-forms-nps",editing:!0,message:Object(l.__)("Collect your own feedback with Crowdsignal","crowdsignal-forms")}))),p())})),Wn={title:Object(l.__)("Measure NPS","crowdsignal-forms"),description:Object(l.__)("Calculate your Net Promoter Score! Collect feedback and track customer satisfaction over time. — powered by Crowdsignal.","crowdsignal-forms"),category:"crowdsignal-forms",attributes:Ln,supports:{multiple:!1,html:!1,reusable:!1},icon:Object(a.createElement)((function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{d:"M4.49707 15V10.3857H4.54102L7.83691 15H9.05762V7.9541H7.64648V12.5439H7.60742L4.31641 7.9541H3.08594V15H4.49707ZM9.73438 7.9541V15H11.209V12.7783H12.5273C14.0117 12.7783 15.042 11.8115 15.042 10.3662C15.042 8.91602 14.0459 7.9541 12.6006 7.9541H9.73438ZM11.209 9.12109H12.21C13.0547 9.12109 13.543 9.57031 13.543 10.3711C13.543 11.1768 13.0498 11.626 12.2051 11.626H11.209V9.12109ZM15.1523 12.9932C15.1963 14.3164 16.2754 15.1221 17.9697 15.1221C19.7178 15.1221 20.8262 14.2578 20.8262 12.8906C20.8262 11.8164 20.2109 11.2109 18.7998 10.9082L17.9453 10.7275C17.1348 10.542 16.793 10.2979 16.793 9.86328C16.793 9.34082 17.2812 8.99414 18.0088 8.99414C18.7461 8.99414 19.2686 9.35547 19.3174 9.95117H20.6992C20.6748 8.67676 19.6445 7.83203 18.0039 7.83203C16.4316 7.83203 15.3086 8.69141 15.3086 9.99023C15.3086 11.0205 15.9482 11.6797 17.2471 11.958L18.165 12.1582C19.0146 12.3486 19.3516 12.6025 19.3516 13.0615C19.3516 13.5791 18.8145 13.9551 18.0283 13.9551C17.2471 13.9551 16.6416 13.5742 16.5732 12.9932H15.1523Z"}))}),null),edit:Vn,keywords:[Object(l.__)("ask","crowdsignal-forms"),"crowdsignal",Object(l.__)("CSAT","crowdsignal-forms"),Object(l.__)("customer experience","crowdsignal-forms"),Object(l.__)("customer satisfaction","crowdsignal-forms"),Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("form","crowdsignal-forms"),Object(l.__)("loyalty","crowdsignal-forms"),Object(l.__)("net promoter score","crowdsignal-forms"),Object(l.__)("nps","crowdsignal-forms"),Object(l.__)("opinion","crowdsignal-forms"),Object(l.__)("poll","crowdsignal-forms"),Object(l.__)("promoter","crowdsignal-forms"),Object(l.__)("research","crowdsignal-forms"),Object(l.__)("rating","crowdsignal-forms"),Object(l.__)("review","crowdsignal-forms"),Object(l.__)("score","crowdsignal-forms"),Object(l.__)("survey","crowdsignal-forms")],example:{attributes:{isExample:!0,ratingQuestion:Object(l.__)("How satisfied are you with the content of the site?","crowdsignal-forms"),feedbackQuestion:Object(l.__)("Any advise on how we could improve your experience?","crowdsignal-forms"),lowRatingLabel:Object(l.__)("Not satisfied","crowdsignal-forms"),highRatingLabel:Object(l.__)("Very satisfied","crowdsignal-forms")}}},Un=function(){return Object(a.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5.25V17.6893L6.42678 16.2626C6.75497 15.9344 7.20008 15.75 7.66421 15.75H18.75C18.8881 15.75 19 15.6381 19 15.5V5.5C19 5.36193 18.8881 5.25 18.75 5.25H5ZM3.5 5C3.5 4.30965 4.05964 3.75 4.75 3.75H18.75C19.7165 3.75 20.5 4.5335 20.5 5.5V15.5C20.5 16.4665 19.7165 17.25 18.75 17.25H7.66421C7.59791 17.25 7.53432 17.2763 7.48744 17.3232L3.5 21.3107V5Z"}),Object(a.createElement)("rect",{x:"7",y:"9.75",width:"1.5",height:"1.5"}),Object(a.createElement)("rect",{x:"11.25",y:"9.75",width:"1.5",height:"1.5"}),Object(a.createElement)("rect",{x:"15.5",y:"9.75",width:"1.5",height:"1.5"}))},zn="question",qn="submit",Kn=Object.freeze({OPEN:"open",CLOSED:"closed",CLOSED_AFTER:"closed-after"}),Gn=Object.freeze({CLICK:"click",HOVER:"hover",PAGE_LOAD:"load"}),Zn={backgroundColor:{type:"string"},buttonColor:{type:"string"},buttonTextColor:{type:"string"},emailPlaceholder:{type:"string",default:Object(l.__)("Your Email","crowdsignal-forms")},emailRequired:{type:"boolean",default:!1},feedbackPlaceholder:{type:"string",default:Object(l.__)("Please let us know how we can do better…","crowdsignal-forms")},header:{type:"string",default:Object(l.__)("👋 Hey there!","crowdsignal-forms")},hideBranding:{type:"boolean",default:!1},hideTriggerShadow:{type:"boolean",default:!1},submitButtonLabel:{type:"string",default:Object(l.__)("Submit","crowdsignal-forms")},submitText:{type:"string",default:Object(l.__)("Thanks for letting us know!","crowdsignal-forms")},surveyId:{type:"number",default:null},textColor:{type:"string"},toggleOn:{type:"string",default:Gn.CLICK},triggerLabel:{type:"string",default:Object(l.__)("Feedback","crowdsignal-forms")},triggerBackgroundColor:{type:"string"},triggerTextColor:{type:"string"},title:{type:"string",default:""},x:{type:"string",default:"left"},y:{type:"string",default:"bottom"},status:{type:"string",default:Kn.OPEN},closedAfterDateTime:{type:"string",default:null},emailResponses:{type:"boolean",default:!0},isExample:{type:"boolean",default:!1},isWidget:{type:"boolean",default:!1}};function Yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yn(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Jn,Xn=function(e,t){return{left:e.left+t.x+window.scrollX,right:e.right+(window.innerWidth>t.left+t.width?window.innerWidth-t.left-t.width:0),top:e.top+t.y+window.scrollY,bottom:e.bottom+(window.innerHeight>t.top+t.height?window.innerHeight-t.top-t.height:0)}},$n=function(e,t,n){return{left:"left"===e?n.left:null,right:"right"===e?n.right:null}},er=function(e,t,n){return"center"===e?{top:(window.innerHeight-t)/2,bottom:null}:{top:"top"===e?n.top:null,bottom:"bottom"===e?n.bottom:null}},tr=function(e){var t=e.attributes,n=e.setAttributes,r=e.shouldPromote,o=e.signalWarning,c=e.email,i="https://app.crowdsignal.com/surveys/".concat(t.surveyId,"/report/overview"),s=function(e){return function(t){return n(d()({},e,t))}};return Object(a.createElement)(C.InspectorControls,null,Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Results","crowdsignal-forms"),initialOpen:!0},Object(a.createElement)("p",null,t.surveyId?Object(l.__)("Manage results on ","crowdsignal-forms"):Object(l.__)("Save the block to track results on ","crowdsignal-forms"),Object(a.createElement)(E.ExternalLink,{href:"https://www.crowdsignal.com"},"crowdsignal.com")),Object(a.createElement)("p",null,Object(a.createElement)(E.Button,{isSecondary:!0,disabled:!t.surveyId,href:i,target:"blank"},Object(l.__)("View results","crowdsignal-forms"))),Object(a.createElement)(E.TextControl,{label:Object(l.__)("Title (optional)","crowdsignal-forms"),onChange:function(e){return n({title:e})},value:Object(k.decodeEntities)(t.title)}),Object(a.createElement)(E.ToggleControl,{label:Object(l.__)("Send me responses via email","crowdsignal-forms"),checked:t.emailResponses,onChange:s("emailResponses"),help:t.emailResponses&&c&&Object(l.sprintf)(Object(l.__)("Responses will be sent to %s","crowdsignal-forms"),c)}),r&&Object(a.createElement)(qe,{signalWarning:o})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Feedback Button","crowdsignal-forms"),initialOpen:!1,colorSettings:[{label:Object(l.__)("Background color","crowdsignal-forms"),onChange:s("triggerBackgroundColor"),value:t.triggerBackgroundColor},{label:Object(l.__)("Text color","crowdsignal-forms"),onChange:s("triggerTextColor"),value:t.triggerTextColor}]},Object(a.createElement)(E.ToggleControl,{label:Object(l.__)("Hide Shadow","crowdsignal-forms"),checked:t.hideTriggerShadow,onChange:s("hideTriggerShadow")})),Object(a.createElement)(C.PanelColorSettings,{title:Object(l.__)("Block styling","crowdsignal-forms"),initialOpen:!1,colorSettings:[{label:Object(l.__)("Background color","crowdsignal-forms"),onChange:s("backgroundColor"),value:t.backgroundColor},{label:Object(l.__)("Text color","crowdsignal-forms"),onChange:s("textColor"),value:t.textColor},{label:Object(l.__)("Button color","crowdsignal-forms"),onChange:s("buttonColor"),value:t.buttonColor},{label:Object(l.__)("Button text color","crowdsignal-forms"),onChange:s("buttonTextColor"),value:t.buttonTextColor}]}),Object(a.createElement)(E.PanelBody,{title:Object(l.__)("Settings","crowdsignal-forms"),initialOpen:!1},Object(a.createElement)(E.SelectControl,{value:t.status,label:Object(l.__)("Status","crowdsignal-forms"),options:[{label:Object(l.__)("Open","crowdsignal-forms"),value:Kn.OPEN},{label:Object(l.__)("Closed after","crowdsignal-forms"),value:Kn.CLOSED_AFTER},{label:Object(l.__)("Closed","crowdsignal-forms"),value:Kn.CLOSED}],onChange:function(e){return n({status:e})},help:Kn.CLOSED_AFTER===t.status&&null!==t.closedAfterDateTime&&(new Date).toISOString()>t.closedAfterDateTime?"Currently closed as date has passed":""}),Kn.CLOSED_AFTER===t.status&&Object(a.createElement)(E.DateTimePicker,{currentDate:t.closedAfterDateTime&&new Date(t.closedAfterDateTime)||new Date,label:Object(l.__)("Close on","crowdsignal-forms"),onChange:function(e){var t=new Date(e);n({closedAfterDateTime:t.toISOString()})},is12Hour:!0}),Object(a.createElement)(E.SelectControl,{value:t.toggleOn,label:Object(l.__)("Show feedback form on:","crowdsignal-forms"),options:[{label:Object(l.__)("Click","crowdsignal-forms"),value:Gn.CLICK},{label:Object(l.__)("Hover","crowdsignal-forms"),value:Gn.HOVER},{label:Object(l.__)("Page load","crowdsignal-forms"),value:Gn.PAGE_LOAD}],onChange:s("toggleOn")}),Object(a.createElement)(E.ToggleControl,{label:Object(l.__)("Require email address","crowdsignal-forms"),checked:t.emailRequired,onChange:s("emailRequired")})))},nr=n(33);function rr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function or(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ar(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?or(Object(n),!0).forEach((function(t){rr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):or(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function lr(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ir(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return cr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cr(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function sr(e){return e?e.ownerDocument||e:document}try{Jn=window}catch(ba){}function ur(e){return e&&sr(e).defaultView||Jn}var dr,fr=(dr=ur(),Boolean(void 0!==dr&&dr.document&&dr.document.createElement)),br=fr?_.useLayoutEffect:_.useEffect;function mr(e){return Object(_.useState)(e)[0]}function pr(e){for(var t,n=[[]],r=function(){var e=t.value,r=n.find((function(t){return!t[0]||t[0].groupId===e.groupId}));r?r.push(e):n.push([e])},o=ir(e);!(t=o()).done;)r();return n}function gr(e){for(var t,n=[],r=ir(e);!(t=r()).done;){var o=t.value;n.push.apply(n,o)}return n}function Or(e){return e.slice().reverse()}function vr(e,t){return t?e.find((function(e){return!e.disabled&&e.id!==t})):e.find((function(e){return!e.disabled}))}function wr(e,t){var n;return t||null===t?t:e.currentId||null===e.currentId?e.currentId:null===(n=vr(e.items||[]))||void 0===n?void 0:n.id}function hr(e,t){if(t)return null==e?void 0:e.find((function(e){return e.id===t&&!e.disabled}))}function jr(e,t){return function(e){return"function"==typeof e}(e)?e(t):e}function _r(e){return void 0===e&&(e="id"),(e?e+"-":"")+Math.random().toString(32).substr(2,6)}var yr=Object(_.createContext)(_r);function Cr(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Er(e,t){return e.findIndex((function(e){return!(!e.ref.current||!t.ref.current)&&Cr(t.ref.current,e.ref.current)}))}function kr(e){for(var t,n=0,r=ir(e);!(t=r()).done;){var o=t.value.length;o>n&&(n=o)}return n}function xr(e){for(var t=pr(e),n=kr(t),r=[],o=0;o<n;o+=1)for(var a,l=ir(t);!(a=l()).done;){var c=a.value;c[o]&&r.push(ar(ar({},c[o]),{},{groupId:c[o].groupId?""+o:void 0}))}return r}function Sr(e,t,n){for(var r,o=kr(e),a=ir(e);!(r=a()).done;)for(var l=r.value,c=0;c<o;c+=1){var i=l[c];if(!i||n&&i.disabled){var s=0===c&&n?vr(l):l[c-1];l[c]=s&&t!==(null==s?void 0:s.id)&&n?s:{id:"__EMPTY_ITEM__",disabled:!0,ref:{current:null},groupId:null==s?void 0:s.groupId}}}return e}var Tr={id:null,ref:{current:null}};function Ir(e,t){return e.filter((function(e){return e.groupId===t}))}var Pr={horizontal:"vertical",vertical:"horizontal"};function Lr(e,t,n){return n in e?[].concat(e.slice(0,n),[t],e.slice(n)):[].concat(e,[t])}function Nr(e){var t=e.map((function(e,t){return[t,e]})),n=!1;return t.sort((function(e,t){var r=e[0],o=e[1],a=t[0],l=t[1],c=o.ref.current,i=l.ref.current;return c&&i?Cr(c,i)?(r>a&&(n=!0),-1):(r<a&&(n=!0),1):0})),n?t.map((function(e){e[0];return e[1]})):e}function Ar(e,t){var n=Nr(e);e!==n&&t(n)}function Rr(e,t){var n=Object(_.useRef)([]);Object(_.useEffect)((function(){for(var r,o=function(e){for(var t,n=e[0],r=e.slice(1),o=null==n||null===(t=n.ref.current)||void 0===t?void 0:t.parentElement,a=function(){var e=o;if(r.every((function(t){return e.contains(t.ref.current)})))return{v:o};o=o.parentElement};o;){var l=a();if("object"==typeof l)return l.v}return sr(o).body}(e),a=new IntersectionObserver((function(){!!n.current.length&&Ar(e,t),n.current=e}),{root:o}),l=ir(e);!(r=l()).done;){var c=r.value;c.ref.current&&a.observe(c.ref.current)}return function(){a.disconnect()}}),[e])}function Dr(e,t){"function"==typeof IntersectionObserver?Rr(e,t):function(e,t){Object(_.useEffect)((function(){var n=setTimeout((function(){return Ar(e,t)}),250);return function(){return clearTimeout(n)}}))}(e,t)}function Br(e,t){var n=e.unstable_virtual,r=e.rtl,o=e.orientation,a=e.items,l=e.groups,c=e.currentId,i=e.loop,s=e.wrap,u=e.pastIds,d=e.shift,f=e.unstable_moves,b=e.unstable_includesBaseElement,m=e.initialVirtual,p=e.initialRTL,g=e.initialOrientation,O=e.initialCurrentId,v=e.initialLoop,w=e.initialWrap,h=e.initialShift,j=e.hasSetCurrentId;switch(t.type){case"registerGroup":var _=t.group;if(0===l.length)return ar(ar({},e),{},{groups:[_]});var y=Er(l,_);return ar(ar({},e),{},{groups:Lr(l,_,y)});case"unregisterGroup":var C=t.id,E=l.filter((function(e){return e.id!==C}));return E.length===l.length?e:ar(ar({},e),{},{groups:E});case"registerItem":var k,x=t.item,S=l.find((function(e){var t;return null===(t=e.ref.current)||void 0===t?void 0:t.contains(x.ref.current)})),T=ar({groupId:null==S?void 0:S.id},x),I=Er(a,T),P=ar(ar({},e),{},{items:Lr(a,T,I)});return j||f||void 0!==O?P:ar(ar({},P),{},{currentId:null===(k=vr(P.items))||void 0===k?void 0:k.id});case"unregisterItem":var L=t.id,N=a.filter((function(e){return e.id!==L}));if(N.length===a.length)return e;var A=u.filter((function(e){return e!==L})),R=ar(ar({},e),{},{pastIds:A,items:N});if(c&&c===L){var D=b?null:wr(ar(ar({},R),{},{currentId:A[0]}));return ar(ar({},R),{},{currentId:D})}return R;case"move":var B=t.id;if(void 0===B)return e;var F=u.filter((function(e){return e!==c&&e!==B})),M=c?[c].concat(F):F,H=ar(ar({},e),{},{pastIds:M});if(null===B)return ar(ar({},H),{},{unstable_moves:f+1,currentId:wr(H,B)});var V=hr(a,B);return ar(ar({},H),{},{unstable_moves:V?f+1:f,currentId:wr(H,null==V?void 0:V.id)});case"next":if(null==c)return Br(e,ar(ar({},t),{},{type:"first"}));var W=r&&"vertical"!==o,U=W?Or(a):a,z=U.find((function(e){return e.id===c}));if(!z)return Br(e,ar(ar({},t),{},{type:"first"}));var q=!!z.groupId,K=U.indexOf(z),G=U.slice(K+1),Z=Ir(G,z.groupId);if(t.allTheWay){var Y=vr(W?Ir(U,z.groupId):Or(Z));return Br(e,ar(ar({},t),{},{type:"move",id:null==Y?void 0:Y.id}))}var Q=function(e){return e&&Pr[e]}(q?o||"horizontal":o),J=i&&i!==Q,X=q&&s&&s!==Q,$=t.hasNullItem||!q&&J&&b;if(J){var ee=vr(function(e,t,n){var r=e.findIndex((function(e){return e.id===t}));return[].concat(e.slice(r+1),n?[Tr]:[],e.slice(0,r))}(X&&!$?U:Ir(U,z.groupId),c,$),c);return Br(e,ar(ar({},t),{},{type:"move",id:null==ee?void 0:ee.id}))}if(X){var te=vr($?Z:G,c),ne=$?(null==te?void 0:te.id)||null:null==te?void 0:te.id;return Br(e,ar(ar({},t),{},{type:"move",id:ne}))}var re=vr(Z,c);return Br(e,!re&&$?ar(ar({},t),{},{type:"move",id:null}):ar(ar({},t),{},{type:"move",id:null==re?void 0:re.id}));case"previous":var oe=!!!l.length&&b,ae=Br(ar(ar({},e),{},{items:Or(a)}),ar(ar({},t),{},{type:"next",hasNullItem:oe}));return ar(ar({},ae),{},{items:a});case"down":var le=d&&!t.allTheWay,ce=xr(gr(Sr(pr(a),c,le))),ie=i&&"horizontal"!==i&&b,se=Br(ar(ar({},e),{},{orientation:"vertical",items:ce}),ar(ar({},t),{},{type:"next",hasNullItem:ie}));return ar(ar({},se),{},{orientation:o,items:a});case"up":var ue=d&&!t.allTheWay,de=xr(Or(gr(Sr(pr(a),c,ue)))),fe=b,be=Br(ar(ar({},e),{},{orientation:"vertical",items:de}),ar(ar({},t),{},{type:"next",hasNullItem:fe}));return ar(ar({},be),{},{orientation:o,items:a});case"first":var me=vr(a);return Br(e,ar(ar({},t),{},{type:"move",id:null==me?void 0:me.id}));case"last":var pe=Br(ar(ar({},e),{},{items:Or(a)}),ar(ar({},t),{},{type:"first"}));return ar(ar({},pe),{},{items:a});case"sort":return ar(ar({},e),{},{items:Nr(a),groups:Nr(l)});case"setVirtual":return ar(ar({},e),{},{unstable_virtual:jr(t.virtual,n)});case"setRTL":return ar(ar({},e),{},{rtl:jr(t.rtl,r)});case"setOrientation":return ar(ar({},e),{},{orientation:jr(t.orientation,o)});case"setCurrentId":var ge=wr(ar(ar({},e),{},{currentId:jr(t.currentId,c)}));return ar(ar({},e),{},{currentId:ge,hasSetCurrentId:!0});case"setLoop":return ar(ar({},e),{},{loop:jr(t.loop,i)});case"setWrap":return ar(ar({},e),{},{wrap:jr(t.wrap,s)});case"setShift":return ar(ar({},e),{},{shift:jr(t.shift,d)});case"setIncludesBaseElement":return ar(ar({},e),{},{unstable_includesBaseElement:jr(t.includesBaseElement,b)});case"reset":return ar(ar({},e),{},{unstable_virtual:m,rtl:p,orientation:g,currentId:wr(ar(ar({},e),{},{currentId:O})),loop:v,wrap:w,shift:h,unstable_moves:0,pastIds:[]});case"setItems":return ar(ar({},e),{},{items:t.items});default:throw new Error}}function Fr(e){return Object(_.useCallback)(e,[])}function Mr(e){void 0===e&&(e={});var t=mr(e),n=t.unstable_virtual,r=void 0!==n&&n,o=t.rtl,a=void 0!==o&&o,l=t.orientation,c=t.currentId,i=t.loop,s=void 0!==i&&i,u=t.wrap,d=void 0!==u&&u,f=t.shift,b=void 0!==f&&f,m=t.unstable_includesBaseElement,p=function(e){void 0===e&&(e={});var t=mr(e).baseId,n=Object(_.useContext)(yr),r=Object(_.useRef)(0),o=Object(_.useState)((function(){return t||n()}));return{baseId:o[0],setBaseId:o[1],unstable_idCountRef:r}}(lr(t,["unstable_virtual","rtl","orientation","currentId","loop","wrap","shift","unstable_includesBaseElement"])),g=Object(_.useReducer)(Br,{unstable_virtual:r,rtl:a,orientation:l,items:[],groups:[],currentId:c,loop:s,wrap:d,shift:b,unstable_moves:0,pastIds:[],unstable_includesBaseElement:null!=m?m:null===c,initialVirtual:r,initialRTL:a,initialOrientation:l,initialCurrentId:c,initialLoop:s,initialWrap:d,initialShift:b}),O=g[0],v=(O.pastIds,O.initialVirtual,O.initialRTL,O.initialOrientation,O.initialCurrentId,O.initialLoop,O.initialWrap,O.initialShift,O.hasSetCurrentId,lr(O,["pastIds","initialVirtual","initialRTL","initialOrientation","initialCurrentId","initialLoop","initialWrap","initialShift","hasSetCurrentId"])),w=g[1],h=Object(_.useState)(!1),j=h[0],y=h[1],C=function(){var e=Object(_.useRef)(!1);return br((function(){return function(){e.current=!0}}),[]),e}(),E=Object(_.useCallback)((function(e){return w({type:"setItems",items:e})}),[]);return Dr(v.items,E),ar(ar(ar({},p),v),{},{unstable_hasActiveWidget:j,unstable_setHasActiveWidget:y,registerItem:Fr((function(e){C.current||w({type:"registerItem",item:e})})),unregisterItem:Fr((function(e){C.current||w({type:"unregisterItem",id:e})})),registerGroup:Fr((function(e){C.current||w({type:"registerGroup",group:e})})),unregisterGroup:Fr((function(e){C.current||w({type:"unregisterGroup",id:e})})),move:Fr((function(e){return w({type:"move",id:e})})),next:Fr((function(e){return w({type:"next",allTheWay:e})})),previous:Fr((function(e){return w({type:"previous",allTheWay:e})})),up:Fr((function(e){return w({type:"up",allTheWay:e})})),down:Fr((function(e){return w({type:"down",allTheWay:e})})),first:Fr((function(){return w({type:"first"})})),last:Fr((function(){return w({type:"last"})})),sort:Fr((function(){return w({type:"sort"})})),unstable_setVirtual:Fr((function(e){return w({type:"setVirtual",virtual:e})})),setRTL:Fr((function(e){return w({type:"setRTL",rtl:e})})),setOrientation:Fr((function(e){return w({type:"setOrientation",orientation:e})})),setCurrentId:Fr((function(e){return w({type:"setCurrentId",currentId:e})})),setLoop:Fr((function(e){return w({type:"setLoop",loop:e})})),setWrap:Fr((function(e){return w({type:"setWrap",wrap:e})})),setShift:Fr((function(e){return w({type:"setShift",shift:e})})),unstable_setIncludesBaseElement:Fr((function(e){return w({type:"setIncludesBaseElement",includesBaseElement:e})})),reset:Fr((function(){return w({type:"reset"})}))})}function Hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Wr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vr(Object(n),!0).forEach((function(t){Hr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ur(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function zr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qr(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return zr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zr(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var Kr=Object(_.createContext)({});var Gr=function(e,t,n){void 0===n&&(n=t.children);var r=Object(_.useContext)(Kr);if(r.useCreateElement)return r.useCreateElement(e,t,n);if("string"==typeof e&&function(e){return"function"==typeof e}(n)){t.children;return n(Ur(t,["children"]))}return Object(_.createElement)(e,t,n)};function Zr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yr(Object(n),!0).forEach((function(t){Zr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Jr(e){return"object"==typeof e&&null!=e}function Xr(e){var t;if(!Jr(e))return!1;var n=Object.getPrototypeOf(e);return null==n||(null===(t=n.constructor)||void 0===t?void 0:t.toString())===Object.toString()}function $r(e,t){for(var n={},r={},o=0,a=Object.keys(e);o<a.length;o++){var l=a[o];t.indexOf(l)>=0?n[l]=e[l]:r[l]=e[l]}return[n,r]}function eo(e,t){if(void 0===t&&(t=[]),!Xr(e.state))return $r(e,t);var n=$r(e,[].concat(t,["state"])),r=n[0],o=n[1],a=r.state,l=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(r,["state"]);return[Qr(Qr({},a),l),o]}function to(e,t){if(e===t)return!0;if(!e)return!1;if(!t)return!1;if("object"!=typeof e)return!1;if("object"!=typeof t)return!1;var n=Object.keys(e),r=Object.keys(t),o=n.length;if(r.length!==o)return!1;for(var a=0,l=n;a<l.length;a++){var c=l[a];if(e[c]!==t[c])return!1}return!0}function no(e){return"normalizePropsAreEqualInner"===e.name?e:function(t,n){return Xr(t.state)&&Xr(n.state)?e(Qr(Qr({},t.state),t),Qr(Qr({},n.state),n)):e(t,n)}}function ro(e){var t,n=e.as,r=e.useHook,o=e.memo,a=e.propsAreEqual,l=void 0===a?null==r?void 0:r.unstable_propsAreEqual:a,c=e.keys,i=void 0===c?(null==r?void 0:r.__keys)||[]:c,s=e.useCreateElement,u=void 0===s?Gr:s,d=function(e,t){var o=e.as,a=void 0===o?n:o,l=Ur(e,["as"]);if(r){var c,s=eo(l,i),d=s[0],f=s[1],b=r(d,Wr({ref:t},f)),m=b.wrapElement,p=Ur(b,["wrapElement"]),g=(null===(c=a.render)||void 0===c?void 0:c.__keys)||a.__keys,O=g&&eo(l,g)[0],v=O?Wr(Wr({},p),O):p,w=u(a,v);return m?m(w):w}return u(a,Wr({ref:t},l))};return t=d,d=Object(_.forwardRef)(t),o&&(d=function(e,t){return Object(_.memo)(e,t)}(d,l&&no(l))),d.__keys=i,d.unstable_propsAreEqual=no(l||to),d}function oo(e,t){Object(_.useDebugValue)(e);var n=Object(_.useContext)(Kr);return null!=n[e]?n[e]:t}function ao(e){var t,n,r,o=(r=e.compose,Array.isArray(r)?r:void 0!==r?[r]:[]),a=function(t,n){if(e.useOptions&&(t=e.useOptions(t,n)),e.name&&(t=function(e,t,n){void 0===t&&(t={}),void 0===n&&(n={});var r="use"+e+"Options";Object(_.useDebugValue)(r);var o=oo(r);return o?Wr(Wr({},t),o(t,n)):t}(e.name,t,n)),e.compose)for(var r,a=qr(o);!(r=a()).done;){t=r.value.__useOptions(t,n)}return t},l=function(t,n,r){if(void 0===t&&(t={}),void 0===n&&(n={}),void 0===r&&(r=!1),r||(t=a(t,n)),e.useProps&&(n=e.useProps(t,n)),e.name&&(n=function(e,t,n){void 0===t&&(t={}),void 0===n&&(n={});var r="use"+e+"Props";Object(_.useDebugValue)(r);var o=oo(r);return o?o(t,n):n}(e.name,t,n)),e.compose)if(e.useComposeOptions&&(t=e.useComposeOptions(t,n)),e.useComposeProps)n=e.useComposeProps(t,n);else for(var l,c=qr(o);!(l=c()).done;){n=(0,l.value)(t,n,!0)}var i={},s=n||{};for(var u in s)void 0!==s[u]&&(i[u]=s[u]);return i};l.__useOptions=a;var c=o.reduce((function(e,t){return e.push.apply(e,t.__keys||[]),e}),[]);return l.__keys=[].concat(c,(null===(t=e.useState)||void 0===t?void 0:t.__keys)||[],e.keys||[]),l.unstable_propsAreEqual=e.propsAreEqual||(null===(n=o[0])||void 0===n?void 0:n.unstable_propsAreEqual)||to,l}function lo(e,t){void 0===t&&(t=null),e&&("function"==typeof e?e(t):e.current=t)}function co(e,t){return Object(_.useMemo)((function(){return null==e&&null==t?null:function(n){lo(e,n),lo(t,n)}}),[e,t])}function io(e){var t=Object(_.useRef)(e);return br((function(){t.current=e})),t}function so(e){return e.target===e.currentTarget}var uo=ao({name:"Role",keys:["unstable_system"],propsAreEqual:function(e,t){var n=e.unstable_system,r=lr(e,["unstable_system"]),o=t.unstable_system,a=lr(t,["unstable_system"]);return!(n!==o&&!to(n,o))&&to(r,a)}}),fo=(ro({as:"div",useHook:uo}),["button","color","file","image","reset","submit"]);function bo(e){if("BUTTON"===e.tagName)return!0;if("INPUT"===e.tagName){var t=e;return-1!==fo.indexOf(t.type)}return!1}function mo(e){var t=sr(e).activeElement;return null!=t&&t.nodeName?t:null}function po(e,t){return e===t||e.contains(t)}function go(e){var t=mo(e);if(!t)return!1;if(po(e,t))return!0;var n=t.getAttribute("aria-activedescendant");return!!n&&(n===e.id||!!e.querySelector("#"+n))}function Oo(e){return!po(e.currentTarget,e.target)}function vo(e){return!!fr&&-1!==window.navigator.userAgent.indexOf(e)}function wo(e,t){return"matches"in e?e.matches(t):"msMatchesSelector"in e?e.msMatchesSelector(t):e.webkitMatchesSelector(t)}var ho="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function jo(e){return wo(e,ho)&&function(e){var t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)}var _o=vo("Mac")&&!vo("Chrome")&&(vo("Safari")||vo("Firefox"));function yo(e){!go(e)&&jo(e)&&e.focus()}function Co(e,t,n,r){return e?t&&!n?-1:void 0:t?r:r||0}function Eo(e,t){return Object(_.useCallback)((function(n){var r;null===(r=e.current)||void 0===r||r.call(e,n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())}),[e,t])}var ko=ao({name:"Tabbable",compose:uo,keys:["disabled","focusable"],useOptions:function(e,t){return ar({disabled:t.disabled},e)},useProps:function(e,t){var n=t.ref,r=t.tabIndex,o=t.onClickCapture,a=t.onMouseDownCapture,l=t.onMouseDown,c=t.onKeyPressCapture,i=t.style,s=lr(t,["ref","tabIndex","onClickCapture","onMouseDownCapture","onMouseDown","onKeyPressCapture","style"]),u=Object(_.useRef)(null),d=io(o),f=io(a),b=io(l),m=io(c),p=!!e.disabled&&!e.focusable,g=Object(_.useState)(!0),O=g[0],v=g[1],w=Object(_.useState)(!0),h=w[0],j=w[1],y=e.disabled?ar({pointerEvents:"none"},i):i;br((function(){var e,t=u.current;t&&("BUTTON"!==(e=t).tagName&&"INPUT"!==e.tagName&&"SELECT"!==e.tagName&&"TEXTAREA"!==e.tagName&&"A"!==e.tagName&&v(!1),function(e){return"BUTTON"===e.tagName||"INPUT"===e.tagName||"SELECT"===e.tagName||"TEXTAREA"===e.tagName}(t)||j(!1))}),[]);var C=Eo(d,e.disabled),E=Eo(f,e.disabled),k=Eo(m,e.disabled),x=Object(_.useCallback)((function(e){var t;null===(t=b.current)||void 0===t||t.call(b,e);var n=e.currentTarget;if(!e.defaultPrevented&&_o&&!Oo(e)&&bo(n)){var r=requestAnimationFrame((function(){n.removeEventListener("mouseup",o,!0),yo(n)})),o=function(){cancelAnimationFrame(r),yo(n)};n.addEventListener("mouseup",o,{once:!0,capture:!0})}}),[]);return ar({ref:co(u,n),style:y,tabIndex:Co(p,O,h,r),disabled:!(!p||!h)||void 0,"aria-disabled":!!e.disabled||void 0,onClickCapture:C,onMouseDownCapture:E,onMouseDown:x,onKeyPressCapture:k},s)}});ro({as:"div",useHook:ko});function xo(e,t,n){if("function"==typeof Event)return new Event(t,n);var r=sr(e).createEvent("Event");return r.initEvent(t,null==n?void 0:n.bubbles,null==n?void 0:n.cancelable),r}function So(e,t,n){return void 0===n&&(n={}),"function"==typeof FocusEvent?new FocusEvent(t,n):xo(e,t,n)}function To(e,t){var n=So(e,"blur",t),r=e.dispatchEvent(n),o=Qr(Qr({},t),{},{bubbles:!0});return e.dispatchEvent(So(e,"focusout",o)),r}function Io(e,t,n){return e.dispatchEvent(function(e,t,n){if(void 0===n&&(n={}),"function"==typeof KeyboardEvent)return new KeyboardEvent(t,n);var r=sr(e).createEvent("KeyboardEvent");return r.initKeyboardEvent(t,n.bubbles,n.cancelable,ur(e),n.key,n.location,n.ctrlKey,n.altKey,n.shiftKey,n.metaKey),r}(e,t,n))}var Po=fr&&"msCrypto"in window;var Lo=["baseId","unstable_idCountRef","setBaseId","unstable_virtual","rtl","orientation","items","groups","currentId","loop","wrap","shift","unstable_moves","unstable_hasActiveWidget","unstable_includesBaseElement","registerItem","unregisterItem","registerGroup","unregisterGroup","move","next","previous","up","down","first","last","sort","unstable_setVirtual","setRTL","setOrientation","setCurrentId","setLoop","setWrap","setShift","reset","unstable_setIncludesBaseElement","unstable_setHasActiveWidget"],No=Lo,Ao=No;function Ro(e){e.userFocus=!0,e.focus(),e.userFocus=!1}function Do(e,t){e.userFocus=t}var Bo=fr&&"msCrypto"in window;function Fo(e,t,n){var r=io(n);return Object(_.useCallback)((function(n){var o;if(null===(o=r.current)||void 0===o||o.call(r,n),!n.defaultPrevented&&e&&function(e){return!!so(e)&&(!e.metaKey&&"Tab"!==e.key)}(n)){var a=null==t?void 0:t.ref.current;a&&(Io(a,n.type,n)||n.preventDefault(),n.currentTarget.contains(a)&&n.stopPropagation())}}),[e,t])}function Mo(e,t){return null==e?void 0:e.some((function(e){return!!t&&e.ref.current===t}))}var Ho=ro({as:"div",useHook:ao({name:"Composite",compose:[ko],keys:Lo,useOptions:function(e){return ar(ar({},e),{},{currentId:wr(e)})},useProps:function(e,t){var n=t.ref,r=t.onFocusCapture,o=t.onFocus,a=t.onBlurCapture,l=t.onKeyDown,c=t.onKeyDownCapture,i=t.onKeyUpCapture,s=lr(t,["ref","onFocusCapture","onFocus","onBlurCapture","onKeyDown","onKeyDownCapture","onKeyUpCapture"]),u=Object(_.useRef)(null),d=hr(e.items,e.currentId),f=Object(_.useRef)(null),b=io(r),m=io(o),p=io(a),g=io(l),O=function(e){var t=io(e),n=Object(_.useReducer)((function(e){return e+1}),0),r=n[0],o=n[1];return Object(_.useEffect)((function(){var e,n=null===(e=t.current)||void 0===e?void 0:e.ref.current;r&&n&&Ro(n)}),[r]),o}(d),v=Bo?function(e){var t=Object(_.useRef)(null);return Object(_.useEffect)((function(){var n=sr(e.current),r=function(e){var n=e.target;t.current=n};return n.addEventListener("focus",r,!0),function(){n.removeEventListener("focus",r,!0)}}),[]),t}(u):void 0;Object(_.useEffect)((function(){var t=u.current;e.unstable_moves&&!d&&(null==t||t.focus())}),[e.unstable_moves,d]);var w=Fo(e.unstable_virtual,d,c),h=Fo(e.unstable_virtual,d,i),j=Object(_.useCallback)((function(t){var n;if(null===(n=b.current)||void 0===n||n.call(b,t),!t.defaultPrevented&&e.unstable_virtual){var r=(null==v?void 0:v.current)||t.relatedTarget,o=Mo(e.items,r);so(t)&&o&&(t.stopPropagation(),f.current=r)}}),[e.unstable_virtual,e.items]),y=Object(_.useCallback)((function(t){var n;if(null===(n=m.current)||void 0===n||n.call(m,t),!t.defaultPrevented)if(e.unstable_virtual)so(t)&&O();else if(so(t)){var r;null===(r=e.setCurrentId)||void 0===r||r.call(e,null)}}),[e.unstable_virtual,e.setCurrentId]),C=Object(_.useCallback)((function(t){var n;if(null===(n=p.current)||void 0===n||n.call(p,t),!t.defaultPrevented&&e.unstable_virtual){var r=(null==d?void 0:d.ref.current)||null,o=function(e){return Po?mo(e.currentTarget):e.relatedTarget}(t),a=Mo(e.items,o);if(so(t)&&a)o===r?f.current&&f.current!==o&&To(f.current,t):r&&To(r,t),t.stopPropagation();else!Mo(e.items,t.target)&&r&&To(r,t)}}),[e.unstable_virtual,e.items,d]),E=Object(_.useCallback)((function(t){var n,r;if(null===(n=g.current)||void 0===n||n.call(g,t),!t.defaultPrevented&&null===e.currentId&&so(t)){var o="horizontal"!==e.orientation,a="vertical"!==e.orientation,l=!(null===(r=e.groups)||void 0===r||!r.length),c={ArrowUp:(l||o)&&function(){if(l){var t,n=vr(gr(Or(pr(e.items))));if(null!=n&&n.id)null===(t=e.move)||void 0===t||t.call(e,n.id)}else{var r;null===(r=e.last)||void 0===r||r.call(e)}},ArrowRight:(l||a)&&e.first,ArrowDown:(l||o)&&e.first,ArrowLeft:(l||a)&&e.last,Home:e.first,End:e.last,PageUp:e.first,PageDown:e.last}[t.key];c&&(t.preventDefault(),c())}}),[e.currentId,e.orientation,e.groups,e.items,e.move,e.last,e.first]);return ar({ref:co(u,n),id:e.baseId,onFocus:y,onFocusCapture:j,onBlurCapture:C,onKeyDownCapture:w,onKeyDown:E,onKeyUpCapture:h,"aria-activedescendant":e.unstable_virtual&&(null==d?void 0:d.id)||void 0},s)},useComposeProps:function(e,t){t=uo(e,t,!0);var n=ko(e,t,!0);return e.unstable_virtual||null===e.currentId?ar({tabIndex:0},n):ar(ar({},t),{},{ref:n.ref})}}),useCreateElement:function(e,t,n){return Gr(e,t,n)}}),Vo=ao({keys:[].concat(["baseId","unstable_idCountRef","setBaseId"],["id"]),useOptions:function(e,t){var n=Object(_.useContext)(yr),r=Object(_.useState)((function(){return e.unstable_idCountRef?(e.unstable_idCountRef.current+=1,"-"+e.unstable_idCountRef.current):e.baseId?"-"+n(""):""}))[0],o=Object(_.useMemo)((function(){return e.baseId||n()}),[e.baseId,n]),a=t.id||e.id||""+o+r;return ar(ar({},e),{},{id:a})},useProps:function(e,t){return ar({id:e.id},t)}}),Wo=(ro({as:"div",useHook:Vo}),ao({name:"Group",compose:uo,keys:[],useProps:function(e,t){return ar({role:"group"},t)}})),Uo=(ro({as:"div",useHook:Wo}),ro({as:"div",useHook:ao({name:"CompositeGroup",compose:[Wo,Vo],keys:No,propsAreEqual:function(e,t){if(!t.id||e.id!==t.id)return Wo.unstable_propsAreEqual(e,t);var n=e.currentId,r=(e.unstable_moves,lr(e,["currentId","unstable_moves"])),o=t.currentId,a=(t.unstable_moves,lr(t,["currentId","unstable_moves"]));if(e.items&&t.items){var l=hr(e.items,n),c=hr(t.items,o),i=null==l?void 0:l.groupId,s=null==c?void 0:c.groupId;if(t.id===s||t.id===i)return!1}return Wo.unstable_propsAreEqual(r,a)},useProps:function(e,t){var n=t.ref,r=lr(t,["ref"]),o=Object(_.useRef)(null),a=e.id;return br((function(){var t;if(a)return null===(t=e.registerGroup)||void 0===t||t.call(e,{id:a,ref:o}),function(){var t;null===(t=e.unregisterGroup)||void 0===t||t.call(e,a)}}),[a,e.registerGroup,e.unregisterGroup]),ar({ref:co(o,n)},r)}})}));var zo=ao({name:"Clickable",compose:ko,keys:["unstable_clickOnEnter","unstable_clickOnSpace"],useOptions:function(e){var t=e.unstable_clickOnEnter,n=void 0===t||t,r=e.unstable_clickOnSpace;return ar({unstable_clickOnEnter:n,unstable_clickOnSpace:void 0===r||r},lr(e,["unstable_clickOnEnter","unstable_clickOnSpace"]))},useProps:function(e,t){var n=t.onKeyDown,r=t.onKeyUp,o=lr(t,["onKeyDown","onKeyUp"]),a=Object(_.useState)(!1),l=a[0],c=a[1],i=io(n),s=io(r),u=Object(_.useCallback)((function(t){var n;if(null===(n=i.current)||void 0===n||n.call(i,t),!t.defaultPrevented&&!e.disabled&&!t.metaKey&&so(t)){var r=e.unstable_clickOnEnter&&"Enter"===t.key,o=e.unstable_clickOnSpace&&" "===t.key;if(r||o){if(function(e){var t=e.currentTarget;return!!e.isTrusted&&(bo(t)||"INPUT"===t.tagName||"TEXTAREA"===t.tagName||"A"===t.tagName||"SELECT"===t.tagName)}(t))return;t.preventDefault(),r?t.currentTarget.click():o&&c(!0)}}}),[e.disabled,e.unstable_clickOnEnter,e.unstable_clickOnSpace]),d=Object(_.useCallback)((function(t){var n;if(null===(n=s.current)||void 0===n||n.call(s,t),!t.defaultPrevented&&!e.disabled&&!t.metaKey){var r=e.unstable_clickOnSpace&&" "===t.key;l&&r&&(c(!1),t.currentTarget.click())}}),[e.disabled,e.unstable_clickOnSpace,l]);return ar({"data-active":l||void 0,onKeyDown:u,onKeyUp:d},o)}});ro({as:"button",memo:!0,useHook:zo});function qo(e){try{var t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName,r="true"===e.contentEditable;return t||n||r||!1}catch(o){return!1}}function Ko(e){var t=mo(e);if(!t)return!1;if(t===e)return!0;var n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function Go(e,t){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){var n,r=Object.getPrototypeOf(e),o=null===(n=Object.getOwnPropertyDescriptor(r,"value"))||void 0===n?void 0:n.set;o&&(o.call(e,t),function(e,t,n){e.dispatchEvent(xo(e,t,n))}(e,"input",{bubbles:!0}))}}function Zo(e){return e.querySelector("[data-composite-item-widget]")}var Yo=ro({as:"button",memo:!0,useHook:ao({name:"CompositeItem",compose:[zo,Vo],keys:Ao,propsAreEqual:function(e,t){if(!t.id||e.id!==t.id)return zo.unstable_propsAreEqual(e,t);var n=e.currentId,r=e.unstable_moves,o=lr(e,["currentId","unstable_moves"]),a=t.currentId,l=t.unstable_moves,c=lr(t,["currentId","unstable_moves"]);if(a!==n){if(t.id===a||t.id===n)return!1}else if(r!==l)return!1;return zo.unstable_propsAreEqual(o,c)},useOptions:function(e){return ar(ar({},e),{},{id:e.id,currentId:wr(e),unstable_clickOnSpace:!e.unstable_hasActiveWidget&&e.unstable_clickOnSpace})},useProps:function(e,t){var n,r=t.ref,o=t.tabIndex,a=void 0===o?0:o,l=t.onMouseDown,c=t.onFocus,i=t.onBlurCapture,s=t.onKeyDown,u=t.onClick,d=lr(t,["ref","tabIndex","onMouseDown","onFocus","onBlurCapture","onKeyDown","onClick"]),f=Object(_.useRef)(null),b=e.id,m=e.disabled&&!e.focusable,p=e.currentId===b,g=io(p),O=Object(_.useRef)(!1),v=function(e){return Object(_.useMemo)((function(){var t;return null===(t=e.items)||void 0===t?void 0:t.find((function(t){return e.id&&t.id===e.id}))}),[e.items,e.id])}(e),w=io(l),h=io(c),j=io(i),y=io(s),C=io(u),E=!e.unstable_virtual&&!e.unstable_hasActiveWidget&&p||!(null!==(n=e.items)&&void 0!==n&&n.length);Object(_.useEffect)((function(){var t;if(b)return null===(t=e.registerItem)||void 0===t||t.call(e,{id:b,ref:f,disabled:!!m}),function(){var t;null===(t=e.unregisterItem)||void 0===t||t.call(e,b)}}),[b,m,e.registerItem,e.unregisterItem]),Object(_.useEffect)((function(){var t=f.current;t&&e.unstable_moves&&g.current&&Ro(t)}),[e.unstable_moves]);var k=Object(_.useCallback)((function(e){var t;null===(t=w.current)||void 0===t||t.call(w,e),Do(e.currentTarget,!0)}),[]),x=Object(_.useCallback)((function(t){var n,r,o=!!t.currentTarget.userFocus;if(Do(t.currentTarget,!1),null===(n=h.current)||void 0===n||n.call(h,t),!t.defaultPrevented&&!Oo(t)&&b&&!function(e,t){if(so(e))return!1;for(var n,r=ir(t);!(n=r()).done;){if(n.value.ref.current===e.target)return!0}return!1}(t,e.items)&&(null===(r=e.setCurrentId)||void 0===r||r.call(e,b),o&&e.unstable_virtual&&e.baseId&&so(t))){var a=sr(t.target).getElementById(e.baseId);a&&(O.current=!0,function(e,t){var n=void 0===t?{}:t,r=n.preventScroll,o=n.isActive,a=void 0===o?Ko:o;a(e)||(e.focus({preventScroll:r}),a(e)||requestAnimationFrame((function(){e.focus({preventScroll:r})})))}(a))}}),[b,e.items,e.setCurrentId,e.unstable_virtual,e.baseId]),S=Object(_.useCallback)((function(t){var n;null===(n=j.current)||void 0===n||n.call(j,t),t.defaultPrevented||e.unstable_virtual&&O.current&&(O.current=!1,t.preventDefault(),t.stopPropagation())}),[e.unstable_virtual]),T=Object(_.useCallback)((function(t){var n;if(so(t)){var r="horizontal"!==e.orientation,o="vertical"!==e.orientation,a=!(null==v||!v.groupId),l={ArrowUp:(a||r)&&e.up,ArrowRight:(a||o)&&e.next,ArrowDown:(a||r)&&e.down,ArrowLeft:(a||o)&&e.previous,Home:function(){var n,r;!a||t.ctrlKey?null===(n=e.first)||void 0===n||n.call(e):null===(r=e.previous)||void 0===r||r.call(e,!0)},End:function(){var n,r;!a||t.ctrlKey?null===(n=e.last)||void 0===n||n.call(e):null===(r=e.next)||void 0===r||r.call(e,!0)},PageUp:function(){var t,n;a?null===(t=e.up)||void 0===t||t.call(e,!0):null===(n=e.first)||void 0===n||n.call(e)},PageDown:function(){var t,n;a?null===(t=e.down)||void 0===t||t.call(e,!0):null===(n=e.last)||void 0===n||n.call(e)}}[t.key];if(l)return t.preventDefault(),void l();if(null===(n=y.current)||void 0===n||n.call(y,t),!t.defaultPrevented)if(1===t.key.length&&" "!==t.key){var c=Zo(t.currentTarget);c&&qo(c)&&(c.focus(),Go(c,""))}else if("Delete"===t.key||"Backspace"===t.key){var i=Zo(t.currentTarget);i&&qo(i)&&(t.preventDefault(),Go(i,""))}}}),[e.orientation,v,e.up,e.next,e.down,e.previous,e.first,e.last]),I=Object(_.useCallback)((function(e){var t;if(null===(t=C.current)||void 0===t||t.call(C,e),!e.defaultPrevented){var n=Zo(e.currentTarget);n&&!go(n)&&n.focus()}}),[]);return ar({ref:co(f,r),id:b,tabIndex:E?a:-1,"aria-selected":!(!e.unstable_virtual||!p)||void 0,onMouseDown:k,onFocus:x,onBlurCapture:S,onKeyDown:T,onClick:I},d)}})}),Qo=function(e){var t=e.isActive,n=e.column,r=e.onSelect,o=e.row,l=Se()(e,["isActive","column","onSelect","row"]),c="".concat(o.label," ").concat(n.label),i=Object(_.useCallback)((function(){r(o.value,n.value)}),[r,o.value,n.value]),s=T()("crowdsignal-forms__block-alignment-control-button",{"is-active":t});return Object(a.createElement)(E.Tooltip,{text:c},Object(a.createElement)(Yo,w()({className:s,role:"gridcell",onFocus:i},l),Object(a.createElement)(E.VisuallyHidden,null,c)))},Jo=function(e,t,n){return"".concat(e,"-").concat(t,"-").concat(n)};var Xo=function e(t){var n=t.columns,r=t.onChange,o=t.rows,c=t.value,i=Object(x.useInstanceId)(e,"block-alignment-control-grid"),s=Mr({baseId:i,currentId:Jo(i,c.row,c.column),rtl:Object(l.isRTL)()});return Object(_.useEffect)((function(){s.setCurrentId(Jo(i,c.row,c.column))}),[c,s.setCurrentId]),Object(a.createElement)(Ho,w()({},s,{className:"crowdsignal-forms__block-alignment-control-grid"}),Object(b.map)(o,(function(e){return Object(a.createElement)(Uo,w()({},s,{key:"".concat(i,"-").concat(e.value),role:"row",className:"crowdsignal-forms__block-alignment-control-row"}),Object(b.map)(n,(function(t){var n=Jo(i,e.value,t.value),o=s.currentId===Jo(i,e.value,t.value);return Object(a.createElement)(Qo,w()({},s,{id:n,key:n,isActive:o,row:e,column:t,onSelect:r,tabIndex:o?0:-1}))})))})))},$o=function(e){var t=e.rows,n=e.columns,r=e.value,o=0,l=0;return Object(a.createElement)("div",{className:"crowdsignal-forms__block-alignment-control-icon"},Object(b.map)(t,(function(e){return Object(a.createElement)("div",{key:l++,className:"crowdsignal-forms__block-alignment-control-icon-row"},Object(b.map)(n,(function(t){var n=e.value===r.row&&t.value===r.column,l=T()("crowdsignal-forms__block-alignment-control-icon-dot",{"is-active":n});return Object(a.createElement)("span",{key:o++,className:l})})))})))},ea={"2x2":{rows:[{label:Object(l.__)("Top","crowdsignal-forms"),value:"top"},{label:Object(l.__)("Bottom","crowdsignal-forms"),value:"bottom"}],columns:[{label:Object(l.__)("Left","crowdsignal-forms"),value:"left"},{label:Object(l.__)("Right","crowdsignal-forms"),value:"right"}]},"2x3":{rows:[{label:Object(l.__)("Top","crowdsignal-forms"),value:"top"},{label:Object(l.__)("Center","crowdsignal-forms"),value:"center"},{label:Object(l.__)("Bottom","crowdsignal-forms"),value:"bottom"}],columns:[{label:Object(l.__)("Left","crowdsignal-forms"),value:"left"},{label:Object(l.__)("Right","crowdsignal-forms"),value:"right"}]}},ta=function(e){var t=e.closeOnSelectionChanged,n=e.disabled,r=e.label,o=e.onChange,l=e.rows,c=e.columns,i=e.value,s=Object(a.createElement)($o,{rows:l,columns:c,value:i});return Object(a.createElement)(E.Dropdown,{className:"crowdsignal-forms__block-alignment-control",popoverProps:{className:"crowdsignal-forms__block-alignment-control-popover"},renderToggle:function(e){var t=e.onToggle,o=e.isOpen;return Object(a.createElement)(E.Tooltip,{text:r},Object(a.createElement)(E.ToolbarButton,{showTooltip:!0,"aria-haspopup":"true","aria-expanded":o,disabled:n,icon:s,onClick:t,onKeyDown:function(e){o||e.keyCode!==nr.DOWN||(e.preventDefault(),e.stopPropagation(),t())}}))},renderContent:function(e){var n=e.onClose;return Object(a.createElement)(Xo,{onChange:function(e,r){o(e,r),!t||i.row===e&&i.column===r||n()},rows:l,columns:c,value:i})}})};ta.defaultProps={closeOnSelectionChanged:!1,label:Object(l.__)("Change block position","crowdsignal-forms"),onChange:b.noop};var na=ta,ra=function(e){var t=e.attributes,n=e.currentView,r=e.onViewChange,o=e.setAttributes,c=function(e){return function(){return r(e)}};return Object(a.createElement)(C.BlockControls,null,Object(a.createElement)(E.ToolbarGroup,{label:Object(l.__)("Current view","crowdsignal-forms")},Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-feedback__toolbar-toggle",isActive:n===zn,label:Object(l.__)("Question","crowdsignal-forms"),onClick:c(zn)},Object(l.__)("Question","crowdsignal-forms")),Object(a.createElement)(E.ToolbarButton,{className:"crowdsignal-forms-feedback__toolbar-toggle",isActive:n===qn,label:Object(l.__)("Submit","crowdsignal-forms"),onClick:c(qn)},Object(l.__)("Submit","crowdsignal-forms"))),Object(a.createElement)(E.ToolbarGroup,null,Object(a.createElement)(na,w()({closeOnSelectionChanged:!0,onChange:function(e,t){return o({x:t,y:e})},label:Object(l.__)("Change button position","crowdsignal-forms"),value:{row:t.y,column:t.x}},ea["2x3"]))))},oa=function(){return!!window.wp.widgets},aa=function(e){return Rn(Q()({path:Object(b.trimEnd)("/crowdsignal-forms/v1/feedback/".concat(e.surveyId||""),"/"),method:"POST",data:e}))};function la(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var ca=Object(x.compose)([Object(f.withSelect)((function(e){var t=e("core/editor").getPermalink();t||(t=e("core").getSite()&&e("core").getSite().url);var n=e("core/edit-post");return{isFullscreen:"isFeatureActive"in n?n.isFeatureActive("fullscreenMode"):n.getPreference("fullscreenMode"),isInserterActive:n.isInserterOpened(),isListViewActive:n.isListViewOpened(),isSidebarActive:n.isEditorSidebarOpened(),sourceLink:t}})),Le])((function(e){var t=Object(_.useState)(zn),n=j()(t,2),r=n[0],o=n[1],c=Object(_.useState)(null),i=j()(c,2),s=i[0],u=i[1],m=Object(_.useState)({}),p=j()(m,2),g=p[0],O=p[1],v=e.attributes,h=e.isFullscreen,y=e.isInserterActive,k=e.isListViewActive,x=e.isSidebarActive,S=e.fallbackStyles,I=e.isSelected,P=e.setAttributes,L=e.clientId,N=e.sourceLink,R=e.setPosition,B=v.isExample,F=v.feedbackPlaceholder,M=v.emailPlaceholder,H=v.surveyId,V=v.title,W=v.header,U=v.emailResponses,z=v.triggerLabel,q=Object(_.useState)({}),K=j()(q,2),G=K[0],Z=K[1],Y=Object(_.useState)(!1),Q=j()(Y,2),J=Q[0],X=Q[1],$=Object(_.useMemo)(oa,[]),ee=Object(_.useRef)(null),te=Object(_.useRef)(null),ne=Object(_.useRef)(null),re=An(function(){var e=D()(A.a.mark((function e(t){var n;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Object(f.dispatch)("core/editor").lockPostSaving(L),e.prev=1,e.next=4,aa({feedbackPlaceholder:t.feedbackPlaceholder,emailPlaceholder:t.emailPlaceholder,sourceLink:t.sourceLink,surveyId:t.surveyId,title:t.title||t.header,emailResponses:t.emailResponses});case 4:n=e.sent,t.surveyId||P({surveyId:n.surveyId});case 6:return e.prev=6,Object(f.dispatch)("core/editor").unlockPostSaving(L),e.finish(6);case 9:case"end":return e.stop()}}),e,null,[[1,,6,9]])})));return function(t){return e.apply(this,arguments)}}(),{feedbackPlaceholder:F,emailPlaceholder:M,sourceLink:N,surveyId:H,title:V,header:W,emailResponses:U}),oe=re.error,ae=re.save;Object(_.useEffect)((function(){B||v.surveyId||(ae(),P({isWidget:$}))}),[]),Object(_.useEffect)((function(){I||o(zn)}),[I]),Object(_.useEffect)((function(){window.requestAnimationFrame((function(){return X(!J)}))}),[y,k,x]),Object(_.useLayoutEffect)((function(){if(!B&&te.current&&!$){R(function(e,t,n,r,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,l={left:Object(b.isObject)(o)?o.left:o,right:Object(b.isObject)(o)?o.right:o,top:Object(b.isObject)(o)?o.top:o,bottom:Object(b.isObject)(o)?o.bottom:o};return a&&(l=Xn(l,a.getBoundingClientRect())),Qn({},$n(e,0,l),{},er(t,r,l))}(v.x,v.y,ee.current.offsetWidth,ee.current.offsetHeight,{left:"center"===v.y?10:20,right:"center"===v.y?10:20,top:I?80:20,bottom:20},document.getElementsByClassName("interface-interface-skeleton__content")[0]),te.current.offsetWidth,te.current.offsetHeight);var e=(Object(b.max)([te.current.offsetWidth,ee.current.offsetHeight])-te.current.offsetWidth)/2;Z({"--crowdsignal-forms-feedback__toggle-padding":"".concat(e,"px"),minHeight:"center"===v.y?te.current.offsetWidth:0,marginLeft:"center"===v.y&&"left"===v.x?te.current.offsetHeight-te.current.offsetWidth-10:0,marginRight:"center"===v.y&&"right"===v.x?te.current.offsetHeight-te.current.offsetWidth-10:0})}}),[J,h,I,R,v.x,v.y,te.current,ee.current,z,$]),Object(_.useLayoutEffect)((function(){ne.current&&u(ne.current.offsetHeight)}),[v.header,ne.current,I]),Object(_.useLayoutEffect)((function(){if(!oa)if(te.current&&te.current.ownerDocument!==document)O({bottom:0,left:0,right:0,top:0});else{var e=document.getElementsByClassName("interface-interface-skeleton__content")[0].getBoundingClientRect();O({bottom:window.innerHeight-(e.top+e.height),left:e.left,right:window.innerWidth-(e.left+e.width),top:e.top})}}),[J,h,I,te.current]);var le=function(e){return function(t){return P(d()({},e,t))}},ce=ie().accountInfo,se=Object(b.get)(ce,["signalCount","shouldDisplay"]),ue=se&&Object(b.get)(ce,["signalCount","count"])>=Object(b.get)(ce,["signalCount","userLimit"]),de=Object(b.get)(ce,["account","email"]),fe=T()("crowdsignal-forms-feedback","align-".concat(v.x),"vertical-align-".concat(v.y),{"no-shadow":v.hideTriggerShadow,"is-active":I,"is-vertical":"center"===v.y,"is-widget":$}),me=$&&te.current&&te.current.offsetHeight?"".concat(te.current&&te.current.offsetHeight,"px"):null,pe=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?la(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):la(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},function(e,t){return Object(b.mapKeys)({backgroundColor:e.backgroundColor||"#ffffff",buttonColor:e.buttonColor||t.accentColor,buttonTextColor:e.buttonTextColor||t.textColorInverted,textColor:e.textColor||t.textColor,textSize:t.textSize,triggerBackgroundColor:e.triggerBackgroundColor||t.accentColor,triggerTextColor:e.triggerTextColor||t.textColorInverted},(function(e,t){return"--crowdsignal-forms-".concat(Object(b.kebabCase)(t))}))}(v,S),{},G,{"--crowdsignal-forms-trigger-height":me}),ge={height:s},Oe=Kn.CLOSED===v.status||Kn.CLOSED_AFTER===v.status&&null!==v.closedAfterDateTime&&(new Date).toISOString()>v.closedAfterDateTime,ve=Object(b.get)(ce,"capabilities",[]).includes("hide-branding");return Object(a.createElement)(lt,{blockName:Object(l.__)("Feedback Button","crowdsignal-forms"),blockIcon:Object(a.createElement)(Un,null)},Object(a.createElement)(ra,w()({currentView:r,onViewChange:o},e)),Object(a.createElement)(tr,w()({shouldPromote:se,signalWarning:ue,email:de},e)),$&&Object(a.createElement)(a.Fragment,null,!B&&!$&&ue&&Object(a.createElement)(pt,null),!B&&!$&&oe&&Object(a.createElement)(Hn,{retryHandler:ae}),Object(a.createElement)(mt,{icon:"warning",status:"warn",isDismissible:!1},Object(l.__)("This widget will appear in a fixed position as selected, in a corner or at an edge.","crowdsignal-forms"))),Object(a.createElement)("div",{ref:ee,className:fe,style:pe},Object(a.createElement)("div",{className:"crowdsignal-forms-feedback__trigger-preview"},Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-feedback__trigger-wrapper"},Object(a.createElement)(C.RichText,{ref:te,className:"wp-block-button__link crowdsignal-forms-feedback__trigger",onChange:le("triggerLabel"),value:z,allowedFormats:[],multiline:!1,disableLineBreaks:!0}))),Object(a.createElement)("div",{className:"crowdsignal-forms-feedback__popover-preview"},(B||I||$)&&Object(a.createElement)(a.Fragment,null,!$&&Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{"aria-modal":"true",role:"dialog",className:"crowdsignal-forms-feedback__popover-overlay",onClick:function(){Object(f.dispatch)("core/block-editor").clearSelectedBlock(),te.current.parentElement.parentElement.parentElement.blur()},style:g})),!B&&!$&&ue&&Object(a.createElement)(pt,null),!B&&!$&&oe&&Object(a.createElement)(Hn,{retryHandler:ae}),r===zn&&Object(a.createElement)("div",{ref:ne,className:"crowdsignal-forms-feedback__popover"},Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-feedback__header",onChange:le("header"),value:v.header,allowedFormats:[]}),Object(a.createElement)(E.TextareaControl,{className:"crowdsignal-forms-feedback__input",rows:6,onChange:le("feedbackPlaceholder"),value:v.feedbackPlaceholder}),Object(a.createElement)(E.TextControl,{className:"crowdsignal-forms-feedback__input",onChange:le("emailPlaceholder"),value:v.emailPlaceholder}),Object(a.createElement)("div",{className:"wp-block-button crowdsignal-forms-feedback__button-wrapper"},Object(a.createElement)(C.RichText,{className:"wp-block-button__link crowdsignal-forms-feedback__feedback-button",onChange:le("submitButtonLabel"),value:v.submitButtonLabel,allowedFormats:[],multiline:!1,disableLineBreaks:!0})),!ve&&Object(a.createElement)(be,{editing:!0,trackRef:"cs-forms-feedback",message:Object(l.__)("Collect your own feedback with Crowdsignal","crowdsignal-forms")})),r===qn&&Object(a.createElement)("div",{className:"crowdsignal-forms-feedback__popover",style:ge},Object(a.createElement)(C.RichText,{tagName:"h3",className:"crowdsignal-forms-feedback__header",onChange:le("submitText"),value:v.submitText,allowedFormats:[]}),!ve&&Object(a.createElement)(be,{editing:!0,trackRef:"cs-forms-feedback",message:Object(l.__)("Collect your own feedback with Crowdsignal","crowdsignal-forms")})),Oe&&Object(a.createElement)("div",{className:"crowdsignal-forms-feedback__closed-notice"},Object(l.__)("This Feedback Form is Closed","crowdsignal-forms"))))),e.renderStyleProbe())})),ia={title:Object(l.__)("Feedback Button","crowdsignal-forms"),description:Object(l.__)("Add an always visible button that allows your audience to share feedback anytime.","crowdsignal-forms"),category:"crowdsignal-forms",keywords:["crowdsignal",Object(l.__)("feedback","crowdsignal-forms"),Object(l.__)("floating","crowdsignal-forms"),Object(l.__)("contact","crowdsignal-forms"),Object(l.__)("call to action","crowdsignal-forms"),Object(l.__)("cta","crowdsignal-forms"),Object(l.__)("button","crowdsignal-forms"),Object(l.__)("subscribe","crowdsignal-forms"),Object(l.__)("form","crowdsignal-forms"),Object(l.__)("email","crowdsignal-forms"),Object(l.__)("message","crowdsignal-forms")],icon:Object(a.createElement)(Un,null),edit:ca,supports:{multiple:!1,html:!1,reusable:!1},attributes:Zn,example:{attributes:{isExample:!0}}};function sa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ua(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sa(Object(n),!0).forEach((function(t){d()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var da={},fa=["crowdsignal-forms/feedback"];Object(r.registerBlockType)("crowdsignal-forms/poll",wt),Object(r.registerBlockType)("crowdsignal-forms/vote",At),Object(r.registerBlockType)("crowdsignal-forms/vote-item",mn),Object(r.registerBlockType)("crowdsignal-forms/applause",Sn),Object(r.registerBlockType)("crowdsignal-forms/nps",Wn),Object(r.registerBlockType)("crowdsignal-forms/feedback",ia),Object(o.addFilter)("editor.BlockListBlock","crowdsignal-forms/with-fixed-position",(function(e){return function(t){if(!Object(b.includes)(fa,t.name))return Object(a.createElement)(e,t);var n=Object(_.useState)({}),r=j()(n,2),o=r[0],l=r[1];da[t.clientId]=l,Object(_.useEffect)((function(){return function(){da[t.clientId]=null}}),[da,t.clientId]);var c=ua({},Object(b.get)(t,["wrapperProps","style"],{}),{},o,{position:Object(b.isEmpty)(o)?null:"fixed",margin:0}),i=ua({},t.wrapperProps,{style:c});return Object(a.createElement)(e,w()({},t,{wrapperProps:i}))}}),1),Object(o.addFilter)("editor.BlockEdit","crowdsignal-forms/with-fixed-position-control",(function(e){return function(t){if(!Object(b.includes)(fa,t.name))return Object(a.createElement)(e,t);var n=Object(_.useCallback)((function(e){da[t.clientId](Object(b.pick)(e,["top","left","right","bottom"]))}),[t.clientId]);return Object(a.createElement)(e,w()({},t,{setPosition:n}))}}))}]));
changelog.txt CHANGED
@@ -1,7 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 1.5.12 =
2
- * Broken connection handling (#193)
3
  * Fix multiple choice poll check position (#192)
4
- * Rework code (#191)
5
 
6
  = 1.5.11 =
7
  * Default polls to "Button" style (#189)
1
+ = 1.5.15 =
2
+ * Fix CSS so it doesn't interfere with Jetpack (#208)
3
+ * add trigger for crowdsignal_forms_get_account_info (#203)
4
+ * fix typo on respones -> responses (#207)
5
+
6
+ = 1.5.13 =
7
+ * Update the text and styling of the settings page. (#199)
8
+ * Fix transient and empty user (#200)
9
+ * Update links to settings page. (#198)
10
+ * Let the dashboard plugin take care of menus. (#196)
11
+ * WIP: Move the "Getting Started" process into the Settings page. (#179)
12
+ * Some fixes along the way (#197)
13
+ * Update and delete the dashboard login details too (#195)
14
+
15
  = 1.5.12 =
16
+ * Improve broken connection handling (#193)
17
  * Fix multiple choice poll check position (#192)
18
+ * Rework backend code (#191)
19
 
20
  = 1.5.11 =
21
  * Default polls to "Button" style (#189)
crowdsignal-forms.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: Crowdsignal Forms
16
  * Plugin URI: https://crowdsignal.com/crowdsignal-forms/
17
  * Description: Crowdsignal Form Blocks
18
- * Version: 1.5.14
19
  * Author: Automattic
20
  * Author URI: https://automattic.com/
21
  * License: GPL-2.0+
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
28
  die;
29
  }
30
 
31
- define( 'CROWDSIGNAL_FORMS_VERSION', '1.5.12' );
32
  define( 'CROWDSIGNAL_FORMS_PLUGIN_FILE', __FILE__ );
33
  define( 'CROWDSIGNAL_FORMS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
34
 
15
  * Plugin Name: Crowdsignal Forms
16
  * Plugin URI: https://crowdsignal.com/crowdsignal-forms/
17
  * Description: Crowdsignal Form Blocks
18
+ * Version: 1.5.15
19
  * Author: Automattic
20
  * Author URI: https://automattic.com/
21
  * License: GPL-2.0+
28
  die;
29
  }
30
 
31
+ define( 'CROWDSIGNAL_FORMS_VERSION', '1.5.15' );
32
  define( 'CROWDSIGNAL_FORMS_PLUGIN_FILE', __FILE__ );
33
  define( 'CROWDSIGNAL_FORMS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
34
 
includes/admin/admin-styles.css CHANGED
@@ -15,6 +15,88 @@
15
  font-weight: 700;
16
  }
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  .crowdsignal-setup__header {
19
  background-color: #fff;
20
  text-align: center;
@@ -112,13 +194,14 @@
112
  margin: 0 auto;
113
  }
114
 
115
- .crowdsignal-setup__content h3,
116
- .crowdsignal-setup__content h4 {
117
  font-family: Recoleta, sans-serif;
118
  font-weight: 700;
119
- font-size: 40px;
120
  line-height: 150%;
121
  margin: 0;
 
122
  }
123
 
124
  .crowdsignal-setup__content h4 {
@@ -174,8 +257,12 @@
174
  margin-top: 40px;
175
  }
176
 
 
 
 
 
177
  .crowdsignal-setup__middle a {
178
- text-decoration: none;
179
  }
180
 
181
  .crowdsignal-setup__video-container {
@@ -205,23 +292,23 @@
205
  }
206
 
207
 
208
- .wrap div.crowdsignal-message {
209
  margin: 24px auto 8px auto;
210
  border: 0;
211
  padding: 16px;
212
  padding-left: 24px;
213
- max-width: 960px;
214
  box-sizing: border-box;
215
  }
216
 
217
- .wrap div.updated.crowdsignal-message {
218
  background-color: #eff9f1;
219
  }
220
- .wrap div.error.crowdsignal-message {
221
  background-color: #fbcfd2;
222
  }
223
- .wrap div.updated.crowdsignal-message p,
224
- .wrap div.error.crowdsignal-message p {
225
  padding: 0;
226
  color: black;
227
  font-size: 14px;
@@ -240,7 +327,7 @@
240
  .crowdsignal-settings__main-content {
241
  }
242
 
243
- .dops-card {
244
  display: block;
245
  position: relative;
246
  margin: 0 auto 10px;
@@ -250,12 +337,12 @@
250
  box-shadow: 0 0 0 1px #ccd0d4,0 1px 1px 1px rgba(0,0,0,.04);
251
  }
252
 
253
- .dops-card.is-compact {
254
  margin-bottom: 1px;
255
  padding: 16px 24px;
256
  }
257
 
258
- .dops-section-header.dops-card {
259
  display: flex;
260
  flex-wrap: wrap;
261
  padding-top: .6875rem;
@@ -263,13 +350,13 @@
263
  position: relative;
264
  }
265
 
266
- .dops-section-header__label {
267
  line-height: 1.75rem;
268
  color: #414141;
269
  font-size: .875rem;
270
  }
271
 
272
- .dops-section-header__label-text {
273
  position: relative;
274
  margin-right: .5rem;
275
  white-space: nowrap;
@@ -277,6 +364,8 @@
277
  width: 100%;
278
  padding-right: .5rem;
279
  min-width: 0;
 
 
280
  }
281
 
282
  .crowdsignal-settings__middle {
@@ -321,3 +410,101 @@
321
  margin-right: -12px;
322
  }
323
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  font-weight: 700;
16
  }
17
 
18
+ #cs-plugin-container {
19
+ min-height: 100vh;
20
+ }
21
+
22
+ #cs-plugin-container .wrap {
23
+ margin: 0 auto;
24
+ max-width:45rem;
25
+ padding: 0 1.5rem;
26
+ }
27
+ #cs-plugin-container.is-wide .wrap {
28
+ max-width: 1040px;
29
+ }
30
+ #cs-plugin-container .wrap .jetpack-wrap-container {
31
+ margin-top: 1em;
32
+ }
33
+
34
+ .cs-lower {
35
+ margin: 0 auto;
36
+ text-align: left;
37
+ max-width: 65rem;
38
+ padding: 1.5rem;
39
+ }
40
+
41
+ .cs-footer {
42
+ text-align: center;
43
+ margin: 1rem 0 2rem;
44
+ }
45
+
46
+ .cs-footer__a8c-attr-container {
47
+ margin-bottom: .5rem;
48
+ }
49
+
50
+ .cs-footer__a8c-attr {
51
+ width: 11.25rem;
52
+ }
53
+
54
+ .cs-footer__a8c-attr a {
55
+ color: #2271b1;
56
+ }
57
+
58
+ .cs-footer__links {
59
+ border-top: 1px #e1e1e1 solid;
60
+ border-bottom: 1px #e1e1e1 solid;
61
+ margin-top: 0;
62
+ margin-bottom: 1rem;
63
+ }
64
+
65
+ .cs-footer__link-item {
66
+ display: inline-block;
67
+ }
68
+
69
+ .cs-footer__link {
70
+ color: #888;
71
+ padding: 1rem .5rem;
72
+ color: #888;
73
+ display: inline-block;
74
+ cursor: pointer;
75
+ }
76
+
77
+ .cs-footer__link:hover, .cs-footer__link:active {
78
+ color: #272727;
79
+ }
80
+
81
+ .cs-footer__link:visited {
82
+ color: #888;
83
+ }
84
+
85
+ .wp-admin #dolly {
86
+ float: none;
87
+ position: relative;
88
+ right: 0;
89
+ left: 0;
90
+ top: 0;
91
+ padding: .625rem;
92
+ text-align: right;
93
+ background: #fff;
94
+ font-size: .75rem;
95
+ font-style: italic;
96
+ color: #87a6bc;
97
+ border-bottom: 1px #e9eff3 solid;
98
+ }
99
+
100
  .crowdsignal-setup__header {
101
  background-color: #fff;
102
  text-align: center;
194
  margin: 0 auto;
195
  }
196
 
197
+ .cs-card h3,
198
+ .cs-card h4 {
199
  font-family: Recoleta, sans-serif;
200
  font-weight: 700;
201
+ font-size: 20px;
202
  line-height: 150%;
203
  margin: 0;
204
+ margin: 0 0 10px 0;
205
  }
206
 
207
  .crowdsignal-setup__content h4 {
257
  margin-top: 40px;
258
  }
259
 
260
+ .crowdsignal-setup__middle p {
261
+ color: #838383;
262
+ }
263
+
264
  .crowdsignal-setup__middle a {
265
+
266
  }
267
 
268
  .crowdsignal-setup__video-container {
292
  }
293
 
294
 
295
+ div.crowdsignal-message {
296
  margin: 24px auto 8px auto;
297
  border: 0;
298
  padding: 16px;
299
  padding-left: 24px;
300
+ max-width: 1040px;
301
  box-sizing: border-box;
302
  }
303
 
304
+ div.updated.crowdsignal-message {
305
  background-color: #eff9f1;
306
  }
307
+ div.error.crowdsignal-message {
308
  background-color: #fbcfd2;
309
  }
310
+ div.updated.crowdsignal-message p,
311
+ div.error.crowdsignal-message p {
312
  padding: 0;
313
  color: black;
314
  font-size: 14px;
327
  .crowdsignal-settings__main-content {
328
  }
329
 
330
+ .cs-card {
331
  display: block;
332
  position: relative;
333
  margin: 0 auto 10px;
337
  box-shadow: 0 0 0 1px #ccd0d4,0 1px 1px 1px rgba(0,0,0,.04);
338
  }
339
 
340
+ .cs-card.is-compact {
341
  margin-bottom: 1px;
342
  padding: 16px 24px;
343
  }
344
 
345
+ .cs-section-header.cs-card {
346
  display: flex;
347
  flex-wrap: wrap;
348
  padding-top: .6875rem;
350
  position: relative;
351
  }
352
 
353
+ .cs-section-header__label {
354
  line-height: 1.75rem;
355
  color: #414141;
356
  font-size: .875rem;
357
  }
358
 
359
+ .cs-section-header__label-text {
360
  position: relative;
361
  margin-right: .5rem;
362
  white-space: nowrap;
364
  width: 100%;
365
  padding-right: .5rem;
366
  min-width: 0;
367
+ font-weight: 400;
368
+ color: #3C434A;
369
  }
370
 
371
  .crowdsignal-settings__middle {
410
  margin-right: -12px;
411
  }
412
  }
413
+
414
+ .cs-form-settings-group p {
415
+ color: #838383;
416
+ font-style: italic;
417
+ font-size: .875rem;
418
+ font-weight: 400;
419
+ }
420
+
421
+ .cs-form-settings-group a {
422
+ }
423
+
424
+ .cs-form-settings-group h2 {
425
+ font-size: .875rem;
426
+ font-weight: 700;
427
+ }
428
+
429
+ #crowdsignal__teaser_img {
430
+ max-width:100%;
431
+ max-height:100%;
432
+ padding-bottom: 20px;
433
+ }
434
+
435
+ #crowdsignal__logo {
436
+ font-size: 1.5rem;
437
+ font-weight: 400;
438
+ margin: .67em 0;
439
+ color: #1d2327;
440
+ font-family: Recoleta, "Noto Serif", Georgia, Times New Roman, Times, serif;
441
+ font-style: normal;
442
+ line-height: 1.2em;
443
+ }
444
+
445
+ #crowdsignal__install_cta {
446
+ margin: 0;
447
+ max-width: 100%;
448
+ }
449
+ .cs-button {
450
+ background:#f6f7f7;
451
+ border:1px solid #2271b1;
452
+ color:#2271b1;
453
+ cursor:pointer;
454
+ display:inline-block;
455
+ margin:0;
456
+ outline:0;
457
+ overflow:hidden;
458
+ font-size:.875rem;
459
+ text-overflow:ellipsis;
460
+ text-decoration:none;
461
+ vertical-align:top;
462
+ box-sizing:border-box;
463
+ border-radius:3px;
464
+ padding:7px 14px 9px;
465
+ -webkit-appearance:none;
466
+ appearance:none
467
+ }
468
+ .cs-button:hover {
469
+ background:#f0f0f1;
470
+ border-color:#0a4b78;
471
+ color:#0a4b78
472
+ }
473
+ .cs-button:disabled,
474
+ .cs-button[disabled] {
475
+ color:#eee;
476
+ background:#fff;
477
+ border-color:#eee;
478
+ cursor:default
479
+ }
480
+ .cs-button:focus {
481
+ background:#fff;
482
+ border-color:#2271b1;
483
+ box-shadow:0 0 0 1px #2271b1
484
+ }
485
+ .cs-button.hidden {
486
+ display:none
487
+ }
488
+ .cs-button.is-primary {
489
+ background:#3582c4;
490
+ border-color:#3582c4;
491
+ color:#fff
492
+ }
493
+ .cs-button.is-primary:focus,
494
+ .cs-button.is-primary:hover {
495
+ border-color:#2271b1;
496
+ background:#2271b1;
497
+ color:#fff
498
+ }
499
+ .cs-button.is-primary:focus {
500
+ box-shadow:0 0 0 1px #fff,0 0 0 3px #2271b1
501
+ }
502
+ .cs-button.is-primary:disabled,
503
+ .cs-button.is-primary[disabled] {
504
+ color:#66c6e4!important;
505
+ background-color:#008ec2!important;
506
+ border-color:#008ec2!important;
507
+ box-shadow:none!important;
508
+ text-shadow:none!important;
509
+ cursor:default
510
+ }
includes/admin/class-crowdsignal-forms-admin.php CHANGED
@@ -66,11 +66,18 @@ class Crowdsignal_Forms_Admin {
66
  * Adds pages to admin menu.
67
  */
68
  public function admin_menu() {
69
- $icon_encoded = 'PHN2ZyBpZD0iY29udGVudCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMjg4IDIyMCI+PGRlZnM+PHN0eWxlPi5jbHMtMXtmaWxsOiNGRkZGRkY7fTwvc3R5bGU+PC9kZWZzPjx0aXRsZT5pY29uLWJsdWU8L3RpdGxlPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTI2Mi40MSw4MC4xYy04LjQ3LTIyLjU1LTE5LjA1LTQyLjgzLTI5Ljc5LTU3LjFDMjIwLjc0LDcuMjQsMjEwLC41NywyMDEuNDcsMy43OWExMi4zMiwxMi4zMiwwLDAsMC0zLjcyLDIuM2wtLjA1LS4xNUwxNiwxNzMuOTRsOC4yLDE5LjEyLDMwLjU2LTEuOTJ2MTMuMDVhMTIuNTcsMTIuNTcsMCwwLDAsMTIuNTgsMTIuNTZjLjMzLDAsLjY3LDAsMSwwbDU4Ljg1LTQuNzdhMTIuNjUsMTIuNjUsMCwwLDAsMTEuNTYtMTIuNTNWMTg1Ljg2bDEyMS40NS03LjY0YTEzLjg4LDEzLjg4LDAsMCwwLDIuMDkuMjYsMTIuMywxMi4zLDAsMCwwLDQuNDEtLjhDMjg1LjMzLDE3MC43LDI3OC42MywxMjMuMzEsMjYyLjQxLDgwLjFabS0yLjI2LDg5Ljc3Yy0xMC40OC0zLjI1LTMwLjQ0LTI4LjE1LTQ2LjY4LTcxLjM5LTE1LjcyLTQxLjktMTcuNS03My4yMS0xMi4zNC04My41NGE2LjUyLDYuNTIsMCwwLDEsMy4yMi0zLjQ4LDMuODIsMy44MiwwLDAsMSwxLjQxLS4yNGMzLjg1LDAsMTAuOTQsNC4yNiwyMC4zMSwxNi43MUMyMzYuMzYsNDEuNTksMjQ2LjU0LDYxLjE1LDI1NC43NCw4M2MxOC40NCw0OS4xMiwxNy43NCw4My43OSw5LjEzLDg3QTUuOTMsNS45MywwLDAsMSwyNjAuMTUsMTY5Ljg3Wk0xMzAuNiwxOTkuNDFhNC40LDQuNCwwLDAsMS00LDQuMzdsLTU4Ljg1LDQuNzdBNC4zOSw0LjM5LDAsMCwxLDYzLDIwNC4xOVYxOTAuNjJsNjcuNjEtNC4yNVoiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik02LDE4NS4yNmExMC4yNSwxMC4yNSwwLDAsMCwxMC4yNSwxMC4yNSwxMC4wNSwxMC4wNSwwLDAsMCw0LjM0LTFsLTcuOTQtMTguNzNBMTAuMiwxMC4yLDAsMCwwLDYsMTg1LjI2WiIvPjwvc3ZnPgo=';
70
- add_menu_page( __( 'Crowdsignal', 'crowdsignal-forms' ), __( 'Crowdsignal', 'crowdsignal-forms' ), 'manage_options', 'crowdsignal-forms', array( $this->settings_page, 'output' ), 'data:image/svg+xml;base64,' . $icon_encoded );
71
- add_submenu_page( 'crowdsignal-forms', __( 'Settings', 'crowdsignal-forms' ), __( 'Settings', 'crowdsignal-forms' ), 'manage_options', 'crowdsignal-forms-settings', array( $this->settings_page, 'output' ) );
72
- add_submenu_page( 'crowdsignal-forms', __( 'Getting Started', 'crowdsignal-forms' ), __( 'Getting Started', 'crowdsignal-forms' ), 'manage_options', 'crowdsignal-forms-setup', array( $this->setup_page, 'setup_page' ) );
73
- remove_submenu_page( 'crowdsignal-forms', 'crowdsignal-forms' );
 
 
 
 
 
 
 
74
  }
75
 
76
  /**
@@ -82,8 +89,7 @@ class Crowdsignal_Forms_Admin {
82
  public function plugin_action_links( $links ) {
83
  return array_merge(
84
  array(
85
- sprintf( '<a href="%s">' . __( 'Getting Started', 'crowdsignal-forms' ) . '</a>', admin_url( 'admin.php?page=crowdsignal-forms-setup' ) ),
86
- sprintf( '<a href="%s">' . __( 'Settings', 'crowdsignal-forms' ) . '</a>', admin_url( 'admin.php?page=crowdsignal-forms-settings' ) ),
87
  ),
88
  $links
89
  );
66
  * Adds pages to admin menu.
67
  */
68
  public function admin_menu() {
69
+ if (
70
+ isset( $_GET['page'] )
71
+ && ( 'crowdsignal-forms-settings' === $_GET['page'] || 'crowdsignal-forms-setup' === $_GET['page'] )
72
+ ) {
73
+ wp_safe_redirect( admin_url( 'options-general.php?page=crowdsignal-settings' ) );
74
+ die();
75
+ }
76
+
77
+ if ( ! is_plugin_active( 'polldaddy/polldaddy.php' ) ) {
78
+ // Add settings pages.
79
+ add_options_page( 'Crowdsignal', 'Crowdsignal', 'manage_options', 'crowdsignal-settings', array( $this->settings_page, 'output' ) );
80
+ }
81
  }
82
 
83
  /**
89
  public function plugin_action_links( $links ) {
90
  return array_merge(
91
  array(
92
+ sprintf( '<a href="%s">' . __( 'Settings', 'crowdsignal-forms' ) . '</a>', admin_url( 'options-general.php?page=crowdsignal-settings' ) ),
 
93
  ),
94
  $links
95
  );
includes/admin/class-crowdsignal-forms-settings.php CHANGED
@@ -8,7 +8,10 @@
8
 
9
  namespace Crowdsignal_Forms\Admin;
10
 
 
 
11
  use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
 
12
 
13
  if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
@@ -21,6 +24,13 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  */
22
  class Crowdsignal_Forms_Settings {
23
 
 
 
 
 
 
 
 
24
  /**
25
  * Our Settings.
26
  *
@@ -36,13 +46,58 @@ class Crowdsignal_Forms_Settings {
36
  add_action( 'admin_init', array( $this, 'update_settings' ) );
37
 
38
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 12 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
 
41
  /**
42
  * Enqueues scripts for setup page.
43
  */
44
  public function admin_enqueue_scripts() {
45
- wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '1.5.12' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
  /**
@@ -64,6 +119,11 @@ class Crowdsignal_Forms_Settings {
64
  */
65
  protected function init_settings() {
66
 
 
 
 
 
 
67
  $this->settings = apply_filters(
68
  'crowdsignal_forms_settings',
69
  array(
@@ -102,7 +162,7 @@ class Crowdsignal_Forms_Settings {
102
  * Disconnect from Crowdsignal if required.
103
  */
104
  public function update_settings() {
105
- if ( ! isset( $_GET['page'] ) || 'crowdsignal-forms-settings' !== $_GET['page'] ) {
106
  return;
107
  }
108
 
@@ -110,6 +170,49 @@ class Crowdsignal_Forms_Settings {
110
  return;
111
  }
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  if (
114
  isset( $_POST['action'] ) &&
115
  isset( $_POST['crowdsignal_api_key'] ) &&
@@ -121,20 +224,21 @@ class Crowdsignal_Forms_Settings {
121
  $api_key = sanitize_key( wp_unslash( $_POST['crowdsignal_api_key'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
122
  if ( ! empty( $api_key ) && $api_auth_provider->get_user_code_for_key( $api_key ) ) {
123
  $api_auth_provider->set_api_key( $api_key );
124
- wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=api-key-added' ) );
 
125
  } else {
126
- wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=api-key-not-added' ) );
127
  }
128
  } else {
129
- wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=bad-nonce' ) );
130
  }
131
  } elseif ( 'disconnect' === $_POST['action'] ) {
132
  if ( ! wp_verify_nonce( sanitize_key( $_POST['_wpnonce'] ), 'disconnect-api-key' ) ) {
133
- wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=disconnect-failed' ) );
134
  } else {
135
  $api_auth_provider->delete_api_key();
136
  $api_auth_provider->delete_user_code();
137
- wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=disconnected' ) );
138
  }
139
  }
140
  }
@@ -145,95 +249,21 @@ class Crowdsignal_Forms_Settings {
145
  */
146
  public function output() {
147
  $this->init_settings();
 
 
 
 
 
148
  include dirname( __FILE__ ) . '/views/html-admin-setup-header.php';
149
- ?>
150
- <div class="crowdsignal-settings-wrap">
151
-
152
- <div class="crowdsignal-settings__main-content">
153
- <div class="dops-card dops-section-header is-compact">
154
- <div class="dops-section-header__label">
155
- <span class="dops-section-header__label-text">Settings</span>
156
- </div>
157
- </div>
158
-
159
- <div class="dops-card dops-section-header is-compact">
160
-
161
- <div class="crowdsignal-settings__middle">
162
- <div class="crowdsignal-settings__text">
163
- <?php
164
- echo wp_kses_post(
165
- sprintf(
166
- /* translators: %s is a link to the Crowdsignal connection page. */
167
- __( 'To collect responses and data with Crowdsignal Forms you need to <a href="%s" target="_blank">connect the plugin with a Crowdsignal account.</a>', 'crowdsignal-forms' ),
168
- '/wp-admin/admin.php?page=crowdsignal-forms-setup'
169
- )
170
- );
171
- ?>
172
- <br>
173
- <?php esc_html_e( 'You can do this by entering an API key below:', 'crowdsignal-forms' ); ?>
174
- </div>
175
-
176
- <form class="crowdsignal-options" method="post" action="<?php echo esc_url( admin_url( 'admin.php?page=crowdsignal-forms-settings' ) ); ?>">
177
- <?php
178
- // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Used for basic flow.
179
- if ( ! empty( $_GET['settings-updated'] ) ) {
180
- echo '<div class="updated fade crowdsignal-updated"><p>' . esc_html__( 'Settings successfully saved', 'crowdsignal-forms' ) . '</p></div>';
181
- }
182
-
183
- $api_auth_provider = new Crowdsignal_Forms_Api_Authenticator();
184
- ?>
185
- <div id="settings-general" class="settings_panel">
186
- <table class="form-table settings parent-settings">
187
- <tr valign="top" class="">
188
- <th scope="row"><label for="setting-crowdsignal_api_key"><?php esc_html_e( 'Enter Crowdsignal API Key', 'crowdsignal-forms' ); ?></a></th>
189
- <td><input
190
- <?php echo $api_auth_provider->get_api_key() ? 'readonly' : ''; ?>
191
- id="setting-crowdsignal_api_key"
192
- class="regular-text"
193
- type="text"
194
- name="crowdsignal_api_key"
195
- value="<?php echo esc_attr( $api_auth_provider->get_api_key() ); ?>"
196
- />
197
- </td>
198
- </tr>
199
- </table>
200
- </div>
201
-
202
- <div class="crowdsignal-settings__submit">
203
- <?php
204
- if ( $api_auth_provider->get_api_key() ) {
205
- wp_nonce_field( 'disconnect-api-key' );
206
- ?>
207
- <input type="hidden" name="action" value="disconnect" />
208
- <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Disconnect', 'crowdsignal-forms' ); ?>" />
209
- <?php
210
- } else {
211
- wp_nonce_field( 'add-api-key' );
212
- ?>
213
- <input type="hidden" name="action" value="update" />
214
- <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Connect', 'crowdsignal-forms' ); ?>" />
215
- <?php
216
- }
217
- ?>
218
- </div>
219
- </form>
220
-
221
- <div class="crowdsignal-settings__bottom">
222
- <div class="crowdsignal-settings__text">
223
- <?php
224
- if ( ! get_option( Crowdsignal_Forms_Api_Authenticator::API_KEY_NAME ) ) {
225
- esc_html_e( "If you don't have an API key we can help you here: ", 'crowdsignal-forms' );
226
- echo '<a class="button" rel="noopener noreferrer" href="/wp-admin/admin.php?page=crowdsignal-forms-setup">Get an API Key</a>';
227
- }
228
- ?>
229
-
230
- </div>
231
- </div>
232
- </div>
233
- </div>
234
- </div>
235
- </div>
236
- <?php
237
  include dirname( __FILE__ ) . '/views/html-admin-setup-footer.php';
238
  }
239
  }
8
 
9
  namespace Crowdsignal_Forms\Admin;
10
 
11
+ use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices;
12
+ use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Notice_Icon;
13
  use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
14
+ use Crowdsignal_Forms\Crowdsignal_Forms;
15
 
16
  if ( ! defined( 'ABSPATH' ) ) {
17
  exit;
24
  */
25
  class Crowdsignal_Forms_Settings {
26
 
27
+ /**
28
+ * The step in the "Getting Started Process".
29
+ *
30
+ * @var int step.
31
+ */
32
+ private $step = false;
33
+
34
  /**
35
  * Our Settings.
36
  *
46
  add_action( 'admin_init', array( $this, 'update_settings' ) );
47
 
48
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 12 );
49
+
50
+ add_filter( 'crowdsignal_forms_show_admin_notice_' . Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP, array( $this, 'show_setup_notice' ) );
51
+ add_filter( 'crowdsignal_forms_show_admin_notice_' . Crowdsignal_Forms_Admin_Notices::SETUP_SUCCESS, array( $this, 'show_setup_success' ) );
52
+ Crowdsignal_Forms_Admin_Notices::add_notice( Crowdsignal_Forms_Admin_Notices::SETUP_SUCCESS );
53
+ }
54
+
55
+ /**
56
+ * Filter admin notice if the plugin has just finished step 3 successfully.
57
+ *
58
+ * @param bool $show to show the notice or not.
59
+ */
60
+ public function show_setup_success( $show ) {
61
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- readonly, boolean check
62
+ return isset( $_GET['msg'] ) && 'connect' === $_GET['msg'];
63
  }
64
 
65
  /**
66
  * Enqueues scripts for setup page.
67
  */
68
  public function admin_enqueue_scripts() {
69
+ wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '1.5.15' );
70
+ wp_enqueue_script( 'videopress', 'https://videopress.com/videopress-iframe.js', array(), '1.0', false );
71
+ }
72
+
73
+ /**
74
+ * Convenience method to get the icon markup from the Notice_Icon helper class
75
+ *
76
+ * @param string $icon The icon type: warning|success.
77
+ */
78
+ public static function get_icon( $icon ) {
79
+ switch ( $icon ) {
80
+ case 'warning':
81
+ return Crowdsignal_Forms_Notice_Icon::warning();
82
+ case 'success':
83
+ return Crowdsignal_Forms_Notice_Icon::success();
84
+ default:
85
+ return '';
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Hides the "Getting Started" admin notice if the plugin is already connected to Crowdsignal.
91
+ *
92
+ * @param bool $show to show the notice or not.
93
+ */
94
+ public function show_setup_notice( $show ) {
95
+ $api_auth_provider = Crowdsignal_Forms::instance()->get_api_authenticator();
96
+ if ( $api_auth_provider->get_user_code() ) {
97
+ return false;
98
+ } else {
99
+ return true;
100
+ }
101
  }
102
 
103
  /**
119
  */
120
  protected function init_settings() {
121
 
122
+ // we're all done, remove the notice.
123
+ if ( 1 !== $this->step ) {
124
+ Crowdsignal_Forms_Admin_Notices::remove_notice( Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP );
125
+ }
126
+
127
  $this->settings = apply_filters(
128
  'crowdsignal_forms_settings',
129
  array(
162
  * Disconnect from Crowdsignal if required.
163
  */
164
  public function update_settings() {
165
+ if ( ! isset( $_GET['page'] ) || 'crowdsignal-settings' !== $_GET['page'] ) {
166
  return;
167
  }
168
 
170
  return;
171
  }
172
 
173
+ $api_auth_provider = new Crowdsignal_Forms_Api_Authenticator();
174
+
175
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- got_api_key check later
176
+ $this->step = ! empty( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
177
+ if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === $_SERVER['REQUEST_METHOD'] ) {
178
+ if ( 2 === $this->step && isset( $_POST['got_api_key'] ) && isset( $_POST['api_key'] ) && get_option( 'crowdsignal_api_key_secret' ) === $_POST['got_api_key'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
179
+ $api_key = sanitize_key( wp_unslash( $_POST['api_key'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
180
+ $api_auth_provider->set_api_key( $api_key );
181
+ $api_auth_provider->get_user_code_for_key( $api_key );
182
+ delete_option( 'crowdsignal_api_key_secret' );
183
+ include dirname( __FILE__ ) . '/views/html-admin-setup-step-2.php';
184
+ return;
185
+ } else {
186
+ $this->step = 1; // repeat the setup.
187
+ }
188
+ } elseif ( 1 === $this->step ) {
189
+ update_option( 'crowdsignal_api_key_secret', md5( time() . wp_rand() ) );
190
+
191
+ $existing_api_key = $api_auth_provider->get_api_key();
192
+ if ( ! $existing_api_key ) {
193
+ $existing_api_key = get_option( 'polldaddy_api_key' );
194
+ $api_auth_provider->set_api_key( $existing_api_key );
195
+ }
196
+
197
+ if ( $existing_api_key ) {
198
+ $existing_user_code = $api_auth_provider->get_user_code_for_key( $existing_api_key );
199
+
200
+ if ( $existing_user_code ) {
201
+ if ( $api_auth_provider->get_user_code() !== $existing_user_code ) {
202
+ $api_auth_provider->set_user_code( $existing_user_code );
203
+ }
204
+ delete_option( 'crowdsignal_api_key_secret' );
205
+ $this->step = 3;
206
+ } else {
207
+ /**
208
+ * Cached API key may have been deleted on the server.
209
+ * Force reconnection.
210
+ */
211
+ $api_auth_provider->delete_api_key();
212
+ }
213
+ }
214
+ }
215
+
216
  if (
217
  isset( $_POST['action'] ) &&
218
  isset( $_POST['crowdsignal_api_key'] ) &&
224
  $api_key = sanitize_key( wp_unslash( $_POST['crowdsignal_api_key'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
225
  if ( ! empty( $api_key ) && $api_auth_provider->get_user_code_for_key( $api_key ) ) {
226
  $api_auth_provider->set_api_key( $api_key );
227
+
228
+ wp_safe_redirect( admin_url( 'options-general.php?page=crowdsignal-settings&msg=api-key-added' ) );
229
  } else {
230
+ wp_safe_redirect( admin_url( 'options-general.php?page=crowdsignal-settings&msg=api-key-not-added' ) );
231
  }
232
  } else {
233
+ wp_safe_redirect( admin_url( 'options-general.php?page=crowdsignal-settings&msg=bad-nonce' ) );
234
  }
235
  } elseif ( 'disconnect' === $_POST['action'] ) {
236
  if ( ! wp_verify_nonce( sanitize_key( $_POST['_wpnonce'] ), 'disconnect-api-key' ) ) {
237
+ wp_safe_redirect( admin_url( 'options-general.php?page=crowdsignal-settings&msg=disconnect-failed' ) );
238
  } else {
239
  $api_auth_provider->delete_api_key();
240
  $api_auth_provider->delete_user_code();
241
+ wp_safe_redirect( admin_url( 'options-general.php?page=crowdsignal-settings&msg=disconnected' ) );
242
  }
243
  }
244
  }
249
  */
250
  public function output() {
251
  $this->init_settings();
252
+
253
+ $api_auth_provider = new Crowdsignal_Forms_Api_Authenticator();
254
+ $api_key = $api_auth_provider->get_api_key();
255
+ $api_key_name = get_option( Crowdsignal_Forms_Api_Authenticator::API_KEY_NAME );
256
+
257
  include dirname( __FILE__ ) . '/views/html-admin-setup-header.php';
258
+
259
+ if ( ! $api_key ) {
260
+ include dirname( __FILE__ ) . '/views/html-admin-setup-step-1.php';
261
+ } else {
262
+ include dirname( __FILE__ ) . '/views/html-admin-settings.php';
263
+ include dirname( __FILE__ ) . '/views/html-admin-setup-step-3.php';
264
+ include dirname( __FILE__ ) . '/views/html-admin-dashboard-teaser.php';
265
+ }
266
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  include dirname( __FILE__ ) . '/views/html-admin-setup-footer.php';
268
  }
269
  }
includes/admin/class-crowdsignal-forms-setup.php CHANGED
@@ -23,6 +23,8 @@ if ( ! defined( 'ABSPATH' ) ) {
23
  */
24
  class Crowdsignal_Forms_Setup {
25
 
 
 
26
  /**
27
  * Constructor.
28
  */
@@ -65,7 +67,7 @@ class Crowdsignal_Forms_Setup {
65
  * Enqueues scripts for setup page.
66
  */
67
  public function admin_enqueue_scripts() {
68
- wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '1.5.12' );
69
  wp_enqueue_script( 'videopress', 'https://videopress.com/videopress-iframe.js', array(), '1.0', false );
70
  }
71
 
@@ -77,17 +79,17 @@ class Crowdsignal_Forms_Setup {
77
  $api_authenticator = Crowdsignal_Forms::instance()->get_api_authenticator();
78
 
79
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- got_api_key check later
80
- $step = ! empty( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
81
  if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === $_SERVER['REQUEST_METHOD'] ) {
82
- if ( 2 === $step && isset( $_POST['got_api_key'] ) && isset( $_POST['api_key'] ) && get_option( 'crowdsignal_api_key_secret' ) === $_POST['got_api_key'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
83
  $api_key = sanitize_key( wp_unslash( $_POST['api_key'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
84
  $api_authenticator->set_api_key( $api_key );
85
  $api_authenticator->get_user_code_for_key( $api_key );
86
  delete_option( 'crowdsignal_api_key_secret' );
87
  } else {
88
- $step = 1; // repeat the setup.
89
  }
90
- } elseif ( 1 === $step ) {
91
  update_option( 'crowdsignal_api_key_secret', md5( time() . wp_rand() ) );
92
 
93
  $existing_api_key = $api_authenticator->get_api_key();
@@ -104,7 +106,7 @@ class Crowdsignal_Forms_Setup {
104
  $api_authenticator->set_user_code( $existing_user_code );
105
  }
106
  delete_option( 'crowdsignal_api_key_secret' );
107
- $step = 3;
108
  } else {
109
  /**
110
  * Cached API key may have been deleted on the server.
@@ -116,11 +118,9 @@ class Crowdsignal_Forms_Setup {
116
  }
117
 
118
  // we're all done, remove the notice.
119
- if ( 1 !== $step ) {
120
  Crowdsignal_Forms_Admin_Notices::remove_notice( Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP );
121
  }
122
-
123
- $this->output( $step );
124
  }
125
 
126
  /**
@@ -141,16 +141,18 @@ class Crowdsignal_Forms_Setup {
141
 
142
  /**
143
  * Displays setup page.
144
- *
145
- * @param int $step the step shown to the user.
146
  */
147
- public function output( $step ) {
 
 
 
 
148
  include dirname( __FILE__ ) . '/views/html-admin-setup-header.php';
149
- if ( 1 === $step ) {
150
  include dirname( __FILE__ ) . '/views/html-admin-setup-step-1.php';
151
- } elseif ( 2 === $step ) {
152
  include dirname( __FILE__ ) . '/views/html-admin-setup-step-2.php';
153
- } elseif ( 3 === $step ) {
154
  include dirname( __FILE__ ) . '/views/html-admin-setup-step-3.php';
155
  }
156
  include dirname( __FILE__ ) . '/views/html-admin-setup-footer.php';
23
  */
24
  class Crowdsignal_Forms_Setup {
25
 
26
+ private $step = false;
27
+
28
  /**
29
  * Constructor.
30
  */
67
  * Enqueues scripts for setup page.
68
  */
69
  public function admin_enqueue_scripts() {
70
+ wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '1.5.15' );
71
  wp_enqueue_script( 'videopress', 'https://videopress.com/videopress-iframe.js', array(), '1.0', false );
72
  }
73
 
79
  $api_authenticator = Crowdsignal_Forms::instance()->get_api_authenticator();
80
 
81
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- got_api_key check later
82
+ $this->step = ! empty( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
83
  if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === $_SERVER['REQUEST_METHOD'] ) {
84
+ if ( 2 === $this->step && isset( $_POST['got_api_key'] ) && isset( $_POST['api_key'] ) && get_option( 'crowdsignal_api_key_secret' ) === $_POST['got_api_key'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
85
  $api_key = sanitize_key( wp_unslash( $_POST['api_key'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
86
  $api_authenticator->set_api_key( $api_key );
87
  $api_authenticator->get_user_code_for_key( $api_key );
88
  delete_option( 'crowdsignal_api_key_secret' );
89
  } else {
90
+ $this->step = 1; // repeat the setup.
91
  }
92
+ } elseif ( 1 === $this->step ) {
93
  update_option( 'crowdsignal_api_key_secret', md5( time() . wp_rand() ) );
94
 
95
  $existing_api_key = $api_authenticator->get_api_key();
106
  $api_authenticator->set_user_code( $existing_user_code );
107
  }
108
  delete_option( 'crowdsignal_api_key_secret' );
109
+ $this->step = 3;
110
  } else {
111
  /**
112
  * Cached API key may have been deleted on the server.
118
  }
119
 
120
  // we're all done, remove the notice.
121
+ if ( 1 !== $this->step ) {
122
  Crowdsignal_Forms_Admin_Notices::remove_notice( Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP );
123
  }
 
 
124
  }
125
 
126
  /**
141
 
142
  /**
143
  * Displays setup page.
 
 
144
  */
145
+ public function output() {
146
+
147
+ if ( false === $this->step ) {
148
+ $this->setup_page();
149
+ }
150
  include dirname( __FILE__ ) . '/views/html-admin-setup-header.php';
151
+ if ( 1 === $this->step ) {
152
  include dirname( __FILE__ ) . '/views/html-admin-setup-step-1.php';
153
+ } elseif ( 2 === $this->step ) {
154
  include dirname( __FILE__ ) . '/views/html-admin-setup-step-2.php';
155
+ } elseif ( 3 === $this->step ) {
156
  include dirname( __FILE__ ) . '/views/html-admin-setup-step-3.php';
157
  }
158
  include dirname( __FILE__ ) . '/views/html-admin-setup-footer.php';
includes/admin/views/html-admin-dashboard-teaser.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File containing the view for step 3 of the setup wizard.
4
+ *
5
+ * @package Crowdsignal_Forms\Admin
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+ ?>
12
+ <br />
13
+ <div class='cs-settings-container'>
14
+ <div class="cs-card cs-section-header is-compact">
15
+ <div class="cs-section-header__label">
16
+ <span class="cs-section-header__label-text"><?php esc_html_e( 'Manage your Crowdsignal projects inside WordPress', 'crowdsignal-forms' ); ?></span>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="cs-card cs-section-header is-compact">
21
+ <div class="cs-form-settings-group" style='width: 100%'>
22
+ <h2><?php echo wp_kses_post( __( 'The Crowdsignal Dashboard plugin', 'crowdsignal-forms' ) ); ?></h2>
23
+ <div class="crowdsignal-setup__middle">
24
+ <p>
25
+ <?php
26
+ printf(
27
+ /* translators: Placeholder is the text "second plugin". */
28
+ esc_html__( 'We have a %s for you that allows you to manage all your Crowdsignal projects right in WP-Admin. Get an overview of all your active projects and get easy access to your results pages.', 'crowdsignal-forms' ),
29
+ sprintf(
30
+ '<a href="https://wordpress.org/plugins/polldaddy/">%s</a>',
31
+ esc_html__( 'second plugin', 'crowdsignal-forms' )
32
+ )
33
+ );
34
+ ?>
35
+ </p>
36
+
37
+ <a href="<?php echo esc_url( admin_url( 'plugin-install.php?s=crowdsignal+polls+ratings&tab=search&type=term' ) ); ?>"><img id='crowdsignal__teaser_img' src='<?php echo esc_url( plugins_url( 'crowdsignal-forms/images/cs_dashboard_teaser.png' ) ); ?>' /></a>
38
+ <p>
39
+ <?php
40
+ echo wp_kses_post(
41
+ sprintf(
42
+ // translators: Argument is a link to Crowdsignal's contact page.
43
+ __(
44
+ 'Do you want to know more about Crowdsignal? <a href="%1s" target="_blank">Learn more</a>.',
45
+ 'crowdsignal-forms'
46
+ ),
47
+ 'https://crowdsignal.com/support/'
48
+ )
49
+ );
50
+ ?>
51
+ </p>
52
+ <p>
53
+ <?php
54
+ printf(
55
+ /* translators: Placeholder is the text "website plugins page". */
56
+ esc_html__( 'Install the Crowdsignal Dashboard plugin directly from your %s.', 'crowdsignal-forms' ),
57
+ sprintf(
58
+ '<a href="' . esc_url( admin_url( 'plugin-install.php?s=crowdsignal+polls+ratings&tab=search&type=term' ) ) . '">%s</a>',
59
+ esc_html__( 'website plugins page', 'crowdsignal-forms' )
60
+ )
61
+ );
62
+ ?>
63
+ </p>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
includes/admin/views/html-admin-notice-core-setup.php CHANGED
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) {
18
  ?>
19
  </p>
20
  <p class="submit">
21
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=crowdsignal-forms-setup' ) ); ?>" class="button-primary"><?php esc_html_e( "Let's Get Started", 'crowdsignal-forms' ); ?></a>
22
  <a class="button-secondary skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'crowdsignal_forms_hide_notice', Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP ), 'crowdsignal_forms_hide_notices_nonce', '_crowdsignal_forms_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'crowdsignal-forms' ); ?></a>
23
  </p>
24
  </div>
18
  ?>
19
  </p>
20
  <p class="submit">
21
+ <a href="<?php echo esc_url( admin_url( 'options-general.php?page=crowdsignal-settings#setup' ) ); ?>" class="button-primary"><?php esc_html_e( "Let's Get Started", 'crowdsignal-forms' ); ?></a>
22
  <a class="button-secondary skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'crowdsignal_forms_hide_notice', Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP ), 'crowdsignal_forms_hide_notices_nonce', '_crowdsignal_forms_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'crowdsignal-forms' ); ?></a>
23
  </p>
24
  </div>
includes/admin/views/html-admin-settings.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File containing the view used in the settings page.
4
+ *
5
+ * @package Crowdsignal_Forms\Admin
6
+ */
7
+
8
+ ?>
9
+ <div class='cs-settings-container'>
10
+ <div class="cs-card cs-section-header is-compact">
11
+ <div class="cs-section-header__label">
12
+ <span class="cs-section-header__label-text"><?php esc_html_e( 'Account Settings', 'crowdsignal-forms' ); ?></span>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="cs-card cs-section-header is-compact">
17
+ <div class="cs-form-settings-group">
18
+ <h2><?php esc_html_e( 'API Key', 'crowdsignal-forms' ); ?></h2>
19
+ <p>
20
+ <?php
21
+ printf(
22
+ /* translators: Placeholder is the text "Crowdsignal". */
23
+ esc_html__( 'Your website is connected to a %s account to collect responses and data from your visitors.', 'crowdsignal-forms' ),
24
+ '<a href="https://crowdsignal.com/">Crowdsignal</a>'
25
+ );
26
+ ?><br /><?php
27
+ printf(
28
+ /* translators: Placeholder is the text "Crowdsignal acount page". */
29
+ esc_html__( 'Visit your %s to find out more about your settings.', 'crowdsignal-forms' ),
30
+ sprintf(
31
+ '<a href="https://crowdsignal.com/account/">%s</a>',
32
+ esc_html__( 'Crowdsignal account page', 'crowdsignal-forms' )
33
+ )
34
+ );
35
+ ?>
36
+ </p>
37
+ <?php if ( ! $api_key ) { ?>
38
+ <p><?php esc_html_e( 'If you have a Crowdsignal account, click the "Get API Key" button to connect. This will open a new window.', 'crowdsignal-forms' ); ?>
39
+ <form id="cs-connect-form" class="crowdsignal-options" method="post" action="https://app.crowdsignal.com/get-api-key/" target="CSCONNECT">
40
+ <input type="hidden" name="get_api_key" value="<?php echo esc_attr( get_option( 'crowdsignal_api_key_secret' ) ); ?>" />
41
+ <input type="hidden" name="ref" value="<?php echo esc_attr( admin_url( 'options-general.php?page=crowdsignal-settings' ) ); ?>" />
42
+ <input type="submit" value="<?php esc_html_e( 'Get API Key', 'crowdsignal-forms' ); ?>" class="cs-button is-primary" />
43
+ </form></p>
44
+ <?php } ?>
45
+ <form class="crowdsignal-options" method="post" action="<?php echo esc_url( admin_url( 'options-general.php?page=crowdsignal-settings' ) ); ?>">
46
+ <?php
47
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Used for basic flow.
48
+ if ( ! empty( $_GET['settings-updated'] ) ) {
49
+ echo '<div class="updated fade crowdsignal-updated"><p>' . esc_html__( 'Settings successfully saved', 'crowdsignal-forms' ) . '</p></div>';
50
+ }
51
+
52
+ ?>
53
+ <div id="settings-general" class="settings_panel">
54
+ <table class="form-table settings parent-settings">
55
+ <tr valign="top" class="">
56
+ <th scope="row"><label for="setting-crowdsignal_api_key"><?php esc_html_e( 'Your Crowdsignal API Key', 'crowdsignal-forms' ); ?></a></th>
57
+ <td><input
58
+ <?php echo $api_key ? 'readonly' : ''; ?>
59
+ id="setting-crowdsignal_api_key"
60
+ class="regular-text"
61
+ type="text"
62
+ name="crowdsignal_api_key"
63
+ value="<?php echo esc_attr( $api_key ); ?>"
64
+ />
65
+ </td>
66
+ </tr>
67
+ </table>
68
+ </div>
69
+
70
+ <div class="crowdsignal-settings__submit">
71
+ <?php
72
+ if ( $api_key ) {
73
+ wp_nonce_field( 'disconnect-api-key' );
74
+ ?>
75
+ <input type="hidden" name="action" value="disconnect" />
76
+ <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Disconnect', 'crowdsignal-forms' ); ?>" />
77
+ <?php
78
+ } else {
79
+ wp_nonce_field( 'add-api-key' );
80
+ ?>
81
+ <input type="hidden" name="action" value="update" />
82
+ <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Connect', 'crowdsignal-forms' ); ?>" />
83
+ <?php
84
+ }
85
+ ?>
86
+ </div>
87
+ </form></p>
88
+ </div>
89
+ </div>
90
+ </div>
91
+
92
+ <script>
93
+ let CSCONNECT = null;
94
+ const showConnect = ( title ) => {
95
+ // window size, match standard iPhone screen size
96
+ const widthRatio = 1/2;
97
+ const heightRatio = 3/4;
98
+
99
+ // Fixes dual-screen position
100
+ const dualScreenLeft = window.screenLeft !== undefined
101
+ ? window.screenLeft // Most browsers
102
+ : window.screenX; // Firefox
103
+ const dualScreenTop = window.screenTop !== undefined
104
+ ? window.screenTop // Most browsers
105
+ : window.screenY; // Firefox
106
+
107
+ const width = window.innerWidth
108
+ ? window.innerWidth
109
+ : document.documentElement.clientWidth
110
+ ? document.documentElement.clientWidth
111
+ : screen.width;
112
+ const height = window.innerHeight
113
+ ? window.innerHeight
114
+ : document.documentElement.clientHeight
115
+ ? document.documentElement.clientHeight
116
+ : screen.height;
117
+
118
+ const popupWidth = width * widthRatio;
119
+ const popupHeight = height * heightRatio;
120
+
121
+ const left = ( (width / 2 ) - ( popupWidth / 2 ) ) + dualScreenLeft;
122
+ const top = ( (height / 2 ) - ( popupHeight / 2 ) ) + dualScreenTop;
123
+
124
+ CSCONNECT = window.open( 'about:blank', title,
125
+ `
126
+ location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no,
127
+ width=${ parseInt( popupWidth, 10 ) },
128
+ height=${ parseInt( popupHeight, 10 ) },
129
+ top=${ parseInt( top, 10 ) },
130
+ left=${ parseInt( left, 10 ) }
131
+ `
132
+ )
133
+
134
+ if ( window.focus ) CSCONNECT.focus();
135
+ }
136
+ ( function( form ) {
137
+ form.onsubmit = function() {
138
+ showConnect( 'CSCONNECT' );
139
+ }
140
+ } )( document.getElementById( 'cs-connect-form' ) );
141
+ </script>
includes/admin/views/html-admin-setup-footer.php CHANGED
@@ -10,21 +10,23 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  }
11
  ?>
12
 
13
- <div class="crowdsignal-setup__footer">
14
- <div class="crowdsignal-setup__footer-container">
15
- <a href="#">
16
- <svg role="img" class="crowdsignal-setup__footer-attr" x="0" y="0" viewBox="0 0 935 38.2" enable-background="new 0 0 935 38.2" aria-labelledby="a8c-svg-title">
 
 
 
17
  <title id="a8c-svg-title">An Automattic Adventure</title>
18
  <path d="M317.1 38.2c-12.6 0-20.7-9.1-20.7-18.5v-1.2c0-9.6 8.2-18.5 20.7-18.5 12.6 0 20.8 8.9 20.8 18.5v1.2C337.9 29.1 329.7 38.2 317.1 38.2zM331.2 18.6c0-6.9-5-13-14.1-13s-14 6.1-14 13v0.9c0 6.9 5 13.1 14 13.1s14.1-6.2 14.1-13.1V18.6zM175 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7L157 1.3h5.5L182 36.8H175zM159.7 8.2L152 23.1h15.7L159.7 8.2zM212.4 38.2c-12.7 0-18.7-6.9-18.7-16.2V1.3h6.6v20.9c0 6.6 4.3 10.5 12.5 10.5 8.4 0 11.9-3.9 11.9-10.5V1.3h6.7V22C231.4 30.8 225.8 38.2 212.4 38.2zM268.6 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H268.6zM397.3 36.8V8.7l-1.8 3.1 -14.9 25h-3.3l-14.7-25 -1.8-3.1v28.1h-6.5V1.3h9.2l14 24.4 1.7 3 1.7-3 13.9-24.4h9.1v35.5H397.3zM454.4 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7l19.2-35.5h5.5l19.5 35.5H454.4zM439.1 8.2l-7.7 14.9h15.7L439.1 8.2zM488.4 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H488.4zM537.3 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H537.3zM569.3 36.8V4.6c2.7 0 3.7-1.4 3.7-3.4h2.8v35.5L569.3 36.8 569.3 36.8zM628 11.3c-3.2-2.9-7.9-5.7-14.2-5.7 -9.5 0-14.8 6.5-14.8 13.3v0.7c0 6.7 5.4 13 15.3 13 5.9 0 10.8-2.8 13.9-5.7l4 4.2c-3.9 3.8-10.5 7.1-18.3 7.1 -13.4 0-21.6-8.7-21.6-18.3v-1.2c0-9.6 8.9-18.7 21.9-18.7 7.5 0 14.3 3.1 18 7.1L628 11.3zM321.5 12.4c1.2 0.8 1.5 2.4 0.8 3.6l-6.1 9.4c-0.8 1.2-2.4 1.6-3.6 0.8l0 0c-1.2-0.8-1.5-2.4-0.8-3.6l6.1-9.4C318.7 11.9 320.3 11.6 321.5 12.4L321.5 12.4z"></path>
19
  </svg>
20
  </a>
21
  </div>
22
- <ul class="crowdsignal-setup__footer-links">
23
- <li class="crowdsignal-setup__footer-item"><a href="https://crowdsignal.com" target="_blank" rel="noopener noreferrer" class="crowdsignal-setup__footer-link" title="Crowdsignal">Crowdsignal.com</a></li>
24
- <li class="crowdsignal-setup__footer-item"><a href="https://crowdsignal.com/support" target="_blank" rel="noopener noreferrer" class="crowdsignal-setup__footer-link" title="<?php esc_html_e( 'Crowdsignal Support', 'crowdsignal-forms' ); ?>"><?php esc_html_e( 'Support', 'crowdsignal-forms' ); ?></a></li>
25
- <li class="crowdsignal-setup__footer-item"><a href="https://crowdsignal.com/terms/" target="_blank" rel="noopener noreferrer" title="<?php esc_attr_e( 'Terms of Service', 'crowdsignal-forms' ); ?>" class="crowdsignal-setup__footer-link"><?php esc_html_e( 'Terms', 'crowdsignal-forms' ); ?></a></li>
26
- <li class="crowdsignal-setup__footer-item"><a href="https://automattic.com/privacy/" target="_blank" rel="noopener noreferrer" title="<?php esc_attr_e( 'Privacy Policy', 'crowdsignal-forms' ); ?>" class="crowdsignal-setup__footer-link"><?php esc_html_e( 'Privacy', 'crowdsignal-forms' ); ?></a></li>
27
  </ul>
28
- </div>
29
 
30
  </div> <!--.wrap-->
10
  }
11
  ?>
12
 
13
+ </div>
14
+ </div>
15
+ </div>
16
+ <div class="cs-footer">
17
+ <div class="cs-footer__a8c-attr-container">
18
+ <a href="https://automattic.com/">
19
+ <svg role="img" class="cs-footer__a8c-attr" x="0" y="0" viewBox="0 0 935 38.2" enable-background="new 0 0 935 38.2" aria-labelledby="a8c-svg-title">
20
  <title id="a8c-svg-title">An Automattic Adventure</title>
21
  <path d="M317.1 38.2c-12.6 0-20.7-9.1-20.7-18.5v-1.2c0-9.6 8.2-18.5 20.7-18.5 12.6 0 20.8 8.9 20.8 18.5v1.2C337.9 29.1 329.7 38.2 317.1 38.2zM331.2 18.6c0-6.9-5-13-14.1-13s-14 6.1-14 13v0.9c0 6.9 5 13.1 14 13.1s14.1-6.2 14.1-13.1V18.6zM175 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7L157 1.3h5.5L182 36.8H175zM159.7 8.2L152 23.1h15.7L159.7 8.2zM212.4 38.2c-12.7 0-18.7-6.9-18.7-16.2V1.3h6.6v20.9c0 6.6 4.3 10.5 12.5 10.5 8.4 0 11.9-3.9 11.9-10.5V1.3h6.7V22C231.4 30.8 225.8 38.2 212.4 38.2zM268.6 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H268.6zM397.3 36.8V8.7l-1.8 3.1 -14.9 25h-3.3l-14.7-25 -1.8-3.1v28.1h-6.5V1.3h9.2l14 24.4 1.7 3 1.7-3 13.9-24.4h9.1v35.5H397.3zM454.4 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7l19.2-35.5h5.5l19.5 35.5H454.4zM439.1 8.2l-7.7 14.9h15.7L439.1 8.2zM488.4 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H488.4zM537.3 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H537.3zM569.3 36.8V4.6c2.7 0 3.7-1.4 3.7-3.4h2.8v35.5L569.3 36.8 569.3 36.8zM628 11.3c-3.2-2.9-7.9-5.7-14.2-5.7 -9.5 0-14.8 6.5-14.8 13.3v0.7c0 6.7 5.4 13 15.3 13 5.9 0 10.8-2.8 13.9-5.7l4 4.2c-3.9 3.8-10.5 7.1-18.3 7.1 -13.4 0-21.6-8.7-21.6-18.3v-1.2c0-9.6 8.9-18.7 21.9-18.7 7.5 0 14.3 3.1 18 7.1L628 11.3zM321.5 12.4c1.2 0.8 1.5 2.4 0.8 3.6l-6.1 9.4c-0.8 1.2-2.4 1.6-3.6 0.8l0 0c-1.2-0.8-1.5-2.4-0.8-3.6l6.1-9.4C318.7 11.9 320.3 11.6 321.5 12.4L321.5 12.4z"></path>
22
  </svg>
23
  </a>
24
  </div>
25
+ <ul class="cs-footer__links">
26
+ <li class="cs-footer__link-item"><a href="https://crowdsignal.com" target="_blank" rel="noopener noreferrer" class="cs-footer__link" title="Crowdsignal">Crowdsignal.com</a></li>
27
+ <li class="cs-footer__link-item"><a href="https://crowdsignal.com/support" target="_blank" rel="noopener noreferrer" class="cs-footer__link" title="<?php esc_html_e( 'Crowdsignal Support', 'crowdsignal-forms' ); ?>"><?php esc_html_e( 'Support', 'crowdsignal-forms' ); ?></a></li>
28
+ <li class="cs-footer__link-item"><a href="https://crowdsignal.com/terms/" target="_blank" rel="noopener noreferrer" title="<?php esc_attr_e( 'Terms of Service', 'crowdsignal-forms' ); ?>" class="cs-footer__link"><?php esc_html_e( 'Terms', 'crowdsignal-forms' ); ?></a></li>
29
+ <li class="cs-footer__link-item"><a href="https://automattic.com/privacy/" target="_blank" rel="noopener noreferrer" title="<?php esc_attr_e( 'Privacy Policy', 'crowdsignal-forms' ); ?>" class="cs-footer__link"><?php esc_html_e( 'Privacy', 'crowdsignal-forms' ); ?></a></li>
30
  </ul>
 
31
 
32
  </div> <!--.wrap-->
includes/admin/views/html-admin-setup-header.php CHANGED
@@ -9,31 +9,10 @@ if ( ! defined( 'ABSPATH' ) ) {
9
  exit;
10
  }
11
  ?>
12
- <div class="wrap">
13
- <div class="crowdsignal-setup__header">
14
- <div class="crowdsignal-setup__header-container">
15
- <div class="crowdsignal-setup__logo-container">
16
- <div class="crowdsignal-setup__logo">
17
- <svg width="199" height="48" viewBox="0 0 199 48" fill="none" xmlns="http://www.w3.org/2000/svg">
18
- <path fill-rule="evenodd" clip-rule="evenodd" d="M23.9981 45.1199C35.6624 45.1199 45.1181 35.6641 45.1181 23.9999C45.1181 12.3356 35.6624 2.87988 23.9981 2.87988C12.3339 2.87988 2.87811 12.3356 2.87811 23.9999C2.87811 35.6641 12.3339 45.1199 23.9981 45.1199Z" fill="white" stroke="#384869" stroke-linecap="round" stroke-dasharray="0.1 2"/>
19
- <path fill-rule="evenodd" clip-rule="evenodd" d="M11.0812 24.8962V17.3437C11.0812 16.4769 11.1073 15.9362 11.1595 15.7045C11.2117 15.4728 11.316 15.2496 11.5768 15.0694C11.8812 14.8463 12.2811 14.769 13.2897 14.769C14.1417 14.769 14.6025 14.8892 14.8373 15.0951C15.0807 15.3097 15.2199 15.7217 15.2199 16.3139V17.9102L14.5938 18.159V16.2967C14.5938 15.8676 14.5417 15.653 14.3765 15.5071C14.22 15.3612 13.9331 15.3183 13.2636 15.3183C12.4028 15.3183 12.1854 15.3869 12.0029 15.5157C11.7681 15.6873 11.7073 16.022 11.7073 16.6657V25.4626C11.7073 26.1063 11.7681 26.441 12.0029 26.6127C12.1854 26.7414 12.5767 26.8101 13.2636 26.8101C13.9331 26.8101 14.22 26.7672 14.3765 26.6212C14.5417 26.4753 14.5938 26.2608 14.5938 25.8316V23.8405L15.2199 23.5917V25.8145C15.2199 26.4153 15.0807 26.8186 14.8373 27.0332C14.6025 27.2392 14.1417 27.3593 13.2897 27.3593C12.455 27.3593 11.8812 27.2821 11.5768 27.0675C11.316 26.8787 11.2117 26.6641 11.1595 26.4238C11.1073 26.2093 11.0812 25.6944 11.0812 24.8962Z" fill="#4CCEE4"/>
20
- <path fill-rule="evenodd" clip-rule="evenodd" d="M18.5086 19.5755H16.8294V15.3203H18.7291C19.1446 15.3203 19.4329 15.3806 19.5602 15.5357C19.6704 15.6735 19.7468 15.9405 19.7468 16.3539V18.6452C19.7468 18.9897 19.645 19.2223 19.4923 19.3601C19.3227 19.5066 18.9835 19.5755 18.5086 19.5755ZM20.1623 19.4548C20.2725 19.2912 20.3574 19.0242 20.3574 18.6538V16.2075C20.3574 15.7079 20.2132 15.3462 19.9927 15.1308C19.7552 14.8896 19.3142 14.769 18.7206 14.769H16.2188V26.5009L16.8294 26.2511V20.1268H18.7969C19.3566 20.1268 19.645 20.4454 19.645 21.1001V25.1399L20.2556 24.8901V20.9536C20.2556 20.2732 19.9673 19.9114 19.3821 19.8683V19.8511C19.7552 19.7908 20.0266 19.6616 20.1623 19.4548Z" fill="#4CCEE4"/>
21
- <path fill-rule="evenodd" clip-rule="evenodd" d="M24.5846 21.5327C24.5846 22.1027 24.5326 22.426 24.3243 22.6047C24.1333 22.7663 23.8122 22.8088 23.2829 22.8088C22.7535 22.8088 22.4324 22.7663 22.2414 22.6047C22.0332 22.426 21.9811 22.1027 21.9811 21.5327V16.5897C21.9811 16.0197 22.0332 15.6964 22.2414 15.5177C22.4324 15.356 22.7535 15.3135 23.2829 15.3135C23.8122 15.3135 24.1333 15.356 24.3243 15.5177C24.5326 15.6964 24.5846 16.0197 24.5846 16.5897V21.5327ZM24.8103 15.1178C24.4892 14.8371 23.9598 14.769 23.2829 14.769C22.606 14.769 22.0765 14.8371 21.7555 15.1178C21.4778 15.3475 21.3563 15.7304 21.3563 16.36V21.7624C21.3563 22.392 21.4778 22.7748 21.7555 23.0045C22.0765 23.2853 22.606 23.3533 23.2829 23.3533C23.9598 23.3533 24.4892 23.2853 24.8103 23.0045C25.0879 22.7748 25.2095 22.392 25.2095 21.7624V16.36C25.2095 15.7304 25.0879 15.3475 24.8103 15.1178Z" fill="#4CCEE4"/>
22
- <path fill-rule="evenodd" clip-rule="evenodd" d="M27.5965 22.0657L25.7812 14.769H26.432L27.999 21.1666L29.5403 14.769H30.5078L31.9635 19.7401L33.2822 14.769H33.9158L32.4601 20.1464L31.5268 20.5095L30.0369 15.3396L28.4785 21.7112L27.5965 22.0657Z" fill="#4CCEE4"/>
23
- <path fill-rule="evenodd" clip-rule="evenodd" d="M35.7824 18.0921H34.9849V15.3089H35.7824C36.5097 15.3089 36.7375 15.604 36.7375 16.7005C36.7375 17.7885 36.5097 18.0921 35.7824 18.0921ZM35.6422 14.769H34.3453V18.632H35.6422C37.053 18.632 37.3422 18.0921 37.3422 16.7005C37.3422 15.3004 37.053 14.769 35.6422 14.769Z" fill="#4CCEE4"/>
24
- <path fill-rule="evenodd" clip-rule="evenodd" d="M16.7906 27.5999L17.3614 27.3594V33.5114H16.7906V27.5999Z" fill="#384869"/>
25
- <path fill-rule="evenodd" clip-rule="evenodd" d="M30.8547 28.4545L31.7639 23.1137L32.6646 28.4545H30.8547ZM32.1134 21.6362L31.4389 21.9089L29.3484 33.5102L30.0119 33.5111L30.7613 29.0041H32.7581L33.5358 33.5111H34.2006L32.1134 21.6362Z" fill="#384869"/>
26
- <path fill-rule="evenodd" clip-rule="evenodd" d="M35.8345 32.9636V22.2515V22.1157V20.2056L35.1984 20.4537V22.1157V22.2515V33.5112H37.3391V32.9636H35.8345Z" fill="#384869"/>
27
- <path fill-rule="evenodd" clip-rule="evenodd" d="M27.7402 23.4135L27.7853 29.284L27.8078 32.6993L26.5472 29.7696L24.5757 24.7024L23.639 25.0776V29.7696V29.7999V33.5116H24.2521V29.7999V29.7696V25.5211L25.8655 29.7696L27.4698 33.5116H28.3485V29.284V23.2104L27.7402 23.4135Z" fill="#384869"/>
28
- <path fill-rule="evenodd" clip-rule="evenodd" d="M14.4219 31.1488V31.1487C14.2634 31.1486 14.1051 31.1486 13.9468 31.1486V31.1485C13.1929 31.1485 13.1655 31.1485 13.1383 31.1485C12.8903 31.1485 12.6651 31.1484 12.424 31.1484C11.856 31.1471 11.6428 31.1094 11.6428 30.4895C11.6428 29.9985 11.8088 29.9071 12.424 29.9006C12.688 29.9004 12.9521 29.9002 13.8863 29.9002C14.0627 29.9001 14.2408 29.9001 14.4219 29.9C15.0349 29.9017 15.1951 30.0672 15.1951 30.5415V30.611L15.7056 30.4028C15.6554 29.6702 15.3991 29.3732 14.4219 29.3629V29.3626C14.2417 29.3626 14.0665 29.3624 13.8863 29.3623C13.1928 29.3623 13.1659 29.3623 13.1383 29.3623C12.894 29.3623 12.6572 29.3625 12.4156 29.3626V29.3627C11.5506 29.37 11.0812 29.5968 11.0812 30.637C11.0812 31.6764 11.7439 31.6863 12.4156 31.6862H13.856H13.9468C14.1038 31.6862 14.2475 31.6864 14.4017 31.6864C14.98 31.6893 15.2291 31.799 15.2291 32.4405C15.2291 32.9597 15.1 33.1064 14.4017 33.1159C14.2177 33.116 14.0373 33.1162 13.856 33.1163C12.9479 33.1166 12.6893 33.1167 12.4156 33.1168V33.1169C11.7956 33.1165 11.5917 32.9083 11.5917 32.3451V32.2758L11.0812 32.4839C11.1316 33.304 11.4303 33.6441 12.4156 33.6539V33.6541C12.6578 33.6542 12.8921 33.6544 13.1383 33.6544C13.1658 33.6544 13.1928 33.6544 13.9166 33.6544V33.6544C14.0859 33.6543 14.2525 33.6542 14.4219 33.6541V33.6538C15.3635 33.6428 15.7907 33.3317 15.7907 32.2931C15.7907 31.2534 15.0954 31.1532 14.4219 31.1488Z" fill="#384869"/>
29
- <path fill-rule="evenodd" clip-rule="evenodd" d="M22.3547 27.7945V27.5274C22.3547 26.7263 21.9104 26.501 20.9381 26.501C20.9031 26.501 20.8689 26.5013 20.8349 26.5018C20.6928 26.5021 20.5528 26.5026 20.4133 26.503V26.5031C19.8616 26.5031 19.8466 26.5032 19.8322 26.5032C19.0096 26.5247 18.5015 26.7263 18.5015 27.7194V28.3739V30.5141V31.8367V31.903V32.3849C18.5015 33.0924 18.8059 33.4817 19.8322 33.5094C19.8467 33.5094 19.8615 33.5095 20.4133 33.5095C20.5524 33.5101 20.6914 33.5107 20.8349 33.5109C20.8525 33.5111 20.8698 33.5115 20.8878 33.5115C21.8434 33.5115 22.3547 33.3112 22.3547 32.3432V31.3731V31.3068V30.5141V30.4845V29.6611H20.8543V30.1952H21.7512V30.4845V30.5141V30.9299V31.3068V31.3731V32.2847C21.7512 32.8856 21.5752 32.9774 20.9045 32.9774C20.8804 32.9774 20.8579 32.9769 20.8349 32.9766C20.6995 32.9763 20.5715 32.9757 20.4432 32.9751V32.9749C19.8616 32.9749 19.847 32.9748 19.8322 32.9748C19.307 32.9577 19.1051 32.8226 19.1051 32.1679V31.903V31.8367V30.9299V30.5141V28.3739V27.8529C19.1051 27.1931 19.2212 27.0559 19.8322 27.0379C19.847 27.0379 19.8616 27.0378 20.4432 27.0377V27.0376C20.5713 27.037 20.6978 27.0364 20.8349 27.0361C20.8684 27.0356 20.9019 27.0351 20.9381 27.0351C21.5081 27.0351 21.8015 27.0685 21.8015 27.5441V28.0031L22.3547 27.7945Z" fill="#384869"/>
30
- <path d="M66.0459 32.2578C69.709 32.2578 72.2441 30.249 72.7275 26.9297H70.0098C69.5801 28.7988 68.1084 29.9053 66.0566 29.9053C63.3711 29.9053 61.6738 27.7246 61.6738 24.2441C61.6738 20.7852 63.3818 18.5938 66.0459 18.5938C68.0547 18.5938 69.6338 19.8721 69.999 21.8164H72.7275C72.3838 18.4863 69.6445 16.2412 66.0459 16.2412C61.6416 16.2412 58.8379 19.3027 58.8379 24.2441C58.8379 29.2178 61.6201 32.2578 66.0459 32.2578ZM74.5645 32H77.2393V25.3721C77.2393 23.7715 78.1523 22.7939 79.667 22.7939C80.1182 22.7939 80.5264 22.8584 80.752 22.9443V20.5273C80.5586 20.4844 80.2578 20.4199 79.9141 20.4199C78.5713 20.4199 77.5723 21.2148 77.1855 22.6006H77.1318V20.6133H74.5645V32ZM86.7354 32.2256C90.0762 32.2256 92.2461 30.002 92.2461 26.3066C92.2461 22.6221 90.0547 20.377 86.7354 20.377C83.416 20.377 81.2246 22.6328 81.2246 26.3066C81.2246 30.002 83.3945 32.2256 86.7354 32.2256ZM86.7354 30.1094C85.0381 30.1094 83.9424 28.7344 83.9424 26.3066C83.9424 23.8896 85.0488 22.5039 86.7354 22.5039C88.4326 22.5039 89.5283 23.8896 89.5283 26.3066C89.5283 28.7344 88.4326 30.1094 86.7354 30.1094ZM109.348 20.6133H106.705L104.782 29.3574H104.718L102.494 20.6133H99.9268L97.7031 29.3574H97.6494L95.7266 20.6133H93.041L96.124 32H98.917L101.151 23.6748H101.205L103.45 32H106.265L109.348 20.6133ZM114.826 32.1826C116.491 32.1826 117.802 31.334 118.425 30.0557H118.468V32H121.089V16.499H118.414V22.5254H118.35C117.748 21.2686 116.459 20.4199 114.826 20.4199C111.958 20.4199 110.1 22.6973 110.1 26.2959C110.1 29.916 111.958 32.1826 114.826 32.1826ZM115.632 22.6221C117.318 22.6221 118.425 24.0723 118.425 26.3066C118.425 28.5625 117.318 29.9912 115.632 29.9912C113.902 29.9912 112.839 28.5732 112.839 26.3066C112.839 24.0508 113.913 22.6221 115.632 22.6221ZM123.13 23.8789C123.13 25.5225 124.193 26.6182 126.299 27.1123L128.372 27.5957C129.479 27.875 129.897 28.2295 129.897 28.8955C129.897 29.7441 129.092 30.2705 127.792 30.2705C126.438 30.2705 125.633 29.6904 125.472 28.6484H122.84C123.022 30.8076 124.838 32.2256 127.695 32.2256C130.574 32.2256 132.562 30.7754 132.562 28.627C132.562 26.9404 131.67 26.0596 129.393 25.5225L127.362 25.0713C126.245 24.8027 125.729 24.373 125.729 23.7285C125.729 22.9014 126.503 22.3428 127.685 22.3428C128.931 22.3428 129.715 22.9443 129.801 23.9219H132.293C132.229 21.8164 130.413 20.377 127.738 20.377C124.967 20.377 123.13 21.7949 123.13 23.8789ZM134.334 32H137.009V20.6133H134.334V32ZM135.666 19.1201C136.504 19.1201 137.159 18.4756 137.159 17.6699C137.159 16.8535 136.504 16.209 135.666 16.209C134.839 16.209 134.184 16.8535 134.184 17.6699C134.184 18.4756 134.839 19.1201 135.666 19.1201ZM144.281 29.8838C142.595 29.8838 141.521 28.5303 141.521 26.2744C141.521 24.04 142.595 22.6221 144.281 22.6221C145.989 22.6221 147.096 24.0615 147.096 26.2744C147.096 28.498 145.989 29.8838 144.281 29.8838ZM144.271 36.2969C147.59 36.2969 149.771 34.5352 149.771 31.8174V20.6133H147.149V22.5684H147.106C146.451 21.2578 145.141 20.4199 143.519 20.4199C140.607 20.4199 138.781 22.665 138.781 26.2637C138.781 29.8086 140.65 32.0107 143.465 32.0107C145.098 32.0107 146.44 31.1943 147.031 29.9697H147.096V31.8926C147.096 33.3428 146.097 34.3203 144.356 34.3203C143.089 34.3203 142.111 33.7295 141.821 32.8594H139.168C139.437 34.8574 141.456 36.2969 144.271 36.2969ZM151.951 32H154.626V25.4043C154.626 23.7715 155.604 22.665 157.14 22.665C158.665 22.665 159.417 23.5674 159.417 25.1787V32H162.092V24.6416C162.092 22.0098 160.663 20.3984 158.149 20.3984C156.398 20.3984 155.185 21.2148 154.572 22.5684H154.519V20.6133H151.951V32ZM168.397 30.1631C167.237 30.1631 166.464 29.5723 166.464 28.6377C166.464 27.7354 167.205 27.1553 168.494 27.0693L171.126 26.9082V27.7783C171.126 29.1533 169.912 30.1631 168.397 30.1631ZM167.592 32.1826C169.053 32.1826 170.481 31.4199 171.137 30.1846H171.19V32H173.769V24.1582C173.769 21.8701 171.932 20.377 169.106 20.377C166.206 20.377 164.391 21.9023 164.272 24.0293H166.754C166.926 23.084 167.731 22.4717 168.999 22.4717C170.32 22.4717 171.126 23.1592 171.126 24.3516V25.168L168.118 25.3398C165.347 25.5117 163.789 26.7256 163.789 28.7451C163.789 30.7969 165.39 32.1826 167.592 32.1826ZM176.003 32H178.678V16.499H176.003V32Z" fill="black"/>
31
- </svg>
32
- </div>
33
- </div>
34
- </div>
35
- </div>
36
-
37
  <?php
38
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
39
  if ( isset( $_GET['msg'] ) ) {
9
  exit;
10
  }
11
  ?>
12
+ <div>
13
+ <div id="cs-plugin-container">
14
+ <div class='cs-lower'>
15
+ <h1 id='crowdsignal__logo'><?php esc_html_e( 'Crowdsignal Settings', 'crowdsignal-forms' ); ?></h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  <?php
17
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
18
  if ( isset( $_GET['msg'] ) ) {
includes/admin/views/html-admin-setup-step-1.php CHANGED
@@ -9,19 +9,28 @@ if ( ! defined( 'ABSPATH' ) ) {
9
  exit;
10
  }
11
  ?>
12
- <div class="crowdsignal-setup__main">
13
- <div class="crowdsignal-setup__content">
14
- <h3><?php esc_html_e( 'Welcome to Crowdsignal Forms', 'crowdsignal-forms' ); ?></h3>
 
 
 
 
15
 
 
 
 
 
16
  <div class="crowdsignal-setup__description">
17
- <p><?php echo wp_kses_post( 'To collect and manage respones you need to connect the plugin to <a href="https://crowdsignal.com">Crowdsignal</a>. <br />It will take less than a minute and it’s free.', 'crowdsignal-forms' ); ?></p>
 
18
  </div>
19
 
20
  <div class="wrap crowdsignal-settings-wrap">
21
  <form id="cs-connect-form" class="crowdsignal-options" method="post" action="https://app.crowdsignal.com/get-api-key/" target="CSCONNECT">
22
- <input type="hidden" name="get_api_key" value="<?php echo esc_attr( get_option( 'crowdsignal_api_key_secret' ) ); ?>" />
23
- <input type="hidden" name="ref" value="<?php echo esc_attr( admin_url( 'admin.php?page=crowdsignal-forms-setup' ) ); ?>" />
24
- <input type="submit" value="<?php esc_html_e( 'Let’s get started', 'crowdsignal-forms' ); ?>" class="crowdsignal-setup__button" />
25
  </form>
26
  </div>
27
  </div>
9
  exit;
10
  }
11
  ?>
12
+ <br />
13
+ <div class='cs-settings-container'>
14
+ <div class="cs-card cs-section-header is-compact">
15
+ <div class="cs-section-header__label">
16
+ <span class="cs-section-header__label-text"><?php esc_html_e( 'Getting Started', 'crowdsignal-forms' ); ?></span>
17
+ </div>
18
+ </div>
19
 
20
+ <div class="cs-card cs-section-header is-compact">
21
+
22
+ <div class="cs-form-settings-group crowdsignal-forms" style='text-align: center; width: 100%'>
23
+ <div class="crowdsignal-setup__content">
24
  <div class="crowdsignal-setup__description">
25
+ <h1><?php esc_html_e( 'Welcome to Crowdsignal Forms', 'crowdsignal-forms' ); ?></h1>
26
+ <p><?php echo wp_kses_post( 'To collect and manage responses you need to connect the plugin to <a href="https://crowdsignal.com">Crowdsignal</a>. <br />It will take less than a minute and it’s free.', 'crowdsignal-forms' ); ?></p>
27
  </div>
28
 
29
  <div class="wrap crowdsignal-settings-wrap">
30
  <form id="cs-connect-form" class="crowdsignal-options" method="post" action="https://app.crowdsignal.com/get-api-key/" target="CSCONNECT">
31
+ <input type="hidden" name="get_api_key" value="<?php echo esc_attr( get_option( 'crowdsignal_api_key_secret' ) ); ?>" />
32
+ <input type="hidden" name="ref" value="<?php echo esc_attr( admin_url( 'options-general.php?page=crowdsignal-settings' ) ); ?>" />
33
+ <input type="submit" value="<?php esc_html_e( 'Let’s get started', 'crowdsignal-forms' ); ?>" class="cs-button is-primary" />
34
  </form>
35
  </div>
36
  </div>
includes/admin/views/html-admin-setup-step-3.php CHANGED
@@ -9,48 +9,36 @@ if ( ! defined( 'ABSPATH' ) ) {
9
  exit;
10
  }
11
  ?>
12
- <div class="crowdsignal-setup__main">
13
- <div class="crowdsignal-setup__content">
14
- <div class="crowdsignal-setup__top">
15
- <h3><?php echo wp_kses_post( __( 'First time using Crowdsignal?', 'crowdsignal-forms' ) ); ?></h3>
 
16
  </div>
 
17
 
 
 
 
18
  <div class="crowdsignal-setup__middle">
19
  <p>
20
- <?php echo wp_kses_post( __( 'You can search for our blocks, like the Poll block, in the library of the block editor.', 'crowdsignal-forms' ) ); ?>
21
- <br>
22
- <?php echo wp_kses_post( __( 'Here is a short video to get you started:', 'crowdsignal-forms' ) ); ?>
23
  </p>
24
 
25
  <div class="crowdsignal-setup__video-container">
26
  <div class="crowdsignal-setup__video">
27
- <iframe src="https://videopress.com/v/jWTs90Dg" frameborder="0" allowfullscreen></iframe>
28
  </div>
29
  </div>
30
 
31
 
32
- <p>
33
- <?php
34
- echo wp_kses_post(
35
- sprintf(
36
- // translators: Argument is a link to Crowdsignal's contact page.
37
- __(
38
- '<a href="%1s" target="_blank">Any questions about Crowdsignal?</a>',
39
- 'crowdsignal-forms'
40
- ),
41
- 'https://crowdsignal.com/contact/'
42
- )
43
- );
44
- ?>
45
- </p>
46
-
47
  <p>
48
  <?php
49
  echo wp_kses_post(
50
  sprintf(
51
  // translators: Argument is a link to Crowdsignal's support page.
52
  __(
53
- '<a href="%1s" target="_blank">Read more about us here.</a>',
54
  'crowdsignal-forms'
55
  ),
56
  'https://crowdsignal.com/support/'
9
  exit;
10
  }
11
  ?>
12
+ <br />
13
+ <div class='cs-settings-container'>
14
+ <div class="cs-card cs-section-header is-compact">
15
+ <div class="cs-section-header__label">
16
+ <span class="cs-section-header__label-text"><?php esc_html_e( 'Getting Started', 'crowdsignal-forms' ); ?></span>
17
  </div>
18
+ </div>
19
 
20
+ <div class="cs-card cs-section-header is-compact">
21
+ <div class="cs-form-settings-group" style='width: 100%'>
22
+ <h2><?php echo wp_kses_post( __( 'First time using Crowdsignal?', 'crowdsignal-forms' ) ); ?></h2>
23
  <div class="crowdsignal-setup__middle">
24
  <p>
25
+ <?php echo wp_kses_post( __( 'You can use Crowdsignal blocks right in your editor. Search for Crowdsignal in the blocks library and add the blocks to your page. Here is a short video to get you started:', 'crowdsignal-forms' ) ); ?>
 
 
26
  </p>
27
 
28
  <div class="crowdsignal-setup__video-container">
29
  <div class="crowdsignal-setup__video">
30
+ <iframe src="https://videopress.com/v/jWTs90Dg?autoplay=0&hd=1" frameborder="0" allowfullscreen></iframe>
31
  </div>
32
  </div>
33
 
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  <p>
36
  <?php
37
  echo wp_kses_post(
38
  sprintf(
39
  // translators: Argument is a link to Crowdsignal's support page.
40
  __(
41
+ 'Do you want to know more about Crowdsignal and our blocks? <a href="%1s" target="_blank">Learn more</a>.',
42
  'crowdsignal-forms'
43
  ),
44
  'https://crowdsignal.com/support/'
includes/auth/class-crowdsignal-forms-api-authenticator.php CHANGED
@@ -16,6 +16,9 @@ class Crowdsignal_Forms_Api_Authenticator {
16
  const USER_CODE_NAME = 'crowdsignal_user_code';
17
  const API_KEY_NAME = 'crowdsignal_api_key';
18
 
 
 
 
19
  /**
20
  * The Crowdsignal auth provider.
21
  *
@@ -83,6 +86,7 @@ class Crowdsignal_Forms_Api_Authenticator {
83
  */
84
  public function delete_api_key() {
85
  delete_option( self::API_KEY_NAME );
 
86
  }
87
 
88
  /**
@@ -90,6 +94,7 @@ class Crowdsignal_Forms_Api_Authenticator {
90
  */
91
  public function delete_user_code() {
92
  delete_option( self::USER_CODE_NAME );
 
93
  }
94
 
95
  /**
@@ -113,6 +118,7 @@ class Crowdsignal_Forms_Api_Authenticator {
113
  */
114
  public function set_user_code( $user_code ) {
115
  update_option( self::USER_CODE_NAME, $user_code );
 
116
  }
117
 
118
  /**
@@ -122,5 +128,6 @@ class Crowdsignal_Forms_Api_Authenticator {
122
  */
123
  public function set_api_key( $api_key ) {
124
  update_option( self::API_KEY_NAME, $api_key );
 
125
  }
126
  }
16
  const USER_CODE_NAME = 'crowdsignal_user_code';
17
  const API_KEY_NAME = 'crowdsignal_api_key';
18
 
19
+ const DASHBOARD_USER_CODE_NAME = 'pd-usercode-';
20
+ const DASHBOARD_API_KEY_NAME = 'polldaddy_api_key';
21
+
22
  /**
23
  * The Crowdsignal auth provider.
24
  *
86
  */
87
  public function delete_api_key() {
88
  delete_option( self::API_KEY_NAME );
89
+ delete_option( self::DASHBOARD_API_KEY_NAME );
90
  }
91
 
92
  /**
94
  */
95
  public function delete_user_code() {
96
  delete_option( self::USER_CODE_NAME );
97
+ delete_option( self::DASHBOARD_USER_CODE_NAME . get_current_user_id() );
98
  }
99
 
100
  /**
118
  */
119
  public function set_user_code( $user_code ) {
120
  update_option( self::USER_CODE_NAME, $user_code );
121
+ update_option( self::DASHBOARD_USER_CODE_NAME . get_current_user_id(), $user_code );
122
  }
123
 
124
  /**
128
  */
129
  public function set_api_key( $api_key ) {
130
  update_option( self::API_KEY_NAME, $api_key );
131
+ update_option( self::DASHBOARD_API_KEY_NAME, $api_key );
132
  }
133
  }
includes/class-crowdsignal-forms.php CHANGED
@@ -193,7 +193,7 @@ final class Crowdsignal_Forms {
193
  return;
194
  }
195
 
196
- wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-setup' ) );
197
  exit();
198
  }
199
  }
@@ -336,14 +336,29 @@ final class Crowdsignal_Forms {
336
  */
337
  public function add_auth_request_headers( $headers ) {
338
  $cs_authenticator = $this->get_api_authenticator();
339
- $user_code = $cs_authenticator->get_user_code();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
 
341
  if ( ! empty( $user_code ) ) {
342
- $headers['x-api-partner-guid'] = $cs_authenticator->get_api_key();
343
- $headers['x-api-user-code'] = $user_code;
 
344
  }
345
 
346
- return $headers;
347
  }
348
 
349
  /**
193
  return;
194
  }
195
 
196
+ wp_safe_redirect( admin_url( 'options-general.php?page=crowdsignal-settings' ) );
197
  exit();
198
  }
199
  }
336
  */
337
  public function add_auth_request_headers( $headers ) {
338
  $cs_authenticator = $this->get_api_authenticator();
339
+ $api_key = $cs_authenticator->get_api_key();
340
+
341
+ if ( empty( $api_key ) ) {
342
+ return $headers;
343
+ }
344
+
345
+ // check if we have it already.
346
+ $transient_key = $api_key . '-' . (int) get_current_user_id();
347
+ $transient_headers = get_transient( $transient_key );
348
+ if ( $transient_headers ) {
349
+ return array_merge( $headers, $transient_headers );
350
+ }
351
+
352
+ $auth_headers = array();
353
+ $user_code = $cs_authenticator->get_user_code();
354
 
355
  if ( ! empty( $user_code ) ) {
356
+ $auth_headers['x-api-partner-guid'] = $api_key;
357
+ $auth_headers['x-api-user-code'] = $user_code;
358
+ set_transient( $transient_key, $auth_headers, MINUTE_IN_SECONDS );
359
  }
360
 
361
+ return array_merge( $headers, $auth_headers );
362
  }
363
 
364
  /**
includes/gateways/class-api-gateway.php CHANGED
@@ -529,12 +529,6 @@ class Api_Gateway implements Api_Gateway_Interface {
529
  * @throws \Exception The exception is handled inside the try/catch.
530
  */
531
  public function get_account_info() {
532
- $transient_key = 'cs-forms-account-info-' . get_current_user_id();
533
- $transient_account_info = get_transient( $transient_key );
534
- if ( $transient_account_info ) {
535
- return $transient_account_info;
536
- }
537
-
538
  try {
539
  $response = $this->perform_request( 'GET', '/account/info' );
540
 
@@ -551,13 +545,7 @@ class Api_Gateway implements Api_Gateway_Interface {
551
  throw new \Exception( 'Could not get account info' );
552
  }
553
 
554
- // cache for 1 minute.
555
- set_transient(
556
- $transient_key,
557
- $response_data,
558
- MINUTE_IN_SECONDS
559
- );
560
-
561
  } catch ( \Exception $ex ) {
562
  // ignore error, we'll get the updated value next time.
563
  // Provide dummy response with safe defaults.
@@ -566,7 +554,7 @@ class Api_Gateway implements Api_Gateway_Interface {
566
  'capabilities' => array( 'hide-branding' ),
567
  );
568
 
569
- do_action( 'crowdsignal_forms_failed_connection' );
570
  }
571
 
572
  return $response_data;
529
  * @throws \Exception The exception is handled inside the try/catch.
530
  */
531
  public function get_account_info() {
 
 
 
 
 
 
532
  try {
533
  $response = $this->perform_request( 'GET', '/account/info' );
534
 
545
  throw new \Exception( 'Could not get account info' );
546
  }
547
 
548
+ do_action( 'crowdsignal_forms_get_account_info', $response_data );
 
 
 
 
 
 
549
  } catch ( \Exception $ex ) {
550
  // ignore error, we'll get the updated value next time.
551
  // Provide dummy response with safe defaults.
554
  'capabilities' => array( 'hide-branding' ),
555
  );
556
 
557
+ do_action( 'crowdsignal_forms_failed_connection', $ex->getMessage() ? $ex->getMessage() : 'Unknown error' );
558
  }
559
 
560
  return $response_data;
languages/crowdsignal-forms.pot CHANGED
@@ -1,17 +1,17 @@
1
- # Copyright (C) 2021 Automattic
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Crowdsignal Forms 1.5.12\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/crowdsignal-forms\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-11-22T17:51:43+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
- "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: crowdsignal-forms\n"
16
 
17
  #. Plugin Name of the plugin
@@ -42,54 +42,52 @@ msgstr ""
42
  msgid "You don&#8217;t have permission to do this."
43
  msgstr ""
44
 
45
- #: includes/admin/class-crowdsignal-forms-admin.php:70
46
- #: includes/class-crowdsignal-forms.php:439
47
- msgid "Crowdsignal"
48
- msgstr ""
49
-
50
- #: includes/admin/class-crowdsignal-forms-admin.php:71
51
- #: includes/admin/class-crowdsignal-forms-admin.php:86
52
- #: build/editor.js:13
53
  msgid "Settings"
54
  msgstr ""
55
 
56
- #: includes/admin/class-crowdsignal-forms-admin.php:72
57
- #: includes/admin/class-crowdsignal-forms-admin.php:85
58
- msgid "Getting Started"
59
- msgstr ""
60
-
61
- #: includes/admin/class-crowdsignal-forms-settings.php:71
62
  msgid "General"
63
  msgstr ""
64
 
65
- #: includes/admin/class-crowdsignal-forms-settings.php:76
66
- #: includes/admin/class-crowdsignal-forms-settings.php:188
67
  msgid "Enter Crowdsignal API Key"
68
  msgstr ""
69
 
70
- #. translators: %s is a link to the Crowdsignal connection page.
71
- #: includes/admin/class-crowdsignal-forms-settings.php:167
72
- msgid "To collect responses and data with Crowdsignal Forms you need to <a href=\"%s\" target=\"_blank\">connect the plugin with a Crowdsignal account.</a>"
73
  msgstr ""
74
 
75
- #: includes/admin/class-crowdsignal-forms-settings.php:173
76
- msgid "You can do this by entering an API key below:"
77
  msgstr ""
78
 
79
- #: includes/admin/class-crowdsignal-forms-settings.php:180
80
- msgid "Settings successfully saved"
 
81
  msgstr ""
82
 
83
- #: includes/admin/class-crowdsignal-forms-settings.php:208
84
- msgid "Disconnect"
85
  msgstr ""
86
 
87
- #: includes/admin/class-crowdsignal-forms-settings.php:214
88
- msgid "Connect"
 
 
 
 
 
 
89
  msgstr ""
90
 
91
- #: includes/admin/class-crowdsignal-forms-settings.php:225
92
- msgid "If you don't have an API key we can help you here: "
93
  msgstr ""
94
 
95
  #: includes/admin/views/html-admin-notice-core-setup.php:17
@@ -104,55 +102,110 @@ msgstr ""
104
  msgid "Skip Setup"
105
  msgstr ""
106
 
107
- #: includes/admin/views/html-admin-setup-footer.php:24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  msgid "Crowdsignal Support"
109
  msgstr ""
110
 
111
- #: includes/admin/views/html-admin-setup-footer.php:24
112
  msgid "Support"
113
  msgstr ""
114
 
115
- #: includes/admin/views/html-admin-setup-footer.php:25
116
  msgid "Terms of Service"
117
  msgstr ""
118
 
119
- #: includes/admin/views/html-admin-setup-footer.php:25
120
  msgid "Terms"
121
  msgstr ""
122
 
123
- #: includes/admin/views/html-admin-setup-footer.php:26
124
  msgid "Privacy Policy"
125
  msgstr ""
126
 
127
- #: includes/admin/views/html-admin-setup-footer.php:26
128
  msgid "Privacy"
129
  msgstr ""
130
 
131
- #: includes/admin/views/html-admin-setup-header.php:46
 
 
 
 
132
  msgid "Could not disconnect. Please try again."
133
  msgstr ""
134
 
135
- #: includes/admin/views/html-admin-setup-header.php:53
136
  msgid "Successfully disconnected from Crowdsignal."
137
  msgstr ""
138
 
139
- #: includes/admin/views/html-admin-setup-header.php:60
140
  msgid "Success! Your Crowdsignal account is successfully connected! You are ready!"
141
  msgstr ""
142
 
143
- #: includes/admin/views/html-admin-setup-header.php:67
144
  msgid "You have been connected to Crowdsignal."
145
  msgstr ""
146
 
147
- #: includes/admin/views/html-admin-setup-header.php:74
148
  msgid "Your API key has not been updated, please try again."
149
  msgstr ""
150
 
151
- #: includes/admin/views/html-admin-setup-step-1.php:14
 
 
 
 
 
152
  msgid "Welcome to Crowdsignal Forms"
153
  msgstr ""
154
 
155
- #: includes/admin/views/html-admin-setup-step-1.php:24
156
  msgid "Let’s get started"
157
  msgstr ""
158
 
@@ -160,26 +213,21 @@ msgstr ""
160
  msgid "You're ready to start using Crowdsignal!"
161
  msgstr ""
162
 
163
- #: includes/admin/views/html-admin-setup-step-3.php:15
164
  msgid "First time using Crowdsignal?"
165
  msgstr ""
166
 
167
- #: includes/admin/views/html-admin-setup-step-3.php:20
168
- msgid "You can search for our blocks, like the Poll block, in the library of the block editor."
169
- msgstr ""
170
-
171
- #: includes/admin/views/html-admin-setup-step-3.php:22
172
- msgid "Here is a short video to get you started:"
173
  msgstr ""
174
 
175
- #. translators: Argument is a link to Crowdsignal's contact page.
176
- #: includes/admin/views/html-admin-setup-step-3.php:37
177
- msgid "<a href=\"%1s\" target=\"_blank\">Any questions about Crowdsignal?</a>"
178
  msgstr ""
179
 
180
- #. translators: Argument is a link to Crowdsignal's support page.
181
- #: includes/admin/views/html-admin-setup-step-3.php:52
182
- msgid "<a href=\"%1s\" target=\"_blank\">Read more about us here.</a>"
183
  msgstr ""
184
 
185
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:146
@@ -187,54 +235,58 @@ msgid "Your Email (optional)"
187
  msgstr ""
188
 
189
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:154
190
- #: build/editor.js:13
191
  msgid "Please let us know how we can do better…"
192
  msgstr ""
193
 
194
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:158
195
- #: build/editor.js:13
196
  msgid "👋 Hey there!"
197
  msgstr ""
198
 
199
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:170
200
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:154
201
  #: includes/frontend/blocks/class-crowdsignal-forms-poll-block.php:155
202
- #: build/editor.js:13
 
 
 
203
  msgid "Submit"
204
  msgstr ""
205
 
206
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:174
207
- #: build/editor.js:13
208
  msgid "Thanks for letting us know!"
209
  msgstr ""
210
 
211
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:189
212
- #: build/editor.js:13
 
213
  msgid "Feedback"
214
  msgstr ""
215
 
216
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:121
217
- #: build/editor.js:13
218
  msgid "Please help us understand your rating"
219
  msgstr ""
220
 
221
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:128
222
- #: build/editor.js:13
223
  msgid "Thanks so much for your response! How could we do better?"
224
  msgstr ""
225
 
226
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:139
227
- #: build/editor.js:13
228
  msgid "Extremely likely"
229
  msgstr ""
230
 
231
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:143
232
- #: build/editor.js:13
233
  msgid "Not likely at all"
234
  msgstr ""
235
 
236
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:147
237
- #: build/editor.js:13
238
  msgid "How likely is it that you would recommend this project to a friend or colleague?"
239
  msgstr ""
240
 
@@ -261,808 +313,898 @@ msgstr ""
261
  msgid "Resource not found"
262
  msgstr ""
263
 
264
- #: build/applause.js:13
265
- #: build/editor.js:13
266
- #: build/poll.js:13
267
- #: build/vote.js:13
268
- msgid "Server error. Please try again."
 
269
  msgstr ""
270
 
271
- #: build/applause.js:13
272
- #: build/editor.js:13
273
- #: build/vote.js:13
274
  msgid "Powered by Crowdsignal"
275
  msgstr ""
276
 
277
- #: build/editor.js:13
278
- #: build/poll.js:13
279
- msgid "This Poll is Hidden"
 
 
 
280
  msgstr ""
281
 
282
- #: build/editor.js:13
283
- #: build/poll.js:13
284
- msgid "This Poll is Closed"
285
  msgstr ""
286
 
287
- #: build/editor.js:13
288
- #: build/poll.js:13
289
- msgid "Thanks For Voting!"
290
  msgstr ""
291
 
292
- #: build/editor.js:13
293
- #: build/poll.js:13
294
- msgid "%s vote"
295
- msgid_plural "%s votes"
296
- msgstr[0] ""
297
- msgstr[1] ""
298
-
299
- #: build/editor.js:13
300
- #: build/feedback.js:6
301
- #: build/nps.js:6
302
- #: build/poll.js:13
303
- msgid "Create your own poll with Crowdsignal"
304
  msgstr ""
305
 
306
- #: build/editor.js:13
307
- #: build/feedback.js:6
308
- #: build/nps.js:6
309
- #: build/poll.js:13
310
- msgid "Hide"
311
  msgstr ""
312
 
313
- #: build/editor.js:13
314
- #: build/poll.js:13
315
- msgid "Unfortunately, we're having some trouble retrieving the results for this poll at this time."
316
  msgstr ""
317
 
318
- #: build/editor.js:13
319
- #: build/poll.js:13
320
- msgid "%s total vote"
321
- msgid_plural "%s total votes"
322
- msgstr[0] ""
323
- msgstr[1] ""
324
 
325
- #: build/editor.js:13
326
- msgid "Enter an answer"
327
  msgstr ""
328
 
329
- #: build/editor.js:13
330
- msgid "Buttons"
331
  msgstr ""
332
 
333
- #: build/editor.js:13
334
- msgid "Upgrade"
335
  msgstr ""
336
 
337
- #: build/editor.js:13
338
- msgid "Your free Crowdsignal account has "
339
  msgstr ""
340
 
341
- #: build/editor.js:13
342
- msgid "reached the signals limit."
343
  msgstr ""
344
 
345
- #: build/editor.js:13
346
- msgid "Hide Crowdsignal branding and get "
 
 
 
 
347
  msgstr ""
348
 
349
- #: build/editor.js:13
350
- msgid "unlimited signals"
351
  msgstr ""
352
 
353
- #: build/editor.js:13
354
- msgid "Results"
 
355
  msgstr ""
356
 
357
- #: build/editor.js:13
358
- msgid "Manage results on "
 
 
 
359
  msgstr ""
360
 
361
- #: build/editor.js:13
362
- msgid "Publish this post to enable results on "
363
  msgstr ""
364
 
365
- #: build/editor.js:13
366
- msgid "View results"
 
 
367
  msgstr ""
368
 
369
- #: build/editor.js:13
370
- msgid "Title of the poll block"
371
  msgstr ""
372
 
373
- #: build/editor.js:13
374
- msgid "Confirmation message"
375
  msgstr ""
376
 
377
- #: build/editor.js:13
378
- msgid "On submission"
379
  msgstr ""
380
 
381
- #: build/editor.js:13
382
- msgid "Show results"
 
383
  msgstr ""
384
 
385
- #: build/editor.js:13
386
- msgid "Show \"Thank You\" message"
 
 
 
 
387
  msgstr ""
388
 
389
- #: build/editor.js:13
390
- msgid "Show a custom text message"
 
 
 
 
391
  msgstr ""
392
 
393
- #: build/editor.js:13
394
- msgid "Message text"
 
 
395
  msgstr ""
396
 
397
- #: build/editor.js:13
398
- #: build/poll.js:13
399
- msgid "Thanks for voting!"
 
 
 
400
  msgstr ""
401
 
402
- #: build/editor.js:13
403
- msgid "Redirect address"
404
  msgstr ""
405
 
406
- #: build/editor.js:13
 
 
 
 
407
  msgid "Status"
408
  msgstr ""
409
 
410
- #: build/editor.js:13
 
 
 
 
411
  msgid "Open"
412
  msgstr ""
413
 
414
- #: build/editor.js:13
 
 
 
 
415
  msgid "Closed after"
416
  msgstr ""
417
 
418
- #: build/editor.js:13
 
 
 
 
419
  msgid "Closed"
420
  msgstr ""
421
 
422
- #: build/editor.js:13
423
- msgid "Close poll on"
424
- msgstr ""
425
-
426
- #: build/editor.js:13
427
- msgid "When poll is closed"
428
- msgstr ""
429
-
430
- #: build/editor.js:13
431
- msgid "Show poll with \"Closed\" banner"
432
- msgstr ""
433
-
434
- #: build/editor.js:13
435
- msgid "Hide poll"
436
  msgstr ""
437
 
438
- #: build/editor.js:13
439
- msgid "Block styling"
 
440
  msgstr ""
441
 
442
- #: build/editor.js:13
 
 
 
 
443
  msgid "Text color"
444
  msgstr ""
445
 
446
- #: build/editor.js:13
 
 
 
 
447
  msgid "Background color"
448
  msgstr ""
449
 
450
- #: build/editor.js:13
 
 
451
  msgid "Border color"
452
  msgstr ""
453
 
454
- #: build/editor.js:13
455
- msgid "Choose font"
 
456
  msgstr ""
457
 
458
- #: build/editor.js:13
459
- msgid "Default theme font"
 
 
460
  msgstr ""
461
 
462
- #: build/editor.js:13
463
- msgid "Width (%)"
 
 
464
  msgstr ""
465
 
466
- #: build/editor.js:13
467
- msgid "Reset"
468
  msgstr ""
469
 
470
- #: build/editor.js:13
471
- msgid "Border thickness"
 
 
472
  msgstr ""
473
 
474
- #: build/editor.js:13
475
- msgid "Corner radius"
476
  msgstr ""
477
 
478
- #: build/editor.js:13
479
- msgid "Drop shadow"
 
 
 
480
  msgstr ""
481
 
482
- #: build/editor.js:13
483
- msgid "Button styling"
484
  msgstr ""
485
 
486
- #: build/editor.js:13
487
- msgid "Alignment"
488
  msgstr ""
489
 
490
- #: build/editor.js:13
491
- msgid "List"
492
  msgstr ""
493
 
494
- #: build/editor.js:13
495
- msgid "Inline"
496
  msgstr ""
497
 
498
- #: build/editor.js:13
499
- msgid "Answer settings"
500
  msgstr ""
501
 
502
- #: build/editor.js:13
503
- msgid "One response per computer"
504
  msgstr ""
505
 
506
- #: build/editor.js:13
507
- msgid "Randomize answer order"
 
508
  msgstr ""
509
 
510
- #: build/editor.js:13
511
- msgid "Choose one answer"
512
  msgstr ""
513
 
514
- #: build/editor.js:13
515
- msgid "Choose multiple answers"
 
 
 
516
  msgstr ""
517
 
518
- #: build/editor.js:13
519
- msgid "Warning! This poll is published. Deleting or reordering answers may cause the loss of existing responses."
520
  msgstr ""
521
 
522
- #: build/editor.js:13
523
- msgid "Edit"
524
  msgstr ""
525
 
526
- #: build/editor.js:13
527
- msgid "You need to connect to a Crowdsignal account to collect and manage your results."
 
528
  msgstr ""
529
 
530
- #: build/editor.js:13
531
- msgid "Please verify your WordPress.com email address in order to publish your poll."
 
532
  msgstr ""
533
 
534
- #: build/editor.js:13
535
- msgid "Connect to Crowdsignal"
536
  msgstr ""
537
 
538
- #: build/editor.js:13
539
- msgid "Verify or Change your Email Address"
 
540
  msgstr ""
541
 
542
- #: build/editor.js:13
543
- msgid "Please upgrade"
544
  msgstr ""
545
 
546
- #: build/editor.js:13
547
- msgid "exceeded 2500 signals."
 
 
548
  msgstr ""
549
 
550
- #: build/editor.js:13
551
- msgid "Crowdsignal Poll"
 
552
  msgstr ""
553
 
554
- #: build/editor.js:13
555
- msgid "Enter your question"
 
556
  msgstr ""
557
 
558
- #: build/editor.js:13
559
- msgid "Add a note (optional)"
 
560
  msgstr ""
561
 
562
- #: build/editor.js:13
563
- msgid "Poll"
564
  msgstr ""
565
 
566
- #: build/editor.js:13
567
- msgid "Create polls and get your audience’s opinion — powered by Crowdsignal."
568
  msgstr ""
569
 
570
- #: build/editor.js:13
571
- msgid "ask"
572
  msgstr ""
573
 
574
- #: build/editor.js:13
575
- msgid "feedback"
576
  msgstr ""
577
 
578
- #: build/editor.js:13
579
- msgid "form"
580
  msgstr ""
581
 
582
- #: build/editor.js:13
583
- msgid "opinion"
 
584
  msgstr ""
585
 
586
- #: build/editor.js:13
587
- msgid "poll"
588
  msgstr ""
589
 
590
- #: build/editor.js:13
591
- msgid "pop"
592
  msgstr ""
593
 
594
- #: build/editor.js:13
595
- msgid "question"
596
  msgstr ""
597
 
598
- #: build/editor.js:13
599
- msgid "quiz"
600
  msgstr ""
601
 
602
- #: build/editor.js:13
603
- msgid "research"
 
 
 
 
 
 
 
604
  msgstr ""
605
 
606
- #: build/editor.js:13
607
- msgid "survey"
608
  msgstr ""
609
 
610
- #: build/editor.js:13
611
- msgid "vote"
612
  msgstr ""
613
 
614
- #: build/editor.js:13
615
- msgid "How did you hear about us?"
616
  msgstr ""
617
 
618
- #: build/editor.js:13
619
- msgid "Search"
620
  msgstr ""
621
 
622
- #: build/editor.js:13
623
- msgid "Friend"
624
  msgstr ""
625
 
626
- #: build/editor.js:13
627
- msgid "Email"
 
628
  msgstr ""
629
 
630
- #: build/editor.js:13
631
- msgid "Small"
632
  msgstr ""
633
 
634
- #: build/editor.js:13
635
- msgid "Medium"
636
  msgstr ""
637
 
638
- #: build/editor.js:13
639
- msgid "Large"
640
  msgstr ""
641
 
642
- #: build/editor.js:13
643
- msgid "Title of the vote block"
644
  msgstr ""
645
 
646
- #: build/editor.js:13
647
- msgid "Close vote block on"
648
  msgstr ""
649
 
650
- #: build/editor.js:13
651
- msgid "Show vote counters"
652
  msgstr ""
653
 
654
- #: build/editor.js:13
655
- msgid "Hide vote counters"
 
 
656
  msgstr ""
657
 
658
- #: build/editor.js:13
659
- msgid "Change block size"
660
  msgstr ""
661
 
662
- #: build/editor.js:13
663
- msgid "Untitled Vote"
 
 
664
  msgstr ""
665
 
666
- #: build/editor.js:13
667
- msgid "Crowdsignal Vote"
668
  msgstr ""
669
 
670
- #: build/editor.js:13
671
- msgid "Vote"
672
  msgstr ""
673
 
674
- #: build/editor.js:13
675
- msgid "Allow your audience to rate your work or express their opinion — powered by Crowdsignal."
 
 
676
  msgstr ""
677
 
678
- #: build/editor.js:13
679
- msgid "ballot"
680
  msgstr ""
681
 
682
- #: build/editor.js:13
683
- msgid "button"
684
  msgstr ""
685
 
686
- #: build/editor.js:13
687
- msgid "count"
688
  msgstr ""
689
 
690
- #: build/editor.js:13
691
- msgid "deciding"
692
  msgstr ""
693
 
694
- #: build/editor.js:13
695
- msgid "decision"
696
  msgstr ""
697
 
698
- #: build/editor.js:13
699
- msgid "elect"
700
  msgstr ""
701
 
702
- #: build/editor.js:13
703
- msgid "election"
704
  msgstr ""
705
 
706
- #: build/editor.js:13
707
- msgid "like"
708
  msgstr ""
709
 
710
- #: build/editor.js:13
711
- msgid "nero"
712
  msgstr ""
713
 
714
- #: build/editor.js:13
715
- msgid "polling"
716
  msgstr ""
717
 
718
- #: build/editor.js:13
719
- msgid "rate"
720
  msgstr ""
721
 
722
- #: build/editor.js:13
723
- msgid "rating"
724
  msgstr ""
725
 
726
- #: build/editor.js:13
727
- msgid "thumb down"
728
  msgstr ""
729
 
730
- #: build/editor.js:13
731
- msgid "thumb up"
732
  msgstr ""
733
 
734
- #: build/editor.js:13
735
- msgid "thumbs"
736
  msgstr ""
737
 
738
- #: build/editor.js:13
739
- msgid "voting"
740
  msgstr ""
741
 
742
- #: build/editor.js:13
743
- msgid "Styling"
744
  msgstr ""
745
 
746
- #: build/editor.js:13
747
- msgid "Vote Item"
748
  msgstr ""
749
 
750
- #: build/editor.js:13
751
- msgid "Title of the applause block"
 
752
  msgstr ""
753
 
754
- #: build/editor.js:13
755
- msgid "Close applause block on"
756
  msgstr ""
757
 
758
- #: build/editor.js:13
759
- msgid "Untitled Applause"
760
  msgstr ""
761
 
762
- #: build/editor.js:13
763
- msgid "Crowdsignal Applause"
764
  msgstr ""
765
 
766
- #: build/editor.js:13
767
- msgid "Applause"
768
  msgstr ""
769
 
770
- #: build/editor.js:13
771
- msgid "Let your audience cheer with a big round of applause — powered by Crowdsignal."
 
772
  msgstr ""
773
 
774
- #: build/editor.js:13
775
- msgid "applause"
776
  msgstr ""
777
 
778
- #: build/editor.js:13
779
- msgid "cheer"
780
  msgstr ""
781
 
782
- #: build/editor.js:13
783
- msgid "cheering"
784
  msgstr ""
785
 
786
- #: build/editor.js:13
787
- msgid "clap"
788
  msgstr ""
789
 
790
- #: build/editor.js:13
791
- msgid "kudos"
792
  msgstr ""
793
 
794
- #: build/editor.js:13
795
- msgid "praise"
796
  msgstr ""
797
 
798
- #: build/editor.js:13
799
- msgid "upvote"
800
  msgstr ""
801
 
802
- #: build/editor.js:13
803
- msgid "upvoting"
 
804
  msgstr ""
805
 
806
- #: build/editor.js:13
807
- msgid "votes"
808
  msgstr ""
809
 
810
- #: build/editor.js:13
811
- msgid "Save the block to track results on "
812
  msgstr ""
813
 
814
- #: build/editor.js:13
815
- msgid "Title (optional)"
816
  msgstr ""
817
 
818
- #: build/editor.js:13
819
- msgid "Button color"
820
  msgstr ""
821
 
822
- #: build/editor.js:13
823
- msgid "Button text color"
824
  msgstr ""
825
 
826
- #: build/editor.js:13
827
- msgid "Close on"
828
  msgstr ""
829
 
830
- #: build/editor.js:13
831
- msgid "Current view"
832
  msgstr ""
833
 
834
- #: build/editor.js:13
835
- msgid "Rating"
836
  msgstr ""
837
 
838
- #: build/editor.js:13
839
- msgid "Set view threshold"
840
  msgstr ""
841
 
842
- #: build/editor.js:13
843
- msgid "Show this block after __ visits:"
844
  msgstr ""
845
 
846
- #: build/editor.js:13
847
- msgid "Retry"
848
  msgstr ""
849
 
850
- #: build/editor.js:13
851
- msgid "Unfortunately, the block couldn't be saved to Crowdsignal.com."
852
  msgstr ""
853
 
854
- #: build/editor.js:13
855
- msgid "Crowdsignal NPS"
856
  msgstr ""
857
 
858
- #: build/editor.js:13
859
- msgid "Preview"
860
  msgstr ""
861
 
862
- #: build/editor.js:13
863
- msgid "This block will appear as a popup window to people who have visited this page at least %d time."
864
- msgid_plural "This block will appear as a popup window to people who have visited this page at least %d times."
865
- msgstr[0] ""
866
- msgstr[1] ""
867
 
868
- #: build/editor.js:13
869
- msgid "Enter your rating question"
870
  msgstr ""
871
 
872
- #: build/editor.js:13
873
- msgid "Not likely"
874
  msgstr ""
875
 
876
- #: build/editor.js:13
877
- msgid "Very likely"
878
  msgstr ""
879
 
880
- #: build/editor.js:13
881
- #: build/feedback.js:6
882
- #: build/nps.js:6
883
- msgid "Collect your own feedback with Crowdsignal"
884
  msgstr ""
885
 
886
- #: build/editor.js:13
887
- msgid "Enter your feedback question"
 
888
  msgstr ""
889
 
890
- #: build/editor.js:13
891
- msgid "Measure NPS"
892
  msgstr ""
893
 
894
- #: build/editor.js:13
895
- msgid "Calculate your Net Promoter Score! Collect feedback and track customer satisfaction over time. — powered by Crowdsignal."
896
  msgstr ""
897
 
898
- #: build/editor.js:13
899
- msgid "CSAT"
900
  msgstr ""
901
 
902
- #: build/editor.js:13
903
- msgid "customer experience"
904
  msgstr ""
905
 
906
- #: build/editor.js:13
907
- msgid "customer satisfaction"
908
  msgstr ""
909
 
910
- #: build/editor.js:13
911
- msgid "loyalty"
912
  msgstr ""
913
 
914
- #: build/editor.js:13
915
- msgid "net promoter score"
916
  msgstr ""
917
 
918
- #: build/editor.js:13
919
- msgid "nps"
920
  msgstr ""
921
 
922
- #: build/editor.js:13
923
- msgid "promoter"
924
  msgstr ""
925
 
926
- #: build/editor.js:13
927
- msgid "review"
928
  msgstr ""
929
 
930
- #: build/editor.js:13
931
- msgid "score"
932
  msgstr ""
933
 
934
- #: build/editor.js:13
935
- msgid "How satisfied are you with the content of the site?"
936
  msgstr ""
937
 
938
- #: build/editor.js:13
939
- msgid "Any advise on how we could improve your experience?"
940
  msgstr ""
941
 
942
- #: build/editor.js:13
943
- msgid "Not satisfied"
944
  msgstr ""
945
 
946
- #: build/editor.js:13
947
- msgid "Very satisfied"
948
  msgstr ""
949
 
950
- #: build/editor.js:13
951
- msgid "Your Email"
952
  msgstr ""
953
 
954
- #: build/editor.js:13
955
- msgid "Send me responses via email"
956
  msgstr ""
957
 
958
- #: build/editor.js:13
959
- msgid "Responses will be sent to %s"
960
  msgstr ""
961
 
962
- #: build/editor.js:13
963
- msgid "Feedback Button"
964
  msgstr ""
965
 
966
- #: build/editor.js:13
967
- msgid "Hide Shadow"
968
  msgstr ""
969
 
970
- #: build/editor.js:13
971
- msgid "Show feedback form on:"
972
  msgstr ""
973
 
974
- #: build/editor.js:13
975
- msgid "Click"
976
  msgstr ""
977
 
978
- #: build/editor.js:13
979
- msgid "Hover"
980
  msgstr ""
981
 
982
- #: build/editor.js:13
983
- msgid "Page load"
984
  msgstr ""
985
 
986
- #: build/editor.js:13
987
- msgid "Require email address"
988
  msgstr ""
989
 
990
- #: build/editor.js:13
991
- msgid "Top"
992
  msgstr ""
993
 
994
- #: build/editor.js:13
995
- msgid "Bottom"
996
  msgstr ""
997
 
998
- #: build/editor.js:13
999
- msgid "Left"
1000
  msgstr ""
1001
 
1002
- #: build/editor.js:13
1003
- msgid "Right"
1004
  msgstr ""
1005
 
1006
- #: build/editor.js:13
1007
- msgid "Center"
 
 
 
1008
  msgstr ""
1009
 
1010
- #: build/editor.js:13
1011
- msgid "Change block position"
 
 
 
1012
  msgstr ""
1013
 
1014
- #: build/editor.js:13
1015
- msgid "Question"
 
 
 
 
 
 
 
 
 
1016
  msgstr ""
1017
 
1018
- #: build/editor.js:13
1019
- msgid "Change button position"
 
1020
  msgstr ""
1021
 
1022
- #: build/editor.js:13
1023
- msgid "This widget will appear in a fixed position as selected, in a corner or at an edge."
 
1024
  msgstr ""
1025
 
1026
- #: build/editor.js:13
1027
- msgid "This Feedback Form is Closed"
 
 
 
 
 
 
 
 
1028
  msgstr ""
1029
 
1030
- #: build/editor.js:13
1031
- msgid "Add an always visible button that allows your audience to share feedback anytime."
1032
  msgstr ""
1033
 
1034
- #: build/editor.js:13
1035
- msgid "floating"
1036
  msgstr ""
1037
 
1038
- #: build/editor.js:13
1039
- msgid "contact"
 
1040
  msgstr ""
1041
 
1042
- #: build/editor.js:13
1043
- msgid "call to action"
1044
  msgstr ""
1045
 
1046
- #: build/editor.js:13
1047
- msgid "cta"
1048
  msgstr ""
1049
 
1050
- #: build/editor.js:13
1051
- msgid "subscribe"
1052
  msgstr ""
1053
 
1054
- #: build/editor.js:13
1055
- msgid "email"
1056
  msgstr ""
1057
 
1058
- #: build/editor.js:13
1059
- msgid "message"
1060
  msgstr ""
1061
 
1062
- #: build/feedback.js:6
1063
  msgid "Close"
1064
  msgstr ""
1065
 
1066
- #: build/nps.js:6
1067
  msgid "Thanks so much for your feedback!"
1068
  msgstr ""
1
+ # Copyright (C) 2022 Automattic
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Crowdsignal Forms 1.5.15\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/crowdsignal-forms\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2022-01-20T10:55:26+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
+ "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: crowdsignal-forms\n"
16
 
17
  #. Plugin Name of the plugin
42
  msgid "You don&#8217;t have permission to do this."
43
  msgstr ""
44
 
45
+ #: includes/admin/class-crowdsignal-forms-admin.php:92
46
+ #: build/editor.js:145
47
+ #: build/editor.js:229
48
+ #: build/editor.js:313
49
+ #: build/editor.js:433
50
+ #: build/editor.js:589
 
 
51
  msgid "Settings"
52
  msgstr ""
53
 
54
+ #: includes/admin/class-crowdsignal-forms-settings.php:131
 
 
 
 
 
55
  msgid "General"
56
  msgstr ""
57
 
58
+ #: includes/admin/class-crowdsignal-forms-settings.php:136
 
59
  msgid "Enter Crowdsignal API Key"
60
  msgstr ""
61
 
62
+ #: includes/admin/views/html-admin-dashboard-teaser.php:16
63
+ msgid "Manage your Crowdsignal projects inside WordPress"
 
64
  msgstr ""
65
 
66
+ #: includes/admin/views/html-admin-dashboard-teaser.php:22
67
+ msgid "The Crowdsignal Dashboard plugin"
68
  msgstr ""
69
 
70
+ #. translators: Placeholder is the text "second plugin".
71
+ #: includes/admin/views/html-admin-dashboard-teaser.php:28
72
+ msgid "We have a %s for you that allows you to manage all your Crowdsignal projects right in WP-Admin. Get an overview of all your active projects and get easy access to your results pages."
73
  msgstr ""
74
 
75
+ #: includes/admin/views/html-admin-dashboard-teaser.php:31
76
+ msgid "second plugin"
77
  msgstr ""
78
 
79
+ #. translators: Argument is a link to Crowdsignal's contact page.
80
+ #: includes/admin/views/html-admin-dashboard-teaser.php:43
81
+ msgid "Do you want to know more about Crowdsignal? <a href=\"%1s\" target=\"_blank\">Learn more</a>."
82
+ msgstr ""
83
+
84
+ #. translators: Placeholder is the text "website plugins page".
85
+ #: includes/admin/views/html-admin-dashboard-teaser.php:56
86
+ msgid "Install the Crowdsignal Dashboard plugin directly from your %s."
87
  msgstr ""
88
 
89
+ #: includes/admin/views/html-admin-dashboard-teaser.php:59
90
+ msgid "website plugins page"
91
  msgstr ""
92
 
93
  #: includes/admin/views/html-admin-notice-core-setup.php:17
102
  msgid "Skip Setup"
103
  msgstr ""
104
 
105
+ #: includes/admin/views/html-admin-settings.php:12
106
+ msgid "Account Settings"
107
+ msgstr ""
108
+
109
+ #: includes/admin/views/html-admin-settings.php:18
110
+ msgid "API Key"
111
+ msgstr ""
112
+
113
+ #. translators: Placeholder is the text "Crowdsignal".
114
+ #: includes/admin/views/html-admin-settings.php:23
115
+ msgid "Your website is connected to a %s account to collect responses and data from your visitors."
116
+ msgstr ""
117
+
118
+ #. translators: Placeholder is the text "Crowdsignal acount page".
119
+ #: includes/admin/views/html-admin-settings.php:29
120
+ msgid "Visit your %s to find out more about your settings."
121
+ msgstr ""
122
+
123
+ #: includes/admin/views/html-admin-settings.php:32
124
+ msgid "Crowdsignal account page"
125
+ msgstr ""
126
+
127
+ #: includes/admin/views/html-admin-settings.php:38
128
+ msgid "If you have a Crowdsignal account, click the \"Get API Key\" button to connect. This will open a new window."
129
+ msgstr ""
130
+
131
+ #: includes/admin/views/html-admin-settings.php:42
132
+ msgid "Get API Key"
133
+ msgstr ""
134
+
135
+ #: includes/admin/views/html-admin-settings.php:49
136
+ msgid "Settings successfully saved"
137
+ msgstr ""
138
+
139
+ #: includes/admin/views/html-admin-settings.php:56
140
+ msgid "Your Crowdsignal API Key"
141
+ msgstr ""
142
+
143
+ #: includes/admin/views/html-admin-settings.php:76
144
+ msgid "Disconnect"
145
+ msgstr ""
146
+
147
+ #: includes/admin/views/html-admin-settings.php:82
148
+ msgid "Connect"
149
+ msgstr ""
150
+
151
+ #: includes/admin/views/html-admin-setup-footer.php:27
152
  msgid "Crowdsignal Support"
153
  msgstr ""
154
 
155
+ #: includes/admin/views/html-admin-setup-footer.php:27
156
  msgid "Support"
157
  msgstr ""
158
 
159
+ #: includes/admin/views/html-admin-setup-footer.php:28
160
  msgid "Terms of Service"
161
  msgstr ""
162
 
163
+ #: includes/admin/views/html-admin-setup-footer.php:28
164
  msgid "Terms"
165
  msgstr ""
166
 
167
+ #: includes/admin/views/html-admin-setup-footer.php:29
168
  msgid "Privacy Policy"
169
  msgstr ""
170
 
171
+ #: includes/admin/views/html-admin-setup-footer.php:29
172
  msgid "Privacy"
173
  msgstr ""
174
 
175
+ #: includes/admin/views/html-admin-setup-header.php:15
176
+ msgid "Crowdsignal Settings"
177
+ msgstr ""
178
+
179
+ #: includes/admin/views/html-admin-setup-header.php:25
180
  msgid "Could not disconnect. Please try again."
181
  msgstr ""
182
 
183
+ #: includes/admin/views/html-admin-setup-header.php:32
184
  msgid "Successfully disconnected from Crowdsignal."
185
  msgstr ""
186
 
187
+ #: includes/admin/views/html-admin-setup-header.php:39
188
  msgid "Success! Your Crowdsignal account is successfully connected! You are ready!"
189
  msgstr ""
190
 
191
+ #: includes/admin/views/html-admin-setup-header.php:46
192
  msgid "You have been connected to Crowdsignal."
193
  msgstr ""
194
 
195
+ #: includes/admin/views/html-admin-setup-header.php:53
196
  msgid "Your API key has not been updated, please try again."
197
  msgstr ""
198
 
199
+ #: includes/admin/views/html-admin-setup-step-1.php:16
200
+ #: includes/admin/views/html-admin-setup-step-3.php:16
201
+ msgid "Getting Started"
202
+ msgstr ""
203
+
204
+ #: includes/admin/views/html-admin-setup-step-1.php:25
205
  msgid "Welcome to Crowdsignal Forms"
206
  msgstr ""
207
 
208
+ #: includes/admin/views/html-admin-setup-step-1.php:33
209
  msgid "Let’s get started"
210
  msgstr ""
211
 
213
  msgid "You're ready to start using Crowdsignal!"
214
  msgstr ""
215
 
216
+ #: includes/admin/views/html-admin-setup-step-3.php:22
217
  msgid "First time using Crowdsignal?"
218
  msgstr ""
219
 
220
+ #: includes/admin/views/html-admin-setup-step-3.php:25
221
+ msgid "You can use Crowdsignal blocks right in your editor. Search for Crowdsignal in the blocks library and add the blocks to your page. Here is a short video to get you started:"
 
 
 
 
222
  msgstr ""
223
 
224
+ #. translators: Argument is a link to Crowdsignal's support page.
225
+ #: includes/admin/views/html-admin-setup-step-3.php:40
226
+ msgid "Do you want to know more about Crowdsignal and our blocks? <a href=\"%1s\" target=\"_blank\">Learn more</a>."
227
  msgstr ""
228
 
229
+ #: includes/class-crowdsignal-forms.php:454
230
+ msgid "Crowdsignal"
 
231
  msgstr ""
232
 
233
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:146
235
  msgstr ""
236
 
237
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:154
238
+ #: build/editor.js:181
239
  msgid "Please let us know how we can do better…"
240
  msgstr ""
241
 
242
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:158
243
+ #: build/editor.js:181
244
  msgid "👋 Hey there!"
245
  msgstr ""
246
 
247
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:170
248
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:154
249
  #: includes/frontend/blocks/class-crowdsignal-forms-poll-block.php:155
250
+ #: build/editor.js:181
251
+ #: build/editor.js:241
252
+ #: build/editor.js:265
253
+ #: build/editor.js:349
254
  msgid "Submit"
255
  msgstr ""
256
 
257
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:174
258
+ #: build/editor.js:181
259
  msgid "Thanks for letting us know!"
260
  msgstr ""
261
 
262
  #: includes/frontend/blocks/class-crowdsignal-forms-feedback-block.php:189
263
+ #: build/editor.js:181
264
+ #: build/editor.js:325
265
  msgid "Feedback"
266
  msgstr ""
267
 
268
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:121
269
+ #: build/editor.js:265
270
  msgid "Please help us understand your rating"
271
  msgstr ""
272
 
273
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:128
274
+ #: build/editor.js:265
275
  msgid "Thanks so much for your response! How could we do better?"
276
  msgstr ""
277
 
278
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:139
279
+ #: build/editor.js:265
280
  msgid "Extremely likely"
281
  msgstr ""
282
 
283
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:143
284
+ #: build/editor.js:265
285
  msgid "Not likely at all"
286
  msgstr ""
287
 
288
  #: includes/frontend/blocks/class-crowdsignal-forms-nps-block.php:147
289
+ #: build/editor.js:265
290
  msgid "How likely is it that you would recommend this project to a friend or colleague?"
291
  msgstr ""
292
 
313
  msgid "Resource not found"
314
  msgstr ""
315
 
316
+ #: build/applause.js:133
317
+ #: build/editor.js:421
318
+ #: build/editor.js:481
319
+ #: build/poll.js:109
320
+ #: build/vote.js:109
321
+ msgid "Buttons"
322
  msgstr ""
323
 
324
+ #: build/applause.js:169
325
+ #: build/editor.js:709
326
+ #: build/vote.js:133
327
  msgid "Powered by Crowdsignal"
328
  msgstr ""
329
 
330
+ #: build/applause.js:241
331
+ #: build/editor.js:1177
332
+ #: build/poll.js:217
333
+ #: build/poll.js:325
334
+ #: build/vote.js:253
335
+ msgid "Server error. Please try again."
336
  msgstr ""
337
 
338
+ #: build/editor.js:109
339
+ #: build/editor.js:553
340
+ msgid "Small"
341
  msgstr ""
342
 
343
+ #: build/editor.js:109
344
+ #: build/editor.js:553
345
+ msgid "Medium"
346
  msgstr ""
347
 
348
+ #: build/editor.js:109
349
+ #: build/editor.js:553
350
+ msgid "Large"
 
 
 
 
 
 
 
 
 
351
  msgstr ""
352
 
353
+ #: build/editor.js:121
354
+ msgid "Untitled Applause"
 
 
 
355
  msgstr ""
356
 
357
+ #: build/editor.js:121
358
+ msgid "Crowdsignal Applause"
 
359
  msgstr ""
360
 
361
+ #: build/editor.js:133
362
+ msgid "Applause"
363
+ msgstr ""
 
 
 
364
 
365
+ #: build/editor.js:133
366
+ msgid "Let your audience cheer with a big round of applause — powered by Crowdsignal."
367
  msgstr ""
368
 
369
+ #: build/editor.js:133
370
+ msgid "applause"
371
  msgstr ""
372
 
373
+ #: build/editor.js:133
374
+ msgid "cheer"
375
  msgstr ""
376
 
377
+ #: build/editor.js:133
378
+ msgid "cheering"
379
  msgstr ""
380
 
381
+ #: build/editor.js:133
382
+ msgid "clap"
383
  msgstr ""
384
 
385
+ #: build/editor.js:133
386
+ #: build/editor.js:217
387
+ #: build/editor.js:301
388
+ #: build/editor.js:421
389
+ #: build/editor.js:577
390
+ msgid "feedback"
391
  msgstr ""
392
 
393
+ #: build/editor.js:133
394
+ msgid "kudos"
395
  msgstr ""
396
 
397
+ #: build/editor.js:133
398
+ #: build/editor.js:577
399
+ msgid "like"
400
  msgstr ""
401
 
402
+ #: build/editor.js:133
403
+ #: build/editor.js:301
404
+ #: build/editor.js:421
405
+ #: build/editor.js:577
406
+ msgid "opinion"
407
  msgstr ""
408
 
409
+ #: build/editor.js:133
410
+ msgid "praise"
411
  msgstr ""
412
 
413
+ #: build/editor.js:133
414
+ #: build/editor.js:301
415
+ #: build/editor.js:577
416
+ msgid "rating"
417
  msgstr ""
418
 
419
+ #: build/editor.js:133
420
+ msgid "upvote"
421
  msgstr ""
422
 
423
+ #: build/editor.js:133
424
+ msgid "upvoting"
425
  msgstr ""
426
 
427
+ #: build/editor.js:133
428
+ msgid "votes"
429
  msgstr ""
430
 
431
+ #: build/editor.js:133
432
+ #: build/editor.js:577
433
+ msgid "voting"
434
  msgstr ""
435
 
436
+ #: build/editor.js:145
437
+ #: build/editor.js:229
438
+ #: build/editor.js:313
439
+ #: build/editor.js:433
440
+ #: build/editor.js:589
441
+ msgid "Results"
442
  msgstr ""
443
 
444
+ #: build/editor.js:145
445
+ #: build/editor.js:229
446
+ #: build/editor.js:313
447
+ #: build/editor.js:433
448
+ #: build/editor.js:589
449
+ msgid "Manage results on "
450
  msgstr ""
451
 
452
+ #: build/editor.js:145
453
+ #: build/editor.js:433
454
+ #: build/editor.js:589
455
+ msgid "Publish this post to enable results on "
456
  msgstr ""
457
 
458
+ #: build/editor.js:145
459
+ #: build/editor.js:229
460
+ #: build/editor.js:313
461
+ #: build/editor.js:433
462
+ #: build/editor.js:589
463
+ msgid "View results"
464
  msgstr ""
465
 
466
+ #: build/editor.js:145
467
+ msgid "Title of the applause block"
468
  msgstr ""
469
 
470
+ #: build/editor.js:145
471
+ #: build/editor.js:229
472
+ #: build/editor.js:313
473
+ #: build/editor.js:433
474
+ #: build/editor.js:589
475
  msgid "Status"
476
  msgstr ""
477
 
478
+ #: build/editor.js:145
479
+ #: build/editor.js:229
480
+ #: build/editor.js:313
481
+ #: build/editor.js:433
482
+ #: build/editor.js:589
483
  msgid "Open"
484
  msgstr ""
485
 
486
+ #: build/editor.js:145
487
+ #: build/editor.js:229
488
+ #: build/editor.js:313
489
+ #: build/editor.js:433
490
+ #: build/editor.js:589
491
  msgid "Closed after"
492
  msgstr ""
493
 
494
+ #: build/editor.js:145
495
+ #: build/editor.js:229
496
+ #: build/editor.js:313
497
+ #: build/editor.js:433
498
+ #: build/editor.js:589
499
  msgid "Closed"
500
  msgstr ""
501
 
502
+ #: build/editor.js:145
503
+ msgid "Close applause block on"
 
 
 
 
 
 
 
 
 
 
 
 
504
  msgstr ""
505
 
506
+ #: build/editor.js:145
507
+ #: build/editor.js:529
508
+ msgid "Styling"
509
  msgstr ""
510
 
511
+ #: build/editor.js:145
512
+ #: build/editor.js:229
513
+ #: build/editor.js:313
514
+ #: build/editor.js:433
515
+ #: build/editor.js:529
516
  msgid "Text color"
517
  msgstr ""
518
 
519
+ #: build/editor.js:145
520
+ #: build/editor.js:229
521
+ #: build/editor.js:313
522
+ #: build/editor.js:433
523
+ #: build/editor.js:529
524
  msgid "Background color"
525
  msgstr ""
526
 
527
+ #: build/editor.js:145
528
+ #: build/editor.js:433
529
+ #: build/editor.js:529
530
  msgid "Border color"
531
  msgstr ""
532
 
533
+ #: build/editor.js:157
534
+ #: build/editor.js:601
535
+ msgid "Change block size"
536
  msgstr ""
537
 
538
+ #: build/editor.js:157
539
+ #: build/editor.js:433
540
+ #: build/editor.js:601
541
+ msgid "Border thickness"
542
  msgstr ""
543
 
544
+ #: build/editor.js:157
545
+ #: build/editor.js:433
546
+ #: build/editor.js:601
547
+ msgid "Corner radius"
548
  msgstr ""
549
 
550
+ #: build/editor.js:181
551
+ msgid "Your Email"
552
  msgstr ""
553
 
554
+ #: build/editor.js:205
555
+ #: build/editor.js:217
556
+ #: build/editor.js:229
557
+ msgid "Feedback Button"
558
  msgstr ""
559
 
560
+ #: build/editor.js:205
561
+ msgid "This widget will appear in a fixed position as selected, in a corner or at an edge."
562
  msgstr ""
563
 
564
+ #: build/editor.js:205
565
+ #: build/editor.js:289
566
+ #: build/feedback.js:145
567
+ #: build/nps.js:157
568
+ msgid "Collect your own feedback with Crowdsignal"
569
  msgstr ""
570
 
571
+ #: build/editor.js:205
572
+ msgid "This Feedback Form is Closed"
573
  msgstr ""
574
 
575
+ #: build/editor.js:217
576
+ msgid "Add an always visible button that allows your audience to share feedback anytime."
577
  msgstr ""
578
 
579
+ #: build/editor.js:217
580
+ msgid "floating"
581
  msgstr ""
582
 
583
+ #: build/editor.js:217
584
+ msgid "contact"
585
  msgstr ""
586
 
587
+ #: build/editor.js:217
588
+ msgid "call to action"
589
  msgstr ""
590
 
591
+ #: build/editor.js:217
592
+ msgid "cta"
593
  msgstr ""
594
 
595
+ #: build/editor.js:217
596
+ #: build/editor.js:577
597
+ msgid "button"
598
  msgstr ""
599
 
600
+ #: build/editor.js:217
601
+ msgid "subscribe"
602
  msgstr ""
603
 
604
+ #: build/editor.js:217
605
+ #: build/editor.js:301
606
+ #: build/editor.js:421
607
+ #: build/editor.js:577
608
+ msgid "form"
609
  msgstr ""
610
 
611
+ #: build/editor.js:217
612
+ msgid "email"
613
  msgstr ""
614
 
615
+ #: build/editor.js:217
616
+ msgid "message"
617
  msgstr ""
618
 
619
+ #: build/editor.js:229
620
+ #: build/editor.js:313
621
+ msgid "Save the block to track results on "
622
  msgstr ""
623
 
624
+ #: build/editor.js:229
625
+ #: build/editor.js:313
626
+ msgid "Title (optional)"
627
  msgstr ""
628
 
629
+ #: build/editor.js:229
630
+ msgid "Send me responses via email"
631
  msgstr ""
632
 
633
+ #. translators: %s: email address
634
+ #: build/editor.js:229
635
+ msgid "Responses will be sent to %s"
636
  msgstr ""
637
 
638
+ #: build/editor.js:229
639
+ msgid "Hide Shadow"
640
  msgstr ""
641
 
642
+ #: build/editor.js:229
643
+ #: build/editor.js:313
644
+ #: build/editor.js:433
645
+ msgid "Block styling"
646
  msgstr ""
647
 
648
+ #: build/editor.js:229
649
+ #: build/editor.js:313
650
+ msgid "Button color"
651
  msgstr ""
652
 
653
+ #: build/editor.js:229
654
+ #: build/editor.js:313
655
+ msgid "Button text color"
656
  msgstr ""
657
 
658
+ #: build/editor.js:229
659
+ #: build/editor.js:313
660
+ msgid "Close on"
661
  msgstr ""
662
 
663
+ #: build/editor.js:229
664
+ msgid "Show feedback form on:"
665
  msgstr ""
666
 
667
+ #: build/editor.js:229
668
+ msgid "Click"
669
  msgstr ""
670
 
671
+ #: build/editor.js:229
672
+ msgid "Hover"
673
  msgstr ""
674
 
675
+ #: build/editor.js:229
676
+ msgid "Page load"
677
  msgstr ""
678
 
679
+ #: build/editor.js:229
680
+ msgid "Require email address"
681
  msgstr ""
682
 
683
+ #: build/editor.js:241
684
+ #: build/editor.js:325
685
+ msgid "Current view"
686
  msgstr ""
687
 
688
+ #: build/editor.js:241
689
+ msgid "Question"
690
  msgstr ""
691
 
692
+ #: build/editor.js:241
693
+ msgid "Change button position"
694
  msgstr ""
695
 
696
+ #: build/editor.js:289
697
+ msgid "Crowdsignal NPS"
698
  msgstr ""
699
 
700
+ #: build/editor.js:289
701
+ msgid "Preview"
702
  msgstr ""
703
 
704
+ #. translators: %d: number of pageviews
705
+ #: build/editor.js:289
706
+ msgid "This block will appear as a popup window to people who have visited this page at least %d time."
707
+ msgid_plural "This block will appear as a popup window to people who have visited this page at least %d times."
708
+ msgstr[0] ""
709
+ msgstr[1] ""
710
+
711
+ #: build/editor.js:289
712
+ msgid "Enter your rating question"
713
  msgstr ""
714
 
715
+ #: build/editor.js:289
716
+ msgid "Not likely"
717
  msgstr ""
718
 
719
+ #: build/editor.js:289
720
+ msgid "Very likely"
721
  msgstr ""
722
 
723
+ #: build/editor.js:289
724
+ msgid "Enter your feedback question"
725
  msgstr ""
726
 
727
+ #: build/editor.js:301
728
+ msgid "Measure NPS"
729
  msgstr ""
730
 
731
+ #: build/editor.js:301
732
+ msgid "Calculate your Net Promoter Score! Collect feedback and track customer satisfaction over time. — powered by Crowdsignal."
733
  msgstr ""
734
 
735
+ #: build/editor.js:301
736
+ #: build/editor.js:421
737
+ msgid "ask"
738
  msgstr ""
739
 
740
+ #: build/editor.js:301
741
+ msgid "CSAT"
742
  msgstr ""
743
 
744
+ #: build/editor.js:301
745
+ msgid "customer experience"
746
  msgstr ""
747
 
748
+ #: build/editor.js:301
749
+ msgid "customer satisfaction"
750
  msgstr ""
751
 
752
+ #: build/editor.js:301
753
+ msgid "loyalty"
754
  msgstr ""
755
 
756
+ #: build/editor.js:301
757
+ msgid "net promoter score"
758
  msgstr ""
759
 
760
+ #: build/editor.js:301
761
+ msgid "nps"
762
  msgstr ""
763
 
764
+ #: build/editor.js:301
765
+ #: build/editor.js:421
766
+ #: build/editor.js:577
767
+ msgid "poll"
768
  msgstr ""
769
 
770
+ #: build/editor.js:301
771
+ msgid "promoter"
772
  msgstr ""
773
 
774
+ #: build/editor.js:301
775
+ #: build/editor.js:421
776
+ #: build/editor.js:577
777
+ msgid "research"
778
  msgstr ""
779
 
780
+ #: build/editor.js:301
781
+ msgid "review"
782
  msgstr ""
783
 
784
+ #: build/editor.js:301
785
+ msgid "score"
786
  msgstr ""
787
 
788
+ #: build/editor.js:301
789
+ #: build/editor.js:421
790
+ #: build/editor.js:577
791
+ msgid "survey"
792
  msgstr ""
793
 
794
+ #: build/editor.js:301
795
+ msgid "How satisfied are you with the content of the site?"
796
  msgstr ""
797
 
798
+ #: build/editor.js:301
799
+ msgid "Any advise on how we could improve your experience?"
800
  msgstr ""
801
 
802
+ #: build/editor.js:301
803
+ msgid "Not satisfied"
804
  msgstr ""
805
 
806
+ #: build/editor.js:301
807
+ msgid "Very satisfied"
808
  msgstr ""
809
 
810
+ #: build/editor.js:325
811
+ msgid "Rating"
812
  msgstr ""
813
 
814
+ #: build/editor.js:325
815
+ msgid "Set view threshold"
816
  msgstr ""
817
 
818
+ #: build/editor.js:325
819
+ msgid "Show this block after __ visits:"
820
  msgstr ""
821
 
822
+ #: build/editor.js:373
823
+ msgid "Enter an answer"
824
  msgstr ""
825
 
826
+ #: build/editor.js:397
827
+ msgid "Warning! This poll is published. Deleting or reordering answers may cause the loss of existing responses."
828
  msgstr ""
829
 
830
+ #: build/editor.js:397
831
+ msgid "Edit"
832
  msgstr ""
833
 
834
+ #: build/editor.js:409
835
+ msgid "Crowdsignal Poll"
836
  msgstr ""
837
 
838
+ #: build/editor.js:409
839
+ msgid "Enter your question"
840
  msgstr ""
841
 
842
+ #: build/editor.js:409
843
+ msgid "Add a note (optional)"
844
  msgstr ""
845
 
846
+ #: build/editor.js:421
847
+ msgid "Poll"
848
  msgstr ""
849
 
850
+ #: build/editor.js:421
851
+ msgid "Create polls and get your audience’s opinion — powered by Crowdsignal."
852
  msgstr ""
853
 
854
+ #: build/editor.js:421
855
+ msgid "pop"
856
  msgstr ""
857
 
858
+ #: build/editor.js:421
859
+ msgid "question"
860
  msgstr ""
861
 
862
+ #: build/editor.js:421
863
+ msgid "quiz"
864
  msgstr ""
865
 
866
+ #: build/editor.js:421
867
+ #: build/editor.js:577
868
+ msgid "vote"
869
  msgstr ""
870
 
871
+ #: build/editor.js:421
872
+ msgid "How did you hear about us?"
873
  msgstr ""
874
 
875
+ #: build/editor.js:421
876
+ msgid "Search"
877
  msgstr ""
878
 
879
+ #: build/editor.js:421
880
+ msgid "Friend"
881
  msgstr ""
882
 
883
+ #: build/editor.js:421
884
+ msgid "Email"
885
  msgstr ""
886
 
887
+ #: build/editor.js:421
888
+ #: build/editor.js:433
889
+ msgid "List"
890
  msgstr ""
891
 
892
+ #: build/editor.js:433
893
+ msgid "Title of the poll block"
894
  msgstr ""
895
 
896
+ #: build/editor.js:433
897
+ msgid "Confirmation message"
898
  msgstr ""
899
 
900
+ #: build/editor.js:433
901
+ msgid "On submission"
902
  msgstr ""
903
 
904
+ #: build/editor.js:433
905
+ msgid "Show results"
906
  msgstr ""
907
 
908
+ #: build/editor.js:433
909
+ msgid "Show \"Thank You\" message"
910
  msgstr ""
911
 
912
+ #: build/editor.js:433
913
+ msgid "Show a custom text message"
914
  msgstr ""
915
 
916
+ #: build/editor.js:433
917
+ msgid "Message text"
918
  msgstr ""
919
 
920
+ #: build/editor.js:433
921
+ #: build/poll.js:241
922
+ msgid "Thanks for voting!"
923
  msgstr ""
924
 
925
+ #: build/editor.js:433
926
+ msgid "Redirect address"
927
  msgstr ""
928
 
929
+ #: build/editor.js:433
930
+ msgid "Close poll on"
931
  msgstr ""
932
 
933
+ #: build/editor.js:433
934
+ msgid "When poll is closed"
935
  msgstr ""
936
 
937
+ #: build/editor.js:433
938
+ msgid "Show poll with \"Closed\" banner"
939
  msgstr ""
940
 
941
+ #: build/editor.js:433
942
+ msgid "Hide poll"
943
  msgstr ""
944
 
945
+ #: build/editor.js:433
946
+ msgid "Choose font"
947
  msgstr ""
948
 
949
+ #: build/editor.js:433
950
+ msgid "Default theme font"
951
  msgstr ""
952
 
953
+ #: build/editor.js:433
954
+ msgid "Width (%)"
955
  msgstr ""
956
 
957
+ #: build/editor.js:433
958
+ msgid "Reset"
959
  msgstr ""
960
 
961
+ #: build/editor.js:433
962
+ msgid "Drop shadow"
963
  msgstr ""
964
 
965
+ #: build/editor.js:433
966
+ msgid "Button styling"
967
  msgstr ""
968
 
969
+ #: build/editor.js:433
970
+ msgid "Alignment"
971
  msgstr ""
972
 
973
+ #: build/editor.js:433
974
+ msgid "Inline"
975
  msgstr ""
976
 
977
+ #: build/editor.js:433
978
+ msgid "Answer settings"
979
  msgstr ""
980
 
981
+ #: build/editor.js:433
982
+ msgid "One response per computer"
983
+ msgstr ""
 
 
984
 
985
+ #: build/editor.js:433
986
+ msgid "Randomize answer order"
987
  msgstr ""
988
 
989
+ #: build/editor.js:469
990
+ msgid "Choose one answer"
991
  msgstr ""
992
 
993
+ #: build/editor.js:469
994
+ msgid "Choose multiple answers"
995
  msgstr ""
996
 
997
+ #: build/editor.js:517
998
+ msgid "Vote Item"
 
 
999
  msgstr ""
1000
 
1001
+ #: build/editor.js:517
1002
+ #: build/editor.js:577
1003
+ msgid "Allow your audience to rate your work or express their opinion — powered by Crowdsignal."
1004
  msgstr ""
1005
 
1006
+ #: build/editor.js:565
1007
+ msgid "Untitled Vote"
1008
  msgstr ""
1009
 
1010
+ #: build/editor.js:565
1011
+ msgid "Crowdsignal Vote"
1012
  msgstr ""
1013
 
1014
+ #: build/editor.js:577
1015
+ msgid "Vote"
1016
  msgstr ""
1017
 
1018
+ #: build/editor.js:577
1019
+ msgid "ballot"
1020
  msgstr ""
1021
 
1022
+ #: build/editor.js:577
1023
+ msgid "count"
1024
  msgstr ""
1025
 
1026
+ #: build/editor.js:577
1027
+ msgid "deciding"
1028
  msgstr ""
1029
 
1030
+ #: build/editor.js:577
1031
+ msgid "decision"
1032
  msgstr ""
1033
 
1034
+ #: build/editor.js:577
1035
+ msgid "elect"
1036
  msgstr ""
1037
 
1038
+ #: build/editor.js:577
1039
+ msgid "election"
1040
  msgstr ""
1041
 
1042
+ #: build/editor.js:577
1043
+ msgid "nero"
1044
  msgstr ""
1045
 
1046
+ #: build/editor.js:577
1047
+ msgid "polling"
1048
  msgstr ""
1049
 
1050
+ #: build/editor.js:577
1051
+ msgid "rate"
1052
  msgstr ""
1053
 
1054
+ #: build/editor.js:577
1055
+ msgid "thumb down"
1056
  msgstr ""
1057
 
1058
+ #: build/editor.js:577
1059
+ msgid "thumb up"
1060
  msgstr ""
1061
 
1062
+ #: build/editor.js:577
1063
+ msgid "thumbs"
1064
  msgstr ""
1065
 
1066
+ #: build/editor.js:589
1067
+ msgid "Title of the vote block"
1068
  msgstr ""
1069
 
1070
+ #: build/editor.js:589
1071
+ msgid "Close vote block on"
1072
  msgstr ""
1073
 
1074
+ #: build/editor.js:601
1075
+ msgid "Show vote counters"
1076
  msgstr ""
1077
 
1078
+ #: build/editor.js:601
1079
+ msgid "Hide vote counters"
1080
  msgstr ""
1081
 
1082
+ #: build/editor.js:649
1083
+ msgid "Top"
1084
  msgstr ""
1085
 
1086
+ #: build/editor.js:649
1087
+ msgid "Bottom"
1088
  msgstr ""
1089
 
1090
+ #: build/editor.js:649
1091
+ msgid "Left"
1092
  msgstr ""
1093
 
1094
+ #: build/editor.js:649
1095
+ msgid "Right"
1096
  msgstr ""
1097
 
1098
+ #: build/editor.js:649
1099
+ msgid "Center"
1100
  msgstr ""
1101
 
1102
+ #: build/editor.js:697
1103
+ msgid "Change block position"
1104
  msgstr ""
1105
 
1106
+ #: build/editor.js:721
1107
+ msgid "You need to connect to a Crowdsignal account to collect and manage your results."
1108
  msgstr ""
1109
 
1110
+ #: build/editor.js:721
1111
+ msgid "Please verify your WordPress.com email address in order to publish your poll."
1112
  msgstr ""
1113
 
1114
+ #: build/editor.js:721
1115
+ msgid "Connect to Crowdsignal"
1116
  msgstr ""
1117
 
1118
+ #: build/editor.js:721
1119
+ msgid "Verify or Change your Email Address"
1120
  msgstr ""
1121
 
1122
+ #: build/editor.js:757
1123
+ #: build/feedback.js:193
1124
+ #: build/nps.js:133
1125
+ #: build/poll.js:121
1126
+ msgid "Create your own poll with Crowdsignal"
1127
  msgstr ""
1128
 
1129
+ #: build/editor.js:757
1130
+ #: build/feedback.js:193
1131
+ #: build/nps.js:133
1132
+ #: build/poll.js:121
1133
+ msgid "Hide"
1134
  msgstr ""
1135
 
1136
+ #. translators: %s: Number of votes.
1137
+ #: build/editor.js:913
1138
+ #: build/poll.js:169
1139
+ msgid "%s vote"
1140
+ msgid_plural "%s votes"
1141
+ msgstr[0] ""
1142
+ msgstr[1] ""
1143
+
1144
+ #: build/editor.js:925
1145
+ #: build/poll.js:193
1146
+ msgid "This Poll is Hidden"
1147
  msgstr ""
1148
 
1149
+ #: build/editor.js:925
1150
+ #: build/poll.js:193
1151
+ msgid "This Poll is Closed"
1152
  msgstr ""
1153
 
1154
+ #: build/editor.js:925
1155
+ #: build/poll.js:193
1156
+ msgid "Thanks For Voting!"
1157
  msgstr ""
1158
 
1159
+ #. translators: %s: Number of votes
1160
+ #: build/editor.js:949
1161
+ #: build/poll.js:229
1162
+ msgid "%s total vote"
1163
+ msgid_plural "%s total votes"
1164
+ msgstr[0] ""
1165
+ msgstr[1] ""
1166
+
1167
+ #: build/editor.js:973
1168
+ msgid "Retry"
1169
  msgstr ""
1170
 
1171
+ #: build/editor.js:973
1172
+ msgid "Unfortunately, the block couldn't be saved to Crowdsignal.com."
1173
  msgstr ""
1174
 
1175
+ #: build/editor.js:985
1176
+ msgid "Upgrade"
1177
  msgstr ""
1178
 
1179
+ #: build/editor.js:985
1180
+ #: build/editor.js:997
1181
+ msgid "Your free Crowdsignal account has "
1182
  msgstr ""
1183
 
1184
+ #: build/editor.js:985
1185
+ msgid "reached the signals limit."
1186
  msgstr ""
1187
 
1188
+ #: build/editor.js:985
1189
+ msgid "Hide Crowdsignal branding and get "
1190
  msgstr ""
1191
 
1192
+ #: build/editor.js:985
1193
+ msgid "unlimited signals"
1194
  msgstr ""
1195
 
1196
+ #: build/editor.js:997
1197
+ msgid "Please upgrade"
1198
  msgstr ""
1199
 
1200
+ #: build/editor.js:997
1201
+ msgid "exceeded 2500 signals."
1202
  msgstr ""
1203
 
1204
+ #: build/feedback.js:169
1205
  msgid "Close"
1206
  msgstr ""
1207
 
1208
+ #: build/nps.js:157
1209
  msgid "Thanks so much for your feedback!"
1210
  msgstr ""