Changeset 3714904
- Timestamp:
- 09/27/2026 01:49:11 AM (4 weeks ago)
- Location:
- ordessa/trunk
- Files:
-
- 3 added
- 11 edited
-
build/blocks/foldout/block.json (modified) (2 diffs)
-
build/blocks/foldout/index-rtl.css (modified) (1 diff)
-
build/blocks/foldout/index.asset.php (modified) (1 diff)
-
build/blocks/foldout/index.css (modified) (1 diff)
-
build/blocks/foldout/index.js (modified) (1 diff)
-
includes (added)
-
includes/schema.php (added)
-
ordessa.php (modified) (2 diffs)
-
package.json (modified) (1 diff)
-
readme.txt (modified) (5 diffs)
-
src/blocks/foldout/block.json (modified) (2 diffs)
-
src/blocks/foldout/edit.js (modified) (2 diffs)
-
src/blocks/foldout/editor.scss (modified) (1 diff)
-
src/blocks/foldout/schema.js (added)
Legend:
- Unmodified
- Added
- Removed
-
ordessa/trunk/build/blocks/foldout/block.json
r3714345 r3714904 16 16 "bulk" 17 17 ], 18 "version": "0.1. 5",18 "version": "0.1.6", 19 19 "textdomain": "ordessa", 20 20 "attributes": { … … 62 62 "default": false 63 63 }, 64 "emitSchema": { 65 "type": "boolean", 66 "default": false 67 }, 68 "schemaShape": { 69 "type": "string", 70 "default": "questions" 71 }, 64 72 "groupId": { 65 73 "type": "string", -
ordessa/trunk/build/blocks/foldout/index-rtl.css
r3713592 r3714904 1 .wb-faq-editor__stack{display:flex;flex-direction:column;gap:12px}.wb-faq-editor .wb-faq-editor__list{list-style:none;margin:0;padding:0}.wb-faq-editor .wb-faq-editor__item,.wb-faq-editor .wb-faq__item{background:transparent;border:0;border-bottom:1px solid;border-color:color-mix(in srgb,currentcolor 20%,transparent);border-radius:0;margin:0;padding:0}.wb-faq-editor .wb-faq-editor__item.is-dragging,.wb-faq-editor .wb-faq__item.is-dragging{opacity:.5}.wb-faq-editor .wb-faq-editor__item.is-drop-target,.wb-faq-editor .wb-faq__item.is-drop-target{border-color:var(--wp-admin-theme-color,#3858e9);box-shadow:0 -2px 0 0 var(--wp-admin-theme-color,#3858e9)}.wb-faq-editor .wb-faq-editor__item.is-incomplete,.wb-faq-editor .wb-faq__item.is-incomplete{border-right:3px solid #bd8600}.wb-faq-editor .wb-faq-editor__item-warning{color:#8a6116;font-size:12px;margin:4px 0 0}.wb-faq-editor .wb-faq-editor__warning{margin:0 0 8px}.wb-faq-editor .wb-faq-editor__item-header{align-items:center;display:flex;gap:4px;margin-bottom:4px}.wb-faq-editor .wb-faq-editor__drag-handle{align-items:center;color:#757575;cursor:grab;display:inline-flex}.wb-faq-editor .wb-faq-editor__drag-handle:active{cursor:grabbing}.wb-faq-editor .wb-faq-editor__position{color:#757575;font-size:11px;letter-spacing:.05em;text-transform:uppercase}.wb-faq-editor .wb-faq-editor__item-actions{display:flex;gap:2px;margin-right:auto}.wb-faq-editor .wb-faq-editor__question,.wb-faq-editor .wb-faq__question{align-items:center;display:flex;gap:.75em;list-style:none;margin:0;padding:.75em 0}.wb-faq-editor .wb-faq-editor__question:focus-visible,.wb-faq-editor .wb-faq__question:focus-visible{outline:2px solid currentcolor;outline-offset:2px}.wb-faq-editor .wb-faq__heading{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.wb-faq-editor .wb-faq-editor__answer,.wb-faq-editor .wb-faq__answer{margin:0;padding:0 0 1em}.wb-faq-editor .wb-faq-editor__add{margin-top:4px}.wb-faq-editor__outline-notice {margin:8px 0 0}.wb-faq-bulk{max-width:380px}.wb-faq-bulk .wb-faq-bulk__intro{color:#757575;font-size:12px;margin:0}.wb-faq-bulk .wb-faq-bulk__preview-list{font-size:12px;margin:0 0 8px;padding-right:1.2em}.wb-faq-bulk .wb-faq-bulk__preview-list li{margin-bottom:6px}.wb-faq-bulk .wb-faq-bulk__preview-list strong{display:block}.wb-faq-bulk .wb-faq-bulk__preview-list span{color:#757575;display:block}.wb-faq-bulk .wb-faq-bulk__count{font-weight:600;margin:0 0 6px}.wb-faq-bulk .wb-faq-bulk__format{color:#757575;font-size:12px;margin:0 0 8px}.wb-faq-bulk .wb-faq-bulk__more{color:#757575;font-size:12px}.wb-faq-bulk .wb-faq-bulk__errors{font-size:12px;margin:0;padding-right:1.2em}.wb-faq-bulk__popover{max-width:420px;padding:16px}1 .wb-faq-editor__stack{display:flex;flex-direction:column;gap:12px}.wb-faq-editor .wb-faq-editor__list{list-style:none;margin:0;padding:0}.wb-faq-editor .wb-faq-editor__item,.wb-faq-editor .wb-faq__item{background:transparent;border:0;border-bottom:1px solid;border-color:color-mix(in srgb,currentcolor 20%,transparent);border-radius:0;margin:0;padding:0}.wb-faq-editor .wb-faq-editor__item.is-dragging,.wb-faq-editor .wb-faq__item.is-dragging{opacity:.5}.wb-faq-editor .wb-faq-editor__item.is-drop-target,.wb-faq-editor .wb-faq__item.is-drop-target{border-color:var(--wp-admin-theme-color,#3858e9);box-shadow:0 -2px 0 0 var(--wp-admin-theme-color,#3858e9)}.wb-faq-editor .wb-faq-editor__item.is-incomplete,.wb-faq-editor .wb-faq__item.is-incomplete{border-right:3px solid #bd8600}.wb-faq-editor .wb-faq-editor__item-warning{color:#8a6116;font-size:12px;margin:4px 0 0}.wb-faq-editor .wb-faq-editor__warning{margin:0 0 8px}.wb-faq-editor .wb-faq-editor__item-header{align-items:center;display:flex;gap:4px;margin-bottom:4px}.wb-faq-editor .wb-faq-editor__drag-handle{align-items:center;color:#757575;cursor:grab;display:inline-flex}.wb-faq-editor .wb-faq-editor__drag-handle:active{cursor:grabbing}.wb-faq-editor .wb-faq-editor__position{color:#757575;font-size:11px;letter-spacing:.05em;text-transform:uppercase}.wb-faq-editor .wb-faq-editor__item-actions{display:flex;gap:2px;margin-right:auto}.wb-faq-editor .wb-faq-editor__question,.wb-faq-editor .wb-faq__question{align-items:center;display:flex;gap:.75em;list-style:none;margin:0;padding:.75em 0}.wb-faq-editor .wb-faq-editor__question:focus-visible,.wb-faq-editor .wb-faq__question:focus-visible{outline:2px solid currentcolor;outline-offset:2px}.wb-faq-editor .wb-faq__heading{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.wb-faq-editor .wb-faq-editor__answer,.wb-faq-editor .wb-faq__answer{margin:0;padding:0 0 1em}.wb-faq-editor .wb-faq-editor__add{margin-top:4px}.wb-faq-editor__outline-notice,.wb-faq-editor__schema-notice{margin:8px 0 0}.wb-faq-bulk{max-width:380px}.wb-faq-bulk .wb-faq-bulk__intro{color:#757575;font-size:12px;margin:0}.wb-faq-bulk .wb-faq-bulk__preview-list{font-size:12px;margin:0 0 8px;padding-right:1.2em}.wb-faq-bulk .wb-faq-bulk__preview-list li{margin-bottom:6px}.wb-faq-bulk .wb-faq-bulk__preview-list strong{display:block}.wb-faq-bulk .wb-faq-bulk__preview-list span{color:#757575;display:block}.wb-faq-bulk .wb-faq-bulk__count{font-weight:600;margin:0 0 6px}.wb-faq-bulk .wb-faq-bulk__format{color:#757575;font-size:12px;margin:0 0 8px}.wb-faq-bulk .wb-faq-bulk__more{color:#757575;font-size:12px}.wb-faq-bulk .wb-faq-bulk__errors{font-size:12px;margin:0;padding-right:1.2em}.wb-faq-bulk__popover{max-width:420px;padding:16px} -
ordessa/trunk/build/blocks/foldout/index.asset.php
r3714345 r3714904 1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => ' 9351d1f008cc760d75f3');1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '7293d69526b680ddf957'); -
ordessa/trunk/build/blocks/foldout/index.css
r3713592 r3714904 1 .wb-faq-editor__stack{display:flex;flex-direction:column;gap:12px}.wb-faq-editor .wb-faq-editor__list{list-style:none;margin:0;padding:0}.wb-faq-editor .wb-faq-editor__item,.wb-faq-editor .wb-faq__item{background:transparent;border:0;border-bottom:1px solid;border-color:color-mix(in srgb,currentcolor 20%,transparent);border-radius:0;margin:0;padding:0}.wb-faq-editor .wb-faq-editor__item.is-dragging,.wb-faq-editor .wb-faq__item.is-dragging{opacity:.5}.wb-faq-editor .wb-faq-editor__item.is-drop-target,.wb-faq-editor .wb-faq__item.is-drop-target{border-color:var(--wp-admin-theme-color,#3858e9);box-shadow:0 -2px 0 0 var(--wp-admin-theme-color,#3858e9)}.wb-faq-editor .wb-faq-editor__item.is-incomplete,.wb-faq-editor .wb-faq__item.is-incomplete{border-left:3px solid #bd8600}.wb-faq-editor .wb-faq-editor__item-warning{color:#8a6116;font-size:12px;margin:4px 0 0}.wb-faq-editor .wb-faq-editor__warning{margin:0 0 8px}.wb-faq-editor .wb-faq-editor__item-header{align-items:center;display:flex;gap:4px;margin-bottom:4px}.wb-faq-editor .wb-faq-editor__drag-handle{align-items:center;color:#757575;cursor:grab;display:inline-flex}.wb-faq-editor .wb-faq-editor__drag-handle:active{cursor:grabbing}.wb-faq-editor .wb-faq-editor__position{color:#757575;font-size:11px;letter-spacing:.05em;text-transform:uppercase}.wb-faq-editor .wb-faq-editor__item-actions{display:flex;gap:2px;margin-left:auto}.wb-faq-editor .wb-faq-editor__question,.wb-faq-editor .wb-faq__question{align-items:center;display:flex;gap:.75em;list-style:none;margin:0;padding:.75em 0}.wb-faq-editor .wb-faq-editor__question:focus-visible,.wb-faq-editor .wb-faq__question:focus-visible{outline:2px solid currentcolor;outline-offset:2px}.wb-faq-editor .wb-faq__heading{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.wb-faq-editor .wb-faq-editor__answer,.wb-faq-editor .wb-faq__answer{margin:0;padding:0 0 1em}.wb-faq-editor .wb-faq-editor__add{margin-top:4px}.wb-faq-editor__outline-notice {margin:8px 0 0}.wb-faq-bulk{max-width:380px}.wb-faq-bulk .wb-faq-bulk__intro{color:#757575;font-size:12px;margin:0}.wb-faq-bulk .wb-faq-bulk__preview-list{font-size:12px;margin:0 0 8px;padding-left:1.2em}.wb-faq-bulk .wb-faq-bulk__preview-list li{margin-bottom:6px}.wb-faq-bulk .wb-faq-bulk__preview-list strong{display:block}.wb-faq-bulk .wb-faq-bulk__preview-list span{color:#757575;display:block}.wb-faq-bulk .wb-faq-bulk__count{font-weight:600;margin:0 0 6px}.wb-faq-bulk .wb-faq-bulk__format{color:#757575;font-size:12px;margin:0 0 8px}.wb-faq-bulk .wb-faq-bulk__more{color:#757575;font-size:12px}.wb-faq-bulk .wb-faq-bulk__errors{font-size:12px;margin:0;padding-left:1.2em}.wb-faq-bulk__popover{max-width:420px;padding:16px}1 .wb-faq-editor__stack{display:flex;flex-direction:column;gap:12px}.wb-faq-editor .wb-faq-editor__list{list-style:none;margin:0;padding:0}.wb-faq-editor .wb-faq-editor__item,.wb-faq-editor .wb-faq__item{background:transparent;border:0;border-bottom:1px solid;border-color:color-mix(in srgb,currentcolor 20%,transparent);border-radius:0;margin:0;padding:0}.wb-faq-editor .wb-faq-editor__item.is-dragging,.wb-faq-editor .wb-faq__item.is-dragging{opacity:.5}.wb-faq-editor .wb-faq-editor__item.is-drop-target,.wb-faq-editor .wb-faq__item.is-drop-target{border-color:var(--wp-admin-theme-color,#3858e9);box-shadow:0 -2px 0 0 var(--wp-admin-theme-color,#3858e9)}.wb-faq-editor .wb-faq-editor__item.is-incomplete,.wb-faq-editor .wb-faq__item.is-incomplete{border-left:3px solid #bd8600}.wb-faq-editor .wb-faq-editor__item-warning{color:#8a6116;font-size:12px;margin:4px 0 0}.wb-faq-editor .wb-faq-editor__warning{margin:0 0 8px}.wb-faq-editor .wb-faq-editor__item-header{align-items:center;display:flex;gap:4px;margin-bottom:4px}.wb-faq-editor .wb-faq-editor__drag-handle{align-items:center;color:#757575;cursor:grab;display:inline-flex}.wb-faq-editor .wb-faq-editor__drag-handle:active{cursor:grabbing}.wb-faq-editor .wb-faq-editor__position{color:#757575;font-size:11px;letter-spacing:.05em;text-transform:uppercase}.wb-faq-editor .wb-faq-editor__item-actions{display:flex;gap:2px;margin-left:auto}.wb-faq-editor .wb-faq-editor__question,.wb-faq-editor .wb-faq__question{align-items:center;display:flex;gap:.75em;list-style:none;margin:0;padding:.75em 0}.wb-faq-editor .wb-faq-editor__question:focus-visible,.wb-faq-editor .wb-faq__question:focus-visible{outline:2px solid currentcolor;outline-offset:2px}.wb-faq-editor .wb-faq__heading{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.wb-faq-editor .wb-faq-editor__answer,.wb-faq-editor .wb-faq__answer{margin:0;padding:0 0 1em}.wb-faq-editor .wb-faq-editor__add{margin-top:4px}.wb-faq-editor__outline-notice,.wb-faq-editor__schema-notice{margin:8px 0 0}.wb-faq-bulk{max-width:380px}.wb-faq-bulk .wb-faq-bulk__intro{color:#757575;font-size:12px;margin:0}.wb-faq-bulk .wb-faq-bulk__preview-list{font-size:12px;margin:0 0 8px;padding-left:1.2em}.wb-faq-bulk .wb-faq-bulk__preview-list li{margin-bottom:6px}.wb-faq-bulk .wb-faq-bulk__preview-list strong{display:block}.wb-faq-bulk .wb-faq-bulk__preview-list span{color:#757575;display:block}.wb-faq-bulk .wb-faq-bulk__count{font-weight:600;margin:0 0 6px}.wb-faq-bulk .wb-faq-bulk__format{color:#757575;font-size:12px;margin:0 0 8px}.wb-faq-bulk .wb-faq-bulk__more{color:#757575;font-size:12px}.wb-faq-bulk .wb-faq-bulk__errors{font-size:12px;margin:0;padding-left:1.2em}.wb-faq-bulk__popover{max-width:420px;padding:16px} -
ordessa/trunk/build/blocks/foldout/index.js
r3714345 r3714904 1 (()=>{"use strict";var e={647(e,t,n){var s=n.cw(function(e,t){var n= a(),s=Symbol.for("react.element"),r=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,n){var a,l={},c=null,u=null;for(a in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)r.call(t,a)&&!i.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:s,type:e,key:c,ref:u,props:l,_owner:o.current}}}),r=n.cw(function(e,t){e.exports=s()}),a=n.cw(function(e,t){e.exports=window.React});const o=window.wp.blocks,i=JSON.parse('{"UU":"ordessa/faq-accordion","uK":{"items":{"type":"array","default":[],"source":"query","selector":"details.wb-faq__item","query":{"id":{"type":"string","source":"attribute","attribute":"data-wb-id"},"question":{"type":"string","source":"html","selector":".wb-faq__question-text","default":""},"answer":{"type":"string","source":"html","selector":".wb-faq__answer","default":""},"initiallyOpen":{"type":"boolean","source":"attribute","attribute":"open","default":false}}},"headingLevel":{"type":"number","default":3},"useHeadingElement":{"type":"boolean","default":true},"singleOpen":{"type":"boolean","default":false},"groupId":{"type":"string","source":"attribute","selector":".wp-block-ordessa-faq-accordion","attribute":"data-wb-group"}},"xY":{"anchor":true,"html":false,"color":{"background":true,"text":true,"link":true,"gradients":false},"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontFamily":true,"__experimentalFontWeight":true},"spacing":{"margin":true,"padding":true,"blockGap":true},"__experimentalBorder":{"color":true,"radius":true,"style":true,"width":true}}}');a();const l=window.wp.element,c=window.wp.blockEditor,u=window.wp.components,d=window.wp.i18n,m=window.wp.primitives;r();var p=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),h=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})}),f=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),w=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),g=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),_=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),b=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});function v(e){return 0===function(e){let t="",n=0,s=!0;for(;s;){const r=e.indexOf("<",n),a=-1===r?-1:e.indexOf(">",r+1);-1===r||-1===a?s=!1:(t+=e.slice(n,r),n=a+1)}return t+e.slice(n)}(String(e||"")).replace(/ /g," ").trim().length}const q=["core/bold","core/italic","core/code"],x=["core/bold","core/italic","core/link","core/code","core/strikethrough","core/subscript","core/superscript"],E=(0,l.memo)(function({item:e,index:t,total:n,questionTag:s,isDragging:r,isDropTarget:o,registerQuestionRef:i,registerAnswerRef:m,onChange:p,onMove:h,onDuplicate:E,onRemove:y,onSplitFromAnswer:k,onFocusAnswer:C,onDragStart:N,onDragOver:O,onDrop:S,onDragEnd:R}){const T=(0,l.useRef)(null),A=v(e.question),D=["wb-faq-editor__item","wb-faq__item",r?"is-dragging":"",o?"is-drop-target":"",A?"is-incomplete":""].filter(Boolean).join(" "),B=(0,d.sprintf)(/* translators: 1: item number, 2: total item count. */ /* translators: 1: item number, 2: total item count. */2 (0,d.__)("Question %1$d of %2$d","ordessa"),t+1,n);return(0, a().createElement)("li",{ref:T,className:D,"data-index":t,onDragOver:e=>O(e,t),onDrop:e=>S(e,t)},(0,a().createElement)("div",{className:"wb-faq-editor__item-header"},(0,a().createElement)(u.Tooltip,{text:(0,d.__)("Drag to reorder","ordessa")},(0,a().createElement)("span",{className:"wb-faq-editor__drag-handle",draggable:"true","aria-hidden":"true",onDragStart:e=>N(e,t),onDragEnd:R},f)),(0,a().createElement)("span",{className:"wb-faq-editor__position"},B),(0,a().createElement)("div",{className:"wb-faq-editor__item-actions"},(0,a().createElement)(u.Button,{size:"small",icon:w,disabled:0===t,label:(0,d.sprintf)(/* translators: %d: item number. */ /* translators: %d: item number. */3 (0,d.__)("Move question %d up","ordessa"),t+1),onClick:()=> h(t,t-1)}),(0,a().createElement)(u.Button,{size:"small",icon:g,disabled:t===n-1,label:(0,d.sprintf)(/* translators: %d: item number. */ /* translators: %d: item number. */4 (0,d.__)("Move question %d down","ordessa"),t+1),onClick:()=> h(t,t+1)}),(0,a().createElement)(u.Button,{size:"small",icon:_,label:(0,d.sprintf)(/* translators: %d: item number. */ /* translators: %d: item number. */5 (0,d.__)("Duplicate question %d","ordessa"),t+1),onClick:()=>E(t)}),(0, a().createElement)(u.Button,{size:"small",icon:b,isDestructive:!0,label:(0,d.sprintf)(/* translators: %d: item number. */ /* translators: %d: item number. */6 (0,d.__)("Delete question %d","ordessa"),t+1),onClick:()=>y(t)}))),(0, a().createElement)(c.RichText,{identifier:`question-${e.id}`,ref:t=>i(e.id,t),tagName:s,className:"wb-faq-editor__question wb-faq__question wb-faq__heading",value:e.question,allowedFormats:q,withoutInteractiveFormatting:!0,placeholder:(0,d.__)("Question…","ordessa"),onChange:e=>p(t,{question:e}),onSplit:()=>C(t),onReplace:()=>{},__unstableOnSplitAtEnd:()=>C(t)}),A&&(0,a().createElement)("p",{className:"wb-faq-editor__item-warning"},(0,d.__)("This question has no text yet. Visitors will see an empty row they can click, with nothing to tell them what it opens.","ordessa")),(0,a().createElement)(c.RichText,{identifier:`answer-${e.id}`,ref:t=>m(e.id,t),tagName:"div",className:"wb-faq-editor__answer wb-faq__answer",value:e.answer,allowedFormats:x,placeholder:(0,d.__)("Answer…","ordessa"),onChange:e=>p(t,{answer:e}),onSplit:()=>k(t),onReplace:()=>{},__unstableOnSplitAtEnd:()=>k(t)}))});function y(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function k(){return"wb-"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function C(e,t){return{id:k(),question:e,answer:t,initiallyOpen:!1}}const N=/^\s*(?:q|question)\s*[:.)-]\s*(.*)$/i,O=/^\s*(?:a|answer)\s*[:.)-]\s*(.*)$/i,S=/^\s*(#{1,6})\s+(\S(?:.*\S)?)\s*$/,R=/^(\s*)\*\*\s*(q|a|question|answer)\s*([:.)-])\s*\*\*\s*/i,T=/^(\s*)\d{1,9}(?:[.)]|\s-)\s+/,A=/^(\s*)[-*+•‣▪–—]\s+/,D=/^\s*"[^"]*"\s*,\s*"[^"]*"\s*(?:,.*)?$/;function B(e){const t=t=>e.slice(t.length).trim().length>0,n=e.match(R);if(n&&t(n[0]))return`${n[1]}${n[2]}${n[3]} ${e.slice(n[0].length).trimStart()}`;const s=e.match(T);if(s&&t(s[0]))return s[1]+e.slice(s[0].length);const r=e.match(A);return r&&t(r[0])?r[1]+e.slice(r[0].length):e}function H(e){switch(e){case"qa":return(0,d.__)('Recognised as "Q:"/"A:" prefixes',"ordessa");case"markdown":return(0,d.__)("Recognised as Markdown headings","ordessa");case"tsv":return(0,d.__)("Recognised as a spreadsheet (tab-separated)","ordessa");case"alternating":return(0,d.__)("Recognised as alternating question and answer lines","ordessa");default:return null}}function j({onCommit:e,existingCount:t}){const[n,s]=(0,l.useState)(""),r=(0,l.useMemo)(()=>n.trim()?function(e){const t=function(e){return String(e).replace(/^\uFEFF/,"").replace(/\r\n?/g,"\n")}(e||""),n=t.split("\n").map((e,t)=>({text:B(e),line:t+1})),s=n.filter(e=>e.text.trim()),r=s.map(e=>e.text);if(!r.length)return{items:[],errors:[],format:"empty"};const a=function(e){let t=!1,n=!1,s=!1,r=0,a=0;for(const o of e)!t&&N.test(o)&&(t=!0),!n&&O.test(o)&&(n=!0),!s&&S.test(o)&&(s=!0),o.includes("\t")&&(r+=1),D.test(o)&&(a+=1);return{hasQ:t,hasA:n,hasHeading:s,tabbed:r,csvRows:a}}(r),o=function(e,t){return t.hasQ&&t.hasA?"qa":t.hasHeading?"markdown":t.tabbed>=2&&t.tabbed/e.length>=.8?"tsv":"alternating"}(r,a);let i;if("qa"===o)i=function(e){const t=[],n=[];let s=null,r=null;const a=()=>{if(!s)return;const e=s.question.join("\n").trim(),r=s.answer.join("\n").trim();e?r?t.push(C(y(e),y(r))):n.push({line:s.line,reason:(0,d.sprintf)(/* translators: %s: the question text that has no answer. */ /* translators: %s: the question text that has no answer. */7 (0,d.__)('Question "%s" has no matching answer.',"ordessa"),e)}):n.push({line:s.line,reason:(0,d.__)("An answer was found with no question before it.","ordessa")}),s=null};return e.forEach(({text:e,line:t})=>{const o=e.match(N);if(o)return a(),s={question:[o[1]],answer:[],line:t},void(r="question");const i=e.match(O);if(i)return s?(s.answer.push(i[1]),void(r="answer")):void n.push({line:t,reason:(0,d.__)("An answer was found before any question.","ordessa")});e.trim()&&(s?s["answer"===r?"answer":"question"].push(e.trim()):n.push({line:t,reason:(0,d.__)('Line is outside any question or answer. Prefix it with "Q:" or "A:".',"ordessa")}))}),a(),{items:t,errors:n}}(n);else if("markdown"===o)i=function(e){const t=[],n=[];let s=null;const r=()=>{if(!s)return;const e=s.answer.join("\n").trim();e?t.push(C(y(s.question),y(e))):n.push({line:s.line,reason:(0,d.sprintf)(/* translators: %s: the heading text that has no body. */ /* translators: %s: the heading text that has no body. */8 (0,d.__)('Heading "%s" has no answer text beneath it.',"ordessa"),s.question)}),s=null};return e.forEach(({text:e,line:t})=>{const a=e.match(S);if(a)return r(),void(s={question:a[2].trim(),answer:[],line:t});e.trim()&&(s?s.answer.push(e.trim()):n.push({line:t,reason:(0,d.__)("Text found before the first heading.","ordessa")}))}),r(),{items:t,errors:n}}(n);else if("tsv"===o)i=function(e){const t=[],n=[];return e.forEach(({text:e,line:s})=>{if(!e.trim())return;const r=e.indexOf("\t");if(-1===r)return void n.push({line:s,reason:(0,d.__)("This line has no tab-separated answer column. Every row of a pasted spreadsheet needs a question and an answer column.","ordessa")});const a=e.slice(0,r).trim();if(!a)return void n.push({line:s,reason:(0,d.__)("This row has an empty question column.","ordessa")});const o=e.slice(r+1).trim();o?t.push(C(y(a),y(o))):n.push({line:s,reason:(0,d.__)("This row has an empty answer column.","ordessa")})}),{items:t,errors:n}}(n);else{const e=/\n\s*\n/.test(t.trim()),o=function(e,t,n,s){return t.tabbed>0?{line:n.find(e=>e.text.includes("\t")).line,reason:(0,d.__)("This line contains tab characters, so this looks like spreadsheet content that is not consistently two columns. Nothing was imported, because the questions and answers could not be matched up reliably. Paste a sheet with exactly two columns — question and answer.","ordessa")}:t.csvRows>0&&t.csvRows/e.length>.5?{line:n.find(e=>D.test(e.text)).line,reason:(0,d.__)('This looks like comma-separated (CSV) text, which is not a supported paste format. Nothing was imported. Open the file in a spreadsheet and copy the two columns directly, or use "Q:" and "A:" prefixes.',"ordessa")}:s||e.length%2==0?null:{line:n[n.length-1].line,reason:(0,d.__)('This text has an odd number of lines, so the last question has no answer and the pairing before it cannot be trusted. Nothing was imported. Separate each question and answer pair with a blank line, or use "Q:" and "A:" prefixes.',"ordessa")}}(r,a,s,e);if(o)return{items:[],errors:[o],format:"unrecognised"};i=function(e,t){const n=[],s=[];if(t){const t=[];let r=[];return e.forEach(e=>{e.text.trim()?r.push(e):r.length&&(t.push(r),r=[])}),r.length&&t.push(r),t.forEach(e=>{if(e.length<2)return void s.push({line:e[0].line,reason:(0,d.__)("This block of text has a question but no answer line beneath it.","ordessa")});const t=e[0].text.trim(),r=e.slice(1).map(e=>e.text.trim()).join("\n");n.push(C(y(t),y(r)))}),{items:n,errors:s}}const r=e.filter(e=>e.text.trim());for(let e=0;e<r.length;e+=2){const t=r[e],a=r[e+1];if(!a){s.push({line:t.line,reason:(0,d.__)("This question has no answer line after it.","ordessa")});break}n.push(C(y(t.text.trim()),y(a.text.trim())))}return{items:n,errors:s}}(n,e)}return i.errors.length||i.items.length||i.errors.push({line:n.find(e=>e.text.trim()).line,reason:(0,d.__)("No question and answer pairs could be found in this text.","ordessa")}),{...i,format:o}}(n):null,[n]),o=!!r&&r.errors.length>0,i=!!r&&!o&&r.items.length>0,c=t=>{i&&(e(r.items,t),s(""))};return(0,a().createElement)("div",{className:"wb-faq-bulk wb-faq-editor__stack"},(0,a().createElement)("p",{className:"wb-faq-bulk__intro"},(0,d.__)('Paste your questions and answers. Recognised formats: "Q:"/"A:" prefixes, alternating lines separated by a blank line, Markdown "## Question" followed by the answer, or two columns copied from a spreadsheet.',"ordessa")),(0,a().createElement)(u.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,d.__)("Paste questions and answers","ordessa"),value:n,rows:8,placeholder:"Q: What is your refund policy?\nA: You can request a refund within 30 days.\n\nQ: Do you ship internationally?\nA: Yes, to most countries.",onChange:s}),o&&(0,a().createElement)(u.Notice,{status:"error",isDismissible:!1},(0,a().createElement)("p",null,(0,d.__)("Nothing was imported. Fix these lines and try again:","ordessa")),(0,a().createElement)("ul",{className:"wb-faq-bulk__errors"},r.errors.slice(0,5).map((e,t)=>(0,a().createElement)("li",{key:t},(0,d.sprintf)(/* translators: %d: line number in the pasted text. */ /* translators: %d: line number in the pasted text. */9 (0,d.__)("Line %d:","ordessa"),e.line)," ",e.reason))), r.errors.length>5&&(0,a().createElement)("p",null,(0,d.sprintf)(/* translators: %d: number of additional problems. */ /* translators: %d: number of additional problems. */10 (0,d.__)("…and %d more.","ordessa"), r.errors.length-5))),i&&(0,a().createElement)("div",{className:"wb-faq-bulk__preview"},(0,a().createElement)("p",{className:"wb-faq-bulk__count"},(0,d.sprintf)(/* translators: %d: number of question and answer pairs found. */ /* translators: %d: number of question and answer pairs found. */11 (0,d._n)("%d question and answer pair found.","%d question and answer pairs found.", r.items.length,"ordessa"),r.items.length)),!!H(r.format)&&(0,a().createElement)("p",{className:"wb-faq-bulk__format"},H(r.format)),(0,a().createElement)("ol",{className:"wb-faq-bulk__preview-list"},r.items.slice(0,3).map(e=>(0,a().createElement)("li",{key:e.id},(0,a().createElement)("strong",null,P(e.question)),(0,a().createElement)("span",null,P(e.answer))))),r.items.length>3&&(0,a().createElement)("p",{className:"wb-faq-bulk__more"},(0,d.sprintf)(/* translators: %d: number of pairs not shown in the preview. */ /* translators: %d: number of pairs not shown in the preview. */12 (0,d._n)("…and %d more pair.","…and %d more pairs.", r.items.length-3,"ordessa"),r.items.length-3)),(0,a().createElement)(u.Flex,{justify:"flex-start",gap:2},(0,a().createElement)(u.FlexItem,null,(0,a().createElement)(u.Button,{variant:"primary",onClick:()=>c("append")},(0,d.__)("Append","ordessa"))),(0,a().createElement)(u.FlexItem,null,(0,a().createElement)(u.Button,{variant:"secondary",isDestructive:t>0,onClick:()=>c("replace")},t>0?(0,d.sprintf)(/* translators: %d: number of existing questions that will be discarded. */ /* translators: %d: number of existing questions that will be discarded. */13 (0,d.__)("Replace all %d existing","ordessa"),t):(0,d.__)("Replace","ordessa"))))))}function P(e){return String(e).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}const V={2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"};function M(e){const{useHeadingElement:t,headingLevel:n}=e||{};return!1===t?"span":V[Number.parseInt(n,10)]||"h3"}const F="span",Q=new Map;function I(e){return`wb-faq-${String(e||"").replace(/[^a-zA-Z0-9_-]/g,"")||k()}`}const z=[{attributes:i.uK,supports:i.xY,save:function({attributes:e}){const{items:t=[],singleOpen:n=!1,groupId:s}=e,r=c.useBlockProps.save(),o=n?s||"wb-faq-group":void 0;return(0,a().createElement)("div",{...r,"data-wb-group":s||void 0},t.map(e=>(0,a().createElement)("details",{key:e.id,className:"wb-faq__item","data-wb-id":e.id,name:o,open:!!e.initiallyOpen},(0,a().createElement)("summary",{className:"wb-faq__question"},(0,a().createElement)("p",{className:"wb-faq__heading"},(0,a().createElement)(c.RichText.Content,{tagName:"span",className:"wb-faq__question-text",value:e.question}))),(0,a().createElement)(c.RichText.Content,{tagName:"div",className:"wb-faq__answer",value:e.answer}))))},isEligible:e=>!1===e?.useHeadingElement}];(0,o.registerBlockType)(i.UU,{edit:function({attributes:e,setAttributes:t,clientId:n}){const{items:s=[],headingLevel:r=3,useHeadingElement:o=!0,singleOpen:i=!1,groupId:m}=e,f=(0,c.useBlockProps)({className:"wb-faq-editor"}),w=M(e),g=(0,l.useRef)(s);g.current=s;const _=(0,l.useRef)({}),b=(0,l.useRef)({}),[q,x]=(0,l.useState)(null),[y,C]=(0,l.useState)(null),[N,O]=(0,l.useState)(null),S=(0,l.useCallback)((e,t)=>{t?_.current[e]=t:delete _.current[e]},[]),R=(0,l.useCallback)((e,t)=>{t?b.current[e]=t:delete b.current[e]},[]);(0,l.useEffect)(()=>{if(!q)return;const{id:e,field:t}=q,n=("answer"===t?b.current:_.current)[e];n&&"function"==typeof n.focus&&n.focus(),x(null)},[q,s]);const T=(0,l.useCallback)(e=>t({items:e}),[t]);(0,l.useEffect)(()=>{if(!m)return void t({groupId:I(n)});const e=Q.get(m);if(!e||e===n)return Q.set(m,n),()=>{Q.get(m)===n&&Q.delete(m)};t({groupId:I(n)})},[m,n,t]);const A=(0,l.useCallback)((e,t)=>{const n=g.current,s=n[e];s&&(Object.keys(t).every(e=>s[e]===t[e])||T(n.map((n,s)=>s===e?{...n,...t}:n)))},[T]),D=(0,l.useCallback)(e=>{const t=g.current,n={id:k(),question:"",answer:"",initiallyOpen:!1},s=[...t];s.splice("number"==typeof e?e:t.length,0,n),T(s),x({id:n.id,field:"question"})},[T]),B=(0,l.useCallback)((e,t)=>{const n=g.current;if(t<0||t>=n.length||e===t)return;const s=[...n],[r]=s.splice(e,1);s.splice(t,0,r),T(s)},[T]),H=(0,l.useCallback)(e=>{const t=g.current,n=t[e];if(!n)return;const s={...n,id:k()},r=[...t];r.splice(e+1,0,s),T(r),x({id:s.id,field:"question"})},[T]),P=(0,l.useCallback)(e=>{const t=g.current.filter((t,n)=>n!==e);T(t);const n=t[e]||t[e-1];n&&x({id:n.id,field:"question"})},[T]),V=(0,l.useCallback)(e=>{const t=g.current[e];t&&x({id:t.id,field:"answer"})},[]),z=(0,l.useCallback)(e=>{D(e+1)},[D]),L=(0,l.useCallback)((e,n)=>{t({items:"replace"===n?e:[...g.current,...e]})},[t]),$=(0,l.useCallback)((e,t)=>{C(t),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",String(t))},[]),G=(0,l.useCallback)((e,t)=>{null!==y&&(e.preventDefault(),e.dataTransfer.dropEffect="move",O(t))},[y]),Z=(0,l.useCallback)((e,t)=>{null!==y&&(e.preventDefault(),B(y,t),C(null),O(null))},[y,B]),U=(0,l.useCallback)(()=>{C(null),O(null)},[]),Y=(0,l.useMemo)(()=>s.reduce((e,t)=>v(t.question)?e+1:e,0),[s]),W=s.length>0&&!!s[0].initiallyOpen;return(0,a().createElement)(a().Fragment,null,(0,a().createElement)(c.BlockControls,null,(0,a().createElement)(u.ToolbarGroup,null,(0,a().createElement)(u.ToolbarButton,{icon:p,label:(0,d.__)("Add question","ordessa"),onClick:()=>D()},(0,d.__)("Add question","ordessa")),(0,a().createElement)(u.Dropdown,{popoverProps:{placement:"bottom-start"},contentClassName:"wb-faq-bulk__popover",renderToggle:({isOpen:e,onToggle:t})=>(0,a().createElement)(u.ToolbarButton,{icon:h,isPressed:e,onClick:t,label:(0,d.__)("Bulk add","ordessa")},(0,d.__)("Bulk add","ordessa")),renderContent:()=>(0,a().createElement)(j,{existingCount:s.length,onCommit:L})}))),(0,a().createElement)(c.InspectorControls,null,(0,a().createElement)(u.PanelBody,{title:(0,d.__)("FAQ settings","ordessa")},(0,a().createElement)(u.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,d.__)("Question element","ordessa"),help:o?(0,d.__)("Choose the level that keeps this page’s heading outline correct.","ordessa"):(0,d.__)("Questions are normally headings so screen-reader users can jump between them. “Plain text” removes them from the page outline — use it when the page’s heading structure is already correct without them.","ordessa"),value:o?String(r):F,options:[...[2,3,4,5,6].map(e=>({label:(0,d.sprintf)(/* translators: %d: heading level, e.g. 3 for H3. */ /* translators: %d: heading level, e.g. 3 for H3. */14 (0,d.__)("H%d","ordessa"),e),value:String(e)})),{label:(0,d.__)("Plain text (no heading)","ordessa"),value: F}],onChange:e=>t(e===F?{useHeadingElement:!1}:{useHeadingElement:!0,headingLevel:parseInt(e,10)})}),!o&&(0,a().createElement)(u.Notice,{status:"info",isDismissible:!1,className:"wb-faq-editor__outline-notice"},(0,d.__)("This question is not in the page outline. Screen-reader users who navigate by heading will not find it — which is the right choice when the page’s headings are already correct without it.","ordessa")),(0,a().createElement)(u.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,d.__)("Open the first item by default","ordessa"),checked:W,onChange:e=>{T(s.map((t,n)=>({...t,initiallyOpen:0===n&&e})))}}),(0,a().createElement)(u.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,d.__)("Allow only one item open at a time","ordessa"),help:(0,d.__)("If a visitor’s browser does not support this, every item still opens and closes on its own.","ordessa"),checked:i,onChange:e=>t({singleOpen:e})})),(0,a().createElement)(u.PanelBody,{title:(0,d.__)("Bulk add questions","ordessa"),initialOpen:0===s.length},(0,a().createElement)(j,{existingCount:s.length,onCommit:L}))),(0,a().createElement)("div",{...f},0===s.length?(0,a().createElement)(u.Placeholder,{label:(0,d.__)("FAQ & Accordion","ordessa"),instructions:(0,d.__)("Add questions one at a time, or paste a whole list at once. Everything stays inside this one block.","ordessa")},(0,a().createElement)("div",{className:"wb-faq-editor__stack"},(0,a().createElement)(u.Button,{variant:"primary",icon:p,onClick:()=>D()},(0,d.__)("Add question","ordessa")),(0,a().createElement)(j,{existingCount:0,onCommit:L}))):(0,a().createElement)(a().Fragment,null,Y>0&&(0,a().createElement)(u.Notice,{status:"warning",isDismissible:!1,className:"wb-faq-editor__warning"},(0,d.sprintf)(/* translators: %d: number of questions left blank. */ /* translators: %d: number of questions left blank. */15 (0,d._n)("%d question has no text yet. Visitors will see an empty row they can click, with nothing to tell them what it opens.","%d questions have no text yet. Visitors will see empty rows they can click, with nothing to tell them what they open.", Y,"ordessa"),Y)),(0,a().createElement)("ol",{className:"wb-faq-editor__list",onDragLeave:()=>O(null)},s.map((e,t)=>(0,a().createElement)(E,{key:e.id,item:e,index:t,total:s.length,questionTag:w,isDragging:y===t,isDropTarget:N===t,registerQuestionRef:S,registerAnswerRef:R,onChange:A,onMove:B,onDuplicate:H,onRemove:P,onFocusAnswer:V,onSplitFromAnswer:z,onDragStart:$,onDragOver:G,onDrop:Z,onDragEnd:U}))),(0,a().createElement)(u.Button,{className:"wb-faq-editor__add",variant:"secondary",icon:p,onClick:()=>D()},(0,d.__)("Add question","ordessa")))))},save:function({attributes:e}){const{items:t=[],singleOpen:n=!1,groupId:s}=e,r=M(e),o=c.useBlockProps.save(),i=n?s||"wb-faq-group":void 0;return(0,a().createElement)("div",{...o,"data-wb-group":s||void 0},t.map(e=>(0,a().createElement)("details",{key:e.id,className:"wb-faq__item","data-wb-id":e.id,name:i,open:!!e.initiallyOpen},(0,a().createElement)("summary",{className:"wb-faq__question"},(0,a().createElement)(r,{className:"wb-faq__heading"},(0,a().createElement)(c.RichText.Content,{tagName:"span",className:"wb-faq__question-text",value:e.question}))),(0,a().createElement)(c.RichText.Content,{tagName:"div",className:"wb-faq__answer",value:e.answer}))))},deprecated:z})}};const t={};function n(s){const r=t[s];if(void 0!==r)return r.exports;const a=t[s]={exports:{}};return e[s](a,a.exports,n),a.exports}n.m=e,(()=>{const e=[];n.O=(t,s,r,a)=>{if(s){a||=0;for(var o=e.length;o>0&&e[o-1][2]>a;o--)e[o]=e[o-1];return void(e[o]=[s,r,a])}let i=1/0;for(o=0;o<e.length;o++){let[s,r,a]=e[o],c=!0;for(var l=0;l<s.length;l++)1&a&&!(i>=a)||!Object.keys(n.O).every(e=>n.O[e](s[l]))?(c=!1,a<i&&(i=a)):s.splice(l--,1);if(c){e.splice(o--,1);const n=r();void 0!==n&&(t=n)}}return t}})(),n.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},n.o=(e,t)=>Object.hasOwn(e,t),(()=>{const e={715:0,987:0};n.O.j=t=>0===e[t];const t=(t,s)=>{let[r,a,o]=s;var i,l,c=0;if(r.some(t=>0!==e[t])){for(i in a)n.o(a,i)&&(n.m[i]=a[i]);if(o)var u=o(n)}for(t&&t(s);c<r.length;c++)l=r[c],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(u)},s=globalThis.webpackChunkordessa||=[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})();let s=n.O(void 0,[987],()=>n(647));s=n.O(s)})();1 (()=>{"use strict";var e={647(e,t,n){var s=n.cw(function(e,t){var n=r(),s=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,n){var r,l={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!i.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===l[r]&&(l[r]=t[r]);return{$$typeof:s,type:e,key:c,ref:u,props:l,_owner:o.current}}}),a=n.cw(function(e,t){e.exports=s()}),r=n.cw(function(e,t){e.exports=window.React});const o=window.wp.blocks,i=JSON.parse('{"UU":"ordessa/faq-accordion","uK":{"items":{"type":"array","default":[],"source":"query","selector":"details.wb-faq__item","query":{"id":{"type":"string","source":"attribute","attribute":"data-wb-id"},"question":{"type":"string","source":"html","selector":".wb-faq__question-text","default":""},"answer":{"type":"string","source":"html","selector":".wb-faq__answer","default":""},"initiallyOpen":{"type":"boolean","source":"attribute","attribute":"open","default":false}}},"headingLevel":{"type":"number","default":3},"useHeadingElement":{"type":"boolean","default":true},"singleOpen":{"type":"boolean","default":false},"emitSchema":{"type":"boolean","default":false},"schemaShape":{"type":"string","default":"questions"},"groupId":{"type":"string","source":"attribute","selector":".wp-block-ordessa-faq-accordion","attribute":"data-wb-group"}},"xY":{"anchor":true,"html":false,"color":{"background":true,"text":true,"link":true,"gradients":false},"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontFamily":true,"__experimentalFontWeight":true},"spacing":{"margin":true,"padding":true,"blockGap":true},"__experimentalBorder":{"color":true,"radius":true,"style":true,"width":true}}}');r();const l=window.wp.element,c=window.wp.blockEditor,u=window.wp.components,d=window.wp.i18n,m=window.wp.primitives;a();var h=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),p=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})}),f=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),g=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),w=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),_=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),b=(0,s().jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s().jsx)(m.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});function v(e){return 0===function(e){let t="",n=0,s=!0;for(;s;){const a=e.indexOf("<",n),r=-1===a?-1:e.indexOf(">",a+1);-1===a||-1===r?s=!1:(t+=e.slice(n,a),n=r+1)}return t+e.slice(n)}(String(e||"")).replace(/ /g," ").trim().length}const q=["core/bold","core/italic","core/code"],x=["core/bold","core/italic","core/link","core/code","core/strikethrough","core/subscript","core/superscript"],E=(0,l.memo)(function({item:e,index:t,total:n,questionTag:s,isDragging:a,isDropTarget:o,registerQuestionRef:i,registerAnswerRef:m,onChange:h,onMove:p,onDuplicate:E,onRemove:y,onSplitFromAnswer:k,onFocusAnswer:C,onDragStart:N,onDragOver:S,onDrop:O,onDragEnd:A}){const D=(0,l.useRef)(null),R=v(e.question),T=["wb-faq-editor__item","wb-faq__item",a?"is-dragging":"",o?"is-drop-target":"",R?"is-incomplete":""].filter(Boolean).join(" "),B=(0,d.sprintf)(/* translators: 1: item number, 2: total item count. */ /* translators: 1: item number, 2: total item count. */ 2 (0,d.__)("Question %1$d of %2$d","ordessa"),t+1,n);return(0,r().createElement)("li",{ref:D,className:T,"data-index":t,onDragOver:e=>S(e,t),onDrop:e=>O(e,t)},(0,r().createElement)("div",{className:"wb-faq-editor__item-header"},(0,r().createElement)(u.Tooltip,{text:(0,d.__)("Drag to reorder","ordessa")},(0,r().createElement)("span",{className:"wb-faq-editor__drag-handle",draggable:"true","aria-hidden":"true",onDragStart:e=>N(e,t),onDragEnd:A},f)),(0,r().createElement)("span",{className:"wb-faq-editor__position"},B),(0,r().createElement)("div",{className:"wb-faq-editor__item-actions"},(0,r().createElement)(u.Button,{size:"small",icon:g,disabled:0===t,label:(0,d.sprintf)(/* translators: %d: item number. */ /* translators: %d: item number. */ 3 (0,d.__)("Move question %d up","ordessa"),t+1),onClick:()=>p(t,t-1)}),(0,r().createElement)(u.Button,{size:"small",icon:w,disabled:t===n-1,label:(0,d.sprintf)(/* translators: %d: item number. */ /* translators: %d: item number. */ 4 (0,d.__)("Move question %d down","ordessa"),t+1),onClick:()=>p(t,t+1)}),(0,r().createElement)(u.Button,{size:"small",icon:_,label:(0,d.sprintf)(/* translators: %d: item number. */ /* translators: %d: item number. */ 5 (0,d.__)("Duplicate question %d","ordessa"),t+1),onClick:()=>E(t)}),(0,r().createElement)(u.Button,{size:"small",icon:b,isDestructive:!0,label:(0,d.sprintf)(/* translators: %d: item number. */ /* translators: %d: item number. */ 6 (0,d.__)("Delete question %d","ordessa"),t+1),onClick:()=>y(t)}))),(0,r().createElement)(c.RichText,{identifier:`question-${e.id}`,ref:t=>i(e.id,t),tagName:s,className:"wb-faq-editor__question wb-faq__question wb-faq__heading",value:e.question,allowedFormats:q,withoutInteractiveFormatting:!0,placeholder:(0,d.__)("Question…","ordessa"),onChange:e=>h(t,{question:e}),onSplit:()=>C(t),onReplace:()=>{},__unstableOnSplitAtEnd:()=>C(t)}),R&&(0,r().createElement)("p",{className:"wb-faq-editor__item-warning"},(0,d.__)("This question has no text yet. Visitors will see an empty row they can click, with nothing to tell them what it opens.","ordessa")),(0,r().createElement)(c.RichText,{identifier:`answer-${e.id}`,ref:t=>m(e.id,t),tagName:"div",className:"wb-faq-editor__answer wb-faq__answer",value:e.answer,allowedFormats:x,placeholder:(0,d.__)("Answer…","ordessa"),onChange:e=>h(t,{answer:e}),onSplit:()=>k(t),onReplace:()=>{},__unstableOnSplitAtEnd:()=>k(t)}))});function y(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function k(){return"wb-"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function C(e,t){return{id:k(),question:e,answer:t,initiallyOpen:!1}}const N=/^\s*(?:q|question)\s*[:.)-]\s*(.*)$/i,S=/^\s*(?:a|answer)\s*[:.)-]\s*(.*)$/i,O=/^\s*(#{1,6})\s+(\S(?:.*\S)?)\s*$/,A=/^(\s*)\*\*\s*(q|a|question|answer)\s*([:.)-])\s*\*\*\s*/i,D=/^(\s*)\d{1,9}(?:[.)]|\s-)\s+/,R=/^(\s*)[-*+•‣▪–—]\s+/,T=/^\s*"[^"]*"\s*,\s*"[^"]*"\s*(?:,.*)?$/;function B(e){const t=t=>e.slice(t.length).trim().length>0,n=e.match(A);if(n&&t(n[0]))return`${n[1]}${n[2]}${n[3]} ${e.slice(n[0].length).trimStart()}`;const s=e.match(D);if(s&&t(s[0]))return s[1]+e.slice(s[0].length);const a=e.match(R);return a&&t(a[0])?a[1]+e.slice(a[0].length):e}function H(e){switch(e){case"qa":return(0,d.__)('Recognised as "Q:"/"A:" prefixes',"ordessa");case"markdown":return(0,d.__)("Recognised as Markdown headings","ordessa");case"tsv":return(0,d.__)("Recognised as a spreadsheet (tab-separated)","ordessa");case"alternating":return(0,d.__)("Recognised as alternating question and answer lines","ordessa");default:return null}}function F({onCommit:e,existingCount:t}){const[n,s]=(0,l.useState)(""),a=(0,l.useMemo)(()=>n.trim()?function(e){const t=function(e){return String(e).replace(/^\uFEFF/,"").replace(/\r\n?/g,"\n")}(e||""),n=t.split("\n").map((e,t)=>({text:B(e),line:t+1})),s=n.filter(e=>e.text.trim()),a=s.map(e=>e.text);if(!a.length)return{items:[],errors:[],format:"empty"};const r=function(e){let t=!1,n=!1,s=!1,a=0,r=0;for(const o of e)!t&&N.test(o)&&(t=!0),!n&&S.test(o)&&(n=!0),!s&&O.test(o)&&(s=!0),o.includes("\t")&&(a+=1),T.test(o)&&(r+=1);return{hasQ:t,hasA:n,hasHeading:s,tabbed:a,csvRows:r}}(a),o=function(e,t){return t.hasQ&&t.hasA?"qa":t.hasHeading?"markdown":t.tabbed>=2&&t.tabbed/e.length>=.8?"tsv":"alternating"}(a,r);let i;if("qa"===o)i=function(e){const t=[],n=[];let s=null,a=null;const r=()=>{if(!s)return;const e=s.question.join("\n").trim(),a=s.answer.join("\n").trim();e?a?t.push(C(y(e),y(a))):n.push({line:s.line,reason:(0,d.sprintf)(/* translators: %s: the question text that has no answer. */ /* translators: %s: the question text that has no answer. */ 7 (0,d.__)('Question "%s" has no matching answer.',"ordessa"),e)}):n.push({line:s.line,reason:(0,d.__)("An answer was found with no question before it.","ordessa")}),s=null};return e.forEach(({text:e,line:t})=>{const o=e.match(N);if(o)return r(),s={question:[o[1]],answer:[],line:t},void(a="question");const i=e.match(S);if(i)return s?(s.answer.push(i[1]),void(a="answer")):void n.push({line:t,reason:(0,d.__)("An answer was found before any question.","ordessa")});e.trim()&&(s?s["answer"===a?"answer":"question"].push(e.trim()):n.push({line:t,reason:(0,d.__)('Line is outside any question or answer. Prefix it with "Q:" or "A:".',"ordessa")}))}),r(),{items:t,errors:n}}(n);else if("markdown"===o)i=function(e){const t=[],n=[];let s=null;const a=()=>{if(!s)return;const e=s.answer.join("\n").trim();e?t.push(C(y(s.question),y(e))):n.push({line:s.line,reason:(0,d.sprintf)(/* translators: %s: the heading text that has no body. */ /* translators: %s: the heading text that has no body. */ 8 (0,d.__)('Heading "%s" has no answer text beneath it.',"ordessa"),s.question)}),s=null};return e.forEach(({text:e,line:t})=>{const r=e.match(O);if(r)return a(),void(s={question:r[2].trim(),answer:[],line:t});e.trim()&&(s?s.answer.push(e.trim()):n.push({line:t,reason:(0,d.__)("Text found before the first heading.","ordessa")}))}),a(),{items:t,errors:n}}(n);else if("tsv"===o)i=function(e){const t=[],n=[];return e.forEach(({text:e,line:s})=>{if(!e.trim())return;const a=e.indexOf("\t");if(-1===a)return void n.push({line:s,reason:(0,d.__)("This line has no tab-separated answer column. Every row of a pasted spreadsheet needs a question and an answer column.","ordessa")});const r=e.slice(0,a).trim();if(!r)return void n.push({line:s,reason:(0,d.__)("This row has an empty question column.","ordessa")});const o=e.slice(a+1).trim();o?t.push(C(y(r),y(o))):n.push({line:s,reason:(0,d.__)("This row has an empty answer column.","ordessa")})}),{items:t,errors:n}}(n);else{const e=/\n\s*\n/.test(t.trim()),o=function(e,t,n,s){return t.tabbed>0?{line:n.find(e=>e.text.includes("\t")).line,reason:(0,d.__)("This line contains tab characters, so this looks like spreadsheet content that is not consistently two columns. Nothing was imported, because the questions and answers could not be matched up reliably. Paste a sheet with exactly two columns — question and answer.","ordessa")}:t.csvRows>0&&t.csvRows/e.length>.5?{line:n.find(e=>T.test(e.text)).line,reason:(0,d.__)('This looks like comma-separated (CSV) text, which is not a supported paste format. Nothing was imported. Open the file in a spreadsheet and copy the two columns directly, or use "Q:" and "A:" prefixes.',"ordessa")}:s||e.length%2==0?null:{line:n[n.length-1].line,reason:(0,d.__)('This text has an odd number of lines, so the last question has no answer and the pairing before it cannot be trusted. Nothing was imported. Separate each question and answer pair with a blank line, or use "Q:" and "A:" prefixes.',"ordessa")}}(a,r,s,e);if(o)return{items:[],errors:[o],format:"unrecognised"};i=function(e,t){const n=[],s=[];if(t){const t=[];let a=[];return e.forEach(e=>{e.text.trim()?a.push(e):a.length&&(t.push(a),a=[])}),a.length&&t.push(a),t.forEach(e=>{if(e.length<2)return void s.push({line:e[0].line,reason:(0,d.__)("This block of text has a question but no answer line beneath it.","ordessa")});const t=e[0].text.trim(),a=e.slice(1).map(e=>e.text.trim()).join("\n");n.push(C(y(t),y(a)))}),{items:n,errors:s}}const a=e.filter(e=>e.text.trim());for(let e=0;e<a.length;e+=2){const t=a[e],r=a[e+1];if(!r){s.push({line:t.line,reason:(0,d.__)("This question has no answer line after it.","ordessa")});break}n.push(C(y(t.text.trim()),y(r.text.trim())))}return{items:n,errors:s}}(n,e)}return i.errors.length||i.items.length||i.errors.push({line:n.find(e=>e.text.trim()).line,reason:(0,d.__)("No question and answer pairs could be found in this text.","ordessa")}),{...i,format:o}}(n):null,[n]),o=!!a&&a.errors.length>0,i=!!a&&!o&&a.items.length>0,c=t=>{i&&(e(a.items,t),s(""))};return(0,r().createElement)("div",{className:"wb-faq-bulk wb-faq-editor__stack"},(0,r().createElement)("p",{className:"wb-faq-bulk__intro"},(0,d.__)('Paste your questions and answers. Recognised formats: "Q:"/"A:" prefixes, alternating lines separated by a blank line, Markdown "## Question" followed by the answer, or two columns copied from a spreadsheet.',"ordessa")),(0,r().createElement)(u.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,d.__)("Paste questions and answers","ordessa"),value:n,rows:8,placeholder:"Q: What is your refund policy?\nA: You can request a refund within 30 days.\n\nQ: Do you ship internationally?\nA: Yes, to most countries.",onChange:s}),o&&(0,r().createElement)(u.Notice,{status:"error",isDismissible:!1},(0,r().createElement)("p",null,(0,d.__)("Nothing was imported. Fix these lines and try again:","ordessa")),(0,r().createElement)("ul",{className:"wb-faq-bulk__errors"},a.errors.slice(0,5).map((e,t)=>(0,r().createElement)("li",{key:t},(0,d.sprintf)(/* translators: %d: line number in the pasted text. */ /* translators: %d: line number in the pasted text. */ 9 (0,d.__)("Line %d:","ordessa"),e.line)," ",e.reason))),a.errors.length>5&&(0,r().createElement)("p",null,(0,d.sprintf)(/* translators: %d: number of additional problems. */ /* translators: %d: number of additional problems. */ 10 (0,d.__)("…and %d more.","ordessa"),a.errors.length-5))),i&&(0,r().createElement)("div",{className:"wb-faq-bulk__preview"},(0,r().createElement)("p",{className:"wb-faq-bulk__count"},(0,d.sprintf)(/* translators: %d: number of question and answer pairs found. */ /* translators: %d: number of question and answer pairs found. */ 11 (0,d._n)("%d question and answer pair found.","%d question and answer pairs found.",a.items.length,"ordessa"),a.items.length)),!!H(a.format)&&(0,r().createElement)("p",{className:"wb-faq-bulk__format"},H(a.format)),(0,r().createElement)("ol",{className:"wb-faq-bulk__preview-list"},a.items.slice(0,3).map(e=>(0,r().createElement)("li",{key:e.id},(0,r().createElement)("strong",null,Q(e.question)),(0,r().createElement)("span",null,Q(e.answer))))),a.items.length>3&&(0,r().createElement)("p",{className:"wb-faq-bulk__more"},(0,d.sprintf)(/* translators: %d: number of pairs not shown in the preview. */ /* translators: %d: number of pairs not shown in the preview. */ 12 (0,d._n)("…and %d more pair.","…and %d more pairs.",a.items.length-3,"ordessa"),a.items.length-3)),(0,r().createElement)(u.Flex,{justify:"flex-start",gap:2},(0,r().createElement)(u.FlexItem,null,(0,r().createElement)(u.Button,{variant:"primary",onClick:()=>c("append")},(0,d.__)("Append","ordessa"))),(0,r().createElement)(u.FlexItem,null,(0,r().createElement)(u.Button,{variant:"secondary",isDestructive:t>0,onClick:()=>c("replace")},t>0?(0,d.sprintf)(/* translators: %d: number of existing questions that will be discarded. */ /* translators: %d: number of existing questions that will be discarded. */ 13 (0,d.__)("Replace all %d existing","ordessa"),t):(0,d.__)("Replace","ordessa"))))))}function Q(e){return String(e).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}const j={2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"};function P(e){const{useHeadingElement:t,headingLevel:n}=e||{};return!1===t?"span":j[Number.parseInt(n,10)]||"h3"}const M="span",V=new Map;function I(e){return`wb-faq-${String(e||"").replace(/[^a-zA-Z0-9_-]/g,"")||k()}`}const z=[{attributes:i.uK,supports:i.xY,save:function({attributes:e}){const{items:t=[],singleOpen:n=!1,groupId:s}=e,a=c.useBlockProps.save(),o=n?s||"wb-faq-group":void 0;return(0,r().createElement)("div",{...a,"data-wb-group":s||void 0},t.map(e=>(0,r().createElement)("details",{key:e.id,className:"wb-faq__item","data-wb-id":e.id,name:o,open:!!e.initiallyOpen},(0,r().createElement)("summary",{className:"wb-faq__question"},(0,r().createElement)("p",{className:"wb-faq__heading"},(0,r().createElement)(c.RichText.Content,{tagName:"span",className:"wb-faq__question-text",value:e.question}))),(0,r().createElement)(c.RichText.Content,{tagName:"div",className:"wb-faq__answer",value:e.answer}))))},isEligible:e=>!1===e?.useHeadingElement}];(0,o.registerBlockType)(i.UU,{edit:function({attributes:e,setAttributes:t,clientId:n}){const{items:s=[],headingLevel:a=3,useHeadingElement:o=!0,singleOpen:i=!1,emitSchema:m=!1,schemaShape:f="questions",groupId:g}=e,w=(0,c.useBlockProps)({className:"wb-faq-editor"}),_=P(e),b=(0,l.useRef)(s);b.current=s;const q=(0,l.useRef)({}),x=(0,l.useRef)({}),[y,C]=(0,l.useState)(null),[N,S]=(0,l.useState)(null),[O,A]=(0,l.useState)(null),D=(0,l.useCallback)((e,t)=>{t?q.current[e]=t:delete q.current[e]},[]),R=(0,l.useCallback)((e,t)=>{t?x.current[e]=t:delete x.current[e]},[]);(0,l.useEffect)(()=>{if(!y)return;const{id:e,field:t}=y,n=("answer"===t?x.current:q.current)[e];n&&"function"==typeof n.focus&&n.focus(),C(null)},[y,s]);const T=(0,l.useCallback)(e=>t({items:e}),[t]);(0,l.useEffect)(()=>{if(!g)return void t({groupId:I(n)});const e=V.get(g);if(!e||e===n)return V.set(g,n),()=>{V.get(g)===n&&V.delete(g)};t({groupId:I(n)})},[g,n,t]);const B=(0,l.useCallback)((e,t)=>{const n=b.current,s=n[e];s&&(Object.keys(t).every(e=>s[e]===t[e])||T(n.map((n,s)=>s===e?{...n,...t}:n)))},[T]),H=(0,l.useCallback)(e=>{const t=b.current,n={id:k(),question:"",answer:"",initiallyOpen:!1},s=[...t];s.splice("number"==typeof e?e:t.length,0,n),T(s),C({id:n.id,field:"question"})},[T]),Q=(0,l.useCallback)((e,t)=>{const n=b.current;if(t<0||t>=n.length||e===t)return;const s=[...n],[a]=s.splice(e,1);s.splice(t,0,a),T(s)},[T]),j=(0,l.useCallback)(e=>{const t=b.current,n=t[e];if(!n)return;const s={...n,id:k()},a=[...t];a.splice(e+1,0,s),T(a),C({id:s.id,field:"question"})},[T]),z=(0,l.useCallback)(e=>{const t=b.current.filter((t,n)=>n!==e);T(t);const n=t[e]||t[e-1];n&&C({id:n.id,field:"question"})},[T]),L=(0,l.useCallback)(e=>{const t=b.current[e];t&&C({id:t.id,field:"answer"})},[]),$=(0,l.useCallback)(e=>{H(e+1)},[H]),G=(0,l.useCallback)((e,n)=>{t({items:"replace"===n?e:[...b.current,...e]})},[t]),Z=(0,l.useCallback)((e,t)=>{S(t),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",String(t))},[]),U=(0,l.useCallback)((e,t)=>{null!==N&&(e.preventDefault(),e.dataTransfer.dropEffect="move",A(t))},[N]),Y=(0,l.useCallback)((e,t)=>{null!==N&&(e.preventDefault(),Q(N,t),S(null),A(null))},[N,Q]),W=(0,l.useCallback)(()=>{S(null),A(null)},[]),K=(0,l.useMemo)(()=>s.reduce((e,t)=>v(t.question)?e+1:e,0),[s]),J=s.length>0&&!!s[0].initiallyOpen;return(0,r().createElement)(r().Fragment,null,(0,r().createElement)(c.BlockControls,null,(0,r().createElement)(u.ToolbarGroup,null,(0,r().createElement)(u.ToolbarButton,{icon:h,label:(0,d.__)("Add question","ordessa"),onClick:()=>H()},(0,d.__)("Add question","ordessa")),(0,r().createElement)(u.Dropdown,{popoverProps:{placement:"bottom-start"},contentClassName:"wb-faq-bulk__popover",renderToggle:({isOpen:e,onToggle:t})=>(0,r().createElement)(u.ToolbarButton,{icon:p,isPressed:e,onClick:t,label:(0,d.__)("Bulk add","ordessa")},(0,d.__)("Bulk add","ordessa")),renderContent:()=>(0,r().createElement)(F,{existingCount:s.length,onCommit:G})}))),(0,r().createElement)(c.InspectorControls,null,(0,r().createElement)(u.PanelBody,{title:(0,d.__)("FAQ settings","ordessa")},(0,r().createElement)(u.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,d.__)("Question element","ordessa"),help:o?(0,d.__)("Choose the level that keeps this page’s heading outline correct.","ordessa"):(0,d.__)("Questions are normally headings so screen-reader users can jump between them. “Plain text” removes them from the page outline — use it when the page’s heading structure is already correct without them.","ordessa"),value:o?String(a):M,options:[...[2,3,4,5,6].map(e=>({label:(0,d.sprintf)(/* translators: %d: heading level, e.g. 3 for H3. */ /* translators: %d: heading level, e.g. 3 for H3. */ 14 (0,d.__)("H%d","ordessa"),e),value:String(e)})),{label:(0,d.__)("Plain text (no heading)","ordessa"),value:M}],onChange:e=>t(e===M?{useHeadingElement:!1}:{useHeadingElement:!0,headingLevel:parseInt(e,10)})}),!o&&(0,r().createElement)(u.Notice,{status:"info",isDismissible:!1,className:"wb-faq-editor__outline-notice"},(0,d.__)("This question is not in the page outline. Screen-reader users who navigate by heading will not find it — which is the right choice when the page’s headings are already correct without it.","ordessa")),(0,r().createElement)(u.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,d.__)("Open the first item by default","ordessa"),checked:J,onChange:e=>{T(s.map((t,n)=>({...t,initiallyOpen:0===n&&e})))}}),(0,r().createElement)(u.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,d.__)("Allow only one item open at a time","ordessa"),help:(0,d.__)("If a visitor’s browser does not support this, every item still opens and closes on its own.","ordessa"),checked:i,onChange:e=>t({singleOpen:e})}),(0,r().createElement)(u.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,d.__)("Add FAQPage structured data","ordessa"),help:m?(0,d.__)("Enable this on only one FAQ block per page. Google no longer shows FAQ rich results, so this will not add search snippets — it describes your questions to AI answer engines and other tools that read structured data.","ordessa"):(0,d.__)("Adds hidden FAQPage data describing your questions. Google no longer shows FAQ rich results, so expect no change in how your page looks in search.","ordessa"),checked:m,onChange:e=>t({emitSchema:e})}),m&&(0,r().createElement)(u.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,d.__)("Structured data format","ordessa"),help:"faqpage"===f?(0,d.__)("Describes the whole page as an FAQ page. Only use this if no SEO plugin is active — Yoast, Rank Math and All in One SEO already describe the page, and this would describe it a second time.","ordessa"):(0,d.__)("Safe with every SEO plugin. Describes each question on its own without claiming what kind of page this is.","ordessa"),value:f,options:[{label:(0,d.__)("Questions only (recommended)","ordessa"),value:"questions"},{label:(0,d.__)("Full FAQ page","ordessa"),value:"faqpage"}],onChange:e=>t({schemaShape:e})}),m&&"faqpage"===f&&(0,r().createElement)(u.Notice,{status:"warning",isDismissible:!1,className:"wb-faq-editor__schema-notice"},(0,d.__)("If an SEO plugin is active, switch to “Questions only” — otherwise this page gets described twice, which can stop search engines trusting either description.","ordessa"))),(0,r().createElement)(u.PanelBody,{title:(0,d.__)("Bulk add questions","ordessa"),initialOpen:0===s.length},(0,r().createElement)(F,{existingCount:s.length,onCommit:G}))),(0,r().createElement)("div",{...w},0===s.length?(0,r().createElement)(u.Placeholder,{label:(0,d.__)("FAQ & Accordion","ordessa"),instructions:(0,d.__)("Add questions one at a time, or paste a whole list at once. Everything stays inside this one block.","ordessa")},(0,r().createElement)("div",{className:"wb-faq-editor__stack"},(0,r().createElement)(u.Button,{variant:"primary",icon:h,onClick:()=>H()},(0,d.__)("Add question","ordessa")),(0,r().createElement)(F,{existingCount:0,onCommit:G}))):(0,r().createElement)(r().Fragment,null,K>0&&(0,r().createElement)(u.Notice,{status:"warning",isDismissible:!1,className:"wb-faq-editor__warning"},(0,d.sprintf)(/* translators: %d: number of questions left blank. */ /* translators: %d: number of questions left blank. */ 15 (0,d._n)("%d question has no text yet. Visitors will see an empty row they can click, with nothing to tell them what it opens.","%d questions have no text yet. Visitors will see empty rows they can click, with nothing to tell them what they open.",K,"ordessa"),K)),(0,r().createElement)("ol",{className:"wb-faq-editor__list",onDragLeave:()=>A(null)},s.map((e,t)=>(0,r().createElement)(E,{key:e.id,item:e,index:t,total:s.length,questionTag:_,isDragging:N===t,isDropTarget:O===t,registerQuestionRef:D,registerAnswerRef:R,onChange:B,onMove:Q,onDuplicate:j,onRemove:z,onFocusAnswer:L,onSplitFromAnswer:$,onDragStart:Z,onDragOver:U,onDrop:Y,onDragEnd:W}))),(0,r().createElement)(u.Button,{className:"wb-faq-editor__add",variant:"secondary",icon:h,onClick:()=>H()},(0,d.__)("Add question","ordessa")))))},save:function({attributes:e}){const{items:t=[],singleOpen:n=!1,groupId:s}=e,a=P(e),o=c.useBlockProps.save(),i=n?s||"wb-faq-group":void 0;return(0,r().createElement)("div",{...o,"data-wb-group":s||void 0},t.map(e=>(0,r().createElement)("details",{key:e.id,className:"wb-faq__item","data-wb-id":e.id,name:i,open:!!e.initiallyOpen},(0,r().createElement)("summary",{className:"wb-faq__question"},(0,r().createElement)(a,{className:"wb-faq__heading"},(0,r().createElement)(c.RichText.Content,{tagName:"span",className:"wb-faq__question-text",value:e.question}))),(0,r().createElement)(c.RichText.Content,{tagName:"div",className:"wb-faq__answer",value:e.answer}))))},deprecated:z})}};const t={};function n(s){const a=t[s];if(void 0!==a)return a.exports;const r=t[s]={exports:{}};return e[s](r,r.exports,n),r.exports}n.m=e,(()=>{const e=[];n.O=(t,s,a,r)=>{if(s){r||=0;for(var o=e.length;o>0&&e[o-1][2]>r;o--)e[o]=e[o-1];return void(e[o]=[s,a,r])}let i=1/0;for(o=0;o<e.length;o++){let[s,a,r]=e[o],c=!0;for(var l=0;l<s.length;l++)1&r&&!(i>=r)||!Object.keys(n.O).every(e=>n.O[e](s[l]))?(c=!1,r<i&&(i=r)):s.splice(l--,1);if(c){e.splice(o--,1);const n=a();void 0!==n&&(t=n)}}return t}})(),n.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},n.o=(e,t)=>Object.hasOwn(e,t),(()=>{const e={715:0,987:0};n.O.j=t=>0===e[t];const t=(t,s)=>{let[a,r,o]=s;var i,l,c=0;if(a.some(t=>0!==e[t])){for(i in r)n.o(r,i)&&(n.m[i]=r[i]);if(o)var u=o(n)}for(t&&t(s);c<a.length;c++)l=a[c],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(u)},s=globalThis.webpackChunkordessa||=[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})();let s=n.O(void 0,[987],()=>n(647));s=n.O(s)})(); -
ordessa/trunk/ordessa.php
r3714345 r3714904 4 4 * Plugin URI: https://wordpress.org/plugins/ordessa/ 5 5 * Description: An FAQ and accordion block that holds many questions in one block — add, reorder and bulk-paste 20 questions without inserting 20 blocks. 6 * Version: 0.1. 56 * Version: 0.1.6 7 7 * Requires at least: 6.5 8 8 * Requires PHP: 7.4 … … 19 19 } 20 20 21 define( 'ORDESSA_VERSION', '0.1. 5' );21 define( 'ORDESSA_VERSION', '0.1.6' ); 22 22 define( 'ORDESSA_PATH', plugin_dir_path( __FILE__ ) ); 23 24 /* 25 * Optional FAQ structured data, printed into wp_head. Deliberately not part of 26 * the block's static save() — see includes/schema.php for why (wp_kses_post 27 * strips <script> for lower-capability users and leaks the raw JSON as text). 28 */ 29 require_once ORDESSA_PATH . 'includes/schema.php'; 23 30 24 31 /** -
ordessa/trunk/package.json
r3714345 r3714904 1 1 { 2 2 "name": "ordessa", 3 "version": "0.1. 5",3 "version": "0.1.6", 4 4 "description": "Focused, reliable Gutenberg blocks. FAQ & Accordion (Bulk Add).", 5 5 "license": "GPL-2.0-or-later", -
ordessa/trunk/readme.txt
r3714345 r3714904 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 0.1. 57 Stable tag: 0.1.6 8 8 License: GPL-2.0-or-later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 47 47 * **No JavaScript required on the front end.** An optional script of well under 2 KB is used only for the "allow only one open at a time" option, and everything still opens and closes without it. 48 48 * **No per-page inline CSS.** One small stylesheet, loaded only on pages that actually use the block. A page with ten of these blocks loads exactly the same CSS as a page with one. 49 * **Optional structured data.** Off by default. Adds schema.org data describing your questions, in a format that is safe alongside SEO plugins. Google retired FAQ rich results in May 2026, so this is for machine readability — not search snippets. 49 50 * **Inherits your theme.** Typography and colours come from your theme rather than being overridden, and the question element is yours to choose — a heading (H2 to H6) so the block does not break your document outline, or plain text where a heading would be wrong. 50 51 * **No settings page and no database rows.** Nothing to configure, nothing left behind. … … 79 80 80 81 == Frequently Asked Questions == 82 83 = Does this add FAQ schema / structured data? = 84 85 Yes, optionally — it is off by default, and you should know what it does and does not do before switching it on. 86 87 Google **retired FAQ rich results on 7 May 2026**. The expandable question boxes that used to appear under a search listing are gone, for every site, including the government and health sites that kept them after Google's 2023 restriction. Google's note is on its own [FAQPage documentation](https://developers.google.com/search/docs/appearance/structured-data/faqpage). So enabling this will **not** change how your page looks in Google. 88 89 What it still does: [FAQPage](https://schema.org/FAQPage) and `Question` remain valid, widely used schema.org types. Google still reads them to understand what your page covers, and AI answer engines read the same data when deciding what to quote. That is the reason to enable it — not search snippets. 90 91 Enable it under **FAQ settings → Add FAQPage structured data**, on one block per page. 92 93 = Will this conflict with Yoast, Rank Math or All in One SEO? = 94 95 Not in the default setting. There are two formats: 96 97 * **Questions only** (default) — describes each question on its own. It makes no claim about what kind of page this is, so it cannot compete with your SEO plugin's own description. Safe to leave on. 98 * **Full FAQ page** — emits `FAQPage`, which is a subtype of `WebPage`. We tested this against Yoast SEO on a live site: the page ends up described as both a `WebPage` (by Yoast) and an `FAQPage` (by this block). Only use this format when no SEO plugin is active. The block shows a warning when you select it. 99 100 If your SEO plugin already outputs FAQ data for a page, use one or the other, not both. 101 81 102 82 103 = Do I need a separate block for each question? = … … 164 185 165 186 == Changelog == 187 188 = 0.1.6 = 189 * Added optional structured data (schema.org) for your questions, off by default. Enable it per block under **FAQ settings → Add FAQPage structured data**. 190 * Please read this before enabling it: Google **retired FAQ rich results on 7 May 2026**, so this will not give you the expandable FAQ boxes under your search listing. Those are gone for every site. Google's own note is on its [FAQPage documentation](https://developers.google.com/search/docs/appearance/structured-data/faqpage). The markup is still valid and still useful — Google reads it to understand your page, and AI answer engines read it when deciding what to cite — but it will not change how your page looks in search, and this plugin will never claim otherwise. 191 * Two formats are offered because of a real conflict we measured. "Questions only" (the default) is safe alongside every SEO plugin. "Full FAQ page" emits `FAQPage`, which is a `WebPage` subtype — tested against Yoast SEO on a live site, that describes the same URL as both a `WebPage` and an `FAQPage`. Rank Math and All in One SEO work the same way. Only use it when no SEO plugin is active; the block warns you when you pick it. 192 * The data is written into the page head, the same place SEO plugins write theirs — not into your post content. This matters: `<script>` is not allowed in post content for Contributors and Authors, so writing it there would have stripped the tag and left the raw data visible on the page. It also keeps it out of your RSS feed. 166 193 167 194 = 0.1.5 = … … 200 227 == Upgrade Notice == 201 228 229 = 0.1.6 = 230 Adds optional schema.org structured data for your questions, off by default. Note that Google retired FAQ rich results in May 2026, so this will not add search snippets — see the changelog. 231 202 232 = 0.1.5 = 203 233 Fixes the non-heading question option, which emitted an invalid `<p>` inside `<summary>`. Affected blocks migrate to `<span>` automatically with no content loss and no action needed. Blocks using headings are unaffected. -
ordessa/trunk/src/blocks/foldout/block.json
r3714345 r3714904 16 16 "bulk" 17 17 ], 18 "version": "0.1. 5",18 "version": "0.1.6", 19 19 "textdomain": "ordessa", 20 20 "attributes": { … … 62 62 "default": false 63 63 }, 64 "emitSchema": { 65 "type": "boolean", 66 "default": false 67 }, 68 "schemaShape": { 69 "type": "string", 70 "default": "questions" 71 }, 64 72 "groupId": { 65 73 "type": "string", -
ordessa/trunk/src/blocks/foldout/edit.js
r3714345 r3714904 96 96 useHeadingElement = true, 97 97 singleOpen = false, 98 emitSchema = false, 99 schemaShape = 'questions', 98 100 groupId, 99 101 } = attributes; … … 575 577 } 576 578 /> 579 580 { /* 581 * Opt-in, off by default, and honest about what it does. 582 * Google retired the FAQ rich result on 7 May 2026, so the 583 * search-snippet payoff people associate with this no longer 584 * exists for any site; the remaining value is machine-readable 585 * Q&A for AI answer engines. Saying that here stops the toggle 586 * reading as an SEO win (docs/ROADMAP.md: never market on it). 587 */ } 588 <ToggleControl 589 __nextHasNoMarginBottom 590 label={ __( 'Add FAQPage structured data', 'ordessa' ) } 591 help={ 592 emitSchema 593 ? __( 594 'Enable this on only one FAQ block per page. Google no longer shows FAQ rich results, so this will not add search snippets — it describes your questions to AI answer engines and other tools that read structured data.', 595 'ordessa' 596 ) 597 : __( 598 'Adds hidden FAQPage data describing your questions. Google no longer shows FAQ rich results, so expect no change in how your page looks in search.', 599 'ordessa' 600 ) 601 } 602 checked={ emitSchema } 603 onChange={ ( value ) => 604 setAttributes( { emitSchema: value } ) 605 } 606 /> 607 608 { emitSchema && ( 609 <SelectControl 610 __nextHasNoMarginBottom 611 __next40pxDefaultSize 612 label={ __( 'Structured data format', 'ordessa' ) } 613 help={ 614 schemaShape === 'faqpage' 615 ? __( 616 'Describes the whole page as an FAQ page. Only use this if no SEO plugin is active — Yoast, Rank Math and All in One SEO already describe the page, and this would describe it a second time.', 617 'ordessa' 618 ) 619 : __( 620 'Safe with every SEO plugin. Describes each question on its own without claiming what kind of page this is.', 621 'ordessa' 622 ) 623 } 624 value={ schemaShape } 625 options={ [ 626 { 627 label: __( 628 'Questions only (recommended)', 629 'ordessa' 630 ), 631 value: 'questions', 632 }, 633 { 634 label: __( 'Full FAQ page', 'ordessa' ), 635 value: 'faqpage', 636 }, 637 ] } 638 onChange={ ( value ) => 639 setAttributes( { schemaShape: value } ) 640 } 641 /> 642 ) } 643 644 { emitSchema && schemaShape === 'faqpage' && ( 645 <Notice 646 status="warning" 647 isDismissible={ false } 648 className="wb-faq-editor__schema-notice" 649 > 650 { __( 651 'If an SEO plugin is active, switch to “Questions only” — otherwise this page gets described twice, which can stop search engines trusting either description.', 652 'ordessa' 653 ) } 654 </Notice> 655 ) } 577 656 </PanelBody> 578 657 -
ordessa/trunk/src/blocks/foldout/editor.scss
r3714345 r3714904 164 164 } 165 165 166 // Duplicate-schema warning, shown in the settings panel while FAQPage output is 167 // enabled. Same sidebar-rendering reason as the outline notice above. 168 .wb-faq-editor__schema-notice { 169 margin: 8px 0 0; 170 } 171 166 172 .wb-faq-bulk { 167 173 max-width: 380px;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)