-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathsurveyjs-widgets.min.js
268 lines (268 loc) · 88.3 KB
/
surveyjs-widgets.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/*!
* surveyjs-widgets - Widgets for the SurveyJS library v1.0.13
* Copyright (c) 2015-2017 Devsoft Baltic OÜ - http://surveyjs.io/
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("inputmask"),require("nouislider"),require("signature_pad"),require("sortablejs"),require("bootstrap-slider")):"function"==typeof define&&define.amd?define("surveyjs-widgets",["inputmask","nouislider","signature_pad","sortablejs","bootstrap-slider"],t):"object"==typeof exports?exports["surveyjs-widgets"]=t(require("inputmask"),require("nouislider"),require("signature_pad"),require("sortablejs"),require("bootstrap-slider")):e["surveyjs-widgets"]=t(e.Inputmask,e.noUiSlider,e.SignaturePad,e.Sortable,e.Slider)}(this,function(e,t,i,n,o){return function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=23)}([function(e,t,i){"use strict";function n(e,t){t=t||window.$;var i={className:"iradio_square-blue",name:"icheck",widgetIsLoaded:function(){return!!t.fn.iCheck},isFit:function(e){var t=e.getType();return"radiogroup"===t||"checkbox"===t||"matrix"===t},isDefaultRender:!0,afterRender:function(e,i){var n=this,o=t(i);o.find("input").data({iCheck:void 0}),o.find("input").iCheck({checkboxClass:n.className,radioClass:n.className});var a=function(){if("matrix"!==e.getType()){var n=e.value;Array.isArray(n)||(n=[n]),n.forEach(function(e){o.find("input[value="+e+"]").iCheck("check")})}else e.generatedVisibleRows.forEach(function(e,n,o){e.value&&t(i).find("input[name='"+e.fullName+"'][value="+e.value+"]").iCheck("check")})};o.find("input").on("ifChecked",function(t){if("matrix"===e.getType())e.generatedVisibleRows.forEach(function(e,i,n){e.fullName===t.target.name&&(e.value=t.target.value)});else if("checkbox"===e.getType()){var i=e.value||[];e.value=i.concat([t.target.value])}else e.value=t.target.value}),o.find("input").on("ifUnchecked",function(t){if("checkbox"===e.getType()){var i=e.value||[],n=i.indexOf(t.target.value);n>=0&&(e.value=i.splice(n,1))}}),e.valueChangedCallback=a,a()},willUnmount:function(e,i){t(i).find("input").iCheck("destroy")}};e.CustomWidgetCollection.Instance.addCustomWidget(i,"type")}Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof Survey&&n(Survey,window.$),t.default=n},function(e,t,i){"use strict";function n(e,t){t=t||window.$;var i={activatedBy:"property",name:"select2",htmlTemplate:"<select style='width: 100%;'></select>",widgetIsLoaded:function(){return"function"==typeof t&&!!t.fn.select2},isFit:function(e){return"property"==i.activatedBy?"select2"===e.renderAs&&"dropdown"===e.getType():"type"==i.activatedBy?"dropdown"==typeof e.getType():"customtype"==i.activatedBy&&"select2"===e.getType()},activatedByChanged:function(t){this.widgetIsLoaded()&&(i.activatedBy=t,e.JsonObject.metaData.removeProperty("dropdown","renderAs"),"property"==t&&e.JsonObject.metaData.addProperty("dropdown",{name:"renderAs",default:"standard",choices:["standard","select2"]}),"customtype"==t&&e.JsonObject.metaData.addClass("select2",[],null,"dropdown"))},afterRender:function(e,i){var n=t(i).is("select")?t(i):t(i).find("select"),o=document.createElement("input");o.type="text",o.style.marginTop="3px",o.style.display="none",o.style.width="100%",n.parent().get(0).appendChild(o);var a=(n.select2({theme:"classic"}),function(){n.val(e.value).trigger("change"),o.style.display=e.isOtherSelected?"":"none"}),r=function(){o.value=e.comment?e.comment:""},d=function(){e.comment=o.value},s=function(){n.select2().empty(),n.select2({data:e.visibleChoices.map(function(e){return{id:e.value,text:e.text}})}),a(),r()};e.choicesChangedCallback=s,s(),n.on("select2:select",function(t){e.value=t.target.value}),o.onchange=d,e.valueChangedCallback=a,e.commentChangedCallback=r,a(),r()},willUnmount:function(e,i){t(i).find("select").off("select2:select").select2("destroy")}};e.CustomWidgetCollection.Instance.addCustomWidget(i)}Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof Survey&&n(Survey,window.$),t.default=n},function(e,t,i){"use strict";function n(e,t){t=t||window.$;var i={name:"imagepicker",title:"Image picker",iconName:"icon-imagepicker",widgetIsLoaded:function(){return!!t.fn.imagepicker},isFit:function(e){return"imagepicker"===e.getType()},isDefaultRender:!0,activatedByChanged:function(t){e.JsonObject.metaData.addClass("imageitemvalues",[],null,"itemvalue"),e.JsonObject.metaData.addProperty("imagepicker",{name:"imageLink"}),e.JsonObject.metaData.addClass("imagepicker",[{name:"hasOther",visible:!1},{name:"otherText",visible:!1},{name:"optionsCaption",visible:!1},{name:"otherErrorText",visible:!1},{name:"storeOthersAsComment",visible:!1},{name:"renderAs",visible:!1}],null,"dropdown"),e.JsonObject.metaData.addProperty("imagepicker",{name:"showLabel:boolean",default:!1}),e.JsonObject.metaData.addProperty("imagepicker",{name:"choices:imageitemvalues",onGetValue:function(t){return e.ItemValue.getData(t.choices)},onSetValue:function(e,t){e.choices=t}})},afterRender:function(e,i){for(var n=t(i).is("select")?t(i):t(i).find("select"),o=n.find("option"),a=e.choices,r=1;r<o.length&&r-1<a.length;r++)t(o[r]).data("imgSrc",a[r-1].imageLink),o[r].selected=e.value==o[r].value;n.imagepicker({hide_select:!0,show_label:e.showLabel,selected:function(t){e.value=t.picker.select[0].value}})},willUnmount:function(e,i){t(i).find("select").data("picker").destroy()}};e.CustomWidgetCollection.Instance.addCustomWidget(i,"customtype")}Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof Survey&&n(Survey,window.$),t.default=n},function(e,t,i){"use strict";function n(e){var t={name:"maskedit",numericGroupSeparator:",",numericAutoGroup:!0,numericDigits:2,numericDigitsOptional:!1,numericPrefix:"$",numericPlaceholder:"0",widgetIsLoaded:function(){return void 0!==a.a},isFit:function(e){return"multipletext"==e.getType()||"text"==e.getType()&&("none"!=e.inputMask||e.inputFormat)},isDefaultRender:!0,activatedByChanged:function(t){if(!e.JsonObject.metaData.findProperty("text","inputMask")){var i=["inputFormat",{name:"inputMask",default:"none",choices:["none","datetime","currency","decimal","email","phone","ip"]}];e.JsonObject.metaData.addProperties("text",i),e.JsonObject.metaData.addProperties("matrixdropdowncolumn",i),e.JsonObject.metaData.addProperties("multipletextitem",i)}},applyInputMask:function(e,t){var i=this,n="none"!=e.inputMask?e.inputMask:e.inputFormat,o={};"none"!=e.inputMask&&(o.inputFormat=e.inputFormat),"currency"!=e.inputMask&&"decimal"!=e.inputMask||(o.groupSeparator=i.numericGroupSeparator,o.autoGroup=i.numericAutoGroup),"currency"==e.inputMask&&(o.digits=i.numericDigits,o.digitsOptional=i.numericDigitsOptional,o.prefix=i.numericPrefix,o.placeholder=i.numericPlaceholder),"datetime"==e.inputMask&&(n=e.inputFormat),a()(n,o).mask(t),t.oninput=function(){e.customWidgetData.isNeedRender=!0};var r=function(){t.value=void 0===e.value?"":e.value};e.valueChangedCallback=r,r()},afterRender:function(e,t){if("multipletext"!=e.getType()){var i=t.querySelector("input")||t;this.applyInputMask(e,i)}else for(var n=0;n<e.items.length;n++){var o=e.items[n];if("none"!=o.inputMask||o.inputFormat){var i=t.querySelector("#"+o.id);i&&this.applyInputMask(o,i)}}},willUnmount:function(e,t){(t.querySelector("input")||t).inputmask.remove()}};e.CustomWidgetCollection.Instance.addCustomWidget(t)}Object.defineProperty(t,"__esModule",{value:!0});var o=i(4),a=i.n(o);"undefined"!=typeof Survey&&n(Survey),t.default=n},function(t,i){t.exports=e},function(e,t,i){"use strict";function n(e,t){t=t||window.$;var i={name:"barrating",title:"Bar rating",iconName:"icon-barrating",widgetIsLoaded:function(){return!!t.fn.barrating},defaultJSON:{choices:[1,2,3,4,5]},isFit:function(e){return"barrating"===e.getType()},isDefaultRender:!0,activatedByChanged:function(t){e.JsonObject.metaData.addClass("barrating",[{name:"hasOther",visible:!1},{name:"otherText",visible:!1},{name:"optionsCaption",visible:!1},{name:"otherErrorText",visible:!1},{name:"storeOthersAsComment",visible:!1},{name:"renderAs",visible:!1}],null,"dropdown"),e.JsonObject.metaData.addProperty("barrating",{name:"showValues:boolean",default:!1}),e.JsonObject.metaData.addProperty("barrating",{name:"ratingTheme",default:"css-stars",choices:["fontawesome-stars","css-stars","bars-pill","bars-1to10","bars-movie","bars-square","bars-reversed","bars-horizontal","bootstrap-stars","fontawesome-stars-o"]})},afterRender:function(e,i){(t(i).is("select")?t(i):t(i).find("select")).barrating("show",{theme:e.ratingTheme,initialRating:e.value,showValues:e.showValues,showSelectedRating:!1,onSelect:function(t,i){e.value=t}}),e.valueChangedCallback=function(){t(i).find("select").barrating("set",e.value)}},willUnmount:function(e,i){t(i).find("select").barrating("destroy")}};e.CustomWidgetCollection.Instance.addCustomWidget(i,"customtype")}Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof Survey&&n(Survey,window.$),t.default=n},function(e,t,i){"use strict";function n(e,t){t=t||window.$;var i={name:"datepicker",title:"Date picker",iconName:"icon-datepicker",widgetIsLoaded:function(){return!!t.fn.datepicker},isFit:function(e){return"datepicker"===e.getType()},htmlTemplate:"<input class='form-control widget-datepicker' type='text' style='width: 100%;'>",activatedByChanged:function(t){e.JsonObject.metaData.addClass("datepicker",[{name:"inputType",visible:!1},{name:"inputFormat",visible:!1},{name:"inputMask",visible:!1}],null,"text"),e.JsonObject.metaData.addProperty("datepicker",{name:"dateFormat",default:"mm/dd/yy",choices:["mm/dd/yy","yy-mm-dd","d M, y","d MM, y","DD, d MM, yy","'day' d 'of' MM 'in the year' yy"]})},afterRender:function(e,i){var n=t(i).is(".widget-datepicker")?t(i):t(i).find(".widget-datepicker"),o=n.datepicker({dateFormat:e.dateFormat,option:{minDate:null,maxDate:null},onSelect:function(t){e.value=t}});e.valueChangedCallback=function(){e.value?o.datepicker("setDate",new Date(e.value)):o.datepicker("setDate",null)},e.valueChangedCallback()},willUnmount:function(e,i){(t(i).is(".widget-datepicker")?t(i):t(i).find(".widget-datepicker")).datepicker("destroy")}};e.CustomWidgetCollection.Instance.addCustomWidget(i,"customtype")}Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof Survey&&n(Survey,window.$),t.default=n},function(e,t,i){"use strict";function n(e){var t={name:"nouislider",title:"noUiSlider",iconName:"icon-nouislider",widgetIsLoaded:function(){return void 0!==a.a},isFit:function(e){return"nouislider"===e.getType()},htmlTemplate:"<div></div>",activatedByChanged:function(t){e.JsonObject.metaData.addClass("nouislider",[],null,"empty"),e.JsonObject.metaData.addProperties("nouislider",[{name:"step:number",default:1},{name:"rangeMin:number",default:0},{name:"rangeMax:number",default:100}])},afterRender:function(e,t){e.value=(e.rangeMin+e.rangeMax)/2,t.style.marginBottom="50px";var i=a.a.create(t,{start:e.value,connect:[!0,!1],step:e.step,tooltips:!0,pips:{mode:"positions",values:[0,25,50,75,100],density:5},range:{min:e.rangeMin,max:e.rangeMax}});i.on("set",function(){e.value=i.get()});var n=function(){i.set(e.value)};e.noUiSlider=i,e.valueChangedCallback=n},willUnmount:function(e,t){e.noUiSlider.destroy(),e.noUiSlider=null}};e.CustomWidgetCollection.Instance.addCustomWidget(t,"customtype")}Object.defineProperty(t,"__esModule",{value:!0});var o=i(8),a=i.n(o);"undefined"!=typeof Survey&&n(Survey),t.default=n},function(e,i){e.exports=t},function(e,t,i){"use strict";function n(e,t){t=t||window.$;var i={name:"tagbox",title:"Tag box",iconName:"icon-tagbox",widgetIsLoaded:function(){return"function"==typeof t&&!!t.fn.select2},defaultJSON:{choices:["Item 1","Item 2","Item 3"]},htmlTemplate:"<select multiple='multiple' style='width: 100%;'></select>",isFit:function(e){return"tagbox"===e.getType()},activatedByChanged:function(t){e.JsonObject.metaData.addClass("tagbox",[{name:"hasOther",visible:!1}],null,"checkbox")},afterRender:function(e,i){var n=t(i).is("select")?t(i):t(i).find("select");n.select2({tags:"true",theme:"classic"});var o=function(){n.val(e.value).trigger("change")},a=function(){n.select2().empty(),n.select2({data:e.visibleChoices.map(function(e){return{id:e.value,text:e.text}})}),o()};e.choicesChangedCallback=a,e.valueChangedCallback=o,n.on("select2:select",function(t){e.value=(e.value||[]).concat(t.params.data.id)}),n.on("select2:unselect",function(t){var i=(e.value||[]).indexOf(t.params.data.id);if(-1!==i){var n=e.value;n.splice(i,1),e.value=n}}),a()},willUnmount:function(e,i){t(i).find("select").off("select2:select").select2("destroy")}};e.CustomWidgetCollection.Instance.addCustomWidget(i,"customtype")}Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof Survey&&n(Survey,window.$),t.default=n},function(e,t,i){"use strict";function n(e){var t=e.getContext("2d"),i=window.devicePixelRatio||1,n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,o=i/n,a=e.width,r=e.height;e.width=a*o,e.height=r*o,e.style.width=a+"px",e.style.height=r+"px",t.scale(o,o)}function o(e){var t={name:"signaturepad",title:"Signature pad",iconName:"icon-signaturepad",widgetIsLoaded:function(){return void 0!==r.a},penColor:"#1ab394",isFit:function(e){return"signaturepad"===e.getType()},htmlTemplate:"<div class='sjs_sp_container'><div><canvas></canvas></div><div class='sjs_sp_controls'><button type='button' class='sjs_sp_clear' title='Clear'>✖</button></div></div><style>.sjs_sp_container { position: relative; } .sjs_sp_controls { position: absolute; left: 0; bottom: 0; } .sjs_sp_controls > button { user-select: none; }</style>",activatedByChanged:function(t){e.JsonObject.metaData.addClass("signaturepad",[],null,"empty"),e.JsonObject.metaData.addProperties("signaturepad",[{name:"allowClear:boolean",default:!0},{name:"width:number",default:300},{name:"height:number",default:200}])},afterRender:function(e,t){var i=this,o=t.getElementsByTagName("canvas")[0],a=new r.a(o);e.isReadOnly&&a.off(),a.penColor=i.penColor,a.onEnd=function(){var t=a.toDataURL();e.value=t};var d=function(){o.width=e.width,o.height=e.height,n(o),a.fromDataURL(e.value||"data:image/gif;base64,R0lGODlhAQABAIAAAP")};e.valueChangedCallback=d,d(),e.signaturePad=a;var s=t.getElementsByTagName("button")[0];e.allowClear&&!e.isReadOnly?s.onclick=function(){e.value=void 0}:s.parentNode.removeChild(s)},willUnmount:function(e,t){e.signaturePad&&e.signaturePad.off(),e.signaturePad=null}};e.CustomWidgetCollection.Instance.addCustomWidget(t,"customtype")}Object.defineProperty(t,"__esModule",{value:!0});var a=i(11),r=i.n(a);"undefined"!=typeof Survey&&o(Survey),t.default=o},function(e,t){e.exports=i},function(e,t,i){"use strict";function n(e){var t={name:"sortablelist",title:"Sortable list",iconName:"icon-sortablelist",widgetIsLoaded:function(){return void 0!==a.a},defaultJSON:{choices:["Item 1","Item 2","Item 3"]},areaStyle:"border: 1px solid #1ab394; width:100%; min-height:50px",itemStyle:"background-color:#1ab394;color:#fff;margin:5px;padding:10px;",isFit:function(e){return"sortablelist"===e.getType()},htmlTemplate:"<div></div>",activatedByChanged:function(t){e.JsonObject.metaData.addClass("sortablelist",[{name:"hasOther",visible:!1},{name:"storeOthersAsComment",visible:!1}],null,"checkbox"),e.JsonObject.metaData.addProperty("sortablelist",{name:"emptyText",default:"Move items here."})},afterRender:function(e,t){var i=this;t.style.width="100%";var n=document.createElement("div"),o=document.createElement("span"),r=document.createElement("div");n.style.cssText=i.areaStyle,o.innerHTML=e.emptyText,n.appendChild(o),r.style.cssText=i.areaStyle,r.style.marginTop="10px",t.appendChild(n),t.appendChild(r);var d=function(t){var i=e.value;if(!Array.isArray(i))return!1;for(var n=0;n<i.length;n++)if(i[n]==t)return!0;return!1},s=!1,c=function(){if(!s){n.innerHTML="",n.appendChild(o),r.innerHTML="";var t=!1;e.activeChoices.forEach(function(e){var o=d(e.value);t=t||o;var a=o?n:r,s=document.createElement("div");s.innerHTML="<div style='"+i.itemStyle+"'>"+e.text+"</div>",s.dataset.value=e.value,a.appendChild(s)}),o.style.display=t?"none":""}};e.resultEl=a.a.create(n,{animation:150,group:e.name,onSort:function(t){var i=[];if(1===n.children.length)o.style.display="";else{o.style.display="none";for(var a=0;a<n.children.length;a++)void 0!==n.children[a].dataset.value&&i.push(n.children[a].dataset.value)}s=!0,e.value=i,s=!1}}),e.sourceEl=a.a.create(r,{animation:150,group:e.name}),e.valueChangedCallback=c,c()},willUnmount:function(e,t){e.resultEl.destroy(),e.sourceEl.destroy()}};e.CustomWidgetCollection.Instance.addCustomWidget(t,"customtype")}Object.defineProperty(t,"__esModule",{value:!0});var o=i(13),a=i.n(o);"undefined"!=typeof Survey&&n(Survey),t.default=n},function(e,t){e.exports=n},function(e,t,i){"use strict";function n(e){var t={name:"editor",title:"Editor",iconName:"icon-editor",widgetIsLoaded:function(){return"undefined"!=typeof CKEDITOR},isFit:function(e){return"editor"===e.getType()},htmlTemplate:"<textarea rows='10' cols='80' style: {width:'100%'}></textarea>",activatedByChanged:function(t){e.JsonObject.metaData.addClass("editor",[],null,"empty"),e.JsonObject.metaData.addProperty("editor",{name:"height",default:300})},afterRender:function(e,t){CKEDITOR.editorConfig=function(t){t.language="es",t.height=e.height,t.toolbarCanCollapse=!0};var i=CKEDITOR.replace(t),n=!1,o=function(){n||i.setData(e.value)};i.on("change",function(){n=!0,e.value=i.getData(),n=!1}),e.valueChangedCallback=o,o()},willUnmount:function(e,t){}};e.CustomWidgetCollection.Instance.addCustomWidget(t,"customtype")}Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof Survey&&n(Survey),t.default=n},function(e,t,i){"use strict";function n(e,t){t=t||window.$;var i={name:"autocomplete",widgetIsLoaded:function(){return!!t.fn.easyAutocomplete},isFit:function(e){return"text"===e.getType()},isDefaultRender:!0,activatedByChanged:function(t){null===e.JsonObject.metaData.findProperty("text","choices")&&null===e.JsonObject.metaData.findProperty("text","choicesByUrl")&&(e.JsonObject.metaData.addProperty("text",{name:"choices:itemvalues",onGetValue:function(t){return e.ItemValue.getData(t.choices||[])},onSetValue:function(e,t){e.choices||(e.choices=e.createItemValues("choices")),e.choices=t}}),e.JsonObject.metaData.addProperty("text",{name:"choicesByUrl:restfull",className:"ChoicesRestfull",onGetValue:function(e){return e&&e.choicesByUrl&&e.choicesByUrl.getData()},onSetValue:function(t,i){t.choicesByUrl||(t.choicesByUrl=new e.ChoicesRestfull),t.choicesByUrl.setData(i)}}))},afterRender:function(e,i){var n=t(i).is("input")?t(i):t(i).find("input"),o={data:(e.choices||[]).map(function(e){return e.getData()}),adjustWidth:!1,list:{sort:{enabled:!0},match:{enabled:!0}},placeholder:e.placeholder};e.choicesByUrl&&(o.url=function(t){return e.choicesByUrl.url},o.getValue=e.choicesByUrl.valueName),n.easyAutocomplete(o)},willUnmount:function(e,t){}};e.CustomWidgetCollection.Instance.addCustomWidget(i,"type")}Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof Survey&&n(Survey,window.$),t.default=n},function(e,t,i){"use strict";function n(e){const t={settings:{supportedTypes:["radiogroup","checkbox","boolean"],radiogroup:{rootClass:"pretty p-default p-round",inputType:"radio",states:[{stateClass:"state p-success",addOn:""}]},checkbox:{rootClass:"pretty p-default",inputType:"checkbox",states:[{stateClass:"state p-success",addOn:""}]},boolean:{rootClass:"pretty p-icon p-default p-has-indeterminate",inputType:"checkbox",states:[{stateClass:"state p-success",addOn:""},{stateClass:"state p-success p-is-indeterminate",iconClass:"icon mdi mdi-minus",addOn:""}]}},name:"pretty-checkbox",activatedBy:"property",widgetIsLoaded:function(){return!0},htmlTemplate:"<fieldset></fieldset>",isFit:function(e){const i=-1!==t.settings.supportedTypes.indexOf(e.getType());return"property"===t.activatedBy?"prettycheckbox"===e.renderAs&&i:"type"===t.activatedBy&&i},activatedByChanged:function(i){this.widgetIsLoaded()&&(t.activatedBy=i,t.settings.supportedTypes.forEach(function(t){e.JsonObject.metaData.removeProperty(t,"renderAs"),"property"===i&&e.JsonObject.metaData.addProperty(t,{name:"renderAs",default:"standard",choices:["standard","prettycheckbox"]})}))},isDefaultRender:!1,afterRender:function(e,t){const i={},n=e.getType(),o=this.settings[n],a="checkbox"===n,r="radiogroup"===n,d="boolean"===n;var s=!1;const c=function(t){s=!0;try{const i=arguments[0].target,n=i.value,o=i.checked;if(a){const d=e.value||[],c=d.indexOf(n);o?-1===c&&d.push(n):-1!==c&&d.splice(c,1),e.value=d}else e.value=r?n:o}finally{s=!1}},u=e.colCount>0?100/e.colCount+"%":"";(d?[{locText:e.locTitle,value:!!e.value}]:e.choices).forEach(function(r,s){const l=document.createElement("input");l.type=o.inputType,l.name=e.name+(a?""+s:""),l.onchange=c,l.value=r.value,d&&(l.indeterminate="indeterminate"===e.defaultValue);const f=document.createElement("div");f.className=o.rootClass,f.appendChild(l),o.states.forEach(function(e){const t=document.createElement("div");if(t.className=e.stateClass,e.iconClass){const i=document.createElement("i");i.className=e.iconClass,t.appendChild(i)}const n=document.createElement("label");r.locText.hasHtml?n.innerHTML=r.locText.html:n.textContent=r.locText.text,t.appendChild(n),f.appendChild(t),e.addOn&&t.insertAdjacentHTML("afterbegin",e.addOn)});const m=document.createElement("div");m.className="sv_cw_pretty_checkbox_"+n,m.style.display="inline-block",m.style.width=u,m.appendChild(f),t.appendChild(m),i[r.value]=l});const l=function(e){if(!s){var t=e||[];r&&(t=[e]),Object.values(i).forEach(function(e){-1!==t.indexOf(e.value)?e.setAttribute("checked",void 0):e.removeAttribute("checked")})}};e.valueChangedCallback=l,l(e.value)},willUnmount:function(e,t){e.valueChangedCallback=void 0}};e.CustomWidgetCollection.Instance.addCustomWidget(t,"property")}Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof Survey&&n(Survey),t.default=n},function(e,t,i){"use strict";function n(e){var t={name:"bootstrapslider",title:"Bootstrap Slider",iconName:"icon-bootstrap-slider",widgetIsLoaded:function(){return void 0!==o},isFit:function(e){return"bootstrapslider"===e.getType()},htmlTemplate:"<div></div>",activatedByChanged:function(t){e.JsonObject.metaData.addClass("bootstrapslider",[],null,"empty"),e.JsonObject.metaData.addProperties("bootstrapslider",[{name:"step:number",default:1},{name:"rangeMin:number",default:0},{name:"rangeMax:number",default:100}])},afterRender:function(e,t){var i=document.createElement("input");i.id=e.id,i.type="text",i.setAttribute("data-slider-id",e.name+"_"+e.id),i.setAttribute("data-slider-min",e.rangeMin),i.setAttribute("data-slider-max",e.rangeMax),i.setAttribute("data-slider-step",e.step),i.setAttribute("data-slider-value",e.value||e.rangeMin),t.appendChild(i);var n=new o(i,{id:e.name+"_"+e.id,min:e.rangeMin,max:e.rangeMax,step:e.step,value:e.value||e.rangeMin});n.on("change",function(t){e.value=n.getValue()});var a=function(){n.setValue(e.value||e.rangeMin)};e.bootstrapSlider=n,e.valueChangedCallback=a},willUnmount:function(e,t){e.bootstrapSlider.destroy(),e.bootstrapSlider=null}};e.CustomWidgetCollection.Instance.addCustomWidget(t,"customtype")}Object.defineProperty(t,"__esModule",{value:!0});var o=i(18);"undefined"!=typeof Survey&&n(Survey),t.default=n},function(e,t){e.exports=o},function(e,t,i){"use strict";function n(e){var t={name:"microphone",title:"Microphone",iconName:"icon-microphone",widgetIsLoaded:function(){return void 0!==a.a},isFit:function(e){return"microphone"===e.getType()},htmlTemplate:"<div><button type='button' title='Record'><i class='fa fa-microphone' aria-hidden='true'></i></button> <button type='button' title='Save'><i class='fa fa-cloud' aria-hidden='true'></i></button> <audio style='position:relative; top:16px; left:10px; height:35px;-moz-box-shadow: 2px 2px 4px 0px #006773;-webkit-box-shadow: 2px 2px 4px 0px #006773;box-shadow: 2px 2px 4px 0px #006773;' controls='true' ></audio></div>",activatedByChanged:function(t){e.JsonObject.metaData.addClass("microphone",[],null,"empty")},afterRender:function(e,t){var i=t.getElementsByTagName("button")[0],n=t.getElementsByTagName("button")[1],o=t.getElementsByTagName("audio")[0],r=function(t){var i={type:"audio",mimeType:"audio/webm",audioBitsPerSecond:44100,sampleRate:44100,bufferSize:32768,numberOfAudioChannels:1};console.log("successCallback"),e.survey.mystream=t,e.survey.recordRTC=a()(e.survey.mystream,i),void 0!==e.survey.recordRTC&&(console.log("startRecording"),e.survey.recordRTC.startRecording())},d=function(){alert("No microphone"),e.survey.recordRTC=void 0,e.survey.mystream=void 0},s=function(t){console.log("processAudio");var i=e.survey.recordRTC.getBlob(),n=new FileReader;n.onload=function(t){var i=t.target.result;console.log("dataUri: "+i),e.value=i,o.src=i,console.log("cleaning"),e.survey.recordRTC=void 0,e.survey.mystream=void 0},n.readAsDataURL(i)},c=function(){e.value=void 0,void 0!==e.survey.recordRTC&&(e.survey.recordRTC.stopRecording(f),void 0!==e.survey.mystream&&e.survey.mystream.getAudioTracks().forEach(function(e){e.stop()}));var t={video:!1,audio:!0};navigator.mediaDevices.getUserMedia(t).then(r.bind(this),d.bind(this))},u=function(){console.log("stopRecording"),void 0!==e.survey.recordRTC&&(e.survey.recordRTC.stopRecording(s.bind(this)),void 0!==e.survey.mystream&&e.survey.mystream.getAudioTracks().forEach(function(e){e.stop()}))};e.isReadOnly?i.parentNode.removeChild(i):i.onclick=c,e.isReadOnly?n.parentNode.removeChild(i):n.onclick=u,o.src=e.value;var l=function(){},f=function(){};e.valueChangedCallback=l},willUnmount:function(e,t){console.log("unmount microphone no record "),void 0!==e.survey.recordRTC&&(e.survey.recordRTC.stopRecording(doNothingHandler),void 0!==e.survey.mystream&&e.survey.mystream.getAudioTracks().forEach(function(e){e.stop()}),e.value=void 0,e.survey.recordRTC=void 0,e.survey.mystream=void 0)}};e.CustomWidgetCollection.Instance.addCustomWidget(t,"customtype")}Object.defineProperty(t,"__esModule",{value:!0});var o=i(20),a=i.n(o);"undefined"!=typeof Survey&&n(Survey),t.default=n},function(e,t,i){"use strict";(function(i,n){/**
* {@link https://github.com/muaz-khan/RecordRTC|RecordRTC} is a WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
* @summary Record audio, video or screen inside the browser.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef RecordRTC
* @class
* @example
* var recorder = RecordRTC(mediaStream or [arrayOfMediaStream], {
* type: 'video', // audio or video or gif or canvas
* recorderType: MediaStreamRecorder || CanvasRecorder || StereoAudioRecorder || Etc
* });
* recorder.startRecording();
* @see For further information:
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {MediaStream} mediaStream - Single media-stream object, array of media-streams, html-canvas-element, etc.
* @param {object} config - {type:"video", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, desiredSampRate: 16000, video: HTMLVideoElement, etc.}
*/
function o(e,t){function i(i){return i&&(t=new a(e,i)),t.disableLogs||console.log("started recording "+t.type+" stream."),v?(v.clearRecordedData(),v.record(),h("recording"),b.recordingDuration&&p(),b):(n(function(){b.recordingDuration&&p()}),b)}function n(i){i&&(t.initCallback=function(){i(),i=t.initCallback=null});var n=new r(e,t);v=new n(e,t),v.record(),h("recording"),t.disableLogs||console.log("Initialized recorderType:",v.constructor.name,"for output-type:",t.type)}function d(e){function i(i){if(!v)return void("function"==typeof e.call?e.call(b,""):e(""));Object.keys(v).forEach(function(e){"function"!=typeof v[e]&&(b[e]=v[e])});var n=v.blob;if(!n){if(!i)throw"Recording failed.";v.blob=n=i}if(n&&!t.disableLogs&&console.log(n.type,"->",s(n.size)),e){var o=M.createObjectURL(n);"function"==typeof e.call?e.call(b,o):e(o)}t.autoWriteToDisk&&m(function(e){var i={};i[t.type+"Blob"]=e,I.Store(i)})}return e=e||function(){},v?"paused"===b.state?(b.resumeRecording(),void setTimeout(function(){d(e)},1)):("recording"===b.state||t.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',b.state),t.disableLogs||console.log("Stopped recording "+t.type+" stream."),"gif"!==t.type?v.stop(i):(v.stop(),i()),void h("stopped")):void g()}function u(){return v?"recording"!==b.state?void(t.disableLogs||console.warn("Unable to pause the recording. Recording state: ",b.state)):(h("paused"),v.pause(),void(t.disableLogs||console.log("Paused recording."))):void g()}function l(){return v?"paused"!==b.state?void(t.disableLogs||console.warn("Unable to resume the recording. Recording state: ",b.state)):(h("recording"),v.resume(),void(t.disableLogs||console.log("Resumed recording."))):void g()}function f(e){postMessage((new FileReaderSync).readAsDataURL(e))}function m(e,i){if(!e)throw"Pass a callback function over getDataURL.";var n=i?i.blob:(v||{}).blob;if(!n)return t.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout(function(){m(e,i)},1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var o=new FileReader;o.readAsDataURL(n),o.onload=function(t){e(t.target.result)}}else{var a=function(e){var t=M.createObjectURL(new Blob([e.toString(),"this.onmessage = function (e) {"+e.name+"(e.data);}"],{type:"application/javascript"})),i=new Worker(t);return M.revokeObjectURL(t),i}(f);a.onmessage=function(t){e(t.data)},a.postMessage(n)}}function p(e){if(e=e||0,"paused"===b.state)return void setTimeout(function(){p(e)},1e3);if("stopped"!==b.state){if(e>=b.recordingDuration)return void d(b.onRecordingStopped);e+=1e3,setTimeout(function(){p(e)},1e3)}}function h(e){b&&(b.state=e,"function"==typeof b.onStateChanged.call?b.onStateChanged.call(b,e):b.onStateChanged(e))}function g(){!0!==t.disableLogs&&console.warn(y)}if(!e)throw"First parameter is required.";t=t||{type:"video"},t=new a(e,t);var v,b=this,y='It seems that recorder is destroyed or "startRecording" is not invoked for '+t.type+" recorder.",w={startRecording:i,stopRecording:d,pauseRecording:u,resumeRecording:l,initRecorder:n,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return b.recordingDuration=e,b.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){b.onRecordingStopped=e}}},clearRecordedData:function(){if(!v)return void g();v.clearRecordedData(),t.disableLogs||console.log("Cleared old recorded data.")},getBlob:function(){return v?v.blob:void g()},getDataURL:m,toURL:function(){return v?M.createObjectURL(v.blob):void g()},getInternalRecorder:function(){return v},save:function(e){if(!v)return void g();c(v.blob,e)},getFromDisk:function(e){if(!v)return void g();o.getFromDisk(t.type,e)},setAdvertisementArray:function(e){t.advertisement=[];for(var i=e.length,n=0;n<i;n++)t.advertisement.push({duration:n,image:e[n]})},blob:null,bufferSize:0,sampleRate:0,buffer:null,reset:function(){v&&"function"==typeof v.clearRecordedData&&v.clearRecordedData(),v=null,h("inactive"),b.blob=null},onStateChanged:function(e){t.disableLogs||console.log("Recorder state changed:",e)},state:"inactive",getState:function(){return b.state},destroy:function(){var e=t.disableLogs;t.disableLogs=!0,b.reset(),t={},h("destroyed"),w=b=null,B.AudioContextConstructor&&(B.AudioContextConstructor.close(),B.AudioContextConstructor=null),e||console.warn("RecordRTC is destroyed.")},version:"5.4.6"};if(!this)return b=w,w;for(var R in w)this[R]=w[R];return b=this,w}/**
* {@link RecordRTCConfiguration} is an inner/private helper for {@link RecordRTC}.
* @summary It configures the 2nd parameter passed over {@link RecordRTC} and returns a valid "config" object.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef RecordRTCConfiguration
* @class
* @example
* var options = RecordRTCConfiguration(mediaStream, options);
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.
* @param {object} config - {type:"video", disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, getNativeBlob:true, etc.}
*/
function a(e,t){return t.recorderType||t.type||(t.audio&&t.video?t.type="video":t.audio&&!t.video&&(t.type="audio")),t.recorderType&&!t.type&&(t.recorderType===g||t.recorderType===h?t.type="video":t.recorderType===v?t.type="gif":t.recorderType===p?t.type="audio":t.recorderType===m&&(e.getAudioTracks().length&&e.getVideoTracks().length?t.type="video":e.getAudioTracks().length&&!e.getVideoTracks().length?t.type="audio":!e.getAudioTracks().length&&e.getVideoTracks().length&&(t.type="audio"))),void 0!==m&&"undefined"!=typeof MediaRecorder&&"requestData"in MediaRecorder.prototype&&(t.mimeType||(t.mimeType="video/webm"),t.type||(t.type=t.mimeType.split("/")[0]),t.bitsPerSecond),t.type||(t.mimeType&&(t.type=t.mimeType.split("/")[0]),t.type||(t.type="audio")),t}/**
* {@link GetRecorderType} is an inner/private helper for {@link RecordRTC}.
* @summary It returns best recorder-type available for your browser.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef GetRecorderType
* @class
* @example
* var RecorderType = GetRecorderType(options);
* var recorder = new RecorderType(options);
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.
* @param {object} config - {type:"video", disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.}
*/
function r(e,t){var i;return(O||D||L)&&(i=p),"undefined"!=typeof MediaRecorder&&"requestData"in MediaRecorder.prototype&&!O&&(i=m),"video"===t.type&&(O||L)&&(i=g),"gif"===t.type&&(i=v),"canvas"===t.type&&(i=h),f()&&i!==h&&i!==v&&"undefined"!=typeof MediaRecorder&&"requestData"in MediaRecorder.prototype&&(e.getVideoTracks&&e.getVideoTracks().length||e.getAudioTracks&&e.getAudioTracks().length)&&("audio"===t.type?"function"==typeof MediaRecorder.isTypeSupported&&MediaRecorder.isTypeSupported("audio/webm")&&(i=m):"function"==typeof MediaRecorder.isTypeSupported&&MediaRecorder.isTypeSupported("video/webm")&&(i=m)),t.recorderType&&(i=t.recorderType),e instanceof Array&&e.length&&(i=y),!t.disableLogs&&i&&i.name&&console.log("Using recorderType:",i.name||i.constructor.name),i}/**
* MRecordRTC runs on top of {@link RecordRTC} to bring multiple recordings in a single place, by providing simple API.
* @summary MRecordRTC stands for "Multiple-RecordRTC".
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef MRecordRTC
* @class
* @example
* var recorder = new MRecordRTC();
* recorder.addStream(MediaStream);
* recorder.mediaType = {
* audio: true, // or StereoAudioRecorder or MediaStreamRecorder
* video: true, // or WhammyRecorder or MediaStreamRecorder
* gif: true // or GifRecorder
* };
* // mimeType is optional and should be set only in advance cases.
* recorder.mimeType = {
* audio: 'audio/wav',
* video: 'video/webm',
* gif: 'image/gif'
* };
* recorder.startRecording();
* @see For further information:
* @see {@link https://github.com/muaz-khan/RecordRTC/tree/master/MRecordRTC|MRecordRTC Source Code}
* @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.
* @requires {@link RecordRTC}
*/
function d(e){this.addStream=function(t){t&&(e=t)},this.mediaType={audio:!0,video:!0},this.startRecording=function(){var t,i=this.mediaType,n=this.mimeType||{audio:null,video:null,gif:null};if("function"!=typeof i.audio&&f()&&e.getAudioTracks&&!e.getAudioTracks().length&&(i.audio=!1),"function"!=typeof i.video&&f()&&e.getVideoTracks&&!e.getVideoTracks().length&&(i.video=!1),"function"!=typeof i.gif&&f()&&e.getVideoTracks&&!e.getVideoTracks().length&&(i.gif=!1),!i.audio&&!i.video&&!i.gif)throw"MediaStream must have either audio or video tracks.";if(i.audio&&(t=null,"function"==typeof i.audio&&(t=i.audio),this.audioRecorder=new o(e,{type:"audio",bufferSize:this.bufferSize,sampleRate:this.sampleRate,numberOfAudioChannels:this.numberOfAudioChannels||2,disableLogs:this.disableLogs,recorderType:t,mimeType:n.audio,timeSlice:this.timeSlice,onTimeStamp:this.onTimeStamp}),i.video||this.audioRecorder.startRecording()),i.video){t=null,"function"==typeof i.video&&(t=i.video);var a=e;if(f()&&i.audio&&"function"==typeof i.audio){var r=e.getVideoTracks()[0];navigator.mozGetUserMedia?(a=new U,a.addTrack(r),t&&t===g&&(t=m)):a=new U([r])}this.videoRecorder=new o(a,{type:"video",video:this.video,canvas:this.canvas,frameInterval:this.frameInterval||10,disableLogs:this.disableLogs,recorderType:t,mimeType:n.video,timeSlice:this.timeSlice,onTimeStamp:this.onTimeStamp}),i.audio||this.videoRecorder.startRecording()}if(i.audio&&i.video){var d=this;f()?(d.audioRecorder=null,d.videoRecorder.startRecording()):d.videoRecorder.initRecorder(function(){d.audioRecorder.initRecorder(function(){d.videoRecorder.startRecording(),d.audioRecorder.startRecording()})})}i.gif&&(t=null,"function"==typeof i.gif&&(t=i.gif),this.gifRecorder=new o(e,{type:"gif",frameRate:this.frameRate||200,quality:this.quality||10,disableLogs:this.disableLogs,recorderType:t,mimeType:n.gif}),this.gifRecorder.startRecording())},this.stopRecording=function(e){e=e||function(){},this.audioRecorder&&this.audioRecorder.stopRecording(function(t){e(t,"audio")}),this.videoRecorder&&this.videoRecorder.stopRecording(function(t){e(t,"video")}),this.gifRecorder&&this.gifRecorder.stopRecording(function(t){e(t,"gif")})},this.pauseRecording=function(){this.audioRecorder&&this.audioRecorder.pauseRecording(),this.videoRecorder&&this.videoRecorder.pauseRecording(),this.gifRecorder&&this.gifRecorder.pauseRecording()},this.resumeRecording=function(){this.audioRecorder&&this.audioRecorder.resumeRecording(),this.videoRecorder&&this.videoRecorder.resumeRecording(),this.gifRecorder&&this.gifRecorder.resumeRecording()},this.getBlob=function(e){var t={};return this.audioRecorder&&(t.audio=this.audioRecorder.getBlob()),this.videoRecorder&&(t.video=this.videoRecorder.getBlob()),this.gifRecorder&&(t.gif=this.gifRecorder.getBlob()),e&&e(t),t},this.destroy=function(){this.audioRecorder&&(this.audioRecorder.destroy(),this.audioRecorder=null),this.videoRecorder&&(this.videoRecorder.destroy(),this.videoRecorder=null),this.gifRecorder&&(this.gifRecorder.destroy(),this.gifRecorder=null)},this.getDataURL=function(e){function t(e,t){if("undefined"!=typeof Worker){var n=i(function(e){postMessage((new FileReaderSync).readAsDataURL(e))});n.onmessage=function(e){t(e.data)},n.postMessage(e)}else{var o=new FileReader;o.readAsDataURL(e),o.onload=function(e){t(e.target.result)}}}function i(e){var t,i=M.createObjectURL(new Blob([e.toString(),"this.onmessage = function (e) {"+e.name+"(e.data);}"],{type:"application/javascript"})),n=new Worker(i);if(void 0!==M)t=M;else{if("undefined"==typeof webkitURL)throw"Neither URL nor webkitURL detected.";t=webkitURL}return t.revokeObjectURL(i),n}this.getBlob(function(i){i.audio&&i.video?t(i.audio,function(n){t(i.video,function(t){e({audio:n,video:t})})}):i.audio?t(i.audio,function(t){e({audio:t})}):i.video&&t(i.video,function(t){e({video:t})})})},this.writeToDisk=function(){o.writeToDisk({audio:this.audioRecorder,video:this.videoRecorder,gif:this.gifRecorder})},this.save=function(e){e=e||{audio:!0,video:!0,gif:!0},e.audio&&this.audioRecorder&&this.audioRecorder.save("string"==typeof e.audio?e.audio:""),e.video&&this.videoRecorder&&this.videoRecorder.save("string"==typeof e.video?e.video:""),e.gif&&this.gifRecorder&&this.gifRecorder.save("string"==typeof e.gif?e.gif:"")}}function s(e){var t=["Bytes","KB","MB","GB","TB"];if(0===e)return"0 Bytes";var i=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,i)).toPrecision(3)+" "+t[i]}function c(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(t&&-1!==t.indexOf(".")){var n=t.split(".");t=n[0],i=n[1]}var o=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,o);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,o);var a=document.createElement("a");a.href=M.createObjectURL(e),a.download=o,a.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(a),"function"==typeof a.click?a.click():(a.target="_blank",a.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),M.revokeObjectURL(a.href)}function u(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!(void 0===n||"object"!=typeof n.versions||!n.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function l(e,t,i){if("createObjectURL"in M&&!i)try{t.src=M.createObjectURL(e)}catch(i){return void l(e,t,!0)}else"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:alert("createObjectURL/srcObject both are not supported.")}function f(){var e=!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0,t=!!window.chrome&&!e||u();if(void 0!==window.InstallTrigger)return!0;var i,n,o=(navigator.appVersion,navigator.userAgent),a=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10);return(t||e)&&(i=o.indexOf("Chrome"),a=o.substring(i+7)),-1!==(n=a.indexOf(";"))&&(a=a.substring(0,n)),-1!==(n=a.indexOf(" "))&&(a=a.substring(0,n)),r=parseInt(""+a,10),isNaN(r)&&(a=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),r>=49}/**
* MediaStreamRecorder is an abstraction layer for {@link https://w3c.github.io/mediacapture-record/MediaRecorder.html|MediaRecorder API}. It is used by {@link RecordRTC} to record MediaStream(s) in both Chrome and Firefox.
* @summary Runs top over {@link https://w3c.github.io/mediacapture-record/MediaRecorder.html|MediaRecorder API}.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link https://github.com/muaz-khan|Muaz Khan}
* @typedef MediaStreamRecorder
* @class
* @example
* var config = {
* mimeType: 'video/webm', // vp8, vp9, h264, mkv, opus/vorbis
* audioBitsPerSecond : 256 * 8 * 1024,
* videoBitsPerSecond : 256 * 8 * 1024,
* bitsPerSecond: 256 * 8 * 1024, // if this is provided, skip above two
* checkForInactiveTracks: true,
* timeSlice: 1000, // concatenate intervals based blobs
* ondataavailable: function() {}, // get intervals based blobs
* ignoreMutedMedia: true
* }
* var recorder = new MediaStreamRecorder(mediaStream, config);
* recorder.record();
* recorder.stop(function(blob) {
* video.src = URL.createObjectURL(blob);
*
* // or
* var blob = recorder.blob;
* });
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.
* @param {object} config - {disableLogs:true, initCallback: function, mimeType: "video/webm", timeSlice: 1000}
* @throws Will throw an error if first argument "MediaStream" is missing. Also throws error if "MediaRecorder API" are not supported by the browser.
*/
function m(e,t){function i(){r.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(r.timestamps[r.timestamps.length-1],r.timestamps)}function n(e){return u&&u.mimeType?u.mimeType:e.mimeType||"video/webm"}function o(){c=[],u=null,r.timestamps=[]}function a(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}var r=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not supports Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if(t=t||{mimeType:"video/webm"},"audio"===t.type){if(e.getVideoTracks().length&&e.getAudioTracks().length){var d;navigator.mozGetUserMedia?(d=new U,d.addTrack(e.getAudioTracks()[0])):d=new U(e.getAudioTracks()),e=d}t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=O?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var c=[];this.getArrayOfBlobs=function(){return c},this.record=function(){r.blob=null,r.clearRecordedData(),r.timestamps=[],l=[],c=[];var o=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",o),u&&(u=null),O&&!f()&&(o="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&o.mimeType&&(MediaRecorder.isTypeSupported(o.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",o.mimeType),o.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{u=new MediaRecorder(e,o),t.mimeType=o.mimeType}catch(t){u=new MediaRecorder(e)}o.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in u&&!1===u.canRecordMimeType(o.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",o.mimeType)),u.ignoreMutedMedia=!0===t.ignoreMutedMedia,u.ondataavailable=function(e){if(e.data&&l.push("ondataavailable: "+s(e.data.size)),"number"!=typeof t.timeSlice){if(!e.data||!e.data.size||e.data.size<100||r.blob)return void(r.recordingCallback&&(r.recordingCallback(new Blob([],{type:n(o)})),r.recordingCallback=null));r.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(o)}),r.recordingCallback&&(r.recordingCallback(r.blob),r.recordingCallback=null)}else if(e.data&&e.data.size&&e.data.size>100&&(c.push(e.data),i(),"function"==typeof t.ondataavailable)){var a=t.getNativeBlob?e.data:new Blob([e.data],{type:n(o)});t.ondataavailable(a)}},u.onstart=function(){l.push("started")},u.onpause=function(){l.push("paused")},u.onresume=function(){l.push("resumed")},u.onstop=function(){l.push("stopped")},u.onerror=function(e){l.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",o.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!r.manuallyStopped&&u&&"inactive"===u.state)return delete t.timeslice,void u.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==u.state&&"stopped"!==u.state&&u.stop()},"number"==typeof t.timeSlice?(i(),u.start(t.timeSlice)):u.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},r.manuallyStopped=!0,u&&(this.recordingCallback=e,"recording"===u.state&&u.stop(),"number"==typeof t.timeSlice&&setTimeout(function(){r.blob=new Blob(c,{type:n(t)}),r.recordingCallback(r.blob)},100))},this.pause=function(){u&&"recording"===u.state&&u.pause()},this.resume=function(){u&&"paused"===u.state&&u.resume()},this.clearRecordedData=function(){u&&"recording"===u.state&&r.stop(o),o()};var u;this.getInternalRecorder=function(){return u},this.blob=null,this.getState=function(){return u?u.state||"inactive":"inactive"};var l=[];this.getAllStates=function(){return l},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);var r=this;!function e(){if(u&&!1!==t.checkForInactiveTracks)return!1===a()?(t.disableLogs||console.log("MediaStream seems stopped."),void r.stop()):void setTimeout(e,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}/**
* StereoAudioRecorder is a standalone class used by {@link RecordRTC} to bring "stereo" audio-recording in chrome.
* @summary JavaScript standalone object for stereo audio recording.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef StereoAudioRecorder
* @class
* @example
* var recorder = new StereoAudioRecorder(MediaStream, {
* sampleRate: 44100,
* bufferSize: 4096
* });
* recorder.record();
* recorder.stop(function(blob) {
* video.src = URL.createObjectURL(blob);
* });
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.
* @param {object} config - {sampleRate: 44100, bufferSize: 4096, numberOfAudioChannels: 1, etc.}
*/
function p(e,t){function i(){if(!1===t.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function n(e,t){function i(e,t){function i(e,t,i){var o=Math.round(e.length*(t/i)),a=[],r=Number((e.length-1)/(o-1));a[0]=e[0];for(var d=1;d<o-1;d++){var s=d*r,c=Number(Math.floor(s)).toFixed(),u=Number(Math.ceil(s)).toFixed(),l=s-c;a[d]=n(e[c],e[u],l)}return a[o-1]=e[e.length-1],a}function n(e,t,i){return e+(t-e)*i}function o(e,t){for(var i=new Float64Array(t),n=0,o=e.length,a=0;a<o;a++){var r=e[a];i.set(r,n),n+=r.length}return i}function a(e,t,i){for(var n=i.length,o=0;o<n;o++)e.setUint8(t+o,i.charCodeAt(o))}var r=e.numberOfAudioChannels,d=e.leftBuffers.slice(0),s=e.rightBuffers.slice(0),c=e.sampleRate,u=e.internalInterleavedLength,l=e.desiredSampRate;2===r&&(d=o(d,u),s=o(s,u),l&&(d=i(d,l,c),s=i(s,l,c))),1===r&&(d=o(d,u),l&&(d=i(d,l,c))),l&&(c=l);var f;2===r&&(f=function(e,t){for(var i=e.length+t.length,n=new Float64Array(i),o=0,a=0;a<i;)n[a++]=e[o],n[a++]=t[o],o++;return n}(d,s)),1===r&&(f=d);var m=f.length,p=44+2*m,h=new ArrayBuffer(p),g=new DataView(h);a(g,0,"RIFF"),g.setUint32(4,44+2*m,!0),a(g,8,"WAVE"),a(g,12,"fmt "),g.setUint32(16,16,!0),g.setUint16(20,1,!0),g.setUint16(22,r,!0),g.setUint32(24,c,!0),g.setUint32(28,2*c,!0),g.setUint16(32,2*r,!0),g.setUint16(34,16,!0),a(g,36,"data"),g.setUint32(40,2*m,!0);for(var v=m,b=44,y=0;y<v;y++)g.setInt16(b,32767*f[y],!0),b+=2;if(t)return t({buffer:h,view:g});postMessage({buffer:h,view:g})}if(D||L||A||e.noWorker)return void i(e,function(e){t(e.buffer,e.view)});var n=o(i);n.onmessage=function(e){t(e.data.buffer,e.data.view),M.revokeObjectURL(n.workerURL)},n.postMessage(e)}function o(e){var t=M.createObjectURL(new Blob([e.toString(),";this.onmessage = function (e) {"+e.name+"(e.data);}"],{type:"application/javascript"})),i=new Worker(t);return i.workerURL=t,i}function a(){l=[],f=[],p=0,k=!1,m=!1,C=!1,v=null,u.leftchannel=l,u.rightchannel=f,u.numberOfAudioChannels=h,u.desiredSampRate=g,u.sampleRate=R,u.recordingLength=p,T={left:[],right:[],recordingLength:0}}function r(){c&&(c.onaudioprocess=null,c.disconnect(),c=null),b&&(b.disconnect(),b=null),a()}function d(e){if(!C){if(!1===i()&&(t.disableLogs||console.log("MediaStream seems stopped."),c.disconnect(),m=!1),!m)return void(b&&(b.disconnect(),b=null));k||(k=!0,t.onAudioProcessStarted&&t.onAudioProcessStarted(),t.initCallback&&t.initCallback());var n=e.inputBuffer.getChannelData(0),o=new Float32Array(n);if(l.push(o),2===h){var a=e.inputBuffer.getChannelData(1),r=new Float32Array(a);f.push(r)}p+=w,u.recordingLength=p,void 0!==t.timeSlice&&(T.recordingLength+=w,T.left.push(o),2===h&&T.right.push(r))}}function s(){m&&"function"==typeof t.ondataavailable&&void 0!==t.timeSlice&&(T.left.length?(n({desiredSampRate:g,sampleRate:R,numberOfAudioChannels:h,internalInterleavedLength:T.recordingLength,leftBuffers:T.left,rightBuffers:1===h?[]:T.right},function(e,i){var n=new Blob([i],{type:"audio/wav"});t.ondataavailable(n),setTimeout(s,t.timeSlice)}),T={left:[],right:[],recordingLength:0}):setTimeout(s,t.timeSlice))}if(!e.getAudioTracks().length)throw"Your stream has no audio tracks.";t=t||{};var c,u=this,l=[],f=[],m=!1,p=0,h=2,g=t.desiredSampRate;!0===t.leftChannel&&(h=1),1===t.numberOfAudioChannels&&(h=1),(!h||h<1)&&(h=2),t.disableLogs||console.log("StereoAudioRecorder is set to record number of channels: ",h),void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!0),this.record=function(){if(!1===i())throw"Please make sure MediaStream is active.";a(),k=C=!1,m=!0,void 0!==t.timeSlice&&s()},this.stop=function(e){e=e||function(){},m=!1,n({desiredSampRate:g,sampleRate:R,numberOfAudioChannels:h,internalInterleavedLength:p,leftBuffers:l,rightBuffers:1===h?[]:f},function(t,i){u.blob=new Blob([i],{type:"audio/wav"}),u.buffer=new ArrayBuffer(i.buffer.byteLength),u.view=i,u.sampleRate=g||R,u.bufferSize=w,u.length=p,k=!1,e&&e(u.blob)})},B.AudioContextConstructor||(B.AudioContextConstructor=new B.AudioContext);var v=B.AudioContextConstructor,b=v.createMediaStreamSource(e),y=[0,256,512,1024,2048,4096,8192,16384],w=void 0===t.bufferSize?4096:t.bufferSize;if(-1===y.indexOf(w)&&(t.disableLogs||console.warn("Legal values for buffer-size are "+JSON.stringify(y,null,"\t"))),v.createJavaScriptNode)c=v.createJavaScriptNode(w,h,h);else{if(!v.createScriptProcessor)throw"WebAudio API has no support on this browser.";c=v.createScriptProcessor(w,h,h)}b.connect(c),t.bufferSize||(w=c.bufferSize);var R=void 0!==t.sampleRate?t.sampleRate:v.sampleRate||44100;(R<22050||R>96e3)&&(t.disableLogs||console.warn("sample-rate must be under range 22050 and 96000.")),t.disableLogs||(console.log("sample-rate",R),console.log("buffer-size",w),t.desiredSampRate&&console.log("Desired sample-rate",t.desiredSampRate));var C=!1;this.pause=function(){C=!0},this.resume=function(){if(!1===i())throw"Please make sure MediaStream is active.";if(!m)return t.disableLogs||console.log("Seems recording has been restarted."),void this.record();C=!1},this.clearRecordedData=function(){t.checkForInactiveTracks=!1,m&&this.stop(r),r()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var k=!1;c.onaudioprocess=d,c.connect(v.destination),this.leftchannel=l,this.rightchannel=f,this.numberOfAudioChannels=h,this.desiredSampRate=g,this.sampleRate=R,u.recordingLength=p;var T={left:[],right:[],recordingLength:0}}/**
* CanvasRecorder is a standalone class used by {@link RecordRTC} to bring HTML5-Canvas recording into video WebM. It uses HTML2Canvas library and runs top over {@link Whammy}.
* @summary HTML2Canvas recording into video WebM.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef CanvasRecorder
* @class
* @example
* var recorder = new CanvasRecorder(htmlElement, { disableLogs: true, useWhammyRecorder: true });
* recorder.record();
* recorder.stop(function(blob) {
* video.src = URL.createObjectURL(blob);
* });
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {HTMLElement} htmlElement - querySelector/getElementById/getElementsByTagName[0]/etc.
* @param {object} config - {disableLogs:true, initCallback: function}
*/
function h(e,t){function i(){h.frames=[],l=!1,f=!1}function n(){var t=document.createElement("canvas"),i=t.getContext("2d");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0),t}function o(){if(f)return p=(new Date).getTime(),setTimeout(o,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-p;return p=(new Date).getTime(),h.frames.push({image:n(),duration:i}),void(l&&setTimeout(o,t.frameInterval))}html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-p;if(!i)return setTimeout(o,t.frameInterval);p=(new Date).getTime(),h.frames.push({image:e.toDataURL("image/webp",1),duration:i}),l&&setTimeout(o,t.frameInterval)}})}if("undefined"==typeof html2canvas)throw"Please link: https://cdn.webrtc-experiment.com/screenshot.js";t=t||{},t.frameInterval||(t.frameInterval=10);var a=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach(function(e){e in document.createElement("canvas")&&(a=!0)});var r=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),d=50,s=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);r&&s&&s[2]&&(d=parseInt(s[2],10)),r&&d<52&&(a=!1);var c,u;if(a)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)c=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";c=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));var l;this.record=function(){if(l=!0,a&&!t.useWhammyRecorder){var e;"captureStream"in c?e=c.captureStream(25):"mozCaptureStream"in c?e=c.mozCaptureStream(25):"webkitCaptureStream"in c&&(e=c.webkitCaptureStream(25));try{var i=new U;i.addTrack(e.getVideoTracks()[0]),e=i}catch(e){}if(!e)throw"captureStream API are NOT available.";u=new m(e,{mimeType:"video/webm"}),u.record()}else h.frames=[],p=(new Date).getTime(),o();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"!==e.nodeName.toLowerCase())return void i();var n=h.frames.length;h.frames.forEach(function(e,i){var o=n-i;t.disableLogs||console.log(o+"/"+n+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(o,n);var a=e.image.toDataURL("image/webp",1);h.frames[i].image=a}),t.disableLogs||console.log("Generating WebM"),i()},this.stop=function(e){l=!1;var i=this;if(a&&u)return void u.stop(e);this.getWebPImages(function(){h.compile(function(n){t.disableLogs||console.log("Recording finished!"),i.blob=n,i.blob.forEach&&(i.blob=new Blob([],{type:"video/webm"})),e&&e(i.blob),h.frames=[]})})};var f=!1;this.pause=function(){if(f=!0,u instanceof m)return void u.pause()},this.resume=function(){if(f=!1,u instanceof m)return void u.resume();l||this.record()},this.clearRecordedData=function(){l&&this.stop(i),i()},this.name="CanvasRecorder",this.toString=function(){return this.name};var p=(new Date).getTime(),h=new j.Video(100)}/**
* WhammyRecorder is a standalone class used by {@link RecordRTC} to bring video recording in Chrome. It runs top over {@link Whammy}.
* @summary Video recording feature in Chrome.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef WhammyRecorder
* @class
* @example
* var recorder = new WhammyRecorder(mediaStream);
* recorder.record();
* recorder.stop(function(blob) {
* video.src = URL.createObjectURL(blob);
* });
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.
* @param {object} config - {disableLogs: true, initCallback: function, video: HTMLVideoElement, etc.}
*/
function g(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-c;return t?d?(c=(new Date).getTime(),setTimeout(i,100)):(c=(new Date).getTime(),s.paused&&s.play(),m.drawImage(s,0,0,f.width,f.height),u.frames.push({duration:t,image:f.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}function n(e){var t=-1,i=e.length;!function n(){if(++t===i)return void e.callback();setTimeout(function(){e.functionToLoop(n,t)},1)}()}function o(e,t,i,o,a){var r=document.createElement("canvas");r.width=f.width,r.height=f.height;var d=r.getContext("2d"),s=[],c=-1===t,u=t&&t>0&&t<=e.length?t:e.length,l={r:0,g:0,b:0},m=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),p=i&&i>=0&&i<=1?i:0,h=o&&o>=0&&o<=1?o:0,g=!1;n({length:u,functionToLoop:function(t,i){var n,o,a,r=function(){!g&&a-n<=a*h||(c&&(g=!0),s.push(e[i])),t()};if(g)r();else{var u=new Image;u.onload=function(){d.drawImage(u,0,0,f.width,f.height);var e=d.getImageData(0,0,f.width,f.height);n=0,o=e.data.length,a=e.data.length/4;for(var t=0;t<o;t+=4){var i={r:e.data[t],g:e.data[t+1],b:e.data[t+2]};Math.sqrt(Math.pow(i.r-l.r,2)+Math.pow(i.g-l.g,2)+Math.pow(i.b-l.b,2))<=m*p&&n++}r()},u.src=e[i].image}},callback:function(){s=s.concat(e.slice(u)),s.length<=0&&s.push(e[e.length-1]),a(s)}})}function a(){u.frames=[],r=!0,d=!1}t=t||{},t.frameInterval||(t.frameInterval=10),t.disableLogs||console.log("Using frames-interval:",t.frameInterval),this.record=function(){t.width||(t.width=320),t.height||(t.height=240),t.video||(t.video={width:t.width,height:t.height}),t.canvas||(t.canvas={width:t.width,height:t.height}),f.width=t.canvas.width||320,f.height=t.canvas.height||240,m=f.getContext("2d"),t.video&&t.video instanceof HTMLVideoElement?(s=t.video.cloneNode(),t.initCallback&&t.initCallback()):(s=document.createElement("video"),l(e,s),s.onloadedmetadata=function(){t.initCallback&&t.initCallback()},s.width=t.video.width,s.height=t.video.height),s.muted=!0,s.play(),c=(new Date).getTime(),u=new j.Video,t.disableLogs||(console.log("canvas resolutions",f.width,"*",f.height),console.log("video width/height",s.width||f.width,"*",s.height||f.height)),i(t.frameInterval)};var r=!1;this.stop=function(e){e=e||function(){},r=!0;var i=this;setTimeout(function(){o(u.frames,-1,null,null,function(n){u.frames=n,t.advertisement&&t.advertisement.length&&(u.frames=t.advertisement.concat(u.frames)),u.compile(function(t){i.blob=t,i.blob.forEach&&(i.blob=new Blob([],{type:"video/webm"})),e&&e(i.blob)})})},10)};var d=!1;this.pause=function(){d=!0},this.resume=function(){d=!1,r&&this.record()},this.clearRecordedData=function(){r||this.stop(a),a()},this.name="WhammyRecorder",this.toString=function(){return this.name};var s,c,u,f=document.createElement("canvas"),m=f.getContext("2d")}/**
* GifRecorder is standalone calss used by {@link RecordRTC} to record video or canvas into animated gif.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef GifRecorder
* @class
* @example
* var recorder = new GifRecorder(mediaStream || canvas || context, { onGifPreview: function, onGifRecordingStarted: function, width: 1280, height: 720, frameRate: 200, quality: 10 });
* recorder.record();
* recorder.stop(function(blob) {
* img.src = URL.createObjectURL(blob);
* });
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {MediaStream} mediaStream - MediaStream object or HTMLCanvasElement or CanvasRenderingContext2D.
* @param {object} config - {disableLogs:true, initCallback: function, width: 320, height: 240, frameRate: 200, quality: 10}
*/
function v(e,t){function i(){p&&(p.stream().bin=[])}if("undefined"==typeof GIFEncoder){var n=document.createElement("script");n.src="https://cdn.webrtc-experiment.com/gif-recorder.js",(document.body||document.documentElement).appendChild(n)}t=t||{};var o=e instanceof CanvasRenderingContext2D||e instanceof HTMLCanvasElement;this.record=function(){function e(i){if(!0!==g.clearedRecordedData){if(a)return setTimeout(function(){e(i)},100);h=k(e),void 0===typeof m&&(m=i),i-m<90||(!o&&c.paused&&c.play(),o||d.drawImage(c,0,0,r.width,r.height),t.onGifPreview&&t.onGifPreview(r.toDataURL("image/png")),p.addFrame(d),m=i)}}return"undefined"==typeof GIFEncoder?void setTimeout(g.record,1e3):s?(o||(t.width||(t.width=c.offsetWidth||320),t.height||(t.height=c.offsetHeight||240),t.video||(t.video={width:t.width,height:t.height}),t.canvas||(t.canvas={width:t.width,height:t.height}),r.width=t.canvas.width||320,r.height=t.canvas.height||240,c.width=t.video.width||320,c.height=t.video.height||240),p=new GIFEncoder,p.setRepeat(0),p.setDelay(t.frameRate||200),p.setQuality(t.quality||10),p.start(),"function"==typeof t.onGifRecordingStarted&&t.onGifRecordingStarted(),u=Date.now(),h=k(e),void(t.initCallback&&t.initCallback())):void setTimeout(g.record,1e3)},this.stop=function(e){e=e||function(){},h&&S(h),f=Date.now(),this.blob=new Blob([new Uint8Array(p.stream().bin)],{type:"image/gif"}),e(this.blob),p.stream().bin=[]};var a=!1;this.pause=function(){a=!0},this.resume=function(){a=!1},this.clearRecordedData=function(){g.clearedRecordedData=!0,i()},this.name="GifRecorder",this.toString=function(){return this.name};var r=document.createElement("canvas"),d=r.getContext("2d");o&&(e instanceof CanvasRenderingContext2D?(d=e,r=d.canvas):e instanceof HTMLCanvasElement&&(d=e.getContext("2d"),r=e));var s=!0;if(!o){var c=document.createElement("video");c.muted=!0,c.autoplay=!0,s=!1,c.onloadedmetadata=function(){s=!0},l(e,c),c.play()}var u,f,m,p,h=null,g=this}function b(e){function t(e,i,n){if("createObjectURL"in h&&!n)try{i.src=h.createObjectURL(e)}catch(n){return void t(e,i,!0)}else"srcObject"in i?i.srcObject=e:"mozSrcObject"in i?i.mozSrcObject=e:alert("createObjectURL/srcObject both are not supported.")}function i(){if(!u){var e=c.length,t=!1,o=[];if(c.forEach(function(e){e.stream||(e.stream={}),e.stream.fullcanvas?t=e:o.push(e)}),t)l.width=t.stream.width,l.height=t.stream.height;else if(o.length){l.width=e>1?2*o[0].width:o[0].width;var a=1;3!==e&&4!==e||(a=2),5!==e&&6!==e||(a=3),7!==e&&8!==e||(a=4),9!==e&&10!==e||(a=5),l.height=o[0].height*a}else l.width=m.width||360,l.height=m.height||240;t&&t instanceof HTMLVideoElement&&n(t),o.forEach(function(e,t){n(e,t)}),setTimeout(i,m.frameInterval)}}function n(e,t){if(!u){var i=0,n=0,o=e.width,a=e.height;1===t&&(i=e.width),2===t&&(n=e.height),3===t&&(i=e.width,n=e.height),4===t&&(n=2*e.height),5===t&&(i=e.width,n=2*e.height),6===t&&(n=3*e.height),7===t&&(i=e.width,n=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(n=e.stream.top),void 0!==e.stream.width&&(o=e.stream.width),void 0!==e.stream.height&&(a=e.stream.height),f.drawImage(e,i,n,o,a),"function"==typeof e.stream.onRender&&e.stream.onRender(f,i,n,o,a,t)}}function o(){u=!1;var t=a(),i=r();i&&i.getAudioTracks().forEach(function(e){t.addTrack(e)});var n;return e.forEach(function(e){e.fullcanvas&&(n=!0)}),t}function a(){s();var e;"captureStream"in l?e=l.captureStream():"mozCaptureStream"in l?e=l.mozCaptureStream():m.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new g;return e.getVideoTracks().forEach(function(e){t.addTrack(e)}),l.stream=t,t}function r(){v.AudioContextConstructor||(v.AudioContextConstructor=new v.AudioContext),m.audioContext=v.AudioContextConstructor,m.audioSources=[],!0===m.useGainNode&&(m.gainNode=m.audioContext.createGain(),m.gainNode.connect(m.audioContext.destination),m.gainNode.gain.value=0);var t=0;if(e.forEach(function(e){if(e.getAudioTracks().length){t++;var i=m.audioContext.createMediaStreamSource(e);!0===m.useGainNode&&i.connect(m.gainNode),m.audioSources.push(i)}}),t)return m.audioDestination=m.audioContext.createMediaStreamDestination(),m.audioSources.forEach(function(e){e.connect(m.audioDestination)}),m.audioDestination.stream}function d(e){var i=document.createElement("video");return t(e,i),i.muted=!0,i.volume=0,i.width=e.width||m.width||360,i.height=e.height||m.height||240,i.play(),i}function s(t){c=[],t=t||e,t.forEach(function(e){if(e.getVideoTracks().length){var t=d(e);t.stream=e,c.push(t)}})}var c=[],u=!1,l=document.createElement("canvas"),f=l.getContext("2d");l.style="opacity:0;position:absolute;z-index:-1;top: -100000000;left:-1000000000; margin-top:-1000000000;margin-left:-1000000000;",(document.body||document.documentElement).appendChild(l),this.disableLogs=!1,this.frameInterval=10,this.width=360,this.height=240,this.useGainNode=!0;var m=this,p=window.AudioContext;void 0===p&&("undefined"!=typeof webkitAudioContext&&(p=webkitAudioContext),"undefined"!=typeof mozAudioContext&&(p=mozAudioContext));var h=window.URL;void 0===h&&"undefined"!=typeof webkitURL&&(h=webkitURL),"undefined"!=typeof navigator&&void 0===navigator.getUserMedia&&(void 0!==navigator.webkitGetUserMedia&&(navigator.getUserMedia=navigator.webkitGetUserMedia),void 0!==navigator.mozGetUserMedia&&(navigator.getUserMedia=navigator.mozGetUserMedia));var g=window.MediaStream;void 0===g&&"undefined"!=typeof webkitMediaStream&&(g=webkitMediaStream),void 0!==g&&("getVideoTracks"in g.prototype||(g.prototype.getVideoTracks=function(){if(!this.getTracks)return[];var e=[];return this.getTracks.forEach(function(t){-1!==t.kind.toString().indexOf("video")&&e.push(t)}),e},g.prototype.getAudioTracks=function(){if(!this.getTracks)return[];var e=[];return this.getTracks.forEach(function(t){-1!==t.kind.toString().indexOf("audio")&&e.push(t)}),e}),void 0===g.prototype.stop&&(g.prototype.stop=function(){this.getTracks().forEach(function(e){e.stop()})}));var v={};void 0!==p?v.AudioContext=p:"undefined"!=typeof webkitAudioContext&&(v.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){i()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),e.concat(t),t.forEach(function(e){if(e.getVideoTracks().length){var t=d(e);t.stream=e,c.push(t)}if(e.getAudioTracks().length&&m.audioContext){var i=m.audioContext.createMediaStreamSource(e);i.connect(m.audioDestination),m.audioSources.push(i)}})},this.releaseStreams=function(){c=[],u=!0,m.gainNode&&(m.gainNode.disconnect(),m.gainNode=null),m.audioSources.length&&(m.audioSources.forEach(function(e){e.disconnect()}),m.audioSources=[]),m.audioDestination&&(m.audioDestination.disconnect(),m.audioDestination=null),m.audioContext=null,f.clearRect(0,0,l.width,l.height),l.stream&&(l.stream.stop(),l.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),s(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=o}/**
* MultiStreamRecorder can record multiple videos in single container.
* @summary Multi-videos recorder.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef MultiStreamRecorder
* @class
* @example
* var options = {
* mimeType: 'video/webm'
* }
* var recorder = new MultiStreamRecorder(ArrayOfMediaStreams, options);
* recorder.record();
* recorder.stop(function(blob) {
* video.src = URL.createObjectURL(blob);
*
* // or
* var blob = recorder.blob;
* });
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {MediaStreams} mediaStreams - Array of MediaStreams.
* @param {object} config - {disableLogs:true, frameInterval: 1, mimeType: "video/webm"}
*/
function y(e,t){function i(){var t=[];return e.forEach(function(e){e.getVideoTracks().forEach(function(e){t.push(e)})}),t}e=e||[];var n,o,a=this;t=t||{mimeType:"video/webm",video:{width:360,height:240}},t.frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){n=new b(e),i().length&&(n.frameInterval=t.frameInterval||10,n.width=t.video.width||360,n.height=t.video.height||240,n.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(n.getMixedStream()),o=new m(n.getMixedStream(),t),o.record()},this.stop=function(e){o&&o.stop(function(t){a.blob=t,e(t),a.clearRecordedData()})},this.pause=function(){o&&o.pause()},this.resume=function(){o&&o.resume()},this.clearRecordedData=function(){o&&(o.clearRecordedData(),o=null),n&&(n.releaseStreams(),n=null)},this.addStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),e.concat(t),o&&n&&n.appendStreams(t)},this.resetVideoStreams=function(e){n&&(!e||e instanceof Array||(e=[e]),n.resetVideoStreams(e))},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}/**
* RecordRTCPromisesHandler adds promises support in {@link RecordRTC}. Try a {@link https://github.com/muaz-khan/RecordRTC/blob/master/simple-demos/RecordRTCPromisesHandler.html|demo here}
* @summary Promises for {@link RecordRTC}
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef RecordRTCPromisesHandler
* @class
* @example
* var recorder = new RecordRTCPromisesHandler(mediaStream, options);
* recorder.startRecording()
* .then(successCB)
* .catch(errorCB);
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
* @param {MediaStream} mediaStream - Single media-stream object, array of media-streams, html-canvas-element, etc.
* @param {object} config - {type:"video", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.}
* @throws Will throw an error if "new" keyword is not used to initiate "RecordRTCPromisesHandler". Also throws error if first argument "MediaStream" is missing.
* @requires {@link RecordRTC}
*/
function w(e,t){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var i=this;i.recordRTC=new o(e,t),this.startRecording=function(){return new Promise(function(e,t){try{i.recordRTC.startRecording(),e()}catch(e){t(e)}})},this.stopRecording=function(){return new Promise(function(e,t){try{i.recordRTC.stopRecording(function(t){i.blob=i.recordRTC.getBlob(),e(t)})}catch(e){t(e)}})},this.getDataURL=function(e){return new Promise(function(e,t){try{i.recordRTC.getDataURL(function(t){e(t)})}catch(e){t(e)}})},this.getBlob=function(){return i.recordRTC.getBlob()},this.blob=null}var R,C;o.version="5.4.6",e.exports=o,R=[],void 0!==(C=function(){return o}.apply(t,R))&&(e.exports=C),o.getFromDisk=function(e,t){if(!t)throw"callback is mandatory.";console.log("Getting recorded "+("all"===e?"blobs":e+" blob ")+" from disk!"),I.Fetch(function(i,n){"all"!==e&&n===e+"Blob"&&t&&t(i),"all"===e&&t&&t(i,n.replace("Blob",""))})},o.writeToDisk=function(e){console.log("Writing recorded blob(s) to disk!"),e=e||{},e.audio&&e.video&&e.gif?e.audio.getDataURL(function(t){e.video.getDataURL(function(i){e.gif.getDataURL(function(e){I.Store({audioBlob:t,videoBlob:i,gifBlob:e})})})}):e.audio&&e.video?e.audio.getDataURL(function(t){e.video.getDataURL(function(e){I.Store({audioBlob:t,videoBlob:e})})}):e.audio&&e.gif?e.audio.getDataURL(function(t){e.gif.getDataURL(function(e){I.Store({audioBlob:t,gifBlob:e})})}):e.video&&e.gif?e.video.getDataURL(function(t){e.gif.getDataURL(function(e){I.Store({videoBlob:t,gifBlob:e})})}):e.audio?e.audio.getDataURL(function(e){I.Store({audioBlob:e})}):e.video?e.video.getDataURL(function(e){I.Store({videoBlob:e})}):e.gif&&e.gif.getDataURL(function(e){I.Store({gifBlob:e})})},d.getFromDisk=o.getFromDisk,d.writeToDisk=o.writeToDisk,void 0!==o&&(o.MRecordRTC=d);!function(e){e&&"undefined"==typeof window&&void 0!==i&&(i.navigator={userAgent:"Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45",getUserMedia:function(){}},i.console||(i.console={}),void 0!==i.console.log&&void 0!==i.console.error||(i.console.error=i.console.log=i.console.log||function(){console.log(arguments)}),"undefined"==typeof document&&(e.document={},document.createElement=document.captureStream=document.mozCaptureStream=function(){var e={getContext:function(){return e},play:function(){},pause:function(){},drawImage:function(){},toDataURL:function(){return""}};return e},e.HTMLVideoElement=function(){}),"undefined"==typeof location&&(e.location={protocol:"file:",href:"",hash:""}),"undefined"==typeof screen&&(e.screen={width:0,height:0}),void 0===M&&(e.URL={createObjectURL:function(){return""},revokeObjectURL:function(){return""}}),e.window=i)}(void 0!==i?i:null);var k=window.requestAnimationFrame;if(void 0===k)if("undefined"!=typeof webkitRequestAnimationFrame)k=webkitRequestAnimationFrame;else if("undefined"!=typeof mozRequestAnimationFrame)k=mozRequestAnimationFrame;else if("undefined"!=typeof msRequestAnimationFrame)k=msRequestAnimationFrame;else if(void 0===k){var T=0;k=function(e,t){var i=(new Date).getTime(),n=Math.max(0,16-(i-T)),o=setTimeout(function(){e(i+n)},n);return T=i+n,o}}var S=window.cancelAnimationFrame;void 0===S&&("undefined"!=typeof webkitCancelAnimationFrame?S=webkitCancelAnimationFrame:"undefined"!=typeof mozCancelAnimationFrame?S=mozCancelAnimationFrame:"undefined"!=typeof msCancelAnimationFrame?S=msCancelAnimationFrame:void 0===S&&(S=function(e){clearTimeout(e)}));var x=window.AudioContext;void 0===x&&("undefined"!=typeof webkitAudioContext&&(x=webkitAudioContext),"undefined"!=typeof mozAudioContext&&(x=mozAudioContext));var M=window.URL;void 0===M&&"undefined"!=typeof webkitURL&&(M=webkitURL),"undefined"!=typeof navigator&&void 0===navigator.getUserMedia&&(void 0!==navigator.webkitGetUserMedia&&(navigator.getUserMedia=navigator.webkitGetUserMedia),void 0!==navigator.mozGetUserMedia&&(navigator.getUserMedia=navigator.mozGetUserMedia));var D=!(-1===navigator.userAgent.indexOf("Edge")||!navigator.msSaveBlob&&!navigator.msSaveOrOpenBlob),L=!!window.opera||-1!==navigator.userAgent.indexOf("OPR/"),A=navigator.userAgent.toLowerCase().indexOf("safari/")>-1,O=!L&&!D&&!!navigator.webkitGetUserMedia||u()||A,U=window.MediaStream;void 0===U&&"undefined"!=typeof webkitMediaStream&&(U=webkitMediaStream),void 0!==U&&("getVideoTracks"in U.prototype||(U.prototype.getVideoTracks=function(){if(!this.getTracks)return[];var e=[];return this.getTracks().forEach(function(t){-1!==t.kind.toString().indexOf("video")&&e.push(t)}),e},U.prototype.getAudioTracks=function(){if(!this.getTracks)return[];var e=[];return this.getTracks().forEach(function(t){-1!==t.kind.toString().indexOf("audio")&&e.push(t)}),e}),void 0===U.prototype.stop&&(U.prototype.stop=function(){this.getTracks().forEach(function(e){e.stop()})}));/**
* Storage is a standalone object used by {@link RecordRTC} to store reusable objects e.g. "new AudioContext".
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @example
* Storage.AudioContext === webkitAudioContext
* @property {webkitAudioContext} AudioContext - Keeps a reference to AudioContext object.
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
*/
var B={};void 0!==x?B.AudioContext=x:"undefined"!=typeof webkitAudioContext&&(B.AudioContext=webkitAudioContext),void 0!==o&&(o.Storage=B),void 0!==o&&(o.MediaStreamRecorder=m),void 0!==o&&(o.StereoAudioRecorder=p),void 0!==o&&(o.CanvasRecorder=h),void 0!==o&&(o.WhammyRecorder=g);/**
* Whammy is a standalone class used by {@link RecordRTC} to bring video recording in Chrome. It is written by {@link https://github.com/antimatter15|antimatter15}
* @summary A real time javascript webm encoder based on a canvas hack.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @typedef Whammy
* @class
* @example
* var recorder = new Whammy().Video(15);
* recorder.add(context || canvas || dataURL);
* var output = recorder.compile();
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
*/
var j=function(){function e(e){this.frames=[],this.duration=e||1,this.quality=.8}function t(e){var t=M.createObjectURL(new Blob([e.toString(),"this.onmessage = function (e) {"+e.name+"(e.data);}"],{type:"application/javascript"})),i=new Worker(t);return M.revokeObjectURL(t),i}function i(e){function t(e){var t=n(e);if(!t)return[];for(var o=[{id:440786851,data:[{data:1,id:17030},{data:1,id:17143},{data:4,id:17138},{data:8,id:17139},{data:"webm",id:17026},{data:2,id:17031},{data:2,id:17029}]},{id:408125543,data:[{id:357149030,data:[{data:1e6,id:2807729},{data:"whammy",id:19840},{data:"whammy",id:22337},{data:f(t.duration),id:17545}]},{id:374648427,data:[{id:174,data:[{data:1,id:215},{data:1,id:29637},{data:0,id:156},{data:"und",id:2274716},{data:"V_VP8",id:134},{data:"VP8",id:2459272},{data:1,id:131},{id:224,data:[{data:t.width,id:176},{data:t.height,id:186}]}]}]}]}],a=0,r=0;a<e.length;){var s=[],c=0;do{s.push(e[a]),c+=e[a].duration,a++}while(a<e.length&&c<3e4);var u={id:524531317,data:i(r,0,s)};o[1].data.push(u),r+=c}return d(o)}function i(e,t,i){return[{data:e,id:231}].concat(i.map(function(e){var i=s({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}}))}function n(e){if(!e[0])return void postMessage({error:"Something went wrong. Maybe WebP format is not supported in the current browser."});for(var t=e[0].width,i=e[0].height,n=e[0].duration,o=1;o<e.length;o++)n+=e[o].duration;return{duration:n,width:t,height:i}}function o(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function a(e){return new Uint8Array(e.split("").map(function(e){return e.charCodeAt(0)}))}function r(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i<e.length;i+=8)t.push(parseInt(e.substr(i,8),2));return new Uint8Array(t)}function d(e){for(var t=[],i=0;i<e.length;i++){var n=e[i].data;"object"==typeof n&&(n=d(n)),"number"==typeof n&&(n=r(n.toString(2))),"string"==typeof n&&(n=a(n));var s=n.size||n.byteLength||n.length,c=Math.ceil(Math.ceil(Math.log(s)/Math.log(2))/8),u=s.toString(2),l=new Array(7*c+7+1-u.length).join("0")+u,f=new Array(c).join("0")+"1"+l;t.push(o(e[i].id)),t.push(r(f)),t.push(n)}return new Blob(t,{type:"video/webm"})}function s(e){var t=0;if(e.keyframe&&(t|=128),e.invisible&&(t|=8),e.lacing&&(t|=e.lacing<<1),e.discardable&&(t|=1),e.trackNum>127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map(function(e){return String.fromCharCode(e)}).join("")+e.frame}function c(e){for(var t=e.RIFF[0].WEBP[0],i=t.indexOf("*"),n=0,o=[];n<4;n++)o[n]=t.charCodeAt(i+3+n);var a,r,d;return d=o[1]<<8|o[0],a=16383&d,d=o[3]<<8|o[2],r=16383&d,{width:a,height:r,data:t,riff:e}}function u(e,t){return parseInt(e.substr(t+4,4).split("").map(function(e){var t=e.charCodeAt(0).toString(2);return new Array(8-t.length+1).join("0")+t}).join(""),2)}function l(e){for(var t=0,i={};t<e.length;){var n=e.substr(t,4),o=u(e,t),a=e.substr(t+4+4,o);t+=8+o,i[n]=i[n]||[],"RIFF"===n||"LIST"===n?i[n].push(l(a)):i[n].push(a)}return i}function f(e){return[].slice.call(new Uint8Array(new Float64Array([e]).buffer),0).map(function(e){return String.fromCharCode(e)}).reverse().join("")}var m=new t(e.map(function(e){var t=c(l(atob(e.image.slice(23))));return t.duration=e.duration,t}));postMessage(m)}return e.prototype.add=function(e,t){if("canvas"in e&&(e=e.canvas),"toDataURL"in e&&(e=e.toDataURL("image/webp",this.quality)),!/^data:image\/webp;base64,/gi.test(e))throw"Input must be formatted properly as a base64 encoded DataURI of type image/webp";this.frames.push({image:e,duration:t||this.duration})},e.prototype.compile=function(e){var n=t(i);n.onmessage=function(t){if(t.data.error)return void console.error(t.data.error);e(t.data)},n.postMessage(this.frames)},{Video:e}}();void 0!==o&&(o.Whammy=j);/**
* DiskStorage is a standalone object used by {@link RecordRTC} to store recorded blobs in IndexedDB storage.
* @summary Writing blobs into IndexedDB.
* @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT}
* @author {@link http://www.MuazKhan.com|Muaz Khan}
* @example
* DiskStorage.Store({
* audioBlob: yourAudioBlob,
* videoBlob: yourVideoBlob,
* gifBlob : yourGifBlob
* });
* DiskStorage.Fetch(function(dataURL, type) {
* if(type === 'audioBlob') { }
* if(type === 'videoBlob') { }
* if(type === 'gifBlob') { }
* });
* // DiskStorage.dataStoreName = 'recordRTC';
* // DiskStorage.onError = function(error) { };
* @property {function} init - This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.
* @property {function} Fetch - This method fetches stored blobs from IndexedDB.
* @property {function} Store - This method stores blobs in IndexedDB.
* @property {function} onError - This function is invoked for any known/unknown error.
* @property {string} dataStoreName - Name of the ObjectStore created in IndexedDB storage.
* @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}
*/
var I={init:function(){function e(e){e.createObjectStore(i.dataStoreName)}function t(){function e(e){t.objectStore(i.dataStoreName).get(e).onsuccess=function(t){i.callback&&i.callback(t.target.result,e)}}var t=n.transaction([i.dataStoreName],"readwrite");i.videoBlob&&t.objectStore(i.dataStoreName).put(i.videoBlob,"videoBlob"),i.gifBlob&&t.objectStore(i.dataStoreName).put(i.gifBlob,"gifBlob"),i.audioBlob&&t.objectStore(i.dataStoreName).put(i.audioBlob,"audioBlob"),e("audioBlob"),e("videoBlob"),e("gifBlob")}var i=this;if("undefined"==typeof indexedDB||void 0===indexedDB.open)return void console.error("IndexedDB API are not available in this browser.");var n,o=this.dbName||location.href.replace(/\/|:|#|%|\.|\[|\]/g,""),a=indexedDB.open(o,1);a.onerror=i.onError,a.onsuccess=function(){if(n=a.result,n.onerror=i.onError,n.setVersion)if(1!==n.version){var o=n.setVersion(1);o.onsuccess=function(){e(n),t()}}else t();else t()},a.onupgradeneeded=function(t){e(t.target.result)}},Fetch:function(e){return this.callback=e,this.init(),this},Store:function(e){return this.audioBlob=e.audioBlob,this.videoBlob=e.videoBlob,this.gifBlob=e.gifBlob,this.init(),this},onError:function(e){console.error(JSON.stringify(e,null,"\t"))},dataStoreName:"recordRTC",dbName:null};void 0!==o&&(o.DiskStorage=I),void 0!==o&&(o.GifRecorder=v),void 0!==o&&(o.MultiStreamRecorder=y),void 0!==o&&(o.RecordRTCPromisesHandler=w)}).call(t,i(21),i(22))},function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(e){if(u===setTimeout)return setTimeout(e,0);if((u===i||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function a(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function r(){h&&m&&(h=!1,m.length?p=m.concat(p):g=-1,p.length&&d())}function d(){if(!h){var e=o(r);h=!0;for(var t=p.length;t;){for(m=p,p=[];++g<t;)m&&m[g].run();g=-1,t=p.length}m=null,h=!1,a(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var u,l,f=e.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:i}catch(e){u=i}try{l="function"==typeof clearTimeout?clearTimeout:n}catch(e){l=n}}();var m,p=[],h=!1,g=-1;f.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];p.push(new s(e,t)),1!==p.length||h||o(d)},s.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=c,f.addListener=c,f.once=c,f.off=c,f.removeListener=c,f.removeAllListeners=c,f.emit=c,f.prependListener=c,f.prependOnceListener=c,f.listeners=function(e){return[]},f.binding=function(e){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(e){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(0);i.d(t,"icheck",function(){return n.default});var o=i(1);i.d(t,"select2",function(){return o.default});var a=i(2);i.d(t,"imagepicker",function(){return a.default});var r=i(3);i.d(t,"inputmask",function(){return r.default});var d=i(5);i.d(t,"jquerybarrating",function(){return d.default});var s=i(6);i.d(t,"jqueryuidatepicker",function(){return s.default});var c=i(7);i.d(t,"nouislider",function(){return c.default});var u=i(9);i.d(t,"select2tagbox",function(){return u.default});var l=i(10);i.d(t,"signaturepad",function(){return l.default});var f=i(12);i.d(t,"sortablejs",function(){return f.default});var m=i(14);i.d(t,"ckeditor",function(){return m.default});var p=i(15);i.d(t,"autocomplete",function(){return p.default});var h=i(16);i.d(t,"prettycheckbox",function(){return h.default});var g=i(17);i.d(t,"bootstrapslider",function(){return g.default});var v=i(19);i.d(t,"microphone",function(){return v.default})}])});
//# sourceMappingURL=surveyjs-widgets.min.js.map