var __awaiter=this&&this.__awaiter||function(e,t,r,n){function l(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{u(n.next(e))}catch(t){i(t)}}function o(e){try{u(n["throw"](e))}catch(t){i(t)}}function u(e){e.done?r(e.value):l(e.value).then(a,o)}u((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,l,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(e){return function(t){return u([e,t])}}function u(a){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,l&&(i=a[0]&2?l["return"]:a[0]?l["throw"]||((i=l["return"])&&i.call(l),0):l.next)&&!(i=i.call(l,a[1])).done)return i;if(l=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:r.label++;return{value:a[1],done:false};case 5:r.label++;l=a[1];a=[0];continue;case 7:a=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){r.label=a[1];break}if(a[0]===6&&r.label<i[1]){r.label=i[1];i=a;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(a);break}if(i[2])r.ops.pop();r.trys.pop();continue}a=t.call(e,r)}catch(o){a=[6,o];l=0}finally{n=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-0bfb8721.system.js"],(function(e){"use strict";var t,r,n;return{setters:[function(e){t=e.r;r=e.h;n=e.g}],execute:function(){var l=e("bce_element_matrix",function(){function e(e){var r=this;t(this,e);this.value=this.template?Array(this.template.rows.length).fill(null):[];this.handleInput=function(e){e.cancelBubble=true;var t=r.el.shadowRoot.querySelectorAll("bce-select");r.value=Array.from(t).map((function(e){var t=typeof e.value==="string"&&e.value.split(",")[1];return t?parseInt(t,10):null}));r.el.dispatchEvent(new Event("input",{bubbles:true}))}}e.prototype.validate=function(e){if(e===void 0){e=false}return __awaiter(this,void 0,void 0,(function(){var t,r,n;return __generator(this,(function(l){switch(l.label){case 0:t=this.el.shadowRoot;r=Array.from(t.querySelectorAll("bce-select"));return[4,Promise.all(r.map((function(t){return t.validate(e)})))];case 1:n=l.sent();return[2,[].concat.apply([],n)]}}))}))};e.prototype.renderHeader=function(){return this.handler.t("columns").map((function(e){if(e.icon)return r("bce-icon",{raw:e.icon,style:{color:e.color}});return r("label",null,e.text)}))};e.prototype.renderRow=function(e){var t=this;if(!this.template)return null;var n=this.value[e]!=null?e+","+this.value[e]:null;return r("bce-select",{allowNull:this.allowNull,design:"matrix",type:"radio",value:n,validation:this.template.required?"required":"",onInput:this.handleInput},this.template.columns.map((function(n,l){return r("bce-option",{allowNull:t.allowNull,value:e+","+l})})))};e.prototype.render=function(){var e=this;if(!this.template)return null;var t=this.template.orientation;var n=this.handler.t("rows").map((function(t,n){return[r("label",{class:"row"},t.text),e.renderRow(n)]}));return[r("p",null,this.handler.t("question")),r("div",null),r("div",{class:"cl","data-orientation":t},this.renderHeader()),n]};Object.defineProperty(e.prototype,"el",{get:function(){return n(this)},enumerable:true,configurable:true});Object.defineProperty(e,"style",{get:function(){return":host{display:grid;grid-template:\"qu qu\" \".. cl\" auto/auto auto;margin:20px 0}:host>p{font-weight:500;text-align:center;grid-area:qu;text-align:center}\@media screen and (min-width: 1024px){:host>p{text-align:left}}:host .row{margin:0 10px 10px 0}:host bce-select{-ms-flex-pack:center;justify-content:center;margin:0 0 10px}:host .cl{grid-area:cl;position:relative;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;text-align:center}:host .cl bce-icon{font-size:40px}:host .cl label{display:-ms-flexbox;display:flex;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-align:center;align-items:center;width:25px;padding:16px 0 0 7px;-webkit-writing-mode:vertical-rl;-ms-writing-mode:tb-rl;writing-mode:vertical-rl;-webkit-transform:rotate(180deg);transform:rotate(180deg)}:host .cl label:before{content:\"\";margin-left:-100%}:host .cl label:after{content:\"\";margin-right:-100%}\@media screen and (min-width: 1024px){:host bce-select,:host .cl{margin:0 40px 10px}:host .cl[data-orientation=horizontal] label{-ms-flex-pack:center;justify-content:center;padding:0 0 16px 7px;-webkit-writing-mode:horizontal-tb;-ms-writing-mode:lr-tb;writing-mode:horizontal-tb;-webkit-transform:none;transform:none}}"},enumerable:true,configurable:true});return e}())}}}));