File: /home/zeusxp5/chuair.org/wp-content/plugins/wd-framework/build/product-attributes.js
!function(){"use strict";var e,t={6371:function(){var e=window.wp.blocks;function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e},t.apply(this,arguments)}var a=window.wp.element,l=window.wp.i18n,n=window.wp.blockEditor,o=window.wp.components;function s(e){let{level:t,isPressed:l=!1}=e;const n={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 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4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return n.hasOwnProperty(t)?(0,a.createElement)(o.SVG,{width:"24",height:"24",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",isPressed:l},(0,a.createElement)(o.Path,{d:n[t]})):null}const r=[1,2,3,4,5,6],i={className:"block-library-heading-level-dropdown"};function c(e){let{selectedLevel:t,onChange:n}=e;return(0,a.createElement)(o.ToolbarDropdownMenu,{popoverProps:i,icon:(0,a.createElement)(s,{level:t}),label:(0,l.__)("Change heading level"),controls:r.map((e=>{{const o=e===t;return{icon:(0,a.createElement)(s,{level:e,isPressed:o}),label:(0,l.sprintf)(
// translators: %s: heading level e.g: "1", "2", "3"
(0,l.__)("Heading %d"),e),isActive:o,onClick(){n(e)}}}}))})}var d=JSON.parse('{"apiVersion":2,"name":"webdevia/product-attributes","version":"0.1.0","title":"Product Attributes","category":"webdevia","description":"this block shows the product attributes we added as custom fields","attributes":{"content":{"type":"string","source":"html","selector":"h1,h2,h3,h4,h5,h6","default":""},"title":{"type":"string","default":""},"dropIndex":{"type":"integer","default":0},"fields":{"type":"array","default":[]},"taxonomy":{"type":"object","default":{}},"level":{"type":"number","default":2},"displayStyle":{"type":"string","default":"list"}},"keywords":["Gutenberg Repeater Field","Repeatable","product attributes","custom field"],"supports":{"html":false},"textdomain":"webdevia-blocks","editorScript":"file:./index.js","viewScript":"file:./view.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');const{name:m,...u}=d,p=wp.element.createElement,v=p("svg",{width:24,height:24,viewBox:"0 0 24 24",strokeWidth:"0",className:"wd-blocks-icon"},p("path",{d:"M14 2v2h-4v-2h4zm2-2h-8v6h8v-6zm-12 20v2h-2v-2h2zm2-2h-6v6h6v-6zm16 2v2h-2v-2h2zm2-2h-6v6h6v-6zm-11 2v2h-2v-2h2zm2-2h-6v6h6v-6zm6-2h-2c0-3.75-4.967-1.207-6.942-4.753-1.965 3.526-7.135 1.016-7.142 4.753h-1.916c.003-6.521 7.384-1.532 8-8h2c.616 6.473 8 1.469 8 8z"}));(0,e.registerBlockType)(m,{...u,icon:v,edit:function(e){let{attributes:o,setAttributes:s}=e;const{Button:r,PanelBody:i,TextControl:d,SelectControl:m}=wp.components,{InspectorControls:u,RichText:p,BlockControls:v}=wp.blockEditor,{useEffect:_}=wp.element,{title:b,fields:h,dropIndex:y,taxonomy:w,level:f,displayStyle:g}=o,E="h"+f;let x,k,N;var z,H;z=webdeviaProductAttributesData.custom_fields?webdeviaProductAttributesData.custom_fields:[],H=new Set,x=z.filter((e=>!H.has(e.id)&&H.add(e.id))),_((()=>{x.length&&x[0].id!==w.slug&&V({slug:x[0].id,type:x[0].type,name:x[0].name})}),[]);const C=e=>{const t=e.target.closest(".wd__product-attributes-attributes__head").querySelector(".wd__product-attributes-attributes__panel-body__params"),a=e.target.closest(".wd__product-attributes-attributes__head").querySelector(".wd__product-attributes-attributes");t.style.display="none"==t.style.display||""==t.style.display?"block":"none",a.classList.toggle("wd__product-attributes-attributes__arrow")};function V(e){const t="location"==e.type?{taxonomy:{slug:e.slug,type:e.type,name:e.name,canvasHeight:"500",zoomLevel:"5"}}:{taxonomy:{slug:e.slug,type:e.type,name:e.name}};s(t)}const O=(0,n.useBlockProps)({className:`wp-block-webdevia-product-attributes ${g}`});return h.length&&(k=h.map(((e,t)=>(0,a.createElement)("div",{className:"wd__product-attributes-attributes__head",key:t,draggable:!0,onDragEnter:e=>((e,t)=>{s({dropIndex:t})})(0,t),onDragEnd:e=>((e,t)=>{const a=[...o.fields],l=a[t];a.splice(t,1);const n=[...a.slice(0,y),l,...a.slice(y,a.length)];s({fields:n})})(0,t)},(0,a.createElement)("div",{className:"wd__product-attributes-attributes",onClick:C},(0,a.createElement)("p",{className:"wd__product-attributes-attributes__name"},e.taxonomy.name),(0,a.createElement)(r,{className:"wd__product-attributes-attributes__remove-name",icon:"no-alt",label:"Delete field",onClick:()=>(e=>{const t=[...o.fields];t.splice(e,1),s({fields:t})})(t)})),(0,a.createElement)("div",{className:"wd__product-attributes-attributes__panel-body__params"},(0,a.createElement)("fieldset",{className:"wd__product-attributes-attributes__panel-body__params__custom-format"},(0,a.createElement)("legend",null,(0,l.__)("Custom Format:","webdevia-blocks")),(0,a.createElement)(d,{value:e.taxonomy.displayText,placeholder:"use {name} and {value}",onChange:e=>((e,t)=>{const a=[...o.fields];a[e].taxonomy.displayText=t,s({fields:a})})(t,e)})),"location"==e.taxonomy.type?(0,a.createElement)(a.Fragment,null,(0,a.createElement)("fieldset",{className:"wd__product-attributes-attributes__panel-body__params__canvas-height"},(0,a.createElement)("legend",null,(0,l.__)("Canvas Height (in px):","webdevia-blocks")),(0,a.createElement)(d,{value:e.taxonomy.canvasHeight,placeholder:"Enter canvas height",onChange:e=>(e=>{const t=h.filter((e=>"location"==e.taxonomy.type))[0],a={...t,taxonomy:{...t.taxonomy,canvasHeight:e}},l=h.map((e=>"location"===e.taxonomy.type?a:e));s({fields:l})})(e)})),(0,a.createElement)("fieldset",{className:"wd__product-attributes-attributes__panel-body__params__zoom-lvel"},(0,a.createElement)("legend",null,(0,l.__)("Zoom Level:","webdevia-blocks")),(0,a.createElement)(d,{value:e.taxonomy.zoomLevel,placeholder:"Enter zoom level",onChange:e=>(e=>{const t=h.filter((e=>"location"==e.taxonomy.type))[0],a={...t,taxonomy:{...t.taxonomy,zoomLevel:e}},l=h.map((e=>"location"===e.taxonomy.type?a:e));s({fields:l})})(e)}))):(0,a.createElement)(a.Fragment,null))))),N=h.map(((e,t)=>(0,a.createElement)("div",{key:t,className:"location"==e.taxonomy.type?"map-line":"line"},"table"==g?(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"name"},e.taxonomy.name),(0,a.createElement)("div",{className:"value"},"{value}")):(0,a.createElement)(a.Fragment,null,e.taxonomy.displayText.replace("{name}",e.taxonomy.name)))))),[(0,a.createElement)(u,{key:"1"},(0,a.createElement)(i,{title:(0,l.__)("Custom Fields"),className:"wd__product-attributes-attributes__panel-body"},k,(0,a.createElement)("div",{className:"wd__product-attributes-attributes__add-group"},(0,a.createElement)("select",{id:"SelectTaxonomy",className:"wd__product-attributes-attributes__panel-body__taxonomies",onChange:e=>(e=>{V(JSON.parse(e.target.value))})(e)},x.map((e=>(0,a.createElement)("option",{value:JSON.stringify({slug:e.id,type:e.type,name:e.name})},e.name)))),(0,a.createElement)(r,{variant:"secondary",className:"wd__product-attributes-attributes__panel-body__add-btn",onClick:()=>(e=>{const t=[...o.fields];t.push({taxonomy:{...e,displayText:"location"==e.type||"url"==e.type?"{value}":"{name}: {value}"}}),s({fields:t})})(w)},(0,l.__)("Add Item"))),(0,a.createElement)(m,{label:(0,l.__)("Display: ","webdevia-blocks"),id:"SelectTaxonomy",className:"wd__product-attributes-attributes__panel-body__taxonomies",value:g,onChange:e=>(e=>{s({displayStyle:e})})(e)},(0,a.createElement)("option",{value:"list"},(0,l.__)("List","webdevia-blocks")),(0,a.createElement)("option",{value:"table"},(0,l.__)("Table","webdevia-blocks"))))),(0,a.createElement)("div",t({key:"2"},O),(0,a.createElement)(v,{group:"block"},(0,a.createElement)(c,{selectedLevel:f,onChange:e=>s({level:e})})),(0,a.createElement)(p,{identifier:"content",tagName:E,className:"wp-block-webdevia-product-attributes__title",placeholder:(0,l.__)("Fields"),value:b,onChange:e=>{s({content:e}),s({title:e})}}),(0,a.createElement)("div",{className:"lines"},"table"==g?(0,a.createElement)("div",{className:"line header"},(0,a.createElement)("div",{className:"header-name"},(0,l.__)("Name","webdevia-blocks")),(0,a.createElement)("div",{className:"header-value"},(0,l.__)("Value","webdevia-blocks"))):(0,a.createElement)(a.Fragment,null),N))]}})}},a={};function l(e){var n=a[e];if(void 0!==n)return n.exports;var o=a[e]={exports:{}};return t[e](o,o.exports,l),o.exports}l.m=t,e=[],l.O=function(t,a,n,o){if(!a){var s=1/0;for(d=0;d<e.length;d++){a=e[d][0],n=e[d][1],o=e[d][2];for(var r=!0,i=0;i<a.length;i++)(!1&o||s>=o)&&Object.keys(l.O).every((function(e){return l.O[e](a[i])}))?a.splice(i--,1):(r=!1,o<s&&(s=o));if(r){e.splice(d--,1);var c=n();void 0!==c&&(t=c)}}return t}o=o||0;for(var d=e.length;d>0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[a,n,o]},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={5516:0,4322:0,1555:0};l.O.j=function(t){return 0===e[t]};var t=function(t,a){var n,o,s=a[0],r=a[1],i=a[2],c=0;if(s.some((function(t){return 0!==e[t]}))){for(n in r)l.o(r,n)&&(l.m[n]=r[n]);if(i)var d=i(l)}for(t&&t(a);c<s.length;c++)o=s[c],l.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return l.O(d)},a=self.webpackChunkwebdevia_blocks=self.webpackChunkwebdevia_blocks||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))}();var n=l.O(void 0,[1555],(function(){return l(6371)}));n=l.O(n)}();